2 * Zcomax ZCN-1523H-2-8/5-16 board support
4 * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
11 #include <linux/mtd/mtd.h>
12 #include <linux/mtd/partitions.h>
14 #include <asm/mach-ar71xx/ar71xx.h>
18 #include "dev-m25p80.h"
19 #include "dev-ap91-pci.h"
20 #include "dev-gpio-buttons.h"
21 #include "dev-leds-gpio.h"
23 #define ZCN_1523H_GPIO_BTN_RESET 0
24 #define ZCN_1523H_GPIO_LED_INIT 11
25 #define ZCN_1523H_GPIO_LED_LAN1 17
27 #define ZCN_1523H_2_GPIO_LED_WEAK 13
28 #define ZCN_1523H_2_GPIO_LED_MEDIUM 14
29 #define ZCN_1523H_2_GPIO_LED_STRONG 15
31 #define ZCN_1523H_5_GPIO_LED_UNKNOWN 1
32 #define ZCN_1523H_5_GPIO_LED_LAN2 13
33 #define ZCN_1523H_5_GPIO_LED_WEAK 14
34 #define ZCN_1523H_5_GPIO_LED_MEDIUM 15
35 #define ZCN_1523H_5_GPIO_LED_STRONG 16
37 #define ZCN_1523H_BUTTONS_POLL_INTERVAL 20
39 #ifdef CONFIG_MTD_PARTITIONS
40 static struct mtd_partition zcn_1523h_partitions
[] = {
45 .mask_flags
= MTD_WRITEABLE
,
50 .mask_flags
= MTD_WRITEABLE
,
63 .mask_flags
= MTD_WRITEABLE
,
68 .mask_flags
= MTD_WRITEABLE
,
73 .mask_flags
= MTD_WRITEABLE
,
80 #endif /* CONFIG_MTD_PARTITIONS */
82 static struct flash_platform_data zcn_1523h_flash_data
= {
83 #ifdef CONFIG_MTD_PARTITIONS
84 .parts
= zcn_1523h_partitions
,
85 .nr_parts
= ARRAY_SIZE(zcn_1523h_partitions
),
89 static struct gpio_button zcn_1523h_gpio_buttons
[] __initdata
= {
95 .gpio
= ZCN_1523H_GPIO_BTN_RESET
,
100 static struct gpio_led zcn_1523h_leds_gpio
[] __initdata
= {
102 .name
= "zcn-1523h:amber:init",
103 .gpio
= ZCN_1523H_GPIO_LED_INIT
,
106 .name
= "zcn-1523h:green:lan1",
107 .gpio
= ZCN_1523H_GPIO_LED_LAN1
,
112 static struct gpio_led zcn_1523h_2_leds_gpio
[] __initdata
= {
114 .name
= "zcn-1523h:red:weak",
115 .gpio
= ZCN_1523H_2_GPIO_LED_WEAK
,
118 .name
= "zcn-1523h:amber:medium",
119 .gpio
= ZCN_1523H_2_GPIO_LED_MEDIUM
,
122 .name
= "zcn-1523h:green:strong",
123 .gpio
= ZCN_1523H_2_GPIO_LED_STRONG
,
128 static struct gpio_led zcn_1523h_5_leds_gpio
[] __initdata
= {
130 .name
= "zcn-1523h:red:weak",
131 .gpio
= ZCN_1523H_5_GPIO_LED_WEAK
,
134 .name
= "zcn-1523h:amber:medium",
135 .gpio
= ZCN_1523H_5_GPIO_LED_MEDIUM
,
138 .name
= "zcn-1523h:green:strong",
139 .gpio
= ZCN_1523H_5_GPIO_LED_STRONG
,
142 .name
= "zcn-1523h:green:lan2",
143 .gpio
= ZCN_1523H_5_GPIO_LED_LAN2
,
146 .name
= "zcn-1523h:amber:unknown",
147 .gpio
= ZCN_1523H_5_GPIO_LED_UNKNOWN
,
151 static void __init
zcn_1523h_generic_setup(void)
153 u8
*mac
= (u8
*) KSEG1ADDR(0x1f7e0004);
154 u8
*ee
= (u8
*) KSEG1ADDR(0x1fff1000);
156 ar71xx_gpio_function_disable(AR724X_GPIO_FUNC_ETH_SWITCH_LED0_EN
|
157 AR724X_GPIO_FUNC_ETH_SWITCH_LED1_EN
|
158 AR724X_GPIO_FUNC_ETH_SWITCH_LED2_EN
|
159 AR724X_GPIO_FUNC_ETH_SWITCH_LED3_EN
|
160 AR724X_GPIO_FUNC_ETH_SWITCH_LED4_EN
);
162 ar71xx_add_device_m25p80(&zcn_1523h_flash_data
);
164 ar71xx_add_device_leds_gpio(0, ARRAY_SIZE(zcn_1523h_leds_gpio
),
165 zcn_1523h_leds_gpio
);
167 ar71xx_add_device_gpio_buttons(-1, ZCN_1523H_BUTTONS_POLL_INTERVAL
,
168 ARRAY_SIZE(zcn_1523h_gpio_buttons
),
169 zcn_1523h_gpio_buttons
);
171 ap91_pci_init(ee
, mac
);
173 ar71xx_init_mac(ar71xx_eth0_data
.mac_addr
, mac
, 0);
174 ar71xx_init_mac(ar71xx_eth1_data
.mac_addr
, mac
, 1);
177 ar71xx_eth0_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
178 ar71xx_eth0_data
.speed
= SPEED_100
;
179 ar71xx_eth0_data
.duplex
= DUPLEX_FULL
;
182 ar71xx_eth1_data
.phy_if_mode
= PHY_INTERFACE_MODE_RMII
;
183 ar71xx_eth1_data
.speed
= SPEED_1000
;
184 ar71xx_eth1_data
.duplex
= DUPLEX_FULL
;
186 ar71xx_add_device_mdio(0x0);
187 ar71xx_add_device_eth(0);
190 static void __init
zcn_1523h_2_setup(void)
192 zcn_1523h_generic_setup();
194 ar71xx_add_device_leds_gpio(1, ARRAY_SIZE(zcn_1523h_2_leds_gpio
),
195 zcn_1523h_2_leds_gpio
);
198 MIPS_MACHINE(AR71XX_MACH_ZCN_1523H_2
, "ZCN-1523H-2", "Zcomax ZCN-1523H-2",
201 static void __init
zcn_1523h_5_setup(void)
203 zcn_1523h_generic_setup();
205 ar71xx_add_device_leds_gpio(1, ARRAY_SIZE(zcn_1523h_5_leds_gpio
),
206 zcn_1523h_5_leds_gpio
);
207 ar71xx_add_device_eth(1);
210 MIPS_MACHINE(AR71XX_MACH_ZCN_1523H_5
, "ZCN-1523H-5", "Zcomax ZCN-1523H-5",