ar71xx: add preliminary support for Mikrotik RB2011L
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / patches-3.3 / 640-MIPS-ath79-dir-825-b1-for-owrt-board-def.patch
1 --- a/arch/mips/ath79/mach-dir-825-b1.c
2 +++ b/arch/mips/ath79/mach-dir-825-b1.c
3 @@ -46,6 +46,12 @@
4 #define DIR825B1_MAC_LOCATION_0 0x1f66ffa0
5 #define DIR825B1_MAC_LOCATION_1 0x1f66ffb4
6
7 +#define DIR825B1_OPENWRT_CAL_LOCATION_0 0x1f7f1000
8 +#define DIR825B1_OPENWRT_CAL_LOCATION_1 0x1f7f5000
9 +
10 +#define DIR825B1_OPENWRT_MAC_LOCATION_0 0x1f7fffa0
11 +#define DIR825B1_OPENWRT_MAC_LOCATION_1 0x1f7fffb4
12 +
13 static struct gpio_led dir825b1_leds_gpio[] __initdata = {
14 {
15 .name = "d-link:blue:usb",
16 @@ -124,12 +130,12 @@ static void dir825b1_read_ascii_mac(u8 *
17 memset(dest, 0, ETH_ALEN);
18 }
19
20 -static void __init dir825b1_setup(void)
21 -{
22 +static void __init dir825b1_common_setup(unsigned int macloc1, unsigned int macloc2,
23 + unsigned int calloc1, unsigned int calloc2) {
24 u8 mac1[ETH_ALEN], mac2[ETH_ALEN];
25
26 - dir825b1_read_ascii_mac(mac1, DIR825B1_MAC_LOCATION_0);
27 - dir825b1_read_ascii_mac(mac2, DIR825B1_MAC_LOCATION_1);
28 + dir825b1_read_ascii_mac(mac1, macloc1);
29 + dir825b1_read_ascii_mac(mac2, macloc2);
30
31 ath79_register_mdio(0, 0x0);
32
33 @@ -165,9 +171,27 @@ static void __init dir825b1_setup(void)
34 ap9x_pci_setup_wmac_led_pin(0, 5);
35 ap9x_pci_setup_wmac_led_pin(1, 5);
36
37 - ap94_pci_init((u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_0), mac1,
38 - (u8 *) KSEG1ADDR(DIR825B1_CAL_LOCATION_1), mac2);
39 + ap94_pci_init((u8 *) KSEG1ADDR(calloc1), mac1,
40 + (u8 *) KSEG1ADDR(calloc2), mac2);
41 +}
42 +
43 +static void __init dir825b1_setup(void)
44 +{
45 + dir825b1_common_setup(DIR825B1_MAC_LOCATION_0, DIR825B1_MAC_LOCATION_1,
46 + DIR825B1_CAL_LOCATION_0, DIR825B1_CAL_LOCATION_1);
47 +}
48 +
49 +static void __init dir825b1_openwrt_setup(void)
50 +{
51 + dir825b1_common_setup(DIR825B1_OPENWRT_MAC_LOCATION_0, DIR825B1_OPENWRT_MAC_LOCATION_1,
52 + DIR825B1_OPENWRT_CAL_LOCATION_0, DIR825B1_OPENWRT_CAL_LOCATION_1);
53 }
54
55 MIPS_MACHINE(ATH79_MACH_DIR_825_B1, "DIR-825-B1", "D-Link DIR-825 rev. B1",
56 dir825b1_setup);
57 +
58 +MIPS_MACHINE(ATH79_MACH_DIR_825_B1_OPENWRT, "DIR-825-B1_OPENWRT", "D-Link DIR-825 rev. B1 OpenWrt",
59 + dir825b1_openwrt_setup);
60 +
61 +MIPS_MACHINE(ATH79_MACH_DIR_825_B1_TOSTOCK, "DIR-825-B1_TOSTOCK", "D-Link DIR-825 rev. B1 TOSTOCK", dir825b1_openwrt_setup);
62 +
63 --- a/arch/mips/ath79/machtypes.h
64 +++ b/arch/mips/ath79/machtypes.h
65 @@ -35,6 +35,8 @@ enum ath79_mach_type {
66 ATH79_MACH_DIR_615_C1, /* D-Link DIR-615 rev. C1 */
67 ATH79_MACH_DIR_615_E4, /* D-Link DIR-615 rev. E4 */
68 ATH79_MACH_DIR_825_B1, /* D-Link DIR-825 rev. B1 */
69 + ATH79_MACH_DIR_825_B1_OPENWRT, /* D-Link DIR-825 rev. B1 OpenWrt */
70 + ATH79_MACH_DIR_825_B1_TOSTOCK, /* D-Link DIR-825 rev. B1 TOSTOCK */
71 ATH79_MACH_EW_DORIN, /* embedded wireless Dorin Platform */
72 ATH79_MACH_EW_DORIN_ROUTER, /* embedded wireless Dorin Router Platform */
73 ATH79_MACH_EAP7660D, /* Senao EAP7660D */