diff options
Diffstat (limited to 'arch/arm/mach-omap2/board-apollon.c')
-rw-r--r-- | arch/arm/mach-omap2/board-apollon.c | 60 |
1 files changed, 50 insertions, 10 deletions
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c index 7846551f0575..a1e1e6765b5b 100644 --- a/arch/arm/mach-omap2/board-apollon.c +++ b/arch/arm/mach-omap2/board-apollon.c | |||
@@ -26,6 +26,8 @@ | |||
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> | 28 | #include <linux/leds.h> |
29 | #include <linux/err.h> | ||
30 | #include <linux/clk.h> | ||
29 | 31 | ||
30 | #include <asm/hardware.h> | 32 | #include <asm/hardware.h> |
31 | #include <asm/mach-types.h> | 33 | #include <asm/mach-types.h> |
@@ -39,7 +41,7 @@ | |||
39 | #include <asm/arch/board.h> | 41 | #include <asm/arch/board.h> |
40 | #include <asm/arch/common.h> | 42 | #include <asm/arch/common.h> |
41 | #include <asm/arch/gpmc.h> | 43 | #include <asm/arch/gpmc.h> |
42 | #include "prcm-regs.h" | 44 | #include <asm/arch/control.h> |
43 | 45 | ||
44 | /* LED & Switch macros */ | 46 | /* LED & Switch macros */ |
45 | #define LED0_GPIO13 13 | 47 | #define LED0_GPIO13 13 |
@@ -187,17 +189,47 @@ static inline void __init apollon_init_smc91x(void) | |||
187 | { | 189 | { |
188 | unsigned long base; | 190 | unsigned long base; |
189 | 191 | ||
192 | unsigned int rate; | ||
193 | struct clk *gpmc_fck; | ||
194 | int eth_cs; | ||
195 | |||
196 | gpmc_fck = clk_get(NULL, "gpmc_fck"); /* Always on ENABLE_ON_INIT */ | ||
197 | if (IS_ERR(gpmc_fck)) { | ||
198 | WARN_ON(1); | ||
199 | return; | ||
200 | } | ||
201 | |||
202 | clk_enable(gpmc_fck); | ||
203 | rate = clk_get_rate(gpmc_fck); | ||
204 | |||
205 | eth_cs = APOLLON_ETH_CS; | ||
206 | |||
190 | /* Make sure CS1 timings are correct */ | 207 | /* Make sure CS1 timings are correct */ |
191 | GPMC_CONFIG1_1 = 0x00011203; | 208 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG1, 0x00011200); |
192 | GPMC_CONFIG2_1 = 0x001f1f01; | 209 | |
193 | GPMC_CONFIG3_1 = 0x00080803; | 210 | if (rate >= 160000000) { |
194 | GPMC_CONFIG4_1 = 0x1c091c09; | 211 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f01); |
195 | GPMC_CONFIG5_1 = 0x041f1f1f; | 212 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080803); |
196 | GPMC_CONFIG6_1 = 0x000004c4; | 213 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1c0b1c0a); |
214 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
215 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
216 | } else if (rate >= 130000000) { | ||
217 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
218 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
219 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
220 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x041f1F1F); | ||
221 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000004C4); | ||
222 | } else {/* rate = 100000000 */ | ||
223 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG2, 0x001f1f00); | ||
224 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG3, 0x00080802); | ||
225 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG4, 0x1C091C09); | ||
226 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG5, 0x031A1F1F); | ||
227 | gpmc_cs_write_reg(eth_cs, GPMC_CS_CONFIG6, 0x000003C2); | ||
228 | } | ||
197 | 229 | ||
198 | if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { | 230 | if (gpmc_cs_request(APOLLON_ETH_CS, SZ_16M, &base) < 0) { |
199 | printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); | 231 | printk(KERN_ERR "Failed to request GPMC CS for smc91x\n"); |
200 | return; | 232 | goto out; |
201 | } | 233 | } |
202 | apollon_smc91x_resources[0].start = base + 0x300; | 234 | apollon_smc91x_resources[0].start = base + 0x300; |
203 | apollon_smc91x_resources[0].end = base + 0x30f; | 235 | apollon_smc91x_resources[0].end = base + 0x30f; |
@@ -208,9 +240,13 @@ static inline void __init apollon_init_smc91x(void) | |||
208 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", | 240 | printk(KERN_ERR "Failed to request GPIO%d for smc91x IRQ\n", |
209 | APOLLON_ETHR_GPIO_IRQ); | 241 | APOLLON_ETHR_GPIO_IRQ); |
210 | gpmc_cs_free(APOLLON_ETH_CS); | 242 | gpmc_cs_free(APOLLON_ETH_CS); |
211 | return; | 243 | goto out; |
212 | } | 244 | } |
213 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); | 245 | omap_set_gpio_direction(APOLLON_ETHR_GPIO_IRQ, 1); |
246 | |||
247 | out: | ||
248 | clk_disable(gpmc_fck); | ||
249 | clk_put(gpmc_fck); | ||
214 | } | 250 | } |
215 | 251 | ||
216 | static void __init omap_apollon_init_irq(void) | 252 | static void __init omap_apollon_init_irq(void) |
@@ -330,6 +366,8 @@ static void __init apollon_usb_init(void) | |||
330 | 366 | ||
331 | static void __init omap_apollon_init(void) | 367 | static void __init omap_apollon_init(void) |
332 | { | 368 | { |
369 | u32 v; | ||
370 | |||
333 | apollon_led_init(); | 371 | apollon_led_init(); |
334 | apollon_sw_init(); | 372 | apollon_sw_init(); |
335 | apollon_flash_init(); | 373 | apollon_flash_init(); |
@@ -339,7 +377,9 @@ static void __init omap_apollon_init(void) | |||
339 | omap_cfg_reg(W19_24XX_SYS_NIRQ); | 377 | omap_cfg_reg(W19_24XX_SYS_NIRQ); |
340 | 378 | ||
341 | /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */ | 379 | /* Use Interal loop-back in MMC/SDIO Module Input Clock selection */ |
342 | CONTROL_DEVCONF |= (1 << 24); | 380 | v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0); |
381 | v |= (1 << 24); | ||
382 | omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0); | ||
343 | 383 | ||
344 | /* | 384 | /* |
345 | * Make sure the serial ports are muxed on at this point. | 385 | * Make sure the serial ports are muxed on at this point. |