From: Markus Pargmann <hidden> Date: 2014-09-07 17:19:28
This series adds support to the cpsw driver to read the MACIDs of the am335x
chip and use them as fallback. These addresses are only used if there are no
mac addresses in the devicetree, for example set by a bootloader.
v6 moves the machine check in patch 5 out of cpsw_am33xx_cm_get_macid() so that
this function is only called for am33xx.
Best regards,
Markus
Markus Pargmann (7):
DT doc: net: cpsw mac-address is optional
net: cpsw: Add missing return value
net: cpsw: header, Add missing include
net: cpsw: Replace pr_err by dev_err
net: cpsw: Add am33xx MACID readout
am33xx: define syscon control module device node
arm: dts: am33xx, Add syscon phandle to cpsw node
Documentation/devicetree/bindings/net/cpsw.txt | 6 +++-
arch/arm/boot/dts/am33xx.dtsi | 6 ++++
drivers/net/ethernet/ti/Kconfig | 2 ++
drivers/net/ethernet/ti/cpsw.c | 45 ++++++++++++++++++++++++--
drivers/net/ethernet/ti/cpsw.h | 1 +
5 files changed, 57 insertions(+), 3 deletions(-)
--
2.1.0
From: Markus Pargmann <hidden> Date: 2014-09-07 17:19:29
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.
Signed-off-by: Markus Pargmann <redacted>
Reviewed-by: Wolfram Sang <redacted>
---
Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
@@ -29,10 +29,10 @@ Slave Properties: Required properties: - phy_id : Specifies slave phy id - phy-mode : See ethernet.txt file in the same directory-- mac-address : See ethernet.txt file in the same directory Optional properties: - dual_emac_res_vlan : Specifies VID to be used to segregate the ports+- mac-address : See ethernet.txt file in the same directory Note: "ti,hwmods" field is used to fetch the base address and irq resources from TI, omap hwmod data base during device registration.
From: Markus Pargmann <hidden> Date: 2014-09-07 17:19:30
ret is set 0 at this point, so jumping to that error label would result
in a return value of 0. Set ret to -ENOMEM to return a proper error
value.
Signed-off-by: Markus Pargmann <redacted>
Reviewed-by: Wolfram Sang <redacted>
---
drivers/net/ethernet/ti/cpsw.c | 1 +
1 file changed, 1 insertion(+)
From: Markus Pargmann <hidden> Date: 2014-09-07 17:19:31
"MII_BUS_ID_SIZE" is defined in linux/phy.h which is not included in the
cpsw.h file.
Signed-off-by: Markus Pargmann <redacted>
Reviewed-by: Wolfram Sang <redacted>
---
drivers/net/ethernet/ti/cpsw.h | 1 +
1 file changed, 1 insertion(+)
From: Markus Pargmann <hidden> Date: 2014-09-07 17:19:33
This patch adds a function to get the MACIDs from the am33xx SoC
control module registers which hold unique vendor MACIDs. This is only
used if of_get_mac_address() fails to get a valid mac address.
Signed-off-by: Markus Pargmann <redacted>
Reviewed-by: Wolfram Sang <redacted>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
---
Notes:
Changes in v6:
- Move machine check outside of cpsw_am33xx_cm_get_macid()
Changes in v5:
- Fixed indention
Documentation/devicetree/bindings/net/cpsw.txt | 4 +++
drivers/net/ethernet/ti/Kconfig | 2 ++
drivers/net/ethernet/ti/cpsw.c | 42 +++++++++++++++++++++++++-
3 files changed, 47 insertions(+), 1 deletion(-)
@@ -24,6 +24,8 @@ Optional properties: - ti,hwmods : Must be "cpgmac0" - no_bd_ram : Must be 0 or 1 - dual_emac : Specifies Switch to act as Dual EMAC+- syscon : Phandle to the system control device node, which is+ the control module device of the am33x Slave Properties: Required properties:
From: Markus Pargmann <hidden> Date: 2014-09-07 17:19:35
There are 2 MACIDs stored in the control module of the am33xx. These are
read by the cpsw driver if no valid MACID was found in the devicetree.
Signed-off-by: Markus Pargmann <redacted>
Reviewed-by: Wolfram Sang <redacted>
Acked-by: Tony Lindgren <tony@atomide.com>
---
arch/arm/boot/dts/am33xx.dtsi | 1 +
1 file changed, 1 insertion(+)
From: Tony Lindgren <tony@atomide.com> Date: 2014-09-08 16:51:17
* Markus Pargmann [off-list ref] [140907 10:20]:
This patch adds a function to get the MACIDs from the am33xx SoC
control module registers which hold unique vendor MACIDs. This is only
used if of_get_mac_address() fails to get a valid mac address.
...
quoted hunk
@@ -1928,8 +1960,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, PHY_ID_FMT, mdio->name, phyid); mac_addr = of_get_mac_address(slave_node);- if (mac_addr)+ if (mac_addr) { memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);+ } else {+ if (of_machine_is_compatible("ti,am33xx")) {+ ret = cpsw_am33xx_cm_get_macid(&pdev->dev, i,+ slave_data->mac_addr);+ if (ret)+ return ret;+ }+ } slave_data->phy_if = of_get_phy_mode(slave_node); if (slave_data->phy_if < 0) {
Thanks for updating this, this looks more future proof for adding
the dra7 related patch.
For the long run, it probably makes sense to add SoC specific
compatible values such as "ti,cpsw-am3350" and so on. Then the
mac address functions can be initialized based on the of_device_id
entry for .data. The wiring is cleary SoC specific here.
So for the purpose of this series, I'm fine with this series,
please feel free to add for this patch:
Acked-by: Tony Lindgren <tony@atomide.com>
Regards,
Tony
From: Markus Pargmann <hidden> Date: 2014-09-09 06:05:22
On Mon, Sep 08, 2014 at 09:51:17AM -0700, Tony Lindgren wrote:
* Markus Pargmann [off-list ref] [140907 10:20]:
quoted
This patch adds a function to get the MACIDs from the am33xx SoC
control module registers which hold unique vendor MACIDs. This is only
used if of_get_mac_address() fails to get a valid mac address.
...
quoted
@@ -1928,8 +1960,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, PHY_ID_FMT, mdio->name, phyid); mac_addr = of_get_mac_address(slave_node);- if (mac_addr)+ if (mac_addr) { memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);+ } else {+ if (of_machine_is_compatible("ti,am33xx")) {+ ret = cpsw_am33xx_cm_get_macid(&pdev->dev, i,+ slave_data->mac_addr);+ if (ret)+ return ret;+ }+ } slave_data->phy_if = of_get_phy_mode(slave_node); if (slave_data->phy_if < 0) {
Thanks for updating this, this looks more future proof for adding
the dra7 related patch.
For the long run, it probably makes sense to add SoC specific
compatible values such as "ti,cpsw-am3350" and so on. Then the
mac address functions can be initialized based on the of_device_id
entry for .data. The wiring is cleary SoC specific here.
The hardware doesn't differ across the SoCs, so I thought it may be
better to keep one compatible and parse the machine compatible for the
MACID location. But different compatible values are also ok.
So for the purpose of this series, I'm fine with this series,
please feel free to add for this patch:
Acked-by: Tony Lindgren <tony@atomide.com>
Thanks.
Best regards,
Markus
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
From: Tony Lindgren <tony@atomide.com> Date: 2014-09-09 14:48:02
* Markus Pargmann [off-list ref] [140908 23:05]:
On Mon, Sep 08, 2014 at 09:51:17AM -0700, Tony Lindgren wrote:
quoted
* Markus Pargmann [off-list ref] [140907 10:20]:
quoted
This patch adds a function to get the MACIDs from the am33xx SoC
control module registers which hold unique vendor MACIDs. This is only
used if of_get_mac_address() fails to get a valid mac address.
...
quoted
@@ -1928,8 +1960,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, PHY_ID_FMT, mdio->name, phyid); mac_addr = of_get_mac_address(slave_node);- if (mac_addr)+ if (mac_addr) { memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);+ } else {+ if (of_machine_is_compatible("ti,am33xx")) {+ ret = cpsw_am33xx_cm_get_macid(&pdev->dev, i,+ slave_data->mac_addr);+ if (ret)+ return ret;+ }+ } slave_data->phy_if = of_get_phy_mode(slave_node); if (slave_data->phy_if < 0) {
Thanks for updating this, this looks more future proof for adding
the dra7 related patch.
For the long run, it probably makes sense to add SoC specific
compatible values such as "ti,cpsw-am3350" and so on. Then the
mac address functions can be initialized based on the of_device_id
entry for .data. The wiring is cleary SoC specific here.
The hardware doesn't differ across the SoCs, so I thought it may be
better to keep one compatible and parse the machine compatible for the
MACID location. But different compatible values are also ok.
Yes both will work, and you're right the Ethernet hardware is
the same. I already forgot that we're getting mac address from the
system control module.. And that's really SoC specific so your solution
is better at least for now.
Regards,
Tony