Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: at91: at91sam9g45: add trng clock and platform device

For the new hw_random driver.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>

authored by

Peter Korsgaard and committed by
Nicolas Ferre
237a62a1 976d1676

+36
+7
arch/arm/mach-at91/at91sam9g45.c
··· 53 53 .pmc_mask = 1 << AT91SAM9G45_ID_PIODE, 54 54 .type = CLK_TYPE_PERIPHERAL, 55 55 }; 56 + static struct clk trng_clk = { 57 + .name = "trng_clk", 58 + .pmc_mask = 1 << AT91SAM9G45_ID_TRNG, 59 + .type = CLK_TYPE_PERIPHERAL, 60 + }; 56 61 static struct clk usart0_clk = { 57 62 .name = "usart0_clk", 58 63 .pmc_mask = 1 << AT91SAM9G45_ID_US0, ··· 181 176 &pioB_clk, 182 177 &pioC_clk, 183 178 &pioDE_clk, 179 + &trng_clk, 184 180 &usart0_clk, 185 181 &usart1_clk, 186 182 &usart2_clk, ··· 221 215 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk), 222 216 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 223 217 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 218 + CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk), 224 219 }; 225 220 226 221 static struct clk_lookup usart_clocks_lookups[] = {
+29
arch/arm/mach-at91/at91sam9g45_devices.c
··· 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 1126 * Watchdog 1099 1127 * -------------------------------------------------------------------- */ 1100 1128 ··· 1611 1583 at91_add_device_hdmac(); 1612 1584 at91_add_device_rtc(); 1613 1585 at91_add_device_rtt(); 1586 + at91_add_device_trng(); 1614 1587 at91_add_device_watchdog(); 1615 1588 at91_add_device_tc(); 1616 1589 return 0;