Commit 5a99529a authored by Paul Mundt's avatar Paul Mundt Committed by Tony Lindgren

[PATCH] ARM: OMAP: Add minimal 24xx support

Add minimal 24xx support
parent 54373ede
...@@ -227,6 +227,8 @@ source "arch/arm/plat-omap/Kconfig" ...@@ -227,6 +227,8 @@ source "arch/arm/plat-omap/Kconfig"
source "arch/arm/mach-omap1/Kconfig" source "arch/arm/mach-omap1/Kconfig"
source "arch/arm/mach-omap2/Kconfig"
source "arch/arm/mach-s3c2410/Kconfig" source "arch/arm/mach-s3c2410/Kconfig"
source "arch/arm/mach-lh7a40x/Kconfig" source "arch/arm/mach-lh7a40x/Kconfig"
......
...@@ -53,7 +53,7 @@ tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi ...@@ -53,7 +53,7 @@ tune-$(CONFIG_CPU_ARM926T) :=-mtune=arm9tdmi
tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110 tune-$(CONFIG_CPU_SA110) :=-mtune=strongarm110
tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100 tune-$(CONFIG_CPU_SA1100) :=-mtune=strongarm1100
tune-$(CONFIG_CPU_XSCALE) :=$(call cc-option,-mtune=xscale,-mtune=strongarm110) -Wa,-mcpu=xscale 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 # Need -Uarm for gcc < 3.x
CFLAGS_ABI :=$(call cc-option,-mapcs-32,-mabi=apcs-gnu) $(call cc-option,-mno-thumb-interwork,) 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 ...@@ -92,6 +92,7 @@ textaddr-$(CONFIG_ARCH_FORTUNET) := 0xc0008000
machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
machine-$(CONFIG_ARCH_IXP2000) := ixp2000 machine-$(CONFIG_ARCH_IXP2000) := ixp2000
machine-$(CONFIG_ARCH_OMAP1) := omap1 machine-$(CONFIG_ARCH_OMAP1) := omap1
machine-$(CONFIG_ARCH_OMAP2) := omap2
incdir-$(CONFIG_ARCH_OMAP) := omap incdir-$(CONFIG_ARCH_OMAP) := omap
machine-$(CONFIG_ARCH_S3C2410) := s3c2410 machine-$(CONFIG_ARCH_S3C2410) := s3c2410
machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
......
...@@ -52,6 +52,20 @@ ...@@ -52,6 +52,20 @@
add \rb, \rb, #0x00010000 @ Ser1 add \rb, \rb, #0x00010000 @ Ser1
# endif # endif
.endm .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) #elif defined(CONFIG_ARCH_IOP331)
.macro loadsp, rb .macro loadsp, rb
mov \rb, #0xff000000 mov \rb, #0xff000000
......
#
# 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
#
# 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
zreladdr-y := 0x80008000
params_phys-y := 0x80000100
initrd_phys-y := 0x80800000
/*
* 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
/*
* 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
/*
* linux/arch/arm/mach-omap/omap1/io.c
*
* OMAP2 I/O mapping code
*
* Copyright (C) 2005 Nokia Corporation
* Author: Juha Yrjl <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));
}
/*
* 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);
}
}
/*
* 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);
/*
* 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 Yrjl <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,
};
...@@ -242,7 +242,7 @@ config CPU_XSCALE ...@@ -242,7 +242,7 @@ config CPU_XSCALE
# ARMv6 # ARMv6
config CPU_V6 config CPU_V6
bool "Support ARM V6 processor" bool "Support ARM V6 processor"
depends on ARCH_INTEGRATOR depends on ARCH_INTEGRATOR || ARCH_OMAP2
select CPU_32v6 select CPU_32v6
select CPU_ABRT_EV6 select CPU_ABRT_EV6
select CPU_CACHE_V6 select CPU_CACHE_V6
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/pagemap.h> #include <linux/pagemap.h>
#include <linux/shm.h>
#include <asm/cacheflush.h> #include <asm/cacheflush.h>
#include <asm/system.h> #include <asm/system.h>
...@@ -117,3 +118,54 @@ void flush_dcache_page(struct page *page) ...@@ -117,3 +118,54 @@ void flush_dcache_page(struct page *page)
} }
} }
EXPORT_SYMBOL(flush_dcache_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);
}
...@@ -123,11 +123,11 @@ ENTRY(cpu_v6_switch_mm) ...@@ -123,11 +123,11 @@ ENTRY(cpu_v6_switch_mm)
* Permissions: * Permissions:
* YUWD APX AP1 AP0 SVC User * YUWD APX AP1 AP0 SVC User
* 0xxx 0 0 0 no acc no acc * 0xxx 0 0 0 no acc no acc
* 100x 1 0 1 r/o no acc
* 10x0 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 * 1011 0 0 1 r/w no acc
* 110x 0 1 0 r/w r/o * 11x0 1 1 0 r/o r/o
* 11x0 0 1 0 r/w r/o * 1101 0 1 0 r/w r/o
* 1111 0 1 1 r/w r/w * 1111 0 1 1 r/w r/w
*/ */
ENTRY(cpu_v6_set_pte) ENTRY(cpu_v6_set_pte)
...@@ -137,15 +137,16 @@ ENTRY(cpu_v6_set_pte) ...@@ -137,15 +137,16 @@ ENTRY(cpu_v6_set_pte)
bic r2, r2, #0x00000003 bic r2, r2, #0x00000003
orr r2, r2, #PTE_EXT_AP0 | 2 orr r2, r2, #PTE_EXT_AP0 | 2
tst r1, #L_PTE_WRITE tst r1, #L_PTE_DIRTY
tstne r1, #L_PTE_DIRTY
orreq r2, r2, #PTE_EXT_APX orreq r2, r2, #PTE_EXT_APX
tst r1, #L_PTE_USER tst r1, #L_PTE_USER
orrne r2, r2, #PTE_EXT_AP1 orrne r2, r2, #PTE_EXT_AP1
tstne r2, #PTE_EXT_APX bicne r2, r2, #PTE_EXT_AP0
bicne r2, r2, #PTE_EXT_APX | PTE_EXT_AP0 tstne r1, #L_PTE_WRITE
tstne r1, #L_PTE_DIRTY
eorne r2, r2, #PTE_EXT_AP0
tst r1, #L_PTE_YOUNG tst r1, #L_PTE_YOUNG
biceq r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK biceq r2, r2, #PTE_EXT_APX | PTE_EXT_AP_MASK
......
...@@ -183,7 +183,8 @@ static int __init new_switch(struct gpio_switch *sw) ...@@ -183,7 +183,8 @@ static int __init new_switch(struct gpio_switch *sw)
if (!direction) if (!direction)
return 0; 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) { if (r < 0) {
printk(KERN_ERR "gpio-switch: request_irq() failed " printk(KERN_ERR "gpio-switch: request_irq() failed "
"for GPIO %d\n", sw->gpio); "for GPIO %d\n", sw->gpio);
......
/* /*
* linux/arch/arm/plat-omap/gpio.c * linux/arch/arm/mach-omap/gpio.c
* *
* Support functions for OMAP GPIO * Support functions for OMAP GPIO
* *
* Copyright (C) 2003 Nokia Corporation * Copyright (C) 2003-2005 Nokia Corporation
* Written by Juha Yrjl <juha.yrjola@nokia.com> * Written by Juha Yrjl <juha.yrjola@nokia.com>
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -84,13 +84,40 @@ ...@@ -84,13 +84,40 @@
#define OMAP730_GPIO_INT_MASK 0x10 #define OMAP730_GPIO_INT_MASK 0x10
#define OMAP730_GPIO_INT_STATUS 0x14 #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) #define OMAP_MPUIO_MASK (~OMAP_MAX_GPIO_LINES & 0xff)
struct gpio_bank { struct gpio_bank {
u32 base; u32 base;
u16 irq; u16 irq;
u16 virtual_irq_start; u16 virtual_irq_start;
u8 method; int method;
u32 reserved_map; u32 reserved_map;
u32 suspend_wakeup; u32 suspend_wakeup;
u32 saved_wakeup; u32 saved_wakeup;
...@@ -101,8 +128,9 @@ struct gpio_bank { ...@@ -101,8 +128,9 @@ struct gpio_bank {
#define METHOD_GPIO_1510 1 #define METHOD_GPIO_1510 1
#define METHOD_GPIO_1610 2 #define METHOD_GPIO_1610 2
#define METHOD_GPIO_730 3 #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] = { static struct gpio_bank gpio_bank_1610[5] = {
{ OMAP_MPUIO_BASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO}, { OMAP_MPUIO_BASE, INT_MPUIO, IH_MPUIO_BASE, METHOD_MPUIO},
{ OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 }, { OMAP1610_GPIO1_BASE, INT_GPIO_BANK1, IH_GPIO_BASE, METHOD_GPIO_1610 },
...@@ -131,6 +159,15 @@ static struct gpio_bank gpio_bank_730[7] = { ...@@ -131,6 +159,15 @@ static struct gpio_bank gpio_bank_730[7] = {
}; };
#endif #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 struct gpio_bank *gpio_bank;
static int gpio_bank_count; static int gpio_bank_count;
...@@ -157,14 +194,23 @@ static inline struct gpio_bank *get_gpio_bank(int gpio) ...@@ -157,14 +194,23 @@ static inline struct gpio_bank *get_gpio_bank(int gpio)
return &gpio_bank[1 + (gpio >> 5)]; return &gpio_bank[1 + (gpio >> 5)];
} }
#endif #endif
#ifdef CONFIG_ARCH_OMAP24XX
if (cpu_is_omap24xx())
return &gpio_bank[gpio >> 5];
#endif
} }
static inline int get_gpio_index(int gpio) static inline int get_gpio_index(int gpio)
{ {
#ifdef CONFIG_ARCH_OMAP730
if (cpu_is_omap730()) if (cpu_is_omap730())
return gpio & 0x1f; return gpio & 0x1f;
else #endif
return gpio & 0x0f; #ifdef CONFIG_ARCH_OMAP24XX
if (cpu_is_omap24xx())
return gpio & 0x1f;
#endif
return gpio & 0x0f;
} }
static inline int gpio_valid(int gpio) static inline int gpio_valid(int gpio)
...@@ -187,6 +233,10 @@ static inline int gpio_valid(int gpio) ...@@ -187,6 +233,10 @@ static inline int gpio_valid(int gpio)
#ifdef CONFIG_ARCH_OMAP730 #ifdef CONFIG_ARCH_OMAP730
if (cpu_is_omap730() && gpio < 192) if (cpu_is_omap730() && gpio < 192)
return 0; return 0;
#endif
#ifdef CONFIG_ARCH_OMAP24XX
if (cpu_is_omap24xx() && gpio < 128)
return 0;
#endif #endif
return -1; return -1;
} }
...@@ -219,6 +269,9 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input) ...@@ -219,6 +269,9 @@ static void _set_gpio_direction(struct gpio_bank *bank, int gpio, int is_input)
case METHOD_GPIO_730: case METHOD_GPIO_730:
reg += OMAP730_GPIO_DIR_CONTROL; reg += OMAP730_GPIO_DIR_CONTROL;
break; break;
case METHOD_GPIO_24XX:
reg += OMAP24XX_GPIO_OE;
break;
} }
l = __raw_readl((void __iomem *)reg); l = __raw_readl((void __iomem *)reg);
if (is_input) if (is_input)
...@@ -277,6 +330,13 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable) ...@@ -277,6 +330,13 @@ static void _set_gpio_dataout(struct gpio_bank *bank, int gpio, int enable)
else else
l &= ~(1 << gpio); l &= ~(1 << gpio);
break; break;
case METHOD_GPIO_24XX:
if (enable)
reg += OMAP24XX_GPIO_SETDATAOUT;
else
reg += OMAP24XX_GPIO_CLEARDATAOUT;
l = 1 << gpio;
break;
default: default:
BUG(); BUG();
return; return;
...@@ -318,6 +378,9 @@ int omap_get_gpio_datain(int gpio) ...@@ -318,6 +378,9 @@ int omap_get_gpio_datain(int gpio)
case METHOD_GPIO_730: case METHOD_GPIO_730:
reg += OMAP730_GPIO_DATA_INPUT; reg += OMAP730_GPIO_DATA_INPUT;
break; break;
case METHOD_GPIO_24XX:
reg += OMAP24XX_GPIO_DATAIN;
break;
default: default:
BUG(); BUG();
return -1; return -1;
...@@ -326,18 +389,42 @@ int omap_get_gpio_datain(int gpio) ...@@ -326,18 +389,42 @@ int omap_get_gpio_datain(int gpio)
& (1 << get_gpio_index(gpio))) != 0; & (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 reg = bank->base;
u32 l; u32 l = 0;
switch (bank->method) { switch (bank->method) {
case METHOD_MPUIO: case METHOD_MPUIO:
reg += OMAP_MPUIO_GPIO_INT_EDGE; reg += OMAP_MPUIO_GPIO_INT_EDGE;
l = __raw_readl((void __iomem *)reg); l = __raw_readl((void __iomem *)reg);
if (edge == IRQT_RISING) if (trigger == IRQT_RISING)
l |= 1 << gpio; l |= 1 << gpio;
else if (edge == IRQT_FALLING) else if (trigger == IRQT_FALLING)
l &= ~(1 << gpio); l &= ~(1 << gpio);
else else
goto bad; goto bad;
...@@ -345,35 +432,41 @@ static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge) ...@@ -345,35 +432,41 @@ static int _set_gpio_edge_ctrl(struct gpio_bank *bank, int gpio, int edge)
case METHOD_GPIO_1510: case METHOD_GPIO_1510:
reg += OMAP1510_GPIO_INT_CONTROL; reg += OMAP1510_GPIO_INT_CONTROL;
l = __raw_readl((void __iomem *)reg); l = __raw_readl((void __iomem *)reg);
if (edge == IRQT_RISING) if (trigger == IRQT_RISING)
l |= 1 << gpio; l |= 1 << gpio;
else if (edge == IRQT_FALLING) else if (trigger == IRQT_FALLING)
l &= ~(1 << gpio); l &= ~(1 << gpio);
else else
goto bad; goto bad;
break; break;
case METHOD_GPIO_1610: case METHOD_GPIO_1610:
/* NOTE: knows __IRQT_{FAL,RIS}EDGE match OMAP hardware */
edge &= 0x03;
if (gpio & 0x08) if (gpio & 0x08)
reg += OMAP1610_GPIO_EDGE_CTRL2; reg += OMAP1610_GPIO_EDGE_CTRL2;
else else
reg += OMAP1610_GPIO_EDGE_CTRL1; reg += OMAP1610_GPIO_EDGE_CTRL1;
gpio &= 0x07; 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 = __raw_readl((void __iomem *)reg);
l &= ~(3 << (gpio << 1)); l &= ~(3 << (gpio << 1));
l |= edge << (gpio << 1); l |= trigger << (gpio << 1);
break; break;
case METHOD_GPIO_730: case METHOD_GPIO_730:
reg += OMAP730_GPIO_INT_CONTROL; reg += OMAP730_GPIO_INT_CONTROL;
l = __raw_readl((void __iomem *)reg); l = __raw_readl((void __iomem *)reg);
if (edge == IRQT_RISING) if (trigger == IRQT_RISING)
l |= 1 << gpio; l |= 1 << gpio;
else if (edge == IRQT_FALLING) else if (trigger == IRQT_FALLING)
l &= ~(1 << gpio); l &= ~(1 << gpio);
else else
goto bad; goto bad;
break; break;
case METHOD_GPIO_24XX:
set_24XX_gpio_triggering(reg, gpio, trigger);
break;
default: default:
BUG(); BUG();
goto bad; goto bad;
...@@ -403,13 +496,34 @@ static int gpio_irq_type(unsigned irq, unsigned type) ...@@ -403,13 +496,34 @@ static int gpio_irq_type(unsigned irq, unsigned type)
bank = get_gpio_bank(gpio); bank = get_gpio_bank(gpio);
spin_lock(&bank->lock); 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); spin_unlock(&bank->lock);
return retval; 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; u32 reg = bank->base, l;
...@@ -433,6 +547,8 @@ static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio) ...@@ -433,6 +547,8 @@ static int _get_gpio_edge_ctrl(struct gpio_bank *bank, int gpio)
l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL); l = __raw_readl(reg + OMAP730_GPIO_INT_CONTROL);
return (l & (1 << gpio)) ? return (l & (1 << gpio)) ?
IRQT_RISING : IRQT_FALLING; IRQT_RISING : IRQT_FALLING;
case METHOD_GPIO_24XX:
return get_24XX_gpio_triggering(reg, gpio);
default: default:
BUG(); BUG();
return -1; return -1;
...@@ -457,6 +573,9 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask) ...@@ -457,6 +573,9 @@ static void _clear_gpio_irqbank(struct gpio_bank *bank, int gpio_mask)
case METHOD_GPIO_730: case METHOD_GPIO_730:
reg += OMAP730_GPIO_INT_STATUS; reg += OMAP730_GPIO_INT_STATUS;
break; break;
case METHOD_GPIO_24XX:
reg += OMAP24XX_GPIO_IRQSTATUS1;
break;
default: default:
BUG(); BUG();
return; return;
...@@ -506,6 +625,13 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab ...@@ -506,6 +625,13 @@ static void _enable_gpio_irqbank(struct gpio_bank *bank, int gpio_mask, int enab
else else
l |= gpio_mask; l |= gpio_mask;
break; break;
case METHOD_GPIO_24XX:
if (enable)
reg += OMAP24XX_GPIO_SETIRQENABLE1;
else
reg += OMAP24XX_GPIO_CLEARIRQENABLE1;
l = gpio_mask;
break;
default: default:
BUG(); BUG();
return; return;
...@@ -530,6 +656,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable) ...@@ -530,6 +656,7 @@ static int _set_gpio_wakeup(struct gpio_bank *bank, int gpio, int enable)
{ {
switch (bank->method) { switch (bank->method) {
case METHOD_GPIO_1610: case METHOD_GPIO_1610:
case METHOD_GPIO_24XX:
spin_lock(&bank->lock); spin_lock(&bank->lock);
if (enable) if (enable)
bank->suspend_wakeup |= (1 << gpio); bank->suspend_wakeup |= (1 << gpio);
...@@ -581,7 +708,7 @@ int omap_request_gpio(int gpio) ...@@ -581,7 +708,7 @@ int omap_request_gpio(int gpio)
if (bank->method == METHOD_GPIO_1510) { if (bank->method == METHOD_GPIO_1510) {
u32 reg; u32 reg;
/* Claim the pin for the ARM */ /* Claim the pin for MPU */
reg = bank->base + OMAP1510_GPIO_PIN_CONTROL; reg = bank->base + OMAP1510_GPIO_PIN_CONTROL;
__raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg); __raw_writel(__raw_readl(reg) | (1 << get_gpio_index(gpio)), reg);
} }
...@@ -592,6 +719,13 @@ int omap_request_gpio(int gpio) ...@@ -592,6 +719,13 @@ int omap_request_gpio(int gpio)
u32 reg = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; u32 reg = bank->base + OMAP1610_GPIO_SET_WAKEUPENA;
__raw_writel(1 << get_gpio_index(gpio), (void __iomem *)reg); __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 #endif
spin_unlock(&bank->lock); spin_unlock(&bank->lock);
...@@ -618,6 +752,13 @@ void omap_free_gpio(int gpio) ...@@ -618,6 +752,13 @@ void omap_free_gpio(int gpio)
u32 reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; u32 reg = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA;
__raw_writel(1 << get_gpio_index(gpio), (void __iomem *)reg); __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 #endif
bank->reserved_map &= ~(1 << get_gpio_index(gpio)); bank->reserved_map &= ~(1 << get_gpio_index(gpio));
_set_gpio_direction(bank, get_gpio_index(gpio), 1); _set_gpio_direction(bank, get_gpio_index(gpio), 1);
...@@ -660,6 +801,10 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc, ...@@ -660,6 +801,10 @@ static void gpio_irq_handler(unsigned int irq, struct irqdesc *desc,
if (bank->method == METHOD_GPIO_730) if (bank->method == METHOD_GPIO_730)
isr_reg = bank->base + OMAP730_GPIO_INT_STATUS; isr_reg = bank->base + OMAP730_GPIO_INT_STATUS;
#endif #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); isr = __raw_readl((void __iomem *)isr_reg);
_enable_gpio_irqbank(bank, isr, 0); _enable_gpio_irqbank(bank, isr, 0);
...@@ -699,14 +844,15 @@ static void gpio_mask_irq(unsigned int irq) ...@@ -699,14 +844,15 @@ static void gpio_mask_irq(unsigned int irq)
static void gpio_unmask_irq(unsigned int irq) static void gpio_unmask_irq(unsigned int irq)
{ {
unsigned int gpio = irq - IH_GPIO_BASE; unsigned int gpio = irq - IH_GPIO_BASE;
unsigned int gpio_idx = get_gpio_index(gpio);
struct gpio_bank *bank = get_gpio_bank(gpio); struct gpio_bank *bank = get_gpio_bank(gpio);
if (_get_gpio_edge_ctrl(bank, get_gpio_index(gpio)) == IRQT_NOEDGE) { if (_get_gpio_triggering(bank, gpio_idx) == IRQT_NOEDGE) {
printk(KERN_ERR "OMAP GPIO %d: trying to enable GPIO IRQ while no edge is set\n", printk(KERN_ERR "OMAP GPIO %d: trying to enable GPIO IRQ while no triggering is set\n",
gpio); 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) static void mpuio_ack_irq(unsigned int irq)
...@@ -786,6 +932,17 @@ static int __init _omap_gpio_init(void) ...@@ -786,6 +932,17 @@ static int __init _omap_gpio_init(void)
gpio_bank_count = 7; gpio_bank_count = 7;
gpio_bank = gpio_bank_730; 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 #endif
for (i = 0; i < gpio_bank_count; i++) { for (i = 0; i < gpio_bank_count; i++) {
int j, gpio_count = 16; int j, gpio_count = 16;
...@@ -817,6 +974,14 @@ static int __init _omap_gpio_init(void) ...@@ -817,6 +974,14 @@ static int __init _omap_gpio_init(void)
gpio_count = 32; /* 730 has 32-bit GPIOs */ 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 #endif
for (j = bank->virtual_irq_start; for (j = bank->virtual_irq_start;
j < bank->virtual_irq_start + gpio_count; j++) { j < bank->virtual_irq_start + gpio_count; j++) {
...@@ -839,22 +1004,34 @@ static int __init _omap_gpio_init(void) ...@@ -839,22 +1004,34 @@ static int __init _omap_gpio_init(void)
return 0; 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) static int omap_gpio_suspend(struct sys_device *dev, pm_message_t mesg)
{ {
int i; int i;
if (cpu_is_omap1510()) if (!cpu_is_omap24xx() && !cpu_is_omap1610())
return 0; return 0;
for (i = 0; i < gpio_bank_count; i++) { for (i = 0; i < gpio_bank_count; i++) {
struct gpio_bank *bank = &gpio_bank[i]; struct gpio_bank *bank = &gpio_bank[i];
u32 wake_status = bank->base + OMAP1610_GPIO_WAKEUPENABLE; u32 wake_status;
u32 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; u32 wake_clear;
u32 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; u32 wake_set;
if (bank->method != METHOD_GPIO_1610) 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; continue;
}
spin_lock(&bank->lock); spin_lock(&bank->lock);
bank->saved_wakeup = __raw_readl(wake_status); bank->saved_wakeup = __raw_readl(wake_status);
...@@ -870,16 +1047,26 @@ static int omap_gpio_resume(struct sys_device *dev) ...@@ -870,16 +1047,26 @@ static int omap_gpio_resume(struct sys_device *dev)
{ {
int i; int i;
if (cpu_is_omap1510()) if (!cpu_is_omap24xx() && !cpu_is_omap1610())
return 0; return 0;
for (i = 0; i < gpio_bank_count; i++) { for (i = 0; i < gpio_bank_count; i++) {
struct gpio_bank *bank = &gpio_bank[i]; struct gpio_bank *bank = &gpio_bank[i];
u32 wake_clear = bank->base + OMAP1610_GPIO_CLEAR_WAKEUPENA; u32 wake_clear;
u32 wake_set = bank->base + OMAP1610_GPIO_SET_WAKEUPENA; u32 wake_set;
if (bank->method != METHOD_GPIO_1610) 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; continue;
}
spin_lock(&bank->lock); spin_lock(&bank->lock);
__raw_writel(0xffffffff, wake_clear); __raw_writel(0xffffffff, wake_clear);
...@@ -920,8 +1107,8 @@ static int __init omap_gpio_sysinit(void) ...@@ -920,8 +1107,8 @@ static int __init omap_gpio_sysinit(void)
if (!initialized) if (!initialized)
ret = _omap_gpio_init(); ret = _omap_gpio_init();
#ifdef CONFIG_ARCH_OMAP16XX #if defined(CONFIG_ARCH_OMAP16XX) || defined(CONFIG_ARCH_OMAP24XX)
if (cpu_is_omap16xx()) { if (cpu_is_omap16xx() || cpu_is_omap24xx()) {
if (ret == 0) { if (ret == 0) {
ret = sysdev_class_register(&omap_gpio_sysclass); ret = sysdev_class_register(&omap_gpio_sysclass);
if (ret == 0) if (ret == 0)
......
...@@ -1794,7 +1794,7 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios, ...@@ -1794,7 +1794,7 @@ serial8250_set_termios(struct uart_port *port, struct termios *termios,
#ifdef CONFIG_ARCH_OMAP1510 #ifdef CONFIG_ARCH_OMAP1510
/* Workaround to enable 115200 baud on OMAP1510 internal ports */ /* 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) { if (baud == 115200) {
quot = 1; quot = 1;
serial_out(up, UART_OMAP_OSC_12M_SEL, 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) ...@@ -1854,7 +1854,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
int ret = 0; int ret = 0;
#ifdef CONFIG_ARCH_OMAP #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; size = 0x16 << up->port.regshift;
#endif #endif
......
...@@ -30,6 +30,9 @@ ...@@ -30,6 +30,9 @@
#define __ASM_ARCH_OMAP_H4_H #define __ASM_ARCH_OMAP_H4_H
/* Placeholder for H4 specific defines */ /* Placeholder for H4 specific defines */
/* GPMC CS1 */
#define OMAP24XX_ETHR_START 0x08000300
#define OMAP24XX_ETHR_GPIO_IRQ 92
#endif /* __ASM_ARCH_OMAP_H4_H */ #endif /* __ASM_ARCH_OMAP_H4_H */
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
.macro addruart,rx .macro addruart,rx
mrc p15, 0, \rx, c1, c0 mrc p15, 0, \rx, c1, c0
tst \rx, #1 @ MMU enabled? tst \rx, #1 @ MMU enabled?
#ifdef CONFIG_ARCH_OMAP1
moveq \rx, #0xff000000 @ physical base address moveq \rx, #0xff000000 @ physical base address
movne \rx, #0xfe000000 @ virtual base movne \rx, #0xfe000000 @ virtual base
orr \rx, \rx, #0x00fb0000 orr \rx, \rx, #0x00fb0000
...@@ -22,6 +23,18 @@ ...@@ -22,6 +23,18 @@
#endif #endif
#if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3) #if defined(CONFIG_OMAP_LL_DEBUG_UART2) || defined(CONFIG_OMAP_LL_DEBUG_UART3)
orr \rx, \rx, #0x00000800 @ UART 2 & 3 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 #endif
.endm .endm
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
#if defined(CONFIG_ARCH_OMAP1)
#if defined(CONFIG_ARCH_OMAP730) && \ #if defined(CONFIG_ARCH_OMAP730) && \
(defined(CONFIG_ARCH_OMAP1510) || defined(CONFIG_ARCH_OMAP16XX)) (defined(CONFIG_ARCH_OMAP1510) || defined(CONFIG_ARCH_OMAP16XX))
#error "FIXME: OMAP730 doesn't support multiple-OMAP" #error "FIXME: OMAP730 doesn't support multiple-OMAP"
...@@ -38,3 +40,29 @@ ...@@ -38,3 +40,29 @@
1510: 1510:
.endm .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
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
* *
* OMAP GPIO handling defines and functions * OMAP GPIO handling defines and functions
* *
* Copyright (C) 2003 Nokia Corporation * Copyright (C) 2003-2005 Nokia Corporation
* *
* Written by Juha Yrjl <juha.yrjola@nokia.com> * Written by Juha Yrjl <juha.yrjola@nokia.com>
* *
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <asm/arch/cpu.h> #include <asm/arch/cpu.h>
#endif #endif
#include <asm/arch/io.h> #include <asm/arch/io.h>
#include <asm/arch/serial.h>
/* /*
* --------------------------------------------------------------------------- * ---------------------------------------------------------------------------
...@@ -143,6 +144,13 @@ ...@@ -143,6 +144,13 @@
* Interrupts * 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_IH1_BASE 0xfffecb00
#define OMAP_IH2_BASE 0xfffe0000 #define OMAP_IH2_BASE 0xfffe0000
...@@ -171,6 +179,8 @@ ...@@ -171,6 +179,8 @@
#define IRQ_ILR0_REG_OFFSET 0x1c #define IRQ_ILR0_REG_OFFSET 0x1c
#define IRQ_GMR_REG_OFFSET 0xa0 #define IRQ_GMR_REG_OFFSET 0xa0
#endif
/* /*
* ---------------------------------------------------------------------------- * ----------------------------------------------------------------------------
* System control registers * System control registers
...@@ -259,26 +269,6 @@ ...@@ -259,26 +269,6 @@
#ifndef __ASSEMBLER__ #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 * Processor specific defines
...@@ -287,6 +277,11 @@ ...@@ -287,6 +277,11 @@
#include "omap730.h" #include "omap730.h"
#include "omap1510.h" #include "omap1510.h"
#ifdef CONFIG_ARCH_OMAP24XX
#include "omap24xx.h"
#endif
#include "omap16xx.h" #include "omap16xx.h"
/* /*
...@@ -313,7 +308,6 @@ ...@@ -313,7 +308,6 @@
#ifdef CONFIG_MACH_OMAP_H4 #ifdef CONFIG_MACH_OMAP_H4
#include "board-h4.h" #include "board-h4.h"
#error "Support for H4 board not yet implemented."
#endif #endif
#ifdef CONFIG_MACH_OMAP_OSK #ifdef CONFIG_MACH_OMAP_OSK
......
...@@ -49,16 +49,24 @@ ...@@ -49,16 +49,24 @@
* I/O mapping * 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) #elif defined(CONFIG_ARCH_OMAP2)
#define io_v2p(x) ((x) + IO_OFFSET) #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__ #ifndef __ASSEMBLER__
...@@ -96,6 +104,8 @@ typedef struct { volatile u32 offset[4096]; } __regbase32; ...@@ -96,6 +104,8 @@ typedef struct { volatile u32 offset[4096]; } __regbase32;
->offset[((vaddr)&4095)>>2] ->offset[((vaddr)&4095)>>2]
#define __REG32(paddr) __REGV32(io_p2v(paddr)) #define __REG32(paddr) __REGV32(io_p2v(paddr))
extern void omap_map_common_io(void);
#else #else
#define __REG8(paddr) io_p2v(paddr) #define __REG8(paddr) io_p2v(paddr)
......
...@@ -232,6 +232,11 @@ ...@@ -232,6 +232,11 @@
#define INT_730_DMA_CH15 (62 + IH2_BASE) #define INT_730_DMA_CH15 (62 + IH2_BASE)
#define INT_730_NAND (63 + 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 /* Max. 128 level 2 IRQs (OMAP1610), 192 GPIOs (OMAP730) and
* 16 MPUIO lines */ * 16 MPUIO lines */
#define OMAP_MAX_GPIO_LINES 192 #define OMAP_MAX_GPIO_LINES 192
......
...@@ -36,12 +36,11 @@ ...@@ -36,12 +36,11 @@
/* /*
* Physical DRAM offset. * Physical DRAM offset.
*/ */
#if defined(CONFIG_ARCH_OMAP1)
#define PHYS_OFFSET (0x10000000UL) #define PHYS_OFFSET (0x10000000UL)
#elif defined(CONFIG_ARCH_OMAP2)
/* #define PHYS_OFFSET (0x80000000UL)
* OMAP-1510 Local Bus address offset #endif
*/
#define OMAP1510_LB_OFFSET (0x30000000UL)
/* /*
* Conversion between SDRAM and fake PCI bus, used by USB * Conversion between SDRAM and fake PCI bus, used by USB
...@@ -64,6 +63,11 @@ ...@@ -64,6 +63,11 @@
*/ */
#ifdef CONFIG_ARCH_OMAP1510 #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 virt_to_lbus(x) ((x) - PAGE_OFFSET + OMAP1510_LB_OFFSET)
#define lbus_to_virt(x) ((x) - OMAP1510_LB_OFFSET + PAGE_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)) #define is_lbus_device(dev) (cpu_is_omap1510() && dev && (strncmp(dev->bus_id, "ohci", 4) == 0))
......
#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 */
...@@ -99,7 +99,8 @@ ...@@ -99,7 +99,8 @@
#define OMAP1610_IDLE_LOOP_REQUEST 0x0400 #define OMAP1610_IDLE_LOOP_REQUEST 0x0400
#if !defined(CONFIG_ARCH_OMAP1510) && \ #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" #error "Power management for this processor not implemented yet"
#endif #endif
......
/*
* 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
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
#include <linux/config.h> #include <linux/config.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/serial_reg.h> #include <linux/serial_reg.h>
#include <asm/arch/hardware.h> #include <asm/arch/serial.h>
unsigned int system_rev; unsigned int system_rev;
...@@ -34,8 +34,9 @@ static void ...@@ -34,8 +34,9 @@ static void
putstr(const char *s) putstr(const char *s)
{ {
volatile u8 * uart = 0; volatile u8 * uart = 0;
int shift; int shift = 2;
#ifdef CONFIG_ARCH_OMAP
#ifdef CONFIG_OMAP_LL_DEBUG_UART3 #ifdef CONFIG_OMAP_LL_DEBUG_UART3
uart = (volatile u8 *)(OMAP_UART3_BASE); uart = (volatile u8 *)(OMAP_UART3_BASE);
#elif CONFIG_OMAP_LL_DEBUG_UART2 #elif CONFIG_OMAP_LL_DEBUG_UART2
...@@ -44,6 +45,7 @@ putstr(const char *s) ...@@ -44,6 +45,7 @@ putstr(const char *s)
uart = (volatile u8 *)(OMAP_UART1_BASE); uart = (volatile u8 *)(OMAP_UART1_BASE);
#endif #endif
#ifdef CONFIG_ARCH_OMAP1
/* Determine which serial port to use */ /* Determine which serial port to use */
do { do {
/* MMU is not on, so cpu_is_omapXXXX() won't work here */ /* MMU is not on, so cpu_is_omapXXXX() won't work here */
...@@ -51,14 +53,14 @@ putstr(const char *s) ...@@ -51,14 +53,14 @@ putstr(const char *s)
if (omap_id == OMAP_ID_730) if (omap_id == OMAP_ID_730)
shift = 0; shift = 0;
else
shift = 2;
if (check_port(uart, shift)) if (check_port(uart, shift))
break; break;
/* Silent boot if no serial ports are enabled. */ /* Silent boot if no serial ports are enabled. */
return; return;
} while (0); } while (0);
#endif /* CONFIG_ARCH_OMAP1 */
#endif
/* /*
* Now, xmit each character * Now, xmit each character
......
...@@ -256,7 +256,7 @@ extern void dmac_flush_range(unsigned long, unsigned long); ...@@ -256,7 +256,7 @@ extern void dmac_flush_range(unsigned long, unsigned long);
* Convert calls to our calling convention. * Convert calls to our calling convention.
*/ */
#define flush_cache_all() __cpuc_flush_kern_all() #define flush_cache_all() __cpuc_flush_kern_all()
#ifndef CONFIG_CPU_CACHE_VIPT
static inline void flush_cache_mm(struct mm_struct *mm) static inline void flush_cache_mm(struct mm_struct *mm)
{ {
if (cpu_isset(smp_processor_id(), mm->cpu_vm_mask)) 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 ...@@ -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); __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 * flush_cache_user_range is used when we want to ensure that the
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment