[OpenWrt-Devel] MAC swap handling for QCA8337N

Gareth Parker gareth41 at orcon.net.nz
Sat Apr 23 01:48:04 EDT 2016

First time posting to this list

I am adding support for the Comfast CF-WR650AC and have it working.  However
this router has a QCA8337N switch and MAC exchange needs to be enabled for
it to work properly or the router hangs and reboots when trying to access
anything switch related.

The problem is the QCA8337N in this device is not being enabled with MAC
exchange by default as it should be according to r47956.  There is no way to
manually enable either as was the case previously by using mac06_exchange_en
= true in the devices machine file.

I also have an EPG5000 with exactly the same switch type QCA8337N, this
device requires MAC exchange and previously had mac06_exchange_en = true in
its machine file, was removed in r47956 and I can confirm this device still
works no problem.

I changed the following so I could manually enable it and fix the problem.
It appears that the QCA8337N on at-least the CF-WR650AC is not automatically
enabled with MAC exchange for some reason.  If there is a better way I can
do this, please advise.


diff --git a/target/linux/generic/files/drivers/net/phy/ar8327.c
index d879782..3a84e2c 100644
--- a/target/linux/generic/files/drivers/net/phy/ar8327.c
+++ b/target/linux/generic/files/drivers/net/phy/ar8327.c
@@ -505,7 +505,7 @@ ar8327_hw_config_pdata(struct ar8xxx_priv *priv,
        data->port6_status = ar8327_get_port_init_status(&pdata->port6_cfg);

        t = ar8327_get_pad_cfg(pdata->pad0_cfg);
-       if (chip_is_ar8337(priv) && !pdata->pad0_cfg->mac06_exchange_dis)
+       if ((chip_is_ar8337(priv) || pdata->pad0_cfg->mac06_exchange_en) &&
            t |= AR8337_PAD_MAC06_EXCHANGE_EN;
        ar8xxx_write(priv, AR8327_REG_PAD0_MODE, t);

diff --git a/target/linux/generic/files/include/linux/ar8216_platform.h
index 24bc442..a8d37ca 100644
--- a/target/linux/generic/files/include/linux/ar8216_platform.h
+++ b/target/linux/generic/files/include/linux/ar8216_platform.h
@@ -47,6 +47,7 @@ struct ar8327_pad_cfg {
        bool sgmii_delay_en;
        enum ar8327_clk_delay_sel txclk_delay_sel;
        enum ar8327_clk_delay_sel rxclk_delay_sel;
+       bool mac06_exchange_en;
        bool mac06_exchange_dis;
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org

More information about the openwrt-devel mailing list