blob: ec89806c9d5d354f3536efccbfa96308ec3583f6 [file] [log] [blame]
Joachim Eastwood397f8c32012-10-28 18:31:09 +00001/*
Nicolas Ferrecac01722015-01-27 16:41:55 +01002 * Setup code for AT91RM9200
Joachim Eastwood397f8c32012-10-28 18:31:09 +00003 *
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/types.h>
12#include <linux/init.h>
13#include <linux/module.h>
14#include <linux/gpio.h>
15#include <linux/of.h>
16#include <linux/of_irq.h>
Alexandre Belloni4db0ba22015-01-15 15:59:27 +010017#include <linux/of_platform.h>
Alexandre Belloni04ffc962014-09-05 16:15:33 +020018#include <linux/clk-provider.h>
Joachim Eastwood397f8c32012-10-28 18:31:09 +000019
Joachim Eastwood397f8c32012-10-28 18:31:09 +000020#include <asm/setup.h>
21#include <asm/irq.h>
22#include <asm/mach/arch.h>
23#include <asm/mach/map.h>
24#include <asm/mach/irq.h>
Alexandre Belloni7d7ffd72015-01-26 19:02:54 +010025#include <asm/system_misc.h>
26
27#include <mach/at91_st.h>
Joachim Eastwood397f8c32012-10-28 18:31:09 +000028
Joachim Eastwood397f8c32012-10-28 18:31:09 +000029#include "generic.h"
30
Alexandre Belloni7d7ffd72015-01-26 19:02:54 +010031static void at91rm9200_restart(enum reboot_mode reboot_mode, const char *cmd)
32{
33 /*
34 * Perform a hardware reset with the use of the Watchdog timer.
35 */
36 at91_st_write(AT91_ST_WDMR, AT91_ST_RSTEN | AT91_ST_EXTEN | 1);
37 at91_st_write(AT91_ST_CR, AT91_ST_WDRST);
38}
39
Alexandre Belloni04ffc962014-09-05 16:15:33 +020040static void __init at91rm9200_dt_timer_init(void)
41{
Alexandre Belloni04ffc962014-09-05 16:15:33 +020042 of_clk_init(NULL);
Alexandre Belloni04ffc962014-09-05 16:15:33 +020043 at91rm9200_timer_init();
44}
45
Alexandre Belloni4db0ba22015-01-15 15:59:27 +010046static void __init rm9200_dt_device_init(void)
47{
Alexandre Belloni4db0ba22015-01-15 15:59:27 +010048 of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
Nicolas Ferreea69f992015-01-23 11:47:37 +010049
Alexandre Belloni7d7ffd72015-01-26 19:02:54 +010050 arm_pm_idle = at91rm9200_idle;
51 arm_pm_restart = at91rm9200_restart;
Nicolas Ferreea69f992015-01-23 11:47:37 +010052 at91_rm9200_pm_init();
Alexandre Belloni4db0ba22015-01-15 15:59:27 +010053}
54
55
56
Alexandre Belloni37e9c4d2015-01-22 17:19:04 +010057static const char *at91rm9200_dt_board_compat[] __initconst = {
Joachim Eastwood397f8c32012-10-28 18:31:09 +000058 "atmel,at91rm9200",
59 NULL
60};
61
62DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)")
Alexandre Belloni04ffc962014-09-05 16:15:33 +020063 .init_time = at91rm9200_dt_timer_init,
Joachim Eastwood397f8c32012-10-28 18:31:09 +000064 .map_io = at91_map_io,
Alexandre Belloni427accd2015-01-12 19:42:15 +010065 .init_early = at91_dt_initialize,
Alexandre Belloni4db0ba22015-01-15 15:59:27 +010066 .init_machine = rm9200_dt_device_init,
Joachim Eastwood397f8c32012-10-28 18:31:09 +000067 .dt_compat = at91rm9200_dt_board_compat,
68MACHINE_END