]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] ARM: OMAP: Add minimal 24xx support
authorPaul Mundt <paul.mundt@nokia.com>
Mon, 15 Aug 2005 08:08:28 +0000 (01:08 -0700)
committerTony Lindgren <tony@atomide.com>
Mon, 15 Aug 2005 08:08:28 +0000 (01:08 -0700)
Add minimal 24xx support

31 files changed:
arch/arm/Kconfig
arch/arm/Makefile
arch/arm/boot/compressed/head.S
arch/arm/configs/omap_generic_2420_defconfig [new file with mode: 0644]
arch/arm/mach-omap2/Makefile [new file with mode: 0644]
arch/arm/mach-omap2/Makefile.boot [new file with mode: 0644]
arch/arm/mach-omap2/board-generic.c [new file with mode: 0644]
arch/arm/mach-omap2/board-h4.c [new file with mode: 0644]
arch/arm/mach-omap2/io.c [new file with mode: 0644]
arch/arm/mach-omap2/irq.c [new file with mode: 0644]
arch/arm/mach-omap2/serial.c [new file with mode: 0644]
arch/arm/mach-omap2/timer-gp.c [new file with mode: 0644]
arch/arm/mm/Kconfig
arch/arm/mm/flush.c
arch/arm/mm/proc-v6.S
arch/arm/plat-omap/gpio-switch.c
arch/arm/plat-omap/gpio.c
drivers/serial/8250.c
include/asm-arm/arch-omap/board-h4.h
include/asm-arm/arch-omap/debug-macro.S
include/asm-arm/arch-omap/entry-macro.S
include/asm-arm/arch-omap/gpio.h
include/asm-arm/arch-omap/hardware.h
include/asm-arm/arch-omap/io.h
include/asm-arm/arch-omap/irqs.h
include/asm-arm/arch-omap/memory.h
include/asm-arm/arch-omap/omap24xx.h [new file with mode: 0644]
include/asm-arm/arch-omap/pm.h
include/asm-arm/arch-omap/serial.h [new file with mode: 0644]
include/asm-arm/arch-omap/uncompress.h
include/asm-arm/cacheflush.h

index e12e730d5252e93383d02f0f696e97bdafe293f5..e22148d0aaafe7de798d847cb734b742fddb4378 100644 (file)
@@ -227,6 +227,8 @@ source "arch/arm/plat-omap/Kconfig"
 
 source "arch/arm/mach-omap1/Kconfig"
 
+source "arch/arm/mach-omap2/Kconfig"
+
 source "arch/arm/mach-s3c2410/Kconfig"
 
 source "arch/arm/mach-lh7a40x/Kconfig"
index 67f1453ade05e9afc085a7b0fb93e518dd053af8..afc3858b6a8e3327e270afe8a2dbbb540ce62a97 100644 (file)
@@ -53,7 +53,7 @@ tune-$(CONFIG_CPU_ARM926T)    :=-mtune=arm9tdmi
 tune-$(CONFIG_CPU_SA110)       :=-mtune=strongarm110
 tune-$(CONFIG_CPU_SA1100)      :=-mtune=strongarm1100
 tune-$(CONFIG_CPU_XSCALE)      :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale
-tune-$(CONFIG_CPU_V6)          :=-mtune=strongarm
+tune-$(CONFIG_CPU_V6)          :=-mtune=arm1136jf-s
 
 # Need -Uarm for gcc < 3.x
 CFLAGS_ABI     :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,)
@@ -92,6 +92,7 @@ textaddr-$(CONFIG_ARCH_FORTUNET)   := 0xc0008000
  machine-$(CONFIG_ARCH_IXP4XX)    := ixp4xx
  machine-$(CONFIG_ARCH_IXP2000)    := ixp2000
  machine-$(CONFIG_ARCH_OMAP1)     := omap1
+ machine-$(CONFIG_ARCH_OMAP2)     := omap2
   incdir-$(CONFIG_ARCH_OMAP)      := omap
  machine-$(CONFIG_ARCH_S3C2410)           := s3c2410
  machine-$(CONFIG_ARCH_LH7A40X)           := lh7a40x
index 7c7f475e213ea3f85779165679e06feb1aea7109..029c5d3f132b6816cacb30e425f655d8173447b6 100644 (file)
                add     \rb, \rb, #0x00010000   @ Ser1
 #  endif
                .endm
+#elif defined(CONFIG_ARCH_OMAP2)
+               .macro  loadsp, rb
+               mov     \rb, #0x48000000        @ physical base address
+               add     \rb, \rb, #0x0006a000
+#ifdef CONFIG_OMAP_LL_DEBUG_UART2
+               add     \rb, \rb, #0x00002000
+#endif
+#ifdef CONFIG_OMAP_LL_DEBUG_UART3
+               add     \rb, \rb, #0x00004000
+#endif
+               .endm
+               .macro  writeb, rb
+               strb    \rb, [r3]
+               .endm
 #elif defined(CONFIG_ARCH_IOP331)
                .macro loadsp, rb
                 mov    \rb, #0xff000000
diff --git a/arch/arm/configs/omap_generic_2420_defconfig b/arch/arm/configs/omap_generic_2420_defconfig
new file mode 100644 (file)
index 0000000..94d4659
--- /dev/null
@@ -0,0 +1,555 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.13-rc6-omap1
+# Thu Aug 11 10:05:10 2005
+#
+CONFIG_ARM=y
+CONFIG_MMU=y
+CONFIG_UID16=y
+CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_CALIBRATE_DELAY=y
+
+#
+# Code maturity level options
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_CLEAN_COMPILE=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+
+#
+# General setup
+#
+CONFIG_LOCALVERSION=""
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+# CONFIG_BSD_PROCESS_ACCT is not set
+CONFIG_SYSCTL=y
+CONFIG_HOTPLUG=y
+# CONFIG_IKCONFIG is not set
+# CONFIG_EMBEDDED is not set
+CONFIG_KALLSYMS=y
+# CONFIG_KALLSYMS_ALL is not set
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SHMEM=y
+CONFIG_CC_ALIGN_FUNCTIONS=0
+CONFIG_CC_ALIGN_LABELS=0
+CONFIG_CC_ALIGN_LOOPS=0
+CONFIG_CC_ALIGN_JUMPS=0
+# CONFIG_TINY_SHMEM is not set
+CONFIG_BASE_SMALL=0
+
+#
+# Loadable module support
+#
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+CONFIG_OBSOLETE_MODPARM=y
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+# CONFIG_KMOD is not set
+
+#
+# System Type
+#
+# CONFIG_ARCH_CLPS7500 is not set
+# CONFIG_ARCH_CLPS711X is not set
+# CONFIG_ARCH_CO285 is not set
+# CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_CAMELOT is not set
+# CONFIG_ARCH_FOOTBRIDGE is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_IOP3XX is not set
+# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_PXA is not set
+# CONFIG_ARCH_RPC is not set
+# CONFIG_ARCH_SA1100 is not set
+# CONFIG_ARCH_S3C2410 is not set
+# CONFIG_ARCH_SHARK is not set
+# CONFIG_ARCH_LH7A40X is not set
+CONFIG_ARCH_OMAP=y
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_AAEC2000 is not set
+
+#
+# TI OMAP Implementations
+#
+# CONFIG_ARCH_OMAP1 is not set
+CONFIG_ARCH_OMAP2=y
+
+#
+# OMAP Feature Selections
+#
+# CONFIG_OMAP_RESET_CLOCKS is not set
+CONFIG_OMAP_BOOT_TAG=y
+# CONFIG_OMAP_BOOT_REASON is not set
+# CONFIG_OMAP_GPIO_SWITCH is not set
+# CONFIG_OMAP_MUX is not set
+CONFIG_OMAP_MPU_TIMER=y
+# CONFIG_OMAP_32K_TIMER is not set
+# CONFIG_OMAP_LL_DEBUG_UART1 is not set
+# CONFIG_OMAP_LL_DEBUG_UART2 is not set
+CONFIG_OMAP_LL_DEBUG_UART3=y
+CONFIG_MACH_OMAP_GENERIC=y
+
+#
+# OMAP Core Type
+#
+CONFIG_ARCH_OMAP24XX=y
+CONFIG_ARCH_OMAP2420=y
+
+#
+# OMAP Board Type
+#
+# CONFIG_MACH_OMAP_H4 is not set
+
+#
+# Processor Type
+#
+CONFIG_CPU_32=y
+CONFIG_CPU_V6=y
+CONFIG_CPU_32v6=y
+CONFIG_CPU_ABRT_EV6=y
+CONFIG_CPU_CACHE_V6=y
+CONFIG_CPU_CACHE_VIPT=y
+CONFIG_CPU_COPY_V6=y
+CONFIG_CPU_TLB_V6=y
+
+#
+# Processor Features
+#
+CONFIG_ARM_THUMB=y
+
+#
+# Bus support
+#
+CONFIG_ISA_DMA_API=y
+
+#
+# PCCARD (PCMCIA/CardBus) support
+#
+# CONFIG_PCCARD is not set
+
+#
+# Kernel Features
+#
+# CONFIG_SMP is not set
+# CONFIG_PREEMPT is not set
+# CONFIG_NO_IDLE_HZ is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_LEDS=y
+# CONFIG_LEDS_TIMER is not set
+# CONFIG_LEDS_CPU is not set
+CONFIG_ALIGNMENT_TRAP=y
+
+#
+# Boot options
+#
+CONFIG_ZBOOT_ROM_TEXT=0x10C08000
+CONFIG_ZBOOT_ROM_BSS=0x10200000
+# CONFIG_ZBOOT_ROM is not set
+CONFIG_CMDLINE=""
+# CONFIG_XIP_KERNEL is not set
+
+#
+# Floating point emulation
+#
+
+#
+# At least one emulation must be selected
+#
+CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
+# CONFIG_FPE_FASTFPE is not set
+# CONFIG_VFP is not set
+
+#
+# Userspace binary formats
+#
+CONFIG_BINFMT_ELF=y
+# CONFIG_BINFMT_AOUT is not set
+# CONFIG_BINFMT_MISC is not set
+# CONFIG_ARTHUR is not set
+
+#
+# Power management options
+#
+# CONFIG_PM is not set
+
+#
+# Networking
+#
+# CONFIG_NET is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+# CONFIG_DEBUG_DRIVER is not set
+
+#
+# Memory Technology Devices (MTD)
+#
+# CONFIG_MTD is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# Block devices
+#
+# CONFIG_BLK_DEV_COW_COMMON is not set
+# CONFIG_BLK_DEV_LOOP is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=4096
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+# CONFIG_CDROM_PKTCDVD is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+
+#
+# SCSI device support
+#
+# CONFIG_SCSI is not set
+
+#
+# Multi-device support (RAID and LVM)
+#
+# CONFIG_MD is not set
+
+#
+# Fusion MPT device support
+#
+# CONFIG_FUSION is not set
+
+#
+# IEEE 1394 (FireWire) support
+#
+
+#
+# I2O device support
+#
+
+#
+# Network device support
+#
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+
+#
+# ISDN subsystem
+#
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+CONFIG_INPUT_MOUSEDEV_PSAUX=y
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_JOYDEV is not set
+# CONFIG_INPUT_TSDEV is not set
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+CONFIG_SERIO_SERPORT=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+CONFIG_SERIAL_8250_NR_UARTS=4
+# CONFIG_SERIAL_8250_EXTENDED is not set
+
+#
+# Non-8250 serial port support
+#
+CONFIG_SERIAL_CORE=y
+CONFIG_SERIAL_CORE_CONSOLE=y
+CONFIG_UNIX98_PTYS=y
+# CONFIG_LEGACY_PTYS is not set
+
+#
+# IPMI
+#
+# CONFIG_IPMI_HANDLER is not set
+
+#
+# Watchdog Cards
+#
+CONFIG_WATCHDOG=y
+CONFIG_WATCHDOG_NOWAYOUT=y
+
+#
+# Watchdog Device Drivers
+#
+# CONFIG_SOFT_WATCHDOG is not set
+# CONFIG_NVRAM is not set
+# CONFIG_RTC is not set
+# CONFIG_DTLK is not set
+# CONFIG_R3964 is not set
+
+#
+# Ftape, the floppy tape device driver
+#
+# CONFIG_RAW_DRIVER is not set
+
+#
+# TPM devices
+#
+
+#
+# I2C support
+#
+# CONFIG_I2C is not set
+# CONFIG_I2C_SENSOR is not set
+
+#
+# Hardware Monitoring support
+#
+CONFIG_HWMON=y
+# CONFIG_HWMON_DEBUG_CHIP is not set
+
+#
+# Misc devices
+#
+
+#
+# Multimedia devices
+#
+# CONFIG_VIDEO_DEV is not set
+
+#
+# Digital Video Broadcasting Devices
+#
+
+#
+# Graphics support
+#
+# CONFIG_FB is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+
+#
+# Sound
+#
+# CONFIG_SOUND is not set
+
+#
+# USB support
+#
+CONFIG_USB_ARCH_HAS_HCD=y
+CONFIG_USB_ARCH_HAS_OHCI=y
+# CONFIG_USB is not set
+
+#
+# USB Gadget Support
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# MMC/SD Card support
+#
+# CONFIG_MMC is not set
+
+#
+# Synchronous Serial Interfaces (SSI)
+#
+# CONFIG_OMAP_TSC2101 is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+CONFIG_EXT2_FS_XATTR=y
+# CONFIG_EXT2_FS_POSIX_ACL is not set
+# CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS_XIP is not set
+# CONFIG_EXT3_FS is not set
+# CONFIG_JBD is not set
+CONFIG_FS_MBCACHE=y
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+
+#
+# XFS support
+#
+# CONFIG_XFS_FS is not set
+# CONFIG_MINIX_FS is not set
+CONFIG_ROMFS_FS=y
+CONFIG_INOTIFY=y
+# CONFIG_QUOTA is not set
+CONFIG_DNOTIFY=y
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+# CONFIG_ISO9660_FS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# DOS/FAT/NT Filesystems
+#
+# CONFIG_MSDOS_FS is not set
+# CONFIG_VFAT_FS is not set
+# CONFIG_NTFS_FS is not set
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_SYSFS=y
+# CONFIG_DEVPTS_FS_XATTR is not set
+# CONFIG_TMPFS is not set
+# CONFIG_HUGETLB_PAGE is not set
+CONFIG_RAMFS=y
+
+#
+# Miscellaneous filesystems
+#
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+
+#
+# Native Language Support
+#
+# CONFIG_NLS is not set
+
+#
+# Profiling support
+#
+# CONFIG_PROFILING is not set
+
+#
+# Kernel hacking
+#
+# CONFIG_PRINTK_TIME is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_MAGIC_SYSRQ is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SCHEDSTATS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+CONFIG_DEBUG_INFO=y
+# CONFIG_DEBUG_FS is not set
+CONFIG_FRAME_POINTER=y
+CONFIG_DEBUG_USER=y
+# CONFIG_DEBUG_WAITQ is not set
+CONFIG_DEBUG_ERRORS=y
+CONFIG_DEBUG_LL=y
+# CONFIG_DEBUG_ICEDCC is not set
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+
+#
+# Cryptographic options
+#
+# CONFIG_CRYPTO is not set
+
+#
+# Hardware crypto devices
+#
+
+#
+# Library routines
+#
+CONFIG_CRC_CCITT=y
+CONFIG_CRC32=y
+# CONFIG_LIBCRC32C is not set
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
new file mode 100644 (file)
index 0000000..0832f64
--- /dev/null
@@ -0,0 +1,13 @@
+#
+# Makefile for the linux kernel.
+#
+
+# Common support
+obj-y := irq.o io.o serial.o
+
+obj-$(CONFIG_OMAP_MPU_TIMER)           += timer-gp.o
+
+# Specific board support
+obj-$(CONFIG_MACH_OMAP_GENERIC)                += board-generic.o
+obj-$(CONFIG_MACH_OMAP_H4)             += board-h4.o
+
diff --git a/arch/arm/mach-omap2/Makefile.boot b/arch/arm/mach-omap2/Makefile.boot
new file mode 100644 (file)
index 0000000..565aff7
--- /dev/null
@@ -0,0 +1,3 @@
+  zreladdr-y           := 0x80008000
+params_phys-y          := 0x80000100
+initrd_phys-y          := 0x80800000
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
new file mode 100644 (file)
index 0000000..8b8e9fc
--- /dev/null
@@ -0,0 +1,85 @@
+/*
+ * linux/arch/arm/mach-omap/omap2/board-generic.c
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Author: Paul Mundt <paul.mundt@nokia.com>
+ *
+ * Modified from mach-omap/omap1/board-generic.c
+ *
+ * Code for generic OMAP2 board. Should work on many OMAP2 systems where
+ * the bootloader passes the board-specific data to the kernel.
+ * Do not put any board specific code to this file; create a new machine
+ * type if you need custom low-level initializations.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <asm/arch/gpio.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/usb.h>
+#include <asm/arch/board.h>
+#include <asm/arch/common.h>
+
+static int __initdata generic_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
+
+static void __init omap_generic_init_irq(void)
+{
+       omap_init_irq();
+}
+
+static struct omap_board_config_kernel generic_config[] = {
+};
+
+static void __init omap_generic_init(void)
+{
+       const struct omap_uart_config *uart_conf;
+
+       /*
+        * Make sure the serial ports are muxed on at this point.
+        * You have to mux them off in device drivers later on
+        * if not needed.
+        */
+
+       uart_conf = omap_get_config(OMAP_TAG_UART, struct omap_uart_config);
+       if (uart_conf != NULL) {
+               unsigned int enabled_ports, i;
+
+               enabled_ports = uart_conf->enabled_uarts;
+               for (i = 0; i < 3; i++) {
+                       if (!(enabled_ports & (1 << i)))
+                               generic_serial_ports[i] = 0;
+               }
+       }
+
+       omap_board_config = generic_config;
+       omap_board_config_size = ARRAY_SIZE(generic_config);
+       omap_serial_init(generic_serial_ports);
+}
+
+static void __init omap_generic_map_io(void)
+{
+       omap_map_common_io();
+}
+
+MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
+       /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
+       .phys_ram       = 0x80000000,
+       .phys_io        = 0x48000000,
+       .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
+       .boot_params    = 0x80000100,
+       .map_io         = omap_generic_map_io,
+       .init_irq       = omap_generic_init_irq,
+       .init_machine   = omap_generic_init,
+       .timer          = &omap_timer,
+MACHINE_END
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
new file mode 100644 (file)
index 0000000..57b12f7
--- /dev/null
@@ -0,0 +1,120 @@
+/*
+ * linux/arch/arm/mach-omap/omap2/board-h4.c
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Author: Paul Mundt <paul.mundt@nokia.com>
+ *
+ * Modified from mach-omap/omap1/board-generic.c
+ *
+ * Code for generic OMAP2 board. Should work on many OMAP2 systems where
+ * the bootloader passes the board-specific data to the kernel.
+ * Do not put any board specific code to this file; create a new machine
+ * type if you need custom low-level initializations.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/device.h>
+
+#include <asm/hardware.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/map.h>
+
+#include <asm/arch/gpio.h>
+#include <asm/arch/mux.h>
+#include <asm/arch/usb.h>
+#include <asm/arch/board.h>
+#include <asm/arch/common.h>
+
+#include <asm/io.h>
+#include <asm/delay.h>
+
+static int __initdata h4_serial_ports[OMAP_MAX_NR_PORTS] = {1, 1, 1};
+
+static struct resource h4_smc91x_resources[] = {
+       [0] = {
+               .start  = OMAP24XX_ETHR_START,          /* Physical */
+               .end    = OMAP24XX_ETHR_START + 0xf,
+               .flags  = IORESOURCE_MEM,
+       },
+       [1] = {
+               .start  = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
+               .end    = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ),
+               .flags  = IORESOURCE_IRQ,
+       },
+};
+
+static struct platform_device h4_smc91x_device = {
+       .name           = "smc91x",
+       .id             = -1,
+       .num_resources  = ARRAY_SIZE(h4_smc91x_resources),
+       .resource       = h4_smc91x_resources,
+};
+
+static struct platform_device *h4_devices[] __initdata = {
+       &h4_smc91x_device,
+};
+
+static inline void __init h4_init_smc91x(void)
+{
+       u32 l;
+
+       if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) {
+               printk(KERN_ERR "Failed to request GPIO#%d for smc91x IRQ\n",
+                       OMAP24XX_ETHR_GPIO_IRQ);
+               return;
+       }
+       omap_set_gpio_triggering(OMAP24XX_ETHR_GPIO_IRQ,
+                                OMAP_GPIO_FALLING_EDGE);
+       /* Set pin M15 to mux mode 3 -> GPIO#92, disable PU/PD */
+       /* FIXME: change this using omap2 mux api when it's ready */
+       l = __raw_readl(0xd8000000 + 0x108);
+       l &= ~(((1 << 5) - 1) << 16);
+       l |= 3 << 16;
+       __raw_writel(l, 0xd8000000 + 0x108);
+}
+
+static void __init omap_h4_init_irq(void)
+{
+       omap_init_irq();
+       omap_gpio_init();
+       h4_init_smc91x();
+}
+
+static struct omap_board_config_kernel h4_config[] = {
+};
+
+static void __init omap_h4_init(void)
+{
+       /*
+        * Make sure the serial ports are muxed on at this point.
+        * You have to mux them off in device drivers later on
+        * if not needed.
+        */
+       platform_add_devices(h4_devices, ARRAY_SIZE(h4_devices));
+       omap_board_config = h4_config;
+       omap_board_config_size = ARRAY_SIZE(h4_config);
+       omap_serial_init(h4_serial_ports);
+}
+
+static void __init omap_h4_map_io(void)
+{
+       omap_map_common_io();
+}
+
+MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
+       /* Maintainer: Paul Mundt <paul.mundt@nokia.com> */
+       .phys_ram       = 0x80000000,
+       .phys_io        = 0x48000000,
+       .io_pg_offst    = ((0xd8000000) >> 18) & 0xfffc,
+       .boot_params    = 0x80000100,
+       .map_io         = omap_h4_map_io,
+       .init_irq       = omap_h4_init_irq,
+       .init_machine   = omap_h4_init,
+       .timer          = &omap_timer,
+MACHINE_END
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
new file mode 100644 (file)
index 0000000..048b0c2
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * linux/arch/arm/mach-omap/omap1/io.c
+ *
+ * OMAP2 I/O mapping code
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Author: Juha Yrjölä <juha.yrjola@nokia.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/config.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+
+#include <asm/mach/map.h>
+#include <asm/io.h>
+
+/*
+ * The machine specific code may provide the extra mapping besides the
+ * default mapping provided here.
+ */
+static struct map_desc omap2_io_desc[] __initdata = {
+       { IO_VIRT,      IO_PHYS,        IO_SIZE,        MT_DEVICE },
+};
+
+void __init omap_map_common_io(void)
+{
+       iotable_init(omap2_io_desc, ARRAY_SIZE(omap2_io_desc));
+}
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
new file mode 100644 (file)
index 0000000..d7baff6
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * linux/arch/arm/mach-omap/omap2/irq.c
+ *
+ * Interrupt handler for OMAP2 boards.
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Author: Paul Mundt <paul.mundt@nokia.com>
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/config.h>
+#include <linux/interrupt.h>
+#include <asm/hardware.h>
+#include <asm/mach/irq.h>
+#include <asm/irq.h>
+#include <asm/io.h>
+
+#define INTC_REVISION  0x0000
+#define INTC_SYSCONFIG 0x0010
+#define INTC_SYSSTATUS 0x0014
+#define INTC_CONTROL   0x0048
+#define INTC_MIR_CLEAR0        0x0088
+#define INTC_MIR_SET0  0x008c
+
+/*
+ * OMAP2 has a number of different interrupt controllers, each interrupt
+ * controller is identified as its own "bank". Register definitions are
+ * fairly consistent for each bank, but not all registers are implemented
+ * for each bank.. when in doubt, consult the TRM.
+ */
+static struct omap_irq_bank {
+       unsigned long base_reg;
+       unsigned int nr_irqs;
+} __attribute__ ((aligned(4))) irq_banks[] = {
+       {
+               /* MPU INTC */
+               .base_reg       = OMAP24XX_IC_BASE,
+               .nr_irqs        = 96,
+       }, {
+               /* XXX: DSP INTC */
+
+#if 0
+       /*
+        * Commented out for now until we fix the IVA clocking
+        */
+#ifdef CONFIG_ARCH_OMAP2420
+       }, {
+               /* IVA INTC (2420 only) */
+               .base_reg       = OMAP24XX_IVA_INTC_BASE,
+               .nr_irqs        = 16,   /* Actually 32, but only 16 are used */
+#endif
+#endif
+       }
+};
+
+/* XXX: FIQ and additional INTC support (only MPU at the moment) */
+static void omap_ack_irq(unsigned int irq)
+{
+       omap_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL);
+}
+
+static void omap_mask_irq(unsigned int irq)
+{
+       int offset = (irq >> 5) << 5;
+
+       if (irq >= 64) {
+               irq %= 64;
+       } else if (irq >= 32) {
+               irq %= 32;
+       }
+
+       omap_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset);
+}
+
+static void omap_unmask_irq(unsigned int irq)
+{
+       int offset = (irq >> 5) << 5;
+
+       if (irq >= 64) {
+               irq %= 64;
+       } else if (irq >= 32) {
+               irq %= 32;
+       }
+
+       omap_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset);
+}
+
+static void omap_mask_ack_irq(unsigned int irq)
+{
+       omap_mask_irq(irq);
+       omap_ack_irq(irq);
+}
+
+static struct irqchip omap_irq_chip = {
+       .ack    = omap_mask_ack_irq,
+       .mask   = omap_mask_irq,
+       .unmask = omap_unmask_irq,
+};
+
+static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank)
+{
+       unsigned long tmp;
+
+       tmp = omap_readl(bank->base_reg + INTC_REVISION) & 0xff;
+       printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx "
+                        "(revision %ld.%ld) with %d interrupts\n",
+                        bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs);
+
+       tmp = omap_readl(bank->base_reg + INTC_SYSCONFIG);
+       tmp |= 1 << 1;  /* soft reset */
+       omap_writel(tmp, bank->base_reg + INTC_SYSCONFIG);
+
+       while (!(omap_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1))
+               /* Wait for reset to complete */;
+}
+
+void __init omap_init_irq(void)
+{
+       unsigned long nr_irqs = 0;
+       unsigned int nr_banks = 0;
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(irq_banks); i++) {
+               struct omap_irq_bank *bank = irq_banks + i;
+
+               /* XXX */
+               if (!bank->base_reg)
+                       continue;
+
+               omap_irq_bank_init_one(bank);
+
+               nr_irqs += bank->nr_irqs;
+               nr_banks++;
+       }
+
+       printk(KERN_INFO "Total of %ld interrupts on %d active controller%s\n",
+              nr_irqs, nr_banks, nr_banks > 1 ? "s" : "");
+
+       for (i = 0; i < nr_irqs; i++) {
+               set_irq_chip(i, &omap_irq_chip);
+               set_irq_handler(i, do_level_IRQ);
+               set_irq_flags(i, IRQF_VALID);
+       }
+}
+
diff --git a/arch/arm/mach-omap2/serial.c b/arch/arm/mach-omap2/serial.c
new file mode 100644 (file)
index 0000000..e86b41b
--- /dev/null
@@ -0,0 +1,107 @@
+/*
+ * arch/arm/mach-omap/omap2/serial.c
+ *
+ * OMAP2 serial support.
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Author: Paul Mundt <paul.mundt@nokia.com>
+ *
+ * Based off of arch/arm/mach-omap/omap1/serial.c
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/serial_8250.h>
+#include <linux/serial_reg.h>
+#include <asm/io.h>
+
+static struct plat_serial8250_port serial_platform_data[] = {
+       {
+               .membase        = (char *)IO_ADDRESS(OMAP_UART1_BASE),
+               .mapbase        = (unsigned long)OMAP_UART1_BASE,
+               .irq            = 72,
+               .flags          = UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = OMAP16XX_BASE_BAUD * 16,
+       }, {
+               .membase        = (char *)IO_ADDRESS(OMAP_UART2_BASE),
+               .mapbase        = (unsigned long)OMAP_UART2_BASE,
+               .irq            = 73,
+               .flags          = UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = OMAP16XX_BASE_BAUD * 16,
+       }, {
+               .membase        = (char *)IO_ADDRESS(OMAP_UART3_BASE),
+               .mapbase        = (unsigned long)OMAP_UART3_BASE,
+               .irq            = 74,
+               .flags          = UPF_BOOT_AUTOCONF,
+               .iotype         = UPIO_MEM,
+               .regshift       = 2,
+               .uartclk        = OMAP16XX_BASE_BAUD * 16,
+       }, {
+               .flags          = 0
+       }
+};
+
+static inline unsigned int serial_read_reg(struct plat_serial8250_port *up,
+                                          int offset)
+{
+       offset <<= up->regshift;
+       return (unsigned int)__raw_readb(up->membase + offset);
+}
+
+static inline void serial_write_reg(struct plat_serial8250_port *p, int offset,
+                                   int value)
+{
+       offset <<= p->regshift;
+       __raw_writeb(value, (unsigned long)(p->membase + offset));
+}
+
+/*
+ * Internal UARTs need to be initialized for the 8250 autoconfig to work
+ * properly. Note that the TX watermark initialization may not be needed
+ * once the 8250.c watermark handling code is merged.
+ */
+static inline void __init omap_serial_reset(struct plat_serial8250_port *p)
+{
+       serial_write_reg(p, UART_OMAP_MDR1, 0x07);
+       serial_write_reg(p, UART_OMAP_SCR, 0x08);
+       serial_write_reg(p, UART_OMAP_MDR1, 0x00);
+       serial_write_reg(p, UART_OMAP_SYSC, 0x01);
+}
+
+void __init omap_serial_init(int ports[OMAP_MAX_NR_PORTS])
+{
+       int i;
+
+       for (i = 0; i < OMAP_MAX_NR_PORTS; i++) {
+               struct plat_serial8250_port *p = serial_platform_data + i;
+
+               if (ports[i] == 0) {
+                       p->membase = 0;
+                       p->mapbase = 0;
+                       continue;
+               }
+
+               omap_serial_reset(p);
+       }
+}
+
+static struct platform_device serial_device = {
+       .name                   = "serial8250",
+       .id                     = 0,
+       .dev                    = {
+               .platform_data  = serial_platform_data,
+       },
+};
+
+static int __init omap_init(void)
+{
+       return platform_device_register(&serial_device);
+}
+arch_initcall(omap_init);
diff --git a/arch/arm/mach-omap2/timer-gp.c b/arch/arm/mach-omap2/timer-gp.c
new file mode 100644 (file)
index 0000000..69c3c47
--- /dev/null
@@ -0,0 +1,108 @@
+/*
+ * linux/arch/arm/mach-omap/omap2/timer-mpu.c
+ *
+ * OMAP2 MPU timer support.
+ *
+ * Copyright (C) 2005 Nokia Corporation
+ * Author: Paul Mundt <paul.mundt@nokia.com>
+ *         Juha Yrjölä <juha.yrjola@nokia.com>
+ *
+ * Some parts based off of TI's 24xx code:
+ *
+ *   Copyright (C) 2004 Texas Instruments, Inc.
+ *
+ * Roughly modelled after the OMAP1 MPU timer code.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+#include <linux/init.h>
+#include <linux/time.h>
+#include <linux/interrupt.h>
+#include <asm/mach/time.h>
+#include <asm/delay.h>
+#include <asm/io.h>
+
+#define OMAP2_GP_TIMER1_BASE   0x48028000
+#define OMAP2_GP_TIMER2_BASE   0x4802a000
+#define OMAP2_GP_TIMER3_BASE   0x48078000
+#define OMAP2_GP_TIMER4_BASE   0x4807a000
+
+#define GP_TIMER_TIDR          0x00
+#define GP_TIMER_TISR          0x18
+#define GP_TIMER_TIER          0x1c
+#define GP_TIMER_TCLR          0x24
+#define GP_TIMER_TCRR          0x28
+#define GP_TIMER_TLDR          0x2c
+#define GP_TIMER_TSICR         0x40
+
+#define OS_TIMER_NR            1  /* GP timer 2 */
+
+static unsigned long timer_base[] = {
+       IO_ADDRESS(OMAP2_GP_TIMER1_BASE),
+       IO_ADDRESS(OMAP2_GP_TIMER2_BASE),
+       IO_ADDRESS(OMAP2_GP_TIMER3_BASE),
+       IO_ADDRESS(OMAP2_GP_TIMER4_BASE),
+};
+
+static inline unsigned int timer_read_reg(int nr, unsigned int reg)
+{
+       return __raw_readl(timer_base[nr] + reg);
+}
+
+static inline void timer_write_reg(int nr, unsigned int reg, unsigned int val)
+{
+       __raw_writel(val, timer_base[nr] + reg);
+}
+
+static inline void omap2_gp_timer_start(int nr, unsigned long load_val)
+{
+       unsigned int tmp;
+
+       tmp = 0xffffffff - load_val;
+
+       timer_write_reg(nr, GP_TIMER_TLDR, tmp);
+       timer_write_reg(nr, GP_TIMER_TCRR, tmp);
+       timer_write_reg(nr, GP_TIMER_TIER, 1 << 1);
+       timer_write_reg(nr, GP_TIMER_TCLR, (1 << 5) | (1 << 1) | 1);
+}
+
+static irqreturn_t omap2_gp_timer_interrupt(int irq, void *dev_id,
+                                           struct pt_regs *regs)
+{
+       write_seqlock(&xtime_lock);
+
+       timer_write_reg(OS_TIMER_NR, GP_TIMER_TISR, 1 << 1);
+       timer_tick(regs);
+
+       write_sequnlock(&xtime_lock);
+
+       return IRQ_HANDLED;
+}
+
+static struct irqaction omap2_gp_timer_irq = {
+       .name           = "gp timer",
+       .flags          = SA_INTERRUPT,
+       .handler        = omap2_gp_timer_interrupt,
+};
+
+#define MPU_TIMER_TICK_PERIOD  (192000 - 1)
+
+static void __init omap2_gp_timer_init(void)
+{
+       u32 l;
+
+       l = timer_read_reg(OS_TIMER_NR, GP_TIMER_TIDR);
+       printk(KERN_INFO "OMAP2 GP timer (HW version %d.%d)\n",
+              (l >> 4) & 0x0f, l & 0x0f);
+
+       setup_irq(38, &omap2_gp_timer_irq);
+
+       omap2_gp_timer_start(OS_TIMER_NR, MPU_TIMER_TICK_PERIOD);
+}
+
+struct sys_timer omap_timer = {
+       .init   = omap2_gp_timer_init,
+};
+
index afbbeb6f46582270b834ffa6e8da166a3d1bf014..9ab1756c832e06bf75ab51f22e2c65dfdd7d7ff9 100644 (file)
@@ -242,7 +242,7 @@ config CPU_XSCALE
 # ARMv6
 config CPU_V6
        bool "Support ARM V6 processor"
-       depends on ARCH_INTEGRATOR
+       depends on ARCH_INTEGRATOR || ARCH_OMAP2
        select CPU_32v6
        select CPU_ABRT_EV6
        select CPU_CACHE_V6
index 191788fb18d13a4f3adad73afd92a649c0c7ff21..b82cd171a5a72d20b5c47f996c6ae94d92c8d160 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/module.h>
 #include <linux/mm.h>
 #include <linux/pagemap.h>
+#include <linux/shm.h>
 
 #include <asm/cacheflush.h>
 #include <asm/system.h>
@@ -117,3 +118,54 @@ void flush_dcache_page(struct page *page)
        }
 }
 EXPORT_SYMBOL(flush_dcache_page);
+
+void flush_cache_mm(struct mm_struct *mm)
+{
+       if (cache_is_vivt()) {
+               if (current->active_mm == mm)
+                       __cpuc_flush_user_all();
+               return;
+       }
+
+       if (cache_is_vipt_aliasing()) {
+               asm(    "mcr    p15, 0, %0, c7, c14, 0\n"
+               "       mcr     p15, 0, %0, c7, c5, 0\n"
+               "       mcr     p15, 0, %0, c7, c10, 4"
+                   :
+                   : "r" (0)
+                   : "cc");
+       }
+}
+
+void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end)
+{
+       if (cache_is_vivt()) {
+               if (current->active_mm == vma->vm_mm)
+                       __cpuc_flush_user_range(start & PAGE_MASK, PAGE_ALIGN(end),
+                                               vma->vm_flags);
+               return;
+       }
+
+       if (cache_is_vipt_aliasing()) {
+               asm(    "mcr    p15, 0, %0, c7, c14, 0\n"
+               "       mcr     p15, 0, %0, c7, c5, 0\n"
+               "       mcr     p15, 0, %0, c7, c10, 4"
+                   :
+                   : "r" (0)
+                   : "cc");
+       }
+}
+
+void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn)
+{
+       if (cache_is_vivt()) {
+               if (current->active_mm == vma->vm_mm) {
+                       unsigned long addr = user_addr & PAGE_MASK;
+                       __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
+               }
+               return;
+       }
+
+       if (cache_is_vipt_aliasing())
+               flush_pfn_alias(pfn, user_addr);
+}
index 3429ddcf65d1837929a5eb87bae21f7938f8e74b..7f0af7e8609f51daf60a3066b211f6eea7ac5044 100644 (file)
@@ -123,11 +123,11 @@ ENTRY(cpu_v6_switch_mm)
  *     Permissions:
  *       YUWD  APX AP1 AP0     SVC     User
  *       0xxx   0   0   0      no acc  no acc
- *       100x   1   0   1      r/o     no acc
  *       10x0   1   0   1      r/o     no acc
+ *       1001   0   0   1      r/w     no acc
  *       1011   0   0   1      r/w     no acc
- *       110x   0   1   0      r/w     r/o
- *       11x0   0   1   0      r/w     r/o
+ *       11x0   1   1   0      r/o     r/o
+ *       1101   0   1   0      r/w     r/o
  *       1111   0   1   1      r/w     r/w
  */
 ENTRY(cpu_v6_set_pte)
@@ -137,15 +137,16 @@ ENTRY(cpu_v6_set_pte)
        bic     r2, r2, #0x00000003
        orr     r2, r2, #PTE_EXT_AP0 | 2
 
-       tst     r1, #L_PTE_WRITE
-       tstne   r1, #L_PTE_DIRTY
+       tst     r1, #L_PTE_DIRTY
        orreq   r2, r2, #PTE_EXT_APX
 
        tst     r1, #L_PTE_USER
        orrne   r2, r2, #PTE_EXT_AP1
-       tstne   r2, #PTE_EXT_APX
-       bicne   r2, r2, #PTE_EXT_APX | PTE_EXT_AP0
-
+       bicne   r2, r2, #PTE_EXT_AP0
+       tstne   r1, #L_PTE_WRITE
+       tstne   r1, #L_PTE_DIRTY
+       eorne   r2, r2, #PTE_EXT_AP0
        tst     r1, #L_PTE_YOUNG
        biceq   r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK
 
index 196073e81466e076708a6c6553034e23bba81da8..57a211c57ffa699723ee855eae380a47cd68454c 100644 (file)
@@ -183,7 +183,8 @@ static int __init new_switch(struct gpio_switch *sw)
        if (!direction)
                return 0;
 
-       r = request_irq(OMAP_GPIO_IRQ(sw->gpio), gpio_sw_irq_handler, SA_SHIRQ,                         sw->name, sw);
+       r = request_irq(OMAP_GPIO_IRQ(sw->gpio), gpio_sw_irq_handler, SA_SHIRQ,
+                       sw->name, sw);
        if (r < 0) {
                printk(KERN_ERR "gpio-switch: request_irq() failed "
                                "for GPIO %d\n", sw->gpio);
index 29d23a1139a098b6d1826b4df0b6acfb506644e9..e554ea72b2ed71e780c36d3729c2d8d616ad4d80 100644 (file)
@@ -1,9 +1,9 @@
 /*
- *  linux/arch/arm/plat-omap/gpio.c
+ *  linux/arch/arm/mach-omap/gpio.c
  *
  * Support functions for OMAP GPIO
  *
- * Copyright (C) 2003 Nokia Corporation
+ * Copyright (C) 2003-2005 Nokia Corporation
  * Written by Juha Yrjölä <juha.yrjola@nokia.com>
  *
  * This program is free software; you can redistribute it and/or modify
 #define OMAP730_GPIO_INT_MASK          0x10
 #define OMAP730_GPIO_INT_STATUS                0x14
 
+/*
+ * omap24xx specific GPIO registers
+ */
+#define OMAP24XX_GPIO1_BASE            0x48018000
+#define OMAP24XX_GPIO2_BASE            0x4801a000
+#define OMAP24XX_GPIO3_BASE            0x4801c000
+#define OMAP24XX_GPIO4_BASE            0x4801e000
+#define OMAP24XX_GPIO_REVISION         0x0000
+#define OMAP24XX_GPIO_SYSCONFIG                0x0010
+#define OMAP24XX_GPIO_SYSSTATUS                0x0014
+#define OMAP24XX_GPIO_IRQSTATUS1       0x0018
+#define OMAP24XX_GPIO_IRQENABLE1       0x001c
+#define OMAP24XX_GPIO_CTRL             0x0030
+#define OMAP24XX_GPIO_OE               0x0034
+#define OMAP24XX_GPIO_DATAIN           0x0038
+#define OMAP24XX_GPIO_DATAOUT          0x003c
+#define OMAP24XX_GPIO_LEVELDETECT0     0x0040
+#define OMAP24XX_GPIO_LEVELDETECT1     0x0044
+#define OMAP24XX_GPIO_RISINGDETECT     0x0048
+#define OMAP24XX_GPIO_FALLINGDETECT    0x004c
+#define OMAP24XX_GPIO_CLEARIRQENABLE1  0x0060
+#define OMAP24XX_GPIO_SETIRQENABLE1    0x0064
+#define OMAP24XX_GPIO_CLEARWKUENA      0x0080
+#define OMAP24XX_GPIO_SETWKUENA                0x0084
+#define OMAP24XX_GPIO_CLEARDATAOUT     0x0090
+#define OMAP24XX_GPIO_SETDATAOUT       0x0094
+
 #define OMAP_MPUIO_MASK                (~OMAP_MAX_GPIO_LINES & 0xff)
 
 struct gpio_bank {
        u32 base;
        u16 irq;
        u16 virtual_irq_start;
-       u8 method;
+       int method;
        u32 reserved_map;
        u32 suspend_wakeup;
        u32 saved_wakeup;
@@ -101,8 +128,9 @@ struct gpio_bank {
 #define METHOD_GPIO_1510       1
 #define METHOD_GPIO_1610       2
 #define METHOD_GPIO_730                3
+#define METHOD_GPIO_24XX       4
 
-#if defined(CONFIG_ARCH_OMAP16XX)
+#ifdef CONFIG_ARCH_OMAP16XX
 static struct gpio_bank gpio_bank_1610[5] = {
        { OMAP_MPUIO_BASE,     INT_MPUIO,           IH_MPUIO_BASE,     METHOD_MPUIO},
        { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1,      IH_GPIO_BASE,      METHOD_GPIO_1610 },
@@ -131,6 +159,15 @@ static struct gpio_bank gpio_bank_730[7] = {
 };
 #endif
 
+#ifdef CONFIG_ARCH_OMAP24XX
+static struct gpio_bank gpio_bank_24xx[4] = {
+       { OMAP24XX_GPIO1_BASE, INT_24XX_GPIO_BANK1, IH_GPIO_BASE,       METHOD_GPIO_24XX },
+       { OMAP24XX_GPIO2_BASE, INT_24XX_GPIO_BANK2, IH_GPIO_BASE + 32,  METHOD_GPIO_24XX },
+       { OMAP24XX_GPIO3_BASE, INT_24XX_GPIO_BANK3, IH_GPIO_BASE + 64,  METHOD_GPIO_24XX },
+       { OMAP24XX_GPIO4_BASE, INT_24XX_GPIO_BANK4, IH_GPIO_BASE + 96,  METHOD_GPIO_24XX },
+};
+#endif
+
 static struct gpio_bank *gpio_bank;
 static int gpio_bank_count;
 
@@ -157,14 +194,23 @@ static inline struct gpio_bank *get_gpio_bank(int gpio)
                return &gpio_bank[1 + (gpio >> 5)];
        }
 #endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (cpu_is_omap24xx())
+               return &gpio_bank[gpio >> 5];
+#endif
 }
 
 static inline int get_gpio_index(int gpio)
 {
+#ifdef CONFIG_ARCH_OMAP730
        if (cpu_is_omap730())
                return gpio & 0x1f;
-       else
-               return gpio & 0x0f;
+#endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (cpu_is_omap24xx())
+               return gpio & 0x1f;
+#endif
+       return gpio & 0x0f;
 }
 
 static inline int gpio_valid(int gpio)
@@ -187,6 +233,10 @@ static inline int gpio_valid(int gpio)
 #ifdef CONFIG_ARCH_OMAP730
        if (cpu_is_omap730() && gpio < 192)
                return 0;
+#endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (cpu_is_omap24xx() && gpio < 128)
+               return 0;
 #endif
        return -1;
 }
@@ -219,6 +269,9 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
        case METHOD_GPIO_730:
                reg += OMAP730_GPIO_DIR_CONTROL;
                break;
+       case METHOD_GPIO_24XX:
+               reg += OMAP24XX_GPIO_OE;
+               break;
        }
        l = __raw_readl((void __iomem *)reg);
        if (is_input)
@@ -277,6 +330,13 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
                else
                        l &= ~(1 << gpio);
                break;
+       case METHOD_GPIO_24XX:
+               if (enable)
+                       reg += OMAP24XX_GPIO_SETDATAOUT;
+               else
+                       reg += OMAP24XX_GPIO_CLEARDATAOUT;
+               l = 1 << gpio;
+               break;
        default:
                BUG();
                return;
@@ -318,6 +378,9 @@ int omap_get_gpio_datain(int gpio)
        case METHOD_GPIO_730:
                reg += OMAP730_GPIO_DATA_INPUT;
                break;
+       case METHOD_GPIO_24XX:
+               reg += OMAP24XX_GPIO_DATAIN;
+               break;
        default:
                BUG();
                return -1;
@@ -326,18 +389,42 @@ int omap_get_gpio_datain(int gpio)
                        & (1 << get_gpio_index(gpio))) != 0;
 }
 
-static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge)
+#define MOD_REG_BIT(reg, bit_mask, set)        \
+do {   \
+       int l = __raw_readl((void __iomem *)(base + reg)); \
+       if (set) l |= bit_mask; \
+       else l &= ~bit_mask; \
+       __raw_writel(l, (void __iomem *)(base + reg)); \
+} while(0)
+
+static inline void set_24XX_gpio_triggering(u32 base, int gpio, int trigger)
+{
+       u32 gpio_bit = 1 << gpio;
+
+       MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT0, gpio_bit,
+               trigger & IRQT_LOW);
+       MOD_REG_BIT(OMAP24XX_GPIO_LEVELDETECT1, gpio_bit,
+               trigger & IRQT_HIGH);
+       MOD_REG_BIT(OMAP24XX_GPIO_RISINGDETECT, gpio_bit,
+               trigger & IRQT_RISING);
+       MOD_REG_BIT(OMAP24XX_GPIO_FALLINGDETECT, gpio_bit,
+               trigger & IRQT_FALLING);
+       /* FIXME: Possibly do 'set_irq_handler(j, do_level_IRQ)' if only level
+        * triggering requested. */
+}
+
+static int _set_gpio_triggering(struct gpio_bank *bank, int gpio, int trigger)
 {
        u32 reg = bank->base;
-       u32 l;
+       u32 l = 0;
 
        switch (bank->method) {
        case METHOD_MPUIO:
                reg += OMAP_MPUIO_GPIO_INT_EDGE;
                l = __raw_readl((void __iomem *)reg);
-               if (edge == IRQT_RISING)
+               if (trigger == IRQT_RISING)
                        l |= 1 << gpio;
-               else if (edge == IRQT_FALLING)
+               else if (trigger == IRQT_FALLING)
                        l &= ~(1 << gpio);
                else
                        goto bad;
@@ -345,35 +432,41 @@ static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge)
        case METHOD_GPIO_1510:
                reg += OMAP1510_GPIO_INT_CONTROL;
                l = __raw_readl((void __iomem *)reg);
-               if (edge == IRQT_RISING)
+               if (trigger == IRQT_RISING)
                        l |= 1 << gpio;
-               else if (edge == IRQT_FALLING)
+               else if (trigger == IRQT_FALLING)
                        l &= ~(1 << gpio);
                else
                        goto bad;
                break;
        case METHOD_GPIO_1610:
-               /* NOTE: knows __IRQT_{FAL,RIS}EDGE match OMAP hardware */
-               edge &= 0x03;
                if (gpio & 0x08)
                        reg += OMAP1610_GPIO_EDGE_CTRL2;
                else
                        reg += OMAP1610_GPIO_EDGE_CTRL1;
                gpio &= 0x07;
+               /* We allow only edge triggering, i.e. two lowest bits */
+               if (trigger & ~IRQT_BOTHEDGE)
+                       BUG();
+               /* NOTE: knows __IRQT_{FAL,RIS}EDGE match OMAP hardware */
+               trigger &= 0x03;
                l = __raw_readl((void __iomem *)reg);
                l &= ~(3 << (gpio << 1));
-               l |= edge << (gpio << 1);
+               l |= trigger << (gpio << 1);
                break;
        case METHOD_GPIO_730:
                reg += OMAP730_GPIO_INT_CONTROL;
                l = __raw_readl((void __iomem *)reg);
-               if (edge == IRQT_RISING)
+               if (trigger == IRQT_RISING)
                        l |= 1 << gpio;
-               else if (edge == IRQT_FALLING)
+               else if (trigger == IRQT_FALLING)
                        l &= ~(1 << gpio);
                else
                        goto bad;
                break;
+       case METHOD_GPIO_24XX:
+               set_24XX_gpio_triggering(reg, gpio, trigger);
+               break;
        default:
                BUG();
                goto bad;
@@ -403,13 +496,34 @@ static int gpio_irq_type(unsigned irq, unsigned type)
 
        bank = get_gpio_bank(gpio);
        spin_lock(&bank->lock);
-       retval = _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), type);
+       retval = _set_gpio_triggering(bank, get_gpio_index(gpio), type);
        spin_unlock(&bank->lock);
        return retval;
 }
 
+static inline int get_24XX_gpio_triggering(u32 base, int gpio)
+{
+       u32 gpio_bit = 1 << gpio;
+       int flags = 0;
+       u32 l;
+
+       l = __raw_readl(base + OMAP24XX_GPIO_LEVELDETECT0);
+       if (l & gpio_bit)
+               flags |= IRQT_LOW;
+       l = __raw_readl(base + OMAP24XX_GPIO_LEVELDETECT1);
+       if (l & gpio_bit)
+               flags |= IRQT_HIGH;
+       l = __raw_readl(base + OMAP24XX_GPIO_RISINGDETECT);
+       if (l & gpio_bit)
+               flags |= IRQT_RISING;
+       l = __raw_readl(base + OMAP24XX_GPIO_FALLINGDETECT);
+       if (l & gpio_bit)
+               flags |= IRQT_FALLING;
+
+       return flags;
+}
 
-static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio)
+static int _get_gpio_triggering(struct gpio_bank *bank, int gpio)
 {
        u32 reg = bank->base, l;
 
@@ -433,6 +547,8 @@ static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio)
                l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL);
                return (l & (1 << gpio)) ?
                        IRQT_RISING : IRQT_FALLING;
+       case METHOD_GPIO_24XX:
+               return get_24XX_gpio_triggering(reg, gpio);
        default:
                BUG();
                return -1;
@@ -457,6 +573,9 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
        case METHOD_GPIO_730:
                reg += OMAP730_GPIO_INT_STATUS;
                break;
+       case METHOD_GPIO_24XX:
+               reg += OMAP24XX_GPIO_IRQSTATUS1;
+               break;
        default:
                BUG();
                return;
@@ -506,6 +625,13 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
                else
                        l |= gpio_mask;
                break;
+       case METHOD_GPIO_24XX:
+               if (enable)
+                       reg += OMAP24XX_GPIO_SETIRQENABLE1;
+               else
+                       reg += OMAP24XX_GPIO_CLEARIRQENABLE1;
+               l = gpio_mask;
+               break;
        default:
                BUG();
                return;
@@ -530,6 +656,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
 {
        switch (bank->method) {
        case METHOD_GPIO_1610:
+       case METHOD_GPIO_24XX:
                spin_lock(&bank->lock);
                if (enable)
                        bank->suspend_wakeup |= (1 << gpio);
@@ -581,7 +708,7 @@ int omap_request_gpio(int gpio)
        if (bank->method == METHOD_GPIO_1510) {
                u32 reg;
 
-               /* Claim the pin for the ARM */
+               /* Claim the pin for MPU */
                reg = bank->base + OMAP1510_GPIO_PIN_CONTROL;
                __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg);
        }
@@ -592,6 +719,13 @@ int omap_request_gpio(int gpio)
                u32 reg = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
                __raw_writel(1 << get_gpio_index(gpio), (void __iomem *)reg);
        }
+#endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (bank->method == METHOD_GPIO_24XX) {
+               /* Enable wake-up during idle for dynamic tick */
+               u32 reg = bank->base + OMAP24XX_GPIO_SETWKUENA;
+               __raw_writel(1 << get_gpio_index(gpio), (void __iomem *)reg);
+       }
 #endif
        spin_unlock(&bank->lock);
 
@@ -618,6 +752,13 @@ void omap_free_gpio(int gpio)
                u32 reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
                __raw_writel(1 << get_gpio_index(gpio), (void __iomem *)reg);
        }
+#endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (bank->method == METHOD_GPIO_24XX) {
+               /* Disable wake-up during idle for dynamic tick */
+               u32 reg = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
+               __raw_writel(1 << get_gpio_index(gpio), (void __iomem *)reg);
+       }
 #endif
        bank->reserved_map &= ~(1 << get_gpio_index(gpio));
        _set_gpio_direction(bank, get_gpio_index(gpio), 1);
@@ -660,6 +801,10 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc,
        if (bank->method == METHOD_GPIO_730)
                isr_reg = bank->base + OMAP730_GPIO_INT_STATUS;
 #endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (bank->method == METHOD_GPIO_24XX)
+               isr_reg = bank->base + OMAP24XX_GPIO_IRQSTATUS1;
+#endif
 
        isr = __raw_readl((void __iomem *)isr_reg);
        _enable_gpio_irqbank(bank, isr, 0);
@@ -699,14 +844,15 @@ static void gpio_mask_irq(unsigned int irq)
 static void gpio_unmask_irq(unsigned int irq)
 {
        unsigned int gpio = irq - IH_GPIO_BASE;
+       unsigned int gpio_idx = get_gpio_index(gpio);
        struct gpio_bank *bank = get_gpio_bank(gpio);
 
-       if (_get_gpio_edge_ctrl(bank, get_gpio_index(gpio)) == IRQT_NOEDGE) {
-               printk(KERN_ERR "OMAP GPIO %d: trying to enable GPIO IRQ while no edge is set\n",
+       if (_get_gpio_triggering(bank, gpio_idx) == IRQT_NOEDGE) {
+               printk(KERN_ERR "OMAP GPIO %d: trying to enable GPIO IRQ while no triggering is set\n",
                       gpio);
-               _set_gpio_edge_ctrl(bank, get_gpio_index(gpio), IRQT_RISING);
+               _set_gpio_triggering(bank, gpio_idx, IRQT_RISING);
        }
-       _set_gpio_irqenable(bank, gpio, 1);
+       _set_gpio_irqenable(bank, gpio_idx, 1);
 }
 
 static void mpuio_ack_irq(unsigned int irq)
@@ -786,6 +932,17 @@ static int __init _omap_gpio_init(void)
                gpio_bank_count = 7;
                gpio_bank = gpio_bank_730;
        }
+#endif
+#ifdef CONFIG_ARCH_OMAP24XX
+       if (cpu_is_omap24xx()) {
+               int rev;
+
+               gpio_bank_count = 4;
+               gpio_bank = gpio_bank_24xx;
+               rev = omap_readl(gpio_bank[0].base + OMAP24XX_GPIO_REVISION);
+               printk(KERN_INFO "OMAP24xx GPIO hardware version %d.%d\n",
+                       (rev >> 4) & 0x0f, rev & 0x0f);
+       }
 #endif
        for (i = 0; i < gpio_bank_count; i++) {
                int j, gpio_count = 16;
@@ -817,6 +974,14 @@ static int __init _omap_gpio_init(void)
 
                        gpio_count = 32; /* 730 has 32-bit GPIOs */
                }
+#endif
+#ifdef CONFIG_ARCH_OMAP24XX
+               if (bank->method == METHOD_GPIO_24XX) {
+                       __raw_writel(0x00000000, bank->base + OMAP24XX_GPIO_IRQENABLE1);
+                       __raw_writel(0xffffffff, bank->base + OMAP24XX_GPIO_IRQSTATUS1);
+
+                       gpio_count = 32;
+               }
 #endif
                for (j = bank->virtual_irq_start;
                     j < bank->virtual_irq_start + gpio_count; j++) {
@@ -839,22 +1004,34 @@ static int __init _omap_gpio_init(void)
        return 0;
 }
 
-#ifdef CONFIG_ARCH_OMAP16XX
+#if defined (CONFIG_ARCH_OMAP16XX) || defined (CONFIG_ARCH_OMAP24XX)
 static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
 {
        int i;
 
-       if (cpu_is_omap1510())
+       if (!cpu_is_omap24xx() && !cpu_is_omap1610())
                return 0;
 
        for (i = 0; i < gpio_bank_count; i++) {
                struct gpio_bank *bank = &gpio_bank[i];
-               u32 wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE;
-               u32 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
-               u32 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
-
-               if (bank->method != METHOD_GPIO_1610)
+               u32 wake_status;
+               u32 wake_clear;
+               u32 wake_set;
+
+               switch (bank->method) {
+               case METHOD_GPIO_1610:
+                       wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE;
+                       wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
+                       wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
+                       break;
+               case METHOD_GPIO_24XX:
+                       wake_status = bank->base + OMAP24XX_GPIO_SETWKUENA;
+                       wake_clear = bank->base + OMAP24XX_GPIO_CLEARWKUENA;
+                       wake_set = bank->base + OMAP24XX_GPIO_SETWKUENA;
+                       break;
+               default:
                        continue;
+               }
 
                spin_lock(&bank->lock);
                bank->saved_wakeup = __raw_readl(wake_status);
@@ -870,16 +1047,26 @@ static int omap_gpio_resume(struct sys_device *dev)
 {
        int i;
 
-       if (cpu_is_omap1510())
+       if (!cpu_is_omap24xx() && !cpu_is_omap1610())
                return 0;
 
        for (i = 0; i < gpio_bank_count; i++) {
                struct gpio_bank *bank = &gpio_bank[i];
-               u32 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
-               u32 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
-
-               if (bank->method != METHOD_GPIO_1610)
+               u32 wake_clear;
+               u32 wake_set;
+
+               switch (bank->method) {
+               case METHOD_GPIO_1610:
+                       wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
+                       wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
+                       break;
+               case METHOD_GPIO_24XX:
+                       wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
+                       wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
+                       break;
+               default:
                        continue;
+               }
 
                spin_lock(&bank->lock);
                __raw_writel(0xffffffff, wake_clear);
@@ -920,8 +1107,8 @@ static int __init omap_gpio_sysinit(void)
        if (!initialized)
                ret = _omap_gpio_init();
 
-#ifdef CONFIG_ARCH_OMAP16XX
-       if (cpu_is_omap16xx()) {
+#if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX)
+       if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
                if (ret == 0) {
                        ret = sysdev_class_register(&omap_gpio_sysclass);
                        if (ret == 0)
index 53258bea68a7377d1c3bb6e2bda8bf6093bb6fa8..64ae829f6d8cb448d8c3431b13560c6e4cbbf501 100644 (file)
@@ -1794,7 +1794,7 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
 
 #ifdef CONFIG_ARCH_OMAP1510
        /* Workaround to enable 115200 baud on OMAP1510 internal ports */
-       if (cpu_is_omap1510() && is_omap_port(up->port.membase)) {
+       if (cpu_is_omap1510() && is_omap_port((unsigned int)up->port.membase)) {
                if (baud == 115200) {
                        quot = 1;
                        serial_out(up, UART_OMAP_OSC_12M_SEL, 1);
@@ -1854,7 +1854,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
        int ret = 0;
 
 #ifdef CONFIG_ARCH_OMAP
-       if (is_omap_port(up->port.membase))
+       if (is_omap_port((unsigned int)up->port.membase))
                size = 0x16 << up->port.regshift;
 #endif
 
index 79138dcfb4accafa92a10910cdc0a70a93d42e8c..d64ee9211eeddc63fbb888421f01157f72f382a1 100644 (file)
@@ -30,6 +30,9 @@
 #define __ASM_ARCH_OMAP_H4_H
 
 /* Placeholder for H4 specific defines */
+/* GPMC CS1 */
+#define OMAP24XX_ETHR_START             0x08000300
+#define OMAP24XX_ETHR_GPIO_IRQ         92
 
 #endif /*  __ASM_ARCH_OMAP_H4_H */
 
index 83bb458afd0ba7480289e87d0b141596a71c2b9e..ca4f577f967588396bdd07146e74d41cda84682c 100644 (file)
@@ -14,6 +14,7 @@
                .macro  addruart,rx
                mrc     p15, 0, \rx, c1, c0
                tst     \rx, #1                 @ MMU enabled?
+#ifdef CONFIG_ARCH_OMAP1
                moveq   \rx, #0xff000000        @ physical base address
                movne   \rx, #0xfe000000        @ virtual base
                orr     \rx, \rx, #0x00fb0000
 #endif
 #if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
                orr     \rx, \rx, #0x00000800   @ UART 2 & 3
+#endif
+
+#elif  CONFIG_ARCH_OMAP2
+               moveq   \rx, #0x48000000        @ physical base address
+               movne   \rx, #0xd8000000        @ virtual base
+               orr     \rx, \rx, #0x0006a000
+#ifdef CONFIG_OMAP_LL_DEBUG_UART2
+               add     \rx, \rx, #0x00002000   @ UART 2
+#endif
+#ifdef CONFIG_OMAP_LL_DEBUG_UART3
+               add     \rx, \rx, #0x00004000   @ UART 3
+#endif
 #endif
                .endm
 
index 976271f4ea11c476c98a0d6e859fbdb6bd4e5b89..383e720b45291301bd1b949b6328e0a485ea5747 100644 (file)
@@ -8,6 +8,8 @@
  * warranty of any kind, whether express or implied.
  */
 
+#if defined(CONFIG_ARCH_OMAP1)
+
 #if defined(CONFIG_ARCH_OMAP730) && \
        (defined(CONFIG_ARCH_OMAP1510) || defined(CONFIG_ARCH_OMAP16XX))
 #error "FIXME: OMAP730 doesn't support multiple-OMAP"  
 1510:
                .endm
 
+#elif defined(CONFIG_ARCH_OMAP24XX)
+
+#include <asm/arch/omap24xx.h>
+
+               .macro  disable_fiq
+               .endm
+
+               .macro  get_irqnr_and_base, irqnr, irqstat, base, tmp
+               ldr     \base, =VA_IC_BASE
+               ldr     \irqnr, [\base, #0x98] /* IRQ pending reg 1 */
+               cmp     \irqnr, #0x0
+               bne     2222f
+               ldr     \irqnr, [\base, #0xb8] /* IRQ pending reg 2 */
+               cmp     \irqnr, #0x0
+               bne     2222f
+               ldr     \irqnr, [\base, #0xd8] /* IRQ pending reg 3 */
+               cmp     \irqnr, #0x0
+2222:
+               ldrne   \irqnr, [\base, #IRQ_SIR_IRQ]
+
+               .endm
+
+               .macro  irq_prio_table
+               .endm
+
+#endif
index b017122e97c6e18235c157c5ee59cc895ef35dc3..6c557f66033d404f147266404cc0187cfc1aa665 100644 (file)
@@ -3,7 +3,7 @@
  *
  * OMAP GPIO handling defines and functions
  *
- * Copyright (C) 2003 Nokia Corporation
+ * Copyright (C) 2003-2005 Nokia Corporation
  *
  * Written by Juha Yrjölä <juha.yrjola@nokia.com>
  *
index 71bc4b30185196879fda3541ab0c19d0b2352d09..60201e1dd6ad72b2eb05e3e81f1ae014fc10fc9b 100644 (file)
@@ -43,6 +43,7 @@
 #include <asm/arch/cpu.h>
 #endif
 #include <asm/arch/io.h>
+#include <asm/arch/serial.h>
 
 /*
  * ---------------------------------------------------------------------------
  * Interrupts
  * ---------------------------------------------------------------------------
  */
+#ifdef CONFIG_ARCH_OMAP1
+
+/*
+ * XXX: These probably want to be moved to arch/arm/mach-omap/omap1/irq.c
+ * or something similar.. -- PFM.
+ */
+
 #define OMAP_IH1_BASE          0xfffecb00
 #define OMAP_IH2_BASE          0xfffe0000
 
 #define IRQ_ILR0_REG_OFFSET    0x1c
 #define IRQ_GMR_REG_OFFSET     0xa0
 
+#endif
+
 /*
  * ----------------------------------------------------------------------------
  * System control registers
 
 #ifndef __ASSEMBLER__
 
-/*
- * ---------------------------------------------------------------------------
- * Serial ports
- * ---------------------------------------------------------------------------
- */
-#define OMAP_UART1_BASE                (unsigned char *)0xfffb0000
-#define OMAP_UART2_BASE                (unsigned char *)0xfffb0800
-#define OMAP_UART3_BASE                (unsigned char *)0xfffb9800
-#define OMAP_MAX_NR_PORTS      3
-#define OMAP1510_BASE_BAUD     (12000000/16)
-#define OMAP16XX_BASE_BAUD     (48000000/16)
-
-#define is_omap_port(p)        ({int __ret = 0;                        \
-                       if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
-                           p == IO_ADDRESS(OMAP_UART2_BASE) || \
-                           p == IO_ADDRESS(OMAP_UART3_BASE))   \
-                               __ret = 1;                      \
-                       __ret;                                  \
-                       })
-
 /*
  * ---------------------------------------------------------------------------
  * Processor specific defines
 
 #include "omap730.h"
 #include "omap1510.h"
+
+#ifdef CONFIG_ARCH_OMAP24XX
+#include "omap24xx.h"
+#endif
+
 #include "omap16xx.h"
 
 /*
 
 #ifdef CONFIG_MACH_OMAP_H4
 #include "board-h4.h"
-#error "Support for H4 board not yet implemented."
 #endif
 
 #ifdef CONFIG_MACH_OMAP_OSK
index 1c8c9fcc766e5254c989c33e8999465e198b6f1b..11fbf629bf755410a10efee0b52f1711b584b931 100644 (file)
  * I/O mapping
  * ----------------------------------------------------------------------------
  */
-#define IO_PHYS                        0xFFFB0000
-#define IO_OFFSET              0x01000000      /* Virtual IO = 0xfefb0000 */
-#define IO_VIRT                        (IO_PHYS - IO_OFFSET)
-#define IO_SIZE                        0x40000
-#define IO_ADDRESS(x)          ((x) - IO_OFFSET)
 
-#define PCIO_BASE              0
+#if defined(CONFIG_ARCH_OMAP1)
+#define IO_PHYS                0xFFFB0000
+#define IO_OFFSET      -0x01000000     /* Virtual IO = 0xfefb0000 */
+#define IO_SIZE                0x40000
 
-#define io_p2v(x)               ((x) - IO_OFFSET)
-#define io_v2p(x)               ((x) + IO_OFFSET)
+#elif defined(CONFIG_ARCH_OMAP2)
+#define IO_PHYS                0x48000000      /* L4 peripherals; other stuff has to be mapped *
+                                        * manually. */
+#define IO_OFFSET      0x90000000      /* Virtual IO = 0xd8000000 */
+#define IO_SIZE                0x08000000
+#endif
+
+#define IO_VIRT                (IO_PHYS + IO_OFFSET)
+#define IO_ADDRESS(x)  ((x) + IO_OFFSET)
+#define PCIO_BASE      0
+#define io_p2v(x)      ((x) + IO_OFFSET)
+#define io_v2p(x)      ((x) - IO_OFFSET)
 
 #ifndef __ASSEMBLER__
 
@@ -96,6 +104,8 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
                                        ->offset[((vaddr)&4095)>>2]
 #define __REG32(paddr)         __REGV32(io_p2v(paddr))
 
+extern void omap_map_common_io(void);
+
 #else
 
 #define __REG8(paddr)          io_p2v(paddr)
index 0d05a7c957d155799e1acaf61a4dab8cf7184f42..5367ce14b9d03d7f418381dd51a6bfb47ee77888 100644 (file)
 #define INT_730_DMA_CH15       (62 + IH2_BASE)
 #define INT_730_NAND           (63 + IH2_BASE)
 
+#define INT_24XX_GPIO_BANK1    29
+#define INT_24XX_GPIO_BANK2    30
+#define INT_24XX_GPIO_BANK3    31
+#define INT_24XX_GPIO_BANK4    32
+
 /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
  * 16 MPUIO lines */
 #define OMAP_MAX_GPIO_LINES    192
index f6b57dd846a318a2099981cd402fd478aacca6f9..84f81e315a25da0aa010154473dfbc272e1cfd8c 100644 (file)
 /*
  * Physical DRAM offset.
  */
+#if defined(CONFIG_ARCH_OMAP1)
 #define PHYS_OFFSET            (0x10000000UL)
-
-/*
- * OMAP-1510 Local Bus address offset
- */
-#define OMAP1510_LB_OFFSET     (0x30000000UL)
+#elif defined(CONFIG_ARCH_OMAP2)
+#define PHYS_OFFSET            (0x80000000UL)
+#endif
 
 /*
  * Conversion between SDRAM and fake PCI bus, used by USB
  */
 #ifdef CONFIG_ARCH_OMAP1510
 
+/*
+ * OMAP-1510 Local Bus address offset
+ */
+#define OMAP1510_LB_OFFSET     (0x30000000UL)
+
 #define virt_to_lbus(x)                ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
 #define lbus_to_virt(x)                ((x) - OMAP1510_LB_OFFSET + PAGE_OFFSET)
 #define is_lbus_device(dev)    (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
diff --git a/include/asm-arm/arch-omap/omap24xx.h b/include/asm-arm/arch-omap/omap24xx.h
new file mode 100644 (file)
index 0000000..a910546
--- /dev/null
@@ -0,0 +1,15 @@
+#ifndef __ASM_ARCH_OMAP24XX_H
+#define __ASM_ARCH_OMAP24XX_H
+
+#define OMAP24XX_L4_IO_BASE    0x48000000
+
+/* interrupt controller */
+#define OMAP24XX_IC_BASE       (OMAP24XX_L4_IO_BASE + 0xfe000)
+#define VA_IC_BASE             IO_ADDRESS(OMAP24XX_IC_BASE)
+
+#define OMAP24XX_IVA_INTC_BASE 0x40000000
+
+#define IRQ_SIR_IRQ            0x0040
+
+#endif /* __ASM_ARCH_OMAP24XX_H */
+
index b2cfdaf9a597e059a54c12c55fd91e232889adf9..5a493071053f846ff3d2e70c50e1b460bf956364 100644 (file)
@@ -99,7 +99,8 @@
 #define OMAP1610_IDLE_LOOP_REQUEST     0x0400
 
 #if     !defined(CONFIG_ARCH_OMAP1510) && \
-       !defined(CONFIG_ARCH_OMAP16XX)
+       !defined(CONFIG_ARCH_OMAP16XX) && \
+       !defined(CONFIG_ARCH_OMAP24XX)
 #error "Power management for this processor not implemented yet"
 #endif
 
diff --git a/include/asm-arm/arch-omap/serial.h b/include/asm-arm/arch-omap/serial.h
new file mode 100644 (file)
index 0000000..79a5297
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ *  linux/include/asm-arm/arch-omap/serial.h
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#ifndef __ASM_ARCH_SERIAL_H
+#define __ASM_ARCH_SERIAL_H
+
+#if defined(CONFIG_ARCH_OMAP1)
+/* OMAP1 serial ports */
+#define OMAP_UART1_BASE                0xfffb0000
+#define OMAP_UART2_BASE                0xfffb0800
+#define OMAP_UART3_BASE                0xfffb9800
+#elif defined(CONFIG_ARCH_OMAP2)
+/* OMAP2 serial ports */
+#define OMAP_UART1_BASE                0x4806a000
+#define OMAP_UART2_BASE                0x4806c000
+#define OMAP_UART3_BASE                0x4806e000
+#endif
+
+#define OMAP_MAX_NR_PORTS      3
+#define OMAP1510_BASE_BAUD     (12000000/16)
+#define OMAP16XX_BASE_BAUD     (48000000/16)
+
+#define is_omap_port(p)        ({int __ret = 0;                        \
+                       if (p == IO_ADDRESS(OMAP_UART1_BASE) || \
+                           p == IO_ADDRESS(OMAP_UART2_BASE) || \
+                           p == IO_ADDRESS(OMAP_UART3_BASE))   \
+                               __ret = 1;                      \
+                       __ret;                                  \
+                       })
+
+#endif
index 3e640aba8c20f576410fb22b1ca72a365df431a6..3545c86859cc9a9700b02760a35fb1ba9a811ba8 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/config.h>
 #include <linux/types.h>
 #include <linux/serial_reg.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch/serial.h>
 
 unsigned int system_rev;
 
@@ -34,8 +34,9 @@ static void
 putstr(const char *s)
 {
        volatile u8 * uart = 0;
-       int shift;
+       int shift = 2;
 
+#ifdef CONFIG_ARCH_OMAP
 #ifdef CONFIG_OMAP_LL_DEBUG_UART3
        uart = (volatile u8 *)(OMAP_UART3_BASE);
 #elif  CONFIG_OMAP_LL_DEBUG_UART2
@@ -44,6 +45,7 @@ putstr(const char *s)
        uart = (volatile u8 *)(OMAP_UART1_BASE);
 #endif
 
+#ifdef CONFIG_ARCH_OMAP1
        /* Determine which serial port to use */
        do {
                /* MMU is not on, so cpu_is_omapXXXX() won't work here */
@@ -51,14 +53,14 @@ putstr(const char *s)
 
                if (omap_id == OMAP_ID_730)
                        shift = 0;
-               else
-                       shift = 2;
 
                if (check_port(uart, shift))
                        break;
                /* Silent boot if no serial ports are enabled. */
                return;
        } while (0);
+#endif /* CONFIG_ARCH_OMAP1 */
+#endif
 
        /*
         * Now, xmit each character
index 035cdcff43d233e8566e5ed0ce3e6b04514be4d9..e81baff4f54b3293d18290088af1e1ac1f65fabe 100644 (file)
@@ -256,7 +256,7 @@ extern void dmac_flush_range(unsigned long, unsigned long);
  * Convert calls to our calling convention.
  */
 #define flush_cache_all()              __cpuc_flush_kern_all()
-
+#ifndef CONFIG_CPU_CACHE_VIPT
 static inline void flush_cache_mm(struct mm_struct *mm)
 {
        if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask))
@@ -279,6 +279,11 @@ flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned l
                __cpuc_flush_user_range(addr, addr + PAGE_SIZE, vma->vm_flags);
        }
 }
+#else
+extern void flush_cache_mm(struct mm_struct *mm);
+extern void flush_cache_range(struct vm_area_struct *vma, unsigned long start, unsigned long end);
+extern void flush_cache_page(struct vm_area_struct *vma, unsigned long user_addr, unsigned long pfn);
+#endif
 
 /*
  * flush_cache_user_range is used when we want to ensure that the