xref: /openbmc/linux/arch/arm/mach-at91/at91rm9200.c (revision 5c73cc4b6c83e88863a5de869cc5df3b913aef4a)
1 /*
2  *  Setup code for AT91RM9200
3  *
4  *  Copyright (C) 2011 Atmel,
5  *                2011 Nicolas Ferre <nicolas.ferre@atmel.com>
6  *                2012 Joachim Eastwood <manabian@gmail.com>
7  *
8  * Licensed under GPLv2 or later.
9  */
10 
11 #include <linux/clk-provider.h>
12 #include <linux/of.h>
13 #include <linux/of_platform.h>
14 
15 #include <asm/mach/arch.h>
16 #include <asm/system_misc.h>
17 
18 #include <mach/at91_st.h>
19 
20 #include "generic.h"
21 #include "soc.h"
22 
23 static const struct at91_soc rm9200_socs[] = {
24 	AT91_SOC(AT91RM9200_CIDR_MATCH, 0, "at91rm9200 BGA", "at91rm9200"),
25 	{ /* sentinel */ },
26 };
27 
28 static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd)
29 {
30 	/*
31 	 * Perform a hardware reset with the use of the Watchdog timer.
32 	 */
33 	at91_st_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
34 	at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
35 }
36 
37 static void __init at91rm9200_dt_timer_init(void)
38 {
39 	of_clk_init(NULL);
40 	at91rm9200_timer_init();
41 }
42 
43 static void __init at91rm9200_dt_device_init(void)
44 {
45 	struct soc_device *soc;
46 	struct device *soc_dev = NULL;
47 
48 	soc = at91_soc_init(rm9200_socs);
49 	if (soc != NULL)
50 		soc_dev = soc_device_to_device(soc);
51 
52 	of_platform_populate(NULL, of_default_bus_match_table, NULL, soc_dev);
53 
54 	arm_pm_idle = at91rm9200_idle;
55 	arm_pm_restart = at91rm9200_restart;
56 	at91rm9200_pm_init();
57 }
58 
59 static const char *at91rm9200_dt_board_compat[] __initconst = {
60 	"atmel,at91rm9200",
61 	NULL
62 };
63 
64 DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200")
65 	.init_time      = at91rm9200_dt_timer_init,
66 	.init_machine	= at91rm9200_dt_device_init,
67 	.dt_compat	= at91rm9200_dt_board_compat,
68 MACHINE_END
69