All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-24 16:07 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series gets rid of gpio_request()-style ethernet pin 
configuration on armadillo800eva in reference implementation.

Guennadi Liakhovetski (3):
  pinctrl: add ethernet pin groups to r8a7740
  ethernet: add a PHY reset GPIO DT binding to sh_eth
  ARM: shmobile: move pin configuration on armadillo800eva-reference to
    DT

 Documentation/devicetree/bindings/net/sh_ether.txt |    2 +
 .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 ++++
 .../board-armadillo800eva-reference.c              |   24 ---------------
 drivers/net/ethernet/renesas/sh_eth.c              |    9 +++++-
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c               |   31 ++++++++++++++++++++
 5 files changed, 48 insertions(+), 25 deletions(-)

-- 
1.7.2.5

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-24 16:07 ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

This patch series gets rid of gpio_request()-style ethernet pin 
configuration on armadillo800eva in reference implementation.

Guennadi Liakhovetski (3):
  pinctrl: add ethernet pin groups to r8a7740
  ethernet: add a PHY reset GPIO DT binding to sh_eth
  ARM: shmobile: move pin configuration on armadillo800eva-reference to
    DT

 Documentation/devicetree/bindings/net/sh_ether.txt |    2 +
 .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 ++++
 .../board-armadillo800eva-reference.c              |   24 ---------------
 drivers/net/ethernet/renesas/sh_eth.c              |    9 +++++-
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c               |   31 ++++++++++++++++++++
 5 files changed, 48 insertions(+), 25 deletions(-)

-- 
1.7.2.5

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 1/3] pinctrl: add ethernet pin groups to r8a7740
  2013-01-24 16:07 ` Guennadi Liakhovetski
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

r8a7740 SoCs have an integrated gigabit ethernet MAC. This patch adds two
pin groups: base for 100mbps and additional pins for the gigabit mode.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
index 4c92af8..d7f69dd 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
@@ -2052,6 +2052,29 @@ static const unsigned int mmc0_ctrl_1_mux[] = {
 	MMC1_CMD_PORT104_MARK, MMC1_CLK_PORT103_MARK,
 };
 
+static const unsigned int eth_base_pins[] = {
+	203, 204, 205, 206, 207,
+	183, 184,
+	185, 186, 187, 188,
+	171, 170, 169, 168,
+	161, 163, 164, 174,
+};
+static const unsigned int eth_base_mux[] = {
+	ET_TX_ER_MARK, ET_RX_ER_MARK, ET_CRS_MARK, ET_MDC_MARK, ET_MDIO_MARK,
+	ET_TX_EN_MARK, ET_TX_CLK_MARK,
+	ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
+	ET_ETXD0_MARK, ET_ETXD1_MARK, ET_ETXD2_MARK, ET_ETXD3_MARK,
+	ET_RX_DV_MARK, ET_COL_MARK, ET_PHY_INT_MARK, ET_RX_CLK_MARK,
+};
+static const unsigned int eth_gbit_pins[] = {
+	189, 190, 191, 192,
+	167, 166, 173, 172,
+};
+static const unsigned int eth_gbit_mux[] = {
+	ET_ERXD4_MARK, ET_ERXD5_MARK, ET_ERXD6_MARK, ET_ERXD7_MARK,
+	ET_ETXD4_MARK, ET_ETXD5_MARK, ET_ETXD6_MARK, ET_ETXD7_MARK,
+};
+
 static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(lcd0_data8),
 	SH_PFC_PIN_GROUP(lcd0_data9),
@@ -2100,6 +2123,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(mmc0_data4_1),
 	SH_PFC_PIN_GROUP(mmc0_data8_1),
 	SH_PFC_PIN_GROUP(mmc0_ctrl_1),
+	SH_PFC_PIN_GROUP(eth_base),
+	SH_PFC_PIN_GROUP(eth_gbit),
 };
 
 static const char * const lcd0_groups[] = {
@@ -2167,6 +2192,11 @@ static const char * const mmc0_groups[] = {
 	"mmc0_ctrl_1",
 };
 
+static const char * const eth_groups[] = {
+	"eth_base",
+	"eth_gbit",
+};
+
 static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(lcd0),
 	SH_PFC_FUNCTION(lcd1),
@@ -2174,6 +2204,7 @@ static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(sdhi1),
 	SH_PFC_FUNCTION(sdhi2),
 	SH_PFC_FUNCTION(mmc0),
+	SH_PFC_FUNCTION(eth),
 };
 
 #define PINMUX_FN_BASE	ARRAY_SIZE(pinmux_pins)
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 1/3] pinctrl: add ethernet pin groups to r8a7740
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

r8a7740 SoCs have an integrated gigabit ethernet MAC. This patch adds two
pin groups: base for 100mbps and additional pins for the gigabit mode.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 drivers/pinctrl/sh-pfc/pfc-r8a7740.c |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
index 4c92af8..d7f69dd 100644
--- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
+++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
@@ -2052,6 +2052,29 @@ static const unsigned int mmc0_ctrl_1_mux[] = {
 	MMC1_CMD_PORT104_MARK, MMC1_CLK_PORT103_MARK,
 };
 
+static const unsigned int eth_base_pins[] = {
+	203, 204, 205, 206, 207,
+	183, 184,
+	185, 186, 187, 188,
+	171, 170, 169, 168,
+	161, 163, 164, 174,
+};
+static const unsigned int eth_base_mux[] = {
+	ET_TX_ER_MARK, ET_RX_ER_MARK, ET_CRS_MARK, ET_MDC_MARK, ET_MDIO_MARK,
+	ET_TX_EN_MARK, ET_TX_CLK_MARK,
+	ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
+	ET_ETXD0_MARK, ET_ETXD1_MARK, ET_ETXD2_MARK, ET_ETXD3_MARK,
+	ET_RX_DV_MARK, ET_COL_MARK, ET_PHY_INT_MARK, ET_RX_CLK_MARK,
+};
+static const unsigned int eth_gbit_pins[] = {
+	189, 190, 191, 192,
+	167, 166, 173, 172,
+};
+static const unsigned int eth_gbit_mux[] = {
+	ET_ERXD4_MARK, ET_ERXD5_MARK, ET_ERXD6_MARK, ET_ERXD7_MARK,
+	ET_ETXD4_MARK, ET_ETXD5_MARK, ET_ETXD6_MARK, ET_ETXD7_MARK,
+};
+
 static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(lcd0_data8),
 	SH_PFC_PIN_GROUP(lcd0_data9),
@@ -2100,6 +2123,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] = {
 	SH_PFC_PIN_GROUP(mmc0_data4_1),
 	SH_PFC_PIN_GROUP(mmc0_data8_1),
 	SH_PFC_PIN_GROUP(mmc0_ctrl_1),
+	SH_PFC_PIN_GROUP(eth_base),
+	SH_PFC_PIN_GROUP(eth_gbit),
 };
 
 static const char * const lcd0_groups[] = {
@@ -2167,6 +2192,11 @@ static const char * const mmc0_groups[] = {
 	"mmc0_ctrl_1",
 };
 
+static const char * const eth_groups[] = {
+	"eth_base",
+	"eth_gbit",
+};
+
 static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(lcd0),
 	SH_PFC_FUNCTION(lcd1),
@@ -2174,6 +2204,7 @@ static const struct sh_pfc_function pinmux_functions[] = {
 	SH_PFC_FUNCTION(sdhi1),
 	SH_PFC_FUNCTION(sdhi2),
 	SH_PFC_FUNCTION(mmc0),
+	SH_PFC_FUNCTION(eth),
 };
 
 #define PINMUX_FN_BASE	ARRAY_SIZE(pinmux_pins)
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
  2013-01-24 16:07 ` Guennadi Liakhovetski
  (?)
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
a binding and code to parse it, request the GPIO and take the PHY out of
reset.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: netdev@vger.kernel.org
---
 Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
 drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt b/Documentation/devicetree/bindings/net/sh_ether.txt
index c11e45d..edaf683 100644
--- a/Documentation/devicetree/bindings/net/sh_ether.txt
+++ b/Documentation/devicetree/bindings/net/sh_ether.txt
@@ -12,6 +12,7 @@ Required properties:
 - interrupts:                   Interrupt mapping for the sh_eth interrupt
                                 sources (vector id).
 - phy-mode:              String, operation mode of the PHY interface.
+- phy-reset-gpios:              PHY reset GPIO tuple
 - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
 - sh-eth,register-type:         String, register type of sh_eth.
                                 Please select "gigabit", "fast-sh4" or
@@ -37,6 +38,7 @@ Example (armadillo800eva):
 		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
 		interrupts = <0x500>;
 		phy-mode = "mii";
+		phy-reset-gpios = <&gpio 18 0>;
 		sh-eth,edmac-endian = "little";
 		sh-eth,register-type = "gigabit";
 		sh-eth,phy-id = <0>;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 1f64848..06035a2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -20,6 +20,7 @@
  *  the file called "COPYING".
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -33,6 +34,7 @@
 #include <linux/netdevice.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_gpio.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
 static struct sh_eth_plat_data *
 sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
 {
-	int ret;
+	int ret, gpio;
 	const char *of_str;
 	struct device_node *np = dev->of_node;
 	struct sh_eth_plat_data *pdata;
+	enum of_gpio_flags flags;
 
 	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
 					GFP_KERNEL);
@@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
 	else
 		pdata->needs_init = 0;
 
+	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
+	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
+		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
+
 #ifdef CONFIG_OF_NET
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-sh
  Cc: Magnus Damm, Simon Horman, linux-arm-kernel,
	Guennadi Liakhovetski, devicetree-discuss, netdev

If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
a binding and code to parse it, request the GPIO and take the PHY out of
reset.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: devicetree-discuss@lists.ozlabs.org
Cc: netdev@vger.kernel.org
---
 Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
 drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt b/Documentation/devicetree/bindings/net/sh_ether.txt
index c11e45d..edaf683 100644
--- a/Documentation/devicetree/bindings/net/sh_ether.txt
+++ b/Documentation/devicetree/bindings/net/sh_ether.txt
@@ -12,6 +12,7 @@ Required properties:
 - interrupts:                   Interrupt mapping for the sh_eth interrupt
                                 sources (vector id).
 - phy-mode:              String, operation mode of the PHY interface.
+- phy-reset-gpios:              PHY reset GPIO tuple
 - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
 - sh-eth,register-type:         String, register type of sh_eth.
                                 Please select "gigabit", "fast-sh4" or
@@ -37,6 +38,7 @@ Example (armadillo800eva):
 		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
 		interrupts = <0x500>;
 		phy-mode = "mii";
+		phy-reset-gpios = <&gpio 18 0>;
 		sh-eth,edmac-endian = "little";
 		sh-eth,register-type = "gigabit";
 		sh-eth,phy-id = <0>;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 1f64848..06035a2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -20,6 +20,7 @@
  *  the file called "COPYING".
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -33,6 +34,7 @@
 #include <linux/netdevice.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_gpio.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
 static struct sh_eth_plat_data *
 sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
 {
-	int ret;
+	int ret, gpio;
 	const char *of_str;
 	struct device_node *np = dev->of_node;
 	struct sh_eth_plat_data *pdata;
+	enum of_gpio_flags flags;
 
 	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
 					GFP_KERNEL);
@@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
 	else
 		pdata->needs_init = 0;
 
+	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
+	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
+		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
+
 #ifdef CONFIG_OF_NET
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
a binding and code to parse it, request the GPIO and take the PHY out of
reset.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Cc: devicetree-discuss at lists.ozlabs.org
Cc: netdev at vger.kernel.org
---
 Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
 drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt b/Documentation/devicetree/bindings/net/sh_ether.txt
index c11e45d..edaf683 100644
--- a/Documentation/devicetree/bindings/net/sh_ether.txt
+++ b/Documentation/devicetree/bindings/net/sh_ether.txt
@@ -12,6 +12,7 @@ Required properties:
 - interrupts:                   Interrupt mapping for the sh_eth interrupt
                                 sources (vector id).
 - phy-mode:              String, operation mode of the PHY interface.
+- phy-reset-gpios:              PHY reset GPIO tuple
 - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
 - sh-eth,register-type:         String, register type of sh_eth.
                                 Please select "gigabit", "fast-sh4" or
@@ -37,6 +38,7 @@ Example (armadillo800eva):
 		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
 		interrupts = <0x500>;
 		phy-mode = "mii";
+		phy-reset-gpios = <&gpio 18 0>;
 		sh-eth,edmac-endian = "little";
 		sh-eth,register-type = "gigabit";
 		sh-eth,phy-id = <0>;
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 1f64848..06035a2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -20,6 +20,7 @@
  *  the file called "COPYING".
  */
 
+#include <linux/gpio.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/kernel.h>
@@ -33,6 +34,7 @@
 #include <linux/netdevice.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/of_gpio.h>
 #include <linux/of_platform.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
 static struct sh_eth_plat_data *
 sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
 {
-	int ret;
+	int ret, gpio;
 	const char *of_str;
 	struct device_node *np = dev->of_node;
 	struct sh_eth_plat_data *pdata;
+	enum of_gpio_flags flags;
 
 	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
 					GFP_KERNEL);
@@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
 	else
 		pdata->needs_init = 0;
 
+	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
+	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
+		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
+
 #ifdef CONFIG_OF_NET
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 3/3] ARM: shmobile: move pin configuration on armadillo800eva-reference to DT
  2013-01-24 16:07 ` Guennadi Liakhovetski
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

Use pinctrl and sh-eth DT bindings to configure sh-eth MAC pins on
armadillo800eva in reference implementation.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 +++++
 .../board-armadillo800eva-reference.c              |   24 --------------------
 2 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
index 11cb0f9..b815ffd9 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -26,9 +26,12 @@
 		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
 		interrupts = <0x500>;
 		phy-mode = "mii";
+		phy-reset-gpios = <&gpio 18 1>;
 		sh-eth,edmac-endian = "little";
 		sh-eth,register-type = "gigabit";
 		sh-eth,phy-id = <0>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&eth_pins>;
 	};
 
 	reg_3p3v: regulator@0 {
@@ -137,4 +140,8 @@
 		renesas,pins = "mmc0_data8_1", "mmc0_ctrl_1";
 		renesas,function = "mmc0";
 	};
+	eth_pins: pfc_eth_pins {
+		renesas,pins = "eth_base";
+		renesas,function = "eth";
+	};
 };
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
index 92d7106..54ec573e 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -152,30 +152,6 @@ static void __init eva_init(void)
 	gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
 	gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
 
-	/* GETHER */
-	gpio_request(GPIO_FN_ET_CRS,		NULL);
-	gpio_request(GPIO_FN_ET_MDC,		NULL);
-	gpio_request(GPIO_FN_ET_MDIO,		NULL);
-	gpio_request(GPIO_FN_ET_TX_ER,		NULL);
-	gpio_request(GPIO_FN_ET_RX_ER,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD0,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD1,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD2,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD3,		NULL);
-	gpio_request(GPIO_FN_ET_TX_CLK,		NULL);
-	gpio_request(GPIO_FN_ET_TX_EN,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD0,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD1,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD2,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD3,		NULL);
-	gpio_request(GPIO_FN_ET_PHY_INT,	NULL);
-	gpio_request(GPIO_FN_ET_COL,		NULL);
-	gpio_request(GPIO_FN_ET_RX_DV,		NULL);
-	gpio_request(GPIO_FN_ET_RX_CLK,		NULL);
-
-	gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
-	gpio_direction_output(GPIO_PORT18, 1);
-
 #ifdef CONFIG_CACHE_L2X0
 	/* Early BRESP enable, Shared attribute override enable, 32K*8way */
 	l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
-- 
1.7.2.5


^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH 3/3] ARM: shmobile: move pin configuration on armadillo800eva-reference to DT
@ 2013-01-24 16:07   ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-24 16:07 UTC (permalink / raw)
  To: linux-arm-kernel

Use pinctrl and sh-eth DT bindings to configure sh-eth MAC pins on
armadillo800eva in reference implementation.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
---
 .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 +++++
 .../board-armadillo800eva-reference.c              |   24 --------------------
 2 files changed, 7 insertions(+), 24 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
index 11cb0f9..b815ffd9 100644
--- a/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
+++ b/arch/arm/boot/dts/r8a7740-armadillo800eva-reference.dts
@@ -26,9 +26,12 @@
 		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
 		interrupts = <0x500>;
 		phy-mode = "mii";
+		phy-reset-gpios = <&gpio 18 1>;
 		sh-eth,edmac-endian = "little";
 		sh-eth,register-type = "gigabit";
 		sh-eth,phy-id = <0>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&eth_pins>;
 	};
 
 	reg_3p3v: regulator at 0 {
@@ -137,4 +140,8 @@
 		renesas,pins = "mmc0_data8_1", "mmc0_ctrl_1";
 		renesas,function = "mmc0";
 	};
+	eth_pins: pfc_eth_pins {
+		renesas,pins = "eth_base";
+		renesas,function = "eth";
+	};
 };
diff --git a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
index 92d7106..54ec573e 100644
--- a/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
+++ b/arch/arm/mach-shmobile/board-armadillo800eva-reference.c
@@ -152,30 +152,6 @@ static void __init eva_init(void)
 	gpio_request(GPIO_FN_SCIFA1_RXD, NULL);
 	gpio_request(GPIO_FN_SCIFA1_TXD, NULL);
 
-	/* GETHER */
-	gpio_request(GPIO_FN_ET_CRS,		NULL);
-	gpio_request(GPIO_FN_ET_MDC,		NULL);
-	gpio_request(GPIO_FN_ET_MDIO,		NULL);
-	gpio_request(GPIO_FN_ET_TX_ER,		NULL);
-	gpio_request(GPIO_FN_ET_RX_ER,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD0,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD1,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD2,		NULL);
-	gpio_request(GPIO_FN_ET_ERXD3,		NULL);
-	gpio_request(GPIO_FN_ET_TX_CLK,		NULL);
-	gpio_request(GPIO_FN_ET_TX_EN,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD0,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD1,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD2,		NULL);
-	gpio_request(GPIO_FN_ET_ETXD3,		NULL);
-	gpio_request(GPIO_FN_ET_PHY_INT,	NULL);
-	gpio_request(GPIO_FN_ET_COL,		NULL);
-	gpio_request(GPIO_FN_ET_RX_DV,		NULL);
-	gpio_request(GPIO_FN_ET_RX_CLK,		NULL);
-
-	gpio_request(GPIO_PORT18, NULL); /* PHY_RST */
-	gpio_direction_output(GPIO_PORT18, 1);
-
 #ifdef CONFIG_CACHE_L2X0
 	/* Early BRESP enable, Shared attribute override enable, 32K*8way */
 	l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
-- 
1.7.2.5

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
  2013-01-24 16:07 ` Guennadi Liakhovetski
@ 2013-01-25  4:37   ` Simon Horman
  -1 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2013-01-25  4:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> This patch series gets rid of gpio_request()-style ethernet pin 
> configuration on armadillo800eva in reference implementation.

Hi Guennadi,

these changes seem to be reasonable to me.

Are there any dependencies for the sh_eth patch?
I assume this will be handled by David Miller through the net-next tree.
Are there any dependencies? The last time I checked the DT bindings
for sh_eth had not been merged.

For the remaining two patches, which I assume will go through my renesas
tree:
* Are there any dependencies that aren't satisfied by the of-intc branch?
* Could you get some Acks. At least from Laurent?

> Guennadi Liakhovetski (3):
>   pinctrl: add ethernet pin groups to r8a7740
>   ethernet: add a PHY reset GPIO DT binding to sh_eth
>   ARM: shmobile: move pin configuration on armadillo800eva-reference to
>     DT
> 
>  Documentation/devicetree/bindings/net/sh_ether.txt |    2 +
>  .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 ++++
>  .../board-armadillo800eva-reference.c              |   24 ---------------
>  drivers/net/ethernet/renesas/sh_eth.c              |    9 +++++-
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c               |   31 ++++++++++++++++++++
>  5 files changed, 48 insertions(+), 25 deletions(-)
> 
> -- 
> 1.7.2.5
> 
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-25  4:37   ` Simon Horman
  0 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2013-01-25  4:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> This patch series gets rid of gpio_request()-style ethernet pin 
> configuration on armadillo800eva in reference implementation.

Hi Guennadi,

these changes seem to be reasonable to me.

Are there any dependencies for the sh_eth patch?
I assume this will be handled by David Miller through the net-next tree.
Are there any dependencies? The last time I checked the DT bindings
for sh_eth had not been merged.

For the remaining two patches, which I assume will go through my renesas
tree:
* Are there any dependencies that aren't satisfied by the of-intc branch?
* Could you get some Acks. At least from Laurent?

> Guennadi Liakhovetski (3):
>   pinctrl: add ethernet pin groups to r8a7740
>   ethernet: add a PHY reset GPIO DT binding to sh_eth
>   ARM: shmobile: move pin configuration on armadillo800eva-reference to
>     DT
> 
>  Documentation/devicetree/bindings/net/sh_ether.txt |    2 +
>  .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 ++++
>  .../board-armadillo800eva-reference.c              |   24 ---------------
>  drivers/net/ethernet/renesas/sh_eth.c              |    9 +++++-
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c               |   31 ++++++++++++++++++++
>  5 files changed, 48 insertions(+), 25 deletions(-)
> 
> -- 
> 1.7.2.5
> 
> Thanks
> Guennadi
> ---
> Guennadi Liakhovetski, Ph.D.
> Freelance Open-Source Software Developer
> http://www.open-technology.de/
> 

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
  2013-01-25  4:37   ` Simon Horman
@ 2013-01-25  8:09     ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-25  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon

On Fri, 25 Jan 2013, Simon Horman wrote:

> On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > This patch series gets rid of gpio_request()-style ethernet pin 
> > configuration on armadillo800eva in reference implementation.
> 
> Hi Guennadi,
> 
> these changes seem to be reasonable to me.
> 
> Are there any dependencies for the sh_eth patch?
> I assume this will be handled by David Miller through the net-next tree.
> Are there any dependencies? The last time I checked the DT bindings
> for sh_eth had not been merged.

Obviously, it can only be applied, if the 
Documentation/devicetree/bindings/net/sh_ether.txt file and the 
sh_eth_parse_dt() function exist. Also, if there are no objections against 
the new phy-reset-gpios DT property. Otherwise there are no dependencies - 
as long as the phy-reset-gpios property isn't found in DT, the patch 
doesn't affect the driver.

> For the remaining two patches, which I assume will go through my renesas
> tree:
> * Are there any dependencies that aren't satisfied by the of-intc branch?

AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which 
are needed for patch 1 to apply and for patch 3 to make sense. My earlier 
MMC DT / pinctrl patches aren't required for these patches to function, 
but these patches won't apply cleanly without them, since they touch the 
same code fragments. So, it would be easier to merge them in the order of 
submission.

> * Could you get some Acks. At least from Laurent?

Sure, let's give reviewers some more time :)

Thanks
Guennadi

> > Guennadi Liakhovetski (3):
> >   pinctrl: add ethernet pin groups to r8a7740
> >   ethernet: add a PHY reset GPIO DT binding to sh_eth
> >   ARM: shmobile: move pin configuration on armadillo800eva-reference to
> >     DT
> > 
> >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 +
> >  .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 ++++
> >  .../board-armadillo800eva-reference.c              |   24 ---------------
> >  drivers/net/ethernet/renesas/sh_eth.c              |    9 +++++-
> >  drivers/pinctrl/sh-pfc/pfc-r8a7740.c               |   31 ++++++++++++++++++++
> >  5 files changed, 48 insertions(+), 25 deletions(-)
> > 
> > -- 
> > 1.7.2.5
> > 
> > Thanks
> > Guennadi
> > ---
> > Guennadi Liakhovetski, Ph.D.
> > Freelance Open-Source Software Developer
> > http://www.open-technology.de/
> > 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-25  8:09     ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-25  8:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon

On Fri, 25 Jan 2013, Simon Horman wrote:

> On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > This patch series gets rid of gpio_request()-style ethernet pin 
> > configuration on armadillo800eva in reference implementation.
> 
> Hi Guennadi,
> 
> these changes seem to be reasonable to me.
> 
> Are there any dependencies for the sh_eth patch?
> I assume this will be handled by David Miller through the net-next tree.
> Are there any dependencies? The last time I checked the DT bindings
> for sh_eth had not been merged.

Obviously, it can only be applied, if the 
Documentation/devicetree/bindings/net/sh_ether.txt file and the 
sh_eth_parse_dt() function exist. Also, if there are no objections against 
the new phy-reset-gpios DT property. Otherwise there are no dependencies - 
as long as the phy-reset-gpios property isn't found in DT, the patch 
doesn't affect the driver.

> For the remaining two patches, which I assume will go through my renesas
> tree:
> * Are there any dependencies that aren't satisfied by the of-intc branch?

AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which 
are needed for patch 1 to apply and for patch 3 to make sense. My earlier 
MMC DT / pinctrl patches aren't required for these patches to function, 
but these patches won't apply cleanly without them, since they touch the 
same code fragments. So, it would be easier to merge them in the order of 
submission.

> * Could you get some Acks. At least from Laurent?

Sure, let's give reviewers some more time :)

Thanks
Guennadi

> > Guennadi Liakhovetski (3):
> >   pinctrl: add ethernet pin groups to r8a7740
> >   ethernet: add a PHY reset GPIO DT binding to sh_eth
> >   ARM: shmobile: move pin configuration on armadillo800eva-reference to
> >     DT
> > 
> >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 +
> >  .../boot/dts/r8a7740-armadillo800eva-reference.dts |    7 ++++
> >  .../board-armadillo800eva-reference.c              |   24 ---------------
> >  drivers/net/ethernet/renesas/sh_eth.c              |    9 +++++-
> >  drivers/pinctrl/sh-pfc/pfc-r8a7740.c               |   31 ++++++++++++++++++++
> >  5 files changed, 48 insertions(+), 25 deletions(-)
> > 
> > -- 
> > 1.7.2.5
> > 
> > Thanks
> > Guennadi
> > ---
> > Guennadi Liakhovetski, Ph.D.
> > Freelance Open-Source Software Developer
> > http://www.open-technology.de/
> > 
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
  2013-01-25  8:09     ` Guennadi Liakhovetski
@ 2013-01-25  9:05       ` Simon Horman
  -1 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2013-01-25  9:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 25, 2013 at 09:09:54AM +0100, Guennadi Liakhovetski wrote:
> Hi Simon
> 
> On Fri, 25 Jan 2013, Simon Horman wrote:
> 
> > On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > > This patch series gets rid of gpio_request()-style ethernet pin 
> > > configuration on armadillo800eva in reference implementation.
> > 
> > Hi Guennadi,
> > 
> > these changes seem to be reasonable to me.
> > 
> > Are there any dependencies for the sh_eth patch?
> > I assume this will be handled by David Miller through the net-next tree.
> > Are there any dependencies? The last time I checked the DT bindings
> > for sh_eth had not been merged.
> 
> Obviously, it can only be applied, if the 
> Documentation/devicetree/bindings/net/sh_ether.txt file and the 
> sh_eth_parse_dt() function exist. Also, if there are no objections against 
> the new phy-reset-gpios DT property. Otherwise there are no dependencies - 
> as long as the phy-reset-gpios property isn't found in DT, the patch 
> doesn't affect the driver.

Thanks, I'm slightly concerned that the other patch(es) relating
to Documentation/devicetree/bindings/net/sh_ether.txt have gone missing in
action.

Do you have an interest in chasing them down or would you like me to?

> > For the remaining two patches, which I assume will go through my renesas
> > tree:
> > * Are there any dependencies that aren't satisfied by the of-intc branch?
> 
> AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which 
> are needed for patch 1 to apply and for patch 3 to make sense. My earlier 
> MMC DT / pinctrl patches aren't required for these patches to function, 
> but these patches won't apply cleanly without them, since they touch the 
> same code fragments. So, it would be easier to merge them in the order of 
> submission.
> 
> > * Could you get some Acks. At least from Laurent?
> 
> Sure, let's give reviewers some more time :)

Indeed.

Laurent, if there are patches ready for me to take into the renesas tree
please let me know. I'm reluctant to add any more pinmux changes for 3.9.
But if a topic branch would help let me know.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-25  9:05       ` Simon Horman
  0 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2013-01-25  9:05 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 25, 2013 at 09:09:54AM +0100, Guennadi Liakhovetski wrote:
> Hi Simon
> 
> On Fri, 25 Jan 2013, Simon Horman wrote:
> 
> > On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > > This patch series gets rid of gpio_request()-style ethernet pin 
> > > configuration on armadillo800eva in reference implementation.
> > 
> > Hi Guennadi,
> > 
> > these changes seem to be reasonable to me.
> > 
> > Are there any dependencies for the sh_eth patch?
> > I assume this will be handled by David Miller through the net-next tree.
> > Are there any dependencies? The last time I checked the DT bindings
> > for sh_eth had not been merged.
> 
> Obviously, it can only be applied, if the 
> Documentation/devicetree/bindings/net/sh_ether.txt file and the 
> sh_eth_parse_dt() function exist. Also, if there are no objections against 
> the new phy-reset-gpios DT property. Otherwise there are no dependencies - 
> as long as the phy-reset-gpios property isn't found in DT, the patch 
> doesn't affect the driver.

Thanks, I'm slightly concerned that the other patch(es) relating
to Documentation/devicetree/bindings/net/sh_ether.txt have gone missing in
action.

Do you have an interest in chasing them down or would you like me to?

> > For the remaining two patches, which I assume will go through my renesas
> > tree:
> > * Are there any dependencies that aren't satisfied by the of-intc branch?
> 
> AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which 
> are needed for patch 1 to apply and for patch 3 to make sense. My earlier 
> MMC DT / pinctrl patches aren't required for these patches to function, 
> but these patches won't apply cleanly without them, since they touch the 
> same code fragments. So, it would be easier to merge them in the order of 
> submission.
> 
> > * Could you get some Acks. At least from Laurent?
> 
> Sure, let's give reviewers some more time :)

Indeed.

Laurent, if there are patches ready for me to take into the renesas tree
please let me know. I'm reluctant to add any more pinmux changes for 3.9.
But if a topic branch would help let me know.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
  2013-01-25  9:05       ` Simon Horman
@ 2013-01-25  9:57         ` Laurent Pinchart
  -1 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Friday 25 January 2013 18:05:44 Simon Horman wrote:
> On Fri, Jan 25, 2013 at 09:09:54AM +0100, Guennadi Liakhovetski wrote:
> > On Fri, 25 Jan 2013, Simon Horman wrote:
> > > On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > > > This patch series gets rid of gpio_request()-style ethernet pin
> > > > configuration on armadillo800eva in reference implementation.
> > > 
> > > Hi Guennadi,
> > > 
> > > these changes seem to be reasonable to me.
> > > 
> > > Are there any dependencies for the sh_eth patch?
> > > I assume this will be handled by David Miller through the net-next tree.
> > > Are there any dependencies? The last time I checked the DT bindings
> > > for sh_eth had not been merged.
> > 
> > Obviously, it can only be applied, if the
> > Documentation/devicetree/bindings/net/sh_ether.txt file and the
> > sh_eth_parse_dt() function exist. Also, if there are no objections against
> > the new phy-reset-gpios DT property. Otherwise there are no dependencies -
> > as long as the phy-reset-gpios property isn't found in DT, the patch
> > doesn't affect the driver.
> 
> Thanks, I'm slightly concerned that the other patch(es) relating
> to Documentation/devicetree/bindings/net/sh_ether.txt have gone missing in
> action.
> 
> Do you have an interest in chasing them down or would you like me to?
> 
> > > For the remaining two patches, which I assume will go through my renesas
> > > tree:
> > > * Are there any dependencies that aren't satisfied by the of-intc
> > > branch?
> > 
> > AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which
> > are needed for patch 1 to apply and for patch 3 to make sense. My earlier
> > MMC DT / pinctrl patches aren't required for these patches to function,
> > but these patches won't apply cleanly without them, since they touch the
> > same code fragments. So, it would be easier to merge them in the order of
> > submission.
> > 
> > > * Could you get some Acks. At least from Laurent?
> > 
> > Sure, let's give reviewers some more time :)
> 
> Indeed.
> 
> Laurent, if there are patches ready for me to take into the renesas tree
> please let me know. I'm reluctant to add any more pinmux changes for 3.9.
> But if a topic branch would help let me know.

I'd like the gpio_request_one() patches to go to v3.9 if possible. The other 
pinctrl patches will need to wait until v3.10 I'm afraid.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-25  9:57         ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Friday 25 January 2013 18:05:44 Simon Horman wrote:
> On Fri, Jan 25, 2013 at 09:09:54AM +0100, Guennadi Liakhovetski wrote:
> > On Fri, 25 Jan 2013, Simon Horman wrote:
> > > On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > > > This patch series gets rid of gpio_request()-style ethernet pin
> > > > configuration on armadillo800eva in reference implementation.
> > > 
> > > Hi Guennadi,
> > > 
> > > these changes seem to be reasonable to me.
> > > 
> > > Are there any dependencies for the sh_eth patch?
> > > I assume this will be handled by David Miller through the net-next tree.
> > > Are there any dependencies? The last time I checked the DT bindings
> > > for sh_eth had not been merged.
> > 
> > Obviously, it can only be applied, if the
> > Documentation/devicetree/bindings/net/sh_ether.txt file and the
> > sh_eth_parse_dt() function exist. Also, if there are no objections against
> > the new phy-reset-gpios DT property. Otherwise there are no dependencies -
> > as long as the phy-reset-gpios property isn't found in DT, the patch
> > doesn't affect the driver.
> 
> Thanks, I'm slightly concerned that the other patch(es) relating
> to Documentation/devicetree/bindings/net/sh_ether.txt have gone missing in
> action.
> 
> Do you have an interest in chasing them down or would you like me to?
> 
> > > For the remaining two patches, which I assume will go through my renesas
> > > tree:
> > > * Are there any dependencies that aren't satisfied by the of-intc
> > > branch?
> > 
> > AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which
> > are needed for patch 1 to apply and for patch 3 to make sense. My earlier
> > MMC DT / pinctrl patches aren't required for these patches to function,
> > but these patches won't apply cleanly without them, since they touch the
> > same code fragments. So, it would be easier to merge them in the order of
> > submission.
> > 
> > > * Could you get some Acks. At least from Laurent?
> > 
> > Sure, let's give reviewers some more time :)
> 
> Indeed.
> 
> Laurent, if there are patches ready for me to take into the renesas tree
> please let me know. I'm reluctant to add any more pinmux changes for 3.9.
> But if a topic branch would help let me know.

I'd like the gpio_request_one() patches to go to v3.9 if possible. The other 
pinctrl patches will need to wait until v3.10 I'm afraid.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 1/3] pinctrl: add ethernet pin groups to r8a7740
  2013-01-24 16:07   ` Guennadi Liakhovetski
@ 2013-01-25 10:15     ` Laurent Pinchart
  -1 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guennadi,

Thanks for the patch.

On Thursday 24 January 2013 17:07:31 Guennadi Liakhovetski wrote:
> r8a7740 SoCs have an integrated gigabit ethernet MAC. This patch adds two
> pin groups: base for 100mbps and additional pins for the gigabit mode.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c |   31 +++++++++++++++++++++++++++++++
> 1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index 4c92af8..d7f69dd 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -2052,6 +2052,29 @@ static const unsigned int mmc0_ctrl_1_mux[] = {
>  	MMC1_CMD_PORT104_MARK, MMC1_CLK_PORT103_MARK,
>  };
> 
> +static const unsigned int eth_base_pins[] = {
> +	203, 204, 205, 206, 207,
> +	183, 184,
> +	185, 186, 187, 188,
> +	171, 170, 169, 168,
> +	161, 163, 164, 174,
> +};
> +static const unsigned int eth_base_mux[] = {
> +	ET_TX_ER_MARK, ET_RX_ER_MARK, ET_CRS_MARK, ET_MDC_MARK, ET_MDIO_MARK,
> +	ET_TX_EN_MARK, ET_TX_CLK_MARK,
> +	ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
> +	ET_ETXD0_MARK, ET_ETXD1_MARK, ET_ETXD2_MARK, ET_ETXD3_MARK,
> +	ET_RX_DV_MARK, ET_COL_MARK, ET_PHY_INT_MARK, ET_RX_CLK_MARK,
> +};
> +static const unsigned int eth_gbit_pins[] = {
> +	189, 190, 191, 192,
> +	167, 166, 173, 172,
> +};
> +static const unsigned int eth_gbit_mux[] = {
> +	ET_ERXD4_MARK, ET_ERXD5_MARK, ET_ERXD6_MARK, ET_ERXD7_MARK,
> +	ET_ETXD4_MARK, ET_ETXD5_MARK, ET_ETXD6_MARK, ET_ETXD7_MARK,
> +};
> +
>  static const struct sh_pfc_pin_group pinmux_groups[] = {
>  	SH_PFC_PIN_GROUP(lcd0_data8),
>  	SH_PFC_PIN_GROUP(lcd0_data9),
> @@ -2100,6 +2123,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] > { SH_PFC_PIN_GROUP(mmc0_data4_1),
>  	SH_PFC_PIN_GROUP(mmc0_data8_1),
>  	SH_PFC_PIN_GROUP(mmc0_ctrl_1),
> +	SH_PFC_PIN_GROUP(eth_base),
> +	SH_PFC_PIN_GROUP(eth_gbit),
>  };
> 
>  static const char * const lcd0_groups[] = {
> @@ -2167,6 +2192,11 @@ static const char * const mmc0_groups[] = {
>  	"mmc0_ctrl_1",
>  };
> 
> +static const char * const eth_groups[] = {
> +	"eth_base",
> +	"eth_gbit",
> +};
> +

What about calling the groups mdio (for management), mii, gmii and rmii ? You 
can duplicate common pins in mii and gmii.

The WOL, GTK_CLK and LINK pins are missing BTW.

>  static const struct sh_pfc_function pinmux_functions[] = {
>  	SH_PFC_FUNCTION(lcd0),
>  	SH_PFC_FUNCTION(lcd1),
> @@ -2174,6 +2204,7 @@ static const struct sh_pfc_function pinmux_functions[]
> = { SH_PFC_FUNCTION(sdhi1),
>  	SH_PFC_FUNCTION(sdhi2),
>  	SH_PFC_FUNCTION(mmc0),
> +	SH_PFC_FUNCTION(eth),
>  };
> 
>  #define PINMUX_FN_BASE	ARRAY_SIZE(pinmux_pins)

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 1/3] pinctrl: add ethernet pin groups to r8a7740
@ 2013-01-25 10:15     ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25 10:15 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guennadi,

Thanks for the patch.

On Thursday 24 January 2013 17:07:31 Guennadi Liakhovetski wrote:
> r8a7740 SoCs have an integrated gigabit ethernet MAC. This patch adds two
> pin groups: base for 100mbps and additional pins for the gigabit mode.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> ---
>  drivers/pinctrl/sh-pfc/pfc-r8a7740.c |   31 +++++++++++++++++++++++++++++++
> 1 files changed, 31 insertions(+), 0 deletions(-)
> 
> diff --git a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c index 4c92af8..d7f69dd 100644
> --- a/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> +++ b/drivers/pinctrl/sh-pfc/pfc-r8a7740.c
> @@ -2052,6 +2052,29 @@ static const unsigned int mmc0_ctrl_1_mux[] = {
>  	MMC1_CMD_PORT104_MARK, MMC1_CLK_PORT103_MARK,
>  };
> 
> +static const unsigned int eth_base_pins[] = {
> +	203, 204, 205, 206, 207,
> +	183, 184,
> +	185, 186, 187, 188,
> +	171, 170, 169, 168,
> +	161, 163, 164, 174,
> +};
> +static const unsigned int eth_base_mux[] = {
> +	ET_TX_ER_MARK, ET_RX_ER_MARK, ET_CRS_MARK, ET_MDC_MARK, ET_MDIO_MARK,
> +	ET_TX_EN_MARK, ET_TX_CLK_MARK,
> +	ET_ERXD0_MARK, ET_ERXD1_MARK, ET_ERXD2_MARK, ET_ERXD3_MARK,
> +	ET_ETXD0_MARK, ET_ETXD1_MARK, ET_ETXD2_MARK, ET_ETXD3_MARK,
> +	ET_RX_DV_MARK, ET_COL_MARK, ET_PHY_INT_MARK, ET_RX_CLK_MARK,
> +};
> +static const unsigned int eth_gbit_pins[] = {
> +	189, 190, 191, 192,
> +	167, 166, 173, 172,
> +};
> +static const unsigned int eth_gbit_mux[] = {
> +	ET_ERXD4_MARK, ET_ERXD5_MARK, ET_ERXD6_MARK, ET_ERXD7_MARK,
> +	ET_ETXD4_MARK, ET_ETXD5_MARK, ET_ETXD6_MARK, ET_ETXD7_MARK,
> +};
> +
>  static const struct sh_pfc_pin_group pinmux_groups[] = {
>  	SH_PFC_PIN_GROUP(lcd0_data8),
>  	SH_PFC_PIN_GROUP(lcd0_data9),
> @@ -2100,6 +2123,8 @@ static const struct sh_pfc_pin_group pinmux_groups[] =
> { SH_PFC_PIN_GROUP(mmc0_data4_1),
>  	SH_PFC_PIN_GROUP(mmc0_data8_1),
>  	SH_PFC_PIN_GROUP(mmc0_ctrl_1),
> +	SH_PFC_PIN_GROUP(eth_base),
> +	SH_PFC_PIN_GROUP(eth_gbit),
>  };
> 
>  static const char * const lcd0_groups[] = {
> @@ -2167,6 +2192,11 @@ static const char * const mmc0_groups[] = {
>  	"mmc0_ctrl_1",
>  };
> 
> +static const char * const eth_groups[] = {
> +	"eth_base",
> +	"eth_gbit",
> +};
> +

What about calling the groups mdio (for management), mii, gmii and rmii ? You 
can duplicate common pins in mii and gmii.

The WOL, GTK_CLK and LINK pins are missing BTW.

>  static const struct sh_pfc_function pinmux_functions[] = {
>  	SH_PFC_FUNCTION(lcd0),
>  	SH_PFC_FUNCTION(lcd1),
> @@ -2174,6 +2204,7 @@ static const struct sh_pfc_function pinmux_functions[]
> = { SH_PFC_FUNCTION(sdhi1),
>  	SH_PFC_FUNCTION(sdhi2),
>  	SH_PFC_FUNCTION(mmc0),
> +	SH_PFC_FUNCTION(eth),
>  };
> 
>  #define PINMUX_FN_BASE	ARRAY_SIZE(pinmux_pins)

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
  2013-01-24 16:07   ` Guennadi Liakhovetski
  (?)
@ 2013-01-25 10:21     ` Laurent Pinchart
  -1 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guennadi,

On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> a binding and code to parse it, request the GPIO and take the PHY out of
> reset.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: netdev@vger.kernel.org
> ---
>  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
>  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
>  2 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> 100644
> --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> @@ -12,6 +12,7 @@ Required properties:
>  - interrupts:                   Interrupt mapping for the sh_eth interrupt
>                                  sources (vector id).
>  - phy-mode:              String, operation mode of the PHY interface.
> +- phy-reset-gpios:              PHY reset GPIO tuple

If you can't have more than one GPIO here, what about calling it phy-reset-
gpio ?

>  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
>  - sh-eth,register-type:         String, register type of sh_eth.
>                                  Please select "gigabit", "fast-sh4" or
> @@ -37,6 +38,7 @@ Example (armadillo800eva):
>  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
>  		interrupts = <0x500>;
>  		phy-mode = "mii";
> +		phy-reset-gpios = <&gpio 18 0>;
>  		sh-eth,edmac-endian = "little";
>  		sh-eth,register-type = "gigabit";
>  		sh-eth,phy-id = <0>;
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -20,6 +20,7 @@
>   *  the file called "COPYING".
>   */
> 
> +#include <linux/gpio.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> @@ -33,6 +34,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> +#include <linux/of_gpio.h>
>  #include <linux/of_platform.h>
>  #include <linux/of_address.h>
>  #include <linux/of_irq.h>
> @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
>  static struct sh_eth_plat_data *
>  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>  {
> -	int ret;
> +	int ret, gpio;
>  	const char *of_str;
>  	struct device_node *np = dev->of_node;
>  	struct sh_eth_plat_data *pdata;
> +	enum of_gpio_flags flags;
> 
>  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
>  					GFP_KERNEL);
> @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> *ndev) else
>  		pdata->needs_init = 0;
> 
> +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));

You could use devm_gpio_request_one() here.

Is there no need to reset the phy at runtime ?

> +
>  #ifdef CONFIG_OF_NET
>  	if (!is_valid_ether_addr(ndev->dev_addr)) {
>  		const char *macaddr = of_get_mac_address(np);
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-25 10:21     ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25 10:21 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh, Magnus Damm, Simon Horman, linux-arm-kernel,
	devicetree-discuss, netdev

Hi Guennadi,

On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> a binding and code to parse it, request the GPIO and take the PHY out of
> reset.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Cc: devicetree-discuss@lists.ozlabs.org
> Cc: netdev@vger.kernel.org
> ---
>  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
>  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
>  2 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> 100644
> --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> @@ -12,6 +12,7 @@ Required properties:
>  - interrupts:                   Interrupt mapping for the sh_eth interrupt
>                                  sources (vector id).
>  - phy-mode:              String, operation mode of the PHY interface.
> +- phy-reset-gpios:              PHY reset GPIO tuple

If you can't have more than one GPIO here, what about calling it phy-reset-
gpio ?

>  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
>  - sh-eth,register-type:         String, register type of sh_eth.
>                                  Please select "gigabit", "fast-sh4" or
> @@ -37,6 +38,7 @@ Example (armadillo800eva):
>  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
>  		interrupts = <0x500>;
>  		phy-mode = "mii";
> +		phy-reset-gpios = <&gpio 18 0>;
>  		sh-eth,edmac-endian = "little";
>  		sh-eth,register-type = "gigabit";
>  		sh-eth,phy-id = <0>;
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -20,6 +20,7 @@
>   *  the file called "COPYING".
>   */
> 
> +#include <linux/gpio.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> @@ -33,6 +34,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> +#include <linux/of_gpio.h>
>  #include <linux/of_platform.h>
>  #include <linux/of_address.h>
>  #include <linux/of_irq.h>
> @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
>  static struct sh_eth_plat_data *
>  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>  {
> -	int ret;
> +	int ret, gpio;
>  	const char *of_str;
>  	struct device_node *np = dev->of_node;
>  	struct sh_eth_plat_data *pdata;
> +	enum of_gpio_flags flags;
> 
>  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
>  					GFP_KERNEL);
> @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> *ndev) else
>  		pdata->needs_init = 0;
> 
> +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));

You could use devm_gpio_request_one() here.

Is there no need to reset the phy at runtime ?

> +
>  #ifdef CONFIG_OF_NET
>  	if (!is_valid_ether_addr(ndev->dev_addr)) {
>  		const char *macaddr = of_get_mac_address(np);
-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-25 10:21     ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-25 10:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guennadi,

On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> a binding and code to parse it, request the GPIO and take the PHY out of
> reset.
> 
> Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> Cc: devicetree-discuss at lists.ozlabs.org
> Cc: netdev at vger.kernel.org
> ---
>  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
>  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
>  2 files changed, 10 insertions(+), 1 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> 100644
> --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> @@ -12,6 +12,7 @@ Required properties:
>  - interrupts:                   Interrupt mapping for the sh_eth interrupt
>                                  sources (vector id).
>  - phy-mode:              String, operation mode of the PHY interface.
> +- phy-reset-gpios:              PHY reset GPIO tuple

If you can't have more than one GPIO here, what about calling it phy-reset-
gpio ?

>  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
>  - sh-eth,register-type:         String, register type of sh_eth.
>                                  Please select "gigabit", "fast-sh4" or
> @@ -37,6 +38,7 @@ Example (armadillo800eva):
>  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
>  		interrupts = <0x500>;
>  		phy-mode = "mii";
> +		phy-reset-gpios = <&gpio 18 0>;
>  		sh-eth,edmac-endian = "little";
>  		sh-eth,register-type = "gigabit";
>  		sh-eth,phy-id = <0>;
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -20,6 +20,7 @@
>   *  the file called "COPYING".
>   */
> 
> +#include <linux/gpio.h>
>  #include <linux/init.h>
>  #include <linux/module.h>
>  #include <linux/kernel.h>
> @@ -33,6 +34,7 @@
>  #include <linux/netdevice.h>
>  #include <linux/of.h>
>  #include <linux/of_device.h>
> +#include <linux/of_gpio.h>
>  #include <linux/of_platform.h>
>  #include <linux/of_address.h>
>  #include <linux/of_irq.h>
> @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
>  static struct sh_eth_plat_data *
>  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>  {
> -	int ret;
> +	int ret, gpio;
>  	const char *of_str;
>  	struct device_node *np = dev->of_node;
>  	struct sh_eth_plat_data *pdata;
> +	enum of_gpio_flags flags;
> 
>  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
>  					GFP_KERNEL);
> @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> *ndev) else
>  		pdata->needs_init = 0;
> 
> +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));

You could use devm_gpio_request_one() here.

Is there no need to reset the phy at runtime ?

> +
>  #ifdef CONFIG_OF_NET
>  	if (!is_valid_ether_addr(ndev->dev_addr)) {
>  		const char *macaddr = of_get_mac_address(np);
-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
  2013-01-25 10:21     ` Laurent Pinchart
  (?)
@ 2013-01-25 10:34       ` Guennadi Liakhovetski
  -1 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-25 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Laurent

On Fri, 25 Jan 2013, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> > a binding and code to parse it, request the GPIO and take the PHY out of
> > reset.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: devicetree-discuss@lists.ozlabs.org
> > Cc: netdev@vger.kernel.org
> > ---
> >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> >  2 files changed, 10 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> > b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> > 100644
> > --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> > +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> > @@ -12,6 +12,7 @@ Required properties:
> >  - interrupts:                   Interrupt mapping for the sh_eth interrupt
> >                                  sources (vector id).
> >  - phy-mode:              String, operation mode of the PHY interface.
> > +- phy-reset-gpios:              PHY reset GPIO tuple
> 
> If you can't have more than one GPIO here, what about calling it phy-reset-
> gpio ?

From Documentation/devicetree/bindings/gpio/gpio.txt:

<quote>
GPIO properties should be named "[<name>-]gpios".
</quote>

> >  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
> >  - sh-eth,register-type:         String, register type of sh_eth.
> >                                  Please select "gigabit", "fast-sh4" or
> > @@ -37,6 +38,7 @@ Example (armadillo800eva):
> >  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
> >  		interrupts = <0x500>;
> >  		phy-mode = "mii";
> > +		phy-reset-gpios = <&gpio 18 0>;
> >  		sh-eth,edmac-endian = "little";
> >  		sh-eth,register-type = "gigabit";
> >  		sh-eth,phy-id = <0>;
> > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > +++ b/drivers/net/ethernet/renesas/sh_eth.c
> > @@ -20,6 +20,7 @@
> >   *  the file called "COPYING".
> >   */
> > 
> > +#include <linux/gpio.h>
> >  #include <linux/init.h>
> >  #include <linux/module.h>
> >  #include <linux/kernel.h>
> > @@ -33,6 +34,7 @@
> >  #include <linux/netdevice.h>
> >  #include <linux/of.h>
> >  #include <linux/of_device.h>
> > +#include <linux/of_gpio.h>
> >  #include <linux/of_platform.h>
> >  #include <linux/of_address.h>
> >  #include <linux/of_irq.h>
> > @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
> >  static struct sh_eth_plat_data *
> >  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
> >  {
> > -	int ret;
> > +	int ret, gpio;
> >  	const char *of_str;
> >  	struct device_node *np = dev->of_node;
> >  	struct sh_eth_plat_data *pdata;
> > +	enum of_gpio_flags flags;
> > 
> >  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
> >  					GFP_KERNEL);
> > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> > *ndev) else
> >  		pdata->needs_init = 0;
> > 
> > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> 
> You could use devm_gpio_request_one() here.

Yes, but then the flag would look uglier, something like

		devm_gpio_request_one(dev, gpio, flags & 
			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH : 
			GPIOF_OUT_INIT_LOW);

Does it really look like an improvement? :)

> Is there no need to reset the phy at runtime ?

No idea, I'm not developing the driver, I'm just porting one specific 
feature from one API to another with no functional changes (apart from 
postponing setting the GPIO).

Thanks
Guennadi

> > +
> >  #ifdef CONFIG_OF_NET
> >  	if (!is_valid_ether_addr(ndev->dev_addr)) {
> >  		const char *macaddr = of_get_mac_address(np);
> -- 
> Regards,
> 
> Laurent Pinchart
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-25 10:34       ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-25 10:34 UTC (permalink / raw)
  To: Laurent Pinchart
  Cc: linux-sh, Magnus Damm, Simon Horman, linux-arm-kernel,
	devicetree-discuss, netdev

Hi Laurent

On Fri, 25 Jan 2013, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> > a binding and code to parse it, request the GPIO and take the PHY out of
> > reset.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: devicetree-discuss@lists.ozlabs.org
> > Cc: netdev@vger.kernel.org
> > ---
> >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> >  2 files changed, 10 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> > b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> > 100644
> > --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> > +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> > @@ -12,6 +12,7 @@ Required properties:
> >  - interrupts:                   Interrupt mapping for the sh_eth interrupt
> >                                  sources (vector id).
> >  - phy-mode:              String, operation mode of the PHY interface.
> > +- phy-reset-gpios:              PHY reset GPIO tuple
> 
> If you can't have more than one GPIO here, what about calling it phy-reset-
> gpio ?

>From Documentation/devicetree/bindings/gpio/gpio.txt:

<quote>
GPIO properties should be named "[<name>-]gpios".
</quote>

> >  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
> >  - sh-eth,register-type:         String, register type of sh_eth.
> >                                  Please select "gigabit", "fast-sh4" or
> > @@ -37,6 +38,7 @@ Example (armadillo800eva):
> >  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
> >  		interrupts = <0x500>;
> >  		phy-mode = "mii";
> > +		phy-reset-gpios = <&gpio 18 0>;
> >  		sh-eth,edmac-endian = "little";
> >  		sh-eth,register-type = "gigabit";
> >  		sh-eth,phy-id = <0>;
> > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > +++ b/drivers/net/ethernet/renesas/sh_eth.c
> > @@ -20,6 +20,7 @@
> >   *  the file called "COPYING".
> >   */
> > 
> > +#include <linux/gpio.h>
> >  #include <linux/init.h>
> >  #include <linux/module.h>
> >  #include <linux/kernel.h>
> > @@ -33,6 +34,7 @@
> >  #include <linux/netdevice.h>
> >  #include <linux/of.h>
> >  #include <linux/of_device.h>
> > +#include <linux/of_gpio.h>
> >  #include <linux/of_platform.h>
> >  #include <linux/of_address.h>
> >  #include <linux/of_irq.h>
> > @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
> >  static struct sh_eth_plat_data *
> >  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
> >  {
> > -	int ret;
> > +	int ret, gpio;
> >  	const char *of_str;
> >  	struct device_node *np = dev->of_node;
> >  	struct sh_eth_plat_data *pdata;
> > +	enum of_gpio_flags flags;
> > 
> >  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
> >  					GFP_KERNEL);
> > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> > *ndev) else
> >  		pdata->needs_init = 0;
> > 
> > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> 
> You could use devm_gpio_request_one() here.

Yes, but then the flag would look uglier, something like

		devm_gpio_request_one(dev, gpio, flags & 
			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH : 
			GPIOF_OUT_INIT_LOW);

Does it really look like an improvement? :)

> Is there no need to reset the phy at runtime ?

No idea, I'm not developing the driver, I'm just porting one specific 
feature from one API to another with no functional changes (apart from 
postponing setting the GPIO).

Thanks
Guennadi

> > +
> >  #ifdef CONFIG_OF_NET
> >  	if (!is_valid_ether_addr(ndev->dev_addr)) {
> >  		const char *macaddr = of_get_mac_address(np);
> -- 
> Regards,
> 
> Laurent Pinchart
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-25 10:34       ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-01-25 10:34 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Laurent

On Fri, 25 Jan 2013, Laurent Pinchart wrote:

> Hi Guennadi,
> 
> On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > If an ethernet PHY can be reset by a GPIO, it can be specified in DT. Add
> > a binding and code to parse it, request the GPIO and take the PHY out of
> > reset.
> > 
> > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > Cc: devicetree-discuss at lists.ozlabs.org
> > Cc: netdev at vger.kernel.org
> > ---
> >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> >  2 files changed, 10 insertions(+), 1 deletions(-)
> > 
> > diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt
> > b/Documentation/devicetree/bindings/net/sh_ether.txt index c11e45d..edaf683
> > 100644
> > --- a/Documentation/devicetree/bindings/net/sh_ether.txt
> > +++ b/Documentation/devicetree/bindings/net/sh_ether.txt
> > @@ -12,6 +12,7 @@ Required properties:
> >  - interrupts:                   Interrupt mapping for the sh_eth interrupt
> >                                  sources (vector id).
> >  - phy-mode:              String, operation mode of the PHY interface.
> > +- phy-reset-gpios:              PHY reset GPIO tuple
> 
> If you can't have more than one GPIO here, what about calling it phy-reset-
> gpio ?

>From Documentation/devicetree/bindings/gpio/gpio.txt:

<quote>
GPIO properties should be named "[<name>-]gpios".
</quote>

> >  - sh-eth,edmac-endian:          String, endian of sh_eth dmac.
> >  - sh-eth,register-type:         String, register type of sh_eth.
> >                                  Please select "gigabit", "fast-sh4" or
> > @@ -37,6 +38,7 @@ Example (armadillo800eva):
> >  		reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
> >  		interrupts = <0x500>;
> >  		phy-mode = "mii";
> > +		phy-reset-gpios = <&gpio 18 0>;
> >  		sh-eth,edmac-endian = "little";
> >  		sh-eth,register-type = "gigabit";
> >  		sh-eth,phy-id = <0>;
> > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > +++ b/drivers/net/ethernet/renesas/sh_eth.c
> > @@ -20,6 +20,7 @@
> >   *  the file called "COPYING".
> >   */
> > 
> > +#include <linux/gpio.h>
> >  #include <linux/init.h>
> >  #include <linux/module.h>
> >  #include <linux/kernel.h>
> > @@ -33,6 +34,7 @@
> >  #include <linux/netdevice.h>
> >  #include <linux/of.h>
> >  #include <linux/of_device.h>
> > +#include <linux/of_gpio.h>
> >  #include <linux/of_platform.h>
> >  #include <linux/of_address.h>
> >  #include <linux/of_irq.h>
> > @@ -2376,10 +2378,11 @@ sh_eth_of_get_register_type(struct device_node *np)
> >  static struct sh_eth_plat_data *
> >  sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
> >  {
> > -	int ret;
> > +	int ret, gpio;
> >  	const char *of_str;
> >  	struct device_node *np = dev->of_node;
> >  	struct sh_eth_plat_data *pdata;
> > +	enum of_gpio_flags flags;
> > 
> >  	pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
> >  					GFP_KERNEL);
> > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct net_device
> > *ndev) else
> >  		pdata->needs_init = 0;
> > 
> > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> 
> You could use devm_gpio_request_one() here.

Yes, but then the flag would look uglier, something like

		devm_gpio_request_one(dev, gpio, flags & 
			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH : 
			GPIOF_OUT_INIT_LOW);

Does it really look like an improvement? :)

> Is there no need to reset the phy at runtime ?

No idea, I'm not developing the driver, I'm just porting one specific 
feature from one API to another with no functional changes (apart from 
postponing setting the GPIO).

Thanks
Guennadi

> > +
> >  #ifdef CONFIG_OF_NET
> >  	if (!is_valid_ether_addr(ndev->dev_addr)) {
> >  		const char *macaddr = of_get_mac_address(np);
> -- 
> Regards,
> 
> Laurent Pinchart
> 

---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
  2013-01-25 10:34       ` Guennadi Liakhovetski
  (?)
@ 2013-01-25 18:21         ` Jason Gunthorpe
  -1 siblings, 0 replies; 36+ messages in thread
From: Jason Gunthorpe @ 2013-01-25 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 25, 2013 at 11:34:55AM +0100, Guennadi Liakhovetski wrote:

> > Is there no need to reset the phy at runtime ?
> 
> No idea, I'm not developing the driver, I'm just porting one specific 
> feature from one API to another with no functional changes (apart from 
> postponing setting the GPIO).

Generally Linux relies on resetting the phy via the inband MDIO method,
which is what Linux does. It is pretty much never required to reset
via the hard pin - but you do need to generate a robust reset edge on
the reset pin once after power up.

Jason

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-25 18:21         ` Jason Gunthorpe
  0 siblings, 0 replies; 36+ messages in thread
From: Jason Gunthorpe @ 2013-01-25 18:21 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: Laurent Pinchart, linux-sh, netdev, devicetree-discuss,
	Magnus Damm, Simon Horman, linux-arm-kernel

On Fri, Jan 25, 2013 at 11:34:55AM +0100, Guennadi Liakhovetski wrote:

> > Is there no need to reset the phy at runtime ?
> 
> No idea, I'm not developing the driver, I'm just porting one specific 
> feature from one API to another with no functional changes (apart from 
> postponing setting the GPIO).

Generally Linux relies on resetting the phy via the inband MDIO method,
which is what Linux does. It is pretty much never required to reset
via the hard pin - but you do need to generate a robust reset edge on
the reset pin once after power up.

Jason

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-25 18:21         ` Jason Gunthorpe
  0 siblings, 0 replies; 36+ messages in thread
From: Jason Gunthorpe @ 2013-01-25 18:21 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 25, 2013 at 11:34:55AM +0100, Guennadi Liakhovetski wrote:

> > Is there no need to reset the phy at runtime ?
> 
> No idea, I'm not developing the driver, I'm just porting one specific 
> feature from one API to another with no functional changes (apart from 
> postponing setting the GPIO).

Generally Linux relies on resetting the phy via the inband MDIO method,
which is what Linux does. It is pretty much never required to reset
via the hard pin - but you do need to generate a robust reset edge on
the reset pin once after power up.

Jason

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
  2013-01-25 10:34       ` Guennadi Liakhovetski
  (?)
@ 2013-01-26  1:04         ` Laurent Pinchart
  -1 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-26  1:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guennadi,

On Friday 25 January 2013 11:34:55 Guennadi Liakhovetski wrote:
> On Fri, 25 Jan 2013, Laurent Pinchart wrote:
> > On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > > If an ethernet PHY can be reset by a GPIO, it can be specified in DT.
> > > Add a binding and code to parse it, request the GPIO and take the PHY
> > > out of reset.
> > > 
> > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > Cc: devicetree-discuss@lists.ozlabs.org
> > > Cc: netdev@vger.kernel.org
> > > ---
> > > 
> > >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> > >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> > >  2 files changed, 10 insertions(+), 1 deletions(-)

[snip]

> > > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > > +++ b/drivers/net/ethernet/renesas/sh_eth.c

[snip]

> > > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct
> > > net_device *ndev) else
> > > 
> > >  		pdata->needs_init = 0;
> > > 
> > > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> > 
> > You could use devm_gpio_request_one() here.
> 
> Yes, but then the flag would look uglier, something like
> 
> 		devm_gpio_request_one(dev, gpio, flags &
> 			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH :
> 			GPIOF_OUT_INIT_LOW);
> 
> Does it really look like an improvement? :)

It's one less function call, so to me it does :-) Feel free to ignore that 
though.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-26  1:04         ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-26  1:04 UTC (permalink / raw)
  To: Guennadi Liakhovetski
  Cc: linux-sh, Magnus Damm, Simon Horman, linux-arm-kernel,
	devicetree-discuss, netdev

Hi Guennadi,

On Friday 25 January 2013 11:34:55 Guennadi Liakhovetski wrote:
> On Fri, 25 Jan 2013, Laurent Pinchart wrote:
> > On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > > If an ethernet PHY can be reset by a GPIO, it can be specified in DT.
> > > Add a binding and code to parse it, request the GPIO and take the PHY
> > > out of reset.
> > > 
> > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > Cc: devicetree-discuss@lists.ozlabs.org
> > > Cc: netdev@vger.kernel.org
> > > ---
> > > 
> > >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> > >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> > >  2 files changed, 10 insertions(+), 1 deletions(-)

[snip]

> > > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > > +++ b/drivers/net/ethernet/renesas/sh_eth.c

[snip]

> > > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct
> > > net_device *ndev) else
> > > 
> > >  		pdata->needs_init = 0;
> > > 
> > > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> > 
> > You could use devm_gpio_request_one() here.
> 
> Yes, but then the flag would look uglier, something like
> 
> 		devm_gpio_request_one(dev, gpio, flags &
> 			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH :
> 			GPIOF_OUT_INIT_LOW);
> 
> Does it really look like an improvement? :)

It's one less function call, so to me it does :-) Feel free to ignore that 
though.

-- 
Regards,

Laurent Pinchart


^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-01-26  1:04         ` Laurent Pinchart
  0 siblings, 0 replies; 36+ messages in thread
From: Laurent Pinchart @ 2013-01-26  1:04 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Guennadi,

On Friday 25 January 2013 11:34:55 Guennadi Liakhovetski wrote:
> On Fri, 25 Jan 2013, Laurent Pinchart wrote:
> > On Thursday 24 January 2013 17:07:32 Guennadi Liakhovetski wrote:
> > > If an ethernet PHY can be reset by a GPIO, it can be specified in DT.
> > > Add a binding and code to parse it, request the GPIO and take the PHY
> > > out of reset.
> > > 
> > > Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > Cc: devicetree-discuss at lists.ozlabs.org
> > > Cc: netdev at vger.kernel.org
> > > ---
> > > 
> > >  Documentation/devicetree/bindings/net/sh_ether.txt |    2 ++
> > >  drivers/net/ethernet/renesas/sh_eth.c              |    9 ++++++++-
> > >  2 files changed, 10 insertions(+), 1 deletions(-)

[snip]

> > > diff --git a/drivers/net/ethernet/renesas/sh_eth.c
> > > b/drivers/net/ethernet/renesas/sh_eth.c index 1f64848..06035a2 100644
> > > --- a/drivers/net/ethernet/renesas/sh_eth.c
> > > +++ b/drivers/net/ethernet/renesas/sh_eth.c

[snip]

> > > @@ -2420,6 +2423,10 @@ sh_eth_parse_dt(struct device *dev, struct
> > > net_device *ndev) else
> > > 
> > >  		pdata->needs_init = 0;
> > > 
> > > +	gpio = of_get_named_gpio_flags(np, "phy-reset-gpios", 0, &flags);
> > > +	if (gpio_is_valid(gpio) && !devm_gpio_request(dev, gpio, NULL))
> > > +		gpio_direction_output(gpio, !!(flags & OF_GPIO_ACTIVE_LOW));
> > 
> > You could use devm_gpio_request_one() here.
> 
> Yes, but then the flag would look uglier, something like
> 
> 		devm_gpio_request_one(dev, gpio, flags &
> 			OF_GPIO_ACTIVE_LOW ? GPIOF_OUT_INIT_HIGH :
> 			GPIOF_OUT_INIT_LOW);
> 
> Does it really look like an improvement? :)

It's one less function call, so to me it does :-) Feel free to ignore that 
though.

-- 
Regards,

Laurent Pinchart

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
  2013-01-25  9:57         ` Laurent Pinchart
@ 2013-01-28  1:02           ` Simon Horman
  -1 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2013-01-28  1:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 25, 2013 at 10:57:08AM +0100, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Friday 25 January 2013 18:05:44 Simon Horman wrote:
> > On Fri, Jan 25, 2013 at 09:09:54AM +0100, Guennadi Liakhovetski wrote:
> > > On Fri, 25 Jan 2013, Simon Horman wrote:
> > > > On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > > > > This patch series gets rid of gpio_request()-style ethernet pin
> > > > > configuration on armadillo800eva in reference implementation.
> > > > 
> > > > Hi Guennadi,
> > > > 
> > > > these changes seem to be reasonable to me.
> > > > 
> > > > Are there any dependencies for the sh_eth patch?
> > > > I assume this will be handled by David Miller through the net-next tree.
> > > > Are there any dependencies? The last time I checked the DT bindings
> > > > for sh_eth had not been merged.
> > > 
> > > Obviously, it can only be applied, if the
> > > Documentation/devicetree/bindings/net/sh_ether.txt file and the
> > > sh_eth_parse_dt() function exist. Also, if there are no objections against
> > > the new phy-reset-gpios DT property. Otherwise there are no dependencies -
> > > as long as the phy-reset-gpios property isn't found in DT, the patch
> > > doesn't affect the driver.
> > 
> > Thanks, I'm slightly concerned that the other patch(es) relating
> > to Documentation/devicetree/bindings/net/sh_ether.txt have gone missing in
> > action.
> > 
> > Do you have an interest in chasing them down or would you like me to?
> > 
> > > > For the remaining two patches, which I assume will go through my renesas
> > > > tree:
> > > > * Are there any dependencies that aren't satisfied by the of-intc
> > > > branch?
> > > 
> > > AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which
> > > are needed for patch 1 to apply and for patch 3 to make sense. My earlier
> > > MMC DT / pinctrl patches aren't required for these patches to function,
> > > but these patches won't apply cleanly without them, since they touch the
> > > same code fragments. So, it would be easier to merge them in the order of
> > > submission.
> > > 
> > > > * Could you get some Acks. At least from Laurent?
> > > 
> > > Sure, let's give reviewers some more time :)
> > 
> > Indeed.
> > 
> > Laurent, if there are patches ready for me to take into the renesas tree
> > please let me know. I'm reluctant to add any more pinmux changes for 3.9.
> > But if a topic branch would help let me know.
> 
> I'd like the gpio_request_one() patches to go to v3.9 if possible. The other 
> pinctrl patches will need to wait until v3.10 I'm afraid.

Understood. I have now queued the gpio_request_one() patches up for v3.9.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva
@ 2013-01-28  1:02           ` Simon Horman
  0 siblings, 0 replies; 36+ messages in thread
From: Simon Horman @ 2013-01-28  1:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jan 25, 2013 at 10:57:08AM +0100, Laurent Pinchart wrote:
> Hi Simon,
> 
> On Friday 25 January 2013 18:05:44 Simon Horman wrote:
> > On Fri, Jan 25, 2013 at 09:09:54AM +0100, Guennadi Liakhovetski wrote:
> > > On Fri, 25 Jan 2013, Simon Horman wrote:
> > > > On Thu, Jan 24, 2013 at 05:07:30PM +0100, Guennadi Liakhovetski wrote:
> > > > > This patch series gets rid of gpio_request()-style ethernet pin
> > > > > configuration on armadillo800eva in reference implementation.
> > > > 
> > > > Hi Guennadi,
> > > > 
> > > > these changes seem to be reasonable to me.
> > > > 
> > > > Are there any dependencies for the sh_eth patch?
> > > > I assume this will be handled by David Miller through the net-next tree.
> > > > Are there any dependencies? The last time I checked the DT bindings
> > > > for sh_eth had not been merged.
> > > 
> > > Obviously, it can only be applied, if the
> > > Documentation/devicetree/bindings/net/sh_ether.txt file and the
> > > sh_eth_parse_dt() function exist. Also, if there are no objections against
> > > the new phy-reset-gpios DT property. Otherwise there are no dependencies -
> > > as long as the phy-reset-gpios property isn't found in DT, the patch
> > > doesn't affect the driver.
> > 
> > Thanks, I'm slightly concerned that the other patch(es) relating
> > to Documentation/devicetree/bindings/net/sh_ether.txt have gone missing in
> > action.
> > 
> > Do you have an interest in chasing them down or would you like me to?
> > 
> > > > For the remaining two patches, which I assume will go through my renesas
> > > > tree:
> > > > * Are there any dependencies that aren't satisfied by the of-intc
> > > > branch?
> > > 
> > > AFAICS, that your branch doesn't contain Laurent's pinctrl patches, which
> > > are needed for patch 1 to apply and for patch 3 to make sense. My earlier
> > > MMC DT / pinctrl patches aren't required for these patches to function,
> > > but these patches won't apply cleanly without them, since they touch the
> > > same code fragments. So, it would be easier to merge them in the order of
> > > submission.
> > > 
> > > > * Could you get some Acks. At least from Laurent?
> > > 
> > > Sure, let's give reviewers some more time :)
> > 
> > Indeed.
> > 
> > Laurent, if there are patches ready for me to take into the renesas tree
> > please let me know. I'm reluctant to add any more pinmux changes for 3.9.
> > But if a topic branch would help let me know.
> 
> I'd like the gpio_request_one() patches to go to v3.9 if possible. The other 
> pinctrl patches will need to wait until v3.10 I'm afraid.

Understood. I have now queued the gpio_request_one() patches up for v3.9.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-07-08 10:49           ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-08 10:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jason

Sorry for resuming an old thread, but I'd like to get this solved 
eventually.

On Fri, 25 Jan 2013, Jason Gunthorpe wrote:

> On Fri, Jan 25, 2013 at 11:34:55AM +0100, Guennadi Liakhovetski wrote:
> 
> > > Is there no need to reset the phy at runtime ?
> > 
> > No idea, I'm not developing the driver, I'm just porting one specific 
> > feature from one API to another with no functional changes (apart from 
> > postponing setting the GPIO).
> 
> Generally Linux relies on resetting the phy via the inband MDIO method,
> which is what Linux does. It is pretty much never required to reset
> via the hard pin - but you do need to generate a robust reset edge on
> the reset pin once after power up.

This all sounds good. So, is there a preferred way to do that? Where in 
the ethernet framework would you propose to hook up such a reset edge 
generation?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-07-08 10:49           ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-08 10:49 UTC (permalink / raw)
  To: Jason Gunthorpe
  Cc: linux-sh-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ, Magnus Damm,
	Simon Horman, Laurent Pinchart,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

Hi Jason

Sorry for resuming an old thread, but I'd like to get this solved 
eventually.

On Fri, 25 Jan 2013, Jason Gunthorpe wrote:

> On Fri, Jan 25, 2013 at 11:34:55AM +0100, Guennadi Liakhovetski wrote:
> 
> > > Is there no need to reset the phy at runtime ?
> > 
> > No idea, I'm not developing the driver, I'm just porting one specific 
> > feature from one API to another with no functional changes (apart from 
> > postponing setting the GPIO).
> 
> Generally Linux relies on resetting the phy via the inband MDIO method,
> which is what Linux does. It is pretty much never required to reset
> via the hard pin - but you do need to generate a robust reset edge on
> the reset pin once after power up.

This all sounds good. So, is there a preferred way to do that? Where in 
the ethernet framework would you propose to hook up such a reset edge 
generation?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth
@ 2013-07-08 10:49           ` Guennadi Liakhovetski
  0 siblings, 0 replies; 36+ messages in thread
From: Guennadi Liakhovetski @ 2013-07-08 10:49 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Jason

Sorry for resuming an old thread, but I'd like to get this solved 
eventually.

On Fri, 25 Jan 2013, Jason Gunthorpe wrote:

> On Fri, Jan 25, 2013 at 11:34:55AM +0100, Guennadi Liakhovetski wrote:
> 
> > > Is there no need to reset the phy at runtime ?
> > 
> > No idea, I'm not developing the driver, I'm just porting one specific 
> > feature from one API to another with no functional changes (apart from 
> > postponing setting the GPIO).
> 
> Generally Linux relies on resetting the phy via the inband MDIO method,
> which is what Linux does. It is pretty much never required to reset
> via the hard pin - but you do need to generate a robust reset edge on
> the reset pin once after power up.

This all sounds good. So, is there a preferred way to do that? Where in 
the ethernet framework would you propose to hook up such a reset edge 
generation?

Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2013-07-08 10:49 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-24 16:07 [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva Guennadi Liakhovetski
2013-01-24 16:07 ` Guennadi Liakhovetski
2013-01-24 16:07 ` [PATCH 1/3] pinctrl: add ethernet pin groups to r8a7740 Guennadi Liakhovetski
2013-01-24 16:07   ` Guennadi Liakhovetski
2013-01-25 10:15   ` Laurent Pinchart
2013-01-25 10:15     ` Laurent Pinchart
2013-01-24 16:07 ` [PATCH/RFC 2/3] ethernet: add a PHY reset GPIO DT binding to sh_eth Guennadi Liakhovetski
2013-01-24 16:07   ` Guennadi Liakhovetski
2013-01-24 16:07   ` Guennadi Liakhovetski
2013-01-25 10:21   ` Laurent Pinchart
2013-01-25 10:21     ` Laurent Pinchart
2013-01-25 10:21     ` Laurent Pinchart
2013-01-25 10:34     ` Guennadi Liakhovetski
2013-01-25 10:34       ` Guennadi Liakhovetski
2013-01-25 10:34       ` Guennadi Liakhovetski
2013-01-25 18:21       ` Jason Gunthorpe
2013-01-25 18:21         ` Jason Gunthorpe
2013-01-25 18:21         ` Jason Gunthorpe
2013-07-08 10:49         ` Guennadi Liakhovetski
2013-07-08 10:49           ` Guennadi Liakhovetski
2013-07-08 10:49           ` Guennadi Liakhovetski
2013-01-26  1:04       ` Laurent Pinchart
2013-01-26  1:04         ` Laurent Pinchart
2013-01-26  1:04         ` Laurent Pinchart
2013-01-24 16:07 ` [PATCH 3/3] ARM: shmobile: move pin configuration on armadillo800eva-reference to DT Guennadi Liakhovetski
2013-01-24 16:07   ` Guennadi Liakhovetski
2013-01-25  4:37 ` [PATCH 0/3] ARM: shmobile: sh-eth pins in DT for armadillo800eva Simon Horman
2013-01-25  4:37   ` Simon Horman
2013-01-25  8:09   ` Guennadi Liakhovetski
2013-01-25  8:09     ` Guennadi Liakhovetski
2013-01-25  9:05     ` Simon Horman
2013-01-25  9:05       ` Simon Horman
2013-01-25  9:57       ` Laurent Pinchart
2013-01-25  9:57         ` Laurent Pinchart
2013-01-28  1:02         ` Simon Horman
2013-01-28  1:02           ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.