[ar71xx] register eth0 device on the AP83 board
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / ar71xx.c
1 /*
2 * AR71xx SoC routines
3 *
4 * Copyright (C) 2008 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11
12 #include <linux/kernel.h>
13 #include <linux/module.h>
14 #include <linux/types.h>
15
16 #include <asm/mach-ar71xx/ar71xx.h>
17
18 void __iomem *ar71xx_ddr_base;
19 EXPORT_SYMBOL_GPL(ar71xx_ddr_base);
20
21 void __iomem *ar71xx_pll_base;
22 EXPORT_SYMBOL_GPL(ar71xx_pll_base);
23
24 void __iomem *ar71xx_reset_base;
25 EXPORT_SYMBOL_GPL(ar71xx_reset_base);
26
27 void __iomem *ar71xx_gpio_base;
28 EXPORT_SYMBOL_GPL(ar71xx_gpio_base);
29
30 void __iomem *ar71xx_usb_ctrl_base;
31 EXPORT_SYMBOL_GPL(ar71xx_usb_ctrl_base);
32
33 void ar71xx_device_stop(u32 mask)
34 {
35 unsigned long flags;
36
37 local_irq_save(flags);
38 ar71xx_reset_wr(RESET_REG_RESET_MODULE,
39 ar71xx_reset_rr(RESET_REG_RESET_MODULE) | mask);
40 local_irq_restore(flags);
41 }
42 EXPORT_SYMBOL_GPL(ar71xx_device_stop);
43
44 void ar71xx_device_start(u32 mask)
45 {
46 unsigned long flags;
47
48 local_irq_save(flags);
49 ar71xx_reset_wr(RESET_REG_RESET_MODULE,
50 ar71xx_reset_rr(RESET_REG_RESET_MODULE) & ~mask);
51 local_irq_restore(flags);
52 }
53 EXPORT_SYMBOL_GPL(ar71xx_device_start);
54
55 void ar71xx_ddr_flush(u32 reg)
56 {
57 ar71xx_ddr_wr(reg, 1);
58 while ((ar71xx_ddr_rr(reg) & 0x1));
59
60 ar71xx_ddr_wr(reg, 1);
61 while ((ar71xx_ddr_rr(reg) & 0x1));
62 }
63 EXPORT_SYMBOL_GPL(ar71xx_ddr_flush);
64