]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ARM: at91: at91sam9g45: add trng clock and platform device
authorPeter Korsgaard <jacmet@sunsite.dk>
Thu, 6 Oct 2011 15:41:33 +0000 (17:41 +0200)
committerJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sun, 16 Oct 2011 19:42:50 +0000 (03:42 +0800)
For the new hw_random driver.

Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
arch/arm/mach-at91/at91sam9g45.c
arch/arm/mach-at91/at91sam9g45_devices.c

index 753df6323bfb8004da2217c18873afcae0d529f3..e47570f7633f0ad66e5d464ad5a73fdb0ff896df 100644 (file)
@@ -53,6 +53,11 @@ static struct clk pioDE_clk = {
        .pmc_mask       = 1 << AT91SAM9G45_ID_PIODE,
        .type           = CLK_TYPE_PERIPHERAL,
 };
+static struct clk trng_clk = {
+       .name           = "trng_clk",
+       .pmc_mask       = 1 << AT91SAM9G45_ID_TRNG,
+       .type           = CLK_TYPE_PERIPHERAL,
+};
 static struct clk usart0_clk = {
        .name           = "usart0_clk",
        .pmc_mask       = 1 << AT91SAM9G45_ID_US0,
@@ -176,6 +181,7 @@ static struct clk *periph_clocks[] __initdata = {
        &pioB_clk,
        &pioC_clk,
        &pioDE_clk,
+       &trng_clk,
        &usart0_clk,
        &usart1_clk,
        &usart2_clk,
@@ -215,6 +221,7 @@ static struct clk_lookup periph_clocks_lookups[] = {
        CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.1", &tcb0_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
        CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
+       CLKDEV_CON_DEV_ID(NULL, "atmel-trng", &trng_clk),
        /* fake hclk clock */
        CLKDEV_CON_DEV_ID("hclk", "at91_ohci", &uhphs_clk),
 };
index ffd655bbe50f93ac31a885e535923f617d2cdfc7..3d0957fc8b81182a8e990f27b3ba4588133d6f3b 100644 (file)
@@ -1100,6 +1100,34 @@ static void __init at91_add_device_rtt(void)
 }
 
 
+/* --------------------------------------------------------------------
+ *  TRNG
+ * -------------------------------------------------------------------- */
+
+#if defined(CONFIG_HW_RANDOM_ATMEL) || defined(CONFIG_HW_RANDOM_ATMEL_MODULE)
+static struct resource trng_resources[] = {
+       {
+               .start  = AT91SAM9G45_BASE_TRNG,
+               .end    = AT91SAM9G45_BASE_TRNG + SZ_16K - 1,
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device at91sam9g45_trng_device = {
+       .name           = "atmel-trng",
+       .id             = -1,
+       .resource       = trng_resources,
+       .num_resources  = ARRAY_SIZE(trng_resources),
+};
+
+static void __init at91_add_device_trng(void)
+{
+       platform_device_register(&at91sam9g45_trng_device);
+}
+#else
+static void __init at91_add_device_trng(void) {}
+#endif
+
 /* --------------------------------------------------------------------
  *  Watchdog
  * -------------------------------------------------------------------- */
@@ -1589,6 +1617,7 @@ static int __init at91_add_standard_devices(void)
        at91_add_device_hdmac();
        at91_add_device_rtc();
        at91_add_device_rtt();
+       at91_add_device_trng();
        at91_add_device_watchdog();
        at91_add_device_tc();
        return 0;