diff options
author | Grant Likely <grant.likely@secretlab.ca> | 2010-05-25 02:38:26 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2010-05-25 02:38:26 -0400 |
commit | b1e50ebcf24668e57f058deb48b0704b5391ed0f (patch) | |
tree | 17e1b69b249d0738317b732186340c9dd053f1a1 /arch/arm/mach-ep93xx | |
parent | 0c2a2ae32793e3500a15a449612485f5d17dd431 (diff) | |
parent | 7e125f7b9cbfce4101191b8076d606c517a73066 (diff) |
Merge remote branch 'origin' into secretlab/next-spi
Diffstat (limited to 'arch/arm/mach-ep93xx')
-rw-r--r-- | arch/arm/mach-ep93xx/adssphere.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/clock.c | 13 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/core.c | 123 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/edb93xx.c | 4 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/gesbc9312.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | 1 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/platform.h | 12 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/ts72xx.h | 19 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/micro9.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/simone.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/snappercl15.c | 6 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/ts72xx.c | 190 |
12 files changed, 279 insertions, 101 deletions
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c index caf6d5154aec..3a1a855bfdca 100644 --- a/arch/arm/mach-ep93xx/adssphere.c +++ b/arch/arm/mach-ep93xx/adssphere.c | |||
@@ -41,7 +41,7 @@ static struct platform_device adssphere_flash = { | |||
41 | .resource = &adssphere_flash_resource, | 41 | .resource = &adssphere_flash_resource, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static struct ep93xx_eth_data adssphere_eth_data = { | 44 | static struct ep93xx_eth_data __initdata adssphere_eth_data = { |
45 | .phy_id = 1, | 45 | .phy_id = 1, |
46 | }; | 46 | }; |
47 | 47 | ||
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c index 5f80092b6ace..e29bdef9b2e2 100644 --- a/arch/arm/mach-ep93xx/clock.c +++ b/arch/arm/mach-ep93xx/clock.c | |||
@@ -96,6 +96,10 @@ static struct clk clk_keypad = { | |||
96 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, | 96 | .enable_mask = EP93XX_SYSCON_KEYTCHCLKDIV_KEN, |
97 | .set_rate = set_keytchclk_rate, | 97 | .set_rate = set_keytchclk_rate, |
98 | }; | 98 | }; |
99 | static struct clk clk_spi = { | ||
100 | .parent = &clk_xtali, | ||
101 | .rate = EP93XX_EXT_CLK_RATE, | ||
102 | }; | ||
99 | static struct clk clk_pwm = { | 103 | static struct clk clk_pwm = { |
100 | .parent = &clk_xtali, | 104 | .parent = &clk_xtali, |
101 | .rate = EP93XX_EXT_CLK_RATE, | 105 | .rate = EP93XX_EXT_CLK_RATE, |
@@ -186,6 +190,7 @@ static struct clk_lookup clocks[] = { | |||
186 | INIT_CK("ep93xx-ohci", NULL, &clk_usb_host), | 190 | INIT_CK("ep93xx-ohci", NULL, &clk_usb_host), |
187 | INIT_CK("ep93xx-keypad", NULL, &clk_keypad), | 191 | INIT_CK("ep93xx-keypad", NULL, &clk_keypad), |
188 | INIT_CK("ep93xx-fb", NULL, &clk_video), | 192 | INIT_CK("ep93xx-fb", NULL, &clk_video), |
193 | INIT_CK("ep93xx-spi.0", NULL, &clk_spi), | ||
189 | INIT_CK(NULL, "pwm_clk", &clk_pwm), | 194 | INIT_CK(NULL, "pwm_clk", &clk_pwm), |
190 | INIT_CK(NULL, "m2p0", &clk_m2p0), | 195 | INIT_CK(NULL, "m2p0", &clk_m2p0), |
191 | INIT_CK(NULL, "m2p1", &clk_m2p1), | 196 | INIT_CK(NULL, "m2p1", &clk_m2p1), |
@@ -473,6 +478,14 @@ static int __init ep93xx_clock_init(void) | |||
473 | /* Initialize the pll2 derived clocks */ | 478 | /* Initialize the pll2 derived clocks */ |
474 | clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1); | 479 | clk_usb_host.rate = clk_pll2.rate / (((value >> 28) & 0xf) + 1); |
475 | 480 | ||
481 | /* | ||
482 | * EP93xx SSP clock rate was doubled in version E2. For more information | ||
483 | * see: | ||
484 | * http://www.cirrus.com/en/pubs/appNote/AN273REV4.pdf | ||
485 | */ | ||
486 | if (ep93xx_chip_revision() < EP93XX_CHIP_REV_E2) | ||
487 | clk_spi.rate /= 2; | ||
488 | |||
476 | pr_info("PLL1 running at %ld MHz, PLL2 at %ld MHz\n", | 489 | pr_info("PLL1 running at %ld MHz, PLL2 at %ld MHz\n", |
477 | clk_pll1.rate / 1000000, clk_pll2.rate / 1000000); | 490 | clk_pll1.rate / 1000000, clk_pll2.rate / 1000000); |
478 | pr_info("FCLK %ld MHz, HCLK %ld MHz, PCLK %ld MHz\n", | 491 | pr_info("FCLK %ld MHz, HCLK %ld MHz, PCLK %ld MHz\n", |
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index 90fb591cbffa..9092677f63eb 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
@@ -31,10 +31,12 @@ | |||
31 | #include <linux/amba/serial.h> | 31 | #include <linux/amba/serial.h> |
32 | #include <linux/i2c.h> | 32 | #include <linux/i2c.h> |
33 | #include <linux/i2c-gpio.h> | 33 | #include <linux/i2c-gpio.h> |
34 | #include <linux/spi/spi.h> | ||
34 | 35 | ||
35 | #include <mach/hardware.h> | 36 | #include <mach/hardware.h> |
36 | #include <mach/fb.h> | 37 | #include <mach/fb.h> |
37 | #include <mach/ep93xx_keypad.h> | 38 | #include <mach/ep93xx_keypad.h> |
39 | #include <mach/ep93xx_spi.h> | ||
38 | 40 | ||
39 | #include <asm/mach/map.h> | 41 | #include <asm/mach/map.h> |
40 | #include <asm/mach/time.h> | 42 | #include <asm/mach/time.h> |
@@ -222,6 +224,20 @@ void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits) | |||
222 | } | 224 | } |
223 | EXPORT_SYMBOL(ep93xx_devcfg_set_clear); | 225 | EXPORT_SYMBOL(ep93xx_devcfg_set_clear); |
224 | 226 | ||
227 | /** | ||
228 | * ep93xx_chip_revision() - returns the EP93xx chip revision | ||
229 | * | ||
230 | * See <mach/platform.h> for more information. | ||
231 | */ | ||
232 | unsigned int ep93xx_chip_revision(void) | ||
233 | { | ||
234 | unsigned int v; | ||
235 | |||
236 | v = __raw_readl(EP93XX_SYSCON_SYSCFG); | ||
237 | v &= EP93XX_SYSCON_SYSCFG_REV_MASK; | ||
238 | v >>= EP93XX_SYSCON_SYSCFG_REV_SHIFT; | ||
239 | return v; | ||
240 | } | ||
225 | 241 | ||
226 | /************************************************************************* | 242 | /************************************************************************* |
227 | * EP93xx peripheral handling | 243 | * EP93xx peripheral handling |
@@ -330,6 +346,10 @@ static struct platform_device ep93xx_ohci_device = { | |||
330 | .resource = ep93xx_ohci_resources, | 346 | .resource = ep93xx_ohci_resources, |
331 | }; | 347 | }; |
332 | 348 | ||
349 | |||
350 | /************************************************************************* | ||
351 | * EP93xx ethernet peripheral handling | ||
352 | *************************************************************************/ | ||
333 | static struct ep93xx_eth_data ep93xx_eth_data; | 353 | static struct ep93xx_eth_data ep93xx_eth_data; |
334 | 354 | ||
335 | static struct resource ep93xx_eth_resource[] = { | 355 | static struct resource ep93xx_eth_resource[] = { |
@@ -354,6 +374,12 @@ static struct platform_device ep93xx_eth_device = { | |||
354 | .resource = ep93xx_eth_resource, | 374 | .resource = ep93xx_eth_resource, |
355 | }; | 375 | }; |
356 | 376 | ||
377 | /** | ||
378 | * ep93xx_register_eth - Register the built-in ethernet platform device. | ||
379 | * @data: platform specific ethernet configuration (__initdata) | ||
380 | * @copy_addr: flag indicating that the MAC address should be copied | ||
381 | * from the IndAd registers (as programmed by the bootloader) | ||
382 | */ | ||
357 | void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) | 383 | void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) |
358 | { | 384 | { |
359 | if (copy_addr) | 385 | if (copy_addr) |
@@ -370,11 +396,19 @@ void __init ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr) | |||
370 | static struct i2c_gpio_platform_data ep93xx_i2c_data; | 396 | static struct i2c_gpio_platform_data ep93xx_i2c_data; |
371 | 397 | ||
372 | static struct platform_device ep93xx_i2c_device = { | 398 | static struct platform_device ep93xx_i2c_device = { |
373 | .name = "i2c-gpio", | 399 | .name = "i2c-gpio", |
374 | .id = 0, | 400 | .id = 0, |
375 | .dev.platform_data = &ep93xx_i2c_data, | 401 | .dev = { |
402 | .platform_data = &ep93xx_i2c_data, | ||
403 | }, | ||
376 | }; | 404 | }; |
377 | 405 | ||
406 | /** | ||
407 | * ep93xx_register_i2c - Register the i2c platform device. | ||
408 | * @data: platform specific i2c-gpio configuration (__initdata) | ||
409 | * @devices: platform specific i2c bus device information (__initdata) | ||
410 | * @num: the number of devices on the i2c bus | ||
411 | */ | ||
378 | void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, | 412 | void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, |
379 | struct i2c_board_info *devices, int num) | 413 | struct i2c_board_info *devices, int num) |
380 | { | 414 | { |
@@ -398,17 +432,67 @@ void __init ep93xx_register_i2c(struct i2c_gpio_platform_data *data, | |||
398 | platform_device_register(&ep93xx_i2c_device); | 432 | platform_device_register(&ep93xx_i2c_device); |
399 | } | 433 | } |
400 | 434 | ||
435 | /************************************************************************* | ||
436 | * EP93xx SPI peripheral handling | ||
437 | *************************************************************************/ | ||
438 | static struct ep93xx_spi_info ep93xx_spi_master_data; | ||
439 | |||
440 | static struct resource ep93xx_spi_resources[] = { | ||
441 | { | ||
442 | .start = EP93XX_SPI_PHYS_BASE, | ||
443 | .end = EP93XX_SPI_PHYS_BASE + 0x18 - 1, | ||
444 | .flags = IORESOURCE_MEM, | ||
445 | }, | ||
446 | { | ||
447 | .start = IRQ_EP93XX_SSP, | ||
448 | .end = IRQ_EP93XX_SSP, | ||
449 | .flags = IORESOURCE_IRQ, | ||
450 | }, | ||
451 | }; | ||
452 | |||
453 | static struct platform_device ep93xx_spi_device = { | ||
454 | .name = "ep93xx-spi", | ||
455 | .id = 0, | ||
456 | .dev = { | ||
457 | .platform_data = &ep93xx_spi_master_data, | ||
458 | }, | ||
459 | .num_resources = ARRAY_SIZE(ep93xx_spi_resources), | ||
460 | .resource = ep93xx_spi_resources, | ||
461 | }; | ||
462 | |||
463 | /** | ||
464 | * ep93xx_register_spi() - registers spi platform device | ||
465 | * @info: ep93xx board specific spi master info (__initdata) | ||
466 | * @devices: SPI devices to register (__initdata) | ||
467 | * @num: number of SPI devices to register | ||
468 | * | ||
469 | * This function registers platform device for the EP93xx SPI controller and | ||
470 | * also makes sure that SPI pins are muxed so that I2S is not using those pins. | ||
471 | */ | ||
472 | void __init ep93xx_register_spi(struct ep93xx_spi_info *info, | ||
473 | struct spi_board_info *devices, int num) | ||
474 | { | ||
475 | /* | ||
476 | * When SPI is used, we need to make sure that I2S is muxed off from | ||
477 | * SPI pins. | ||
478 | */ | ||
479 | ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_I2SONSSP); | ||
480 | |||
481 | ep93xx_spi_master_data = *info; | ||
482 | spi_register_board_info(devices, num); | ||
483 | platform_device_register(&ep93xx_spi_device); | ||
484 | } | ||
401 | 485 | ||
402 | /************************************************************************* | 486 | /************************************************************************* |
403 | * EP93xx LEDs | 487 | * EP93xx LEDs |
404 | *************************************************************************/ | 488 | *************************************************************************/ |
405 | static struct gpio_led ep93xx_led_pins[] = { | 489 | static struct gpio_led ep93xx_led_pins[] = { |
406 | { | 490 | { |
407 | .name = "platform:grled", | 491 | .name = "platform:grled", |
408 | .gpio = EP93XX_GPIO_LINE_GRLED, | 492 | .gpio = EP93XX_GPIO_LINE_GRLED, |
409 | }, { | 493 | }, { |
410 | .name = "platform:rdled", | 494 | .name = "platform:rdled", |
411 | .gpio = EP93XX_GPIO_LINE_RDLED, | 495 | .gpio = EP93XX_GPIO_LINE_RDLED, |
412 | }, | 496 | }, |
413 | }; | 497 | }; |
414 | 498 | ||
@@ -528,7 +612,7 @@ static struct platform_device ep93xx_fb_device = { | |||
528 | .name = "ep93xx-fb", | 612 | .name = "ep93xx-fb", |
529 | .id = -1, | 613 | .id = -1, |
530 | .dev = { | 614 | .dev = { |
531 | .platform_data = &ep93xxfb_data, | 615 | .platform_data = &ep93xxfb_data, |
532 | .coherent_dma_mask = DMA_BIT_MASK(32), | 616 | .coherent_dma_mask = DMA_BIT_MASK(32), |
533 | .dma_mask = &ep93xx_fb_device.dev.coherent_dma_mask, | 617 | .dma_mask = &ep93xx_fb_device.dev.coherent_dma_mask, |
534 | }, | 618 | }, |
@@ -536,6 +620,10 @@ static struct platform_device ep93xx_fb_device = { | |||
536 | .resource = ep93xx_fb_resource, | 620 | .resource = ep93xx_fb_resource, |
537 | }; | 621 | }; |
538 | 622 | ||
623 | /** | ||
624 | * ep93xx_register_fb - Register the framebuffer platform device. | ||
625 | * @data: platform specific framebuffer configuration (__initdata) | ||
626 | */ | ||
539 | void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data) | 627 | void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data) |
540 | { | 628 | { |
541 | ep93xxfb_data = *data; | 629 | ep93xxfb_data = *data; |
@@ -546,6 +634,8 @@ void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data) | |||
546 | /************************************************************************* | 634 | /************************************************************************* |
547 | * EP93xx matrix keypad peripheral handling | 635 | * EP93xx matrix keypad peripheral handling |
548 | *************************************************************************/ | 636 | *************************************************************************/ |
637 | static struct ep93xx_keypad_platform_data ep93xx_keypad_data; | ||
638 | |||
549 | static struct resource ep93xx_keypad_resource[] = { | 639 | static struct resource ep93xx_keypad_resource[] = { |
550 | { | 640 | { |
551 | .start = EP93XX_KEY_MATRIX_PHYS_BASE, | 641 | .start = EP93XX_KEY_MATRIX_PHYS_BASE, |
@@ -559,15 +649,22 @@ static struct resource ep93xx_keypad_resource[] = { | |||
559 | }; | 649 | }; |
560 | 650 | ||
561 | static struct platform_device ep93xx_keypad_device = { | 651 | static struct platform_device ep93xx_keypad_device = { |
562 | .name = "ep93xx-keypad", | 652 | .name = "ep93xx-keypad", |
563 | .id = -1, | 653 | .id = -1, |
564 | .num_resources = ARRAY_SIZE(ep93xx_keypad_resource), | 654 | .dev = { |
565 | .resource = ep93xx_keypad_resource, | 655 | .platform_data = &ep93xx_keypad_data, |
656 | }, | ||
657 | .num_resources = ARRAY_SIZE(ep93xx_keypad_resource), | ||
658 | .resource = ep93xx_keypad_resource, | ||
566 | }; | 659 | }; |
567 | 660 | ||
661 | /** | ||
662 | * ep93xx_register_keypad - Register the keypad platform device. | ||
663 | * @data: platform specific keypad configuration (__initdata) | ||
664 | */ | ||
568 | void __init ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data) | 665 | void __init ep93xx_register_keypad(struct ep93xx_keypad_platform_data *data) |
569 | { | 666 | { |
570 | ep93xx_keypad_device.dev.platform_data = data; | 667 | ep93xx_keypad_data = *data; |
571 | platform_device_register(&ep93xx_keypad_device); | 668 | platform_device_register(&ep93xx_keypad_device); |
572 | } | 669 | } |
573 | 670 | ||
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c index d22d67ac8b99..3884182cd362 100644 --- a/arch/arm/mach-ep93xx/edb93xx.c +++ b/arch/arm/mach-ep93xx/edb93xx.c | |||
@@ -74,7 +74,7 @@ static void __init edb93xx_register_flash(void) | |||
74 | } | 74 | } |
75 | } | 75 | } |
76 | 76 | ||
77 | static struct ep93xx_eth_data edb93xx_eth_data = { | 77 | static struct ep93xx_eth_data __initdata edb93xx_eth_data = { |
78 | .phy_id = 1, | 78 | .phy_id = 1, |
79 | }; | 79 | }; |
80 | 80 | ||
@@ -82,7 +82,7 @@ static struct ep93xx_eth_data edb93xx_eth_data = { | |||
82 | /************************************************************************* | 82 | /************************************************************************* |
83 | * EDB93xx i2c peripheral handling | 83 | * EDB93xx i2c peripheral handling |
84 | *************************************************************************/ | 84 | *************************************************************************/ |
85 | static struct i2c_gpio_platform_data edb93xx_i2c_gpio_data = { | 85 | static struct i2c_gpio_platform_data __initdata edb93xx_i2c_gpio_data = { |
86 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | 86 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, |
87 | .sda_is_open_drain = 0, | 87 | .sda_is_open_drain = 0, |
88 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | 88 | .scl_pin = EP93XX_GPIO_LINE_EECLK, |
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c index 3da7ca816d19..a809618e9f05 100644 --- a/arch/arm/mach-ep93xx/gesbc9312.c +++ b/arch/arm/mach-ep93xx/gesbc9312.c | |||
@@ -41,7 +41,7 @@ static struct platform_device gesbc9312_flash = { | |||
41 | .resource = &gesbc9312_flash_resource, | 41 | .resource = &gesbc9312_flash_resource, |
42 | }; | 42 | }; |
43 | 43 | ||
44 | static struct ep93xx_eth_data gesbc9312_eth_data = { | 44 | static struct ep93xx_eth_data __initdata gesbc9312_eth_data = { |
45 | .phy_id = 1, | 45 | .phy_id = 1, |
46 | }; | 46 | }; |
47 | 47 | ||
diff --git a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h index 93e2ecc79ceb..b1e096f0c2d2 100644 --- a/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h +++ b/arch/arm/mach-ep93xx/include/mach/ep93xx-regs.h | |||
@@ -106,6 +106,7 @@ | |||
106 | 106 | ||
107 | #define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) | 107 | #define EP93XX_AAC_BASE EP93XX_APB_IOMEM(0x00080000) |
108 | 108 | ||
109 | #define EP93XX_SPI_PHYS_BASE EP93XX_APB_PHYS(0x000a0000) | ||
109 | #define EP93XX_SPI_BASE EP93XX_APB_IOMEM(0x000a0000) | 110 | #define EP93XX_SPI_BASE EP93XX_APB_IOMEM(0x000a0000) |
110 | 111 | ||
111 | #define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) | 112 | #define EP93XX_IRDA_BASE EP93XX_APB_IOMEM(0x000b0000) |
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h index c6dc14dbca18..9a4413dd44bb 100644 --- a/arch/arm/mach-ep93xx/include/mach/platform.h +++ b/arch/arm/mach-ep93xx/include/mach/platform.h | |||
@@ -6,9 +6,11 @@ | |||
6 | 6 | ||
7 | struct i2c_gpio_platform_data; | 7 | struct i2c_gpio_platform_data; |
8 | struct i2c_board_info; | 8 | struct i2c_board_info; |
9 | struct spi_board_info; | ||
9 | struct platform_device; | 10 | struct platform_device; |
10 | struct ep93xxfb_mach_info; | 11 | struct ep93xxfb_mach_info; |
11 | struct ep93xx_keypad_platform_data; | 12 | struct ep93xx_keypad_platform_data; |
13 | struct ep93xx_spi_info; | ||
12 | 14 | ||
13 | struct ep93xx_eth_data | 15 | struct ep93xx_eth_data |
14 | { | 16 | { |
@@ -33,9 +35,19 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits) | |||
33 | ep93xx_devcfg_set_clear(0x00, bits); | 35 | ep93xx_devcfg_set_clear(0x00, bits); |
34 | } | 36 | } |
35 | 37 | ||
38 | #define EP93XX_CHIP_REV_D0 3 | ||
39 | #define EP93XX_CHIP_REV_D1 4 | ||
40 | #define EP93XX_CHIP_REV_E0 5 | ||
41 | #define EP93XX_CHIP_REV_E1 6 | ||
42 | #define EP93XX_CHIP_REV_E2 7 | ||
43 | |||
44 | unsigned int ep93xx_chip_revision(void); | ||
45 | |||
36 | void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); | 46 | void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); |
37 | void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, | 47 | void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, |
38 | struct i2c_board_info *devices, int num); | 48 | struct i2c_board_info *devices, int num); |
49 | void ep93xx_register_spi(struct ep93xx_spi_info *info, | ||
50 | struct spi_board_info *devices, int num); | ||
39 | void ep93xx_register_fb(struct ep93xxfb_mach_info *data); | 51 | void ep93xx_register_fb(struct ep93xxfb_mach_info *data); |
40 | void ep93xx_register_pwm(int pwm0, int pwm1); | 52 | void ep93xx_register_pwm(int pwm0, int pwm1); |
41 | int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); | 53 | int ep93xx_pwm_acquire_gpio(struct platform_device *pdev); |
diff --git a/arch/arm/mach-ep93xx/include/mach/ts72xx.h b/arch/arm/mach-ep93xx/include/mach/ts72xx.h index 93107d88ff3a..0eabec62cd9d 100644 --- a/arch/arm/mach-ep93xx/include/mach/ts72xx.h +++ b/arch/arm/mach-ep93xx/include/mach/ts72xx.h | |||
@@ -9,9 +9,6 @@ | |||
9 | * febff000 22000000 4K model number register | 9 | * febff000 22000000 4K model number register |
10 | * febfe000 22400000 4K options register | 10 | * febfe000 22400000 4K options register |
11 | * febfd000 22800000 4K options register #2 | 11 | * febfd000 22800000 4K options register #2 |
12 | * febfc000 [67]0000000 4K NAND data register | ||
13 | * febfb000 [67]0400000 4K NAND control register | ||
14 | * febfa000 [67]0800000 4K NAND busy register | ||
15 | * febf9000 10800000 4K TS-5620 RTC index register | 12 | * febf9000 10800000 4K TS-5620 RTC index register |
16 | * febf8000 11700000 4K TS-5620 RTC data register | 13 | * febf8000 11700000 4K TS-5620 RTC data register |
17 | */ | 14 | */ |
@@ -41,22 +38,6 @@ | |||
41 | #define TS72XX_OPTIONS2_TS9420_BOOT 0x02 | 38 | #define TS72XX_OPTIONS2_TS9420_BOOT 0x02 |
42 | 39 | ||
43 | 40 | ||
44 | #define TS72XX_NAND1_DATA_PHYS_BASE 0x60000000 | ||
45 | #define TS72XX_NAND2_DATA_PHYS_BASE 0x70000000 | ||
46 | #define TS72XX_NAND_DATA_VIRT_BASE 0xfebfc000 | ||
47 | #define TS72XX_NAND_DATA_SIZE 0x00001000 | ||
48 | |||
49 | #define TS72XX_NAND1_CONTROL_PHYS_BASE 0x60400000 | ||
50 | #define TS72XX_NAND2_CONTROL_PHYS_BASE 0x70400000 | ||
51 | #define TS72XX_NAND_CONTROL_VIRT_BASE 0xfebfb000 | ||
52 | #define TS72XX_NAND_CONTROL_SIZE 0x00001000 | ||
53 | |||
54 | #define TS72XX_NAND1_BUSY_PHYS_BASE 0x60800000 | ||
55 | #define TS72XX_NAND2_BUSY_PHYS_BASE 0x70800000 | ||
56 | #define TS72XX_NAND_BUSY_VIRT_BASE 0xfebfa000 | ||
57 | #define TS72XX_NAND_BUSY_SIZE 0x00001000 | ||
58 | |||
59 | |||
60 | #define TS72XX_RTC_INDEX_VIRT_BASE 0xfebf9000 | 41 | #define TS72XX_RTC_INDEX_VIRT_BASE 0xfebf9000 |
61 | #define TS72XX_RTC_INDEX_PHYS_BASE 0x10800000 | 42 | #define TS72XX_RTC_INDEX_PHYS_BASE 0x10800000 |
62 | #define TS72XX_RTC_INDEX_SIZE 0x00001000 | 43 | #define TS72XX_RTC_INDEX_SIZE 0x00001000 |
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c index c33360e82868..1cc911b4efa6 100644 --- a/arch/arm/mach-ep93xx/micro9.c +++ b/arch/arm/mach-ep93xx/micro9.c | |||
@@ -80,7 +80,7 @@ static void __init micro9_register_flash(void) | |||
80 | /************************************************************************* | 80 | /************************************************************************* |
81 | * Micro9 Ethernet | 81 | * Micro9 Ethernet |
82 | *************************************************************************/ | 82 | *************************************************************************/ |
83 | static struct ep93xx_eth_data micro9_eth_data = { | 83 | static struct ep93xx_eth_data __initdata micro9_eth_data = { |
84 | .phy_id = 0x1f, | 84 | .phy_id = 0x1f, |
85 | }; | 85 | }; |
86 | 86 | ||
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c index cd93990f1b99..388aec95f60e 100644 --- a/arch/arm/mach-ep93xx/simone.c +++ b/arch/arm/mach-ep93xx/simone.c | |||
@@ -49,17 +49,17 @@ static struct platform_device simone_flash = { | |||
49 | }, | 49 | }, |
50 | }; | 50 | }; |
51 | 51 | ||
52 | static struct ep93xx_eth_data simone_eth_data = { | 52 | static struct ep93xx_eth_data __initdata simone_eth_data = { |
53 | .phy_id = 1, | 53 | .phy_id = 1, |
54 | }; | 54 | }; |
55 | 55 | ||
56 | static struct ep93xxfb_mach_info simone_fb_info = { | 56 | static struct ep93xxfb_mach_info __initdata simone_fb_info = { |
57 | .num_modes = EP93XXFB_USE_MODEDB, | 57 | .num_modes = EP93XXFB_USE_MODEDB, |
58 | .bpp = 16, | 58 | .bpp = 16, |
59 | .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, | 59 | .flags = EP93XXFB_USE_SDCSN0 | EP93XXFB_PCLK_FALLING, |
60 | }; | 60 | }; |
61 | 61 | ||
62 | static struct i2c_gpio_platform_data simone_i2c_gpio_data = { | 62 | static struct i2c_gpio_platform_data __initdata simone_i2c_gpio_data = { |
63 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | 63 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, |
64 | .sda_is_open_drain = 0, | 64 | .sda_is_open_drain = 0, |
65 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | 65 | .scl_pin = EP93XX_GPIO_LINE_EECLK, |
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c index 51134b0382ca..38deaee40397 100644 --- a/arch/arm/mach-ep93xx/snappercl15.c +++ b/arch/arm/mach-ep93xx/snappercl15.c | |||
@@ -125,11 +125,11 @@ static struct platform_device snappercl15_nand_device = { | |||
125 | .num_resources = ARRAY_SIZE(snappercl15_nand_resource), | 125 | .num_resources = ARRAY_SIZE(snappercl15_nand_resource), |
126 | }; | 126 | }; |
127 | 127 | ||
128 | static struct ep93xx_eth_data snappercl15_eth_data = { | 128 | static struct ep93xx_eth_data __initdata snappercl15_eth_data = { |
129 | .phy_id = 1, | 129 | .phy_id = 1, |
130 | }; | 130 | }; |
131 | 131 | ||
132 | static struct i2c_gpio_platform_data snappercl15_i2c_gpio_data = { | 132 | static struct i2c_gpio_platform_data __initdata snappercl15_i2c_gpio_data = { |
133 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, | 133 | .sda_pin = EP93XX_GPIO_LINE_EEDAT, |
134 | .sda_is_open_drain = 0, | 134 | .sda_is_open_drain = 0, |
135 | .scl_pin = EP93XX_GPIO_LINE_EECLK, | 135 | .scl_pin = EP93XX_GPIO_LINE_EECLK, |
@@ -145,7 +145,7 @@ static struct i2c_board_info __initdata snappercl15_i2c_data[] = { | |||
145 | }, | 145 | }, |
146 | }; | 146 | }; |
147 | 147 | ||
148 | static struct ep93xxfb_mach_info snappercl15_fb_info = { | 148 | static struct ep93xxfb_mach_info __initdata snappercl15_fb_info = { |
149 | .num_modes = EP93XXFB_USE_MODEDB, | 149 | .num_modes = EP93XXFB_USE_MODEDB, |
150 | .bpp = 16, | 150 | .bpp = 16, |
151 | }; | 151 | }; |
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c index fac1ec7a60fb..ae7319e588c7 100644 --- a/arch/arm/mach-ep93xx/ts72xx.c +++ b/arch/arm/mach-ep93xx/ts72xx.c | |||
@@ -10,12 +10,16 @@ | |||
10 | * your option) any later version. | 10 | * your option) any later version. |
11 | */ | 11 | */ |
12 | 12 | ||
13 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | ||
14 | |||
13 | #include <linux/kernel.h> | 15 | #include <linux/kernel.h> |
14 | #include <linux/init.h> | 16 | #include <linux/init.h> |
15 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
16 | #include <linux/io.h> | 18 | #include <linux/io.h> |
17 | #include <linux/m48t86.h> | 19 | #include <linux/m48t86.h> |
18 | #include <linux/mtd/physmap.h> | 20 | #include <linux/mtd/physmap.h> |
21 | #include <linux/mtd/nand.h> | ||
22 | #include <linux/mtd/partitions.h> | ||
19 | 23 | ||
20 | #include <mach/hardware.h> | 24 | #include <mach/hardware.h> |
21 | #include <mach/ts72xx.h> | 25 | #include <mach/ts72xx.h> |
@@ -54,92 +58,162 @@ static struct map_desc ts72xx_io_desc[] __initdata = { | |||
54 | } | 58 | } |
55 | }; | 59 | }; |
56 | 60 | ||
57 | static struct map_desc ts72xx_nand_io_desc[] __initdata = { | 61 | static void __init ts72xx_map_io(void) |
58 | { | 62 | { |
59 | .virtual = TS72XX_NAND_DATA_VIRT_BASE, | 63 | ep93xx_map_io(); |
60 | .pfn = __phys_to_pfn(TS72XX_NAND1_DATA_PHYS_BASE), | 64 | iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc)); |
61 | .length = TS72XX_NAND_DATA_SIZE, | 65 | } |
62 | .type = MT_DEVICE, | 66 | |
63 | }, { | 67 | |
64 | .virtual = TS72XX_NAND_CONTROL_VIRT_BASE, | 68 | /************************************************************************* |
65 | .pfn = __phys_to_pfn(TS72XX_NAND1_CONTROL_PHYS_BASE), | 69 | * NAND flash |
66 | .length = TS72XX_NAND_CONTROL_SIZE, | 70 | *************************************************************************/ |
67 | .type = MT_DEVICE, | 71 | #define TS72XX_NAND_CONTROL_ADDR_LINE 22 /* 0xN0400000 */ |
68 | }, { | 72 | #define TS72XX_NAND_BUSY_ADDR_LINE 23 /* 0xN0800000 */ |
69 | .virtual = TS72XX_NAND_BUSY_VIRT_BASE, | 73 | |
70 | .pfn = __phys_to_pfn(TS72XX_NAND1_BUSY_PHYS_BASE), | 74 | static void ts72xx_nand_hwcontrol(struct mtd_info *mtd, |
71 | .length = TS72XX_NAND_BUSY_SIZE, | 75 | int cmd, unsigned int ctrl) |
72 | .type = MT_DEVICE, | 76 | { |
77 | struct nand_chip *chip = mtd->priv; | ||
78 | |||
79 | if (ctrl & NAND_CTRL_CHANGE) { | ||
80 | void __iomem *addr = chip->IO_ADDR_R; | ||
81 | unsigned char bits; | ||
82 | |||
83 | addr += (1 << TS72XX_NAND_CONTROL_ADDR_LINE); | ||
84 | |||
85 | bits = __raw_readb(addr) & ~0x07; | ||
86 | bits |= (ctrl & NAND_NCE) << 2; /* bit 0 -> bit 2 */ | ||
87 | bits |= (ctrl & NAND_CLE); /* bit 1 -> bit 1 */ | ||
88 | bits |= (ctrl & NAND_ALE) >> 2; /* bit 2 -> bit 0 */ | ||
89 | |||
90 | __raw_writeb(bits, addr); | ||
73 | } | 91 | } |
74 | }; | ||
75 | 92 | ||
76 | static struct map_desc ts72xx_alternate_nand_io_desc[] __initdata = { | 93 | if (cmd != NAND_CMD_NONE) |
94 | __raw_writeb(cmd, chip->IO_ADDR_W); | ||
95 | } | ||
96 | |||
97 | static int ts72xx_nand_device_ready(struct mtd_info *mtd) | ||
98 | { | ||
99 | struct nand_chip *chip = mtd->priv; | ||
100 | void __iomem *addr = chip->IO_ADDR_R; | ||
101 | |||
102 | addr += (1 << TS72XX_NAND_BUSY_ADDR_LINE); | ||
103 | |||
104 | return !!(__raw_readb(addr) & 0x20); | ||
105 | } | ||
106 | |||
107 | static const char *ts72xx_nand_part_probes[] = { "cmdlinepart", NULL }; | ||
108 | |||
109 | #define TS72XX_BOOTROM_PART_SIZE (SZ_16K) | ||
110 | #define TS72XX_REDBOOT_PART_SIZE (SZ_2M + SZ_1M) | ||
111 | |||
112 | static struct mtd_partition ts72xx_nand_parts[] = { | ||
77 | { | 113 | { |
78 | .virtual = TS72XX_NAND_DATA_VIRT_BASE, | 114 | .name = "TS-BOOTROM", |
79 | .pfn = __phys_to_pfn(TS72XX_NAND2_DATA_PHYS_BASE), | 115 | .offset = 0, |
80 | .length = TS72XX_NAND_DATA_SIZE, | 116 | .size = TS72XX_BOOTROM_PART_SIZE, |
81 | .type = MT_DEVICE, | 117 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
82 | }, { | 118 | }, { |
83 | .virtual = TS72XX_NAND_CONTROL_VIRT_BASE, | 119 | .name = "Linux", |
84 | .pfn = __phys_to_pfn(TS72XX_NAND2_CONTROL_PHYS_BASE), | 120 | .offset = MTDPART_OFS_APPEND, |
85 | .length = TS72XX_NAND_CONTROL_SIZE, | 121 | .size = 0, /* filled in later */ |
86 | .type = MT_DEVICE, | ||
87 | }, { | 122 | }, { |
88 | .virtual = TS72XX_NAND_BUSY_VIRT_BASE, | 123 | .name = "RedBoot", |
89 | .pfn = __phys_to_pfn(TS72XX_NAND2_BUSY_PHYS_BASE), | 124 | .offset = MTDPART_OFS_APPEND, |
90 | .length = TS72XX_NAND_BUSY_SIZE, | 125 | .size = MTDPART_SIZ_FULL, |
91 | .type = MT_DEVICE, | 126 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
92 | } | 127 | }, |
93 | }; | 128 | }; |
94 | 129 | ||
95 | static void __init ts72xx_map_io(void) | 130 | static void ts72xx_nand_set_parts(uint64_t size, |
131 | struct platform_nand_chip *chip) | ||
96 | { | 132 | { |
97 | ep93xx_map_io(); | 133 | /* Factory TS-72xx boards only come with 32MiB or 128MiB NAND options */ |
98 | iotable_init(ts72xx_io_desc, ARRAY_SIZE(ts72xx_io_desc)); | 134 | if (size == SZ_32M || size == SZ_128M) { |
135 | /* Set the "Linux" partition size */ | ||
136 | ts72xx_nand_parts[1].size = size - TS72XX_REDBOOT_PART_SIZE; | ||
99 | 137 | ||
100 | /* | 138 | chip->partitions = ts72xx_nand_parts; |
101 | * The TS-7200 has NOR flash, the other models have NAND flash. | 139 | chip->nr_partitions = ARRAY_SIZE(ts72xx_nand_parts); |
102 | */ | 140 | } else { |
103 | if (!board_is_ts7200()) { | 141 | pr_warning("Unknown nand disk size:%lluMiB\n", size >> 20); |
104 | if (is_ts9420_installed()) { | ||
105 | iotable_init(ts72xx_alternate_nand_io_desc, | ||
106 | ARRAY_SIZE(ts72xx_alternate_nand_io_desc)); | ||
107 | } else { | ||
108 | iotable_init(ts72xx_nand_io_desc, | ||
109 | ARRAY_SIZE(ts72xx_nand_io_desc)); | ||
110 | } | ||
111 | } | 142 | } |
112 | } | 143 | } |
113 | 144 | ||
145 | static struct platform_nand_data ts72xx_nand_data = { | ||
146 | .chip = { | ||
147 | .nr_chips = 1, | ||
148 | .chip_offset = 0, | ||
149 | .chip_delay = 15, | ||
150 | .part_probe_types = ts72xx_nand_part_probes, | ||
151 | .set_parts = ts72xx_nand_set_parts, | ||
152 | }, | ||
153 | .ctrl = { | ||
154 | .cmd_ctrl = ts72xx_nand_hwcontrol, | ||
155 | .dev_ready = ts72xx_nand_device_ready, | ||
156 | }, | ||
157 | }; | ||
158 | |||
159 | static struct resource ts72xx_nand_resource[] = { | ||
160 | { | ||
161 | .start = 0, /* filled in later */ | ||
162 | .end = 0, /* filled in later */ | ||
163 | .flags = IORESOURCE_MEM, | ||
164 | }, | ||
165 | }; | ||
166 | |||
167 | static struct platform_device ts72xx_nand_flash = { | ||
168 | .name = "gen_nand", | ||
169 | .id = -1, | ||
170 | .dev.platform_data = &ts72xx_nand_data, | ||
171 | .resource = ts72xx_nand_resource, | ||
172 | .num_resources = ARRAY_SIZE(ts72xx_nand_resource), | ||
173 | }; | ||
174 | |||
175 | |||
114 | /************************************************************************* | 176 | /************************************************************************* |
115 | * NOR flash (TS-7200 only) | 177 | * NOR flash (TS-7200 only) |
116 | *************************************************************************/ | 178 | *************************************************************************/ |
117 | static struct physmap_flash_data ts72xx_flash_data = { | 179 | static struct physmap_flash_data ts72xx_nor_data = { |
118 | .width = 2, | 180 | .width = 2, |
119 | }; | 181 | }; |
120 | 182 | ||
121 | static struct resource ts72xx_flash_resource = { | 183 | static struct resource ts72xx_nor_resource = { |
122 | .start = EP93XX_CS6_PHYS_BASE, | 184 | .start = EP93XX_CS6_PHYS_BASE, |
123 | .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1, | 185 | .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1, |
124 | .flags = IORESOURCE_MEM, | 186 | .flags = IORESOURCE_MEM, |
125 | }; | 187 | }; |
126 | 188 | ||
127 | static struct platform_device ts72xx_flash = { | 189 | static struct platform_device ts72xx_nor_flash = { |
128 | .name = "physmap-flash", | 190 | .name = "physmap-flash", |
129 | .id = 0, | 191 | .id = 0, |
130 | .dev = { | 192 | .dev.platform_data = &ts72xx_nor_data, |
131 | .platform_data = &ts72xx_flash_data, | 193 | .resource = &ts72xx_nor_resource, |
132 | }, | 194 | .num_resources = 1, |
133 | .num_resources = 1, | ||
134 | .resource = &ts72xx_flash_resource, | ||
135 | }; | 195 | }; |
136 | 196 | ||
137 | static void __init ts72xx_register_flash(void) | 197 | static void __init ts72xx_register_flash(void) |
138 | { | 198 | { |
139 | if (board_is_ts7200()) | 199 | if (board_is_ts7200()) { |
140 | platform_device_register(&ts72xx_flash); | 200 | platform_device_register(&ts72xx_nor_flash); |
201 | } else { | ||
202 | resource_size_t start; | ||
203 | |||
204 | if (is_ts9420_installed()) | ||
205 | start = EP93XX_CS7_PHYS_BASE; | ||
206 | else | ||
207 | start = EP93XX_CS6_PHYS_BASE; | ||
208 | |||
209 | ts72xx_nand_resource[0].start = start; | ||
210 | ts72xx_nand_resource[0].end = start + SZ_16M - 1; | ||
211 | |||
212 | platform_device_register(&ts72xx_nand_flash); | ||
213 | } | ||
141 | } | 214 | } |
142 | 215 | ||
216 | |||
143 | static unsigned char ts72xx_rtc_readbyte(unsigned long addr) | 217 | static unsigned char ts72xx_rtc_readbyte(unsigned long addr) |
144 | { | 218 | { |
145 | __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); | 219 | __raw_writeb(addr, TS72XX_RTC_INDEX_VIRT_BASE); |
@@ -186,7 +260,7 @@ static struct platform_device ts72xx_wdt_device = { | |||
186 | .resource = ts72xx_wdt_resources, | 260 | .resource = ts72xx_wdt_resources, |
187 | }; | 261 | }; |
188 | 262 | ||
189 | static struct ep93xx_eth_data ts72xx_eth_data = { | 263 | static struct ep93xx_eth_data __initdata ts72xx_eth_data = { |
190 | .phy_id = 1, | 264 | .phy_id = 1, |
191 | }; | 265 | }; |
192 | 266 | ||