blob: 31cba6d9aa61747c136763b8db580e4ec8965655 [file] [log] [blame]
SAN People73a59c12006-01-09 17:05:41 +00001/*
Andrew Victor9d041262007-02-05 11:42:07 +01002 * linux/arch/arm/mach-at91/generic.h
SAN People73a59c12006-01-09 17:05:41 +00003 *
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
Maxime Ripard1bd59db2014-07-01 11:33:15 +020011#ifndef _AT91_GENERIC_H
12#define _AT91_GENERIC_H
13
Jean-Christophe PLAGNIOL-VILLARDbd602992011-02-02 07:27:07 +010014#include <linux/clkdev.h>
Nicolas Ferre8014d6f2012-02-14 18:08:14 +010015#include <linux/of.h>
Robin Holt7b6d8642013-07-08 16:01:40 -070016#include <linux/reboot.h>
Jean-Christophe PLAGNIOL-VILLARDbd602992011-02-02 07:27:07 +010017
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080018 /* Map io */
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080019extern void __init at91_map_io(void);
Jean-Christophe PLAGNIOL-VILLARDf0051d82011-05-10 03:20:09 +080020extern void __init at91_init_sram(int bank, unsigned long base,
21 unsigned int length);
Jean-Christophe PLAGNIOL-VILLARD1b021a32011-04-28 20:19:32 +080022
Andrew Victor2eeaaa22006-09-27 10:50:59 +010023 /* Processors */
Jean-Christophe PLAGNIOL-VILLARDe57556e32011-04-24 11:40:22 +080024extern void __init at91rm9200_set_type(int type);
Jean-Christophe PLAGNIOL-VILLARD21d08b92011-04-23 15:28:34 +080025extern void __init at91_initialize(unsigned long main_clock);
Greg Ungerer9a7e2462007-07-30 02:39:02 +010026extern void __init at91x40_initialize(unsigned long main_clock);
Joachim Eastwood397f8c32012-10-28 18:31:09 +000027extern void __init at91rm9200_dt_initialize(void);
Jean-Christophe PLAGNIOL-VILLARD2b11ea52012-02-28 13:57:51 +080028extern void __init at91_dt_initialize(void);
Andrew Victor2eeaaa22006-09-27 10:50:59 +010029
Andrew Victorba854e12006-07-05 17:22:52 +010030 /* Interrupts */
Jean-Christophe PLAGNIOL-VILLARD92100c12011-04-23 15:28:34 +080031extern void __init at91_init_irq_default(void);
32extern void __init at91_init_interrupts(unsigned int priority[]);
Greg Ungerer9a7e2462007-07-30 02:39:02 +010033extern void __init at91x40_init_interrupts(unsigned int priority[]);
Nicolas Ferre738a0fd2012-10-24 16:09:57 +020034extern void __init at91_aic_init(unsigned int priority[],
35 unsigned int ext_irq_mask);
Nicolas Ferre8014d6f2012-02-14 18:08:14 +010036extern int __init at91_aic_of_init(struct device_node *node,
37 struct device_node *parent);
Ludovic Desrochesc4b68522012-05-30 10:01:09 +020038extern int __init at91_aic5_of_init(struct device_node *node,
39 struct device_node *parent);
Johan Hovold6de714c2013-10-16 11:56:14 +020040extern void __init at91_sysirq_mask_rtc(u32 rtc_base);
Johan Hovold94c4c792013-10-16 11:56:15 +020041extern void __init at91_sysirq_mask_rtt(u32 rtt_base);
Nicolas Ferre8014d6f2012-02-14 18:08:14 +010042
Maxime Ripard65f2ce92014-07-02 17:49:28 +020043 /* Devices */
44extern void __init at91_register_devices(void);
SAN People73a59c12006-01-09 17:05:41 +000045
Andrew Victorba854e12006-07-05 17:22:52 +010046 /* Timer */
Jean-Christophe PLAGNIOL-VILLARD5e9cf5e2012-02-20 11:07:39 +010047extern void at91rm9200_ioremap_st(u32 addr);
Stephen Warren6bb27d72012-11-08 12:40:59 -070048extern void at91rm9200_timer_init(void);
Jean-Christophe PLAGNIOL-VILLARD4ab0c5992011-09-18 22:29:50 +080049extern void at91sam926x_ioremap_pit(u32 addr);
Stephen Warren6bb27d72012-11-08 12:40:59 -070050extern void at91sam926x_pit_init(void);
51extern void at91x40_timer_init(void);
SAN People73a59c12006-01-09 17:05:41 +000052
Andrew Victorba854e12006-07-05 17:22:52 +010053 /* Clocks */
Boris BREZILLONc8a8c632013-10-11 09:37:46 +020054#ifdef CONFIG_OLD_CLK_AT91
Jean-Christophe PLAGNIOL-VILLARD46539372011-04-24 18:20:28 +080055extern int __init at91_clock_init(unsigned long main_clock);
Jean-Christophe PLAGNIOL-VILLARDeb5e76f2012-03-02 20:44:23 +080056extern int __init at91_dt_clock_init(void);
Jean-Christophe PLAGNIOL-VILLARD46539372011-04-24 18:20:28 +080057#else
58static int inline at91_clock_init(unsigned long main_clock) { return 0; }
Boris BREZILLONc8a8c632013-10-11 09:37:46 +020059static int inline at91_dt_clock_init(void) { return 0; }
Jean-Christophe PLAGNIOL-VILLARD46539372011-04-24 18:20:28 +080060#endif
Andrew Victor907d6de2006-06-20 19:30:19 +010061struct device;
Andrew Victor907d6de2006-06-20 19:30:19 +010062
63 /* Power Management */
64extern void at91_irq_suspend(void);
65extern void at91_irq_resume(void);
66
Jean-Christophe PLAGNIOL-VILLARD0d781712012-02-05 20:25:32 +080067/* idle */
68extern void at91sam9_idle(void);
69
Jean-Christophe PLAGNIOL-VILLARD4342d642011-11-27 23:15:50 +080070/* Matrix */
71extern void at91_ioremap_matrix(u32 base_addr);
72
Jean-Christophe PLAGNIOL-VILLARDf363c402012-02-13 12:58:53 +080073/* Ram Controler */
74extern void at91_ioremap_ramc(int id, u32 addr, u32 size);
75
Andrew Victorf2173832006-09-27 13:23:00 +010076 /* GPIO */
77#define AT91RM9200_PQFP 3 /* AT91RM9200 PQFP package has 3 banks */
78#define AT91RM9200_BGA 4 /* AT91RM9200 BGA package has 4 banks */
79
80struct at91_gpio_bank {
81 unsigned short id; /* peripheral ID */
Jean-Christophe PLAGNIOL-VILLARD80e91cb2011-09-16 23:37:50 +080082 unsigned long regbase; /* offset from system peripheral base */
Andrew Victorf2173832006-09-27 13:23:00 +010083};
84extern void __init at91_gpio_init(struct at91_gpio_bank *, int nr_banks);
85extern void __init at91_gpio_irq_setup(void);
Nicolas Ferre8014d6f2012-02-14 18:08:14 +010086extern int __init at91_gpio_of_irq_setup(struct device_node *node,
87 struct device_node *parent);
Andrew Victor1f4fd0a2006-11-30 10:01:47 +010088
Jean-Christophe PLAGNIOL-VILLARD546c8302013-06-01 16:40:11 +020089extern u32 at91_get_extern_irq(void);
Maxime Ripard1bd59db2014-07-01 11:33:15 +020090
91#endif /* _AT91_GENERIC_H */