From: Michal Vokáč <hidden> Date: 2018-05-23 06:21:17
This series basically adds support for a QCA8334 ethernet switch to the
qca8k driver. It is a four-port variant of the already supported seven
port QCA8337. Register map is the same for the whole familly and all chips
have the same device ID.
Major part of this series enhances the CPU port setting. Currently the CPU
port is not set to any sensible defaults compatible with the xGMII
interface. This series forces the CPU port to its maximum bandwidth and
also allows to adjust the new defaults using fixed-link device tree
sub-node.
Alongside these changes I fixed two checkpatch warnings regarding SPDX and
redundant parentheses.
Changes in v3:
- Rebased on latest net-next/master.
- Corrected fixed-link documentation.
Michal Vokáč (7):
net: dsa: qca8k: Add QCA8334 binding documentation
net: dsa: qca8k: Add support for QCA8334 switch
net: dsa: qca8k: Enable RXMAC when bringing up a port
net: dsa: qca8k: Force CPU port to its highest bandwidth
net: dsa: qca8k: Allow overwriting CPU port setting
net: dsa: qca8k: Replace GPL boilerplate by SPDX
net: dsa: qca8k: Remove redundant parentheses
.../devicetree/bindings/net/dsa/qca8k.txt | 23 +++++++-
drivers/net/dsa/qca8k.c | 64 ++++++++++++++++++----
drivers/net/dsa/qca8k.h | 7 ++-
3 files changed, 79 insertions(+), 15 deletions(-)
--
2.7.4
From: Michal Vokáč <hidden> Date: 2018-05-23 06:21:22
Add support for the four-port variant of the Qualcomm QCA833x switch.
The CPU port default link settings can be reconfigured using
a fixed-link sub-node.
Signed-off-by: Michal Vokáč <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Changes in v3:
- Correct fixed-link node documentation term: s/property/node.
- Add "Reviewed-by" tag from Rob and Andrew.
Changes in v2:
- Add commit message and document fixed-link binding.
.../devicetree/bindings/net/dsa/qca8k.txt | 23 +++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
@@ -2,7 +2,10 @@ Required properties:-- compatible: should be "qca,qca8337"+- compatible: should be one of:+ "qca,qca8334"+ "qca,qca8337"+ - #size-cells: must be 0 - #address-cells: must be 1
@@ -14,6 +17,20 @@ port and PHY id, each subnode describing a port needs to have a valid phandle referencing the internal PHY connected to it. The CPU port of this switch is always port 0.+A CPU port node has the following optional node:++- fixed-link : Fixed-link subnode describing a link to a non-MDIO+ managed entity. See+ Documentation/devicetree/bindings/net/fixed-link.txt+ for details.++For QCA8K the 'fixed-link' sub-node supports only the following properties:++- 'speed' (integer, mandatory), to indicate the link speed. Accepted+ values are 10, 100 and 1000+- 'full-duplex' (boolean, optional), to indicate that full duplex is+ used. When absent, half duplex is assumed.+ Example:
Add support for the four-port variant of the Qualcomm QCA833x switch.
The CPU port default link settings can be reconfigured using
a fixed-link sub-node.
Signed-off-by: Michal Vokáč <redacted>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
From: Michal Vokáč <hidden> Date: 2018-05-23 06:21:30
By default autonegotiation is enabled to configure MAC on all ports.
For the CPU port autonegotiation can not be used so we need to set
some sensible defaults manually.
This patch forces the default setting of the CPU port to 1000Mbps/full
duplex which is the chip maximum capability.
Also correct size of the bit field used to configure link speed.
Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family")
Signed-off-by: Michal Vokáč <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v3:
- none
Changes in v2:
- Add "Fixes" tag as pointed out by Florian.
- Add "Reviewed-by" tags from Andrew and Florian.
drivers/net/dsa/qca8k.c | 6 +++++-
drivers/net/dsa/qca8k.h | 6 ++++--
2 files changed, 9 insertions(+), 3 deletions(-)
@@ -564,7 +565,10 @@ qca8k_setup(struct dsa_switch *ds)if(ret<0)returnret;-/* Enable CPU Port */+/* Enable CPU Port, force it to maximum bandwidth and full-duplex */+mask=QCA8K_PORT_STATUS_SPEED_1000|QCA8K_PORT_STATUS_TXFLOW|+QCA8K_PORT_STATUS_RXFLOW|QCA8K_PORT_STATUS_DUPLEX;+qca8k_write(priv,QCA8K_REG_PORT_STATUS(QCA8K_CPU_PORT),mask);qca8k_reg_set(priv,QCA8K_REG_GLOBAL_FW_CTRL0,QCA8K_GLOBAL_FW_CTRL0_CPU_PORT_EN);qca8k_port_set_status(priv,QCA8K_CPU_PORT,1);
@@ -513,7 +513,7 @@ qca8k_port_set_status(struct qca8k_priv *priv, int port, int enable)pr_debug("qca: port %i set status %i\n",port,enable);/* Port 0 and 6 have no internal PHY */-if((port>0)&&(port<6))+if(port>0&&port<6)mask|=QCA8K_PORT_STATUS_LINK_AUTO;if(enable)
From: Michal Vokáč <hidden> Date: 2018-05-23 06:22:36
Implement adjust_link function that allows to overwrite default CPU port
setting using fixed-link device tree subnode.
Signed-off-by: Michal Vokáč <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v3:
- none
Changes in v2:
- Add "Reviewed-by" tags from Andrew and Florian.
drivers/net/dsa/qca8k.c | 43 +++++++++++++++++++++++++++++++++++++++++++
drivers/net/dsa/qca8k.h | 1 +
2 files changed, 44 insertions(+)
@@ -636,6 +636,47 @@ qca8k_setup(struct dsa_switch *ds)return0;}+staticvoid+qca8k_adjust_link(structdsa_switch*ds,intport,structphy_device*phy)+{+structqca8k_priv*priv=ds->priv;+u32reg;++/* Force fixed-link setting for CPU port, skip others. */+if(!phy_is_pseudo_fixed_link(phy))+return;++/* Set port speed */+switch(phy->speed){+case10:+reg=QCA8K_PORT_STATUS_SPEED_10;+break;+case100:+reg=QCA8K_PORT_STATUS_SPEED_100;+break;+case1000:+reg=QCA8K_PORT_STATUS_SPEED_1000;+break;+default:+dev_dbg(priv->dev,"port%d link speed %dMbps not supported.\n",+port,phy->speed);+return;+}++/* Set duplex mode */+if(phy->duplex==DUPLEX_FULL)+reg|=QCA8K_PORT_STATUS_DUPLEX;++/* Force flow control */+if(dsa_is_cpu_port(ds,port))+reg|=QCA8K_PORT_STATUS_RXFLOW|QCA8K_PORT_STATUS_TXFLOW;++/* Force link down before changing MAC options */+qca8k_port_set_status(priv,port,0);+qca8k_write(priv,QCA8K_REG_PORT_STATUS(port),reg);+qca8k_port_set_status(priv,port,1);+}+staticintqca8k_phy_read(structdsa_switch*ds,intphy,intregnum){
@@ -909,6 +950,7 @@ qca8k_get_tag_protocol(struct dsa_switch *ds, int port)staticconststructdsa_switch_opsqca8k_switch_ops={.get_tag_protocol=qca8k_get_tag_protocol,.setup=qca8k_setup,+.adjust_link=qca8k_adjust_link,.get_strings=qca8k_get_strings,.phy_read=qca8k_phy_read,.phy_write=qca8k_phy_write,
@@ -942,6 +984,7 @@ qca8k_sw_probe(struct mdio_device *mdiodev)return-ENOMEM;priv->bus=mdiodev->bus;+priv->dev=&mdiodev->dev;/* read the switches ID register */id=qca8k_read(priv,QCA8K_REG_MASK_CTRL);
From: Michal Vokáč <hidden> Date: 2018-05-23 06:22:42
When a port is brought up/down do not enable/disable only the TXMAC
but the RXMAC as well. This is essential for the CPU port to work.
Fixes: 6b93fb46480a ("net-next: dsa: add new driver for qca8xxx family")
Signed-off-by: Michal Vokáč <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v3:
- none
Changes in v2:
- Add "Fixes" tag as pointed out by Florian.
- Add "Reviewed-by" tags from Andrew and Florian.
drivers/net/dsa/qca8k.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -516,7 +516,7 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode)staticvoidqca8k_port_set_status(structqca8k_priv*priv,intport,intenable){-u32mask=QCA8K_PORT_STATUS_TXMAC;+u32mask=QCA8K_PORT_STATUS_TXMAC|QCA8K_PORT_STATUS_RXMAC;pr_debug("qca: port %i set status %i\n",port,enable);
From: Michal Vokáč <hidden> Date: 2018-05-23 06:23:40
Add support for the four-port variant of the Qualcomm QCA833x switch.
Signed-off-by: Michal Vokáč <redacted>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
Changes in v3:
- Add "Reviewed-by" tag from Andrew
Changes in v2:
- Add commit message
drivers/net/dsa/qca8k.c | 1 +
1 file changed, 1 insertion(+)
This series basically adds support for a QCA8334 ethernet switch to the
qca8k driver. It is a four-port variant of the already supported seven
port QCA8337. Register map is the same for the whole familly and all chips
have the same device ID.
Major part of this series enhances the CPU port setting. Currently the CPU
port is not set to any sensible defaults compatible with the xGMII
interface. This series forces the CPU port to its maximum bandwidth and
also allows to adjust the new defaults using fixed-link device tree
sub-node.
Alongside these changes I fixed two checkpatch warnings regarding SPDX and
redundant parentheses.
Looks great, thanks Michal! Do you have any features or things you are
working on that would be added later to the driver?
Changes in v3:
- Rebased on latest net-next/master.
- Corrected fixed-link documentation.
Michal Vokáč (7):
net: dsa: qca8k: Add QCA8334 binding documentation
net: dsa: qca8k: Add support for QCA8334 switch
net: dsa: qca8k: Enable RXMAC when bringing up a port
net: dsa: qca8k: Force CPU port to its highest bandwidth
net: dsa: qca8k: Allow overwriting CPU port setting
net: dsa: qca8k: Replace GPL boilerplate by SPDX
net: dsa: qca8k: Remove redundant parentheses
.../devicetree/bindings/net/dsa/qca8k.txt | 23 +++++++-
drivers/net/dsa/qca8k.c | 64 ++++++++++++++++++----
drivers/net/dsa/qca8k.h | 7 ++-
3 files changed, 79 insertions(+), 15 deletions(-)
From: Michal Vokáč <hidden> Date: 2018-05-24 09:35:07
On 23.5.2018 17:39, Florian Fainelli wrote:
On 05/22/2018 11:20 PM, Michal Vokáč wrote:
quoted
This series basically adds support for a QCA8334 ethernet switch to the
qca8k driver. It is a four-port variant of the already supported seven
port QCA8337. Register map is the same for the whole familly and all chips
have the same device ID.
Major part of this series enhances the CPU port setting. Currently the CPU
port is not set to any sensible defaults compatible with the xGMII
interface. This series forces the CPU port to its maximum bandwidth and
also allows to adjust the new defaults using fixed-link device tree
sub-node.
Alongside these changes I fixed two checkpatch warnings regarding SPDX and
redundant parentheses.
Looks great, thanks Michal! Do you have any features or things you are
working on that would be added later to the driver?
Thank you too Florian. And also big thank to you Andrew. You helped me
a lot to debug the RGMII issue. I have been stuck at that for more than
a month and would not resolve it without your help.
As I have done this in a process of upgrading our BSP to a more recent
kernel, and hopefully mainline, I now need to move on to other parts of
the board. So unfortunately no, I do not have any other enhancements
planned to this driver for now. But as we are probably one of the few
with access to the NDA covered Qualcomm documentation I see a great
opportunity to work on that later. I am afraid "later" means something
like next year in this case as I am basically the only kernel developer
in our company and not yet very experienced.
Thank you all for your time,
Michal
From: Andrew Lunn <andrew@lunn.ch> Date: 2018-05-24 13:17:45
Thank you too Florian. And also big thank to you Andrew. You helped me
a lot to debug the RGMII issue. I have been stuck at that for more than
a month and would not resolve it without your help.
We are here to help. I also got stuck figuring out RGMII issues, so i
know what it feels like...
As I have done this in a process of upgrading our BSP to a more recent
kernel, and hopefully mainline, I now need to move on to other parts of
the board.
Do you think you can mainline the board? It would be nice to have an
in kernel board using this switch. If you post the device tree
patches, please Cc: me.
Andrew
This series basically adds support for a QCA8334 ethernet switch to the
qca8k driver. It is a four-port variant of the already supported seven
port QCA8337. Register map is the same for the whole familly and all chips
have the same device ID.
Major part of this series enhances the CPU port setting. Currently the CPU
port is not set to any sensible defaults compatible with the xGMII
interface. This series forces the CPU port to its maximum bandwidth and
also allows to adjust the new defaults using fixed-link device tree
sub-node.
Alongside these changes I fixed two checkpatch warnings regarding SPDX and
redundant parentheses.
Changes in v3:
- Rebased on latest net-next/master.
- Corrected fixed-link documentation.