From: Sean Wang <sean.wang@mediatek.com>
By default, GMAC0 is connected to built-in switch called
MT7530 through the proprietary interface called Turbo RGMII
(TRGMII). TRGMII also supports well for RGMII as generic external
PHY uses but requires some slight changes to the setup of TRGMII
and doesn't have well support on current driver.
So this patchset
1) provides the slight changes of the setup for RGMII can work
through TRGMII
2) adds additional setting "trgmii" as PHY_INTERFACE_MODE_TRGMII
about phy-mode on device tree to make GMAC0 distinguish which
mode it runs
3) changes dynamically source clock, TX/RX delay and interface
mode on TRGMII for adapting various link
Changes since v1:
- fixed the style of comment which doesn't have a space at
the beginning and end of comment lines
- add support for phy-mode "trgmii" as PHY_INTERFACE_MODE_TRGMII
into linux/phy.h
- enhance the Documentation about device tree binding for trgmii
which is applicable only for GMAC0 which uses fixed-link
Sean Wang (3):
net: ethernet: mediatek: add extension of phy-mode for TRGMII
net: ethernet: mediatek: add support for GMAC0 connecting with
external PHY through TRGMII
net: ethernet: mediatek: add the dts property to set if TRGMII
supported on GMAC0
.../devicetree/bindings/net/mediatek-net.txt | 5 +++-
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 34 +++++++++++++++++++++-
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 34 +++++++++++++++++++++-
include/linux/phy.h | 3 ++
4 files changed, 73 insertions(+), 3 deletions(-)
--
1.9.1
From: Sean Wang <sean.wang@mediatek.com>
adds PHY-mode "trgmii" as an extension for the operation
mode of the PHY interface for PHY_INTERFACE_MODE_TRGMII.
and adds a variable trgmii inside mtk_mac as the indication
to make the difference between the MAC connected to internal
switch or connected to external PHY by the given configuration
on the board and then to perform the corresponding setup on
TRGMII hardware module.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +++
include/linux/phy.h | 3 +++
3 files changed, 8 insertions(+)
@@ -539,6 +541,7 @@ struct mtk_mac {structphy_device*phy_dev;__be32hwlro_ip[MTK_MAX_LRO_IP_CNT];inthwlro_ip_cnt;+booltrgmii;};/* the struct describing the SoC. these are declared in the soc_xyz.c files */
From: Sean Wang <sean.wang@mediatek.com>
Changing dynamically source clock, TX/RX delay and interface mode
used by TRGMII hardware module inside PHY capability polling routine
for adapting to the various speed of RGMII used by external PHY for
GMAC0.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 32 ++++++++++++++++++++++++++++-
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 31 +++++++++++++++++++++++++++-
2 files changed, 61 insertions(+), 2 deletions(-)
@@ -135,6 +135,33 @@ static int mtk_mdio_read(struct mii_bus *bus, int phy_addr, int phy_reg)return_mtk_mdio_read(eth,phy_addr,phy_reg);}+staticvoidmtk_gmac0_rgmii_adjust(structmtk_eth*eth,intspeed)+{+u32val;+intret;++val=(speed==SPEED_1000)?+INTF_MODE_RGMII_1000:INTF_MODE_RGMII_10_100;+mtk_w32(eth,val,INTF_MODE);++regmap_update_bits(eth->ethsys,ETHSYS_CLKCFG0,+ETHSYS_TRGMII_CLK_SEL362_5,+ETHSYS_TRGMII_CLK_SEL362_5);++val=(speed==SPEED_1000)?250000000:500000000;+ret=clk_set_rate(eth->clks[MTK_CLK_TRGPLL],val);+if(ret)+dev_err(eth->dev,"Failed to set trgmii pll: %d\n",ret);++val=(speed==SPEED_1000)?+RCK_CTRL_RGMII_1000:RCK_CTRL_RGMII_10_100;+mtk_w32(eth,val,TRGMII_RCK_CTRL);++val=(speed==SPEED_1000)?+TCK_CTRL_RGMII_1000:TCK_CTRL_RGMII_10_100;+mtk_w32(eth,val,TRGMII_TCK_CTRL);+}+staticvoidmtk_phy_link_adjust(structnet_device*dev){structmtk_mac*mac=netdev_priv(dev);
From: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
Add the dts property for the capability if TRGMII supported on GAMC0
Signed-off-by: Sean Wang <sean.wang-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
---
Documentation/devicetree/bindings/net/mediatek-net.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -31,7 +31,10 @@ Optional properties: Required properties: - compatible: Should be "mediatek,eth-mac" - reg: The number of the MAC-- phy-handle: see ethernet.txt file in the same directory.+- phy-handle: see ethernet.txt file in the same directory and+ the phy-mode "trgmii" required being provided when reg+ is equal to 0 and the MAC uses fixed-link to connect+ with inernal switch such as MT7530. Example:
Le 21/09/2016 à 19:33, sean.wang@mediatek.com a écrit :
From: Sean Wang <sean.wang@mediatek.com>
By default, GMAC0 is connected to built-in switch called
MT7530 through the proprietary interface called Turbo RGMII
(TRGMII). TRGMII also supports well for RGMII as generic external
PHY uses but requires some slight changes to the setup of TRGMII
and doesn't have well support on current driver.
So this patchset
1) provides the slight changes of the setup for RGMII can work
through TRGMII
2) adds additional setting "trgmii" as PHY_INTERFACE_MODE_TRGMII
about phy-mode on device tree to make GMAC0 distinguish which
mode it runs
3) changes dynamically source clock, TX/RX delay and interface
mode on TRGMII for adapting various link
Changes since v1:
- fixed the style of comment which doesn't have a space at
the beginning and end of comment lines
- add support for phy-mode "trgmii" as PHY_INTERFACE_MODE_TRGMII
into linux/phy.h
- enhance the Documentation about device tree binding for trgmii
which is applicable only for GMAC0 which uses fixed-link
Looks good to me:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Thanks Sean!
--
Florian
From: Sergei Shtylyov <hidden> Date: 2016-09-22 11:28:48
Hello.
On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
quoted hunk
From: Sean Wang <sean.wang@mediatek.com>
Add the dts property for the capability if TRGMII supported on GAMC0
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
Documentation/devicetree/bindings/net/mediatek-net.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -31,7 +31,10 @@ Optional properties: Required properties: - compatible: Should be "mediatek,eth-mac" - reg: The number of the MAC-- phy-handle: see ethernet.txt file in the same directory.+- phy-handle: see ethernet.txt file in the same directory and+ the phy-mode "trgmii" required being provided when reg
Since you've modified the generic parser of the "phy-mode" to add your "trgmii", you also need to update ethernet.txt...
+ is equal to 0 and the MAC uses fixed-link to connect
+ with inernal switch such as MT7530.
From: Sergei Shtylyov <hidden> Date: 2016-09-22 11:31:02
Hello.
On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
quoted hunk
From: Sean Wang <sean.wang@mediatek.com>
adds PHY-mode "trgmii" as an extension for the operation
mode of the PHY interface for PHY_INTERFACE_MODE_TRGMII.
and adds a variable trgmii inside mtk_mac as the indication
to make the difference between the MAC connected to internal
switch or connected to external PHY by the given configuration
on the board and then to perform the corresponding setup on
TRGMII hardware module.
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 ++
drivers/net/ethernet/mediatek/mtk_eth_soc.h | 3 +++
include/linux/phy.h | 3 +++
3 files changed, 8 insertions(+)
By default, GMAC0 is connected to built-in switch called
MT7530 through the proprietary interface called Turbo RGMII
(TRGMII). TRGMII also supports well for RGMII as generic external
PHY uses but requires some slight changes to the setup of TRGMII
and doesn't have well support on current driver.
So this patchset
1) provides the slight changes of the setup for RGMII can work
through TRGMII
2) adds additional setting "trgmii" as PHY_INTERFACE_MODE_TRGMII
about phy-mode on device tree to make GMAC0 distinguish which
mode it runs
3) changes dynamically source clock, TX/RX delay and interface
mode on TRGMII for adapting various link
Changes since v1:
- fixed the style of comment which doesn't have a space at
the beginning and end of comment lines
- add support for phy-mode "trgmii" as PHY_INTERFACE_MODE_TRGMII
into linux/phy.h
- enhance the Documentation about device tree binding for trgmii
which is applicable only for GMAC0 which uses fixed-link
Hello.
On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
quoted
From: Sean Wang <sean.wang@mediatek.com>
Add the dts property for the capability if TRGMII supported on GAMC0
Signed-off-by: Sean Wang <sean.wang@mediatek.com>
---
Documentation/devicetree/bindings/net/mediatek-net.txt | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
@@ -31,7 +31,10 @@ Optional properties: Required properties: - compatible: Should be "mediatek,eth-mac" - reg: The number of the MAC-- phy-handle: see ethernet.txt file in the same directory.+- phy-handle: see ethernet.txt file in the same directory and+ the phy-mode "trgmii" required being provided when reg
Since you've modified the generic parser of the "phy-mode" to add your
"trgmii", you also need to update ethernet.txt...
quoted
+ is equal to 0 and the MAC uses fixed-link to connect
+ with inernal switch such as MT7530.
Internal.
thank you for taking time and effort to review this
I will fix it up
From: Sergei Shtylyov <hidden> Date: 2016-09-22 17:08:53
Hello.
On 09/22/2016 03:22 PM, David Miller wrote:
quoted
By default, GMAC0 is connected to built-in switch called
MT7530 through the proprietary interface called Turbo RGMII
(TRGMII). TRGMII also supports well for RGMII as generic external
PHY uses but requires some slight changes to the setup of TRGMII
and doesn't have well support on current driver.
So this patchset
1) provides the slight changes of the setup for RGMII can work
through TRGMII
2) adds additional setting "trgmii" as PHY_INTERFACE_MODE_TRGMII
about phy-mode on device tree to make GMAC0 distinguish which
mode it runs
3) changes dynamically source clock, TX/RX delay and interface
mode on TRGMII for adapting various link
Changes since v1:
- fixed the style of comment which doesn't have a space at
the beginning and end of comment lines
- add support for phy-mode "trgmii" as PHY_INTERFACE_MODE_TRGMII
into linux/phy.h
- enhance the Documentation about device tree binding for trgmii
which is applicable only for GMAC0 which uses fixed-link
On 9/22/2016 5:33 AM, sean.wang@mediatek.com wrote:
quoted
From: Sean Wang <sean.wang@mediatek.com>
adds PHY-mode "trgmii" as an extension for the operation mode of the
PHY interface for PHY_INTERFACE_MODE_TRGMII.
.. deleted
quoted
switch (of_get_phy_mode(np)) {+ case PHY_INTERFACE_MODE_TRGMII:+ mac->trgmii = true; case PHY_INTERFACE_MODE_RGMII_TXID: case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_ID:
From: Sergei Shtylyov <hidden> Date: 2016-09-23 10:19:58
Hello.
On 9/23/2016 6:32 AM, Sean Wang wrote:
quoted
quoted
From: Sean Wang <sean.wang@mediatek.com>
adds PHY-mode "trgmii" as an extension for the operation mode of the
PHY interface for PHY_INTERFACE_MODE_TRGMII.
.. deleted
What? Why?
quoted
quoted
switch (of_get_phy_mode(np)) {+ case PHY_INTERFACE_MODE_TRGMII:+ mac->trgmii = true; case PHY_INTERFACE_MODE_RGMII_TXID: case PHY_INTERFACE_MODE_RGMII_RXID: case PHY_INTERFACE_MODE_RGMII_ID: