[PATCH] net: ethernet: mediatek: enhance the locking using the lightweight ones

2016-08-11 Thread sean.wang
From: Sean Wang Since these critical sections protected by page_lock are all entered from the user context or bottom half context, they can be replaced with the spin_lock() or spin_lock_bh instead of spin_lock_irqsave(). Signed-off-by: Sean Wang

[PATCH net v4 5/9] net: ethernet: mediatek: fix logic unbalance between probe and remove

2016-08-31 Thread sean.wang
From: Sean Wang original mdio_cleanup is not in the symmetric place against where mdio_init is, so relocate mdio_cleanup to the right one. Signed-off-by: Sean Wang Acked-by: John Crispin ---

[PATCH net v4 8/9] net: ethernet: mediatek: use devm_mdiobus_alloc instead of mdiobus_alloc inside mtk_mdio_init

2016-08-31 Thread sean.wang
From: Sean Wang a lot of parts in the driver uses devm_* APIs to gain benefits from the device resource management, so devm_mdiobus_alloc is also used instead of mdiobus_alloc to have more elegant code flow. Using common code provided by the devm_* helps to 1) have

[PATCH net v4 9/9] net: ethernet: mediatek: fix error handling inside mtk_mdio_init

2016-08-31 Thread sean.wang
From: Sean Wang Return -ENODEV if the MDIO bus is disabled in the device tree. Signed-off-by: Sean Wang Acked-by: John Crispin Reviewed-by: Andrew Lunn --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1

[PATCH net v4 3/9] net: ethernet: mediatek: fix API usage with skb_free_frag

2016-08-31 Thread sean.wang
From: Sean Wang use skb_free_frag() instead of legacy put_page() Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH net v4 1/9] net: ethernet: mediatek: fix fails from TX housekeeping due to incorrect port setup

2016-08-31 Thread sean.wang
From: Sean Wang which net device the SKB is complete for depends on the forward port on txd4 on the corresponding TX descriptor, but the information isn't set up well in case of SKB fragments that would lead to watchdog timeout from the upper layer, so fix it up.

[PATCH net v4 6/9] net: ethernet: mediatek: fix issue of driver removal with interface is up

2016-08-31 Thread sean.wang
From: Sean Wang mtk_stop() must be called to stop for freeing DMA resources acquired and restoring state changed by mtk_open() firstly when module removal. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 1

[PATCH net v4 4/9] net: ethernet: mediatek: remove redundant free_irq for devm_request_irq allocated irq

2016-08-31 Thread sean.wang
From: Sean Wang these irqs are not used for shared irq and disabled during ethernet stops. irq requested by devm_request_irq is safe to be freed automatically on driver detach. Signed-off-by: Sean Wang Acked-by: John Crispin

[PATCH net v4 2/9] net: ethernet: mediatek: fix incorrect return value of devm_clk_get with EPROBE_DEFER

2016-08-31 Thread sean.wang
From: Sean Wang 1) If the return value of devm_clk_get is EPROBE_DEFER, we should defer probing the driver. The change is verified and works based on 4.8-rc1 staying with the latest clk-next code for MT7623. 2) Changing with the usage of loops to work out if all clocks

[PATCH net v4 0/9] net: ethernet: mediatek: a couple of fixes

2016-08-31 Thread sean.wang
From: Sean Wang a couple of fixes come out from integrating with linux-4.8 rc1 they all are verified and workable on linux-4.8 rc1 Changes since v1: - usage of loops to work out if all required clock are ready instead of tedious coding - remove redundant pinctrl setup

[PATCH net v4 7/9] net: ethernet: mediatek: fix the missing of_node_put() after node is used done inside mtk_mdio_init

2016-08-31 Thread sean.wang
From: Sean Wang This patch adds the missing of_node_put() after finishing the usage of of_get_child_by_name. Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + 1 file

[PATCH net-next v3 0/2] net: ethernet: mediatek: add enhancements to RX path

2016-09-02 Thread sean.wang
From: Sean Wang Changes since v1: - fix message typos and add coverletter Changes since v2: - split from the previous series for submitting add enhancements as a series targeting 'net-next' and add indents before comments. Changes since v3: - merge the patch using

[PATCH net-next v3 1/2] net: ethernet: mediatek: enhance RX path by reducing the frequency of the memory barrier used

2016-09-02 Thread sean.wang
From: Sean Wang The patch makes move wmb() to outside the loop that could help RX path handling more faster although that RX descriptors aren't freed for DMA to use as soon as possible, but based on my experiment and the result shows it still can reach about 943Mbpis

[PATCH net-next v3 2/2] net: ethernet: mediatek: enhance RX path by aggregating more SKBs into NAPI

2016-09-02 Thread sean.wang
From: Sean Wang The patch adds support for aggregating more SKBs feed into NAPI in order to get more benefits from generic receive offload (GRO) by peeking at the RX ring status and moving more packets right before returning from NAPI RX polling handler if NAPI budgets

[PATCH net-next v4 1/2] net: ethernet: mediatek: enhance RX path by reducing the frequency of the memory barrier used

2016-09-02 Thread sean.wang
From: Sean Wang The patch makes move wmb() to outside the loop that could help RX path handling more faster although that RX descriptors aren't freed for DMA to use as soon as possible, but based on my experiment and the result shows it still can reach about 943Mbpis

[PATCH net-next v4 2/2] net: ethernet: mediatek: enhance RX path by aggregating more SKBs into NAPI

2016-09-02 Thread sean.wang
From: Sean Wang The patch adds support for aggregating more SKBs feed into NAPI in order to get more benefits from generic receive offload (GRO) by peeking at the RX ring status and moving more packets right before returning from NAPI RX polling handler if NAPI budgets

[PATCH net-next v4 0/2] net: ethernet: mediatek: add enhancements to RX path

2016-09-02 Thread sean.wang
From: Sean Wang Changes since v1: - fix message typos and add coverletter Changes since v2: - split from the previous series for submitting add enhancements as a series targeting 'net-next' and add indents before comments. Changes since v3: - merge the patch using

[PATCH net-next v5 2/2] net: ethernet: mediatek: enhance RX path by aggregating more SKBs into NAPI

2016-09-03 Thread sean.wang
From: Sean Wang The patch adds support for aggregating more SKBs feed into NAPI in order to get more benefits from generic receive offload (GRO) by peeking at the RX ring status and moving more packets right before returning from NAPI RX polling handler if NAPI budgets

[PATCH net-next v5 1/2] net: ethernet: mediatek: enhance RX path by reducing the frequency of the memory barrier used

2016-09-03 Thread sean.wang
From: Sean Wang The patch makes move wmb() to outside the loop that could help RX path handling more faster although that RX descriptors aren't freed for DMA to use as soon as possible, but based on my experiment and the result shows it still can reach about 943Mbpis

[PATCH net-next v5 0/2] net: ethernet: mediatek: add enhancements to RX path

2016-09-03 Thread sean.wang
From: Sean Wang Changes since v1: - fix message typos and add coverletter Changes since v2: - split from the previous series for submitting add enhancements as a series targeting 'net-next' and add indents before comments. Changes since v3: - merge the patch using

[PATCH net v3 3/9] net: ethernet: mediatek: fix API usage with skb_free_frag

2016-08-29 Thread sean.wang
From: Sean Wang use skb_free_frag() instead of legacy put_page() Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH net v3 6/9] net: ethernet: mediatek: fix issue of driver removal with interface is up

2016-08-29 Thread sean.wang
From: Sean Wang mtk_stop() must be called to stop for freeing DMA resources acquired and restoring state changed by mtk_open() firstly when module removal. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 1

[PATCH net v3 9/9] net: ethernet: mediatek: fix error handling inside mtk_mdio_init

2016-08-29 Thread sean.wang
From: Sean Wang Return -ENODEV if the MDIO bus is disabled in the device tree. Signed-off-by: Sean Wang Acked-by: John Crispin Reviewed-by: Andrew Lunn --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1

[PATCH net v3 4/9] net: ethernet: mediatek: remove redundant free_irq for devm_request_irq allocated irq

2016-08-29 Thread sean.wang
From: Sean Wang these irqs are not used for shared irq and disabled during ethernet stops. irq requested by devm_request_irq is safe to be freed automatically on driver detach. Signed-off-by: Sean Wang Acked-by: John Crispin

[PATCH net v3 0/9] net: ethernet: mediatek: a couple of fixes

2016-08-29 Thread sean.wang
From: Sean Wang a couple of fixes come out from integrating with linux-4.8 rc1 they all are verified and workable on linux-4.8 rc1 Changes since v1: - usage of loops to work out if all required clock are ready instead of tedious coding - remove redundant pinctrl setup

[PATCH net v3 2/9] net: ethernet: mediatek: fix incorrect return value of devm_clk_get with EPROBE_DEFER

2016-08-29 Thread sean.wang
From: Sean Wang 1) If the return value of devm_clk_get is EPROBE_DEFER, we should defer probing the driver. The change is verified and works based on 4.8-rc1 staying with the latest clk-next code for MT7623. 2) Changing with the usage of loops to work out if all clocks

[PATCH net v3 8/9] net: ethernet: mediatek: use devm_mdiobus_alloc instead of mdiobus_alloc inside mtk_mdio_init

2016-08-29 Thread sean.wang
From: Sean Wang a lot of parts in the driver uses devm_* APIs to gain benefits from the device resource management, so devm_mdiobus_alloc is also used instead of mdiobus_alloc to have more elegant code flow. Using common code provided by the devm_* helps to 1) have

[PATCH net v3 7/9] net: ethernet: mediatek: fix the missing of_node_put() after node is used done inside mtk_mdio_init

2016-08-29 Thread sean.wang
From: Sean Wang This patch adds the missing of_node_put() after finishing the usage of of_get_child_by_name. Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + 1 file

[PATCH net v3 1/9] net: ethernet: mediatek: fix fails from TX housekeeping due to incorrect port setup

2016-08-29 Thread sean.wang
From: Sean Wang which net device the SKB is complete for depends on the forward port on txd4 on the corresponding TX descriptor, but the information isn't set up well in case of SKB fragments that would lead to watchdog timeout from the upper layer, so fix it up.

[PATCH net v3 5/9] net: ethernet: mediatek: fix logic unbalance between probe and remove

2016-08-29 Thread sean.wang
From: Sean Wang original mdio_cleanup is not in the symmetric place against where mdio_init is, so relocate mdio_cleanup to the right one. Signed-off-by: Sean Wang Acked-by: John Crispin ---

[PATCH net] net: ethernet: mediatek: fix module loading automatically based on MODULE_DEVICE_TABLE

2016-09-14 Thread sean.wang
From: Sean Wang The device table is required to load modules based on modaliases. After adding MODULE_DEVICE_TABLE, below entries for example will be added to modules.alias: alias of:N*T*Cmediatek,mt7623-ethC* mtk_eth_soc Signed-off-by: Sean Wang

[PATCH net-next v2 6/7] net: ethernet: mediatek: add more resets for internal ethernet circuit block

2016-09-14 Thread sean.wang
From: Sean Wang struct mtk_eth has already contained struct regmap ethsys pointer to the address range of the internal circuit reset, so we reuse it to reset more internal blocks on ethernet hardware such as packet processing engine (PPE) and frame engine (FE) instead of

[PATCH net-next v2 4/7] net: ethernet: mediatek: add controlling power domain the ethernet belongs to

2016-09-14 Thread sean.wang
From: Sean Wang introduce power domain control which the digital circuit of the ethernet belongs to inside the flow of hardware initialization and deinitialization which helps the entire ethernet hardware block could restart cleanly and completely as being back to the

[PATCH net-next v2 2/7] net: ethernet: mediatek: add mtk_hw_deinit call as the opposite to mtk_hw_init call

2016-09-14 Thread sean.wang
From: Sean Wang grouping things related to the deinitialization of what mtk_hw_init call does that help to be reused by the reset process and the error path handling. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 15

[PATCH net-next v2 1/7] net: ethernet: mediatek: refactoring mtk_hw_init to be reused

2016-09-14 Thread sean.wang
From: Sean Wang the existing mtk_hw_init includes hardware and software initialization inside so that it is slightly hard to reuse them for the process of the reset recovery, so some splitting is made here for keeping hardware initializing relevant thing and the else such

[PATCH net-next v2 0/7] add enhancement into the existing reset flow

2016-09-14 Thread sean.wang
From: Sean Wang Current driver only resets DMA used by descriptor rings which can't guarantee it can recover all various kinds of fatal errors, so the patch 1) tries to reset the underlying hardware resource from scratch on Mediatek SoC required for ethernet running. 2)

[PATCH net-next v2 3/7] net: ethernet: mediatek: cleanup error path inside mtk_hw_init

2016-09-14 Thread sean.wang
From: Sean Wang This cleans up the error path inside mtk_hw_init call, causing it able to exit appropriately when something fails and also includes refactoring mtk_cleanup call to make the partial logic reusable on the error path. Signed-off-by: Sean Wang

[PATCH net-next v2 5/7] net: ethernet: mediatek: add the whole ethernet reset into the reset process

2016-09-14 Thread sean.wang
From: Sean Wang 1) original driver only resets DMA used by descriptor rings which can't guarantee it can recover all various kinds of fatal errors, so the patch tries to reset the underlying hardware resource from scratch on Mediatek SoC required for ethernet running,

[PATCH net-next v2 7/7] net: ethernet: mediatek: avoid race condition during the reset process

2016-09-14 Thread sean.wang
From: Sean Wang add the protection of the race condition between the reset process and hardware access happening on the related callbacks. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 36

[PATCH net-next 7/7] net: ethernet: mediatek: avoid race condition during the reset process

2016-09-13 Thread sean.wang
From: Sean Wang add the protection of the race condition between the reset process and hardware access happening on the related callbacks. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 36

[PATCH net-next 3/7] net: ethernet: mediatek: cleanup error path inside mtk_hw_init

2016-09-13 Thread sean.wang
From: Sean Wang This cleans up the error path inside mtk_hw_init call, causing it able to exit appropriately when something fails and also includes refactoring mtk_cleanup call to make the partial logic reusable on the error path. Signed-off-by: Sean Wang

[PATCH net-next 6/7] net: ethernet: mediatek: add more resets for internal ethernet circuit block

2016-09-13 Thread sean.wang
From: Sean Wang struct mtk_eth has already contained struct regmap ethsys pointer to the address range of the internal circuit reset, so we reuse it to reset more internal blocks on ethernet hardware such as packet processing engine (PPE) and frame engine (FE) instead of

[PATCH net-next 5/7] net: ethernet: mediatek: add the whole ethernet reset into the reset process

2016-09-13 Thread sean.wang
From: Sean Wang 1) original driver only resets DMA used by descriptor rings which can't guarantee it can recover all various kinds of fatal errors, so the patch tries to reset the underlying hardware resource from scratch on Mediatek SoC required for ethernet running,

[PATCH net-next 4/7] net: ethernet: mediatek: add controlling power domain the ethernet belongs to

2016-09-13 Thread sean.wang
From: Sean Wang introduce power domain control which the digital circuit of the ethernet belongs to inside the flow of hardware initialization and deinitialization which helps the entire ethernet hardware block could restart cleanly and completely as being back to the

[PATCH net-next 1/7] net: ethernet: mediatek: refactoring mtk_hw_init to be reused

2016-09-13 Thread sean.wang
From: Sean Wang the existing mtk_hw_init includes hardware and software initialization inside so that it is slightly hard to reuse them for the process of the reset recovery, so some splitting is made here for keeping hardware initializing relevant thing and the else such

[PATCH net-next 0/7] add enhancement into the existing reset flow

2016-09-13 Thread sean.wang
From: Sean Wang Current driver only resets DMA used by descriptor rings which can't guarantee it can recover all various kinds of fatal errors, so the patch 1) tries to reset the underlying hardware resource from scratch on Mediatek SoC required for ethernet running. 2)

[PATCH net-next 2/7] net: ethernet: mediatek: add mtk_hw_deinit call as the opposite to mtk_hw_init call

2016-09-13 Thread sean.wang
From: Sean Wang grouping things related to the deinitialization of what mtk_hw_init call does that help to be reused by the reset process and the error path handling. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 15

[PATCH net-next] net: ethernet: mediatek: fix missing changes merged for conflicts overlapping commits

2016-09-20 Thread sean.wang
From: Sean Wang add the missing commits about 1) Commit d3bd1ce4db8e843dce421e2f8f123e5251a9c7d3 ("remove redundant free_irq for devm_request_ir allocated irq") 2) Commit 7c6b0d76fa02213393815e3b6d5e4a415bf3f0e2 ("fix logic unbalance between probe and remove") during

[PATCH net-next] net: ethernet: mediatek: enhance with avoiding superfluous assignment inside mtk_get_ethtool_stats

2016-09-19 Thread sean.wang
From: Sean Wang data_src is unchanged inside the loop, so this patch moves the assignment to outside the loop to avoid unnecessarily assignment Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 3 ++- 1 file changed, 2

[PATCH net-next 0/3] add support for RGMII on GMAC0 through TRGMII hardware module

2016-09-20 Thread sean.wang
From: Sean Wang 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

[PATCH net-next 3/3] net: ethernet: mediatek: add the dts property to set if TRGMII supported on GMAC0

2016-09-20 Thread sean.wang
From: Sean Wang Add the dts property for the capability if TRGMII supported on GAMC0 Signed-off-by: Sean Wang --- Documentation/devicetree/bindings/net/mediatek-net.txt | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[PATCH net-next 2/3] net: ethernet: mediatek: add support for GMAC0 connecting with external PHY through TRGMII

2016-09-20 Thread sean.wang
From: Sean Wang 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

[PATCH net-next 1/3] net: ethernet: mediatek: add extension of phy-mode for TRGMII

2016-09-20 Thread sean.wang
From: Sean Wang adds PHY-mode "trgmii" as an extension for the operation mode of the PHY interface, TRGMII can be compatible with RGMII, so the extended mode doesn't really have effects on the target MAC and PHY, is used as the indication if the current MAC is connected

[PATCH net-next v2] Documentation: devicetree: revise ethernet device-tree binding about TRGMII

2016-09-23 Thread sean.wang
From: Sean Wang add phy-mode "trgmii" to Documentation/devicetree/bindings/net/ethernet.txt Cc: devicet...@vger.kernel.org Reported-by: Sergei Shtylyov Signed-off-by: Sean Wang ---

[PATCH net-next] Documentation: devicetree: fix typo in MediaTek ethernet device-tree binding

2016-09-23 Thread sean.wang
From: Sean Wang fix typo in Documentation/devicetree/bindings/net/mediatek-net.txt Cc: devicet...@vger.kernel.org Reported-by: Sergei Shtylyov Signed-off-by: Sean Wang ---

[PATCH net-next v2 0/3] add support for RGMII on GMAC0 through TRGMII hardware module

2016-09-21 Thread sean.wang
From: Sean Wang 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

[PATCH net-next v2 3/3] net: ethernet: mediatek: add the dts property to set if TRGMII supported on GMAC0

2016-09-21 Thread sean.wang
From: Sean Wang Add the dts property for the capability if TRGMII supported on GAMC0 Signed-off-by: Sean Wang --- Documentation/devicetree/bindings/net/mediatek-net.txt | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git

[PATCH net-next v2 1/3] net: ethernet: mediatek: add extension of phy-mode for TRGMII

2016-09-21 Thread sean.wang
From: Sean Wang 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

[PATCH net-next v2 2/3] net: ethernet: mediatek: add support for GMAC0 connecting with external PHY through TRGMII

2016-09-21 Thread sean.wang
From: Sean Wang 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

[PATCH net-next] net: ethernet: mediatek: remove superfluous local variable for phy address

2016-09-22 Thread sean.wang
From: Sean Wang remove the unused variable for parsing PHY address and the related logic for sanity test which would be all already handled done when of_mdiobus_register was called Reported-by: Nelson Chang Signed-off-by: Sean Wang

[PATCH net-next] net: ethernet: mediatek: get out of potential invalid pointer access

2016-09-22 Thread sean.wang
From: Sean Wang Potential dangerous invalid pointer might be accessed if the error happens when couple phy_device to net_device so cleanup the error path. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 -- 1

[PATCH net-next] net: ethernet: mediatek: use [get|set]_link_ksettings

2016-09-22 Thread sean.wang
From: Sean Wang 1) use new api [get|set]_link_ksettings instead of [get|set]_settings old ones. 2) dev->phydev is sure being ready before calling these callbacks, so removing all the sanity check if it is existing. Signed-off-by: Sean Wang ---

[PATCH net-next] net: ethernet: mediatek: use phydev from struct net_device

2016-09-22 Thread sean.wang
From: Sean Wang reuse phydev already in struct net_device instead of creating another new one in private structure. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 73 ++---

[PATCH net-next] Documentation: devicetree: revise ethernet device-tree binding about TRGMII

2016-09-22 Thread sean.wang
From: Sean Wang fix typo in mediatek-net.txt and add phy-mode "trgmii" to ethernet.txt Cc: devicet...@vger.kernel.org Reported-by: Sergei Shtylyov Signed-off-by: Sean Wang ---

[PATCH net v2 3/9] net: ethernet: mediatek: fix API usage with skb_free_frag

2016-08-28 Thread sean.wang
From: Sean Wang use skb_free_frag() instead of legacy put_page() Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH net v2 6/9] net: ethernet: mediatek: fix issue of driver removal with interface is up

2016-08-28 Thread sean.wang
From: Sean Wang mtk_stop() must be called to stop for freeing DMA resources acquired and restoring state changed by mtk_open() firstly when module removal. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 8 1

[PATCH net v2 8/9] net: ethernet: mediatek: use devm_mdiobus_alloc instead of mdiobus_alloc inside mtk_mdio_init

2016-08-28 Thread sean.wang
From: Sean Wang a lot of parts in the driver uses devm_* APIs to gain benefits from the device resource management, so devm_mdiobus_alloc is also used instead of mdiobus_alloc to have more elegant code flow. Using common code provided by the devm_* helps to 1) have

[PATCH net v2 5/9] net: ethernet: mediatek: fix logic unbalance between probe and remove

2016-08-28 Thread sean.wang
From: Sean Wang original mdio_cleanup is not in the symmetric place against where mdio_init is, so relocate mdio_cleanup to the right one. Signed-off-by: Sean Wang Acked-by: John Crispin ---

[PATCH net v2 2/9] net: ethernet: mediatek: fix incorrect return value of devm_clk_get with EPROBE_DEFER

2016-08-28 Thread sean.wang
From: Sean Wang 1) If the return value of devm_clk_get is EPROBE_DEFER, we should defer probing the driver. The change is verified and works based on 4.8-rc1 staying with the latest clk-next code for MT7623. 2) Changing with the usage of loops to work out if all clocks

[PATCH net v2 1/9] net: ethernet: mediatek: fix fails from TX housekeeping due to incorrect port setup

2016-08-28 Thread sean.wang
From: Sean Wang which net device the SKB is complete for depends on the forward port on txd4 on the corresponding TX descriptor, but the information isn't set up well in case of SKB fragments that would lead to watchdog timeout from the upper layer, so fix it up.

[PATCH net v2 9/9] net: ethernet: mediatek: fix error handling inside mtk_mdio_init

2016-08-28 Thread sean.wang
From: Sean Wang return -ENODEV if no child is found in MDIO bus. Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git

[PATCH net v2 7/9] net: ethernet: mediatek: fix the missing of_node_put() after node is used done inside mtk_mdio_init

2016-08-28 Thread sean.wang
From: Sean Wang This patch adds the missing of_node_put() after finishing the usage of of_get_child_by_name. Signed-off-by: Sean Wang Acked-by: John Crispin --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 1 + 1 file

[PATCH net v2 4/9] net: ethernet: mediatek: remove redundant free_irq for devm_request_irq allocated irq

2016-08-28 Thread sean.wang
From: Sean Wang these irqs are not used for shared irq and disabled during ethernet stops. irq requested by devm_request_irq is safe to be freed automatically on driver detach. Signed-off-by: Sean Wang Acked-by: John Crispin

[PATCH net v2 0/9] net: ethernet: mediatek: a couple of fixes

2016-08-28 Thread sean.wang
From: Sean Wang a couple of fixes come out from integrating with linux-4.8 rc1 they all are verified and workable on linux-4.8 rc1 changes since v1: - usage of loops to work out if all required clock are ready instead of tedious coding - remove redundant pinctrl setup

Re: [RESEND PATCH net 09/10] net: ethernet: mediatek: use devm_mdiobus_alloc instead of mdiobus_alloc inside mtk_mdio_init

2016-08-26 Thread sean.wang
On Date: Thu, 25 Aug 2016 15:39:08 +0200, John Crispin wrote: >Hi Sean, > >small nitpick inline > >On 25/08/2016 12:45, Sean Wang wrote: >> a lot of parts in the driver uses devm_* APIs to gain benefits from the >> -eth->mii_bus = mdiobus_alloc(); >> +eth->mii_bus =

[PATCH net-next v3 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-29 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N platform which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the

[PATCH net-next v3 1/5] dt-bindings: net: dsa: add Mediatek MT7530 binding

2017-03-29 Thread sean.wang
From: Sean Wang Add device-tree binding for Mediatek MT7530 switch. Cc: devicet...@vger.kernel.org Signed-off-by: Sean Wang Acked-by: Rob Herring --- .../devicetree/bindings/net/dsa/mt7530.txt | 92

[PATCH net-next v3 0/5] net-next: dsa: add Mediatek MT7530 support

2017-03-29 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the user ports

[PATCH net-next v3 3/5] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA

2017-03-29 Thread sean.wang
From: Sean Wang The patch adds the setup for allowing CDM can recognize these packets with carrying port-distinguishing tag. Otherwise, these tagging packets will be handled incorrectly by CDM. The setup is also working out for general untag packets as well.

[PATCH net-next v3 2/5] net-next: dsa: add Mediatek tag RX/TX handler

2017-03-29 Thread sean.wang
From: Sean Wang Add the support for the 4-bytes tag for DSA port distinguishing inserted allowing receiving and transmitting the packet via the particular port. The tag is being added after the source MAC address in the ethernet header. Signed-off-by: Sean Wang

[PATCH net-next v3 4/5] net-next: ethernet: mediatek: add device_node of GMAC pointing into the netdev instance

2017-03-29 Thread sean.wang
From: Sean Wang the patch adds the setup of the corresponding device node of GMAC into the netdev instance which could allow other modules such as DSA to find the instance through the node in dt-bindings using of_find_net_device_by_node() call. Signed-off-by: Sean Wang

[PATCH net-next v2 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-03-21 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N platform which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the

[PATCH net-next v2 1/5] dt-bindings: net: dsa: add Mediatek MT7530 binding

2017-03-21 Thread sean.wang
From: Sean Wang Add device-tree binding for Mediatek MT7530 switch. Cc: devicet...@vger.kernel.org Signed-off-by: Sean Wang --- .../devicetree/bindings/net/dsa/mt7530.txt | 92 ++ 1 file changed, 92 insertions(+)

[PATCH net-next v2 2/5] net-next: dsa: add Mediatek tag RX/TX handler

2017-03-21 Thread sean.wang
From: Sean Wang Add the support for the 4-bytes tag for DSA port distinguishing inserted allowing receiving and transmitting the packet via the particular port. The tag is being added after the source MAC address in the ethernet header. Signed-off-by: Sean Wang

[PATCH net-next v2 3/5] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA

2017-03-21 Thread sean.wang
From: Sean Wang The patch adds the setup for allowing CDM can recognize these packets with carrying port-distinguishing tag. Otherwise, these tagging packets will be handled incorrectly by CDM. The setup is working out for general untag packets as well. Signed-off-by:

[PATCH net-next v2 4/5] net-next: ethernet: mediatek: add device_node of GMAC pointing into the netdev instance

2017-03-21 Thread sean.wang
From: Sean Wang the patch adds the setup of the corresponding device node of GMAC into the netdev instance which could allow other modules such as DSA to find the instance through the node in dt-bindings using of_find_net_device_by_node() call. Signed-off-by: Sean Wang

[PATCH net-next v2 0/5] net-next: dsa: add Mediatek MT7530 support

2017-03-21 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the user ports

[PATCH net-next v4 5/5] net-next: dsa: add dsa support for Mediatek MT7530 switch

2017-04-07 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N platform which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the

[PATCH net-next v4 4/5] net-next: ethernet: mediatek: add device_node of GMAC pointing into the netdev instance

2017-04-07 Thread sean.wang
From: Sean Wang the patch adds the setup of the corresponding device node of GMAC into the netdev instance which could allow other modules such as DSA to find the instance through the node in dt-bindings using of_find_net_device_by_node() call. Signed-off-by: Sean Wang

[PATCH net-next v4 1/5] dt-bindings: net: dsa: add Mediatek MT7530 binding

2017-04-07 Thread sean.wang
From: Sean Wang Add device-tree binding for Mediatek MT7530 switch. Cc: devicet...@vger.kernel.org Signed-off-by: Sean Wang Acked-by: Rob Herring --- .../devicetree/bindings/net/dsa/mt7530.txt | 92

[PATCH net-next v4 0/5] net-next: dsa: add Mediatek MT7530 support

2017-04-07 Thread sean.wang
From: Sean Wang MT7530 is a 7-ports Gigabit Ethernet Switch that could be found on Mediatek router platforms such as MT7623A or MT7623N which includes 7-port Gigabit Ethernet MAC and 5-port Gigabit Ethernet PHY. Among these ports, The port from 0 to 4 are the user ports

[PATCH net-next v4 3/5] net-next: ethernet: mediatek: add CDM able to recognize the tag for DSA

2017-04-07 Thread sean.wang
From: Sean Wang The patch adds the setup for allowing CDM can recognize these packets with carrying port-distinguishing tag. Otherwise, these tagging packets will be handled incorrectly by CDM. The setup is also working out for general untag packets as well.

[PATCH net-next v4 2/5] net-next: dsa: add Mediatek tag RX/TX handler

2017-04-07 Thread sean.wang
From: Sean Wang Add the support for the 4-bytes tag for DSA port distinguishing inserted allowing receiving and transmitting the packet via the particular port. The tag is being added after the source MAC address in the ethernet header. Signed-off-by: Sean Wang

[PATCH net 1/2] net: ethernet: mediatek: fix inconsistency between TXD and the used buffer

2017-04-11 Thread sean.wang
From: Sean Wang Fix inconsistency between the TXD descriptor and the used buffer that would cause unexpected logic at mtk_tx_unmap() during skb housekeeping. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 17

[PATCH net 0/2] Fix crash caused by reporting inconsistent skb->len to BQL

2017-04-11 Thread sean.wang
From: Sean Wang The series fixes kernel BUG caused by inconsistent SKB length reported into BQL. The reason for inconsistent length comes from hardware BUG which results in different port number carried on the TXD within the lifecycle of SKB. So patch 2) is proposed for

[PATCH net 2/2] net: ethernet: mediatek: fix inconsistency of port number carried in TXD

2017-04-11 Thread sean.wang
From: Sean Wang Fix port inconsistency on TXD due to hardware BUG that would cause different port number is carried on the same TXD between tx_map() and tx_unmap() with the iperf test. It would cause confusing BQL logic which leads to kernel panic when dual GMAC runs

[PATCH net-next] net: ethernet: mediatek: enhance TX path with recycling more SKBs in one poll

2017-04-11 Thread sean.wang
From: Sean Wang The patch adds the enhancement for recycling more TX completed SKBs in one NAPI polling handler if NAPI budgets are still available and hardware raises status bit shown for certain SKBs are aready done. Signed-off-by: Sean Wang

[PATCH v2 net 0/2] Fix crash caused by reporting inconsistent skb->len to BQL

2017-04-13 Thread sean.wang
From: Sean Wang Changes since v1: - fix inconsistent enumeration which easily causes the potential bug The series fixes kernel BUG caused by inconsistent SKB length reported into BQL. The reason for inconsistent length comes from hardware BUG which results in different

[PATCH v2 net 1/2] net: ethernet: mediatek: fix inconsistency between TXD and the used buffer

2017-04-13 Thread sean.wang
From: Sean Wang Fix inconsistency between the TXD descriptor and the used buffer that would cause unexpected logic at mtk_tx_unmap() during skb housekeeping. Signed-off-by: Sean Wang --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 17

[PATCH v2 net 2/2] net: ethernet: mediatek: fix inconsistency of port number carried in TXD

2017-04-13 Thread sean.wang
From: Sean Wang Fix port inconsistency on TXD due to hardware BUG that would cause different port number is carried on the same TXD between tx_map() and tx_unmap() with the iperf test. It would cause confusing BQL logic which leads to kernel panic when dual GMAC runs

  1   2   >