diff options
25 files changed, 524 insertions, 7 deletions
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c index 1532b508c814..00c0a78fc12c 100644 --- a/arch/arm/mach-at91/at91sam9g45.c +++ b/arch/arm/mach-at91/at91sam9g45.c | |||
@@ -54,6 +54,11 @@ static struct clk pioDE_clk = { | |||
54 | .pmc_mask = 1 << AT91SAM9G45_ID_PIODE, | 54 | .pmc_mask = 1 << AT91SAM9G45_ID_PIODE, |
55 | .type = CLK_TYPE_PERIPHERAL, | 55 | .type = CLK_TYPE_PERIPHERAL, |
56 | }; | 56 | }; |
57 | static struct clk trng_clk = { | ||
58 | .name = "trng_clk", | ||
59 | .pmc_mask = 1 << AT91SAM9G45_ID_TRNG, | ||
60 | .type = CLK_TYPE_PERIPHERAL, | ||
61 | }; | ||
57 | static struct clk usart0_clk = { | 62 | static struct clk usart0_clk = { |
58 | .name = "usart0_clk", | 63 | .name = "usart0_clk", |
59 | .pmc_mask = 1 << AT91SAM9G45_ID_US0, | 64 | .pmc_mask = 1 << AT91SAM9G45_ID_US0, |
@@ -177,6 +182,7 @@ static struct clk *periph_clocks[] __initdata = { | |||
177 | &pioB_clk, | 182 | &pioB_clk, |
178 | &pioC_clk, | 183 | &pioC_clk, |
179 | &pioDE_clk, | 184 | &pioDE_clk, |
185 | &trng_clk, | ||
180 | &usart0_clk, | 186 | &usart0_clk, |
181 | &usart1_clk, | 187 | &usart1_clk, |
182 | &usart2_clk, | 188 | &usart2_clk, |
@@ -216,6 +222,7 @@ static struct clk_lookup periph_clocks_lookups[] = { | |||
216 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), | 222 | CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), |
217 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), | 223 | CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), |
218 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), | 224 | CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), |
225 | CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk), | ||
219 | }; | 226 | }; |
220 | 227 | ||
221 | static struct clk_lookup usart_clocks_lookups[] = { | 228 | static struct clk_lookup usart_clocks_lookups[] = { |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index c3dfb1b3b1e3..2d6d57f7ba8a 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -1095,6 +1095,34 @@ static void __init at91_add_device_rtt(void) | |||
1095 | 1095 | ||
1096 | 1096 | ||
1097 | /* -------------------------------------------------------------------- | 1097 | /* -------------------------------------------------------------------- |
1098 | * TRNG | ||
1099 | * -------------------------------------------------------------------- */ | ||
1100 | |||
1101 | #if defined(CONFIG_HW_RANDOM_ATMEL) || defined(CONFIG_HW_RANDOM_ATMEL_MODULE) | ||
1102 | static struct resource trng_resources[] = { | ||
1103 | { | ||
1104 | .start = AT91SAM9G45_BASE_TRNG, | ||
1105 | .end = AT91SAM9G45_BASE_TRNG + SZ_16K - 1, | ||
1106 | .flags = IORESOURCE_MEM, | ||
1107 | }, | ||
1108 | }; | ||
1109 | |||
1110 | static struct platform_device at91sam9g45_trng_device = { | ||
1111 | .name = "atmel-trng", | ||
1112 | .id = -1, | ||
1113 | .resource = trng_resources, | ||
1114 | .num_resources = ARRAY_SIZE(trng_resources), | ||
1115 | }; | ||
1116 | |||
1117 | static void __init at91_add_device_trng(void) | ||
1118 | { | ||
1119 | platform_device_register(&at91sam9g45_trng_device); | ||
1120 | } | ||
1121 | #else | ||
1122 | static void __init at91_add_device_trng(void) {} | ||
1123 | #endif | ||
1124 | |||
1125 | /* -------------------------------------------------------------------- | ||
1098 | * Watchdog | 1126 | * Watchdog |
1099 | * -------------------------------------------------------------------- */ | 1127 | * -------------------------------------------------------------------- */ |
1100 | 1128 | ||
@@ -1583,6 +1611,7 @@ static int __init at91_add_standard_devices(void) | |||
1583 | at91_add_device_hdmac(); | 1611 | at91_add_device_hdmac(); |
1584 | at91_add_device_rtc(); | 1612 | at91_add_device_rtc(); |
1585 | at91_add_device_rtt(); | 1613 | at91_add_device_rtt(); |
1614 | at91_add_device_trng(); | ||
1586 | at91_add_device_watchdog(); | 1615 | at91_add_device_watchdog(); |
1587 | at91_add_device_tc(); | 1616 | at91_add_device_tc(); |
1588 | return 0; | 1617 | return 0; |
diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c index 6912b821b37b..becc92e0b95d 100644 --- a/arch/arm/mach-imx/clock-imx27.c +++ b/arch/arm/mach-imx/clock-imx27.c | |||
@@ -583,7 +583,7 @@ DEFINE_CLOCK(emi_clk, 0, PCCR1, 19, NULL, NULL, &ahb_clk); | |||
583 | DEFINE_CLOCK(dma_clk1, 0, PCCR1, 20, NULL, NULL, &ahb_clk); | 583 | DEFINE_CLOCK(dma_clk1, 0, PCCR1, 20, NULL, NULL, &ahb_clk); |
584 | DEFINE_CLOCK(csi_clk1, 0, PCCR1, 21, NULL, NULL, &ahb_clk); | 584 | DEFINE_CLOCK(csi_clk1, 0, PCCR1, 21, NULL, NULL, &ahb_clk); |
585 | DEFINE_CLOCK(brom_clk, 0, PCCR1, 22, NULL, NULL, &ahb_clk); | 585 | DEFINE_CLOCK(brom_clk, 0, PCCR1, 22, NULL, NULL, &ahb_clk); |
586 | DEFINE_CLOCK(ata_clk, 0, PCCR1, 23, NULL, NULL, &ahb_clk); | 586 | DEFINE_CLOCK(pata_clk, 0, PCCR1, 23, NULL, NULL, &ahb_clk); |
587 | DEFINE_CLOCK(wdog_clk, 0, PCCR1, 24, NULL, NULL, &ipg_clk); | 587 | DEFINE_CLOCK(wdog_clk, 0, PCCR1, 24, NULL, NULL, &ipg_clk); |
588 | DEFINE_CLOCK(usb_clk, 0, PCCR1, 25, get_rate_usb, &usb_clk1, &spll_clk); | 588 | DEFINE_CLOCK(usb_clk, 0, PCCR1, 25, get_rate_usb, &usb_clk1, &spll_clk); |
589 | DEFINE_CLOCK(uart6_clk1, 0, PCCR1, 26, NULL, NULL, &ipg_clk); | 589 | DEFINE_CLOCK(uart6_clk1, 0, PCCR1, 26, NULL, NULL, &ipg_clk); |
@@ -666,7 +666,7 @@ static struct clk_lookup lookups[] = { | |||
666 | _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) | 666 | _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk) |
667 | _REGISTER_CLOCK(NULL, "emi", emi_clk) | 667 | _REGISTER_CLOCK(NULL, "emi", emi_clk) |
668 | _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk) | 668 | _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk) |
669 | _REGISTER_CLOCK(NULL, "ata", ata_clk) | 669 | _REGISTER_CLOCK("pata_imx", NULL, pata_clk) |
670 | _REGISTER_CLOCK(NULL, "mstick", mstick_clk) | 670 | _REGISTER_CLOCK(NULL, "mstick", mstick_clk) |
671 | _REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk) | 671 | _REGISTER_CLOCK("imx2-wdt.0", NULL, wdog_clk) |
672 | _REGISTER_CLOCK(NULL, "gpio", gpio_clk) | 672 | _REGISTER_CLOCK(NULL, "gpio", gpio_clk) |
diff --git a/arch/arm/mach-imx/clock-imx31.c b/arch/arm/mach-imx/clock-imx31.c index d973770b1f96..58ea0a857ef4 100644 --- a/arch/arm/mach-imx/clock-imx31.c +++ b/arch/arm/mach-imx/clock-imx31.c | |||
@@ -476,7 +476,7 @@ DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CGR0, 4, NULL, NULL, &perclk_clk); | |||
476 | DEFINE_CLOCK(epit1_clk, 0, MXC_CCM_CGR0, 6, NULL, NULL, &perclk_clk); | 476 | DEFINE_CLOCK(epit1_clk, 0, MXC_CCM_CGR0, 6, NULL, NULL, &perclk_clk); |
477 | DEFINE_CLOCK(epit2_clk, 1, MXC_CCM_CGR0, 8, NULL, NULL, &perclk_clk); | 477 | DEFINE_CLOCK(epit2_clk, 1, MXC_CCM_CGR0, 8, NULL, NULL, &perclk_clk); |
478 | DEFINE_CLOCK(iim_clk, 0, MXC_CCM_CGR0, 10, NULL, NULL, &ipg_clk); | 478 | DEFINE_CLOCK(iim_clk, 0, MXC_CCM_CGR0, 10, NULL, NULL, &ipg_clk); |
479 | DEFINE_CLOCK(ata_clk, 0, MXC_CCM_CGR0, 12, NULL, NULL, &ipg_clk); | 479 | DEFINE_CLOCK(pata_clk, 0, MXC_CCM_CGR0, 12, NULL, NULL, &ipg_clk); |
480 | DEFINE_CLOCK(sdma_clk1, 0, MXC_CCM_CGR0, 14, NULL, NULL, &ahb_clk); | 480 | DEFINE_CLOCK(sdma_clk1, 0, MXC_CCM_CGR0, 14, NULL, NULL, &ahb_clk); |
481 | DEFINE_CLOCK(cspi3_clk, 2, MXC_CCM_CGR0, 16, NULL, NULL, &ipg_clk); | 481 | DEFINE_CLOCK(cspi3_clk, 2, MXC_CCM_CGR0, 16, NULL, NULL, &ipg_clk); |
482 | DEFINE_CLOCK(rng_clk, 0, MXC_CCM_CGR0, 18, NULL, NULL, &ipg_clk); | 482 | DEFINE_CLOCK(rng_clk, 0, MXC_CCM_CGR0, 18, NULL, NULL, &ipg_clk); |
@@ -562,7 +562,7 @@ static struct clk_lookup lookups[] = { | |||
562 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) | 562 | _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk) |
563 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) | 563 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) |
564 | _REGISTER_CLOCK(NULL, "firi", firi_clk) | 564 | _REGISTER_CLOCK(NULL, "firi", firi_clk) |
565 | _REGISTER_CLOCK(NULL, "ata", ata_clk) | 565 | _REGISTER_CLOCK("pata_imx", NULL, pata_clk) |
566 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) | 566 | _REGISTER_CLOCK(NULL, "rtic", rtic_clk) |
567 | _REGISTER_CLOCK(NULL, "rng", rng_clk) | 567 | _REGISTER_CLOCK(NULL, "rng", rng_clk) |
568 | _REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1) | 568 | _REGISTER_CLOCK("imx31-sdma", NULL, sdma_clk1) |
diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c index 88b62a071aea..c39f5c3e20b4 100644 --- a/arch/arm/mach-imx/clock-imx35.c +++ b/arch/arm/mach-imx/clock-imx35.c | |||
@@ -354,7 +354,7 @@ static void clk_cgr_disable(struct clk *clk) | |||
354 | } | 354 | } |
355 | 355 | ||
356 | DEFINE_CLOCK(asrc_clk, 0, CCM_CGR0, 0, NULL, NULL); | 356 | DEFINE_CLOCK(asrc_clk, 0, CCM_CGR0, 0, NULL, NULL); |
357 | DEFINE_CLOCK(ata_clk, 0, CCM_CGR0, 2, get_rate_ipg, NULL); | 357 | DEFINE_CLOCK(pata_clk, 0, CCM_CGR0, 2, get_rate_ipg, NULL); |
358 | /* DEFINE_CLOCK(audmux_clk, 0, CCM_CGR0, 4, NULL, NULL); */ | 358 | /* DEFINE_CLOCK(audmux_clk, 0, CCM_CGR0, 4, NULL, NULL); */ |
359 | DEFINE_CLOCK(can1_clk, 0, CCM_CGR0, 6, get_rate_ipg, NULL); | 359 | DEFINE_CLOCK(can1_clk, 0, CCM_CGR0, 6, get_rate_ipg, NULL); |
360 | DEFINE_CLOCK(can2_clk, 1, CCM_CGR0, 8, get_rate_ipg, NULL); | 360 | DEFINE_CLOCK(can2_clk, 1, CCM_CGR0, 8, get_rate_ipg, NULL); |
@@ -447,7 +447,7 @@ static struct clk nfc_clk = { | |||
447 | 447 | ||
448 | static struct clk_lookup lookups[] = { | 448 | static struct clk_lookup lookups[] = { |
449 | _REGISTER_CLOCK(NULL, "asrc", asrc_clk) | 449 | _REGISTER_CLOCK(NULL, "asrc", asrc_clk) |
450 | _REGISTER_CLOCK(NULL, "ata", ata_clk) | 450 | _REGISTER_CLOCK("pata_imx", NULL, pata_clk) |
451 | _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) | 451 | _REGISTER_CLOCK("flexcan.0", NULL, can1_clk) |
452 | _REGISTER_CLOCK("flexcan.1", NULL, can2_clk) | 452 | _REGISTER_CLOCK("flexcan.1", NULL, can2_clk) |
453 | _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi1_clk) | 453 | _REGISTER_CLOCK("imx35-cspi.0", NULL, cspi1_clk) |
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h index 7f97a3cdd41d..2f727d7c380c 100644 --- a/arch/arm/mach-imx/devices-imx27.h +++ b/arch/arm/mach-imx/devices-imx27.h | |||
@@ -76,3 +76,7 @@ extern const struct imx_spi_imx_data imx27_cspi_data[]; | |||
76 | #define imx27_add_spi_imx0(pdata) imx27_add_cspi(0, pdata) | 76 | #define imx27_add_spi_imx0(pdata) imx27_add_cspi(0, pdata) |
77 | #define imx27_add_spi_imx1(pdata) imx27_add_cspi(1, pdata) | 77 | #define imx27_add_spi_imx1(pdata) imx27_add_cspi(1, pdata) |
78 | #define imx27_add_spi_imx2(pdata) imx27_add_cspi(2, pdata) | 78 | #define imx27_add_spi_imx2(pdata) imx27_add_cspi(2, pdata) |
79 | |||
80 | extern const struct imx_pata_imx_data imx27_pata_imx_data; | ||
81 | #define imx27_add_pata_imx() \ | ||
82 | imx_add_pata_imx(&imx27_pata_imx_data) | ||
diff --git a/arch/arm/mach-imx/devices-imx31.h b/arch/arm/mach-imx/devices-imx31.h index dbe940d9c53a..488e241a6db6 100644 --- a/arch/arm/mach-imx/devices-imx31.h +++ b/arch/arm/mach-imx/devices-imx31.h | |||
@@ -78,3 +78,7 @@ extern const struct imx_spi_imx_data imx31_cspi_data[]; | |||
78 | #define imx31_add_spi_imx0(pdata) imx31_add_cspi(0, pdata) | 78 | #define imx31_add_spi_imx0(pdata) imx31_add_cspi(0, pdata) |
79 | #define imx31_add_spi_imx1(pdata) imx31_add_cspi(1, pdata) | 79 | #define imx31_add_spi_imx1(pdata) imx31_add_cspi(1, pdata) |
80 | #define imx31_add_spi_imx2(pdata) imx31_add_cspi(2, pdata) | 80 | #define imx31_add_spi_imx2(pdata) imx31_add_cspi(2, pdata) |
81 | |||
82 | extern const struct imx_pata_imx_data imx31_pata_imx_data; | ||
83 | #define imx31_add_pata_imx() \ | ||
84 | imx_add_pata_imx(&imx31_pata_imx_data) | ||
diff --git a/arch/arm/mach-imx/devices-imx35.h b/arch/arm/mach-imx/devices-imx35.h index 234cbd3c18af..7b99ef0bb501 100644 --- a/arch/arm/mach-imx/devices-imx35.h +++ b/arch/arm/mach-imx/devices-imx35.h | |||
@@ -81,3 +81,7 @@ extern const struct imx_spi_imx_data imx35_cspi_data[]; | |||
81 | imx_add_spi_imx(&imx35_cspi_data[id], pdata) | 81 | imx_add_spi_imx(&imx35_cspi_data[id], pdata) |
82 | #define imx35_add_spi_imx0(pdata) imx35_add_cspi(0, pdata) | 82 | #define imx35_add_spi_imx0(pdata) imx35_add_cspi(0, pdata) |
83 | #define imx35_add_spi_imx1(pdata) imx35_add_cspi(1, pdata) | 83 | #define imx35_add_spi_imx1(pdata) imx35_add_cspi(1, pdata) |
84 | |||
85 | extern const struct imx_pata_imx_data imx35_pata_imx_data; | ||
86 | #define imx35_add_pata_imx() \ | ||
87 | imx_add_pata_imx(&imx35_pata_imx_data) | ||
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig index b4f5ab669e48..5e42c73881a5 100644 --- a/arch/arm/mach-mx5/Kconfig +++ b/arch/arm/mach-mx5/Kconfig | |||
@@ -153,6 +153,7 @@ config MX51_EFIKA_COMMON | |||
153 | select SOC_IMX51 | 153 | select SOC_IMX51 |
154 | select IMX_HAVE_PLATFORM_IMX_UART | 154 | select IMX_HAVE_PLATFORM_IMX_UART |
155 | select IMX_HAVE_PLATFORM_MXC_EHCI | 155 | select IMX_HAVE_PLATFORM_MXC_EHCI |
156 | select IMX_HAVE_PLATFORM_PATA_IMX | ||
156 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX | 157 | select IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX |
157 | select IMX_HAVE_PLATFORM_SPI_IMX | 158 | select IMX_HAVE_PLATFORM_SPI_IMX |
158 | select MXC_ULPI if USB_ULPI | 159 | select MXC_ULPI if USB_ULPI |
diff --git a/arch/arm/mach-mx5/board-mx53_ard.c b/arch/arm/mach-mx5/board-mx53_ard.c index ddc3015102d5..9d844f102382 100644 --- a/arch/arm/mach-mx5/board-mx53_ard.c +++ b/arch/arm/mach-mx5/board-mx53_ard.c | |||
@@ -234,6 +234,7 @@ static void __init mx53_ard_board_init(void) | |||
234 | imx53_add_imx_i2c(1, &mx53_ard_i2c2_data); | 234 | imx53_add_imx_i2c(1, &mx53_ard_i2c2_data); |
235 | imx53_add_imx_i2c(2, &mx53_ard_i2c3_data); | 235 | imx53_add_imx_i2c(2, &mx53_ard_i2c3_data); |
236 | imx_add_gpio_keys(&ard_button_data); | 236 | imx_add_gpio_keys(&ard_button_data); |
237 | imx53_add_ahci_imx(); | ||
237 | } | 238 | } |
238 | 239 | ||
239 | static void __init mx53_ard_timer_init(void) | 240 | static void __init mx53_ard_timer_init(void) |
diff --git a/arch/arm/mach-mx5/board-mx53_loco.c b/arch/arm/mach-mx5/board-mx53_loco.c index 4e1d51d252dc..940aac932fa3 100644 --- a/arch/arm/mach-mx5/board-mx53_loco.c +++ b/arch/arm/mach-mx5/board-mx53_loco.c | |||
@@ -273,6 +273,7 @@ static void __init mx53_loco_board_init(void) | |||
273 | imx53_add_sdhci_esdhc_imx(2, &mx53_loco_sd3_data); | 273 | imx53_add_sdhci_esdhc_imx(2, &mx53_loco_sd3_data); |
274 | imx_add_gpio_keys(&loco_button_data); | 274 | imx_add_gpio_keys(&loco_button_data); |
275 | gpio_led_register_device(-1, &mx53loco_leds_data); | 275 | gpio_led_register_device(-1, &mx53loco_leds_data); |
276 | imx53_add_ahci_imx(); | ||
276 | } | 277 | } |
277 | 278 | ||
278 | static void __init mx53_loco_timer_init(void) | 279 | static void __init mx53_loco_timer_init(void) |
diff --git a/arch/arm/mach-mx5/board-mx53_smd.c b/arch/arm/mach-mx5/board-mx53_smd.c index bc02894eafef..efcab68840ae 100644 --- a/arch/arm/mach-mx5/board-mx53_smd.c +++ b/arch/arm/mach-mx5/board-mx53_smd.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include "devices-imx53.h" | 35 | #include "devices-imx53.h" |
36 | 36 | ||
37 | #define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6) | 37 | #define SMD_FEC_PHY_RST IMX_GPIO_NR(7, 6) |
38 | #define MX53_SMD_SATA_PWR_EN IMX_GPIO_NR(3, 3) | ||
38 | 39 | ||
39 | static iomux_v3_cfg_t mx53_smd_pads[] = { | 40 | static iomux_v3_cfg_t mx53_smd_pads[] = { |
40 | MX53_PAD_CSI0_DAT10__UART1_TXD_MUX, | 41 | MX53_PAD_CSI0_DAT10__UART1_TXD_MUX, |
@@ -111,6 +112,19 @@ static const struct imxi2c_platform_data mx53_smd_i2c_data __initconst = { | |||
111 | .bitrate = 100000, | 112 | .bitrate = 100000, |
112 | }; | 113 | }; |
113 | 114 | ||
115 | static inline void mx53_smd_ahci_pwr_on(void) | ||
116 | { | ||
117 | int ret; | ||
118 | |||
119 | /* Enable SATA PWR */ | ||
120 | ret = gpio_request_one(MX53_SMD_SATA_PWR_EN, | ||
121 | GPIOF_DIR_OUT | GPIOF_INIT_HIGH, "ahci-sata-pwr"); | ||
122 | if (ret) { | ||
123 | pr_err("failed to enable SATA_PWR_EN: %d\n", ret); | ||
124 | return; | ||
125 | } | ||
126 | } | ||
127 | |||
114 | static void __init mx53_smd_board_init(void) | 128 | static void __init mx53_smd_board_init(void) |
115 | { | 129 | { |
116 | imx53_soc_init(); | 130 | imx53_soc_init(); |
@@ -125,6 +139,8 @@ static void __init mx53_smd_board_init(void) | |||
125 | imx53_add_sdhci_esdhc_imx(0, NULL); | 139 | imx53_add_sdhci_esdhc_imx(0, NULL); |
126 | imx53_add_sdhci_esdhc_imx(1, NULL); | 140 | imx53_add_sdhci_esdhc_imx(1, NULL); |
127 | imx53_add_sdhci_esdhc_imx(2, NULL); | 141 | imx53_add_sdhci_esdhc_imx(2, NULL); |
142 | mx53_smd_ahci_pwr_on(); | ||
143 | imx53_add_ahci_imx(); | ||
128 | } | 144 | } |
129 | 145 | ||
130 | static void __init mx53_smd_timer_init(void) | 146 | static void __init mx53_smd_timer_init(void) |
diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c index a3db3557b7c9..c2dafe406304 100644 --- a/arch/arm/mach-mx5/clock-mx51-mx53.c +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c | |||
@@ -1401,6 +1401,22 @@ static struct clk esdhc4_mx53_clk = { | |||
1401 | .secondary = &esdhc4_ipg_clk, | 1401 | .secondary = &esdhc4_ipg_clk, |
1402 | }; | 1402 | }; |
1403 | 1403 | ||
1404 | static struct clk sata_clk = { | ||
1405 | .parent = &ipg_clk, | ||
1406 | .enable = _clk_max_enable, | ||
1407 | .enable_reg = MXC_CCM_CCGR4, | ||
1408 | .enable_shift = MXC_CCM_CCGRx_CG1_OFFSET, | ||
1409 | .disable = _clk_max_disable, | ||
1410 | }; | ||
1411 | |||
1412 | static struct clk ahci_phy_clk = { | ||
1413 | .parent = &usb_phy1_clk, | ||
1414 | }; | ||
1415 | |||
1416 | static struct clk ahci_dma_clk = { | ||
1417 | .parent = &ahb_clk, | ||
1418 | }; | ||
1419 | |||
1404 | DEFINE_CLOCK(mipi_esc_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG5_OFFSET, NULL, NULL, NULL, &pll2_sw_clk); | 1420 | DEFINE_CLOCK(mipi_esc_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG5_OFFSET, NULL, NULL, NULL, &pll2_sw_clk); |
1405 | DEFINE_CLOCK(mipi_hsc2_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG4_OFFSET, NULL, NULL, &mipi_esc_clk, &pll2_sw_clk); | 1421 | DEFINE_CLOCK(mipi_hsc2_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG4_OFFSET, NULL, NULL, &mipi_esc_clk, &pll2_sw_clk); |
1406 | DEFINE_CLOCK(mipi_hsc1_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG3_OFFSET, NULL, NULL, &mipi_hsc2_clk, &pll2_sw_clk); | 1422 | DEFINE_CLOCK(mipi_hsc1_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG3_OFFSET, NULL, NULL, &mipi_hsc2_clk, &pll2_sw_clk); |
@@ -1418,6 +1434,10 @@ DEFINE_CLOCK(ipu_di0_clk, 0, MXC_CCM_CCGR6, MXC_CCM_CCGRx_CG5_OFFSET, | |||
1418 | DEFINE_CLOCK(ipu_di1_clk, 0, MXC_CCM_CCGR6, MXC_CCM_CCGRx_CG6_OFFSET, | 1434 | DEFINE_CLOCK(ipu_di1_clk, 0, MXC_CCM_CCGR6, MXC_CCM_CCGRx_CG6_OFFSET, |
1419 | NULL, NULL, &pll3_sw_clk, NULL); | 1435 | NULL, NULL, &pll3_sw_clk, NULL); |
1420 | 1436 | ||
1437 | /* PATA */ | ||
1438 | DEFINE_CLOCK(pata_clk, 0, MXC_CCM_CCGR4, MXC_CCM_CCGRx_CG0_OFFSET, | ||
1439 | NULL, NULL, &ipg_clk, &spba_clk); | ||
1440 | |||
1421 | #define _REGISTER_CLOCK(d, n, c) \ | 1441 | #define _REGISTER_CLOCK(d, n, c) \ |
1422 | { \ | 1442 | { \ |
1423 | .dev_id = d, \ | 1443 | .dev_id = d, \ |
@@ -1474,6 +1494,7 @@ static struct clk_lookup mx51_lookups[] = { | |||
1474 | _REGISTER_CLOCK("imx-ipuv3", "di0", ipu_di0_clk) | 1494 | _REGISTER_CLOCK("imx-ipuv3", "di0", ipu_di0_clk) |
1475 | _REGISTER_CLOCK("imx-ipuv3", "di1", ipu_di1_clk) | 1495 | _REGISTER_CLOCK("imx-ipuv3", "di1", ipu_di1_clk) |
1476 | _REGISTER_CLOCK(NULL, "gpc_dvfs", gpc_dvfs_clk) | 1496 | _REGISTER_CLOCK(NULL, "gpc_dvfs", gpc_dvfs_clk) |
1497 | _REGISTER_CLOCK("pata_imx", NULL, pata_clk) | ||
1477 | }; | 1498 | }; |
1478 | 1499 | ||
1479 | static struct clk_lookup mx53_lookups[] = { | 1500 | static struct clk_lookup mx53_lookups[] = { |
@@ -1507,6 +1528,10 @@ static struct clk_lookup mx53_lookups[] = { | |||
1507 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) | 1528 | _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk) |
1508 | _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk) | 1529 | _REGISTER_CLOCK("imx-ssi.2", NULL, ssi3_clk) |
1509 | _REGISTER_CLOCK("imx-keypad", NULL, dummy_clk) | 1530 | _REGISTER_CLOCK("imx-keypad", NULL, dummy_clk) |
1531 | _REGISTER_CLOCK("pata_imx", NULL, pata_clk) | ||
1532 | _REGISTER_CLOCK("imx53-ahci.0", "ahci", sata_clk) | ||
1533 | _REGISTER_CLOCK("imx53-ahci.0", "ahci_phy", ahci_phy_clk) | ||
1534 | _REGISTER_CLOCK("imx53-ahci.0", "ahci_dma", ahci_dma_clk) | ||
1510 | }; | 1535 | }; |
1511 | 1536 | ||
1512 | static void clk_tree_init(void) | 1537 | static void clk_tree_init(void) |
diff --git a/arch/arm/mach-mx5/devices-imx51.h b/arch/arm/mach-mx5/devices-imx51.h index f311c9616bb1..af488bc0e225 100644 --- a/arch/arm/mach-mx5/devices-imx51.h +++ b/arch/arm/mach-mx5/devices-imx51.h | |||
@@ -65,3 +65,7 @@ extern const struct imx_mxc_pwm_data imx51_mxc_pwm_data[]; | |||
65 | extern const struct imx_imx_keypad_data imx51_imx_keypad_data; | 65 | extern const struct imx_imx_keypad_data imx51_imx_keypad_data; |
66 | #define imx51_add_imx_keypad(pdata) \ | 66 | #define imx51_add_imx_keypad(pdata) \ |
67 | imx_add_imx_keypad(&imx51_imx_keypad_data, pdata) | 67 | imx_add_imx_keypad(&imx51_imx_keypad_data, pdata) |
68 | |||
69 | extern const struct imx_pata_imx_data imx51_pata_imx_data; | ||
70 | #define imx51_add_pata_imx() \ | ||
71 | imx_add_pata_imx(&imx51_pata_imx_data) | ||
diff --git a/arch/arm/mach-mx5/devices-imx53.h b/arch/arm/mach-mx5/devices-imx53.h index c27fe8bb4762..7fe5e462fdca 100644 --- a/arch/arm/mach-mx5/devices-imx53.h +++ b/arch/arm/mach-mx5/devices-imx53.h | |||
@@ -40,3 +40,8 @@ extern const struct imx_imx_ssi_data imx53_imx_ssi_data[]; | |||
40 | extern const struct imx_imx_keypad_data imx53_imx_keypad_data; | 40 | extern const struct imx_imx_keypad_data imx53_imx_keypad_data; |
41 | #define imx53_add_imx_keypad(pdata) \ | 41 | #define imx53_add_imx_keypad(pdata) \ |
42 | imx_add_imx_keypad(&imx53_imx_keypad_data, pdata) | 42 | imx_add_imx_keypad(&imx53_imx_keypad_data, pdata) |
43 | |||
44 | extern const struct imx_pata_imx_data imx53_pata_imx_data; | ||
45 | #define imx53_add_pata_imx() \ | ||
46 | imx_add_pata_imx(&imx53_pata_imx_data) | ||
47 | extern struct platform_device *__init imx53_add_ahci_imx(void); | ||
diff --git a/arch/arm/mach-mx5/mx51_efika.c b/arch/arm/mach-mx5/mx51_efika.c index d5bf95825533..83c57027de75 100644 --- a/arch/arm/mach-mx5/mx51_efika.c +++ b/arch/arm/mach-mx5/mx51_efika.c | |||
@@ -625,6 +625,8 @@ void __init efika_board_common_init(void) | |||
625 | ARRAY_SIZE(mx51_efika_spi_board_info)); | 625 | ARRAY_SIZE(mx51_efika_spi_board_info)); |
626 | imx51_add_ecspi(0, &mx51_efika_spi_pdata); | 626 | imx51_add_ecspi(0, &mx51_efika_spi_pdata); |
627 | 627 | ||
628 | imx51_add_pata_imx(); | ||
629 | |||
628 | #if defined(CONFIG_CPU_FREQ_IMX) | 630 | #if defined(CONFIG_CPU_FREQ_IMX) |
629 | get_cpu_op = mx51_get_cpu_op; | 631 | get_cpu_op = mx51_get_cpu_op; |
630 | #endif | 632 | #endif |
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig index 39b08957e8ad..cb3e3eef55c0 100644 --- a/arch/arm/plat-mxc/devices/Kconfig +++ b/arch/arm/plat-mxc/devices/Kconfig | |||
@@ -31,6 +31,9 @@ config IMX_HAVE_PLATFORM_IMX_I2C | |||
31 | config IMX_HAVE_PLATFORM_IMX_KEYPAD | 31 | config IMX_HAVE_PLATFORM_IMX_KEYPAD |
32 | bool | 32 | bool |
33 | 33 | ||
34 | config IMX_HAVE_PLATFORM_PATA_IMX | ||
35 | bool | ||
36 | |||
34 | config IMX_HAVE_PLATFORM_IMX_SSI | 37 | config IMX_HAVE_PLATFORM_IMX_SSI |
35 | bool | 38 | bool |
36 | 39 | ||
@@ -76,3 +79,7 @@ config IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX | |||
76 | 79 | ||
77 | config IMX_HAVE_PLATFORM_SPI_IMX | 80 | config IMX_HAVE_PLATFORM_SPI_IMX |
78 | bool | 81 | bool |
82 | |||
83 | config IMX_HAVE_PLATFORM_AHCI | ||
84 | bool | ||
85 | default y if ARCH_MX53 | ||
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile index b41bf972b54b..c11ac8472beb 100644 --- a/arch/arm/plat-mxc/devices/Makefile +++ b/arch/arm/plat-mxc/devices/Makefile | |||
@@ -10,6 +10,7 @@ obj-y += platform-imx-dma.o | |||
10 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o | 10 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_FB) += platform-imx-fb.o |
11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o | 11 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o |
12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o | 12 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_KEYPAD) += platform-imx-keypad.o |
13 | obj-$(CONFIG_IMX_HAVE_PLATFORM_PATA_IMX) += platform-pata_imx.o | ||
13 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o | 14 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_SSI) += platform-imx-ssi.o |
14 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o | 15 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o |
15 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o | 16 | obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UDC) += platform-imx_udc.o |
@@ -25,3 +26,4 @@ obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_RTC) += platform-mxc_rtc.o | |||
25 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o | 26 | obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_W1) += platform-mxc_w1.o |
26 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o | 27 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SDHCI_ESDHC_IMX) += platform-sdhci-esdhc-imx.o |
27 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o | 28 | obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o |
29 | obj-$(CONFIG_IMX_HAVE_PLATFORM_AHCI) += platform-ahci-imx.o | ||
diff --git a/arch/arm/plat-mxc/devices/platform-ahci-imx.c b/arch/arm/plat-mxc/devices/platform-ahci-imx.c new file mode 100644 index 000000000000..d8a56aee521b --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-ahci-imx.c | |||
@@ -0,0 +1,156 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2011 Freescale Semiconductor, Inc. All Rights Reserved. | ||
3 | */ | ||
4 | |||
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 as published by | ||
8 | * the Free Software Foundation; either version 2 of the License, or | ||
9 | * (at your option) any later version. | ||
10 | |||
11 | * This program is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | * GNU General Public License for more details. | ||
15 | |||
16 | * You should have received a copy of the GNU General Public License along | ||
17 | * with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | */ | ||
20 | |||
21 | #include <linux/io.h> | ||
22 | #include <linux/clk.h> | ||
23 | #include <linux/err.h> | ||
24 | #include <linux/device.h> | ||
25 | #include <linux/dma-mapping.h> | ||
26 | #include <asm/sizes.h> | ||
27 | #include <mach/hardware.h> | ||
28 | #include <mach/devices-common.h> | ||
29 | |||
30 | #define imx_ahci_imx_data_entry_single(soc, _devid) \ | ||
31 | { \ | ||
32 | .devid = _devid, \ | ||
33 | .iobase = soc ## _SATA_BASE_ADDR, \ | ||
34 | .irq = soc ## _INT_SATA, \ | ||
35 | } | ||
36 | |||
37 | #ifdef CONFIG_SOC_IMX53 | ||
38 | const struct imx_ahci_imx_data imx53_ahci_imx_data __initconst = | ||
39 | imx_ahci_imx_data_entry_single(MX53, "imx53-ahci"); | ||
40 | #endif | ||
41 | |||
42 | enum { | ||
43 | HOST_CAP = 0x00, | ||
44 | HOST_CAP_SSS = (1 << 27), /* Staggered Spin-up */ | ||
45 | HOST_PORTS_IMPL = 0x0c, | ||
46 | HOST_TIMER1MS = 0xe0, /* Timer 1-ms */ | ||
47 | }; | ||
48 | |||
49 | static struct clk *sata_clk, *sata_ref_clk; | ||
50 | |||
51 | /* AHCI module Initialization, if return 0, initialization is successful. */ | ||
52 | static int imx_sata_init(struct device *dev, void __iomem *addr) | ||
53 | { | ||
54 | u32 tmpdata; | ||
55 | int ret = 0; | ||
56 | struct clk *clk; | ||
57 | |||
58 | sata_clk = clk_get(dev, "ahci"); | ||
59 | if (IS_ERR(sata_clk)) { | ||
60 | dev_err(dev, "no sata clock.\n"); | ||
61 | return PTR_ERR(sata_clk); | ||
62 | } | ||
63 | ret = clk_enable(sata_clk); | ||
64 | if (ret) { | ||
65 | dev_err(dev, "can't enable sata clock.\n"); | ||
66 | goto put_sata_clk; | ||
67 | } | ||
68 | |||
69 | /* Get the AHCI SATA PHY CLK */ | ||
70 | sata_ref_clk = clk_get(dev, "ahci_phy"); | ||
71 | if (IS_ERR(sata_ref_clk)) { | ||
72 | dev_err(dev, "no sata ref clock.\n"); | ||
73 | ret = PTR_ERR(sata_ref_clk); | ||
74 | goto release_sata_clk; | ||
75 | } | ||
76 | ret = clk_enable(sata_ref_clk); | ||
77 | if (ret) { | ||
78 | dev_err(dev, "can't enable sata ref clock.\n"); | ||
79 | goto put_sata_ref_clk; | ||
80 | } | ||
81 | |||
82 | /* Get the AHB clock rate, and configure the TIMER1MS reg later */ | ||
83 | clk = clk_get(dev, "ahci_dma"); | ||
84 | if (IS_ERR(clk)) { | ||
85 | dev_err(dev, "no dma clock.\n"); | ||
86 | ret = PTR_ERR(clk); | ||
87 | goto release_sata_ref_clk; | ||
88 | } | ||
89 | tmpdata = clk_get_rate(clk) / 1000; | ||
90 | clk_put(clk); | ||
91 | |||
92 | writel(tmpdata, addr + HOST_TIMER1MS); | ||
93 | |||
94 | tmpdata = readl(addr + HOST_CAP); | ||
95 | if (!(tmpdata & HOST_CAP_SSS)) { | ||
96 | tmpdata |= HOST_CAP_SSS; | ||
97 | writel(tmpdata, addr + HOST_CAP); | ||
98 | } | ||
99 | |||
100 | if (!(readl(addr + HOST_PORTS_IMPL) & 0x1)) | ||
101 | writel((readl(addr + HOST_PORTS_IMPL) | 0x1), | ||
102 | addr + HOST_PORTS_IMPL); | ||
103 | |||
104 | return 0; | ||
105 | |||
106 | release_sata_ref_clk: | ||
107 | clk_disable(sata_ref_clk); | ||
108 | put_sata_ref_clk: | ||
109 | clk_put(sata_ref_clk); | ||
110 | release_sata_clk: | ||
111 | clk_disable(sata_clk); | ||
112 | put_sata_clk: | ||
113 | clk_put(sata_clk); | ||
114 | |||
115 | return ret; | ||
116 | } | ||
117 | |||
118 | static void imx_sata_exit(struct device *dev) | ||
119 | { | ||
120 | clk_disable(sata_ref_clk); | ||
121 | clk_put(sata_ref_clk); | ||
122 | |||
123 | clk_disable(sata_clk); | ||
124 | clk_put(sata_clk); | ||
125 | |||
126 | } | ||
127 | struct platform_device *__init imx_add_ahci_imx( | ||
128 | const struct imx_ahci_imx_data *data, | ||
129 | const struct ahci_platform_data *pdata) | ||
130 | { | ||
131 | struct resource res[] = { | ||
132 | { | ||
133 | .start = data->iobase, | ||
134 | .end = data->iobase + SZ_4K - 1, | ||
135 | .flags = IORESOURCE_MEM, | ||
136 | }, { | ||
137 | .start = data->irq, | ||
138 | .end = data->irq, | ||
139 | .flags = IORESOURCE_IRQ, | ||
140 | }, | ||
141 | }; | ||
142 | |||
143 | return imx_add_platform_device_dmamask(data->devid, 0, | ||
144 | res, ARRAY_SIZE(res), | ||
145 | pdata, sizeof(*pdata), DMA_BIT_MASK(32)); | ||
146 | } | ||
147 | |||
148 | struct platform_device *__init imx53_add_ahci_imx(void) | ||
149 | { | ||
150 | struct ahci_platform_data pdata = { | ||
151 | .init = imx_sata_init, | ||
152 | .exit = imx_sata_exit, | ||
153 | }; | ||
154 | |||
155 | return imx_add_ahci_imx(&imx53_ahci_imx_data, &pdata); | ||
156 | } | ||
diff --git a/arch/arm/plat-mxc/devices/platform-pata_imx.c b/arch/arm/plat-mxc/devices/platform-pata_imx.c new file mode 100644 index 000000000000..70e2f2a44714 --- /dev/null +++ b/arch/arm/plat-mxc/devices/platform-pata_imx.c | |||
@@ -0,0 +1,59 @@ | |||
1 | /* | ||
2 | * This program is free software; you can redistribute it and/or modify it under | ||
3 | * the terms of the GNU General Public License version 2 as published by the | ||
4 | * Free Software Foundation. | ||
5 | */ | ||
6 | #include <mach/hardware.h> | ||
7 | #include <mach/devices-common.h> | ||
8 | |||
9 | #define imx_pata_imx_data_entry_single(soc, _size) \ | ||
10 | { \ | ||
11 | .iobase = soc ## _ATA_BASE_ADDR, \ | ||
12 | .iosize = _size, \ | ||
13 | .irq = soc ## _INT_ATA, \ | ||
14 | } | ||
15 | |||
16 | #ifdef CONFIG_SOC_IMX27 | ||
17 | const struct imx_pata_imx_data imx27_pata_imx_data __initconst = | ||
18 | imx_pata_imx_data_entry_single(MX27, SZ_4K); | ||
19 | #endif /* ifdef CONFIG_SOC_IMX27 */ | ||
20 | |||
21 | #ifdef CONFIG_SOC_IMX31 | ||
22 | const struct imx_pata_imx_data imx31_pata_imx_data __initconst = | ||
23 | imx_pata_imx_data_entry_single(MX31, SZ_16K); | ||
24 | #endif /* ifdef CONFIG_SOC_IMX31 */ | ||
25 | |||
26 | #ifdef CONFIG_SOC_IMX35 | ||
27 | const struct imx_pata_imx_data imx35_pata_imx_data __initconst = | ||
28 | imx_pata_imx_data_entry_single(MX35, SZ_16K); | ||
29 | #endif /* ifdef CONFIG_SOC_IMX35 */ | ||
30 | |||
31 | #ifdef CONFIG_SOC_IMX51 | ||
32 | const struct imx_pata_imx_data imx51_pata_imx_data __initconst = | ||
33 | imx_pata_imx_data_entry_single(MX51, SZ_16K); | ||
34 | #endif /* ifdef CONFIG_SOC_IMX51 */ | ||
35 | |||
36 | #ifdef CONFIG_SOC_IMX53 | ||
37 | const struct imx_pata_imx_data imx53_pata_imx_data __initconst = | ||
38 | imx_pata_imx_data_entry_single(MX53, SZ_16K); | ||
39 | #endif /* ifdef CONFIG_SOC_IMX53 */ | ||
40 | |||
41 | struct platform_device *__init imx_add_pata_imx( | ||
42 | const struct imx_pata_imx_data *data) | ||
43 | { | ||
44 | struct resource res[] = { | ||
45 | { | ||
46 | .start = data->iobase, | ||
47 | .end = data->iobase + data->iosize - 1, | ||
48 | .flags = IORESOURCE_MEM, | ||
49 | }, | ||
50 | { | ||
51 | .start = data->irq, | ||
52 | .end = data->irq, | ||
53 | .flags = IORESOURCE_IRQ, | ||
54 | }, | ||
55 | }; | ||
56 | return imx_add_platform_device("pata_imx", -1, | ||
57 | res, ARRAY_SIZE(res), NULL, 0); | ||
58 | } | ||
59 | |||
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h index 543525d76a60..def9ba53e23a 100644 --- a/arch/arm/plat-mxc/include/mach/devices-common.h +++ b/arch/arm/plat-mxc/include/mach/devices-common.h | |||
@@ -263,6 +263,14 @@ struct platform_device *__init imx_add_mxc_nand( | |||
263 | const struct imx_mxc_nand_data *data, | 263 | const struct imx_mxc_nand_data *data, |
264 | const struct mxc_nand_platform_data *pdata); | 264 | const struct mxc_nand_platform_data *pdata); |
265 | 265 | ||
266 | struct imx_pata_imx_data { | ||
267 | resource_size_t iobase; | ||
268 | resource_size_t iosize; | ||
269 | resource_size_t irq; | ||
270 | }; | ||
271 | struct platform_device *__init imx_add_pata_imx( | ||
272 | const struct imx_pata_imx_data *data); | ||
273 | |||
266 | struct imx_mxc_pwm_data { | 274 | struct imx_mxc_pwm_data { |
267 | int id; | 275 | int id; |
268 | resource_size_t iobase; | 276 | resource_size_t iobase; |
@@ -313,3 +321,13 @@ struct platform_device *__init imx_add_spi_imx( | |||
313 | struct platform_device *imx_add_imx_dma(void); | 321 | struct platform_device *imx_add_imx_dma(void); |
314 | struct platform_device *imx_add_imx_sdma(char *name, | 322 | struct platform_device *imx_add_imx_sdma(char *name, |
315 | resource_size_t iobase, int irq, struct sdma_platform_data *pdata); | 323 | resource_size_t iobase, int irq, struct sdma_platform_data *pdata); |
324 | |||
325 | #include <linux/ahci_platform.h> | ||
326 | struct imx_ahci_imx_data { | ||
327 | const char *devid; | ||
328 | resource_size_t iobase; | ||
329 | resource_size_t irq; | ||
330 | }; | ||
331 | struct platform_device *__init imx_add_ahci_imx( | ||
332 | const struct imx_ahci_imx_data *data, | ||
333 | const struct ahci_platform_data *pdata); | ||
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h index d13dbfeef08a..80965a99aa55 100644 --- a/arch/arm/plat-mxc/include/mach/mx35.h +++ b/arch/arm/plat-mxc/include/mach/mx35.h | |||
@@ -36,7 +36,7 @@ | |||
36 | #define MX35_UART3_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x0c000) | 36 | #define MX35_UART3_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x0c000) |
37 | #define MX35_CSPI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x10000) | 37 | #define MX35_CSPI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x10000) |
38 | #define MX35_SSI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x14000) | 38 | #define MX35_SSI2_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x14000) |
39 | #define MX35_ATA_DMA_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x20000) | 39 | #define MX35_ATA_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x20000) |
40 | #define MX35_MSHC1_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x24000) | 40 | #define MX35_MSHC1_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x24000) |
41 | #define MX35_FEC_BASE_ADDR 0x50038000 | 41 | #define MX35_FEC_BASE_ADDR 0x50038000 |
42 | #define MX35_SPBA_CTRL_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x3c000) | 42 | #define MX35_SPBA_CTRL_BASE_ADDR (MX35_SPBA0_BASE_ADDR + 0x3c000) |
diff --git a/drivers/char/hw_random/Kconfig b/drivers/char/hw_random/Kconfig index 1d2ebc7a4947..e0135873ba9d 100644 --- a/drivers/char/hw_random/Kconfig +++ b/drivers/char/hw_random/Kconfig | |||
@@ -60,6 +60,19 @@ config HW_RANDOM_AMD | |||
60 | 60 | ||
61 | If unsure, say Y. | 61 | If unsure, say Y. |
62 | 62 | ||
63 | config HW_RANDOM_ATMEL | ||
64 | tristate "Atmel Random Number Generator support" | ||
65 | depends on HW_RANDOM && ARCH_AT91SAM9G45 | ||
66 | default HW_RANDOM | ||
67 | ---help--- | ||
68 | This driver provides kernel-side support for the Random Number | ||
69 | Generator hardware found on Atmel AT91 devices. | ||
70 | |||
71 | To compile this driver as a module, choose M here: the | ||
72 | module will be called atmel-rng. | ||
73 | |||
74 | If unsure, say Y. | ||
75 | |||
63 | config HW_RANDOM_GEODE | 76 | config HW_RANDOM_GEODE |
64 | tristate "AMD Geode HW Random Number Generator support" | 77 | tristate "AMD Geode HW Random Number Generator support" |
65 | depends on HW_RANDOM && X86_32 && PCI | 78 | depends on HW_RANDOM && X86_32 && PCI |
diff --git a/drivers/char/hw_random/Makefile b/drivers/char/hw_random/Makefile index c88f244c8a71..b2ff5265a996 100644 --- a/drivers/char/hw_random/Makefile +++ b/drivers/char/hw_random/Makefile | |||
@@ -7,6 +7,7 @@ rng-core-y := core.o | |||
7 | obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o | 7 | obj-$(CONFIG_HW_RANDOM_TIMERIOMEM) += timeriomem-rng.o |
8 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o | 8 | obj-$(CONFIG_HW_RANDOM_INTEL) += intel-rng.o |
9 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o | 9 | obj-$(CONFIG_HW_RANDOM_AMD) += amd-rng.o |
10 | obj-$(CONFIG_HW_RANDOM_ATMEL) += atmel-rng.o | ||
10 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o | 11 | obj-$(CONFIG_HW_RANDOM_GEODE) += geode-rng.o |
11 | obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o | 12 | obj-$(CONFIG_HW_RANDOM_N2RNG) += n2-rng.o |
12 | n2-rng-y := n2-drv.o n2-asm.o | 13 | n2-rng-y := n2-drv.o n2-asm.o |
diff --git a/drivers/char/hw_random/atmel-rng.c b/drivers/char/hw_random/atmel-rng.c new file mode 100644 index 000000000000..241df2e76aba --- /dev/null +++ b/drivers/char/hw_random/atmel-rng.c | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2011 Peter Korsgaard <jacmet@sunsite.dk> | ||
3 | * | ||
4 | * This file is licensed under the terms of the GNU General Public | ||
5 | * License version 2. This program is licensed "as is" without any | ||
6 | * warranty of any kind, whether express or implied. | ||
7 | */ | ||
8 | |||
9 | #include <linux/kernel.h> | ||
10 | #include <linux/module.h> | ||
11 | #include <linux/slab.h> | ||
12 | #include <linux/err.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/io.h> | ||
15 | #include <linux/hw_random.h> | ||
16 | #include <linux/platform_device.h> | ||
17 | |||
18 | #define TRNG_CR 0x00 | ||
19 | #define TRNG_ISR 0x1c | ||
20 | #define TRNG_ODATA 0x50 | ||
21 | |||
22 | #define TRNG_KEY 0x524e4700 /* RNG */ | ||
23 | |||
24 | struct atmel_trng { | ||
25 | struct clk *clk; | ||
26 | void __iomem *base; | ||
27 | struct hwrng rng; | ||
28 | }; | ||
29 | |||
30 | static int atmel_trng_read(struct hwrng *rng, void *buf, size_t max, | ||
31 | bool wait) | ||
32 | { | ||
33 | struct atmel_trng *trng = container_of(rng, struct atmel_trng, rng); | ||
34 | u32 *data = buf; | ||
35 | |||
36 | /* data ready? */ | ||
37 | if (readl(trng->base + TRNG_ODATA) & 1) { | ||
38 | *data = readl(trng->base + TRNG_ODATA); | ||
39 | return 4; | ||
40 | } else | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | static int atmel_trng_probe(struct platform_device *pdev) | ||
45 | { | ||
46 | struct atmel_trng *trng; | ||
47 | struct resource *res; | ||
48 | int ret; | ||
49 | |||
50 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
51 | if (!res) | ||
52 | return -EINVAL; | ||
53 | |||
54 | trng = devm_kzalloc(&pdev->dev, sizeof(*trng), GFP_KERNEL); | ||
55 | if (!trng) | ||
56 | return -ENOMEM; | ||
57 | |||
58 | if (!devm_request_mem_region(&pdev->dev, res->start, | ||
59 | resource_size(res), pdev->name)) | ||
60 | return -EBUSY; | ||
61 | |||
62 | trng->base = devm_ioremap(&pdev->dev, res->start, resource_size(res)); | ||
63 | if (!trng->base) | ||
64 | return -EBUSY; | ||
65 | |||
66 | trng->clk = clk_get(&pdev->dev, NULL); | ||
67 | if (IS_ERR(trng->clk)) | ||
68 | return PTR_ERR(trng->clk); | ||
69 | |||
70 | ret = clk_enable(trng->clk); | ||
71 | if (ret) | ||
72 | goto err_enable; | ||
73 | |||
74 | writel(TRNG_KEY | 1, trng->base + TRNG_CR); | ||
75 | trng->rng.name = pdev->name; | ||
76 | trng->rng.read = atmel_trng_read; | ||
77 | |||
78 | ret = hwrng_register(&trng->rng); | ||
79 | if (ret) | ||
80 | goto err_register; | ||
81 | |||
82 | platform_set_drvdata(pdev, trng); | ||
83 | |||
84 | return 0; | ||
85 | |||
86 | err_register: | ||
87 | clk_disable(trng->clk); | ||
88 | err_enable: | ||
89 | clk_put(trng->clk); | ||
90 | |||
91 | return ret; | ||
92 | } | ||
93 | |||
94 | static int __devexit atmel_trng_remove(struct platform_device *pdev) | ||
95 | { | ||
96 | struct atmel_trng *trng = platform_get_drvdata(pdev); | ||
97 | |||
98 | hwrng_unregister(&trng->rng); | ||
99 | |||
100 | writel(TRNG_KEY, trng->base + TRNG_CR); | ||
101 | clk_disable(trng->clk); | ||
102 | clk_put(trng->clk); | ||
103 | |||
104 | platform_set_drvdata(pdev, NULL); | ||
105 | |||
106 | return 0; | ||
107 | } | ||
108 | |||
109 | #ifdef CONFIG_PM | ||
110 | static int atmel_trng_suspend(struct device *dev) | ||
111 | { | ||
112 | struct atmel_trng *trng = dev_get_drvdata(dev); | ||
113 | |||
114 | clk_disable(trng->clk); | ||
115 | |||
116 | return 0; | ||
117 | } | ||
118 | |||
119 | static int atmel_trng_resume(struct device *dev) | ||
120 | { | ||
121 | struct atmel_trng *trng = dev_get_drvdata(dev); | ||
122 | |||
123 | return clk_enable(trng->clk); | ||
124 | } | ||
125 | |||
126 | static const struct dev_pm_ops atmel_trng_pm_ops = { | ||
127 | .suspend = atmel_trng_suspend, | ||
128 | .resume = atmel_trng_resume, | ||
129 | }; | ||
130 | #endif /* CONFIG_PM */ | ||
131 | |||
132 | static struct platform_driver atmel_trng_driver = { | ||
133 | .probe = atmel_trng_probe, | ||
134 | .remove = __devexit_p(atmel_trng_remove), | ||
135 | .driver = { | ||
136 | .name = "atmel-trng", | ||
137 | .owner = THIS_MODULE, | ||
138 | #ifdef CONFIG_PM | ||
139 | .pm = &atmel_trng_pm_ops, | ||
140 | #endif /* CONFIG_PM */ | ||
141 | }, | ||
142 | }; | ||
143 | |||
144 | static int __init atmel_trng_init(void) | ||
145 | { | ||
146 | return platform_driver_register(&atmel_trng_driver); | ||
147 | } | ||
148 | module_init(atmel_trng_init); | ||
149 | |||
150 | static void __exit atmel_trng_exit(void) | ||
151 | { | ||
152 | platform_driver_unregister(&atmel_trng_driver); | ||
153 | } | ||
154 | module_exit(atmel_trng_exit); | ||
155 | |||
156 | MODULE_LICENSE("GPL"); | ||
157 | MODULE_AUTHOR("Peter Korsgaard <jacmet@sunsite.dk>"); | ||
158 | MODULE_DESCRIPTION("Atmel true random number generator driver"); | ||