summaryrefslogtreecommitdiff
path: root/target/linux/ar71xx
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2013-05-30 17:38:28 +0000
committerGabor Juhos <juhosg@openwrt.org>2013-05-30 17:38:28 +0000
commit151dca093597031aa940271f31ab63a30a78240a (patch)
tree898b8d7b22b13662e5ad901e368d2fa147c42b48 /target/linux/ar71xx
parenta1f91282b49b22fe845182d860319a75f0b84627 (diff)
downloadmtk-20170518-151dca093597031aa940271f31ab63a30a78240a.zip
mtk-20170518-151dca093597031aa940271f31ab63a30a78240a.tar.gz
mtk-20170518-151dca093597031aa940271f31ab63a30a78240a.tar.bz2
ar71xx: make the SFP port usable on RB2011*S boards
The port 6 of the switch is connected to the SFP cage on the RB2011*S boards. Add a helper function to correctly initialize the switch configuration data on those boards to make the SFP port usable. Signed-off-by: Gabor Juhos <juhosg@openwrt.org> SVN-Revision: 36799
Diffstat (limited to 'target/linux/ar71xx')
-rw-r--r--target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
index a6261d6..1966102 100644
--- a/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
+++ b/target/linux/ar71xx/files/arch/mips/ath79/mach-rb2011.c
@@ -37,6 +37,7 @@
#include "routerboot.h"
#define RB2011_GPIO_NAND_NCE 14
+#define RB2011_GPIO_SFP_LOS 21
#define RB_ROUTERBOOT_OFFSET 0x0000
#define RB_ROUTERBOOT_MIN_SIZE 0xb000
@@ -119,6 +120,9 @@ static struct ar8327_pad_cfg rb2011_ar8327_pad0_cfg = {
.rxclk_delay_sel = AR8327_CLK_DELAY_SEL0,
};
+static struct ar8327_pad_cfg rb2011_ar8327_pad6_cfg;
+static struct ar8327_sgmii_cfg rb2011_ar8327_sgmii_cfg;
+
static struct ar8327_led_cfg rb2011_ar8327_led_cfg = {
.led_ctrl0 = 0x0000c731,
.led_ctrl1 = 0x00000000,
@@ -231,6 +235,35 @@ static void __init rb2011_nand_init(void)
ath79_register_nfc();
}
+static int rb2011_get_port_link(unsigned port)
+{
+ if (port != 6)
+ return -EINVAL;
+
+ /* The Loss of signal line is active low */
+ return !gpio_get_value(RB2011_GPIO_SFP_LOS);
+}
+
+static void __init rb2011_sfp_init(void)
+{
+ gpio_request_one(RB2011_GPIO_SFP_LOS, GPIOF_IN, "SFP LOS");
+
+ rb2011_ar8327_pad6_cfg.mode = AR8327_PAD_MAC_SGMII;
+
+ rb2011_ar8327_data.pad6_cfg = &rb2011_ar8327_pad6_cfg;
+
+ rb2011_ar8327_sgmii_cfg.sgmii_ctrl = 0xc70167d0;
+ rb2011_ar8327_sgmii_cfg.serdes_aen = true;
+
+ rb2011_ar8327_data.sgmii_cfg = &rb2011_ar8327_sgmii_cfg;
+
+ rb2011_ar8327_data.port6_cfg.force_link = 1;
+ rb2011_ar8327_data.port6_cfg.speed = AR8327_PORT_SPEED_1000;
+ rb2011_ar8327_data.port6_cfg.duplex = 1;
+
+ rb2011_ar8327_data.get_port_link = rb2011_get_port_link;
+}
+
static void __init rb2011_setup(void)
{
rb2011_init_partitions();
@@ -271,6 +304,7 @@ MIPS_MACHINE(ATH79_MACH_RB_2011L, "2011L", "MikroTik RouterBOARD 2011L",
static void __init rb2011us_setup(void)
{
rb2011_setup();
+ rb2011_sfp_init();
}
MIPS_MACHINE(ATH79_MACH_RB_2011US, "2011US", "MikroTik RouterBOARD 2011UAS",
@@ -279,6 +313,7 @@ MIPS_MACHINE(ATH79_MACH_RB_2011US, "2011US", "MikroTik RouterBOARD 2011UAS",
static void __init rb2011g_setup(void)
{
rb2011_setup();
+ rb2011_sfp_init();
rb2011_wlan_init();
}