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/board-2430sdp.c | |
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/board-2430sdp.c')
-rw-r--r-- | arch/arm/mach-omap2/board-2430sdp.c | 218 |
1 files changed, 218 insertions, 0 deletions
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 | ||