ar71xx: add initial support for RB750GL
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31025 3c298f89-4303-0410-b956-a3cf2f4a3e73master
parent
fcb6507f7b
commit
935d0cf7fe
|
@ -62,6 +62,14 @@ routerstation-pro)
|
|||
ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 4"
|
||||
;;
|
||||
|
||||
rb-750gl |\
|
||||
wzr-hp-g450h)
|
||||
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
|
||||
ucidef_add_switch "switch0" "1" "1"
|
||||
ucidef_add_switch_vlan "switch0" "1" "0t 2 3 4 5"
|
||||
ucidef_add_switch_vlan "switch0" "2" "0t 1"
|
||||
;;
|
||||
|
||||
rb-493g)
|
||||
ucidef_set_interfaces_lan_wan "eth0 eth1.1" "eth1.2"
|
||||
ucidef_add_switch "switch0" "1" "1"
|
||||
|
|
|
@ -247,6 +247,9 @@ ar71xx_board_detect() {
|
|||
*"RouterBOARD 750")
|
||||
name="rb-750"
|
||||
;;
|
||||
*"RouterBOARD 750GL")
|
||||
name="rb-750gl"
|
||||
;;
|
||||
*"Rocket M")
|
||||
name="rocket-m"
|
||||
;;
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <linux/export.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/phy.h>
|
||||
#include <linux/ar8216_platform.h>
|
||||
|
||||
#include <asm/mach-ath79/ar71xx_regs.h>
|
||||
#include <asm/mach-ath79/ath79.h>
|
||||
|
@ -47,6 +49,14 @@ static struct rb750_led_data rb750_leds[] = {
|
|||
}
|
||||
};
|
||||
|
||||
static struct rb750_led_data rb750gr3_leds[] = {
|
||||
{
|
||||
.name = "rb750:green:act",
|
||||
.mask = RB7XX_LED_ACT,
|
||||
.active_low = 1,
|
||||
},
|
||||
};
|
||||
|
||||
static struct rb750_led_platform_data rb750_leds_data;
|
||||
static struct platform_device rb750_leds_device = {
|
||||
.name = "leds-rb750",
|
||||
|
@ -155,3 +165,108 @@ static void __init rb750_setup(void)
|
|||
|
||||
MIPS_MACHINE(ATH79_MACH_RB_750, "750i", "MikroTik RouterBOARD 750",
|
||||
rb750_setup);
|
||||
|
||||
static struct ar8327_pad_cfg rb750gr3_ar8327_pad0_cfg = {
|
||||
.mode = AR8327_PAD_MAC_RGMII,
|
||||
.txclk_delay_en = true,
|
||||
.rxclk_delay_en = true,
|
||||
.txclk_delay_sel = AR8327_CLK_DELAY_SEL1,
|
||||
.rxclk_delay_sel = AR8327_CLK_DELAY_SEL2,
|
||||
};
|
||||
|
||||
static struct ar8327_platform_data rb750gr3_ar8327_data = {
|
||||
.pad0_cfg = &rb750gr3_ar8327_pad0_cfg,
|
||||
.cpuport_cfg = {
|
||||
.force_link = 1,
|
||||
.speed = AR8327_PORT_SPEED_100,
|
||||
.duplex = 1,
|
||||
.txpause = 1,
|
||||
.rxpause = 1,
|
||||
}
|
||||
};
|
||||
|
||||
static struct mdio_board_info rb750g3_mdio_info[] = {
|
||||
{
|
||||
.bus_id = "ag71xx-mdio.0",
|
||||
.phy_addr = 0,
|
||||
.platform_data = &rb750gr3_ar8327_data,
|
||||
},
|
||||
};
|
||||
|
||||
static void rb750gr3_nand_enable_pins(void)
|
||||
{
|
||||
ath79_gpio_function_setup(AR724X_GPIO_FUNC_JTAG_DISABLE,
|
||||
AR724X_GPIO_FUNC_SPI_EN |
|
||||
AR724X_GPIO_FUNC_SPI_CS_EN2);
|
||||
}
|
||||
|
||||
static void rb750gr3_nand_disable_pins(void)
|
||||
{
|
||||
ath79_gpio_function_setup(AR724X_GPIO_FUNC_SPI_EN |
|
||||
AR724X_GPIO_FUNC_SPI_CS_EN2,
|
||||
AR724X_GPIO_FUNC_JTAG_DISABLE);
|
||||
}
|
||||
|
||||
static void rb750gr3_latch_change(u32 mask_clr, u32 mask_set)
|
||||
{
|
||||
static DEFINE_SPINLOCK(lock);
|
||||
static u32 latch_set = RB7XX_LED_ACT;
|
||||
static u32 latch_clr;
|
||||
void __iomem *base = ath79_gpio_base;
|
||||
unsigned long flags;
|
||||
u32 t;
|
||||
|
||||
spin_lock_irqsave(&lock, flags);
|
||||
|
||||
latch_set = (latch_set | mask_set) & ~mask_clr;
|
||||
latch_clr = (latch_clr | mask_clr) & ~mask_set;
|
||||
|
||||
mask_set = latch_set & (RB7XX_USB_POWERON | RB7XX_MONITOR);
|
||||
mask_clr = latch_clr & (RB7XX_USB_POWERON | RB7XX_MONITOR);
|
||||
|
||||
if ((latch_set ^ RB7XX_LED_ACT) & RB7XX_LED_ACT) {
|
||||
/* enable output mode */
|
||||
t = __raw_readl(base + AR71XX_GPIO_REG_OE);
|
||||
t |= RB7XX_LED_ACT;
|
||||
__raw_writel(t, base + AR71XX_GPIO_REG_OE);
|
||||
|
||||
mask_clr |= RB7XX_LED_ACT;
|
||||
} else {
|
||||
/* disable output mode */
|
||||
t = __raw_readl(base + AR71XX_GPIO_REG_OE);
|
||||
t &= ~RB7XX_LED_ACT;
|
||||
__raw_writel(t, base + AR71XX_GPIO_REG_OE);
|
||||
}
|
||||
|
||||
__raw_writel(mask_set, base + AR71XX_GPIO_REG_SET);
|
||||
__raw_writel(mask_clr, base + AR71XX_GPIO_REG_CLEAR);
|
||||
|
||||
spin_unlock_irqrestore(&lock, flags);
|
||||
}
|
||||
|
||||
static void __init rb750gr3_setup(void)
|
||||
{
|
||||
ath79_register_mdio(0, 0x0);
|
||||
mdiobus_register_board_info(rb750g3_mdio_info,
|
||||
ARRAY_SIZE(rb750g3_mdio_info));
|
||||
|
||||
ath79_init_mac(ath79_eth0_data.mac_addr, ath79_mac_base, 0);
|
||||
ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_RGMII;
|
||||
ath79_eth0_data.phy_mask = BIT(0);
|
||||
|
||||
ath79_register_eth(0);
|
||||
|
||||
rb750_leds_data.num_leds = ARRAY_SIZE(rb750gr3_leds);
|
||||
rb750_leds_data.leds = rb750gr3_leds;
|
||||
rb750_leds_data.latch_change = rb750gr3_latch_change;
|
||||
platform_device_register(&rb750_leds_device);
|
||||
|
||||
rb750_nand_data.nce_line = RB7XX_NAND_NCE;
|
||||
rb750_nand_data.enable_pins = rb750gr3_nand_enable_pins;
|
||||
rb750_nand_data.disable_pins = rb750gr3_nand_disable_pins;
|
||||
rb750_nand_data.latch_change = rb750gr3_latch_change;
|
||||
platform_device_register(&rb750_nand_device);
|
||||
}
|
||||
|
||||
MIPS_MACHINE(ATH79_MACH_RB_750G_R3, "750Gr3", "MikroTik RouterBOARD 750GL",
|
||||
rb750gr3_setup);
|
||||
|
|
|
@ -50,6 +50,16 @@
|
|||
#define RB750_LED_BITS (RB750_LED_PORT1 | RB750_LED_PORT2 | RB750_LED_PORT3 | \
|
||||
RB750_LED_PORT4 | RB750_LED_PORT5 | RB750_LED_ACT)
|
||||
|
||||
#define RB7XX_GPIO_NAND_NCE 0
|
||||
#define RB7XX_GPIO_MON 9
|
||||
#define RB7XX_GPIO_LED_ACT 11
|
||||
#define RB7XX_GPIO_USB_POWERON 13
|
||||
|
||||
#define RB7XX_NAND_NCE BIT(RB7XX_GPIO_NAND_NCE)
|
||||
#define RB7XX_LED_ACT BIT(RB7XX_GPIO_LED_ACT)
|
||||
#define RB7XX_MONITOR BIT(RB7XX_GPIO_MON)
|
||||
#define RB7XX_USB_POWERON BIT(RB7XX_GPIO_USB_POWERON)
|
||||
|
||||
struct rb750_led_data {
|
||||
char *name;
|
||||
char *default_trigger;
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
--- a/arch/mips/ath79/machtypes.h
|
||||
+++ b/arch/mips/ath79/machtypes.h
|
||||
@@ -51,6 +51,7 @@ enum ath79_mach_type {
|
||||
ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */
|
||||
ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */
|
||||
ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */
|
||||
+ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */
|
||||
ATH79_MACH_RW2458N, /* Redwave RW2458N */
|
||||
ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */
|
||||
ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */
|
||||
--- a/arch/mips/ath79/prom.c
|
||||
+++ b/arch/mips/ath79/prom.c
|
||||
@@ -180,6 +180,9 @@ void __init prom_init(void)
|
||||
ath79_prom_append_cmdline("board", env);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (strstr(arcs_cmdline, "board=750Gr3"))
|
||||
+ ath79_prom_append_cmdline("console", "ttyS0,115200");
|
||||
}
|
||||
|
||||
void __init prom_free_prom_memory(void)
|
|
@ -0,0 +1,22 @@
|
|||
--- a/arch/mips/ath79/machtypes.h
|
||||
+++ b/arch/mips/ath79/machtypes.h
|
||||
@@ -51,6 +51,7 @@ enum ath79_mach_type {
|
||||
ATH79_MACH_RB_493, /* Mikrotik RouterBOARD 493/493AH */
|
||||
ATH79_MACH_RB_493G, /* Mikrotik RouterBOARD 493G */
|
||||
ATH79_MACH_RB_750, /* MikroTik RouterBOARD 750 */
|
||||
+ ATH79_MACH_RB_750G_R3, /* MikroTik RouterBOARD 750GL */
|
||||
ATH79_MACH_RW2458N, /* Redwave RW2458N */
|
||||
ATH79_MACH_TEW_632BRP, /* TRENDnet TEW-632BRP */
|
||||
ATH79_MACH_TEW_673GRU, /* TRENDnet TEW-673GRU */
|
||||
--- a/arch/mips/ath79/prom.c
|
||||
+++ b/arch/mips/ath79/prom.c
|
||||
@@ -180,6 +180,9 @@ void __init prom_init(void)
|
||||
ath79_prom_append_cmdline("board", env);
|
||||
}
|
||||
}
|
||||
+
|
||||
+ if (strstr(arcs_cmdline, "board=750Gr3"))
|
||||
+ ath79_prom_append_cmdline("console", "ttyS0,115200");
|
||||
}
|
||||
|
||||
void __init prom_free_prom_memory(void)
|
Loading…
Reference in New Issue