From: Markus Pargmann <hidden> Date: 2014-08-25 06:23:41
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.
v5 contains just a small style fix in patch 5.
Best regards,
Markus Pargmann
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 | 46 ++++++++++++++++++++++++--
drivers/net/ethernet/ti/cpsw.h | 1 +
5 files changed, 58 insertions(+), 3 deletions(-)
--
2.1.0.rc1
From: Markus Pargmann <hidden> Date: 2014-08-25 06:23:42
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-08-25 06:23:43
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-08-25 06:23:44
"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-08-25 06:23:46
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 v5:
- Fixed indention
Documentation/devicetree/bindings/net/cpsw.txt | 4 +++
drivers/net/ethernet/ti/Kconfig | 2 ++
drivers/net/ethernet/ti/cpsw.c | 43 +++++++++++++++++++++++++-
3 files changed, 48 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-08-25 06:23:48
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>
---
arch/arm/boot/dts/am33xx.dtsi | 1 +
1 file changed, 1 insertion(+)
From: Tony Lindgren <tony@atomide.com> Date: 2014-08-25 16:01:19
* Markus Pargmann [off-list ref] [140824 23:24]:
quoted hunk
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 v5:
- Fixed indention
Documentation/devicetree/bindings/net/cpsw.txt | 4 +++
drivers/net/ethernet/ti/Kconfig | 2 ++
drivers/net/ethernet/ti/cpsw.c | 43 +++++++++++++++++++++++++-
3 files changed, 48 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:
I think this only works for the first instance of the cpsw?
Can the other instances of cpsw use this too and just increment
some value in it?
quoted hunk
static int cpsw_probe_dt(struct cpsw_platform_data *data,
struct platform_device *pdev)
{
@@ -1928,8 +1963,14 @@ 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 {+ 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) {
The cpsw_am33xx_cm_get_macid() should only get called based on the
compatible flag to avoid random register access on other SoCs.
So how about add the of_machine_is_compatible("ti,am33xx")
check here instead and skip calling cpsw_am33xx_cm_get_macid()
otherwise?
That allows adding support for other omaps as we already have
ti,am4372-cpsw and people have pointed out issues with dra7xx
already.
Regards,
Tony
From: Tony Lindgren <tony@atomide.com> Date: 2014-08-25 16:02:25
* Markus Pargmann [off-list ref] [140824 23:24]:
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>
I think this only works for the first instance of the cpsw?
This works for both cpsw slaves on am335x. It does not work for multiple
cpsw drivers. But we don't have them on am335x. For other platforms this
function may be used in case they have the same register layout.
Can the other instances of cpsw use this too and just increment
some value in it?
quoted
static int cpsw_probe_dt(struct cpsw_platform_data *data,
struct platform_device *pdev)
{
@@ -1928,8 +1963,14 @@ 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 {+ 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) {
The cpsw_am33xx_cm_get_macid() should only get called based on the
compatible flag to avoid random register access on other SoCs.
So how about add the of_machine_is_compatible("ti,am33xx")
check here instead and skip calling cpsw_am33xx_cm_get_macid()
otherwise?
That allows adding support for other omaps as we already have
ti,am4372-cpsw and people have pointed out issues with dra7xx
already.
Okay, I will move the machine check here instead.
Thanks,
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 |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140826/d31b6a6e/attachment.sig>