[PATCH RESEND v6 7/7] arm: dts: am33xx, Add syscon phandle to cpsw node

2014-09-29 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/am33xx.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 25e38b6ac376..13e44b0f5adc 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -701,6 +701,7 @@
 */
interrupts = 40 41 42 43;
ranges;
+   syscon = cm;
status = disabled;
 
davinci_mdio: mdio@4a101000 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 5/7] net: cpsw: Add am33xx MACID readout

2014-09-29 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Tested-by: Steven Rostedt rost...@goodmis.org
Acked-by: Tony Lindgren t...@atomide.com
---

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(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 107caf174a0e..33fe8462edf4 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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:
@@ -57,6 +59,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
@@ -85,6 +88,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 1769700a6070..5d8cb7956113 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,8 @@ config TI_CPSW
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select MFD_SYSCON
+   select REGMAP
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 0bc2c2a2c236..12497d921fa6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -33,6 +33,8 @@
 #include linux/of_net.h
 #include linux/of_device.h
 #include linux/if_vlan.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include linux/pinctrl/consumer.h
 
@@ -1816,6 +1818,36 @@ static void cpsw_slave_init(struct cpsw_slave *slave, 
struct cpsw_priv *priv,
slave-port_vlan = data-dual_emac_res_vlan;
 }
 
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
+
+static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+   struct regmap *syscon;
+
+   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
+   if (IS_ERR(syscon)) {
+   if (PTR_ERR(syscon) == -ENODEV)
+   return 0;
+   return PTR_ERR(syscon);
+   }
+
+   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
+   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
+
+   mac_addr[5] = (macid_lo  8)  0xff;
+   mac_addr[4] = macid_lo  0xff;
+   mac_addr[3] = (macid_hi  24)  0xff;
+   mac_addr[2] = (macid_hi  16)  0xff;
+   mac_addr[1] = (macid_hi  8)  0xff;
+   mac_addr[0] = macid_hi  0xff;
+
+   return 0;
+}
+
 static int cpsw_probe_dt(struct cpsw_platform_data *data,
 struct platform_device *pdev)
 {
@@ -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) {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body

[PATCH RESEND v6 6/7] am33xx: define syscon control module device node

2014-09-29 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/am33xx.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..25e38b6ac376 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,6 +132,11 @@
};
};
 
+   cm: syscon@44e1 {
+   compatible = ti,am33xx-controlmodule, syscon;
+   reg = 0x44e1 0x800;
+   };
+
intc: interrupt-controller@4820 {
compatible = ti,omap2-intc;
interrupt-controller;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 3/7] net: cpsw: header, Add missing include

2014-09-29 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49da693f..1b710674630c 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 4/7] net: cpsw: Replace pr_err by dev_err

2014-09-29 Thread Markus Pargmann
Use dev_err instead of pr_err.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f09b4639ad31..0bc2c2a2c236 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1921,7 +1921,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio = of_find_device_by_node(mdio_node);
of_node_put(mdio_node);
if (!mdio) {
-   pr_err(Missing mdio platform device\n);
+   dev_err(pdev-dev, Missing mdio platform device\n);
return -EINVAL;
}
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 2/7] net: cpsw: Add missing return value

2014-09-29 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 999fb72688d2..f09b4639ad31 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2063,6 +2063,7 @@ static int cpsw_probe(struct platform_device *pdev)
priv-irq_enabled = true;
if (!priv-cpts) {
dev_err(pdev-dev, error allocating cpts\n);
+   ret = -ENOMEM;
goto clean_ndev_ret;
}
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 0/7] net: cpsw: Support for am335x chip MACIDs

2014-09-29 Thread Markus Pargmann
Hi,

Another resend of this series to add the netdev list.

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.

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

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 1/7] DT doc: net: cpsw mac-address is optional

2014-09-29 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index ae2b8b7f9c38..107caf174a0e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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.
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 6/7] am33xx: define syscon control module device node

2014-09-28 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/am33xx.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..25e38b6ac376 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,6 +132,11 @@
};
};
 
+   cm: syscon@44e1 {
+   compatible = ti,am33xx-controlmodule, syscon;
+   reg = 0x44e1 0x800;
+   };
+
intc: interrupt-controller@4820 {
compatible = ti,omap2-intc;
interrupt-controller;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 2/7] net: cpsw: Add missing return value

2014-09-28 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 999fb72688d2..f09b4639ad31 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2063,6 +2063,7 @@ static int cpsw_probe(struct platform_device *pdev)
priv-irq_enabled = true;
if (!priv-cpts) {
dev_err(pdev-dev, error allocating cpts\n);
+   ret = -ENOMEM;
goto clean_ndev_ret;
}
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 7/7] arm: dts: am33xx, Add syscon phandle to cpsw node

2014-09-28 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/am33xx.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 25e38b6ac376..13e44b0f5adc 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -701,6 +701,7 @@
 */
interrupts = 40 41 42 43;
ranges;
+   syscon = cm;
status = disabled;
 
davinci_mdio: mdio@4a101000 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 4/7] net: cpsw: Replace pr_err by dev_err

2014-09-28 Thread Markus Pargmann
Use dev_err instead of pr_err.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f09b4639ad31..0bc2c2a2c236 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1921,7 +1921,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio = of_find_device_by_node(mdio_node);
of_node_put(mdio_node);
if (!mdio) {
-   pr_err(Missing mdio platform device\n);
+   dev_err(pdev-dev, Missing mdio platform device\n);
return -EINVAL;
}
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 0/7] DT doc: net: cpsw mac-address is optional

2014-09-28 Thread Markus Pargmann
Hi,

This is a resend of v6 of this series. I added the Acked-by of Tony Lindgren
for patch 5/7. There are no other changes.

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.

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

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 1/7] DT doc: net: cpsw mac-address is optional

2014-09-28 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index ae2b8b7f9c38..107caf174a0e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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.
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH RESEND v6 5/7] net: cpsw: Add am33xx MACID readout

2014-09-28 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Tested-by: Steven Rostedt rost...@goodmis.org
Acked-by: Tony Lindgren t...@atomide.com
---

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(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 107caf174a0e..33fe8462edf4 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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:
@@ -57,6 +59,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
@@ -85,6 +88,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 1769700a6070..5d8cb7956113 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,8 @@ config TI_CPSW
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select MFD_SYSCON
+   select REGMAP
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 0bc2c2a2c236..12497d921fa6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -33,6 +33,8 @@
 #include linux/of_net.h
 #include linux/of_device.h
 #include linux/if_vlan.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include linux/pinctrl/consumer.h
 
@@ -1816,6 +1818,36 @@ static void cpsw_slave_init(struct cpsw_slave *slave, 
struct cpsw_priv *priv,
slave-port_vlan = data-dual_emac_res_vlan;
 }
 
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
+
+static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+   struct regmap *syscon;
+
+   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
+   if (IS_ERR(syscon)) {
+   if (PTR_ERR(syscon) == -ENODEV)
+   return 0;
+   return PTR_ERR(syscon);
+   }
+
+   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
+   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
+
+   mac_addr[5] = (macid_lo  8)  0xff;
+   mac_addr[4] = macid_lo  0xff;
+   mac_addr[3] = (macid_hi  24)  0xff;
+   mac_addr[2] = (macid_hi  16)  0xff;
+   mac_addr[1] = (macid_hi  8)  0xff;
+   mac_addr[0] = macid_hi  0xff;
+
+   return 0;
+}
+
 static int cpsw_probe_dt(struct cpsw_platform_data *data,
 struct platform_device *pdev)
 {
@@ -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) {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body

[PATCH RESEND v6 3/7] net: cpsw: header, Add missing include

2014-09-28 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49da693f..1b710674630c 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v6 5/7] net: cpsw: Add am33xx MACID readout

2014-09-09 Thread Markus Pargmann
On Mon, Sep 08, 2014 at 09:51:17AM -0700, Tony Lindgren wrote:
 * Markus Pargmann m...@pengutronix.de [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.
 ...
 
  @@ -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 t...@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- |


signature.asc
Description: Digital signature


[PATCH v6 4/7] net: cpsw: Replace pr_err by dev_err

2014-09-07 Thread Markus Pargmann
Use dev_err instead of pr_err.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f09b4639ad31..0bc2c2a2c236 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1921,7 +1921,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio = of_find_device_by_node(mdio_node);
of_node_put(mdio_node);
if (!mdio) {
-   pr_err(Missing mdio platform device\n);
+   dev_err(pdev-dev, Missing mdio platform device\n);
return -EINVAL;
}
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 1/7] DT doc: net: cpsw mac-address is optional

2014-09-07 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index ae2b8b7f9c38..107caf174a0e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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.
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 3/7] net: cpsw: header, Add missing include

2014-09-07 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49da693f..1b710674630c 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 5/7] net: cpsw: Add am33xx MACID readout

2014-09-07 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Tested-by: Steven Rostedt rost...@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(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 107caf174a0e..33fe8462edf4 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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:
@@ -57,6 +59,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
@@ -85,6 +88,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 1769700a6070..5d8cb7956113 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,8 @@ config TI_CPSW
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select MFD_SYSCON
+   select REGMAP
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 0bc2c2a2c236..12497d921fa6 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -33,6 +33,8 @@
 #include linux/of_net.h
 #include linux/of_device.h
 #include linux/if_vlan.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include linux/pinctrl/consumer.h
 
@@ -1816,6 +1818,36 @@ static void cpsw_slave_init(struct cpsw_slave *slave, 
struct cpsw_priv *priv,
slave-port_vlan = data-dual_emac_res_vlan;
 }
 
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
+
+static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+   struct regmap *syscon;
+
+   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
+   if (IS_ERR(syscon)) {
+   if (PTR_ERR(syscon) == -ENODEV)
+   return 0;
+   return PTR_ERR(syscon);
+   }
+
+   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
+   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
+
+   mac_addr[5] = (macid_lo  8)  0xff;
+   mac_addr[4] = macid_lo  0xff;
+   mac_addr[3] = (macid_hi  24)  0xff;
+   mac_addr[2] = (macid_hi  16)  0xff;
+   mac_addr[1] = (macid_hi  8)  0xff;
+   mac_addr[0] = macid_hi  0xff;
+
+   return 0;
+}
+
 static int cpsw_probe_dt(struct cpsw_platform_data *data,
 struct platform_device *pdev)
 {
@@ -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) {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More

[PATCH v6 7/7] arm: dts: am33xx, Add syscon phandle to cpsw node

2014-09-07 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/am33xx.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 25e38b6ac376..13e44b0f5adc 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -701,6 +701,7 @@
 */
interrupts = 40 41 42 43;
ranges;
+   syscon = cm;
status = disabled;
 
davinci_mdio: mdio@4a101000 {
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 2/7] net: cpsw: Add missing return value

2014-09-07 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 999fb72688d2..f09b4639ad31 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2063,6 +2063,7 @@ static int cpsw_probe(struct platform_device *pdev)
priv-irq_enabled = true;
if (!priv-cpts) {
dev_err(pdev-dev, error allocating cpts\n);
+   ret = -ENOMEM;
goto clean_ndev_ret;
}
 
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 6/7] am33xx: define syscon control module device node

2014-09-07 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Acked-by: Tony Lindgren t...@atomide.com
---
 arch/arm/boot/dts/am33xx.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..25e38b6ac376 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,6 +132,11 @@
};
};
 
+   cm: syscon@44e1 {
+   compatible = ti,am33xx-controlmodule, syscon;
+   reg = 0x44e1 0x800;
+   };
+
intc: interrupt-controller@4820 {
compatible = ti,omap2-intc;
interrupt-controller;
-- 
2.1.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v6 0/7] DT doc: net: cpsw mac-address is optional

2014-09-07 Thread Markus Pargmann
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

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 4/7] net: cpsw: Replace pr_err by dev_err

2014-08-25 Thread Markus Pargmann
Use dev_err instead of pr_err.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f09b4639ad31..0bc2c2a2c236 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1921,7 +1921,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio = of_find_device_by_node(mdio_node);
of_node_put(mdio_node);
if (!mdio) {
-   pr_err(Missing mdio platform device\n);
+   dev_err(pdev-dev, Missing mdio platform device\n);
return -EINVAL;
}
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 2/7] net: cpsw: Add missing return value

2014-08-25 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 999fb72688d2..f09b4639ad31 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2063,6 +2063,7 @@ static int cpsw_probe(struct platform_device *pdev)
priv-irq_enabled = true;
if (!priv-cpts) {
dev_err(pdev-dev, error allocating cpts\n);
+   ret = -ENOMEM;
goto clean_ndev_ret;
}
 
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 3/7] net: cpsw: header, Add missing include

2014-08-25 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49da693f..1b710674630c 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 7/7] arm: dts: am33xx, Add syscon phandle to cpsw node

2014-08-25 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 arch/arm/boot/dts/am33xx.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 25e38b6ac376..13e44b0f5adc 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -701,6 +701,7 @@
 */
interrupts = 40 41 42 43;
ranges;
+   syscon = cm;
status = disabled;
 
davinci_mdio: mdio@4a101000 {
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 1/7] DT doc: net: cpsw mac-address is optional

2014-08-25 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index ae2b8b7f9c38..107caf174a0e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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.
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 5/7] net: cpsw: Add am33xx MACID readout

2014-08-25 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Tested-by: Steven Rostedt rost...@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(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 107caf174a0e..33fe8462edf4 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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:
@@ -57,6 +59,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
@@ -85,6 +88,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 1769700a6070..5d8cb7956113 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,8 @@ config TI_CPSW
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select MFD_SYSCON
+   select REGMAP
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 0bc2c2a2c236..7c94a0fb24bc 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -33,6 +33,8 @@
 #include linux/of_net.h
 #include linux/of_device.h
 #include linux/if_vlan.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include linux/pinctrl/consumer.h
 
@@ -1816,6 +1818,39 @@ static void cpsw_slave_init(struct cpsw_slave *slave, 
struct cpsw_priv *priv,
slave-port_vlan = data-dual_emac_res_vlan;
 }
 
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
+
+static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+   struct regmap *syscon;
+
+   if (!of_machine_is_compatible(ti,am33xx))
+   return 0;
+
+   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
+   if (IS_ERR(syscon)) {
+   if (PTR_ERR(syscon) == -ENODEV)
+   return 0;
+   return PTR_ERR(syscon);
+   }
+
+   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
+   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
+
+   mac_addr[5] = (macid_lo  8)  0xff;
+   mac_addr[4] = macid_lo  0xff;
+   mac_addr[3] = (macid_hi  24)  0xff;
+   mac_addr[2] = (macid_hi  16)  0xff;
+   mac_addr[1] = (macid_hi  8)  0xff;
+   mac_addr[0] = macid_hi  0xff;
+
+   return 0;
+}
+
 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) {
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 6/7] am33xx: define syscon control module device node

2014-08-25 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 arch/arm/boot/dts/am33xx.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..25e38b6ac376 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,6 +132,11 @@
};
};
 
+   cm: syscon@44e1 {
+   compatible = ti,am33xx-controlmodule, syscon;
+   reg = 0x44e1 0x800;
+   };
+
intc: interrupt-controller@4820 {
compatible = ti,omap2-intc;
interrupt-controller;
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v5 0/7] net: cpsw: Support for am335x chip MACIDs

2014-08-25 Thread Markus Pargmann
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

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v5 5/7] net: cpsw: Add am33xx MACID readout

2014-08-25 Thread Markus Pargmann
Hi,

On Mon, Aug 25, 2014 at 09:01:19AM -0700, Tony Lindgren wrote:
  diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
  index 0bc2c2a2c236..7c94a0fb24bc 100644
  --- a/drivers/net/ethernet/ti/cpsw.c
  +++ b/drivers/net/ethernet/ti/cpsw.c
  @@ -33,6 +33,8 @@
   #include linux/of_net.h
   #include linux/of_device.h
   #include linux/if_vlan.h
  +#include linux/mfd/syscon.h
  +#include linux/regmap.h
   
   #include linux/pinctrl/consumer.h
   
  @@ -1816,6 +1818,39 @@ static void cpsw_slave_init(struct cpsw_slave 
  *slave, struct cpsw_priv *priv,
  slave-port_vlan = data-dual_emac_res_vlan;
   }
   
  +#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
  +#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
  +
  +static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
  +   u8 *mac_addr)
  +{
  +   u32 macid_lo;
  +   u32 macid_hi;
  +   struct regmap *syscon;
  +
  +   if (!of_machine_is_compatible(ti,am33xx))
  +   return 0;
  +
  +   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
  +   if (IS_ERR(syscon)) {
  +   if (PTR_ERR(syscon) == -ENODEV)
  +   return 0;
  +   return PTR_ERR(syscon);
  +   }
  +
  +   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
  +   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
  +
  +   mac_addr[5] = (macid_lo  8)  0xff;
  +   mac_addr[4] = macid_lo  0xff;
  +   mac_addr[3] = (macid_hi  24)  0xff;
  +   mac_addr[2] = (macid_hi  16)  0xff;
  +   mac_addr[1] = (macid_hi  8)  0xff;
  +   mac_addr[0] = macid_hi  0xff;
  +
  +   return 0;
  +}
 
 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?
 
   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- |


signature.asc
Description: Digital signature


Re: [PATCH v4 5/7] net: cpsw: Add am33xx MACID readout

2014-08-24 Thread Markus Pargmann
On Thu, Aug 21, 2014 at 02:51:53PM +0530, Mugunthan V N wrote:
 On Thursday 21 August 2014 11:21 AM, Markus Pargmann wrote:
  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 m...@pengutronix.de
  Reviewed-by: Wolfram Sang w...@the-dreams.de
  Tested-by: Steven Rostedt rost...@goodmis.org
  ---
   Documentation/devicetree/bindings/net/cpsw.txt |  4 +++
   drivers/net/ethernet/ti/Kconfig|  2 ++
   drivers/net/ethernet/ti/cpsw.c | 46 
  --
   3 files changed, 50 insertions(+), 2 deletions(-)
 
  diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
  b/Documentation/devicetree/bindings/net/cpsw.txt
  index 107caf174a0e..33fe8462edf4 100644
  --- a/Documentation/devicetree/bindings/net/cpsw.txt
  +++ b/Documentation/devicetree/bindings/net/cpsw.txt
  @@ -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:
  @@ -57,6 +59,7 @@ Examples:
  active_slave = 0;
  cpts_clock_mult = 0x8000;
  cpts_clock_shift = 29;
  +   syscon = cm;
  cpsw_emac0: slave@0 {
  phy_id = davinci_mdio, 0;
  phy-mode = rgmii-txid;
  @@ -85,6 +88,7 @@ Examples:
  active_slave = 0;
  cpts_clock_mult = 0x8000;
  cpts_clock_shift = 29;
  +   syscon = cm;
  cpsw_emac0: slave@0 {
  phy_id = davinci_mdio, 0;
  phy-mode = rgmii-txid;
  diff --git a/drivers/net/ethernet/ti/Kconfig 
  b/drivers/net/ethernet/ti/Kconfig
  index 1769700a6070..5d8cb7956113 100644
  --- a/drivers/net/ethernet/ti/Kconfig
  +++ b/drivers/net/ethernet/ti/Kconfig
  @@ -62,6 +62,8 @@ config TI_CPSW
  select TI_DAVINCI_CPDMA
  select TI_DAVINCI_MDIO
  select TI_CPSW_PHY_SEL
  +   select MFD_SYSCON
  +   select REGMAP
  ---help---
This driver supports TI's CPSW Ethernet Switch.
   
  diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
  index 0bc2c2a2c236..aaf8a42f9633 100644
  --- a/drivers/net/ethernet/ti/cpsw.c
  +++ b/drivers/net/ethernet/ti/cpsw.c
  @@ -33,6 +33,8 @@
   #include linux/of_net.h
   #include linux/of_device.h
   #include linux/if_vlan.h
  +#include linux/mfd/syscon.h
  +#include linux/regmap.h
   
   #include linux/pinctrl/consumer.h
   
  @@ -1816,6 +1818,39 @@ static void cpsw_slave_init(struct cpsw_slave 
  *slave, struct cpsw_priv *priv,
  slave-port_vlan = data-dual_emac_res_vlan;
   }
   
  +#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
  +#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
  +
  +static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
  +   u8 *mac_addr)
  +{
  +   u32 macid_lo;
  +   u32 macid_hi;
  +   struct regmap *syscon;
  +
  +   if (!of_machine_is_compatible(ti,am33xx))
  +   return 0;
  +
  +   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
  +   if (IS_ERR(syscon)) {
  +   if (PTR_ERR(syscon) == -ENODEV)
  +   return 0;
  +   return PTR_ERR(syscon);
  +   }
  +
  +   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
  +   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
  +
  +   mac_addr[5] = (macid_lo  8)  0xff;
  +   mac_addr[4] = macid_lo  0xff;
  +   mac_addr[3] = (macid_hi  24)  0xff;
  +   mac_addr[2] = (macid_hi  16)  0xff;
  +   mac_addr[1] = (macid_hi  8)  0xff;
  +   mac_addr[0] = macid_hi  0xff;
  +
  +   return 0;
  +}
  +
   static int cpsw_probe_dt(struct cpsw_platform_data *data,
   struct platform_device *pdev)
   {
  @@ -1928,8 +1963,15 @@ 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)
  -   memcpy(slave_data-mac_addr, mac_addr, ETH_ALEN);
  +   if (mac_addr) {
  +   memcpy(slave_data-mac_addr, mac_addr,
  +   ETH_ALEN);
 
 Alignment should match open parenthesis

Thanks, fixed as the rest of the driver is also aligned to the opening
paranthesis.

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

[PATCH v4 4/7] net: cpsw: Replace pr_err by dev_err

2014-08-20 Thread Markus Pargmann
Use dev_err instead of pr_err.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index f09b4639ad31..0bc2c2a2c236 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1921,7 +1921,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio = of_find_device_by_node(mdio_node);
of_node_put(mdio_node);
if (!mdio) {
-   pr_err(Missing mdio platform device\n);
+   dev_err(pdev-dev, Missing mdio platform device\n);
return -EINVAL;
}
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 7/7] arm: dts: am33xx, Add syscon phandle to cpsw node

2014-08-20 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 arch/arm/boot/dts/am33xx.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 25e38b6ac376..13e44b0f5adc 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -701,6 +701,7 @@
 */
interrupts = 40 41 42 43;
ranges;
+   syscon = cm;
status = disabled;
 
davinci_mdio: mdio@4a101000 {
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/7] DT doc: net: cpsw mac-address is optional

2014-08-20 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index ae2b8b7f9c38..107caf174a0e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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.
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 6/7] am33xx: define syscon control module device node

2014-08-20 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 arch/arm/boot/dts/am33xx.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..25e38b6ac376 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,6 +132,11 @@
};
};
 
+   cm: syscon@44e1 {
+   compatible = ti,am33xx-controlmodule, syscon;
+   reg = 0x44e1 0x800;
+   };
+
intc: interrupt-controller@4820 {
compatible = ti,omap2-intc;
interrupt-controller;
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/7] net: cpsw: Add missing return value

2014-08-20 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 999fb72688d2..f09b4639ad31 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2063,6 +2063,7 @@ static int cpsw_probe(struct platform_device *pdev)
priv-irq_enabled = true;
if (!priv-cpts) {
dev_err(pdev-dev, error allocating cpts\n);
+   ret = -ENOMEM;
goto clean_ndev_ret;
}
 
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/7] net: cpsw: Support for am335x chip MACIDs

2014-08-20 Thread Markus Pargmann
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.

In v4 I removed an unused Makefile rule which was introduced by me when this
series introduced a seperate driver to read the MACID. As the code is now
integrated into the main driver this is not necessary anymore.

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 | 49 --
 drivers/net/ethernet/ti/cpsw.h |  1 +
 5 files changed, 60 insertions(+), 4 deletions(-)

-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 5/7] net: cpsw: Add am33xx MACID readout

2014-08-20 Thread Markus Pargmann
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 m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
Tested-by: Steven Rostedt rost...@goodmis.org
---
 Documentation/devicetree/bindings/net/cpsw.txt |  4 +++
 drivers/net/ethernet/ti/Kconfig|  2 ++
 drivers/net/ethernet/ti/cpsw.c | 46 --
 3 files changed, 50 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 107caf174a0e..33fe8462edf4 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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:
@@ -57,6 +59,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
@@ -85,6 +88,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 1769700a6070..5d8cb7956113 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,8 @@ config TI_CPSW
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select MFD_SYSCON
+   select REGMAP
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 0bc2c2a2c236..aaf8a42f9633 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -33,6 +33,8 @@
 #include linux/of_net.h
 #include linux/of_device.h
 #include linux/if_vlan.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include linux/pinctrl/consumer.h
 
@@ -1816,6 +1818,39 @@ static void cpsw_slave_init(struct cpsw_slave *slave, 
struct cpsw_priv *priv,
slave-port_vlan = data-dual_emac_res_vlan;
 }
 
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
+
+static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+   struct regmap *syscon;
+
+   if (!of_machine_is_compatible(ti,am33xx))
+   return 0;
+
+   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
+   if (IS_ERR(syscon)) {
+   if (PTR_ERR(syscon) == -ENODEV)
+   return 0;
+   return PTR_ERR(syscon);
+   }
+
+   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
+   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
+
+   mac_addr[5] = (macid_lo  8)  0xff;
+   mac_addr[4] = macid_lo  0xff;
+   mac_addr[3] = (macid_hi  24)  0xff;
+   mac_addr[2] = (macid_hi  16)  0xff;
+   mac_addr[1] = (macid_hi  8)  0xff;
+   mac_addr[0] = macid_hi  0xff;
+
+   return 0;
+}
+
 static int cpsw_probe_dt(struct cpsw_platform_data *data,
 struct platform_device *pdev)
 {
@@ -1928,8 +1963,15 @@ 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)
-   memcpy(slave_data-mac_addr, mac_addr, ETH_ALEN);
+   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) {
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 3/7] net: cpsw: header, Add missing include

2014-08-20 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
Reviewed-by: Wolfram Sang w...@the-dreams.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49da693f..1b710674630c 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
2.1.0.rc1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 5/7] net: cpsw: Add am33xx MACID readout

2014-08-19 Thread Markus Pargmann
Hi,

On Tue, Aug 19, 2014 at 12:50:59AM +0200, Javier Martinez Canillas wrote:
 Hello Mugunthan,
 
 On Mon, Aug 18, 2014 at 9:58 PM, Mugunthan V N mugunthan...@ti.com wrote:
 
  Thus, for this patchset, as is:
 
  Tested-by: Steven Rostedt rost...@goodmis.org
 
  This will fail for DRA7xx not in AM33xx
 
 
 cpsw_am33xx_cm_get_macid() checks for
 of_machine_is_compatible(ti,am33xx) and returns 0 if the machine is
 not an am33xx. cpsw_probe_dt() only propagates the return value if is
 not 0 so this patch does not change the semantics for other SoCs
 besides am33xx.

Yes, this patch is only about the am33xx. I don't have the DRA7xx
hardware so I am not able to test on that hardware. Mugunthan, perhaps
you can supply some followup patches for DRA7xx.

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- |


signature.asc
Description: Digital signature


Re: [PATCH v3 5/7] net: cpsw: Add am33xx MACID readout

2014-08-18 Thread Markus Pargmann
Hi,

On Sat, Aug 16, 2014 at 11:46:48AM -0500, Wolfram Sang wrote:
 
  diff --git a/drivers/net/ethernet/ti/Makefile 
  b/drivers/net/ethernet/ti/Makefile
  index 9cfaab8152be..5a31c2b322ee 100644
  --- a/drivers/net/ethernet/ti/Makefile
  +++ b/drivers/net/ethernet/ti/Makefile
  @@ -8,5 +8,6 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
   obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
   obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
   obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
  +obj-$(CONFIG_TI_CPSW_CTRL_MACID) += cpsw-ctrl-macid.o
   obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
   ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
 
 Leftover from your last series?

Yes thanks, will remove it for the next version.

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- |


signature.asc
Description: Digital signature


Re: [PATCH v3 5/7] net: cpsw: Add am33xx MACID readout

2014-08-18 Thread Markus Pargmann
On Sat, Aug 16, 2014 at 11:53:18AM -0500, Wolfram Sang wrote:
 
  +   mac_addr[5] = (macid_lo  8)  0xff;
  +   mac_addr[4] = macid_lo  0xff;
  +   mac_addr[3] = (macid_hi  24)  0xff;
  +   mac_addr[2] = (macid_hi  16)  0xff;
  +   mac_addr[1] = (macid_hi  8)  0xff;
  +   mac_addr[0] = macid_hi  0xff;
 
 That looks twisted, but I assume that you tested it is correct.

The registers are twisted that way.

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- |


signature.asc
Description: Digital signature


[PATCH v3 6/7] am33xx: define syscon control module device node

2014-08-16 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/am33xx.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 4a4e02d0ce9e..cb1113bcc290 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -132,6 +132,11 @@
};
};
 
+   cm: syscon@44e1 {
+   compatible = ti,am33xx-controlmodule, syscon;
+   reg = 0x44e1 0x800;
+   };
+
intc: interrupt-controller@4820 {
compatible = ti,omap2-intc;
interrupt-controller;
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/7] net: cpsw: Support for am335x chip MACIDs

2014-08-16 Thread Markus Pargmann
Hi,

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.

In v3 I removed the previously seperate driver and included the changes into
the main cpsw driver. I now check for a am33xx machine to not make this
operation when running on davinci.

Patches 1-4 are some minor fixes for the cpsw driver.
Patch 5 adds the readout support.
Patches 6 and 7 are for am33xx.dtsi to actually enable this feature.

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/Makefile   |  1 +
 drivers/net/ethernet/ti/cpsw.c | 49 --
 drivers/net/ethernet/ti/cpsw.h |  1 +
 6 files changed, 61 insertions(+), 4 deletions(-)

-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 1/7] DT doc: net: cpsw mac-address is optional

2014-08-16 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index ae2b8b7f9c38..107caf174a0e 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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.
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 5/7] net: cpsw: Add am33xx MACID readout

2014-08-16 Thread Markus Pargmann
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 m...@pengutronix.de
---
 Documentation/devicetree/bindings/net/cpsw.txt |  4 +++
 drivers/net/ethernet/ti/Kconfig|  2 ++
 drivers/net/ethernet/ti/Makefile   |  1 +
 drivers/net/ethernet/ti/cpsw.c | 46 --
 4 files changed, 51 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 107caf174a0e..33fe8462edf4 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -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:
@@ -57,6 +59,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
@@ -85,6 +88,7 @@ Examples:
active_slave = 0;
cpts_clock_mult = 0x8000;
cpts_clock_shift = 29;
+   syscon = cm;
cpsw_emac0: slave@0 {
phy_id = davinci_mdio, 0;
phy-mode = rgmii-txid;
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 53150c25a96b..afaf0196ffd2 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -62,6 +62,8 @@ config TI_CPSW
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select MFD_SYSCON
+   select REGMAP
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
index 9cfaab8152be..5a31c2b322ee 100644
--- a/drivers/net/ethernet/ti/Makefile
+++ b/drivers/net/ethernet/ti/Makefile
@@ -8,5 +8,6 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
 obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
+obj-$(CONFIG_TI_CPSW_CTRL_MACID) += cpsw-ctrl-macid.o
 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
 ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index b52df53441b0..aa13f68a178c 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -33,6 +33,8 @@
 #include linux/of_net.h
 #include linux/of_device.h
 #include linux/if_vlan.h
+#include linux/mfd/syscon.h
+#include linux/regmap.h
 
 #include linux/pinctrl/consumer.h
 
@@ -1796,6 +1798,39 @@ static void cpsw_slave_init(struct cpsw_slave *slave, 
struct cpsw_priv *priv,
slave-port_vlan = data-dual_emac_res_vlan;
 }
 
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x630 + 0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x630 + 0x8 * id + 0x4)
+
+static int cpsw_am33xx_cm_get_macid(struct device *dev, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+   struct regmap *syscon;
+
+   if (!of_machine_is_compatible(ti,am33xx))
+   return 0;
+
+   syscon = syscon_regmap_lookup_by_phandle(dev-of_node, syscon);
+   if (IS_ERR(syscon)) {
+   if (PTR_ERR(syscon) == -ENODEV)
+   return 0;
+   return PTR_ERR(syscon);
+   }
+
+   regmap_read(syscon, AM33XX_CTRL_MAC_LO_REG(slave), macid_lo);
+   regmap_read(syscon, AM33XX_CTRL_MAC_HI_REG(slave), macid_hi);
+
+   mac_addr[5] = (macid_lo  8)  0xff;
+   mac_addr[4] = macid_lo  0xff;
+   mac_addr[3] = (macid_hi  24)  0xff;
+   mac_addr[2] = (macid_hi  16)  0xff;
+   mac_addr[1] = (macid_hi  8)  0xff;
+   mac_addr[0] = macid_hi  0xff;
+
+   return 0;
+}
+
 static int cpsw_probe_dt(struct cpsw_platform_data *data,
 struct platform_device *pdev)
 {
@@ -1908,8 +1943,15 @@ 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)
-   memcpy(slave_data-mac_addr, mac_addr, ETH_ALEN);
+   if (mac_addr) {
+   memcpy(slave_data-mac_addr, mac_addr,
+   ETH_ALEN);
+   } else {
+   ret

[PATCH v3 7/7] arm: dts: am33xx, Add syscon phandle to cpsw node

2014-08-16 Thread Markus Pargmann
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 m...@pengutronix.de
---
 arch/arm/boot/dts/am33xx.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index cb1113bcc290..5e9bfb3b9f1d 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -692,6 +692,7 @@
 */
interrupts = 40 41 42 43;
ranges;
+   syscon = cm;
status = disabled;
 
davinci_mdio: mdio@4a101000 {
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 3/7] net: cpsw: header, Add missing include

2014-08-16 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49da693f..1b710674630c 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 2/7] net: cpsw: Add missing return value

2014-08-16 Thread Markus Pargmann
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 m...@pengutronix.de
---
 drivers/net/ethernet/ti/cpsw.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index ff380dac6629..43b2777f8e04 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2043,6 +2043,7 @@ static int cpsw_probe(struct platform_device *pdev)
priv-irq_enabled = true;
if (!priv-cpts) {
dev_err(pdev-dev, error allocating cpts\n);
+   ret = -ENOMEM;
goto clean_ndev_ret;
}
 
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 4/7] net: cpsw: Replace pr_err by dev_err

2014-08-16 Thread Markus Pargmann
Use dev_err instead of pr_err.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/net/ethernet/ti/cpsw.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 43b2777f8e04..b52df53441b0 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1901,7 +1901,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
mdio = of_find_device_by_node(mdio_node);
of_node_put(mdio_node);
if (!mdio) {
-   pr_err(Missing mdio platform device\n);
+   dev_err(pdev-dev, Missing mdio platform device\n);
return -EINVAL;
}
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: OMAP2+: omap_device: remove warning that clk alias already exists

2014-08-04 Thread Markus Pargmann
When an alias for a clock already exists the warning is printed. For
every module with a main_clk defined, a clk alias for fck is added.
There are some components that have the same main_clk defined, so this
is a really normal situation.

For example the am33xx edma device has 4 components using the same main
clock. So there are three warnings in the boot log for this already
existing clock alias:
platform 4900.edma: alias fck already exists
platform 4900.edma: alias fck already exists
platform 4900.edma: alias fck already exists

As this is only interesting for developers, this patch changes the
message to a debug message.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/mach-omap2/omap_device.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/omap_device.c 
b/arch/arm/mach-omap2/omap_device.c
index 01ef59def44b..d22c30d3ccfa 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -56,7 +56,7 @@ static void _add_clkdev(struct omap_device *od, const char 
*clk_alias,
 
r = clk_get_sys(dev_name(od-pdev-dev), clk_alias);
if (!IS_ERR(r)) {
-   dev_warn(od-pdev-dev,
+   dev_dbg(od-pdev-dev,
 alias %s already exists\n, clk_alias);
clk_put(r);
return;
-- 
2.0.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] net: micrel : ks8851-ml: add vdd-supply support

2014-03-25 Thread Markus Pargmann
Hi,

On Mon, Mar 24, 2014 at 12:37:58AM -0400, David Miller wrote:
 From: Nishanth Menon n...@ti.com
 Date: Fri, 21 Mar 2014 01:52:48 -0500
 
  Few platforms use external regulator to keep the ethernet MAC supplied.
  So, request and enable the regulator for driver functionality.
  
  Fixes: 66fda75f47dc (regulator: core: Replace direct ops-disable usage)
  Reported-by: Russell King rmk+ker...@arm.linux.org.uk
  Suggested-by: Markus Pargmann m...@pengutronix.de
  Signed-off-by: Nishanth Menon n...@ti.com
 
 Applied, thanks.
 

The two regulator patches for enable and disable are going into the
stable trees so this should also be submitted to stable for 3.10 to
3.13.

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- |


signature.asc
Description: Digital signature


Re: [PATCH] net: micrel : ks8851-ml: add vdd-supply support

2014-03-21 Thread Markus Pargmann
Hi,

On Fri, Mar 21, 2014 at 01:52:48AM -0500, Nishanth Menon wrote:
 Few platforms use external regulator to keep the ethernet MAC supplied.
 So, request and enable the regulator for driver functionality.
 
 Fixes: 66fda75f47dc (regulator: core: Replace direct ops-disable usage)
 Reported-by: Russell King rmk+ker...@arm.linux.org.uk
 Suggested-by: Markus Pargmann m...@pengutronix.de
 Signed-off-by: Nishanth Menon n...@ti.com
 ---
 
 This fixes a regression in SDP4430 platform as reported by Russel here:
 http://marc.info/?t=139509918200014r=1w=2
 
 Patch is based on [v3.14-rc7] tag, if it is too late to submit, I can repost
 rebased to git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git
 
  .../devicetree/bindings/net/micrel-ks8851.txt  |1 +
  drivers/net/ethernet/micrel/ks8851.c   |   30 
 +++-
  2 files changed, 30 insertions(+), 1 deletion(-)
 
 diff --git a/Documentation/devicetree/bindings/net/micrel-ks8851.txt 
 b/Documentation/devicetree/bindings/net/micrel-ks8851.txt
 index 11ace3c..4fc3927 100644
 --- a/Documentation/devicetree/bindings/net/micrel-ks8851.txt
 +++ b/Documentation/devicetree/bindings/net/micrel-ks8851.txt
 @@ -7,3 +7,4 @@ Required properties:
  
  Optional properties:
  - local-mac-address : Ethernet mac address to use
 +- vdd-supply:supply for Ethernet mac
 diff --git a/drivers/net/ethernet/micrel/ks8851.c 
 b/drivers/net/ethernet/micrel/ks8851.c
 index 727b546a..e0c92e0 100644
 --- a/drivers/net/ethernet/micrel/ks8851.c
 +++ b/drivers/net/ethernet/micrel/ks8851.c
 @@ -23,6 +23,7 @@
  #include linux/crc32.h
  #include linux/mii.h
  #include linux/eeprom_93cx6.h
 +#include linux/regulator/consumer.h
  
  #include linux/spi/spi.h
  
 @@ -83,6 +84,7 @@ union ks8851_tx_hdr {
   * @rc_rxqcr: Cached copy of KS_RXQCR.
   * @eeprom_size: Companion eeprom size in Bytes, 0 if no eeprom
   * @eeprom: 93CX6 EEPROM state for accessing on-board EEPROM.
 + * @vdd_reg: Optional regulator supplying the chip
   *
   * The @lock ensures that the chip is protected when certain operations are
   * in progress. When the read or write packet transfer is in progress, most
 @@ -130,6 +132,7 @@ struct ks8851_net {
   struct spi_transfer spi_xfer2[2];
  
   struct eeprom_93cx6 eeprom;
 + struct regulator*vdd_reg;
  };
  
  static int msg_enable;
 @@ -1414,6 +1417,21 @@ static int ks8851_probe(struct spi_device *spi)
   ks-spidev = spi;
   ks-tx_space = 6144;
  
 + ks-vdd_reg = regulator_get_optional(spi-dev, vdd);

You could use devm_regulator_get_optional here and remove the
regulator_put.

Regards,

Markus

 + if (IS_ERR(ks-vdd_reg)) {
 + ret = PTR_ERR(ks-vdd_reg);
 + if (ret == -EPROBE_DEFER)
 + goto err_reg;
 + } else {
 + ret = regulator_enable(ks-vdd_reg);
 + if (ret) {
 + dev_err(spi-dev, regulator enable fail: %d\n,
 + ret);
 + goto err_reg_en;
 + }
 + }
 +
 +
   mutex_init(ks-lock);
   spin_lock_init(ks-statelock);
  
 @@ -1508,8 +1526,14 @@ static int ks8851_probe(struct spi_device *spi)
  err_netdev:
   free_irq(ndev-irq, ks);
  
 -err_id:
  err_irq:
 +err_id:
 + if (!IS_ERR(ks-vdd_reg))
 + regulator_disable(ks-vdd_reg);
 +err_reg_en:
 + if (!IS_ERR(ks-vdd_reg))
 + regulator_put(ks-vdd_reg);
 +err_reg:
   free_netdev(ndev);
   return ret;
  }
 @@ -1523,6 +1547,10 @@ static int ks8851_remove(struct spi_device *spi)
  
   unregister_netdev(priv-netdev);
   free_irq(spi-irq, priv);
 + if (!IS_ERR(priv-vdd_reg)) {
 + regulator_disable(priv-vdd_reg);
 + regulator_put(priv-vdd_reg);
 + }
   free_netdev(priv-netdev);
  
   return 0;
 -- 
 1.7.9.5
 
 

-- 
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- |


signature.asc
Description: Digital signature


Re: OMAP4 SDP regression...

2014-03-18 Thread Markus Pargmann
Hi,

On Mon, Mar 17, 2014 at 06:35:07PM -0700, Tony Lindgren wrote:
 * Russell King - ARM Linux li...@arm.linux.org.uk [140317 16:35]:
  There's been a couple of regressions on OMAP4430 SDP I've only recently
  noticed:
  
  http://www.arm.linux.org.uk/developer/build/result.php?type=bootidx=1597
  
  Configuring network interfaces... udhcpc (v1.9.1) started
  Sending discover...
  Sending discover...
  Sending discover...
  No lease, failing
  done.
  
  No link lights come up either.  The hardware is fine because uboot manages
  to successfully tftp the kernel.
  
  It looks like it was working in -rc4+armsoc and -rc5+armsoc, but not
  -rc6+armsoc.
  
  From what I can see, nothing has changed in drivers/net/ethernet/micrel/
  since rc5.
  
  I've been through the delta from 3.14-rc5, and I don't see anything
  obvious.  Any ideas?  Known problem?
 
 Seems like plain v3.14-rc6 fails for me while -rc5 works. Bisecting
 points to:
 
 66fda75f regulator: core: Replace direct ops-disable usage
 
 Also verified that v3.14-rc6 with 66fda75f reverted also works.
 
 Markus  Mark, any ideas?

I just had a look into the specific dts 'omap4-sdp.dts'. It defines a
'vdd_eth' at the top of the file, which is a fixed regulator using gpios
with 'regulator-boot-on'. This regulator is also passed to the ks8851
driver as vdd-supply. But this supply is not used in the driver.

The problem may be that the fixed regulator was never enabled/disabled
before my patch. As the network driver does not enable the regulator
manually, it will be disabled by the regulator framework. A
'regulator-always-on' may help here.

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- |


signature.asc
Description: Digital signature


Re: [PATCH v2 3/5] net: cpsw: Add control-module macid driver

2014-03-18 Thread Markus Pargmann
Hi,

On Mon, Mar 17, 2014 at 10:11:36AM -0700, Tony Lindgren wrote:
 Hi,
 
 * Markus Pargmann m...@pengutronix.de [140315 06:12]:
  This driver extracts the hardware macid from the control module of
  am335x processors. It exports a function cpsw_ctrl_macid_read for cpsw
  to get the macid from within the processor.
 
 Few things have improved recently :) This can be now implemented
 in a much cleaner way using regmap against the already defined syscon
 node.
 
 For an example, see how the MMC PBIAS regulator is using regmap
 in Linux next:
 
 11469e0bb1 (regulator: add pbias regulator support)
 cd042fe5c1 (ARM: dts: add pbias dt node)
 
 That avoids the problem of the tinkering with SoC specific registers
 that belong to another device.
 
 So please update this series for regmap, let's not add more mapping
 of system control module registers to the drivers.

Thanks, I will have a look into this and update the series.

Regards,

Markus

 
 Regards,
 
 Tony
 

-- 
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- |


signature.asc
Description: Digital signature


Re: [PATCH v2 3/5] net: cpsw: Add control-module macid driver

2014-03-18 Thread Markus Pargmann
Hi Uwe,

On Mon, Mar 17, 2014 at 10:05:08AM +0100, Uwe Kleine-König wrote:
 Hello Markus,
 
 On Sat, Mar 15, 2014 at 02:07:42PM +0100, Markus Pargmann wrote:
  This driver extracts the hardware macid from the control module of
  am335x processors. It exports a function cpsw_ctrl_macid_read for cpsw
  to get the macid from within the processor.
  
  Signed-off-by: Markus Pargmann m...@pengutronix.de
  ---
   .../devicetree/bindings/net/cpsw-ctrl-macid.txt|  32 +
   drivers/net/ethernet/ti/Kconfig|   1 +
   drivers/net/ethernet/ti/Makefile   |   2 +-
   drivers/net/ethernet/ti/cpsw-ctrl-macid.c  | 138 
  +
   4 files changed, 172 insertions(+), 1 deletion(-)
   create mode 100644 
  Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
   create mode 100644 drivers/net/ethernet/ti/cpsw-ctrl-macid.c
  
  diff --git a/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt 
  b/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
  new file mode 100644
  index 000..4eb39f6
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
  @@ -0,0 +1,32 @@
  +TI CPSW ctrl macid Devicetree bindings
  +--
  +
  +Required properties:
  + - compatible  : Should be ti,am3352-cpsw-ctrl-macid
 this is called am3352-..., still you add it (in patch 5) to am33xx.dtsi
 and in the commit log you wrote about am335x. Looks abstruse.

This is of course for the whole am335x series. But as the cpsw phy_sel
driver already uses ti,am3352-cpsw-phy-sel as compatible, I didn't
want to create more confusion about the bindings and stick with a
similar compatible pattern.

 
  + - reg : physical base address and size of the cpsw
  + registers map
  + - reg-names   : names of the register map given in reg node
  + - #ti,mac-address-ctrl-cells  : Should be 1
 Would be sensible to drop this property, or at least let it default to 1
 if missing?

I would actually prefer to have this property here. But I will implement
a default value for this in the driver.

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- |


signature.asc
Description: Digital signature


[PATCH v2 5/5] arm: dts: am33xx, Add device node for cpsw-ctrl-macid

2014-03-15 Thread Markus Pargmann
Add cpsw-ctrl-macid to the am33xx dtsi file. It does not change the
behaviour of boards with a provided mac-address, so it is safe to add it
for all boards with this CPU.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/am33xx.dtsi | 9 +
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 6d95d3d..5aff257 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -690,11 +690,13 @@
cpsw_emac0: slave@4a100200 {
/* Filled in by U-Boot */
mac-address = [ 00 00 00 00 00 00 ];
+   ti,mac-address-ctrl = cpsw_ctrl_macid 0;
};
 
cpsw_emac1: slave@4a100300 {
/* Filled in by U-Boot */
mac-address = [ 00 00 00 00 00 00 ];
+   ti,mac-address-ctrl = cpsw_ctrl_macid 1;
};
 
phy_sel: cpsw-phy-sel@44e10650 {
@@ -702,6 +704,13 @@
reg= 0x44e10650 0x4;
reg-names = gmii-sel;
};
+
+   cpsw_ctrl_macid: cpsw-ctrl-macid@44e10630 {
+   compatible = ti,am3352-cpsw-ctrl-macid;
+   #ti,mac-address-ctrl-cells = 1;
+   reg = 0x44e10630 0x10;
+   reg-names = ctrl-macid;
+   };
};
 
ocmcram: ocmcram@4030 {
-- 
1.9.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/5] net: cpsw: make cpsw.h self-contained

2014-03-15 Thread Markus Pargmann
cpsw.h uses the symbol MII_BUS_ID_SIZE which is defined in
linux/phy.h. Add the respective #include to not depend on users to
include it themselves.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49d..1b71067 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
1.9.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/5] net: cpsw: Support for am335x chip MACIDs

2014-03-15 Thread Markus Pargmann
Hi,

This series introduces a driver to read and use the MACIDs stored in the am335x
control module. These are read-only registers for a unique MACID. At the moment
the MACIDs are generated randomly when the mac-address property is not a valid
mac address.

In v2 I changed the precedence of mac-address and this driver. This driver is
only used when no mac-address was set by the bootloader. This way we can avoid
using random MAC addresses.  There are other minor style and documentation
fixes in v2.

Best regards,

Markus


Markus Pargmann (5):
  net: cpsw: document mac-address being optional
  net: cpsw: make cpsw.h self-contained
  net: cpsw: Add control-module macid driver
  net: cpsw: Use cpsw-ctrl-macid driver
  arm: dts: am33xx, Add device node for cpsw-ctrl-macid

 .../devicetree/bindings/net/cpsw-ctrl-macid.txt|  32 +
 Documentation/devicetree/bindings/net/cpsw.txt |   8 +-
 arch/arm/boot/dts/am33xx.dtsi  |   9 ++
 drivers/net/ethernet/ti/Kconfig|   1 +
 drivers/net/ethernet/ti/Makefile   |   2 +-
 drivers/net/ethernet/ti/cpsw-ctrl-macid.c  | 138 +
 drivers/net/ethernet/ti/cpsw.c |  16 ++-
 drivers/net/ethernet/ti/cpsw.h |   3 +
 8 files changed, 204 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
 create mode 100644 drivers/net/ethernet/ti/cpsw-ctrl-macid.c

-- 
1.9.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/5] net: cpsw: document mac-address being optional

2014-03-15 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 05d660e..c39f077 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -30,10 +30,10 @@ Required properties:
 - phy_id   : Specifies slave phy id
 - phy-mode : The interface between the SoC and the PHY (a string
  that of_get_phy_mode() can understand)
-- mac-address  : Specifies slave MAC address
 
 Optional properties:
 - dual_emac_res_vlan   : Specifies VID to be used to segregate the ports
+- mac-address  : Specifies slave MAC address
 
 Note: ti,hwmods field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
-- 
1.9.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 4/5] net: cpsw: Use cpsw-ctrl-macid driver

2014-03-15 Thread Markus Pargmann
Use ctrl-macid driver to obtain the macids stored in the processor. This
is only done when defined in DT.

The internal macid is not used if mac-address is given explicitly. So it
does not change the behavior if the bootloader provides a mac address
through the mac-address property

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 Documentation/devicetree/bindings/net/cpsw.txt |  6 ++
 drivers/net/ethernet/ti/cpsw.c | 16 +---
 drivers/net/ethernet/ti/cpsw.h |  2 ++
 3 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index c39f077..b997b96 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -34,6 +34,12 @@ Required properties:
 Optional properties:
 - dual_emac_res_vlan   : Specifies VID to be used to segregate the ports
 - mac-address  : Specifies slave MAC address
+- ti,mac-address-ctrl  : When cpsw-ctrl-macid support is compiled-in, this can
+ be set to a phandle with one argument, see
+ cpsw-ctrl-macid.txt. If this method fails, cpsw falls
+ back to a random mac-address. An explicit mac-address
+ property takes precedence.
+
 
 Note: ti,hwmods field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 651087b..05f4948 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1892,8 +1892,15 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
}
 
mac_addr = of_get_mac_address(slave_node);
-   if (mac_addr)
-   memcpy(slave_data-mac_addr, mac_addr, ETH_ALEN);
+   if (mac_addr) {
+   memcpy(slave_data-mac_addr, mac_addr,
+   ETH_ALEN);
+   } else {
+   ret = cpsw_ctrl_macid_read(slave_node,
+   slave_data-mac_addr);
+   if (ret == -EPROBE_DEFER)
+   return ret;
+   }
 
slave_data-phy_if = of_get_phy_mode(slave_node);
if (slave_data-phy_if  0) {
@@ -2038,10 +2045,13 @@ static int cpsw_probe(struct platform_device *pdev)
/* Select default pin state */
pinctrl_pm_select_default_state(pdev-dev);
 
-   if (cpsw_probe_dt(priv-data, pdev)) {
+   ret = cpsw_probe_dt(priv-data, pdev);
+   if (ret == -EINVAL) {
pr_err(cpsw: platform data missing\n);
ret = -ENODEV;
goto clean_runtime_disable_ret;
+   } else if (ret) {
+   goto clean_runtime_disable_ret;
}
data = priv-data;
 
diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 1b71067..222eebe 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -42,4 +42,6 @@ struct cpsw_platform_data {
 
 void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave);
 
+int cpsw_ctrl_macid_read(struct device_node *np, u8 *mac_addr);
+
 #endif /* __CPSW_H__ */
-- 
1.9.0

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] ARM: dts: tps65910 backup battery regulator

2014-02-16 Thread Markus Pargmann
Hi,

On Thu, Jan 16, 2014 at 05:08:23PM +0100, Markus Pargmann wrote:
 This patch adds a devicetree node for the backup battery regulator.
 
 Signed-off-by: Markus Pargmann m...@pengutronix.de
 ---
 Hi,
 
 Mark Brown applied [1] the other part of the series which adds 'vbb' as
 regulator-compatible. I forgot to add you in Cc.

Any comments on this?

Regards,

Markus

 
 Regards,
 
 Markus
 
 [1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/289815/focus=290089
 
  arch/arm/boot/dts/tps65910.dtsi | 5 +
  1 file changed, 5 insertions(+)
 
 diff --git a/arch/arm/boot/dts/tps65910.dtsi b/arch/arm/boot/dts/tps65910.dtsi
 index 92693a8..b0ac665 100644
 --- a/arch/arm/boot/dts/tps65910.dtsi
 +++ b/arch/arm/boot/dts/tps65910.dtsi
 @@ -82,5 +82,10 @@
   reg = 12;
   regulator-compatible = vmmc;
   };
 +
 + vbb_reg: regulator@13 {
 + reg = 13;
 + regulator-compatible = vbb;
 + };
   };
  };
 -- 
 1.8.5.2
 
 

-- 
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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 0/2] usb: musb dsps updates

2014-02-16 Thread Markus Pargmann
Hi,

On Fri, Jan 17, 2014 at 10:22:34AM +0100, Markus Pargmann wrote:
 Hi,
 
 The two remaining patches from the previous series usb: musb bugfixes. In v4
 I used the device name for the debugfs root dir and added a commit message to
 the second patch.

Felipe, could you please have a look at this?

Thanks,

Markus

 
 Regards,
 
 Markus
 
 
 Markus Pargmann (2):
   usb: musb: dsps, debugfs files
   usb: musb: dsps, use devm_kzalloc
 
  drivers/usb/musb/musb_dsps.c | 58 
 +---
  1 file changed, 55 insertions(+), 3 deletions(-)
 
 -- 
 1.8.5.2
 
 

-- 
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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] drm/tilcdc: Defer probe if no encoders/connectors found

2014-02-16 Thread Markus Pargmann
Hi,

On Wed, Dec 18, 2013 at 02:56:01PM +0100, Markus Pargmann wrote:
 At the moment this driver fails to load if no encoders/connectors were
 found. In case other drivers that register encoders/connectors
 (tilcdc_panel) are defered it would be better to check for
 encoders/connectors later again. This patch replaces the returncode
 -ENXIO with -EPROBE_DEFER to get a working setup even if tilcdc_panel
 probes after tilcdc.
 

Ping. Anything I need to change?

Regards,

Markus

 Signed-off-by: Markus Pargmann m...@pengutronix.de
 ---
  drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
 b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
 index 116da19..217303c 100644
 --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
 +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
 @@ -84,7 +84,7 @@ static int modeset_init(struct drm_device *dev)
   if ((priv-num_encoders == 0) || (priv-num_connectors == 0)) {
   /* oh nos! */
   dev_err(dev-dev, no encoders/connectors found\n);
 - return -ENXIO;
 + return -EPROBE_DEFER;
   }
  
   dev-mode_config.min_width = 0;
 -- 
 1.8.5.1
 
 

-- 
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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 4/6] net: cpsw: Use cpsw-ctrl-macid driver

2014-02-14 Thread Markus Pargmann
Hi Uwe,

On Thu, Feb 13, 2014 at 08:37:02PM +0100, Uwe Kleine-König wrote:
 Hello Markus,
 
 On Wed, Dec 18, 2013 at 05:47:20PM +0100, Markus Pargmann wrote:
  Use ctrl-macid driver to obtain the macids stored in the processor. This
  is only done when defined in DT.
  
  Signed-off-by: Markus Pargmann m...@pengutronix.de
  ---
   Documentation/devicetree/bindings/net/cpsw.txt |  5 +
   drivers/net/ethernet/ti/cpsw.c | 18 ++
   drivers/net/ethernet/ti/cpsw.h |  2 ++
   3 files changed, 21 insertions(+), 4 deletions(-)
  
  diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
  b/Documentation/devicetree/bindings/net/cpsw.txt
  index c39f077..b95c38b 100644
  --- a/Documentation/devicetree/bindings/net/cpsw.txt
  +++ b/Documentation/devicetree/bindings/net/cpsw.txt
  @@ -34,6 +34,11 @@ Required properties:
   Optional properties:
   - dual_emac_res_vlan   : Specifies VID to be used to segregate the 
  ports
   - mac-address  : Specifies slave MAC address
  +- ti,mac-address-ctrl  : When cpsw-ctrl-macid support is compiledin, 
  this can
  + be set to a phandle with one argument, see
  + cpsw-ctrl-macid.txt. If this method fails, cpsw falls
  + back to mac-address or random mac-address.
  +
   
   Note: ti,hwmods field is used to fetch the base address and irq
   resources from TI, omap hwmod data base during device registration.
  diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
  index 5120d9c..382d793 100644
  --- a/drivers/net/ethernet/ti/cpsw.c
  +++ b/drivers/net/ethernet/ti/cpsw.c
  @@ -1804,9 +1804,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data 
  *data,
  snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
   PHY_ID_FMT, mdio-name, phyid);
   
  -   mac_addr = of_get_mac_address(slave_node);
  -   if (mac_addr)
  -   memcpy(slave_data-mac_addr, mac_addr, ETH_ALEN);
  +   ret = cpsw_ctrl_macid_read(slave_node, slave_data-mac_addr);
  +   if (ret) {
  +   if (ret == -EPROBE_DEFER)
  +   return ret;
  +
  +   mac_addr = of_get_mac_address(slave_node);
  +   if (mac_addr)
  +   memcpy(slave_data-mac_addr, mac_addr,
  +   ETH_ALEN);
  +   }
 I'd do it the other way round: Use the contents from an explicit
 mac-address or local-mac-address property (i.e. of_get_mac_address)
 and if that doesn't return anything use the mac-address-ctrl as
 fallback.

Yes you are right. In this case this wouldn't even influence any boots
with u-boot which already set the correct mac-address property.

I will fix this.

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/6] net: cpsw: Add control-module macid driver

2014-02-14 Thread Markus Pargmann
Hi,

On Thu, Feb 13, 2014 at 08:44:31PM +0100, Uwe Kleine-König wrote:
 On Wed, Dec 18, 2013 at 05:47:19PM +0100, Markus Pargmann wrote:
  This driver extracts the hardware macid from the control module of
  am335x processors. It exports a function cpsw_ctrl_macid_read for cpsw
  to get the macid from within the processor.
  
  This driver is not used, unless it is defined in DT and referenced by a
  cpsw slave with a phandle.
  
  Signed-off-by: Markus Pargmann m...@pengutronix.de
  ---
   .../devicetree/bindings/net/cpsw-ctrl-macid.txt|  31 +
   drivers/net/ethernet/ti/Kconfig|   8 ++
   drivers/net/ethernet/ti/Makefile   |   1 +
   drivers/net/ethernet/ti/cpsw-ctrl-macid.c  | 138 
  +
   4 files changed, 178 insertions(+)
   create mode 100644 
  Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
   create mode 100644 drivers/net/ethernet/ti/cpsw-ctrl-macid.c
  
  diff --git a/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt 
  b/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
  new file mode 100644
  index 000..abff2af
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
  @@ -0,0 +1,31 @@
  +TI CPSW ctrl macid Devicetree bindings
  +--
  +
  +Required properties:
  + - compatible  : Should be ti,am3352-cpsw-ctrl-macid
  + - reg : physical base address and size of the cpsw
  + registers map
  + - reg-names   : names of the register map given in reg node
  + - #ti,cpsw-ctrl-macid : Should be 1
 #ti,mac-address-ctrl-cells?

Sounds better, will fix.

 
  +
  +When used from cpsw, ti,mac-address-ctrl should be a phandle to this 
  device
  +node with one argument, 0 or 1 to select the macid 0 or 1.
  +
  +Examples:
  +
  +   cpsw_ctrl_macid: cpsw-ctrl-macid@44e10630 {
  +   compatible = ti,am3352-cpsw-ctrl-macid;
  +   #ti,mac-address-ctrl-cells = 1;
  +   reg = 0x44e10630 0x16;
 s/0x16/0x10/

Thanks, that's a bug, obviously we only have 4, not 5.5 registers.

 
  +   reg-names = ctrl-macid;
  +   };
  +
  +Used in cpsw slave nodes like this:
  +
  +   cpsw_emac0: slave@4a100200 {
  +   ti,mac-address-ctrl = cpsw_ctrl_macid 0;
  +   };
  +
  +   cpsw_emac1: slave@4a100300 {
  +   ti,mac-address-ctrl = cpsw_ctrl_macid 1;
  +   };
  diff --git a/drivers/net/ethernet/ti/Kconfig 
  b/drivers/net/ethernet/ti/Kconfig
  index 53150c2..24819ef 100644
  --- a/drivers/net/ethernet/ti/Kconfig
  +++ b/drivers/net/ethernet/ti/Kconfig
  @@ -56,12 +56,20 @@ config TI_CPSW_PHY_SEL
This driver supports configuring of the phy mode connected to
the CPSW.
   
  +config TI_CPSW_CTRL_MACID
  +   boolean TI CPSW internal MACID support
  +   depends on TI_CPSW
  +   ---help---
  + This driver supports reading the hardcoded MACID from am33xx
  + processors control module.
  +
 Would it be nicer to put this after the TI_CPSW definition. (Think
 $(make config).)

I inserted TI_CPSW_CTRL_MACID here because the other TI_CPSW specific
subdriver (TI_CPSW_PHY_SEL) was above TI_CPSW. But I could change this.

 
   config TI_CPSW
  tristate TI CPSW Switch Support
  depends on ARM  (ARCH_DAVINCI || SOC_AM33XX)
  select TI_DAVINCI_CPDMA
  select TI_DAVINCI_MDIO
  select TI_CPSW_PHY_SEL
  +   select TI_CPSW_CTRL_MACID
 If TI_CPSW selects TI_CPSW_CTRL_MACID the latter doesn't need to depend
 on the former. So this optin is user visible but never
 user-(de)selectable. I'd say drop the Kconfig symbol and just add
 cpsw-ctrl-macid.o to ti_cpsw-y in the Makefile (or really make it
 optional).

As this is closely related to the cpsw driver, I think it's better to
make it non-optional and include it in the Makefile.

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] arm: dtsi: am335x-bone-common, usb0 is peripheral only

2014-02-14 Thread Markus Pargmann
Hi,

On Thu, Feb 13, 2014 at 03:25:52PM -0800, Tony Lindgren wrote:
 * Markus Pargmann m...@pengutronix.de [140213 15:16]:
  Hi,
  
  On Thu, Feb 13, 2014 at 02:54:38PM -0800, Tony Lindgren wrote:
   * Markus Pargmann m...@pengutronix.de [140111 06:03]:
The PMIC is using usb0 vbus line as power source. It is also connected
to the am335x processor as vbus sense. But there is no possibility to
pullup usb0 vbus to operate as host. This patch fixes the dr_mode of 
usb0.
   
   That's the MUSB? AFAIK it's not possible to operate MUSB in peripheral
   only mode because the hardware does what it wants based on the ID
   pin state.
  
  Yes that's MUSB. The am335x reference manual describes that it is
  possible to force peripheral/host mode by setting bit 7 (IDDIG_MUX) in
  register USBnMODE to 1. Then it uses the bit written in bit 8 (IDDIG) of
  register USBnMODE to set host/peripheral mode.
 
 OK
  
  I am not sure if the driver supports it yet but I think the DTS should
  contain the correct mode nevertheless, especially to avoid starting the
  otg loops in the musb driver.
 
 Well there's one more thing to consider.. I think in the OTG role change
 case the VBUS is still driven externally from the original host, so the
 lack of VBUS does not always mean that host mode should be disabled.

I thought more about the hardware description than the possible role
changes through software protocols. In a hardware perspective, this USB
port is only in peripheral mode, as it can't drive VBUS. However is
there any support for role change protocols in the kernel yet?

Perhaps we have to add a seperate DT binding for usb role changes when
they are supported. This would help to describe the hardware
capabilities (host, peripheral or OTG) and the role change protocols
supported.

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] arm: dtsi: am335x-bone-common, usb0 is peripheral only

2014-02-13 Thread Markus Pargmann
Hi,

On Thu, Feb 13, 2014 at 02:54:38PM -0800, Tony Lindgren wrote:
 * Markus Pargmann m...@pengutronix.de [140111 06:03]:
  The PMIC is using usb0 vbus line as power source. It is also connected
  to the am335x processor as vbus sense. But there is no possibility to
  pullup usb0 vbus to operate as host. This patch fixes the dr_mode of usb0.
 
 That's the MUSB? AFAIK it's not possible to operate MUSB in peripheral
 only mode because the hardware does what it wants based on the ID
 pin state.

Yes that's MUSB. The am335x reference manual describes that it is
possible to force peripheral/host mode by setting bit 7 (IDDIG_MUX) in
register USBnMODE to 1. Then it uses the bit written in bit 8 (IDDIG) of
register USBnMODE to set host/peripheral mode.

I am not sure if the driver supports it yet but I think the DTS should
contain the correct mode nevertheless, especially to avoid starting the
otg loops in the musb driver.

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] serial: omap-serial: Move info message to probe function

2014-01-24 Thread Markus Pargmann
Currently the info message about a missing wakeirq for uart is printed
every time the serial driver's startup function is called. This happens
multiple times and not just once.

This patch moves the infomessage to the probe function to display it
only once.

Cc: Tony Lindgren t...@atomide.com
Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/tty/serial/omap-serial.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/tty/serial/omap-serial.c b/drivers/tty/serial/omap-serial.c
index fa511eb..2051581 100644
--- a/drivers/tty/serial/omap-serial.c
+++ b/drivers/tty/serial/omap-serial.c
@@ -738,9 +738,6 @@ static int serial_omap_startup(struct uart_port *port)
return retval;
}
disable_irq(up-wakeirq);
-   } else {
-   dev_info(up-port.dev, no wakeirq for uart%d\n,
-up-port.line);
}
 
dev_dbg(up-port.dev, serial_omap_startup+%d\n, up-port.line);
@@ -1687,6 +1684,9 @@ static int serial_omap_probe(struct platform_device *pdev)
up-port.iotype = UPIO_MEM;
up-port.irq = uartirq;
up-wakeirq = wakeirq;
+   if (!up-wakeirq)
+   dev_info(up-port.dev, no wakeirq for uart%d\n,
+up-port.line);
 
up-port.regshift = 2;
up-port.fifosize = 64;
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 2/2] usb: musb: dsps, use devm_kzalloc

2014-01-17 Thread Markus Pargmann
Replace kzalloc by devm_kzalloc and remove the kfree() calls.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/usb/musb/musb_dsps.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index d0a97d6..6cae0c8 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -668,7 +668,7 @@ static int dsps_probe(struct platform_device *pdev)
wrp = match-data;
 
/* allocate glue */
-   glue = kzalloc(sizeof(*glue), GFP_KERNEL);
+   glue = devm_kzalloc(pdev-dev, sizeof(*glue), GFP_KERNEL);
if (!glue) {
dev_err(pdev-dev, unable to allocate glue memory\n);
return -ENOMEM;
@@ -696,7 +696,6 @@ err3:
pm_runtime_put(pdev-dev);
 err2:
pm_runtime_disable(pdev-dev);
-   kfree(glue);
return ret;
 }
 
@@ -709,7 +708,6 @@ static int dsps_remove(struct platform_device *pdev)
/* disable usbss clocks */
pm_runtime_put(pdev-dev);
pm_runtime_disable(pdev-dev);
-   kfree(glue);
 
debugfs_remove_recursive(glue-dbgfs_root);
 
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 1/2] usb: musb: dsps, debugfs files

2014-01-17 Thread Markus Pargmann
debugfs files to show the contents of important dsps registers.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/usb/musb/musb_dsps.c | 54 
 1 file changed, 54 insertions(+)

diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c
index 593d3c9..d0a97d6 100644
--- a/drivers/usb/musb/musb_dsps.c
+++ b/drivers/usb/musb/musb_dsps.c
@@ -46,6 +46,8 @@
 #include linux/of_irq.h
 #include linux/usb/of.h
 
+#include linux/debugfs.h
+
 #include musb_core.h
 
 static const struct of_device_id musb_dsps_of_match[];
@@ -137,6 +139,26 @@ struct dsps_glue {
unsigned long last_timer;/* last timer data for each instance */
 
struct dsps_context context;
+   struct debugfs_regset32 regset;
+   struct dentry *dbgfs_root;
+};
+
+static const struct debugfs_reg32 dsps_musb_regs[] = {
+   { revision,   0x00 },
+   { control,0x14 },
+   { status, 0x18 },
+   { eoi,0x24 },
+   { intr0_stat, 0x30 },
+   { intr1_stat, 0x34 },
+   { intr0_set,  0x38 },
+   { intr1_set,  0x3c },
+   { txmode, 0x70 },
+   { rxmode, 0x74 },
+   { autoreq,0xd0 },
+   { srpfixtime, 0xd4 },
+   { tdown,  0xd8 },
+   { phy_utmi,   0xe0 },
+   { mode,   0xe8 },
 };
 
 static void dsps_musb_try_idle(struct musb *musb, unsigned long timeout)
@@ -369,6 +391,30 @@ out:
return ret;
 }
 
+static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue)
+{
+   struct dentry *root;
+   struct dentry *file;
+   char buf[128];
+
+   sprintf(buf, %s.dsps, dev_name(musb-controller));
+   root = debugfs_create_dir(buf, NULL);
+   if (!root)
+   return -ENOMEM;
+   glue-dbgfs_root = root;
+
+   glue-regset.regs = dsps_musb_regs;
+   glue-regset.nregs = ARRAY_SIZE(dsps_musb_regs);
+   glue-regset.base = musb-ctrl_base;
+
+   file = debugfs_create_regset32(regdump, S_IRUGO, root, glue-regset);
+   if (!file) {
+   debugfs_remove_recursive(root);
+   return -ENOMEM;
+   }
+   return 0;
+}
+
 static int dsps_musb_init(struct musb *musb)
 {
struct device *dev = musb-controller;
@@ -378,6 +424,7 @@ static int dsps_musb_init(struct musb *musb)
void __iomem *reg_base;
struct resource *r;
u32 rev, val;
+   int ret;
 
r = platform_get_resource_byname(parent, IORESOURCE_MEM, control);
if (!r)
@@ -411,6 +458,10 @@ static int dsps_musb_init(struct musb *musb)
val = ~(1  wrp-otg_disable);
dsps_writel(musb-ctrl_base, wrp-phy_utmi, val);
 
+   ret = dsps_musb_dbg_init(musb, glue);
+   if (ret)
+   return ret;
+
return 0;
 }
 
@@ -659,6 +710,9 @@ static int dsps_remove(struct platform_device *pdev)
pm_runtime_put(pdev-dev);
pm_runtime_disable(pdev-dev);
kfree(glue);
+
+   debugfs_remove_recursive(glue-dbgfs_root);
+
return 0;
 }
 
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 0/2] usb: musb dsps updates

2014-01-17 Thread Markus Pargmann
Hi,

The two remaining patches from the previous series usb: musb bugfixes. In v4
I used the device name for the debugfs root dir and added a commit message to
the second patch.

Regards,

Markus


Markus Pargmann (2):
  usb: musb: dsps, debugfs files
  usb: musb: dsps, use devm_kzalloc

 drivers/usb/musb/musb_dsps.c | 58 +---
 1 file changed, 55 insertions(+), 3 deletions(-)

-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] ARM: dts: tps65910 backup battery regulator

2014-01-16 Thread Markus Pargmann
This patch adds a devicetree node for the backup battery regulator.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
Hi,

Mark Brown applied [1] the other part of the series which adds 'vbb' as
regulator-compatible. I forgot to add you in Cc.

Regards,

Markus

[1] http://thread.gmane.org/gmane.linux.ports.arm.kernel/289815/focus=290089

 arch/arm/boot/dts/tps65910.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/tps65910.dtsi b/arch/arm/boot/dts/tps65910.dtsi
index 92693a8..b0ac665 100644
--- a/arch/arm/boot/dts/tps65910.dtsi
+++ b/arch/arm/boot/dts/tps65910.dtsi
@@ -82,5 +82,10 @@
reg = 12;
regulator-compatible = vmmc;
};
+
+   vbb_reg: regulator@13 {
+   reg = 13;
+   regulator-compatible = vbb;
+   };
};
 };
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] arm: dtsi: am335x-bone-common, usb0 is peripheral only

2014-01-11 Thread Markus Pargmann
The PMIC is using usb0 vbus line as power source. It is also connected
to the am335x processor as vbus sense. But there is no possibility to
pullup usb0 vbus to operate as host. This patch fixes the dr_mode of usb0.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/am335x-bone-common.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi 
b/arch/arm/boot/dts/am335x-bone-common.dtsi
index e3f27ec..da2db9b 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -197,6 +197,7 @@
 
usb@47401000 {
status = okay;
+   dr_mode = peripheral;
};
 
usb@47401800 {
-- 
1.8.5.2

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/2] ARM: dts: tps65910 backup battery regulator

2013-12-20 Thread Markus Pargmann
This patch adds a devicetree node for the backup battery regulator.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/tps65910.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/tps65910.dtsi b/arch/arm/boot/dts/tps65910.dtsi
index 92693a8..b0ac665 100644
--- a/arch/arm/boot/dts/tps65910.dtsi
+++ b/arch/arm/boot/dts/tps65910.dtsi
@@ -82,5 +82,10 @@
reg = 12;
regulator-compatible = vmmc;
};
+
+   vbb_reg: regulator@13 {
+   reg = 13;
+   regulator-compatible = vbb;
+   };
};
 };
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 0/2] regulator: tps65910: backup battery regulator

2013-12-20 Thread Markus Pargmann
Hi,

backup battery charger regulator for tps65910.

Regards,

Markus


Changes in v2:
 - Seperate ops for vbb to reduce performance impact for other regulators on
   voltage mapping
 - Usage of switch statements

Markus Pargmann (2):
  regulator: tps65910: Add backup battery regulator
  ARM: dts: tps65910 backup battery regulator

 Documentation/devicetree/bindings/mfd/tps65910.txt |  4 +-
 arch/arm/boot/dts/tps65910.dtsi|  5 ++
 drivers/regulator/tps65910-regulator.c | 56 +-
 include/linux/mfd/tps65910.h   |  3 +-
 4 files changed, 64 insertions(+), 4 deletions(-)

-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/2] regulator: tps65910: Add backup battery regulator

2013-12-20 Thread Markus Pargmann
tps65910 has a backup battery charger with a configurable voltage. This
patch adds a regulator for the backup battery.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 Documentation/devicetree/bindings/mfd/tps65910.txt |  4 +-
 drivers/regulator/tps65910-regulator.c | 56 +-
 include/linux/mfd/tps65910.h   |  3 +-
 3 files changed, 59 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/mfd/tps65910.txt 
b/Documentation/devicetree/bindings/mfd/tps65910.txt
index 2e33048..b4bd98a 100644
--- a/Documentation/devicetree/bindings/mfd/tps65910.txt
+++ b/Documentation/devicetree/bindings/mfd/tps65910.txt
@@ -21,7 +21,7 @@ Required properties:
 
   The valid regulator-compatible values are:
   tps65910: vrtc, vio, vdd1, vdd2, vdd3, vdig1, vdig2, vpll, vdac, vaux1,
-vaux2, vaux33, vmmc
+vaux2, vaux33, vmmc, vbb
   tps65911: vrtc, vio, vdd1, vdd3, vddctrl, ldo1, ldo2, ldo3, ldo4, ldo5,
 ldo6, ldo7, ldo8
 
@@ -38,7 +38,7 @@ Required properties:
vcc4-supply: VAUX1 and VAUX2 input.
vcc5-supply: VPLL and VDAC input.
vcc6-supply: VDIG1 and VDIG2 input.
-   vcc7-supply: VRTC input.
+   vcc7-supply: VRTC and VBB input.
vccio-supply: VIO input.
   tps65911:
vcc1-supply: VDD1 input.
diff --git a/drivers/regulator/tps65910-regulator.c 
b/drivers/regulator/tps65910-regulator.c
index a00132e..979ea0a 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -88,6 +88,11 @@ static const unsigned int VMMC_VSEL_table[] = {
180, 280, 300, 330,
 };
 
+/* supported BBCH voltages in microvolts */
+static const unsigned int VBB_VSEL_table[] = {
+   300, 252, 315, 500,
+};
+
 struct tps_info {
const char *name;
const char *vin_name;
@@ -183,6 +188,12 @@ static struct tps_info tps65910_regs[] = {
.voltage_table = VMMC_VSEL_table,
.enable_time_us = 100,
},
+   {
+   .name = vbb,
+   .vin_name = vcc7,
+   .n_voltages = ARRAY_SIZE(VBB_VSEL_table),
+   .voltage_table = VBB_VSEL_table,
+   },
 };
 
 static struct tps_info tps65911_regs[] = {
@@ -339,6 +350,8 @@ static int tps65910_get_ctrl_register(int id)
return TPS65910_VAUX33;
case TPS65910_REG_VMMC:
return TPS65910_VMMC;
+   case TPS65910_REG_VBB:
+   return TPS65910_BBCH;
default:
return -EINVAL;
}
@@ -528,6 +541,10 @@ static int tps65910_get_voltage_sel(struct regulator_dev 
*dev)
value = LDO_SEL_MASK;
value = LDO_SEL_SHIFT;
break;
+   case TPS65910_REG_VBB:
+   value = BBCH_BBSEL_MASK;
+   value = BBCH_BBSEL_SHIFT;
+   break;
default:
return -EINVAL;
}
@@ -638,6 +655,9 @@ static int tps65910_set_voltage_sel(struct regulator_dev 
*dev,
case TPS65910_REG_VMMC:
return tps65910_reg_update_bits(pmic-mfd, reg, LDO_SEL_MASK,
selector  LDO_SEL_SHIFT);
+   case TPS65910_REG_VBB:
+   return tps65910_reg_update_bits(pmic-mfd, reg, BBCH_BBSEL_MASK,
+   selector  BBCH_BBSEL_SHIFT);
}
 
return -EINVAL;
@@ -669,6 +689,9 @@ static int tps65911_set_voltage_sel(struct regulator_dev 
*dev,
case TPS65910_REG_VIO:
return tps65910_reg_update_bits(pmic-mfd, reg, LDO_SEL_MASK,
selector  LDO_SEL_SHIFT);
+   case TPS65910_REG_VBB:
+   return tps65910_reg_update_bits(pmic-mfd, reg, BBCH_BBSEL_MASK,
+   selector  BBCH_BBSEL_SHIFT);
}
 
return -EINVAL;
@@ -762,6 +785,18 @@ static struct regulator_ops tps65910_ops_vdd3 = {
.map_voltage= regulator_map_voltage_ascend,
 };
 
+static struct regulator_ops tps65910_ops_vbb = {
+   .is_enabled = regulator_is_enabled_regmap,
+   .enable = regulator_enable_regmap,
+   .disable= regulator_disable_regmap,
+   .set_mode   = tps65910_set_mode,
+   .get_mode   = tps65910_get_mode,
+   .get_voltage_sel= tps65910_get_voltage_sel,
+   .set_voltage_sel= tps65910_set_voltage_sel,
+   .list_voltage   = regulator_list_voltage_table,
+   .map_voltage= regulator_map_voltage_iterate,
+};
+
 static struct regulator_ops tps65910_ops = {
.is_enabled = regulator_is_enabled_regmap,
.enable = regulator_enable_regmap,
@@ -944,6 +979,7 @@ static struct of_regulator_match tps65910_matches[] = {
{ .name = vaux2,  .driver_data

Re: [PATCH 0/6] net: cpsw: Support for am335x chip MACIDs

2013-12-19 Thread Markus Pargmann
Hi,

On Wed, Dec 18, 2013 at 10:40:58PM +0530, Mugunthan V N wrote:
 On Wednesday 18 December 2013 10:38 PM, Felipe Balbi wrote:
  On Wed, Dec 18, 2013 at 10:30:55PM +0530, Mugunthan V N wrote:
  On Wednesday 18 December 2013 10:17 PM, Markus Pargmann wrote:
  Hi,
 
  This series introduces a driver to read and use the MACIDs stored in the 
  am335x
  control module. These are read-only registers for a unique MACID. At the 
  moment
  the MACIDs are generated randomly or they are set by the bootloader.
 
  A device node is added in am33xx dtsi and used by the cpsw slaves in the 
  bone
  board files.
 
  Regards,
 
  Markus
 
 
  Markus Pargmann (6):
DT doc: net: cpsw mac-address is optional
net: cpsw: header, Add missing include
net: cpsw: Add control-module macid driver
net: cpsw: Use cpsw-ctrl-macid driver
arm: dts: am33xx, Add device node for cpsw-ctrl-macid
arm: dts: am335x beagle bone use processor macids
 
   .../devicetree/bindings/net/cpsw-ctrl-macid.txt|  31 +
   Documentation/devicetree/bindings/net/cpsw.txt |   7 +-
   arch/arm/boot/dts/am335x-bone.dts  |   8 ++
   arch/arm/boot/dts/am335x-boneblack.dts |   8 ++
   arch/arm/boot/dts/am33xx.dtsi  |   7 ++
   drivers/net/ethernet/ti/Kconfig|   8 ++
   drivers/net/ethernet/ti/Makefile   |   1 +
   drivers/net/ethernet/ti/cpsw-ctrl-macid.c  | 138 
  +
   drivers/net/ethernet/ti/cpsw.c |  18 ++-
   drivers/net/ethernet/ti/cpsw.h |   3 +
   10 files changed, 224 insertions(+), 5 deletions(-)
   create mode 100644 
  Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
   create mode 100644 drivers/net/ethernet/ti/cpsw-ctrl-macid.c
 
  Mac ID is to be filled by U-Boot and this kind of approach is already
  rejected in linux-omap list.
 
  If proper ethaddr/eth*addr is populated in U-boot environment variable
  then mac-address dt property in ethernet* device nodes will be populated
  before boot kernel in U-boot. So I don't think this patch series is
  required.
  but will u-boot read MACID from control module ?
 
 Yes, U-Boot will read the MACID from control module and if a customer
 wants to have his own MACID, U-boot ENV variable ethaddr/eth1addr must
 be updated.

I think we should not rely on any bootloader to setup the macids
correctly.

U-Boot is not the only bootloader. There are others which may not
support cpsw or don't support devicetree or don't load the cpsw driver
automatically when no ethernet connection is used. Most installed
bootloaders use their local storage to load the kernel, so how can we be
certain that the bootloader added the correct MACIDs to the devicetree?
Why can't the kernel be bootloader independent?


A cpsw slave defined in am33xx.dtsi:

cpsw_emac0: slave@4a100200 {
/* Filled in by U-Boot */
mac-address = [ 00 00 00 00 00 00 ];
};

This is not a proper hardware description, only a clear statement that
the kernel depends on U-Boot or any other bootloader that does always
set the mac-address the same way U-Boot does. But that DT is not usable
in anything else than Linux and U-Boot.

The TI reference manual clearly lists the MACID registers in the control
module so we can use that to describe the source of the MACIDs in DT,
independent of U-Boot. Any bootloader can use such a devictree and parse
the correct location in the control module.

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] regulator: tps65910: Add backup battery regulator

2013-12-19 Thread Markus Pargmann
On Wed, Dec 18, 2013 at 04:24:52PM +, Mark Brown wrote:
 On Wed, Dec 18, 2013 at 03:50:07PM +0100, Markus Pargmann wrote:
 
  @@ -771,7 +794,7 @@ static struct regulator_ops tps65910_ops = {
  .get_voltage_sel= tps65910_get_voltage_sel,
  .set_voltage_sel= tps65910_set_voltage_sel,
  .list_voltage   = regulator_list_voltage_table,
  -   .map_voltage= regulator_map_voltage_ascend,
  +   .map_voltage= regulator_map_voltage_iterate,
   };
 
 You should make separate ops for this rather than make all the other
 regulators take the performance hit.

Fixed.

 
   static struct regulator_ops tps65911_ops = {
  @@ -944,6 +967,7 @@ static struct of_regulator_match tps65910_matches[] = {
  { .name = vaux2,  .driver_data = (void *) tps65910_regs[10] },
  { .name = vaux33, .driver_data = (void *) tps65910_regs[11] },
  { .name = vmmc,   .driver_data = (void *) tps65910_regs[12] },
  +   { .name = vbb,.driver_data = (void *) tps65910_regs[13] },
   };
 
 Ugh, these numbered tables aren't good.  Not a problem from this patch
 though.
 
  -   pmic-desc[i].enable_mask = TPS65910_SUPPLY_STATE_ENABLED;
  +   if (tps65910_chip_id(tps65910) == TPS65910 
  +   i == TPS65910_REG_VBB)
  +   pmic-desc[i].enable_mask = BBCH_BBCHEN_MASK;
  +   else
  +   pmic-desc[i].enable_mask = 
  TPS65910_SUPPLY_STATE_ENABLED;
 
 switch statements please - it means if additional things need
 customising they can drop right in.

Fixed.


Thank you,

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] ARM: dts: tps65910 backup battery regulator

2013-12-19 Thread Markus Pargmann
On Wed, Dec 18, 2013 at 04:25:46PM +, Mark Brown wrote:
 On Wed, Dec 18, 2013 at 03:50:08PM +0100, Markus Pargmann wrote:
  This patch adds a devicetree node for the backup battery regulator.
 
 Your previous patch missed an update to the binding documentation for
 the regulator driver.

Right, thank you, I added vbb to the tps65910 mfd binding documentation.

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- |
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] drm/tilcdc: Defer probe if no encoders/connectors found

2013-12-18 Thread Markus Pargmann
At the moment this driver fails to load if no encoders/connectors were
found. In case other drivers that register encoders/connectors
(tilcdc_panel) are defered it would be better to check for
encoders/connectors later again. This patch replaces the returncode
-ENXIO with -EPROBE_DEFER to get a working setup even if tilcdc_panel
probes after tilcdc.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/gpu/drm/tilcdc/tilcdc_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c 
b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index 116da19..217303c 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -84,7 +84,7 @@ static int modeset_init(struct drm_device *dev)
if ((priv-num_encoders == 0) || (priv-num_connectors == 0)) {
/* oh nos! */
dev_err(dev-dev, no encoders/connectors found\n);
-   return -ENXIO;
+   return -EPROBE_DEFER;
}
 
dev-mode_config.min_width = 0;
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] regulator: tps65910: Add backup battery regulator

2013-12-18 Thread Markus Pargmann
tps65910 has a backup battery charger with a configurable voltage. This
patch adds a regulator for the backup battery.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/regulator/tps65910-regulator.c | 32 ++--
 include/linux/mfd/tps65910.h   |  3 ++-
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/tps65910-regulator.c 
b/drivers/regulator/tps65910-regulator.c
index a00132e..74f5e05 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -88,6 +88,11 @@ static const unsigned int VMMC_VSEL_table[] = {
180, 280, 300, 330,
 };
 
+/* supported BBCH voltages in microvolts */
+static const unsigned int VBB_VSEL_table[] = {
+   300, 252, 315, 500,
+};
+
 struct tps_info {
const char *name;
const char *vin_name;
@@ -183,6 +188,12 @@ static struct tps_info tps65910_regs[] = {
.voltage_table = VMMC_VSEL_table,
.enable_time_us = 100,
},
+   {
+   .name = vbb,
+   .vin_name = vcc7,
+   .n_voltages = ARRAY_SIZE(VBB_VSEL_table),
+   .voltage_table = VBB_VSEL_table,
+   },
 };
 
 static struct tps_info tps65911_regs[] = {
@@ -339,6 +350,8 @@ static int tps65910_get_ctrl_register(int id)
return TPS65910_VAUX33;
case TPS65910_REG_VMMC:
return TPS65910_VMMC;
+   case TPS65910_REG_VBB:
+   return TPS65910_BBCH;
default:
return -EINVAL;
}
@@ -528,6 +541,10 @@ static int tps65910_get_voltage_sel(struct regulator_dev 
*dev)
value = LDO_SEL_MASK;
value = LDO_SEL_SHIFT;
break;
+   case TPS65910_REG_VBB:
+   value = BBCH_BBSEL_MASK;
+   value = BBCH_BBSEL_SHIFT;
+   break;
default:
return -EINVAL;
}
@@ -638,6 +655,9 @@ static int tps65910_set_voltage_sel(struct regulator_dev 
*dev,
case TPS65910_REG_VMMC:
return tps65910_reg_update_bits(pmic-mfd, reg, LDO_SEL_MASK,
selector  LDO_SEL_SHIFT);
+   case TPS65910_REG_VBB:
+   return tps65910_reg_update_bits(pmic-mfd, reg, BBCH_BBSEL_MASK,
+   selector  BBCH_BBSEL_SHIFT);
}
 
return -EINVAL;
@@ -669,6 +689,9 @@ static int tps65911_set_voltage_sel(struct regulator_dev 
*dev,
case TPS65910_REG_VIO:
return tps65910_reg_update_bits(pmic-mfd, reg, LDO_SEL_MASK,
selector  LDO_SEL_SHIFT);
+   case TPS65910_REG_VBB:
+   return tps65910_reg_update_bits(pmic-mfd, reg, BBCH_BBSEL_MASK,
+   selector  BBCH_BBSEL_SHIFT);
}
 
return -EINVAL;
@@ -771,7 +794,7 @@ static struct regulator_ops tps65910_ops = {
.get_voltage_sel= tps65910_get_voltage_sel,
.set_voltage_sel= tps65910_set_voltage_sel,
.list_voltage   = regulator_list_voltage_table,
-   .map_voltage= regulator_map_voltage_ascend,
+   .map_voltage= regulator_map_voltage_iterate,
 };
 
 static struct regulator_ops tps65911_ops = {
@@ -944,6 +967,7 @@ static struct of_regulator_match tps65910_matches[] = {
{ .name = vaux2,  .driver_data = (void *) tps65910_regs[10] },
{ .name = vaux33, .driver_data = (void *) tps65910_regs[11] },
{ .name = vmmc,   .driver_data = (void *) tps65910_regs[12] },
+   { .name = vbb,.driver_data = (void *) tps65910_regs[13] },
 };
 
 static struct of_regulator_match tps65911_matches[] = {
@@ -1167,7 +1191,11 @@ static int tps65910_probe(struct platform_device *pdev)
pmic-desc[i].type = REGULATOR_VOLTAGE;
pmic-desc[i].owner = THIS_MODULE;
pmic-desc[i].enable_reg = pmic-get_ctrl_reg(i);
-   pmic-desc[i].enable_mask = TPS65910_SUPPLY_STATE_ENABLED;
+   if (tps65910_chip_id(tps65910) == TPS65910 
+   i == TPS65910_REG_VBB)
+   pmic-desc[i].enable_mask = BBCH_BBCHEN_MASK;
+   else
+   pmic-desc[i].enable_mask = 
TPS65910_SUPPLY_STATE_ENABLED;
 
config.dev = tps65910-dev;
config.init_data = reg_data;
diff --git a/include/linux/mfd/tps65910.h b/include/linux/mfd/tps65910.h
index 20e433e..1adeee1 100644
--- a/include/linux/mfd/tps65910.h
+++ b/include/linux/mfd/tps65910.h
@@ -833,6 +833,7 @@
 #define TPS65910_REG_VAUX2 10
 #define TPS65910_REG_VAUX3311
 #define TPS65910_REG_VMMC  12
+#define TPS65910_REG_VBB   13
 
 #define

[PATCH 2/2] ARM: dts: tps65910 backup battery regulator

2013-12-18 Thread Markus Pargmann
This patch adds a devicetree node for the backup battery regulator.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/tps65910.dtsi | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/tps65910.dtsi b/arch/arm/boot/dts/tps65910.dtsi
index 92693a8..b0ac665 100644
--- a/arch/arm/boot/dts/tps65910.dtsi
+++ b/arch/arm/boot/dts/tps65910.dtsi
@@ -82,5 +82,10 @@
reg = 12;
regulator-compatible = vmmc;
};
+
+   vbb_reg: regulator@13 {
+   reg = 13;
+   regulator-compatible = vbb;
+   };
};
 };
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/6] net: cpsw: Add control-module macid driver

2013-12-18 Thread Markus Pargmann
This driver extracts the hardware macid from the control module of
am335x processors. It exports a function cpsw_ctrl_macid_read for cpsw
to get the macid from within the processor.

This driver is not used, unless it is defined in DT and referenced by a
cpsw slave with a phandle.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 .../devicetree/bindings/net/cpsw-ctrl-macid.txt|  31 +
 drivers/net/ethernet/ti/Kconfig|   8 ++
 drivers/net/ethernet/ti/Makefile   |   1 +
 drivers/net/ethernet/ti/cpsw-ctrl-macid.c  | 138 +
 4 files changed, 178 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
 create mode 100644 drivers/net/ethernet/ti/cpsw-ctrl-macid.c

diff --git a/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt 
b/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
new file mode 100644
index 000..abff2af
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
@@ -0,0 +1,31 @@
+TI CPSW ctrl macid Devicetree bindings
+--
+
+Required properties:
+ - compatible  : Should be ti,am3352-cpsw-ctrl-macid
+ - reg : physical base address and size of the cpsw
+ registers map
+ - reg-names   : names of the register map given in reg node
+ - #ti,cpsw-ctrl-macid : Should be 1
+
+When used from cpsw, ti,mac-address-ctrl should be a phandle to this device
+node with one argument, 0 or 1 to select the macid 0 or 1.
+
+Examples:
+
+   cpsw_ctrl_macid: cpsw-ctrl-macid@44e10630 {
+   compatible = ti,am3352-cpsw-ctrl-macid;
+   #ti,mac-address-ctrl-cells = 1;
+   reg = 0x44e10630 0x16;
+   reg-names = ctrl-macid;
+   };
+
+Used in cpsw slave nodes like this:
+
+   cpsw_emac0: slave@4a100200 {
+   ti,mac-address-ctrl = cpsw_ctrl_macid 0;
+   };
+
+   cpsw_emac1: slave@4a100300 {
+   ti,mac-address-ctrl = cpsw_ctrl_macid 1;
+   };
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index 53150c2..24819ef 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -56,12 +56,20 @@ config TI_CPSW_PHY_SEL
  This driver supports configuring of the phy mode connected to
  the CPSW.
 
+config TI_CPSW_CTRL_MACID
+   boolean TI CPSW internal MACID support
+   depends on TI_CPSW
+   ---help---
+ This driver supports reading the hardcoded MACID from am33xx
+ processors control module.
+
 config TI_CPSW
tristate TI CPSW Switch Support
depends on ARM  (ARCH_DAVINCI || SOC_AM33XX)
select TI_DAVINCI_CPDMA
select TI_DAVINCI_MDIO
select TI_CPSW_PHY_SEL
+   select TI_CPSW_CTRL_MACID
---help---
  This driver supports TI's CPSW Ethernet Switch.
 
diff --git a/drivers/net/ethernet/ti/Makefile b/drivers/net/ethernet/ti/Makefile
index 9cfaab8..5a31c2b 100644
--- a/drivers/net/ethernet/ti/Makefile
+++ b/drivers/net/ethernet/ti/Makefile
@@ -8,5 +8,6 @@ obj-$(CONFIG_TI_DAVINCI_EMAC) += davinci_emac.o
 obj-$(CONFIG_TI_DAVINCI_MDIO) += davinci_mdio.o
 obj-$(CONFIG_TI_DAVINCI_CPDMA) += davinci_cpdma.o
 obj-$(CONFIG_TI_CPSW_PHY_SEL) += cpsw-phy-sel.o
+obj-$(CONFIG_TI_CPSW_CTRL_MACID) += cpsw-ctrl-macid.o
 obj-$(CONFIG_TI_CPSW) += ti_cpsw.o
 ti_cpsw-y := cpsw_ale.o cpsw.o cpts.o
diff --git a/drivers/net/ethernet/ti/cpsw-ctrl-macid.c 
b/drivers/net/ethernet/ti/cpsw-ctrl-macid.c
new file mode 100644
index 000..e18c957
--- /dev/null
+++ b/drivers/net/ethernet/ti/cpsw-ctrl-macid.c
@@ -0,0 +1,138 @@
+/* CPSW Control Module MACID driver
+ *
+ * Copyright (C) 2013 Markus Pargmann m...@pengutronix.de
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/platform_device.h
+#include linux/module.h
+#include linux/of.h
+#include linux/of_device.h
+
+#include cpsw.h
+
+#define AM33XX_CTRL_MAC_LO_REG(id) (0x8 * id)
+#define AM33XX_CTRL_MAC_HI_REG(id) (0x8 * id + 0x4)
+
+struct cpsw_ctrl_macid {
+   struct device *dev;
+   u8 __iomem *ctrl_macid;
+   void (*cpsw_macid_get)(struct cpsw_ctrl_macid *priv, int slave,
+   u8 *mac_addr);
+};
+
+
+static void cpsw_ctrl_get_macid(struct cpsw_ctrl_macid *priv, int slave,
+   u8 *mac_addr)
+{
+   u32 macid_lo;
+   u32 macid_hi;
+
+   macid_lo = readl(priv-ctrl_macid + AM33XX_CTRL_MAC_LO_REG(slave));
+   macid_hi = readl(priv-ctrl_macid

[PATCH 2/6] net: cpsw: header, Add missing include

2013-12-18 Thread Markus Pargmann
MII_BUS_ID_SIZE is defined in linux/phy.h which is not included in the
cpsw.h file.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 drivers/net/ethernet/ti/cpsw.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 574f49d..1b71067 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -15,6 +15,7 @@
 #define __CPSW_H__
 
 #include linux/if_ether.h
+#include linux/phy.h
 
 struct cpsw_slave_data {
charphy_id[MII_BUS_ID_SIZE];
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/6] DT doc: net: cpsw mac-address is optional

2013-12-18 Thread Markus Pargmann
mac-address is an optional property. If no mac-address is set, a random
mac-address will be generated.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 Documentation/devicetree/bindings/net/cpsw.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index 05d660e..c39f077 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -30,10 +30,10 @@ Required properties:
 - phy_id   : Specifies slave phy id
 - phy-mode : The interface between the SoC and the PHY (a string
  that of_get_phy_mode() can understand)
-- mac-address  : Specifies slave MAC address
 
 Optional properties:
 - dual_emac_res_vlan   : Specifies VID to be used to segregate the ports
+- mac-address  : Specifies slave MAC address
 
 Note: ti,hwmods field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 6/6] arm: dts: am335x beagle bone use processor macids

2013-12-18 Thread Markus Pargmann
Use macids stored in the am335x chip.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/am335x-bone.dts  | 8 
 arch/arm/boot/dts/am335x-boneblack.dts | 8 
 2 files changed, 16 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-bone.dts 
b/arch/arm/boot/dts/am335x-bone.dts
index 94ee427..9b65a62 100644
--- a/arch/arm/boot/dts/am335x-bone.dts
+++ b/arch/arm/boot/dts/am335x-bone.dts
@@ -10,6 +10,14 @@
 #include am33xx.dtsi
 #include am335x-bone-common.dtsi
 
+cpsw_emac0 {
+   ti,mac-address-ctrl = cpsw_ctrl_macid 0;
+};
+
+cpsw_emac1 {
+   ti,mac-address-ctrl = cpsw_ctrl_macid 1;
+};
+
 ldo3_reg {
regulator-min-microvolt = 180;
regulator-max-microvolt = 330;
diff --git a/arch/arm/boot/dts/am335x-boneblack.dts 
b/arch/arm/boot/dts/am335x-boneblack.dts
index 6b71ad9..f6f0b40 100644
--- a/arch/arm/boot/dts/am335x-boneblack.dts
+++ b/arch/arm/boot/dts/am335x-boneblack.dts
@@ -10,6 +10,14 @@
 #include am33xx.dtsi
 #include am335x-bone-common.dtsi
 
+cpsw_emac0 {
+   ti,mac-address-ctrl = cpsw_ctrl_macid 0;
+};
+
+cpsw_emac1 {
+   ti,mac-address-ctrl = cpsw_ctrl_macid 1;
+};
+
 ldo3_reg {
regulator-min-microvolt = 180;
regulator-max-microvolt = 180;
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 4/6] net: cpsw: Use cpsw-ctrl-macid driver

2013-12-18 Thread Markus Pargmann
Use ctrl-macid driver to obtain the macids stored in the processor. This
is only done when defined in DT.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 Documentation/devicetree/bindings/net/cpsw.txt |  5 +
 drivers/net/ethernet/ti/cpsw.c | 18 ++
 drivers/net/ethernet/ti/cpsw.h |  2 ++
 3 files changed, 21 insertions(+), 4 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/cpsw.txt 
b/Documentation/devicetree/bindings/net/cpsw.txt
index c39f077..b95c38b 100644
--- a/Documentation/devicetree/bindings/net/cpsw.txt
+++ b/Documentation/devicetree/bindings/net/cpsw.txt
@@ -34,6 +34,11 @@ Required properties:
 Optional properties:
 - dual_emac_res_vlan   : Specifies VID to be used to segregate the ports
 - mac-address  : Specifies slave MAC address
+- ti,mac-address-ctrl  : When cpsw-ctrl-macid support is compiledin, this can
+ be set to a phandle with one argument, see
+ cpsw-ctrl-macid.txt. If this method fails, cpsw falls
+ back to mac-address or random mac-address.
+
 
 Note: ti,hwmods field is used to fetch the base address and irq
 resources from TI, omap hwmod data base during device registration.
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 5120d9c..382d793 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1804,9 +1804,16 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
snprintf(slave_data-phy_id, sizeof(slave_data-phy_id),
 PHY_ID_FMT, mdio-name, phyid);
 
-   mac_addr = of_get_mac_address(slave_node);
-   if (mac_addr)
-   memcpy(slave_data-mac_addr, mac_addr, ETH_ALEN);
+   ret = cpsw_ctrl_macid_read(slave_node, slave_data-mac_addr);
+   if (ret) {
+   if (ret == -EPROBE_DEFER)
+   return ret;
+
+   mac_addr = of_get_mac_address(slave_node);
+   if (mac_addr)
+   memcpy(slave_data-mac_addr, mac_addr,
+   ETH_ALEN);
+   }
 
slave_data-phy_if = of_get_phy_mode(slave_node);
 
@@ -1946,10 +1953,13 @@ static int cpsw_probe(struct platform_device *pdev)
/* Select default pin state */
pinctrl_pm_select_default_state(pdev-dev);
 
-   if (cpsw_probe_dt(priv-data, pdev)) {
+   ret = cpsw_probe_dt(priv-data, pdev);
+   if (ret == -EINVAL) {
pr_err(cpsw: platform data missing\n);
ret = -ENODEV;
goto clean_runtime_disable_ret;
+   } else if (ret) {
+   goto clean_runtime_disable_ret;
}
data = priv-data;
 
diff --git a/drivers/net/ethernet/ti/cpsw.h b/drivers/net/ethernet/ti/cpsw.h
index 1b71067..222eebe 100644
--- a/drivers/net/ethernet/ti/cpsw.h
+++ b/drivers/net/ethernet/ti/cpsw.h
@@ -42,4 +42,6 @@ struct cpsw_platform_data {
 
 void cpsw_phy_sel(struct device *dev, phy_interface_t phy_mode, int slave);
 
+int cpsw_ctrl_macid_read(struct device_node *np, u8 *mac_addr);
+
 #endif /* __CPSW_H__ */
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 5/6] arm: dts: am33xx, Add device node for cpsw-ctrl-macid

2013-12-18 Thread Markus Pargmann
Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/am33xx.dtsi | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index f6d8ffe..4e1bf08 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -676,6 +676,13 @@
reg= 0x44e10650 0x4;
reg-names = gmii-sel;
};
+
+   cpsw_ctrl_macid: cpsw-ctrl-macid@44e10630 {
+   compatible = ti,am3352-cpsw-ctrl-macid;
+   #ti,mac-address-ctrl-cells = 1;
+   reg = 0x44e10630 0x16;
+   reg-names = ctrl-macid;
+   };
};
 
ocmcram: ocmcram@4030 {
-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 0/6] net: cpsw: Support for am335x chip MACIDs

2013-12-18 Thread Markus Pargmann
Hi,

This series introduces a driver to read and use the MACIDs stored in the am335x
control module. These are read-only registers for a unique MACID. At the moment
the MACIDs are generated randomly or they are set by the bootloader.

A device node is added in am33xx dtsi and used by the cpsw slaves in the bone
board files.

Regards,

Markus


Markus Pargmann (6):
  DT doc: net: cpsw mac-address is optional
  net: cpsw: header, Add missing include
  net: cpsw: Add control-module macid driver
  net: cpsw: Use cpsw-ctrl-macid driver
  arm: dts: am33xx, Add device node for cpsw-ctrl-macid
  arm: dts: am335x beagle bone use processor macids

 .../devicetree/bindings/net/cpsw-ctrl-macid.txt|  31 +
 Documentation/devicetree/bindings/net/cpsw.txt |   7 +-
 arch/arm/boot/dts/am335x-bone.dts  |   8 ++
 arch/arm/boot/dts/am335x-boneblack.dts |   8 ++
 arch/arm/boot/dts/am33xx.dtsi  |   7 ++
 drivers/net/ethernet/ti/Kconfig|   8 ++
 drivers/net/ethernet/ti/Makefile   |   1 +
 drivers/net/ethernet/ti/cpsw-ctrl-macid.c  | 138 +
 drivers/net/ethernet/ti/cpsw.c |  18 ++-
 drivers/net/ethernet/ti/cpsw.h |   3 +
 10 files changed, 224 insertions(+), 5 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/net/cpsw-ctrl-macid.txt
 create mode 100644 drivers/net/ethernet/ti/cpsw-ctrl-macid.c

-- 
1.8.5.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: omap2: irq, AM33XX add missing register check

2013-10-17 Thread Markus Pargmann
am33xx has a INTC_PENDING_IRQ3 register that is not checked for pending
interrupts. This patch adds AM33XX to the ifdef of SOCs that have to
check this register.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/mach-omap2/irq.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/irq.c b/arch/arm/mach-omap2/irq.c
index 3926f37..e022a86 100644
--- a/arch/arm/mach-omap2/irq.c
+++ b/arch/arm/mach-omap2/irq.c
@@ -233,7 +233,7 @@ static inline void omap_intc_handle_irq(void __iomem 
*base_addr, struct pt_regs
goto out;
 
irqnr = readl_relaxed(base_addr + 0xd8);
-#ifdef CONFIG_SOC_TI81XX
+#if IS_ENABLED(CONFIG_SOC_TI81XX) || IS_ENABLED(CONFIG_SOC_AM33XX)
if (irqnr)
goto out;
irqnr = readl_relaxed(base_addr + 0xf8);
-- 
1.8.4.rc3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: dts: am33xx, change usb ctrl module label

2013-10-14 Thread Markus Pargmann
Control module is not usb specific. This patch changes the label to
usb_ctrl_mod.

Signed-off-by: Markus Pargmann m...@pengutronix.de
---
 arch/arm/boot/dts/am33xx.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index f9c5da9..14510ee 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -346,7 +346,7 @@
ti,hwmods = usb_otg_hs;
status = disabled;
 
-   ctrl_mod: control@44e1 {
+   usb_ctrl_mod: control@44e1 {
compatible = ti,am335x-usb-ctrl-module;
reg = 0x44e10620 0x10
0x44e10648 0x4;
@@ -359,7 +359,7 @@
reg = 0x47401300 0x100;
reg-names = phy;
status = disabled;
-   ti,ctrl_mod = ctrl_mod;
+   ti,ctrl_mod = usb_ctrl_mod;
};
 
usb0: usb@47401000 {
@@ -407,7 +407,7 @@
reg = 0x47401b00 0x100;
reg-names = phy;
status = disabled;
-   ti,ctrl_mod = ctrl_mod;
+   ti,ctrl_mod = usb_ctrl_mod;
};
 
usb1: usb@47401800 {
-- 
1.8.4.rc3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html