diff options
| author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 19:08:50 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-15 19:08:50 -0400 |
| commit | 65a6ec0d72a07f16719e9b7a96e1c4bae044b591 (patch) | |
| tree | 344e03a5039a44982c1b78d6113633b21b434820 /arch/arm/mach-omap2 | |
| parent | 541010e4b8921cd781ff02ae68028501457045b6 (diff) | |
| parent | 0181b61a988424b5cc44fe09e6968142359c815e (diff) | |
Merge branch 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm
* 'devel' of master.kernel.org:/home/rmk/linux-2.6-arm: (95 commits)
[ARM] 4578/1: CM-x270: PCMCIA support
[ARM] 4577/1: ITE 8152 PCI bridge support
[ARM] 4576/1: CM-X270 machine support
[ARM] pxa: Avoid pxa_gpio_mode() in gpio_direction_{in,out}put()
[ARM] pxa: move pxa_set_mode() from pxa2xx_mainstone.c to mainstone.c
[ARM] pxa: move pxa_set_mode() from pxa2xx_lubbock.c to lubbock.c
[ARM] pxa: Make cpu_is_pxaXXX dependent on configuration symbols
[ARM] pxa: PXA3xx base support
[NET] smc91x: fix PXA DMA support code
[SERIAL] Fix console initialisation ordering
[ARM] pxa: tidy up arch/arm/mach-pxa/Makefile
[ARM] Update arch/arm/Kconfig for drivers/Kconfig changes
[ARM] 4600/1: fix kernel build failure with build-id-supporting binutils
[ARM] 4599/1: Preserve ATAG list for use with kexec (2.6.23)
[ARM] Rename consistent_sync() as dma_cache_maint()
[ARM] 4572/1: ep93xx: add cirrus logic edb9307 support
[ARM] 4596/1: S3C2412: Correct IRQs for SDI+CF and add decoding support
[ARM] 4595/1: ns9xxx: define registers as void __iomem * instead of volatile u32
[ARM] 4594/1: ns9xxx: use the new gpio functions
[ARM] 4593/1: ns9xxx: implement generic clockevents
...
Diffstat (limited to 'arch/arm/mach-omap2')
| -rw-r--r-- | arch/arm/mach-omap2/Kconfig | 11 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/Makefile | 1 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-2430sdp.c | 218 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-apollon.c | 99 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/board-h4.c | 46 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/devices.c | 6 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/gpmc.c | 47 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/id.c | 6 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/io.c | 22 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/irq.c | 19 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/memory.c | 18 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/mux.c | 38 | ||||
| -rw-r--r-- | arch/arm/mach-omap2/usb-tusb6010.c | 349 |
13 files changed, 787 insertions, 93 deletions
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig index 7393109f5c30..7069c9d536f1 100644 --- a/arch/arm/mach-omap2/Kconfig +++ b/arch/arm/mach-omap2/Kconfig | |||
| @@ -11,6 +11,10 @@ config ARCH_OMAP2420 | |||
| 11 | select OMAP_DM_TIMER | 11 | select OMAP_DM_TIMER |
| 12 | select ARCH_OMAP_OTG | 12 | select ARCH_OMAP_OTG |
| 13 | 13 | ||
| 14 | config ARCH_OMAP2430 | ||
| 15 | bool "OMAP2430 support" | ||
| 16 | depends on ARCH_OMAP24XX | ||
| 17 | |||
| 14 | comment "OMAP Board Type" | 18 | comment "OMAP Board Type" |
| 15 | depends on ARCH_OMAP2 | 19 | depends on ARCH_OMAP2 |
| 16 | 20 | ||
| @@ -21,8 +25,13 @@ config MACH_OMAP_GENERIC | |||
| 21 | config MACH_OMAP_H4 | 25 | config MACH_OMAP_H4 |
| 22 | bool "OMAP 2420 H4 board" | 26 | bool "OMAP 2420 H4 board" |
| 23 | depends on ARCH_OMAP2 && ARCH_OMAP24XX | 27 | depends on ARCH_OMAP2 && ARCH_OMAP24XX |
| 24 | select OMAP_DEBUG_LEDS if LEDS || LEDS_OMAP_DEBUG | 28 | select OMAP_DEBUG_DEVICES |
| 25 | 29 | ||
| 26 | config MACH_OMAP_APOLLON | 30 | config MACH_OMAP_APOLLON |
| 27 | bool "OMAP 2420 Apollon board" | 31 | bool "OMAP 2420 Apollon board" |
| 28 | depends on ARCH_OMAP2 && ARCH_OMAP24XX | 32 | depends on ARCH_OMAP2 && ARCH_OMAP24XX |
| 33 | |||
| 34 | config MACH_OMAP_2430SDP | ||
| 35 | bool "OMAP 2430 SDP board" | ||
| 36 | depends on ARCH_OMAP2 && ARCH_OMAP24XX | ||
| 37 | |||
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile index 266d88e77bdc..b05b738d31e6 100644 --- a/arch/arm/mach-omap2/Makefile +++ b/arch/arm/mach-omap2/Makefile | |||
| @@ -14,5 +14,6 @@ obj-$(CONFIG_PM) += pm.o pm-domain.o sleep.o | |||
| 14 | # Specific board support | 14 | # Specific board support |
| 15 | obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o | 15 | obj-$(CONFIG_MACH_OMAP_GENERIC) += board-generic.o |
| 16 | obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o | 16 | obj-$(CONFIG_MACH_OMAP_H4) += board-h4.o |
| 17 | obj-$(CONFIG_MACH_OMAP_2430SDP) += board-2430sdp.o | ||
| 17 | obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o | 18 | obj-$(CONFIG_MACH_OMAP_APOLLON) += board-apollon.o |
| 18 | 19 | ||
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c new file mode 100644 index 000000000000..7e76fbf19b5d --- /dev/null +++ b/arch/arm/mach-omap2/board-2430sdp.c | |||
| @@ -0,0 +1,218 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/mach-omap2/board-2430sdp.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Texas Instruments | ||
| 5 | * | ||
| 6 | * Modified from mach-omap2/board-generic.c | ||
| 7 | * | ||
| 8 | * Initial Code : Based on a patch from Komal Shah and Richard Woodruff | ||
| 9 | * Updated the Code for 2430 SDP : Syed Mohammed Khasim | ||
| 10 | * | ||
| 11 | * This program is free software; you can redistribute it and/or modify | ||
| 12 | * it under the terms of the GNU General Public License version 2 as | ||
| 13 | * published by the Free Software Foundation. | ||
| 14 | */ | ||
| 15 | |||
| 16 | #include <linux/kernel.h> | ||
| 17 | #include <linux/init.h> | ||
| 18 | #include <linux/platform_device.h> | ||
| 19 | #include <linux/mtd/mtd.h> | ||
| 20 | #include <linux/mtd/partitions.h> | ||
| 21 | #include <linux/delay.h> | ||
| 22 | #include <linux/err.h> | ||
| 23 | #include <linux/clk.h> | ||
| 24 | |||
| 25 | #include <asm/hardware.h> | ||
| 26 | #include <asm/mach-types.h> | ||
| 27 | #include <asm/mach/arch.h> | ||
| 28 | #include <asm/mach/map.h> | ||
| 29 | #include <asm/mach/flash.h> | ||
| 30 | |||
| 31 | #include <asm/arch/gpio.h> | ||
| 32 | #include <asm/arch/mux.h> | ||
| 33 | #include <asm/arch/board.h> | ||
| 34 | #include <asm/arch/common.h> | ||
| 35 | #include <asm/arch/gpmc.h> | ||
| 36 | #include "prcm-regs.h" | ||
| 37 | |||
| 38 | #include <asm/io.h> | ||
| 39 | |||
| 40 | |||
| 41 | #define SDP2430_FLASH_CS 0 | ||
| 42 | #define SDP2430_SMC91X_CS 5 | ||
| 43 | |||
| 44 | static struct mtd_partition sdp2430_partitions[] = { | ||
| 45 | /* bootloader (U-Boot, etc) in first sector */ | ||
| 46 | { | ||
| 47 | .name = "bootloader", | ||
| 48 | .offset = 0, | ||
| 49 | .size = SZ_256K, | ||
| 50 | .mask_flags = MTD_WRITEABLE, /* force read-only */ | ||
| 51 | }, | ||
| 52 | /* bootloader params in the next sector */ | ||
| 53 | { | ||
| 54 | .name = "params", | ||
| 55 | .offset = MTDPART_OFS_APPEND, | ||
| 56 | .size = SZ_128K, | ||
| 57 | .mask_flags = 0, | ||
| 58 | }, | ||
| 59 | /* kernel */ | ||
| 60 | { | ||
| 61 | .name = "kernel", | ||
| 62 | .offset = MTDPART_OFS_APPEND, | ||
| 63 | .size = SZ_2M, | ||
| 64 | .mask_flags = 0 | ||
| 65 | }, | ||
| 66 | /* file system */ | ||
| 67 | { | ||
| 68 | .name = "filesystem", | ||
| 69 | .offset = MTDPART_OFS_APPEND, | ||
| 70 | .size = MTDPART_SIZ_FULL, | ||
| 71 | .mask_flags = 0 | ||
| 72 | } | ||
| 73 | }; | ||
| 74 | |||
| 75 | static struct flash_platform_data sdp2430_flash_data = { | ||
| 76 | .map_name = "cfi_probe", | ||
| 77 | .width = 2, | ||
| 78 | .parts = sdp2430_partitions, | ||
| 79 | .nr_parts = ARRAY_SIZE(sdp2430_partitions), | ||
| 80 | }; | ||
| 81 | |||
| 82 | static struct resource sdp2430_flash_resource = { | ||
| 83 | .start = SDP2430_CS0_BASE, | ||
| 84 | .end = SDP2430_CS0_BASE + SZ_64M - 1, | ||
| 85 | .flags = IORESOURCE_MEM, | ||
| 86 | }; | ||
| 87 | |||
| 88 | static struct platform_device sdp2430_flash_device = { | ||
| 89 | .name = "omapflash", | ||
| 90 | .id = 0, | ||
| 91 | .dev = { | ||
| 92 | .platform_data = &sdp2430_flash_data, | ||
| 93 | }, | ||
| 94 | .num_resources = 1, | ||
| 95 | .resource = &sdp2430_flash_resource, | ||
| 96 | }; | ||
| 97 | |||
| 98 | static struct resource sdp2430_smc91x_resources[] = { | ||
| 99 | [0] = { | ||
| 100 | .start = SDP2430_CS0_BASE, | ||
| 101 | .end = SDP2430_CS0_BASE + SZ_64M - 1, | ||
| 102 | .flags = IORESOURCE_MEM, | ||
| 103 | }, | ||
| 104 | [1] = { | ||
| 105 | .start = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ), | ||
| 106 | .end = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ), | ||
| 107 | .flags = IORESOURCE_IRQ, | ||
| 108 | }, | ||
| 109 | }; | ||
| 110 | |||
| 111 | static struct platform_device sdp2430_smc91x_device = { | ||
| 112 | .name = "smc91x", | ||
| 113 | .id = -1, | ||
| 114 | .num_resources = ARRAY_SIZE(sdp2430_smc91x_resources), | ||
| 115 | .resource = sdp2430_smc91x_resources, | ||
| 116 | }; | ||
| 117 | |||
| 118 | static struct platform_device *sdp2430_devices[] __initdata = { | ||
| 119 | &sdp2430_smc91x_device, | ||
| 120 | &sdp2430_flash_device, | ||
| 121 | }; | ||
| 122 | |||
| 123 | static inline void __init sdp2430_init_smc91x(void) | ||
| 124 | { | ||
| 125 | int eth_cs; | ||
| 126 | unsigned long cs_mem_base; | ||
| 127 | unsigned int rate; | ||
| 128 | struct clk *l3ck; | ||
| 129 | |||
| 130 | eth_cs = SDP2430_SMC91X_CS; | ||
| 131 | |||
| 132 | l3ck = clk_get(NULL, "core_l3_ck"); | ||
| 133 | if (IS_ERR(l3ck)) | ||
| 134 | rate = 100000000; | ||
| 135 | else | ||
| 136 | rate = clk_get_rate(l3ck); | ||
| 137 | |||
| 138 | /* Make sure CS1 timings are correct, for 2430 always muxed */ | ||
| 139 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); | ||
| 140 | |||
| 141 | if (rate >= 160000000) { | ||
| 142 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); | ||
| 143 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); | ||
| 144 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); | ||
| 145 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
| 146 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
| 147 | } else if (rate >= 130000000) { | ||
| 148 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
| 149 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
| 150 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
| 151 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
| 152 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
| 153 | } else { /* rate = 100000000 */ | ||
| 154 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
| 155 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
| 156 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
| 157 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
| 158 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
| 159 | } | ||
| 160 | |||
| 161 | if (gpmc_cs_request(eth_cs, SZ_16M, &cs_mem_base) < 0) { | ||
| 162 | printk(KERN_ERR "Failed to request GPMC mem for smc91x\n"); | ||
| 163 | return; | ||
| 164 | } | ||
| 165 | |||
| 166 | sdp2430_smc91x_resources[0].start = cs_mem_base + 0x300; | ||
| 167 | sdp2430_smc91x_resources[0].end = cs_mem_base + 0x30f; | ||
| 168 | udelay(100); | ||
| 169 | |||
| 170 | if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) { | ||
| 171 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | ||
| 172 | OMAP24XX_ETHR_GPIO_IRQ); | ||
| 173 | gpmc_cs_free(eth_cs); | ||
| 174 | return; | ||
| 175 | } | ||
| 176 | omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1); | ||
| 177 | |||
| 178 | } | ||
| 179 | |||
| 180 | static void __init omap_2430sdp_init_irq(void) | ||
| 181 | { | ||
| 182 | omap2_init_common_hw(); | ||
| 183 | omap_init_irq(); | ||
| 184 | omap_gpio_init(); | ||
| 185 | sdp2430_init_smc91x(); | ||
| 186 | } | ||
| 187 | |||
| 188 | static struct omap_uart_config sdp2430_uart_config __initdata = { | ||
| 189 | .enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)), | ||
| 190 | }; | ||
| 191 | |||
| 192 | static struct omap_board_config_kernel sdp2430_config[] = { | ||
| 193 | {OMAP_TAG_UART, &sdp2430_uart_config}, | ||
| 194 | }; | ||
| 195 | |||
| 196 | static void __init omap_2430sdp_init(void) | ||
| 197 | { | ||
| 198 | platform_add_devices(sdp2430_devices, ARRAY_SIZE(sdp2430_devices)); | ||
| 199 | omap_board_config = sdp2430_config; | ||
| 200 | omap_board_config_size = ARRAY_SIZE(sdp2430_config); | ||
| 201 | omap_serial_init(); | ||
| 202 | } | ||
| 203 | |||
| 204 | static void __init omap_2430sdp_map_io(void) | ||
| 205 | { | ||
| 206 | omap2_map_common_io(); | ||
| 207 | } | ||
| 208 | |||
| 209 | MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board") | ||
| 210 | /* Maintainer: Syed Khasim - Texas Instruments Inc */ | ||
| 211 | .phys_io = 0x48000000, | ||
| 212 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, | ||
| 213 | .boot_params = 0x80000100, | ||
| 214 | .map_io = omap_2430sdp_map_io, | ||
| 215 | .init_irq = omap_2430sdp_init_irq, | ||
| 216 | .init_machine = omap_2430sdp_init, | ||
| 217 | .timer = &omap_timer, | ||
| 218 | MACHINE_END | ||
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index 878ff9181d0e..3bb49c17c858 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
| @@ -25,6 +25,8 @@ | |||
| 25 | #include <linux/irq.h> | 25 | #include <linux/irq.h> |
| 26 | #include <linux/interrupt.h> | 26 | #include <linux/interrupt.h> |
| 27 | #include <linux/delay.h> | 27 | #include <linux/delay.h> |
| 28 | #include <linux/leds.h> | ||
| 29 | #include <linux/irq.h> | ||
| 28 | 30 | ||
| 29 | #include <asm/hardware.h> | 31 | #include <asm/hardware.h> |
| 30 | #include <asm/mach-types.h> | 32 | #include <asm/mach-types.h> |
| @@ -32,10 +34,12 @@ | |||
| 32 | #include <asm/mach/flash.h> | 34 | #include <asm/mach/flash.h> |
| 33 | 35 | ||
| 34 | #include <asm/arch/gpio.h> | 36 | #include <asm/arch/gpio.h> |
| 37 | #include <asm/arch/led.h> | ||
| 35 | #include <asm/arch/mux.h> | 38 | #include <asm/arch/mux.h> |
| 36 | #include <asm/arch/usb.h> | 39 | #include <asm/arch/usb.h> |
| 37 | #include <asm/arch/board.h> | 40 | #include <asm/arch/board.h> |
| 38 | #include <asm/arch/common.h> | 41 | #include <asm/arch/common.h> |
| 42 | #include <asm/arch/gpmc.h> | ||
| 39 | #include "prcm-regs.h" | 43 | #include "prcm-regs.h" |
| 40 | 44 | ||
| 41 | /* LED & Switch macros */ | 45 | /* LED & Switch macros */ |
| @@ -46,6 +50,9 @@ | |||
| 46 | #define SW_UP_GPIO17 17 | 50 | #define SW_UP_GPIO17 17 |
| 47 | #define SW_DOWN_GPIO58 58 | 51 | #define SW_DOWN_GPIO58 58 |
| 48 | 52 | ||
| 53 | #define APOLLON_FLASH_CS 0 | ||
| 54 | #define APOLLON_ETH_CS 1 | ||
| 55 | |||
| 49 | static struct mtd_partition apollon_partitions[] = { | 56 | static struct mtd_partition apollon_partitions[] = { |
| 50 | { | 57 | { |
| 51 | .name = "X-Loader + U-Boot", | 58 | .name = "X-Loader + U-Boot", |
| @@ -85,10 +92,10 @@ static struct flash_platform_data apollon_flash_data = { | |||
| 85 | .nr_parts = ARRAY_SIZE(apollon_partitions), | 92 | .nr_parts = ARRAY_SIZE(apollon_partitions), |
| 86 | }; | 93 | }; |
| 87 | 94 | ||
| 88 | static struct resource apollon_flash_resource = { | 95 | static struct resource apollon_flash_resource[] = { |
| 89 | .start = APOLLON_CS0_BASE, | 96 | [0] = { |
| 90 | .end = APOLLON_CS0_BASE + SZ_128K, | 97 | .flags = IORESOURCE_MEM, |
| 91 | .flags = IORESOURCE_MEM, | 98 | }, |
| 92 | }; | 99 | }; |
| 93 | 100 | ||
| 94 | static struct platform_device apollon_onenand_device = { | 101 | static struct platform_device apollon_onenand_device = { |
| @@ -97,14 +104,24 @@ static struct platform_device apollon_onenand_device = { | |||
| 97 | .dev = { | 104 | .dev = { |
| 98 | .platform_data = &apollon_flash_data, | 105 | .platform_data = &apollon_flash_data, |
| 99 | }, | 106 | }, |
| 100 | .num_resources = ARRAY_SIZE(&apollon_flash_resource), | 107 | .num_resources = ARRAY_SIZE(apollon_flash_resource), |
| 101 | .resource = &apollon_flash_resource, | 108 | .resource = apollon_flash_resource, |
| 102 | }; | 109 | }; |
| 103 | 110 | ||
| 111 | static void __init apollon_flash_init(void) | ||
| 112 | { | ||
| 113 | unsigned long base; | ||
| 114 | |||
| 115 | if (gpmc_cs_request(APOLLON_FLASH_CS, SZ_128K, &base) < 0) { | ||
| 116 | printk(KERN_ERR "Cannot request OneNAND GPMC CS\n"); | ||
| 117 | return; | ||
| 118 | } | ||
| 119 | apollon_flash_resource[0].start = base; | ||
| 120 | apollon_flash_resource[0].end = base + SZ_128K - 1; | ||
| 121 | } | ||
| 122 | |||
| 104 | static struct resource apollon_smc91x_resources[] = { | 123 | static struct resource apollon_smc91x_resources[] = { |
| 105 | [0] = { | 124 | [0] = { |
| 106 | .start = APOLLON_ETHR_START, /* Physical */ | ||
| 107 | .end = APOLLON_ETHR_START + 0xf, | ||
| 108 | .flags = IORESOURCE_MEM, | 125 | .flags = IORESOURCE_MEM, |
| 109 | }, | 126 | }, |
| 110 | [1] = { | 127 | [1] = { |
| @@ -126,14 +143,51 @@ static struct platform_device apollon_lcd_device = { | |||
| 126 | .id = -1, | 143 | .id = -1, |
| 127 | }; | 144 | }; |
| 128 | 145 | ||
| 146 | static struct omap_led_config apollon_led_config[] = { | ||
| 147 | { | ||
| 148 | .cdev = { | ||
| 149 | .name = "apollon:led0", | ||
| 150 | }, | ||
| 151 | .gpio = LED0_GPIO13, | ||
| 152 | }, | ||
| 153 | { | ||
| 154 | .cdev = { | ||
| 155 | .name = "apollon:led1", | ||
| 156 | }, | ||
| 157 | .gpio = LED1_GPIO14, | ||
| 158 | }, | ||
| 159 | { | ||
| 160 | .cdev = { | ||
| 161 | .name = "apollon:led2", | ||
| 162 | }, | ||
| 163 | .gpio = LED2_GPIO15, | ||
| 164 | }, | ||
| 165 | }; | ||
| 166 | |||
| 167 | static struct omap_led_platform_data apollon_led_data = { | ||
| 168 | .nr_leds = ARRAY_SIZE(apollon_led_config), | ||
| 169 | .leds = apollon_led_config, | ||
| 170 | }; | ||
| 171 | |||
| 172 | static struct platform_device apollon_led_device = { | ||
| 173 | .name = "omap-led", | ||
| 174 | .id = -1, | ||
| 175 | .dev = { | ||
| 176 | .platform_data = &apollon_led_data, | ||
| 177 | }, | ||
| 178 | }; | ||
| 179 | |||
| 129 | static struct platform_device *apollon_devices[] __initdata = { | 180 | static struct platform_device *apollon_devices[] __initdata = { |
| 130 | &apollon_onenand_device, | 181 | &apollon_onenand_device, |
| 131 | &apollon_smc91x_device, | 182 | &apollon_smc91x_device, |
| 132 | &apollon_lcd_device, | 183 | &apollon_lcd_device, |
| 184 | &apollon_led_device, | ||
| 133 | }; | 185 | }; |
| 134 | 186 | ||
| 135 | static inline void __init apollon_init_smc91x(void) | 187 | static inline void __init apollon_init_smc91x(void) |
| 136 | { | 188 | { |
| 189 | unsigned long base; | ||
| 190 | |||
| 137 | /* Make sure CS1 timings are correct */ | 191 | /* Make sure CS1 timings are correct */ |
| 138 | GPMC_CONFIG1_1 = 0x00011203; | 192 | GPMC_CONFIG1_1 = 0x00011203; |
| 139 | GPMC_CONFIG2_1 = 0x001f1f01; | 193 | GPMC_CONFIG2_1 = 0x001f1f01; |
| @@ -141,13 +195,20 @@ static inline void __init apollon_init_smc91x(void) | |||
| 141 | GPMC_CONFIG4_1 = 0x1c091c09; | 195 | GPMC_CONFIG4_1 = 0x1c091c09; |
| 142 | GPMC_CONFIG5_1 = 0x041f1f1f; | 196 | GPMC_CONFIG5_1 = 0x041f1f1f; |
| 143 | GPMC_CONFIG6_1 = 0x000004c4; | 197 | GPMC_CONFIG6_1 = 0x000004c4; |
| 144 | GPMC_CONFIG7_1 = 0x00000f40 | (APOLLON_CS1_BASE >> 24); | 198 | |
| 199 | if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { | ||
| 200 | printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); | ||
| 201 | return; | ||
| 202 | } | ||
| 203 | apollon_smc91x_resources[0].start = base + 0x300; | ||
| 204 | apollon_smc91x_resources[0].end = base + 0x30f; | ||
| 145 | udelay(100); | 205 | udelay(100); |
| 146 | 206 | ||
| 147 | omap_cfg_reg(W4__24XX_GPIO74); | 207 | omap_cfg_reg(W4__24XX_GPIO74); |
| 148 | if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { | 208 | if (omap_request_gpio(APOLLON_ETHR_GPIO_IRQ) < 0) { |
| 149 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 209 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", |
| 150 | APOLLON_ETHR_GPIO_IRQ); | 210 | APOLLON_ETHR_GPIO_IRQ); |
| 211 | gpmc_cs_free(APOLLON_ETH_CS); | ||
| 151 | return; | 212 | return; |
| 152 | } | 213 | } |
| 153 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); | 214 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); |
| @@ -175,6 +236,13 @@ static struct omap_mmc_config apollon_mmc_config __initdata = { | |||
| 175 | }, | 236 | }, |
| 176 | }; | 237 | }; |
| 177 | 238 | ||
| 239 | static struct omap_usb_config apollon_usb_config __initdata = { | ||
| 240 | .register_dev = 1, | ||
| 241 | .hmc_mode = 0x14, /* 0:dev 1:host1 2:disable */ | ||
| 242 | |||
| 243 | .pins[0] = 6, | ||
| 244 | }; | ||
| 245 | |||
| 178 | static struct omap_lcd_config apollon_lcd_config __initdata = { | 246 | static struct omap_lcd_config apollon_lcd_config __initdata = { |
| 179 | .ctrl_name = "internal", | 247 | .ctrl_name = "internal", |
| 180 | }; | 248 | }; |
| @@ -182,6 +250,7 @@ static struct omap_lcd_config apollon_lcd_config __initdata = { | |||
| 182 | static struct omap_board_config_kernel apollon_config[] = { | 250 | static struct omap_board_config_kernel apollon_config[] = { |
| 183 | { OMAP_TAG_UART, &apollon_uart_config }, | 251 | { OMAP_TAG_UART, &apollon_uart_config }, |
| 184 | { OMAP_TAG_MMC, &apollon_mmc_config }, | 252 | { OMAP_TAG_MMC, &apollon_mmc_config }, |
| 253 | { OMAP_TAG_USB, &apollon_usb_config }, | ||
| 185 | { OMAP_TAG_LCD, &apollon_lcd_config }, | 254 | { OMAP_TAG_LCD, &apollon_lcd_config }, |
| 186 | }; | 255 | }; |
| 187 | 256 | ||
| @@ -250,10 +319,22 @@ static void __init apollon_sw_init(void) | |||
| 250 | return; | 319 | return; |
| 251 | } | 320 | } |
| 252 | 321 | ||
| 322 | static void __init apollon_usb_init(void) | ||
| 323 | { | ||
| 324 | /* USB device */ | ||
| 325 | /* DEVICE_SUSPEND */ | ||
| 326 | omap_cfg_reg(P21_242X_GPIO12); | ||
| 327 | omap_request_gpio(12); | ||
| 328 | omap_set_gpio_direction(12, 0); /* OUT */ | ||
| 329 | omap_set_gpio_dataout(12, 0); | ||
| 330 | } | ||
| 331 | |||
| 253 | static void __init omap_apollon_init(void) | 332 | static void __init omap_apollon_init(void) |
| 254 | { | 333 | { |
| 255 | apollon_led_init(); | 334 | apollon_led_init(); |
| 256 | apollon_sw_init(); | 335 | apollon_sw_init(); |
| 336 | apollon_flash_init(); | ||
| 337 | apollon_usb_init(); | ||
| 257 | 338 | ||
| 258 | /* REVISIT: where's the correct place */ | 339 | /* REVISIT: where's the correct place */ |
| 259 | omap_cfg_reg(W19_24XX_SYS_NIRQ); | 340 | omap_cfg_reg(W19_24XX_SYS_NIRQ); |
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c index 452193f01531..f125f432cc3e 100644 --- a/arch/arm/mach-omap2/board-h4.c +++ b/arch/arm/mach-omap2/board-h4.c | |||
| @@ -131,26 +131,6 @@ static struct platform_device h4_flash_device = { | |||
| 131 | .resource = &h4_flash_resource, | 131 | .resource = &h4_flash_resource, |
| 132 | }; | 132 | }; |
| 133 | 133 | ||
| 134 | static struct resource h4_smc91x_resources[] = { | ||
| 135 | [0] = { | ||
| 136 | .start = OMAP24XX_ETHR_START, /* Physical */ | ||
| 137 | .end = OMAP24XX_ETHR_START + 0xf, | ||
| 138 | .flags = IORESOURCE_MEM, | ||
| 139 | }, | ||
| 140 | [1] = { | ||
| 141 | .start = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ), | ||
| 142 | .end = OMAP_GPIO_IRQ(OMAP24XX_ETHR_GPIO_IRQ), | ||
| 143 | .flags = IORESOURCE_IRQ, | ||
| 144 | }, | ||
| 145 | }; | ||
| 146 | |||
| 147 | static struct platform_device h4_smc91x_device = { | ||
| 148 | .name = "smc91x", | ||
| 149 | .id = -1, | ||
| 150 | .num_resources = ARRAY_SIZE(h4_smc91x_resources), | ||
| 151 | .resource = h4_smc91x_resources, | ||
| 152 | }; | ||
| 153 | |||
| 154 | /* Select between the IrDA and aGPS module | 134 | /* Select between the IrDA and aGPS module |
| 155 | */ | 135 | */ |
| 156 | static int h4_select_irda(struct device *dev, int state) | 136 | static int h4_select_irda(struct device *dev, int state) |
| @@ -266,29 +246,14 @@ static struct platform_device h4_lcd_device = { | |||
| 266 | .id = -1, | 246 | .id = -1, |
| 267 | }; | 247 | }; |
| 268 | 248 | ||
| 269 | static struct resource h4_led_resources[] = { | ||
| 270 | [0] = { | ||
| 271 | .flags = IORESOURCE_MEM, | ||
| 272 | }, | ||
| 273 | }; | ||
| 274 | |||
| 275 | static struct platform_device h4_led_device = { | ||
| 276 | .name = "omap_dbg_led", | ||
| 277 | .id = -1, | ||
| 278 | .num_resources = ARRAY_SIZE(h4_led_resources), | ||
| 279 | .resource = h4_led_resources, | ||
| 280 | }; | ||
| 281 | |||
| 282 | static struct platform_device *h4_devices[] __initdata = { | 249 | static struct platform_device *h4_devices[] __initdata = { |
| 283 | &h4_smc91x_device, | ||
| 284 | &h4_flash_device, | 250 | &h4_flash_device, |
| 285 | &h4_irda_device, | 251 | &h4_irda_device, |
| 286 | &h4_kp_device, | 252 | &h4_kp_device, |
| 287 | &h4_lcd_device, | 253 | &h4_lcd_device, |
| 288 | &h4_led_device, | ||
| 289 | }; | 254 | }; |
| 290 | 255 | ||
| 291 | static inline void __init h4_init_smc91x(void) | 256 | static inline void __init h4_init_debug(void) |
| 292 | { | 257 | { |
| 293 | /* Make sure CS1 timings are correct */ | 258 | /* Make sure CS1 timings are correct */ |
| 294 | GPMC_CONFIG1_1 = 0x00011200; | 259 | GPMC_CONFIG1_1 = 0x00011200; |
| @@ -301,12 +266,8 @@ static inline void __init h4_init_smc91x(void) | |||
| 301 | udelay(100); | 266 | udelay(100); |
| 302 | 267 | ||
| 303 | omap_cfg_reg(M15_24XX_GPIO92); | 268 | omap_cfg_reg(M15_24XX_GPIO92); |
| 304 | if (omap_request_gpio(OMAP24XX_ETHR_GPIO_IRQ) < 0) { | 269 | if (debug_card_init(cs_mem_base, OMAP24XX_ETHR_GPIO_IRQ) < 0) |
| 305 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 270 | gpmc_cs_free(eth_cs); |
| 306 | OMAP24XX_ETHR_GPIO_IRQ); | ||
| 307 | return; | ||
| 308 | } | ||
| 309 | omap_set_gpio_direction(OMAP24XX_ETHR_GPIO_IRQ, 1); | ||
| 310 | } | 271 | } |
| 311 | 272 | ||
| 312 | static void __init omap_h4_init_irq(void) | 273 | static void __init omap_h4_init_irq(void) |
| @@ -314,7 +275,6 @@ static void __init omap_h4_init_irq(void) | |||
| 314 | omap2_init_common_hw(); | 275 | omap2_init_common_hw(); |
| 315 | omap_init_irq(); | 276 | omap_init_irq(); |
| 316 | omap_gpio_init(); | 277 | omap_gpio_init(); |
| 317 | h4_init_smc91x(); | ||
| 318 | } | 278 | } |
| 319 | 279 | ||
| 320 | static struct omap_uart_config h4_uart_config __initdata = { | 280 | static struct omap_uart_config h4_uart_config __initdata = { |
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 52ec2f2d6360..b603bc5f8e5b 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
| @@ -55,8 +55,10 @@ static void omap_init_i2c(void) | |||
| 55 | if (machine_is_omap_h4()) | 55 | if (machine_is_omap_h4()) |
| 56 | return; | 56 | return; |
| 57 | 57 | ||
| 58 | omap_cfg_reg(J15_24XX_I2C2_SCL); | 58 | if (!cpu_is_omap2430()) { |
| 59 | omap_cfg_reg(H19_24XX_I2C2_SDA); | 59 | omap_cfg_reg(J15_24XX_I2C2_SCL); |
| 60 | omap_cfg_reg(H19_24XX_I2C2_SDA); | ||
| 61 | } | ||
| 60 | (void) platform_device_register(&omap_i2c_device2); | 62 | (void) platform_device_register(&omap_i2c_device2); |
| 61 | } | 63 | } |
| 62 | 64 | ||
diff --git a/arch/arm/mach-omap2/gpmc.c b/arch/arm/mach-omap2/gpmc.c index e290b989aa94..5a4cc2076a7d 100644 --- a/arch/arm/mach-omap2/gpmc.c +++ b/arch/arm/mach-omap2/gpmc.c | |||
| @@ -22,7 +22,14 @@ | |||
| 22 | 22 | ||
| 23 | #undef DEBUG | 23 | #undef DEBUG |
| 24 | 24 | ||
| 25 | #ifdef CONFIG_ARCH_OMAP2420 | ||
| 25 | #define GPMC_BASE 0x6800a000 | 26 | #define GPMC_BASE 0x6800a000 |
| 27 | #endif | ||
| 28 | |||
| 29 | #ifdef CONFIG_ARCH_OMAP2430 | ||
| 30 | #define GPMC_BASE 0x6E000000 | ||
| 31 | #endif | ||
| 32 | |||
| 26 | #define GPMC_REVISION 0x00 | 33 | #define GPMC_REVISION 0x00 |
| 27 | #define GPMC_SYSCONFIG 0x10 | 34 | #define GPMC_SYSCONFIG 0x10 |
| 28 | #define GPMC_SYSSTATUS 0x14 | 35 | #define GPMC_SYSSTATUS 0x14 |
| @@ -88,7 +95,7 @@ u32 gpmc_cs_read_reg(int cs, int idx) | |||
| 88 | } | 95 | } |
| 89 | 96 | ||
| 90 | /* TODO: Add support for gpmc_fck to clock framework and use it */ | 97 | /* TODO: Add support for gpmc_fck to clock framework and use it */ |
| 91 | static unsigned long gpmc_get_fclk_period(void) | 98 | unsigned long gpmc_get_fclk_period(void) |
| 92 | { | 99 | { |
| 93 | /* In picoseconds */ | 100 | /* In picoseconds */ |
| 94 | return 1000000000 / ((clk_get_rate(gpmc_l3_clk)) / 1000); | 101 | return 1000000000 / ((clk_get_rate(gpmc_l3_clk)) / 1000); |
| @@ -104,6 +111,13 @@ unsigned int gpmc_ns_to_ticks(unsigned int time_ns) | |||
| 104 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; | 111 | return (time_ns * 1000 + tick_ps - 1) / tick_ps; |
| 105 | } | 112 | } |
| 106 | 113 | ||
| 114 | unsigned int gpmc_round_ns_to_ticks(unsigned int time_ns) | ||
| 115 | { | ||
| 116 | unsigned long ticks = gpmc_ns_to_ticks(time_ns); | ||
| 117 | |||
| 118 | return ticks * gpmc_get_fclk_period() / 1000; | ||
| 119 | } | ||
| 120 | |||
| 107 | #ifdef DEBUG | 121 | #ifdef DEBUG |
| 108 | static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, | 122 | static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, |
| 109 | int time, const char *name) | 123 | int time, const char *name) |
| @@ -120,15 +134,21 @@ static int set_gpmc_timing_reg(int cs, int reg, int st_bit, int end_bit, | |||
| 120 | else | 134 | else |
| 121 | ticks = gpmc_ns_to_ticks(time); | 135 | ticks = gpmc_ns_to_ticks(time); |
| 122 | nr_bits = end_bit - st_bit + 1; | 136 | nr_bits = end_bit - st_bit + 1; |
| 123 | if (ticks >= 1 << nr_bits) | 137 | if (ticks >= 1 << nr_bits) { |
| 138 | #ifdef DEBUG | ||
| 139 | printk(KERN_INFO "GPMC CS%d: %-10s* %3d ns, %3d ticks >= %d\n", | ||
| 140 | cs, name, time, ticks, 1 << nr_bits); | ||
| 141 | #endif | ||
| 124 | return -1; | 142 | return -1; |
| 143 | } | ||
| 125 | 144 | ||
| 126 | mask = (1 << nr_bits) - 1; | 145 | mask = (1 << nr_bits) - 1; |
| 127 | l = gpmc_cs_read_reg(cs, reg); | 146 | l = gpmc_cs_read_reg(cs, reg); |
| 128 | #ifdef DEBUG | 147 | #ifdef DEBUG |
| 129 | printk(KERN_INFO "GPMC CS%d: %-10s: %d ticks, %3lu ns (was %i ticks)\n", | 148 | printk(KERN_INFO |
| 149 | "GPMC CS%d: %-10s: %3d ticks, %3lu ns (was %3i ticks) %3d ns\n", | ||
| 130 | cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000, | 150 | cs, name, ticks, gpmc_get_fclk_period() * ticks / 1000, |
| 131 | (l >> st_bit) & mask); | 151 | (l >> st_bit) & mask, time); |
| 132 | #endif | 152 | #endif |
| 133 | l &= ~(mask << st_bit); | 153 | l &= ~(mask << st_bit); |
| 134 | l |= ticks << st_bit; | 154 | l |= ticks << st_bit; |
| @@ -157,7 +177,7 @@ int gpmc_cs_calc_divider(int cs, unsigned int sync_clk) | |||
| 157 | div = l / gpmc_get_fclk_period(); | 177 | div = l / gpmc_get_fclk_period(); |
| 158 | if (div > 4) | 178 | if (div > 4) |
| 159 | return -1; | 179 | return -1; |
| 160 | if (div < 0) | 180 | if (div <= 0) |
| 161 | div = 1; | 181 | div = 1; |
| 162 | 182 | ||
| 163 | return div; | 183 | return div; |
| @@ -191,14 +211,19 @@ int gpmc_cs_set_timings(int cs, const struct gpmc_timings *t) | |||
| 191 | 211 | ||
| 192 | GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access); | 212 | GPMC_SET_ONE(GPMC_CS_CONFIG5, 24, 27, page_burst_access); |
| 193 | 213 | ||
| 214 | /* caller is expected to have initialized CONFIG1 to cover | ||
| 215 | * at least sync vs async | ||
| 216 | */ | ||
| 217 | l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | ||
| 218 | if (l & (GPMC_CONFIG1_READTYPE_SYNC | GPMC_CONFIG1_WRITETYPE_SYNC)) { | ||
| 194 | #ifdef DEBUG | 219 | #ifdef DEBUG |
| 195 | printk(KERN_INFO "GPMC CS%d CLK period is %lu (div %d)\n", | 220 | printk(KERN_INFO "GPMC CS%d CLK period is %lu ns (div %d)\n", |
| 196 | cs, gpmc_get_fclk_period(), div); | 221 | cs, (div * gpmc_get_fclk_period()) / 1000, div); |
| 197 | #endif | 222 | #endif |
| 198 | 223 | l &= ~0x03; | |
| 199 | l = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); | 224 | l |= (div - 1); |
| 200 | l &= ~0x03; | 225 | gpmc_cs_write_reg(cs, GPMC_CS_CONFIG1, l); |
| 201 | l |= (div - 1); | 226 | } |
| 202 | 227 | ||
| 203 | return 0; | 228 | return 0; |
| 204 | } | 229 | } |
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c index 871ace4fccb8..4dfd878d7968 100644 --- a/arch/arm/mach-omap2/id.c +++ b/arch/arm/mach-omap2/id.c | |||
| @@ -17,7 +17,13 @@ | |||
| 17 | 17 | ||
| 18 | #include <asm/io.h> | 18 | #include <asm/io.h> |
| 19 | 19 | ||
| 20 | #if defined(CONFIG_ARCH_OMAP2420) | ||
| 20 | #define OMAP24XX_TAP_BASE io_p2v(0x48014000) | 21 | #define OMAP24XX_TAP_BASE io_p2v(0x48014000) |
| 22 | #endif | ||
| 23 | |||
| 24 | #if defined(CONFIG_ARCH_OMAP2430) | ||
| 25 | #define OMAP24XX_TAP_BASE io_p2v(0x4900A000) | ||
| 26 | #endif | ||
| 21 | 27 | ||
| 22 | #define OMAP_TAP_IDCODE 0x0204 | 28 | #define OMAP_TAP_IDCODE 0x0204 |
| 23 | #define OMAP_TAP_PROD_ID 0x0208 | 29 | #define OMAP_TAP_PROD_ID 0x0208 |
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c index 82dc70f6b779..5a4091f582ed 100644 --- a/arch/arm/mach-omap2/io.c +++ b/arch/arm/mach-omap2/io.c | |||
| @@ -5,6 +5,7 @@ | |||
| 5 | * | 5 | * |
| 6 | * Copyright (C) 2005 Nokia Corporation | 6 | * Copyright (C) 2005 Nokia Corporation |
| 7 | * Author: Juha Yrjölä <juha.yrjola@nokia.com> | 7 | * Author: Juha Yrjölä <juha.yrjola@nokia.com> |
| 8 | * Updated map desc to add 2430 support : <x0khasim@ti.com> | ||
| 8 | * | 9 | * |
| 9 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
| 10 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
| @@ -26,6 +27,7 @@ | |||
| 26 | extern void omap_sram_init(void); | 27 | extern void omap_sram_init(void); |
| 27 | extern int omap2_clk_init(void); | 28 | extern int omap2_clk_init(void); |
| 28 | extern void omap2_check_revision(void); | 29 | extern void omap2_check_revision(void); |
| 30 | extern void omap2_init_memory(void); | ||
| 29 | extern void gpmc_init(void); | 31 | extern void gpmc_init(void); |
| 30 | extern void omapfb_reserve_sdram(void); | 32 | extern void omapfb_reserve_sdram(void); |
| 31 | 33 | ||
| @@ -40,6 +42,20 @@ static struct map_desc omap2_io_desc[] __initdata = { | |||
| 40 | .length = L3_24XX_SIZE, | 42 | .length = L3_24XX_SIZE, |
| 41 | .type = MT_DEVICE | 43 | .type = MT_DEVICE |
| 42 | }, | 44 | }, |
| 45 | #ifdef CONFIG_ARCH_OMAP2430 | ||
| 46 | { | ||
| 47 | .virtual = L4_WK_243X_VIRT, | ||
| 48 | .pfn = __phys_to_pfn(L4_WK_243X_PHYS), | ||
| 49 | .length = L4_WK_243X_SIZE, | ||
| 50 | .type = MT_DEVICE | ||
| 51 | }, | ||
| 52 | { | ||
| 53 | .virtual = OMAP243X_GPMC_VIRT, | ||
| 54 | .pfn = __phys_to_pfn(OMAP243X_GPMC_PHYS), | ||
| 55 | .length = OMAP243X_GPMC_SIZE, | ||
| 56 | .type = MT_DEVICE | ||
| 57 | }, | ||
| 58 | #endif | ||
| 43 | { | 59 | { |
| 44 | .virtual = DSP_MEM_24XX_VIRT, | 60 | .virtual = DSP_MEM_24XX_VIRT, |
| 45 | .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS), | 61 | .pfn = __phys_to_pfn(DSP_MEM_24XX_PHYS), |
| @@ -80,5 +96,11 @@ void __init omap2_init_common_hw(void) | |||
| 80 | { | 96 | { |
| 81 | omap2_mux_init(); | 97 | omap2_mux_init(); |
| 82 | omap2_clk_init(); | 98 | omap2_clk_init(); |
| 99 | /* | ||
| 100 | * Need to Fix this for 2430 | ||
| 101 | */ | ||
| 102 | #ifndef CONFIG_ARCH_OMAP2430 | ||
| 103 | omap2_init_memory(); | ||
| 104 | #endif | ||
| 83 | gpmc_init(); | 105 | gpmc_init(); |
| 84 | } | 106 | } |
diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c index a39d30680300..f064f725e724 100644 --- a/arch/arm/mach-omap2/irq.c +++ b/arch/arm/mach-omap2/irq.c | |||
| @@ -37,7 +37,7 @@ static struct omap_irq_bank { | |||
| 37 | } __attribute__ ((aligned(4))) irq_banks[] = { | 37 | } __attribute__ ((aligned(4))) irq_banks[] = { |
| 38 | { | 38 | { |
| 39 | /* MPU INTC */ | 39 | /* MPU INTC */ |
| 40 | .base_reg = OMAP24XX_IC_BASE, | 40 | .base_reg = IO_ADDRESS(OMAP24XX_IC_BASE), |
| 41 | .nr_irqs = 96, | 41 | .nr_irqs = 96, |
| 42 | }, { | 42 | }, { |
| 43 | /* XXX: DSP INTC */ | 43 | /* XXX: DSP INTC */ |
| @@ -47,7 +47,7 @@ static struct omap_irq_bank { | |||
| 47 | /* XXX: FIQ and additional INTC support (only MPU at the moment) */ | 47 | /* XXX: FIQ and additional INTC support (only MPU at the moment) */ |
| 48 | static void omap_ack_irq(unsigned int irq) | 48 | static void omap_ack_irq(unsigned int irq) |
| 49 | { | 49 | { |
| 50 | omap_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL); | 50 | __raw_writel(0x1, irq_banks[0].base_reg + INTC_CONTROL); |
| 51 | } | 51 | } |
| 52 | 52 | ||
| 53 | static void omap_mask_irq(unsigned int irq) | 53 | static void omap_mask_irq(unsigned int irq) |
| @@ -60,7 +60,7 @@ static void omap_mask_irq(unsigned int irq) | |||
| 60 | irq %= 32; | 60 | irq %= 32; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | omap_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset); | 63 | __raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_SET0 + offset); |
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | static void omap_unmask_irq(unsigned int irq) | 66 | static void omap_unmask_irq(unsigned int irq) |
| @@ -73,7 +73,7 @@ static void omap_unmask_irq(unsigned int irq) | |||
| 73 | irq %= 32; | 73 | irq %= 32; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | omap_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset); | 76 | __raw_writel(1 << irq, irq_banks[0].base_reg + INTC_MIR_CLEAR0 + offset); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | static void omap_mask_ack_irq(unsigned int irq) | 79 | static void omap_mask_ack_irq(unsigned int irq) |
| @@ -93,17 +93,20 @@ static void __init omap_irq_bank_init_one(struct omap_irq_bank *bank) | |||
| 93 | { | 93 | { |
| 94 | unsigned long tmp; | 94 | unsigned long tmp; |
| 95 | 95 | ||
| 96 | tmp = omap_readl(bank->base_reg + INTC_REVISION) & 0xff; | 96 | tmp = __raw_readl(bank->base_reg + INTC_REVISION) & 0xff; |
| 97 | printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx " | 97 | printk(KERN_INFO "IRQ: Found an INTC at 0x%08lx " |
| 98 | "(revision %ld.%ld) with %d interrupts\n", | 98 | "(revision %ld.%ld) with %d interrupts\n", |
| 99 | bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs); | 99 | bank->base_reg, tmp >> 4, tmp & 0xf, bank->nr_irqs); |
| 100 | 100 | ||
| 101 | tmp = omap_readl(bank->base_reg + INTC_SYSCONFIG); | 101 | tmp = __raw_readl(bank->base_reg + INTC_SYSCONFIG); |
| 102 | tmp |= 1 << 1; /* soft reset */ | 102 | tmp |= 1 << 1; /* soft reset */ |
| 103 | omap_writel(tmp, bank->base_reg + INTC_SYSCONFIG); | 103 | __raw_writel(tmp, bank->base_reg + INTC_SYSCONFIG); |
| 104 | 104 | ||
| 105 | while (!(omap_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1)) | 105 | while (!(__raw_readl(bank->base_reg + INTC_SYSSTATUS) & 0x1)) |
| 106 | /* Wait for reset to complete */; | 106 | /* Wait for reset to complete */; |
| 107 | |||
| 108 | /* Enable autoidle */ | ||
| 109 | __raw_writel(1 << 0, bank->base_reg + INTC_SYSCONFIG); | ||
| 107 | } | 110 | } |
| 108 | 111 | ||
| 109 | void __init omap_init_irq(void) | 112 | void __init omap_init_irq(void) |
diff --git a/arch/arm/mach-omap2/memory.c b/arch/arm/mach-omap2/memory.c index 85cbc2a2e663..3e5d8cd4ea4f 100644 --- a/arch/arm/mach-omap2/memory.c +++ b/arch/arm/mach-omap2/memory.c | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | #include "prcm-regs.h" | 30 | #include "prcm-regs.h" |
| 31 | #include "memory.h" | 31 | #include "memory.h" |
| 32 | 32 | ||
| 33 | |||
| 33 | static struct memory_timings mem_timings; | 34 | static struct memory_timings mem_timings; |
| 34 | 35 | ||
| 35 | u32 omap2_memory_get_slow_dll_ctrl(void) | 36 | u32 omap2_memory_get_slow_dll_ctrl(void) |
| @@ -99,3 +100,20 @@ void omap2_init_memory_params(u32 force_lock_to_unlock_mode) | |||
| 99 | /* 90 degree phase for anything below 133Mhz + disable DLL filter */ | 100 | /* 90 degree phase for anything below 133Mhz + disable DLL filter */ |
| 100 | mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); | 101 | mem_timings.slow_dll_ctrl |= ((1 << 1) | (3 << 8)); |
| 101 | } | 102 | } |
| 103 | |||
| 104 | /* turn on smart idle modes for SDRAM scheduler and controller */ | ||
| 105 | void __init omap2_init_memory(void) | ||
| 106 | { | ||
| 107 | u32 l; | ||
| 108 | |||
| 109 | l = SMS_SYSCONFIG; | ||
| 110 | l &= ~(0x3 << 3); | ||
| 111 | l |= (0x2 << 3); | ||
| 112 | SMS_SYSCONFIG = l; | ||
| 113 | |||
| 114 | l = SDRC_SYSCONFIG; | ||
| 115 | l &= ~(0x3 << 3); | ||
| 116 | l |= (0x2 << 3); | ||
| 117 | SDRC_SYSCONFIG = l; | ||
| 118 | |||
| 119 | } | ||
diff --git a/arch/arm/mach-omap2/mux.c b/arch/arm/mach-omap2/mux.c index 0439906d5da7..05750975d746 100644 --- a/arch/arm/mach-omap2/mux.c +++ b/arch/arm/mach-omap2/mux.c | |||
| @@ -53,8 +53,8 @@ MUX_CFG_24XX("W19_24XX_SYS_NIRQ", 0x12c, 0, 1, 1, 1) | |||
| 53 | MUX_CFG_24XX("W14_24XX_SYS_CLKOUT", 0x137, 0, 1, 1, 1) | 53 | MUX_CFG_24XX("W14_24XX_SYS_CLKOUT", 0x137, 0, 1, 1, 1) |
| 54 | 54 | ||
| 55 | /* 24xx GPMC chipselects, wait pin monitoring */ | 55 | /* 24xx GPMC chipselects, wait pin monitoring */ |
| 56 | MUX_CFG_24XX("E2_GPMC_NCS2", 0x08e, 0, 1, 1, 1) | 56 | MUX_CFG_24XX("E2_GPMC_NCS2", 0x08e, 0, 1, 1, 1) |
| 57 | MUX_CFG_24XX("L2_GPMC_NCS7", 0x093, 0, 1, 1, 1) | 57 | MUX_CFG_24XX("L2_GPMC_NCS7", 0x093, 0, 1, 1, 1) |
| 58 | MUX_CFG_24XX("L3_GPMC_WAIT0", 0x09a, 0, 1, 1, 1) | 58 | MUX_CFG_24XX("L3_GPMC_WAIT0", 0x09a, 0, 1, 1, 1) |
| 59 | MUX_CFG_24XX("N7_GPMC_WAIT1", 0x09b, 0, 1, 1, 1) | 59 | MUX_CFG_24XX("N7_GPMC_WAIT1", 0x09b, 0, 1, 1, 1) |
| 60 | MUX_CFG_24XX("M1_GPMC_WAIT2", 0x09c, 0, 1, 1, 1) | 60 | MUX_CFG_24XX("M1_GPMC_WAIT2", 0x09c, 0, 1, 1, 1) |
| @@ -67,18 +67,18 @@ MUX_CFG_24XX("W15_24XX_MCBSP2_DR", 0x126, 1, 1, 0, 1) | |||
| 67 | MUX_CFG_24XX("V15_24XX_MCBSP2_DX", 0x127, 1, 1, 0, 1) | 67 | MUX_CFG_24XX("V15_24XX_MCBSP2_DX", 0x127, 1, 1, 0, 1) |
| 68 | 68 | ||
| 69 | /* 24xx GPIO */ | 69 | /* 24xx GPIO */ |
| 70 | MUX_CFG_24XX("M21_242X_GPIO11", 0x0c9, 3, 1, 1, 1) | 70 | MUX_CFG_24XX("M21_242X_GPIO11", 0x0c9, 3, 1, 1, 1) |
| 71 | MUX_CFG_24XX("P21_242X_GPIO12", 0x0ca, 3, 0, 0, 1) | 71 | MUX_CFG_24XX("P21_242X_GPIO12", 0x0ca, 3, 0, 0, 1) |
| 72 | MUX_CFG_24XX("AA10_242X_GPIO13", 0x0e5, 3, 0, 0, 1) | 72 | MUX_CFG_24XX("AA10_242X_GPIO13", 0x0e5, 3, 0, 0, 1) |
| 73 | MUX_CFG_24XX("AA6_242X_GPIO14", 0x0e6, 3, 0, 0, 1) | 73 | MUX_CFG_24XX("AA6_242X_GPIO14", 0x0e6, 3, 0, 0, 1) |
| 74 | MUX_CFG_24XX("AA4_242X_GPIO15", 0x0e7, 3, 0, 0, 1) | 74 | MUX_CFG_24XX("AA4_242X_GPIO15", 0x0e7, 3, 0, 0, 1) |
| 75 | MUX_CFG_24XX("Y11_242X_GPIO16", 0x0e8, 3, 0, 0, 1) | 75 | MUX_CFG_24XX("Y11_242X_GPIO16", 0x0e8, 3, 0, 0, 1) |
| 76 | MUX_CFG_24XX("AA12_242X_GPIO17", 0x0e9, 3, 0, 0, 1) | 76 | MUX_CFG_24XX("AA12_242X_GPIO17", 0x0e9, 3, 0, 0, 1) |
| 77 | MUX_CFG_24XX("AA8_242X_GPIO58", 0x0ea, 3, 0, 0, 1) | 77 | MUX_CFG_24XX("AA8_242X_GPIO58", 0x0ea, 3, 0, 0, 1) |
| 78 | MUX_CFG_24XX("Y20_24XX_GPIO60", 0x12c, 3, 0, 0, 1) | 78 | MUX_CFG_24XX("Y20_24XX_GPIO60", 0x12c, 3, 0, 0, 1) |
| 79 | MUX_CFG_24XX("W4__24XX_GPIO74", 0x0f2, 3, 0, 0, 1) | 79 | MUX_CFG_24XX("W4__24XX_GPIO74", 0x0f2, 3, 0, 0, 1) |
| 80 | MUX_CFG_24XX("M15_24XX_GPIO92", 0x10a, 3, 0, 0, 1) | 80 | MUX_CFG_24XX("M15_24XX_GPIO92", 0x10a, 3, 0, 0, 1) |
| 81 | MUX_CFG_24XX("J15_24XX_GPIO99", 0x113, 3, 1, 1, 1) | 81 | MUX_CFG_24XX("J15_24XX_GPIO99", 0x113, 3, 1, 1, 1) |
| 82 | MUX_CFG_24XX("V14_24XX_GPIO117", 0x128, 3, 1, 0, 1) | 82 | MUX_CFG_24XX("V14_24XX_GPIO117", 0x128, 3, 1, 0, 1) |
| 83 | MUX_CFG_24XX("P14_24XX_GPIO125", 0x140, 3, 1, 1, 1) | 83 | MUX_CFG_24XX("P14_24XX_GPIO125", 0x140, 3, 1, 1, 1) |
| 84 | 84 | ||
| @@ -95,17 +95,17 @@ MUX_CFG_24XX("T3_242X_GPIO55", 0xd9, 3, 0, 0, 1) | |||
| 95 | MUX_CFG_24XX("U2_242X_GPIO56", 0xda, 3, 0, 0, 1) | 95 | MUX_CFG_24XX("U2_242X_GPIO56", 0xda, 3, 0, 0, 1) |
| 96 | 96 | ||
| 97 | /* 24xx external DMA requests */ | 97 | /* 24xx external DMA requests */ |
| 98 | MUX_CFG_24XX("AA10_242X_DMAREQ0", 0x0e5, 2, 0, 0, 1) | 98 | MUX_CFG_24XX("AA10_242X_DMAREQ0", 0x0e5, 2, 0, 0, 1) |
| 99 | MUX_CFG_24XX("AA6_242X_DMAREQ1", 0x0e6, 2, 0, 0, 1) | 99 | MUX_CFG_24XX("AA6_242X_DMAREQ1", 0x0e6, 2, 0, 0, 1) |
| 100 | MUX_CFG_24XX("E4_242X_DMAREQ2", 0x074, 2, 0, 0, 1) | 100 | MUX_CFG_24XX("E4_242X_DMAREQ2", 0x074, 2, 0, 0, 1) |
| 101 | MUX_CFG_24XX("G4_242X_DMAREQ3", 0x073, 2, 0, 0, 1) | 101 | MUX_CFG_24XX("G4_242X_DMAREQ3", 0x073, 2, 0, 0, 1) |
| 102 | MUX_CFG_24XX("D3_242X_DMAREQ4", 0x072, 2, 0, 0, 1) | 102 | MUX_CFG_24XX("D3_242X_DMAREQ4", 0x072, 2, 0, 0, 1) |
| 103 | MUX_CFG_24XX("E3_242X_DMAREQ5", 0x071, 2, 0, 0, 1) | 103 | MUX_CFG_24XX("E3_242X_DMAREQ5", 0x071, 2, 0, 0, 1) |
| 104 | 104 | ||
| 105 | /* TSC IRQ */ | 105 | /* TSC IRQ */ |
| 106 | MUX_CFG_24XX("P20_24XX_TSC_IRQ", 0x108, 0, 0, 0, 1) | 106 | MUX_CFG_24XX("P20_24XX_TSC_IRQ", 0x108, 0, 0, 0, 1) |
| 107 | 107 | ||
| 108 | /* UART3 */ | 108 | /* UART3 */ |
| 109 | MUX_CFG_24XX("K15_24XX_UART3_TX", 0x118, 0, 0, 0, 1) | 109 | MUX_CFG_24XX("K15_24XX_UART3_TX", 0x118, 0, 0, 0, 1) |
| 110 | MUX_CFG_24XX("K14_24XX_UART3_RX", 0x119, 0, 0, 0, 1) | 110 | MUX_CFG_24XX("K14_24XX_UART3_RX", 0x119, 0, 0, 0, 1) |
| 111 | 111 | ||
diff --git a/arch/arm/mach-omap2/usb-tusb6010.c b/arch/arm/mach-omap2/usb-tusb6010.c new file mode 100644 index 000000000000..80bb42eb5082 --- /dev/null +++ b/arch/arm/mach-omap2/usb-tusb6010.c | |||
| @@ -0,0 +1,349 @@ | |||
| 1 | /* | ||
| 2 | * linux/arch/arm/mach-omap2/usb-tusb6010.c | ||
| 3 | * | ||
| 4 | * Copyright (C) 2006 Nokia Corporation | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include <linux/types.h> | ||
| 12 | #include <linux/errno.h> | ||
| 13 | #include <linux/delay.h> | ||
| 14 | #include <linux/platform_device.h> | ||
| 15 | |||
| 16 | #include <linux/usb/musb.h> | ||
| 17 | |||
| 18 | #include <asm/arch/gpmc.h> | ||
| 19 | #include <asm/arch/gpio.h> | ||
| 20 | #include <asm/arch/mux.h> | ||
| 21 | |||
| 22 | |||
| 23 | static u8 async_cs, sync_cs; | ||
| 24 | static unsigned refclk_psec; | ||
| 25 | |||
| 26 | |||
| 27 | /* t2_ps, when quantized to fclk units, must happen no earlier than | ||
| 28 | * the clock after after t1_NS. | ||
| 29 | * | ||
| 30 | * Return a possibly updated value of t2_ps, converted to nsec. | ||
| 31 | */ | ||
| 32 | static unsigned | ||
| 33 | next_clk(unsigned t1_NS, unsigned t2_ps, unsigned fclk_ps) | ||
| 34 | { | ||
| 35 | unsigned t1_ps = t1_NS * 1000; | ||
| 36 | unsigned t1_f, t2_f; | ||
| 37 | |||
| 38 | if ((t1_ps + fclk_ps) < t2_ps) | ||
| 39 | return t2_ps / 1000; | ||
| 40 | |||
| 41 | t1_f = (t1_ps + fclk_ps - 1) / fclk_ps; | ||
| 42 | t2_f = (t2_ps + fclk_ps - 1) / fclk_ps; | ||
| 43 | |||
| 44 | if (t1_f >= t2_f) | ||
| 45 | t2_f = t1_f + 1; | ||
| 46 | |||
| 47 | return (t2_f * fclk_ps) / 1000; | ||
| 48 | } | ||
| 49 | |||
| 50 | /* NOTE: timings are from tusb 6010 datasheet Rev 1.8, 12-Sept 2006 */ | ||
| 51 | |||
| 52 | static int tusb_set_async_mode(unsigned sysclk_ps, unsigned fclk_ps) | ||
| 53 | { | ||
| 54 | struct gpmc_timings t; | ||
| 55 | unsigned t_acsnh_advnh = sysclk_ps + 3000; | ||
| 56 | unsigned tmp; | ||
| 57 | |||
| 58 | memset(&t, 0, sizeof(t)); | ||
| 59 | |||
| 60 | /* CS_ON = t_acsnh_acsnl */ | ||
| 61 | t.cs_on = 8; | ||
| 62 | /* ADV_ON = t_acsnh_advnh - t_advn */ | ||
| 63 | t.adv_on = next_clk(t.cs_on, t_acsnh_advnh - 7000, fclk_ps); | ||
| 64 | |||
| 65 | /* | ||
| 66 | * READ ... from omap2420 TRM fig 12-13 | ||
| 67 | */ | ||
| 68 | |||
| 69 | /* ADV_RD_OFF = t_acsnh_advnh */ | ||
| 70 | t.adv_rd_off = next_clk(t.adv_on, t_acsnh_advnh, fclk_ps); | ||
| 71 | |||
| 72 | /* OE_ON = t_acsnh_advnh + t_advn_oen (then wait for nRDY) */ | ||
| 73 | t.oe_on = next_clk(t.adv_on, t_acsnh_advnh + 1000, fclk_ps); | ||
| 74 | |||
| 75 | /* ACCESS = counters continue only after nRDY */ | ||
| 76 | tmp = t.oe_on * 1000 + 300; | ||
| 77 | t.access = next_clk(t.oe_on, tmp, fclk_ps); | ||
| 78 | |||
| 79 | /* OE_OFF = after data gets sampled */ | ||
| 80 | tmp = t.access * 1000; | ||
| 81 | t.oe_off = next_clk(t.access, tmp, fclk_ps); | ||
| 82 | |||
| 83 | t.cs_rd_off = t.oe_off; | ||
| 84 | |||
| 85 | tmp = t.cs_rd_off * 1000 + 7000 /* t_acsn_rdy_z */; | ||
| 86 | t.rd_cycle = next_clk(t.cs_rd_off, tmp, fclk_ps); | ||
| 87 | |||
| 88 | /* | ||
| 89 | * WRITE ... from omap2420 TRM fig 12-15 | ||
| 90 | */ | ||
| 91 | |||
| 92 | /* ADV_WR_OFF = t_acsnh_advnh */ | ||
| 93 | t.adv_wr_off = t.adv_rd_off; | ||
| 94 | |||
| 95 | /* WE_ON = t_acsnh_advnh + t_advn_wen (then wait for nRDY) */ | ||
| 96 | t.we_on = next_clk(t.adv_wr_off, t_acsnh_advnh + 1000, fclk_ps); | ||
| 97 | |||
| 98 | /* WE_OFF = after data gets sampled */ | ||
| 99 | tmp = t.we_on * 1000 + 300; | ||
| 100 | t.we_off = next_clk(t.we_on, tmp, fclk_ps); | ||
| 101 | |||
| 102 | t.cs_wr_off = t.we_off; | ||
| 103 | |||
| 104 | tmp = t.cs_wr_off * 1000 + 7000 /* t_acsn_rdy_z */; | ||
| 105 | t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps); | ||
| 106 | |||
| 107 | return gpmc_cs_set_timings(async_cs, &t); | ||
| 108 | } | ||
| 109 | |||
| 110 | static int tusb_set_sync_mode(unsigned sysclk_ps, unsigned fclk_ps) | ||
| 111 | { | ||
| 112 | struct gpmc_timings t; | ||
| 113 | unsigned t_scsnh_advnh = sysclk_ps + 3000; | ||
| 114 | unsigned tmp; | ||
| 115 | |||
| 116 | memset(&t, 0, sizeof(t)); | ||
| 117 | t.cs_on = 8; | ||
| 118 | |||
| 119 | /* ADV_ON = t_acsnh_advnh - t_advn */ | ||
| 120 | t.adv_on = next_clk(t.cs_on, t_scsnh_advnh - 7000, fclk_ps); | ||
| 121 | |||
| 122 | /* GPMC_CLK rate = fclk rate / div */ | ||
| 123 | t.sync_clk = 12 /* 11.1 nsec */; | ||
| 124 | tmp = (t.sync_clk * 1000 + fclk_ps - 1) / fclk_ps; | ||
| 125 | if (tmp > 4) | ||
| 126 | return -ERANGE; | ||
| 127 | if (tmp <= 0) | ||
| 128 | tmp = 1; | ||
| 129 | t.page_burst_access = (fclk_ps * tmp) / 1000; | ||
| 130 | |||
| 131 | /* | ||
| 132 | * READ ... based on omap2420 TRM fig 12-19, 12-20 | ||
| 133 | */ | ||
| 134 | |||
| 135 | /* ADV_RD_OFF = t_scsnh_advnh */ | ||
| 136 | t.adv_rd_off = next_clk(t.adv_on, t_scsnh_advnh, fclk_ps); | ||
| 137 | |||
| 138 | /* OE_ON = t_scsnh_advnh + t_advn_oen * fclk_ps (then wait for nRDY) */ | ||
| 139 | tmp = (t.adv_rd_off * 1000) + (3 * fclk_ps); | ||
| 140 | t.oe_on = next_clk(t.adv_on, tmp, fclk_ps); | ||
| 141 | |||
| 142 | /* ACCESS = number of clock cycles after t_adv_eon */ | ||
| 143 | tmp = (t.oe_on * 1000) + (5 * fclk_ps); | ||
| 144 | t.access = next_clk(t.oe_on, tmp, fclk_ps); | ||
| 145 | |||
| 146 | /* OE_OFF = after data gets sampled */ | ||
| 147 | tmp = (t.access * 1000) + (1 * fclk_ps); | ||
| 148 | t.oe_off = next_clk(t.access, tmp, fclk_ps); | ||
| 149 | |||
| 150 | t.cs_rd_off = t.oe_off; | ||
| 151 | |||
| 152 | tmp = t.cs_rd_off * 1000 + 7000 /* t_scsn_rdy_z */; | ||
| 153 | t.rd_cycle = next_clk(t.cs_rd_off, tmp, fclk_ps); | ||
| 154 | |||
| 155 | /* | ||
| 156 | * WRITE ... based on omap2420 TRM fig 12-21 | ||
| 157 | */ | ||
| 158 | |||
| 159 | /* ADV_WR_OFF = t_scsnh_advnh */ | ||
| 160 | t.adv_wr_off = t.adv_rd_off; | ||
| 161 | |||
| 162 | /* WE_ON = t_scsnh_advnh + t_advn_wen * fclk_ps (then wait for nRDY) */ | ||
| 163 | tmp = (t.adv_wr_off * 1000) + (3 * fclk_ps); | ||
| 164 | t.we_on = next_clk(t.adv_wr_off, tmp, fclk_ps); | ||
| 165 | |||
| 166 | /* WE_OFF = number of clock cycles after t_adv_wen */ | ||
| 167 | tmp = (t.we_on * 1000) + (6 * fclk_ps); | ||
| 168 | t.we_off = next_clk(t.we_on, tmp, fclk_ps); | ||
| 169 | |||
| 170 | t.cs_wr_off = t.we_off; | ||
| 171 | |||
| 172 | tmp = t.cs_wr_off * 1000 + 7000 /* t_scsn_rdy_z */; | ||
| 173 | t.wr_cycle = next_clk(t.cs_wr_off, tmp, fclk_ps); | ||
| 174 | |||
| 175 | return gpmc_cs_set_timings(sync_cs, &t); | ||
| 176 | } | ||
| 177 | |||
| 178 | extern unsigned long gpmc_get_fclk_period(void); | ||
| 179 | |||
| 180 | /* tusb driver calls this when it changes the chip's clocking */ | ||
| 181 | int tusb6010_platform_retime(unsigned is_refclk) | ||
| 182 | { | ||
| 183 | static const char error[] = | ||
| 184 | KERN_ERR "tusb6010 %s retime error %d\n"; | ||
| 185 | |||
| 186 | unsigned fclk_ps = gpmc_get_fclk_period(); | ||
| 187 | unsigned sysclk_ps; | ||
| 188 | int status; | ||
| 189 | |||
| 190 | if (!refclk_psec) | ||
| 191 | return -ENODEV; | ||
| 192 | |||
| 193 | sysclk_ps = is_refclk ? refclk_psec : TUSB6010_OSCCLK_60; | ||
| 194 | |||
| 195 | status = tusb_set_async_mode(sysclk_ps, fclk_ps); | ||
| 196 | if (status < 0) { | ||
| 197 | printk(error, "async", status); | ||
| 198 | goto done; | ||
| 199 | } | ||
| 200 | status = tusb_set_sync_mode(sysclk_ps, fclk_ps); | ||
| 201 | if (status < 0) | ||
| 202 | printk(error, "sync", status); | ||
| 203 | done: | ||
| 204 | return status; | ||
| 205 | } | ||
| 206 | EXPORT_SYMBOL_GPL(tusb6010_platform_retime); | ||
| 207 | |||
| 208 | static struct resource tusb_resources[] = { | ||
| 209 | /* Order is significant! The start/end fields | ||
| 210 | * are updated during setup.. | ||
| 211 | */ | ||
| 212 | { /* Asynchronous access */ | ||
| 213 | .flags = IORESOURCE_MEM, | ||
| 214 | }, | ||
| 215 | { /* Synchronous access */ | ||
| 216 | .flags = IORESOURCE_MEM, | ||
| 217 | }, | ||
| 218 | { /* IRQ */ | ||
| 219 | .flags = IORESOURCE_IRQ, | ||
| 220 | }, | ||
| 221 | }; | ||
| 222 | |||
| 223 | static u64 tusb_dmamask = ~(u32)0; | ||
| 224 | |||
| 225 | static struct platform_device tusb_device = { | ||
| 226 | .name = "musb_hdrc", | ||
| 227 | .id = -1, | ||
| 228 | .dev = { | ||
| 229 | .dma_mask = &tusb_dmamask, | ||
| 230 | .coherent_dma_mask = 0xffffffff, | ||
| 231 | }, | ||
| 232 | .num_resources = ARRAY_SIZE(tusb_resources), | ||
| 233 | .resource = tusb_resources, | ||
| 234 | }; | ||
| 235 | |||
| 236 | |||
| 237 | /* this may be called only from board-*.c setup code */ | ||
| 238 | int __init | ||
| 239 | tusb6010_setup_interface(struct musb_hdrc_platform_data *data, | ||
| 240 | unsigned ps_refclk, unsigned waitpin, | ||
| 241 | unsigned async, unsigned sync, | ||
| 242 | unsigned irq, unsigned dmachan) | ||
| 243 | { | ||
| 244 | int status; | ||
| 245 | static char error[] __initdata = | ||
| 246 | KERN_ERR "tusb6010 init error %d, %d\n"; | ||
| 247 | |||
| 248 | /* ASYNC region, primarily for PIO */ | ||
| 249 | status = gpmc_cs_request(async, SZ_16M, (unsigned long *) | ||
| 250 | &tusb_resources[0].start); | ||
| 251 | if (status < 0) { | ||
| 252 | printk(error, 1, status); | ||
| 253 | return status; | ||
| 254 | } | ||
| 255 | tusb_resources[0].end = tusb_resources[0].start + 0x9ff; | ||
| 256 | async_cs = async; | ||
| 257 | gpmc_cs_write_reg(async, GPMC_CS_CONFIG1, | ||
| 258 | GPMC_CONFIG1_PAGE_LEN(2) | ||
| 259 | | GPMC_CONFIG1_WAIT_READ_MON | ||
| 260 | | GPMC_CONFIG1_WAIT_WRITE_MON | ||
| 261 | | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) | ||
| 262 | | GPMC_CONFIG1_READTYPE_ASYNC | ||
| 263 | | GPMC_CONFIG1_WRITETYPE_ASYNC | ||
| 264 | | GPMC_CONFIG1_DEVICESIZE_16 | ||
| 265 | | GPMC_CONFIG1_DEVICETYPE_NOR | ||
| 266 | | GPMC_CONFIG1_MUXADDDATA); | ||
| 267 | |||
| 268 | |||
| 269 | /* SYNC region, primarily for DMA */ | ||
| 270 | status = gpmc_cs_request(sync, SZ_16M, (unsigned long *) | ||
| 271 | &tusb_resources[1].start); | ||
| 272 | if (status < 0) { | ||
| 273 | printk(error, 2, status); | ||
| 274 | return status; | ||
| 275 | } | ||
| 276 | tusb_resources[1].end = tusb_resources[1].start + 0x9ff; | ||
| 277 | sync_cs = sync; | ||
| 278 | gpmc_cs_write_reg(sync, GPMC_CS_CONFIG1, | ||
| 279 | GPMC_CONFIG1_READMULTIPLE_SUPP | ||
| 280 | | GPMC_CONFIG1_READTYPE_SYNC | ||
| 281 | | GPMC_CONFIG1_WRITEMULTIPLE_SUPP | ||
| 282 | | GPMC_CONFIG1_WRITETYPE_SYNC | ||
| 283 | | GPMC_CONFIG1_CLKACTIVATIONTIME(1) | ||
| 284 | | GPMC_CONFIG1_PAGE_LEN(2) | ||
| 285 | | GPMC_CONFIG1_WAIT_READ_MON | ||
| 286 | | GPMC_CONFIG1_WAIT_WRITE_MON | ||
| 287 | | GPMC_CONFIG1_WAIT_PIN_SEL(waitpin) | ||
| 288 | | GPMC_CONFIG1_DEVICESIZE_16 | ||
| 289 | | GPMC_CONFIG1_DEVICETYPE_NOR | ||
| 290 | | GPMC_CONFIG1_MUXADDDATA | ||
| 291 | /* fclk divider gets set later */ | ||
| 292 | ); | ||
| 293 | |||
| 294 | /* IRQ */ | ||
| 295 | status = omap_request_gpio(irq); | ||
| 296 | if (status < 0) { | ||
| 297 | printk(error, 3, status); | ||
| 298 | return status; | ||
| 299 | } | ||
| 300 | omap_set_gpio_direction(irq, 1); | ||
| 301 | tusb_resources[2].start = irq + IH_GPIO_BASE; | ||
| 302 | |||
| 303 | /* set up memory timings ... can speed them up later */ | ||
| 304 | if (!ps_refclk) { | ||
| 305 | printk(error, 4, status); | ||
| 306 | return -ENODEV; | ||
| 307 | } | ||
| 308 | refclk_psec = ps_refclk; | ||
| 309 | status = tusb6010_platform_retime(1); | ||
| 310 | if (status < 0) { | ||
| 311 | printk(error, 5, status); | ||
| 312 | return status; | ||
| 313 | } | ||
| 314 | |||
| 315 | /* finish device setup ... */ | ||
| 316 | if (!data) { | ||
| 317 | printk(error, 6, status); | ||
| 318 | return -ENODEV; | ||
| 319 | } | ||
| 320 | data->multipoint = 1; | ||
| 321 | tusb_device.dev.platform_data = data; | ||
| 322 | |||
| 323 | /* REVISIT let the driver know what DMA channels work */ | ||
| 324 | if (!dmachan) | ||
| 325 | tusb_device.dev.dma_mask = NULL; | ||
| 326 | else { | ||
| 327 | /* assume OMAP 2420 ES2.0 and later */ | ||
| 328 | if (dmachan & (1 << 0)) | ||
| 329 | omap_cfg_reg(AA10_242X_DMAREQ0); | ||
| 330 | if (dmachan & (1 << 1)) | ||
| 331 | omap_cfg_reg(AA6_242X_DMAREQ1); | ||
| 332 | if (dmachan & (1 << 2)) | ||
| 333 | omap_cfg_reg(E4_242X_DMAREQ2); | ||
| 334 | if (dmachan & (1 << 3)) | ||
| 335 | omap_cfg_reg(G4_242X_DMAREQ3); | ||
| 336 | if (dmachan & (1 << 4)) | ||
| 337 | omap_cfg_reg(D3_242X_DMAREQ4); | ||
| 338 | if (dmachan & (1 << 5)) | ||
| 339 | omap_cfg_reg(E3_242X_DMAREQ5); | ||
| 340 | } | ||
| 341 | |||
| 342 | /* so far so good ... register the device */ | ||
| 343 | status = platform_device_register(&tusb_device); | ||
| 344 | if (status < 0) { | ||
| 345 | printk(error, 7, status); | ||
| 346 | return status; | ||
| 347 | } | ||
| 348 | return 0; | ||
| 349 | } | ||
