SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 1 | /* |
Andrew Victor | 9d04126 | 2007-02-05 11:42:07 +0100 | [diff] [blame] | 2 | * linux/arch/arm/mach-at91/generic.h |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 3 | * |
| 4 | * Copyright (C) 2005 David Brownell |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
Jean-Christophe PLAGNIOL-VILLARD | bd60299 | 2011-02-02 07:27:07 +0100 | [diff] [blame] | 11 | #include <linux/clkdev.h> |
Nicolas Ferre | 8014d6f4 | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 12 | #include <linux/of.h> |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 13 | #include <linux/reboot.h> |
Jean-Christophe PLAGNIOL-VILLARD | bd60299 | 2011-02-02 07:27:07 +0100 | [diff] [blame] | 14 | |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 15 | /* Map io */ |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 16 | extern void __init at91_map_io(void); |
Jean-Christophe PLAGNIOL-VILLARD | f0051d8 | 2011-05-10 03:20:09 +0800 | [diff] [blame] | 17 | extern void __init at91_init_sram(int bank, unsigned long base, |
| 18 | unsigned int length); |
Jean-Christophe PLAGNIOL-VILLARD | 1b021a3 | 2011-04-28 20:19:32 +0800 | [diff] [blame] | 19 | |
Andrew Victor | 2eeaaa2 | 2006-09-27 10:50:59 +0100 | [diff] [blame] | 20 | /* Processors */ |
Jean-Christophe PLAGNIOL-VILLARD | e57556e3 | 2011-04-24 11:40:22 +0800 | [diff] [blame] | 21 | extern void __init at91rm9200_set_type(int type); |
Jean-Christophe PLAGNIOL-VILLARD | 21d08b9 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 22 | extern void __init at91_initialize(unsigned long main_clock); |
Greg Ungerer | 9a7e246 | 2007-07-30 02:39:02 +0100 | [diff] [blame] | 23 | extern void __init at91x40_initialize(unsigned long main_clock); |
Joachim Eastwood | 397f8c3 | 2012-10-28 18:31:09 +0000 | [diff] [blame] | 24 | extern void __init at91rm9200_dt_initialize(void); |
Jean-Christophe PLAGNIOL-VILLARD | 2b11ea5 | 2012-02-28 13:57:51 +0800 | [diff] [blame] | 25 | extern void __init at91_dt_initialize(void); |
Andrew Victor | 2eeaaa2 | 2006-09-27 10:50:59 +0100 | [diff] [blame] | 26 | |
Andrew Victor | ba854e1 | 2006-07-05 17:22:52 +0100 | [diff] [blame] | 27 | /* Interrupts */ |
Jean-Christophe PLAGNIOL-VILLARD | 92100c1 | 2011-04-23 15:28:34 +0800 | [diff] [blame] | 28 | extern void __init at91_init_irq_default(void); |
| 29 | extern void __init at91_init_interrupts(unsigned int priority[]); |
Greg Ungerer | 9a7e246 | 2007-07-30 02:39:02 +0100 | [diff] [blame] | 30 | extern void __init at91x40_init_interrupts(unsigned int priority[]); |
Nicolas Ferre | 738a0fd | 2012-10-24 16:09:57 +0200 | [diff] [blame] | 31 | extern void __init at91_aic_init(unsigned int priority[], |
| 32 | unsigned int ext_irq_mask); |
Nicolas Ferre | 8014d6f4 | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 33 | extern int __init at91_aic_of_init(struct device_node *node, |
| 34 | struct device_node *parent); |
Ludovic Desroches | c4b6852 | 2012-05-30 10:01:09 +0200 | [diff] [blame] | 35 | extern int __init at91_aic5_of_init(struct device_node *node, |
| 36 | struct device_node *parent); |
Johan Hovold | 6de714c | 2013-10-16 11:56:14 +0200 | [diff] [blame] | 37 | extern void __init at91_sysirq_mask_rtc(u32 rtc_base); |
Johan Hovold | 94c4c79 | 2013-10-16 11:56:15 +0200 | [diff] [blame] | 38 | extern void __init at91_sysirq_mask_rtt(u32 rtt_base); |
Nicolas Ferre | 8014d6f4 | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 39 | |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 40 | |
Andrew Victor | ba854e1 | 2006-07-05 17:22:52 +0100 | [diff] [blame] | 41 | /* Timer */ |
Jean-Christophe PLAGNIOL-VILLARD | 5e9cf5e | 2012-02-20 11:07:39 +0100 | [diff] [blame] | 42 | extern void at91rm9200_ioremap_st(u32 addr); |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 43 | extern void at91rm9200_timer_init(void); |
Jean-Christophe PLAGNIOL-VILLARD | 4ab0c599 | 2011-09-18 22:29:50 +0800 | [diff] [blame] | 44 | extern void at91sam926x_ioremap_pit(u32 addr); |
Stephen Warren | 6bb27d7 | 2012-11-08 12:40:59 -0700 | [diff] [blame] | 45 | extern void at91sam926x_pit_init(void); |
| 46 | extern void at91x40_timer_init(void); |
SAN People | 73a59c1 | 2006-01-09 17:05:41 +0000 | [diff] [blame] | 47 | |
Andrew Victor | ba854e1 | 2006-07-05 17:22:52 +0100 | [diff] [blame] | 48 | /* Clocks */ |
Boris BREZILLON | c8a8c63 | 2013-10-11 09:37:46 +0200 | [diff] [blame] | 49 | #ifdef CONFIG_OLD_CLK_AT91 |
Jean-Christophe PLAGNIOL-VILLARD | 4653937 | 2011-04-24 18:20:28 +0800 | [diff] [blame] | 50 | extern int __init at91_clock_init(unsigned long main_clock); |
Jean-Christophe PLAGNIOL-VILLARD | eb5e76f | 2012-03-02 20:44:23 +0800 | [diff] [blame] | 51 | extern int __init at91_dt_clock_init(void); |
Jean-Christophe PLAGNIOL-VILLARD | 4653937 | 2011-04-24 18:20:28 +0800 | [diff] [blame] | 52 | #else |
| 53 | static int inline at91_clock_init(unsigned long main_clock) { return 0; } |
Boris BREZILLON | c8a8c63 | 2013-10-11 09:37:46 +0200 | [diff] [blame] | 54 | static int inline at91_dt_clock_init(void) { return 0; } |
Jean-Christophe PLAGNIOL-VILLARD | 4653937 | 2011-04-24 18:20:28 +0800 | [diff] [blame] | 55 | #endif |
Andrew Victor | 907d6de | 2006-06-20 19:30:19 +0100 | [diff] [blame] | 56 | struct device; |
Andrew Victor | 907d6de | 2006-06-20 19:30:19 +0100 | [diff] [blame] | 57 | |
| 58 | /* Power Management */ |
| 59 | extern void at91_irq_suspend(void); |
| 60 | extern void at91_irq_resume(void); |
| 61 | |
Jean-Christophe PLAGNIOL-VILLARD | 0d78171 | 2012-02-05 20:25:32 +0800 | [diff] [blame] | 62 | /* idle */ |
| 63 | extern void at91sam9_idle(void); |
| 64 | |
Nicolas Ferre | bb413db | 2010-10-14 19:14:00 +0200 | [diff] [blame] | 65 | /* reset */ |
Jean-Christophe PLAGNIOL-VILLARD | e9f68b5 | 2011-11-18 01:25:52 +0800 | [diff] [blame] | 66 | extern void at91_ioremap_rstc(u32 base_addr); |
Robin Holt | 7b6d864 | 2013-07-08 16:01:40 -0700 | [diff] [blame] | 67 | extern void at91sam9_alt_restart(enum reboot_mode, const char *); |
| 68 | extern void at91sam9g45_restart(enum reboot_mode, const char *); |
Nicolas Ferre | bb413db | 2010-10-14 19:14:00 +0200 | [diff] [blame] | 69 | |
Jean-Christophe PLAGNIOL-VILLARD | f22deee | 2011-11-01 01:23:20 +0800 | [diff] [blame] | 70 | /* shutdown */ |
| 71 | extern void at91_ioremap_shdwc(u32 base_addr); |
| 72 | |
Jean-Christophe PLAGNIOL-VILLARD | 4342d64 | 2011-11-27 23:15:50 +0800 | [diff] [blame] | 73 | /* Matrix */ |
| 74 | extern void at91_ioremap_matrix(u32 base_addr); |
| 75 | |
Jean-Christophe PLAGNIOL-VILLARD | f363c40 | 2012-02-13 12:58:53 +0800 | [diff] [blame] | 76 | /* Ram Controler */ |
| 77 | extern void at91_ioremap_ramc(int id, u32 addr, u32 size); |
| 78 | |
Andrew Victor | f217383 | 2006-09-27 13:23:00 +0100 | [diff] [blame] | 79 | /* GPIO */ |
| 80 | #define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */ |
| 81 | #define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */ |
| 82 | |
| 83 | struct at91_gpio_bank { |
| 84 | unsigned short id; /* peripheral ID */ |
Jean-Christophe PLAGNIOL-VILLARD | 80e91cb | 2011-09-16 23:37:50 +0800 | [diff] [blame] | 85 | unsigned long regbase; /* offset from system peripheral base */ |
Andrew Victor | f217383 | 2006-09-27 13:23:00 +0100 | [diff] [blame] | 86 | }; |
| 87 | extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks); |
| 88 | extern void __init at91_gpio_irq_setup(void); |
Nicolas Ferre | 8014d6f4 | 2012-02-14 18:08:14 +0100 | [diff] [blame] | 89 | extern int __init at91_gpio_of_irq_setup(struct device_node *node, |
| 90 | struct device_node *parent); |
Andrew Victor | 1f4fd0a | 2006-11-30 10:01:47 +0100 | [diff] [blame] | 91 | |
Jean-Christophe PLAGNIOL-VILLARD | 546c830 | 2013-06-01 16:40:11 +0200 | [diff] [blame] | 92 | extern u32 at91_get_extern_irq(void); |