Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 1 | /* |
Nicolas Ferre | cac0172 | 2015-01-27 16:41:55 +0100 | [diff] [blame^] | 2 | * Setup code for AT91RM9200 |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 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/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 Belloni | 4db0ba2 | 2015-01-15 15:59:27 +0100 | [diff] [blame] | 17 | #include <linux/of_platform.h> |
Alexandre Belloni | 04ffc96 | 2014-09-05 16:15:33 +0200 | [diff] [blame] | 18 | #include <linux/clk-provider.h> |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 19 | |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 20 | #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 Belloni | 7d7ffd7 | 2015-01-26 19:02:54 +0100 | [diff] [blame] | 25 | #include <asm/system_misc.h> |
| 26 | |
| 27 | #include <mach/at91_st.h> |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 28 | |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 29 | #include "generic.h" |
| 30 | |
Alexandre Belloni | 7d7ffd7 | 2015-01-26 19:02:54 +0100 | [diff] [blame] | 31 | static 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 Belloni | 04ffc96 | 2014-09-05 16:15:33 +0200 | [diff] [blame] | 40 | static void __init at91rm9200_dt_timer_init(void) |
| 41 | { |
Alexandre Belloni | 04ffc96 | 2014-09-05 16:15:33 +0200 | [diff] [blame] | 42 | of_clk_init(NULL); |
Alexandre Belloni | 04ffc96 | 2014-09-05 16:15:33 +0200 | [diff] [blame] | 43 | at91rm9200_timer_init(); |
| 44 | } |
| 45 | |
Alexandre Belloni | 4db0ba2 | 2015-01-15 15:59:27 +0100 | [diff] [blame] | 46 | static void __init rm9200_dt_device_init(void) |
| 47 | { |
Alexandre Belloni | 4db0ba2 | 2015-01-15 15:59:27 +0100 | [diff] [blame] | 48 | of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); |
Nicolas Ferre | ea69f99 | 2015-01-23 11:47:37 +0100 | [diff] [blame] | 49 | |
Alexandre Belloni | 7d7ffd7 | 2015-01-26 19:02:54 +0100 | [diff] [blame] | 50 | arm_pm_idle = at91rm9200_idle; |
| 51 | arm_pm_restart = at91rm9200_restart; |
Nicolas Ferre | ea69f99 | 2015-01-23 11:47:37 +0100 | [diff] [blame] | 52 | at91_rm9200_pm_init(); |
Alexandre Belloni | 4db0ba2 | 2015-01-15 15:59:27 +0100 | [diff] [blame] | 53 | } |
| 54 | |
| 55 | |
| 56 | |
Alexandre Belloni | 37e9c4d | 2015-01-22 17:19:04 +0100 | [diff] [blame] | 57 | static const char *at91rm9200_dt_board_compat[] __initconst = { |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 58 | "atmel,at91rm9200", |
| 59 | NULL |
| 60 | }; |
| 61 | |
| 62 | DT_MACHINE_START(at91rm9200_dt, "Atmel AT91RM9200 (Device Tree)") |
Alexandre Belloni | 04ffc96 | 2014-09-05 16:15:33 +0200 | [diff] [blame] | 63 | .init_time = at91rm9200_dt_timer_init, |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 64 | .map_io = at91_map_io, |
Alexandre Belloni | 427accd | 2015-01-12 19:42:15 +0100 | [diff] [blame] | 65 | .init_early = at91_dt_initialize, |
Alexandre Belloni | 4db0ba2 | 2015-01-15 15:59:27 +0100 | [diff] [blame] | 66 | .init_machine = rm9200_dt_device_init, |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 67 | .dt_compat = at91rm9200_dt_board_compat, |
| 68 | MACHINE_END |