netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR
@ 2013-04-18 10:11 Nobuhiro Iwamatsu
  2013-04-18 10:11 ` [PATCH v2 2/8] net: sh-eth: Set EDSR_ENALL instead of 0x03 is set to EDSR Nobuhiro Iwamatsu
                   ` (7 more replies)
  0 siblings, 8 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.h |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 6f9a997..f86ea96 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -166,19 +166,16 @@ enum {
 /*
  * Register's bits
  */
-#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) ||\
-    defined(CONFIG_ARCH_R8A7740)
-/* EDSR */
+/* EDSR : sh7734, sh7764, sh7757 and r8a7740 only */
 enum EDSR_BIT {
 	EDSR_ENT = 0x01, EDSR_ENR = 0x02,
 };
 #define EDSR_ENALL (EDSR_ENT|EDSR_ENR)
 
-/* GECMR */
+/* GECMR : sh7734, sh7764 and r8a7740 only */
 enum GECMR_BIT {
 	GECMR_10 = 0x0, GECMR_100 = 0x04, GECMR_1000 = 0x01,
 };
-#endif
 
 /* EDMR */
 enum DMAC_M_BIT {
-- 
1.7.10.4

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

* [PATCH v2 2/8] net: sh-eth: Set EDSR_ENALL instead of 0x03 is set to EDSR
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 10:11 ` [PATCH v2 3/8] net: sh-eth: Remove duplicate sh_eth_set_duplex() Nobuhiro Iwamatsu
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index d9458ae..313d6ef 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -523,7 +523,7 @@ static int sh_eth_reset(struct net_device *ndev)
 	int ret = 0;
 
 	if (sh_eth_is_gether(mdp)) {
-		sh_eth_write(ndev, 0x03, EDSR);
+		sh_eth_write(ndev, EDSR_ENALL, EDSR);
 		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER,
 				EDMR);
 
-- 
1.7.10.4

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

* [PATCH v2 3/8] net: sh-eth: Remove duplicate sh_eth_set_duplex()
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
  2013-04-18 10:11 ` [PATCH v2 2/8] net: sh-eth: Set EDSR_ENALL instead of 0x03 is set to EDSR Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 10:11 ` [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead Nobuhiro Iwamatsu
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.c |   65 ++++++---------------------------
 1 file changed, 12 insertions(+), 53 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 313d6ef..5c4e82c 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -341,9 +341,11 @@ static void sh_eth_select_mii(struct net_device *ndev)
 }
 #endif
 
-/* There is CPU dependent code */
-#if defined(CONFIG_ARCH_R8A7779)
-#define SH_ETH_RESET_DEFAULT	1
+#if defined(CONFIG_CPU_SUBTYPE_SH7619) || \
+	defined(CONFIG_CPU_SUBTYPE_SH7710) || \
+	defined(CONFIG_CPU_SUBTYPE_SH7712)
+#  define sh_eth_set_duplex NULL
+#else
 static void sh_eth_set_duplex(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -353,7 +355,11 @@ static void sh_eth_set_duplex(struct net_device *ndev)
 	else		/* Half */
 		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
 }
+#endif
 
+/* There is CPU dependent code */
+#if defined(CONFIG_ARCH_R8A7779)
+#define SH_ETH_RESET_DEFAULT	1
 static void sh_eth_set_rate(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -391,15 +397,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 };
 #elif defined(CONFIG_CPU_SUBTYPE_SH7724)
 #define SH_ETH_RESET_DEFAULT	1
-static void sh_eth_set_duplex(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-
-	if (mdp->duplex) /* Full */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR);
-	else		/* Half */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
-}
 
 static void sh_eth_set_rate(struct net_device *ndev)
 {
@@ -443,16 +440,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 #define SH_ETH_HAS_TSU	1
 static int sh_eth_check_reset(struct net_device *ndev);
 
-static void sh_eth_set_duplex(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-
-	if (mdp->duplex) /* Full */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR);
-	else		/* Half */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
-}
-
 static void sh_eth_set_rate(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -552,16 +539,6 @@ out:
 	return ret;
 }
 
-static void sh_eth_set_duplex_giga(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-
-	if (mdp->duplex) /* Full */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR);
-	else		/* Half */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
-}
-
 static void sh_eth_set_rate_giga(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -584,7 +561,7 @@ static void sh_eth_set_rate_giga(struct net_device *ndev)
 /* SH7757(GETHERC) */
 static struct sh_eth_cpu_data sh_eth_my_cpu_data_giga = {
 	.chip_reset	= sh_eth_chip_reset_giga,
-	.set_duplex	= sh_eth_set_duplex_giga,
+	.set_duplex	= sh_eth_set_duplex,
 	.set_rate	= sh_eth_set_rate_giga,
 
 	.ecsr_value	= ECSR_ICD | ECSR_MPD,
@@ -635,16 +612,6 @@ static void sh_eth_chip_reset(struct net_device *ndev)
 	mdelay(1);
 }
 
-static void sh_eth_set_duplex(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-
-	if (mdp->duplex) /* Full */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR);
-	else		/* Half */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
-}
-
 static void sh_eth_set_rate(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -774,16 +741,6 @@ out:
 	return ret;
 }
 
-static void sh_eth_set_duplex(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-
-	if (mdp->duplex) /* Full */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) | ECMR_DM, ECMR);
-	else		/* Half */
-		sh_eth_write(ndev, sh_eth_read(ndev, ECMR) & ~ECMR_DM, ECMR);
-}
-
 static void sh_eth_set_rate(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -834,6 +791,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 #elif defined(CONFIG_CPU_SUBTYPE_SH7619)
 #define SH_ETH_RESET_DEFAULT	1
 static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
+	.set_duplex = sh_eth_set_duplex,
 	.eesipr_value	= DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
 
 	.apr		= 1,
@@ -845,6 +803,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 #define SH_ETH_RESET_DEFAULT	1
 #define SH_ETH_HAS_TSU	1
 static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
+	.set_duplex = sh_eth_set_duplex,
 	.eesipr_value	= DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
 	.tsu		= 1,
 	.tsu_multi_reg	= 1,
-- 
1.7.10.4

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

* [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
  2013-04-18 10:11 ` [PATCH v2 2/8] net: sh-eth: Set EDSR_ENALL instead of 0x03 is set to EDSR Nobuhiro Iwamatsu
  2013-04-18 10:11 ` [PATCH v2 3/8] net: sh-eth: Remove duplicate sh_eth_set_duplex() Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 14:40   ` Sergei Shtylyov
  2013-04-18 10:11 ` [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops Nobuhiro Iwamatsu
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.c |   22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 5c4e82c..7de0b0e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -437,7 +437,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 };
 #elif defined(CONFIG_CPU_SUBTYPE_SH7757)
 #define SH_ETH_HAS_BOTH_MODULES	1
-#define SH_ETH_HAS_TSU	1
 static int sh_eth_check_reset(struct net_device *ndev);
 
 static void sh_eth_set_rate(struct net_device *ndev)
@@ -599,7 +598,6 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
 }
 
 #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
-#define SH_ETH_HAS_TSU	1
 static int sh_eth_check_reset(struct net_device *ndev);
 static void sh_eth_reset_hw_crc(struct net_device *ndev);
 
@@ -702,7 +700,6 @@ static void sh_eth_reset_hw_crc(struct net_device *ndev)
 }
 
 #elif defined(CONFIG_ARCH_R8A7740)
-#define SH_ETH_HAS_TSU	1
 static int sh_eth_check_reset(struct net_device *ndev);
 
 static void sh_eth_chip_reset(struct net_device *ndev)
@@ -801,7 +798,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 };
 #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
 #define SH_ETH_RESET_DEFAULT	1
-#define SH_ETH_HAS_TSU	1
 static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.set_duplex = sh_eth_set_duplex,
 	.eesipr_value	= DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -2117,7 +2113,6 @@ static int sh_eth_do_ioctl(struct net_device *ndev, struct ifreq *rq,
 	return phy_mii_ioctl(phydev, rq, cmd);
 }
 
-#if defined(SH_ETH_HAS_TSU)
 /* For TSU_POSTn. Please refer to the manual about this (strange) bitfields */
 static void *sh_eth_tsu_get_post_reg_offset(struct sh_eth_private *mdp,
 					    int entry)
@@ -2458,7 +2453,6 @@ static int sh_eth_vlan_rx_kill_vid(struct net_device *ndev, u16 vid)
 
 	return 0;
 }
-#endif /* SH_ETH_HAS_TSU */
 
 /* SuperH's TSU register init function */
 static void sh_eth_tsu_init(struct sh_eth_private *mdp)
@@ -2597,16 +2591,11 @@ static const u16 *sh_eth_get_register_offset(int register_type)
 	return reg_offset;
 }
 
-static const struct net_device_ops sh_eth_netdev_ops = {
+static struct net_device_ops sh_eth_netdev_ops = {
 	.ndo_open		= sh_eth_open,
 	.ndo_stop		= sh_eth_close,
 	.ndo_start_xmit		= sh_eth_start_xmit,
 	.ndo_get_stats		= sh_eth_get_stats,
-#if defined(SH_ETH_HAS_TSU)
-	.ndo_set_rx_mode	= sh_eth_set_multicast_list,
-	.ndo_vlan_rx_add_vid	= sh_eth_vlan_rx_add_vid,
-	.ndo_vlan_rx_kill_vid	= sh_eth_vlan_rx_kill_vid,
-#endif
 	.ndo_tx_timeout		= sh_eth_tx_timeout,
 	.ndo_do_ioctl		= sh_eth_do_ioctl,
 	.ndo_validate_addr	= eth_validate_addr,
@@ -2687,6 +2676,15 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	sh_eth_set_default_cpu_data(mdp->cd);
 
 	/* set function */
+	if (mdp->cd->tsu) {
+		sh_eth_netdev_ops.ndo_set_rx_mode
+			= sh_eth_set_multicast_list;
+		sh_eth_netdev_ops.ndo_vlan_rx_add_vid
+			= sh_eth_vlan_rx_add_vid;
+		sh_eth_netdev_ops.ndo_vlan_rx_kill_vid
+			= sh_eth_vlan_rx_kill_vid;
+	}
+
 	ndev->netdev_ops = &sh_eth_netdev_ops;
 	SET_ETHTOOL_OPS(ndev, &sh_eth_ethtool_ops);
 	ndev->watchdog_timeo = TX_TIMEOUT;
-- 
1.7.10.4

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

* [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
                   ` (2 preceding siblings ...)
  2013-04-18 10:11 ` [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 14:53   ` Sergei Shtylyov
  2013-04-18 10:11 ` [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data Nobuhiro Iwamatsu
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 7de0b0e..af8c225 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2772,6 +2772,7 @@ static int sh_eth_drv_remove(struct platform_device *pdev)
 	return 0;
 }
 
+#ifdef CONFIG_PM
 static int sh_eth_runtime_nop(struct device *dev)
 {
 	/*
@@ -2785,17 +2786,21 @@ static int sh_eth_runtime_nop(struct device *dev)
 	return 0;
 }
 
-static struct dev_pm_ops sh_eth_dev_pm_ops = {
+static const struct dev_pm_ops sh_eth_dev_pm_ops = {
 	.runtime_suspend = sh_eth_runtime_nop,
 	.runtime_resume = sh_eth_runtime_nop,
 };
+#define SH_ETH_PM_OPS &sh_eth_dev_pm_ops
+#else
+#define SH_ETH_PM_OPS NULL
+#endif
 
 static struct platform_driver sh_eth_driver = {
 	.probe = sh_eth_drv_probe,
 	.remove = sh_eth_drv_remove,
 	.driver = {
 		   .name = CARDNAME,
-		   .pm = &sh_eth_dev_pm_ops,
+		   .pm = SH_ETH_PM_OPS,
 	},
 };
 
-- 
1.7.10.4

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

* [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
                   ` (3 preceding siblings ...)
  2013-04-18 10:11 ` [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 14:57   ` Sergei Shtylyov
  2013-04-18 10:11 ` [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii Nobuhiro Iwamatsu
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

sh-eth is supporting some SH and shmobile CPU. CPU with two or more networked
devices is in these, these specify IRQF_SHARED as IRQ configureation flags.
This changes to set IRQ configureation flags using in sh_eth_cpu_data.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.c |   12 ++++--------
 drivers/net/ethernet/renesas/sh_eth.h |    2 ++
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index af8c225..a4e337f 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -468,6 +468,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 			  EESR_RFRMER | EESR_TFE | EESR_TDE | EESR_ECI,
 	.tx_error_check	= EESR_TWB | EESR_TABT | EESR_TDE | EESR_TFE,
 
+	.irq_flags	= IRQF_SHARED,
 	.apr		= 1,
 	.mpr		= 1,
 	.tpauser	= 1,
@@ -576,6 +577,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data_giga = {
 	.fdr_value	= 0x0000072f,
 	.rmcr_value	= 0x00000001,
 
+	.irq_flags	= IRQF_SHARED,
 	.apr		= 1,
 	.mpr		= 1,
 	.tpauser	= 1,
@@ -658,6 +660,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.hw_crc     = 1,
 	.select_mii = 1,
 #else
+	.irq_flags	= IRQF_SHARED,
 	.tsu_multi_reg	= 1,
 #endif
 };
@@ -1920,14 +1923,7 @@ static int sh_eth_open(struct net_device *ndev)
 	pm_runtime_get_sync(&mdp->pdev->dev);
 
 	ret = request_irq(ndev->irq, sh_eth_interrupt,
-#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \
-	defined(CONFIG_CPU_SUBTYPE_SH7764) || \
-	defined(CONFIG_CPU_SUBTYPE_SH7757)
-				IRQF_SHARED,
-#else
-				0,
-#endif
-				ndev->name, ndev);
+				mdp->cd->irq_flags, ndev->name, ndev);
 	if (ret) {
 		dev_err(&ndev->dev, "Can not assign IRQ number\n");
 		return ret;
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index f86ea96..0772ec1 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -463,6 +463,7 @@ struct sh_eth_cpu_data {
 	unsigned long tx_error_check;
 
 	/* hardware features */
+	unsigned long irq_flags; /* IRQ configuration flags */
 	unsigned no_psr:1;		/* EtherC DO NOT have PSR */
 	unsigned apr:1;			/* EtherC have APR */
 	unsigned mpr:1;			/* EtherC have MPR */
@@ -508,6 +509,7 @@ struct sh_eth_private {
 	int duplex;
 	int port;		/* for TSU */
 	int vlan_num_ids;	/* for VLAN tag filter */
+	unsigned long irq_flags; /* IRQ configuration flags */
 
 	unsigned no_ether_link:1;
 	unsigned ether_link_active_low:1;
-- 
1.7.10.4

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

* [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
                   ` (4 preceding siblings ...)
  2013-04-18 10:11 ` [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 14:36   ` Sergei Shtylyov
  2013-04-18 10:11 ` [PATCH v2 8/8] net: sh-eth: Rewrite sh_eth_reset function Nobuhiro Iwamatsu
  2013-04-18 14:50 ` [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Sergei Shtylyov
  7 siblings, 1 reply; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: no change.

 drivers/net/ethernet/renesas/sh_eth.c |    4 ----
 1 file changed, 4 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index a4e337f..eb428d4 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -313,9 +313,6 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
 	[TSU_ADRL31]	= 0x01fc,
 };
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7734) || \
-	defined(CONFIG_CPU_SUBTYPE_SH7763) || \
-	defined(CONFIG_ARCH_R8A7740)
 static void sh_eth_select_mii(struct net_device *ndev)
 {
 	u32 value = 0x0;
@@ -339,7 +336,6 @@ static void sh_eth_select_mii(struct net_device *ndev)
 
 	sh_eth_write(ndev, value, RMII_MII);
 }
-#endif
 
 #if defined(CONFIG_CPU_SUBTYPE_SH7619) || \
 	defined(CONFIG_CPU_SUBTYPE_SH7710) || \
-- 
1.7.10.4

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

* [PATCH v2 8/8] net: sh-eth: Rewrite sh_eth_reset function
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
                   ` (5 preceding siblings ...)
  2013-04-18 10:11 ` [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii Nobuhiro Iwamatsu
@ 2013-04-18 10:11 ` Nobuhiro Iwamatsu
  2013-04-18 14:50 ` [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Sergei Shtylyov
  7 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-04-18 10:11 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, Nobuhiro Iwamatsu

This driver has sh_eth_reset function each CPU.
And this function is almost the same. This is summarized in
single function.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
 v2: Remove unnecessary comment correction.

 drivers/net/ethernet/renesas/sh_eth.c |  194 +++++++++++----------------------
 1 file changed, 61 insertions(+), 133 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index eb428d4..d097525 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -355,7 +355,6 @@ static void sh_eth_set_duplex(struct net_device *ndev)
 
 /* There is CPU dependent code */
 #if defined(CONFIG_ARCH_R8A7779)
-#define SH_ETH_RESET_DEFAULT	1
 static void sh_eth_set_rate(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -392,7 +391,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.hw_swap	= 1,
 };
 #elif defined(CONFIG_CPU_SUBTYPE_SH7724)
-#define SH_ETH_RESET_DEFAULT	1
 
 static void sh_eth_set_rate(struct net_device *ndev)
 {
@@ -433,7 +431,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 };
 #elif defined(CONFIG_CPU_SUBTYPE_SH7757)
 #define SH_ETH_HAS_BOTH_MODULES	1
-static int sh_eth_check_reset(struct net_device *ndev);
 
 static void sh_eth_set_rate(struct net_device *ndev)
 {
@@ -500,40 +497,6 @@ static void sh_eth_chip_reset_giga(struct net_device *ndev)
 }
 
 static int sh_eth_is_gether(struct sh_eth_private *mdp);
-static int sh_eth_reset(struct net_device *ndev)
-{
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-	int ret = 0;
-
-	if (sh_eth_is_gether(mdp)) {
-		sh_eth_write(ndev, EDSR_ENALL, EDSR);
-		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER,
-				EDMR);
-
-		ret = sh_eth_check_reset(ndev);
-		if (ret)
-			goto out;
-
-		/* Table Init */
-		sh_eth_write(ndev, 0x0, TDLAR);
-		sh_eth_write(ndev, 0x0, TDFAR);
-		sh_eth_write(ndev, 0x0, TDFXR);
-		sh_eth_write(ndev, 0x0, TDFFR);
-		sh_eth_write(ndev, 0x0, RDLAR);
-		sh_eth_write(ndev, 0x0, RDFAR);
-		sh_eth_write(ndev, 0x0, RDFXR);
-		sh_eth_write(ndev, 0x0, RDFFR);
-	} else {
-		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_ETHER,
-				EDMR);
-		mdelay(3);
-		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) & ~EDMR_SRST_ETHER,
-				EDMR);
-	}
-
-out:
-	return ret;
-}
 
 static void sh_eth_set_rate_giga(struct net_device *ndev)
 {
@@ -596,8 +559,6 @@ static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
 }
 
 #elif defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763)
-static int sh_eth_check_reset(struct net_device *ndev);
-static void sh_eth_reset_hw_crc(struct net_device *ndev);
 
 static void sh_eth_chip_reset(struct net_device *ndev)
 {
@@ -661,45 +622,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 #endif
 };
 
-static int sh_eth_reset(struct net_device *ndev)
-{
-	int ret = 0;
-
-	sh_eth_write(ndev, EDSR_ENALL, EDSR);
-	sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR);
-
-	ret = sh_eth_check_reset(ndev);
-	if (ret)
-		goto out;
-
-	/* Table Init */
-	sh_eth_write(ndev, 0x0, TDLAR);
-	sh_eth_write(ndev, 0x0, TDFAR);
-	sh_eth_write(ndev, 0x0, TDFXR);
-	sh_eth_write(ndev, 0x0, TDFFR);
-	sh_eth_write(ndev, 0x0, RDLAR);
-	sh_eth_write(ndev, 0x0, RDFAR);
-	sh_eth_write(ndev, 0x0, RDFXR);
-	sh_eth_write(ndev, 0x0, RDFFR);
-
-	/* Reset HW CRC register */
-	sh_eth_reset_hw_crc(ndev);
-
-	/* Select MII mode */
-	if (sh_eth_my_cpu_data.select_mii)
-		sh_eth_select_mii(ndev);
-out:
-	return ret;
-}
-
-static void sh_eth_reset_hw_crc(struct net_device *ndev)
-{
-	if (sh_eth_my_cpu_data.hw_crc)
-		sh_eth_write(ndev, 0x0, CSMR);
-}
 
 #elif defined(CONFIG_ARCH_R8A7740)
-static int sh_eth_check_reset(struct net_device *ndev);
 
 static void sh_eth_chip_reset(struct net_device *ndev)
 {
@@ -712,31 +636,6 @@ static void sh_eth_chip_reset(struct net_device *ndev)
 	sh_eth_select_mii(ndev);
 }
 
-static int sh_eth_reset(struct net_device *ndev)
-{
-	int ret = 0;
-
-	sh_eth_write(ndev, EDSR_ENALL, EDSR);
-	sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER, EDMR);
-
-	ret = sh_eth_check_reset(ndev);
-	if (ret)
-		goto out;
-
-	/* Table Init */
-	sh_eth_write(ndev, 0x0, TDLAR);
-	sh_eth_write(ndev, 0x0, TDFAR);
-	sh_eth_write(ndev, 0x0, TDFXR);
-	sh_eth_write(ndev, 0x0, TDFFR);
-	sh_eth_write(ndev, 0x0, RDLAR);
-	sh_eth_write(ndev, 0x0, RDFAR);
-	sh_eth_write(ndev, 0x0, RDFXR);
-	sh_eth_write(ndev, 0x0, RDFFR);
-
-out:
-	return ret;
-}
-
 static void sh_eth_set_rate(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -785,7 +684,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 };
 
 #elif defined(CONFIG_CPU_SUBTYPE_SH7619)
-#define SH_ETH_RESET_DEFAULT	1
 static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.set_duplex = sh_eth_set_duplex,
 	.eesipr_value	= DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -796,7 +694,6 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.hw_swap	= 1,
 };
 #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
-#define SH_ETH_RESET_DEFAULT	1
 static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.set_duplex = sh_eth_set_duplex,
 	.eesipr_value	= DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
@@ -833,36 +730,6 @@ static void sh_eth_set_default_cpu_data(struct sh_eth_cpu_data *cd)
 		cd->tx_error_check = DEFAULT_TX_ERROR_CHECK;
 }
 
-#if defined(SH_ETH_RESET_DEFAULT)
-/* Chip Reset */
-static int  sh_eth_reset(struct net_device *ndev)
-{
-	sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_ETHER, EDMR);
-	mdelay(3);
-	sh_eth_write(ndev, sh_eth_read(ndev, EDMR) & ~EDMR_SRST_ETHER, EDMR);
-
-	return 0;
-}
-#else
-static int sh_eth_check_reset(struct net_device *ndev)
-{
-	int ret = 0;
-	int cnt = 100;
-
-	while (cnt > 0) {
-		if (!(sh_eth_read(ndev, EDMR) & 0x3))
-			break;
-		mdelay(1);
-		cnt--;
-	}
-	if (cnt < 0) {
-		pr_err("Device reset fail\n");
-		ret = -ETIMEDOUT;
-	}
-	return ret;
-}
-#endif
-
 #if defined(CONFIG_CPU_SH4) || defined(CONFIG_ARCH_SHMOBILE)
 static void sh_eth_set_receive_align(struct sk_buff *skb)
 {
@@ -953,6 +820,67 @@ static unsigned long sh_eth_get_edtrr_trns(struct sh_eth_private *mdp)
 		return EDTRR_TRNS_ETHER;
 }
 
+static int sh_eth_check_reset(struct net_device *ndev)
+{
+	int ret = 0;
+	int cnt = 100;
+
+	while (cnt > 0) {
+		if (!(sh_eth_read(ndev, EDMR) & 0x3))
+			break;
+		mdelay(1);
+		cnt--;
+	}
+	if (cnt < 0) {
+		pr_err("Device reset fail\n");
+		ret = -ETIMEDOUT;
+	}
+	return ret;
+}
+
+static int sh_eth_reset(struct net_device *ndev)
+{
+	struct sh_eth_private *mdp = netdev_priv(ndev);
+	int ret = 0;
+
+	if (sh_eth_is_gether(mdp)) {
+		sh_eth_write(ndev, EDSR_ENALL, EDSR);
+		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_GETHER,
+				EDMR);
+
+		ret = sh_eth_check_reset(ndev);
+		if (ret)
+			goto out;
+
+		/* Table Init */
+		sh_eth_write(ndev, 0x0, TDLAR);
+		sh_eth_write(ndev, 0x0, TDFAR);
+		sh_eth_write(ndev, 0x0, TDFXR);
+		sh_eth_write(ndev, 0x0, TDFFR);
+		sh_eth_write(ndev, 0x0, RDLAR);
+		sh_eth_write(ndev, 0x0, RDFAR);
+		sh_eth_write(ndev, 0x0, RDFXR);
+		sh_eth_write(ndev, 0x0, RDFFR);
+
+		/* Reset HW CRC register */
+		if (mdp->cd->hw_crc)
+			sh_eth_write(ndev, 0x0, CSMR);
+
+		/* Select MII mode */
+		if (mdp->cd->select_mii)
+			sh_eth_select_mii(ndev);
+	} else {
+		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) | EDMR_SRST_ETHER,
+				EDMR);
+		mdelay(3);
+		sh_eth_write(ndev, sh_eth_read(ndev, EDMR) & ~EDMR_SRST_ETHER,
+				EDMR);
+	}
+
+out:
+	return ret;
+}
+
 struct bb_info {
 	void (*set_gate)(void *addr);
 	struct mdiobb_ctrl ctrl;
-- 
1.7.10.4

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

* Re: [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii
  2013-04-18 10:11 ` [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii Nobuhiro Iwamatsu
@ 2013-04-18 14:36   ` Sergei Shtylyov
  2013-05-07  5:00     ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 18+ messages in thread
From: Sergei Shtylyov @ 2013-04-18 14:36 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

Hello.

On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:

> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

    That's what I was going to do first.

>   drivers/net/ethernet/renesas/sh_eth.c |    4 ----
>   1 file changed, 4 deletions(-)

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index a4e337f..eb428d4 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -313,9 +313,6 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
>   	[TSU_ADRL31]	= 0x01fc,
>   };
>
> -#if defined(CONFIG_CPU_SUBTYPE_SH7734) || \
> -	defined(CONFIG_CPU_SUBTYPE_SH7763) || \
> -	defined(CONFIG_ARCH_R8A7740)
>   static void sh_eth_select_mii(struct net_device *ndev)

    Don't you want to annotate the function with __maybe_unused?

WBR, Sergei

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

* Re: [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead
  2013-04-18 10:11 ` [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead Nobuhiro Iwamatsu
@ 2013-04-18 14:40   ` Sergei Shtylyov
  2013-05-07  2:57     ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 18+ messages in thread
From: Sergei Shtylyov @ 2013-04-18 14:40 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:

> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> ---
[...]

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 5c4e82c..7de0b0e 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
[...]
> @@ -2597,16 +2591,11 @@ static const u16 *sh_eth_get_register_offset(int register_type)
>   	return reg_offset;
>   }
>
> -static const struct net_device_ops sh_eth_netdev_ops = {
> +static struct net_device_ops sh_eth_netdev_ops = {
>   	.ndo_open		= sh_eth_open,
>   	.ndo_stop		= sh_eth_close,
>   	.ndo_start_xmit		= sh_eth_start_xmit,
>   	.ndo_get_stats		= sh_eth_get_stats,
> -#if defined(SH_ETH_HAS_TSU)
> -	.ndo_set_rx_mode	= sh_eth_set_multicast_list,
> -	.ndo_vlan_rx_add_vid	= sh_eth_vlan_rx_add_vid,
> -	.ndo_vlan_rx_kill_vid	= sh_eth_vlan_rx_kill_vid,
> -#endif
>   	.ndo_tx_timeout		= sh_eth_tx_timeout,
>   	.ndo_do_ioctl		= sh_eth_do_ioctl,
>   	.ndo_validate_addr	= eth_validate_addr,
> @@ -2687,6 +2676,15 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>   	sh_eth_set_default_cpu_data(mdp->cd);
>
>   	/* set function */
> +	if (mdp->cd->tsu) {
> +		sh_eth_netdev_ops.ndo_set_rx_mode
> +			= sh_eth_set_multicast_list;
> +		sh_eth_netdev_ops.ndo_vlan_rx_add_vid
> +			= sh_eth_vlan_rx_add_vid;
> +		sh_eth_netdev_ops.ndo_vlan_rx_kill_vid
> +			= sh_eth_vlan_rx_kill_vid;
> +	}
> +

    What if there's multiple Ether devices, only one of which has TSU? Or that 
never happens?

WBR, Sergei

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

* Re: [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR
  2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
                   ` (6 preceding siblings ...)
  2013-04-18 10:11 ` [PATCH v2 8/8] net: sh-eth: Rewrite sh_eth_reset function Nobuhiro Iwamatsu
@ 2013-04-18 14:50 ` Sergei Shtylyov
  2013-05-07  2:57   ` Nobuhiro Iwamatsu
  7 siblings, 1 reply; 18+ messages in thread
From: Sergei Shtylyov @ 2013-04-18 14:50 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:

> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>

    Step in the right direction.

> diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
> index 6f9a997..f86ea96 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.h
> +++ b/drivers/net/ethernet/renesas/sh_eth.h
> @@ -166,19 +166,16 @@ enum {
>   /*
>    * Register's bits
>    */
> -#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) ||\
> -    defined(CONFIG_ARCH_R8A7740)
> -/* EDSR */
> +/* EDSR : sh7734, sh7764, sh7757 and r8a7740 only */

    Where sh7764 and sh7757 came from?

>   enum EDSR_BIT {
>   	EDSR_ENT = 0x01, EDSR_ENR = 0x02,
>   };
>   #define EDSR_ENALL (EDSR_ENT|EDSR_ENR)
>
> -/* GECMR */
> +/* GECMR : sh7734, sh7764 and r8a7740 only */

    Where sh7764 came from?

>   enum GECMR_BIT {
>   	GECMR_10 = 0x0, GECMR_100 = 0x04, GECMR_1000 = 0x01,
>   };
> -#endif

WBR, Sergei

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

* Re: [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops
  2013-04-18 10:11 ` [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops Nobuhiro Iwamatsu
@ 2013-04-18 14:53   ` Sergei Shtylyov
  2013-05-07  2:57     ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 18+ messages in thread
From: Sergei Shtylyov @ 2013-04-18 14:53 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:

> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
[...]

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 7de0b0e..af8c225 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
[...]
> @@ -2785,17 +2786,21 @@ static int sh_eth_runtime_nop(struct device *dev)
>   	return 0;
>   }
>
> -static struct dev_pm_ops sh_eth_dev_pm_ops = {
> +static const struct dev_pm_ops sh_eth_dev_pm_ops = {
>   	.runtime_suspend = sh_eth_runtime_nop,
>   	.runtime_resume = sh_eth_runtime_nop,
>   };
> +#define SH_ETH_PM_OPS &sh_eth_dev_pm_ops

    scripts/checkpatch.pl would complain here about missing (), I heard.
Did you run it?

WBR, Sergei

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

* Re: [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data
  2013-04-18 10:11 ` [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data Nobuhiro Iwamatsu
@ 2013-04-18 14:57   ` Sergei Shtylyov
  2013-05-07  2:57     ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 18+ messages in thread
From: Sergei Shtylyov @ 2013-04-18 14:57 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

Hello.

On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:

> sh-eth is supporting some SH and shmobile CPU. CPU with two or more networked
> devices is in these, these specify IRQF_SHARED as IRQ configureation flags.
> This changes to set IRQ configureation flags using in sh_eth_cpu_data.

> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
[...]

> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index af8c225..a4e337f 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
[...]
> @@ -1920,14 +1923,7 @@ static int sh_eth_open(struct net_device *ndev)
>   	pm_runtime_get_sync(&mdp->pdev->dev);
>
>   	ret = request_irq(ndev->irq, sh_eth_interrupt,
> -#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \
> -	defined(CONFIG_CPU_SUBTYPE_SH7764) || \
> -	defined(CONFIG_CPU_SUBTYPE_SH7757)
> -				IRQF_SHARED,
> -#else
> -				0,
> -#endif

    Isn't it simpler to always pass IRQF_SHARED?

> -				ndev->name, ndev);
> +				mdp->cd->irq_flags, ndev->name, ndev);
>   	if (ret) {
>   		dev_err(&ndev->dev, "Can not assign IRQ number\n");
>   		return ret;
> diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
> index f86ea96..0772ec1 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.h
> +++ b/drivers/net/ethernet/renesas/sh_eth.h
> @@ -463,6 +463,7 @@ struct sh_eth_cpu_data {
>   	unsigned long tx_error_check;
>
>   	/* hardware features */
> +	unsigned long irq_flags; /* IRQ configuration flags */

    Comment should have been indented with tabs like the others.

>   	unsigned no_psr:1;		/* EtherC DO NOT have PSR */
>   	unsigned apr:1;			/* EtherC have APR */
>   	unsigned mpr:1;			/* EtherC have MPR */
> @@ -508,6 +509,7 @@ struct sh_eth_private {
>   	int duplex;
>   	int port;		/* for TSU */
>   	int vlan_num_ids;	/* for VLAN tag filter */
> +	unsigned long irq_flags; /* IRQ configuration flags */

    You don't seem to use this...

WBR, Sergei

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

* Re: [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data
  2013-04-18 14:57   ` Sergei Shtylyov
@ 2013-05-07  2:57     ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-05-07  2:57 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, yoshihiro.shimoda.uh

Hi,

(2013/04/18 23:57), Sergei Shtylyov wrote:
> Hello.
>
> On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:
>
>> sh-eth is supporting some SH and shmobile CPU. CPU with two or more networked
>> devices is in these, these specify IRQF_SHARED as IRQ configureation flags.
>> This changes to set IRQ configureation flags using in sh_eth_cpu_data.
>
>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> [...]
>
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
>> index af8c225..a4e337f 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> [...]
>> @@ -1920,14 +1923,7 @@ static int sh_eth_open(struct net_device *ndev)
>> pm_runtime_get_sync(&mdp->pdev->dev);
>>
>> ret = request_irq(ndev->irq, sh_eth_interrupt,
>> -#if defined(CONFIG_CPU_SUBTYPE_SH7763) || \
>> - defined(CONFIG_CPU_SUBTYPE_SH7764) || \
>> - defined(CONFIG_CPU_SUBTYPE_SH7757)
>> - IRQF_SHARED,
>> -#else
>> - 0,
>> -#endif
>
> Isn't it simpler to always pass IRQF_SHARED?
>

I think there is a mechanism to separate the setting par CPU,
split is good.

>> - ndev->name, ndev);
>> + mdp->cd->irq_flags, ndev->name, ndev);
>> if (ret) {
>> dev_err(&ndev->dev, "Can not assign IRQ number\n");
>> return ret;
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
>> index f86ea96..0772ec1 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.h
>> +++ b/drivers/net/ethernet/renesas/sh_eth.h
>> @@ -463,6 +463,7 @@ struct sh_eth_cpu_data {
>> unsigned long tx_error_check;
>>
>> /* hardware features */
>> + unsigned long irq_flags; /* IRQ configuration flags */
>
> Comment should have been indented with tabs like the others.
>

OK, I will fix.

>> unsigned no_psr:1; /* EtherC DO NOT have PSR */
>> unsigned apr:1; /* EtherC have APR */
>> unsigned mpr:1; /* EtherC have MPR */
>> @@ -508,6 +509,7 @@ struct sh_eth_private {
>> int duplex;
>> int port; /* for TSU */
>> int vlan_num_ids; /* for VLAN tag filter */
>> + unsigned long irq_flags; /* IRQ configuration flags */
>
> You don't seem to use this...

Oh, I will remove. thank you.

Best regards,
   Nobuhiro

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

* Re: [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR
  2013-04-18 14:50 ` [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Sergei Shtylyov
@ 2013-05-07  2:57   ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-05-07  2:57 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, yoshihiro.shimoda.uh

Hi,

(2013/04/18 23:50), Sergei Shtylyov wrote:
> On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:
>
>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
>
> Step in the right direction.
>
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
>> index 6f9a997..f86ea96 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.h
>> +++ b/drivers/net/ethernet/renesas/sh_eth.h
>> @@ -166,19 +166,16 @@ enum {
>> /*
>> * Register's bits
>> */
>> -#if defined(CONFIG_CPU_SUBTYPE_SH7734) || defined(CONFIG_CPU_SUBTYPE_SH7763) ||\
>> - defined(CONFIG_ARCH_R8A7740)
>> -/* EDSR */
>> +/* EDSR : sh7734, sh7764, sh7757 and r8a7740 only */
>
> Where sh7764 and sh7757 came from?

sh7764 is wrong. I will fix to sh7763.
sh7757 has this register. I will split to other patch about this.

>
>> enum EDSR_BIT {
>> EDSR_ENT = 0x01, EDSR_ENR = 0x02,
>> };
>> #define EDSR_ENALL (EDSR_ENT|EDSR_ENR)
>>
>> -/* GECMR */
>> +/* GECMR : sh7734, sh7764 and r8a7740 only */
>
> Where sh7764 came from?

This is same too. thanks.

>
>> enum GECMR_BIT {
>> GECMR_10 = 0x0, GECMR_100 = 0x04, GECMR_1000 = 0x01,
>> };
>> -#endif
>
> WBR, Sergei
>

Best regards,
   Nobuhiro

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

* Re: [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead
  2013-04-18 14:40   ` Sergei Shtylyov
@ 2013-05-07  2:57     ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-05-07  2:57 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, yoshihiro.shimoda.uh

Hi,

(2013/04/18 23:40), Sergei Shtylyov wrote:
> On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:
>
>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
>> ---
> [...]
>
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
>> index 5c4e82c..7de0b0e 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> [...]
>> @@ -2597,16 +2591,11 @@ static const u16 *sh_eth_get_register_offset(int register_type)
>> return reg_offset;
>> }
>>
>> -static const struct net_device_ops sh_eth_netdev_ops = {
>> +static struct net_device_ops sh_eth_netdev_ops = {
>> .ndo_open = sh_eth_open,
>> .ndo_stop = sh_eth_close,
>> .ndo_start_xmit = sh_eth_start_xmit,
>> .ndo_get_stats = sh_eth_get_stats,
>> -#if defined(SH_ETH_HAS_TSU)
>> - .ndo_set_rx_mode = sh_eth_set_multicast_list,
>> - .ndo_vlan_rx_add_vid = sh_eth_vlan_rx_add_vid,
>> - .ndo_vlan_rx_kill_vid = sh_eth_vlan_rx_kill_vid,
>> -#endif
>> .ndo_tx_timeout = sh_eth_tx_timeout,
>> .ndo_do_ioctl = sh_eth_do_ioctl,
>> .ndo_validate_addr = eth_validate_addr,
>> @@ -2687,6 +2676,15 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>> sh_eth_set_default_cpu_data(mdp->cd);
>>
>> /* set function */
>> + if (mdp->cd->tsu) {
>> + sh_eth_netdev_ops.ndo_set_rx_mode
>> + = sh_eth_set_multicast_list;
>> + sh_eth_netdev_ops.ndo_vlan_rx_add_vid
>> + = sh_eth_vlan_rx_add_vid;
>> + sh_eth_netdev_ops.ndo_vlan_rx_kill_vid
>> + = sh_eth_vlan_rx_kill_vid;
>> + }
>> +
>
> What if there's multiple Ether devices, only one of which has TSU? Or that never happens?
>

Now, the device with TSU has TSU matually.
I think that it is no problem now.
Althought it is also considered that only one of the two will have
TSU in the future, I don't think that it is necessary to correspond
now since there is no device.

Of cource, I think that the coreesponding good.

Best regards,
   Nobuhiro

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

* Re: [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops
  2013-04-18 14:53   ` Sergei Shtylyov
@ 2013-05-07  2:57     ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-05-07  2:57 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, yoshihiro.shimoda.uh

Hi,

(2013/04/18 23:53), Sergei Shtylyov wrote:
> On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:
>
>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> [...]
>
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
>> index 7de0b0e..af8c225 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> [...]
>> @@ -2785,17 +2786,21 @@ static int sh_eth_runtime_nop(struct device *dev)
>> return 0;
>> }
>>
>> -static struct dev_pm_ops sh_eth_dev_pm_ops = {
>> +static const struct dev_pm_ops sh_eth_dev_pm_ops = {
>> .runtime_suspend = sh_eth_runtime_nop,
>> .runtime_resume = sh_eth_runtime_nop,
>> };
>> +#define SH_ETH_PM_OPS &sh_eth_dev_pm_ops
>
> scripts/checkpatch.pl would complain here about missing (), I heard.
> Did you run it?

thanks, it had missed, although I was running.
I will fix this.

Best regards,
   Nobuhiro

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

* Re: [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii
  2013-04-18 14:36   ` Sergei Shtylyov
@ 2013-05-07  5:00     ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 18+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-05-07  5:00 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, yoshihiro.shimoda.uh

Hi,

(2013/04/18 23:36), Sergei Shtylyov wrote:
> Hello.
>
> On 18-04-2013 14:11, Nobuhiro Iwamatsu wrote:
>
>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
>
> That's what I was going to do first.
>
>> drivers/net/ethernet/renesas/sh_eth.c | 4 ----
>> 1 file changed, 4 deletions(-)
>
>> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
>> index a4e337f..eb428d4 100644
>> --- a/drivers/net/ethernet/renesas/sh_eth.c
>> +++ b/drivers/net/ethernet/renesas/sh_eth.c
>> @@ -313,9 +313,6 @@ static const u16 sh_eth_offset_fast_sh3_sh2[SH_ETH_MAX_REGISTER_OFFSET] = {
>> [TSU_ADRL31] = 0x01fc,
>> };
>>
>> -#if defined(CONFIG_CPU_SUBTYPE_SH7734) || \
>> - defined(CONFIG_CPU_SUBTYPE_SH7763) || \
>> - defined(CONFIG_ARCH_R8A7740)
>> static void sh_eth_select_mii(struct net_device *ndev)
>
> Don't you want to annotate the function with __maybe_unused?
>
I see.
I will add __maybe_unused. thanks!

Best regards,
   Nobuhiro

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

end of thread, other threads:[~2013-05-07  5:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-18 10:11 [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 2/8] net: sh-eth: Set EDSR_ENALL instead of 0x03 is set to EDSR Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 3/8] net: sh-eth: Remove duplicate sh_eth_set_duplex() Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 4/8] net: sh-eth: Remove SH_ETH_HAS_TSU and use tsu of sh_eth_cpu_data instead Nobuhiro Iwamatsu
2013-04-18 14:40   ` Sergei Shtylyov
2013-05-07  2:57     ` Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 5/8] net: sh-eth: Add CONFIG_PM to definition of dev_pm_ops Nobuhiro Iwamatsu
2013-04-18 14:53   ` Sergei Shtylyov
2013-05-07  2:57     ` Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 6/8] net: sh-eth: Add irq configureation flags in sh_eth_cpu_data Nobuhiro Iwamatsu
2013-04-18 14:57   ` Sergei Shtylyov
2013-05-07  2:57     ` Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 7/8] net: sh-eth: Remove ifdef for sh_eth_select_mii Nobuhiro Iwamatsu
2013-04-18 14:36   ` Sergei Shtylyov
2013-05-07  5:00     ` Nobuhiro Iwamatsu
2013-04-18 10:11 ` [PATCH v2 8/8] net: sh-eth: Rewrite sh_eth_reset function Nobuhiro Iwamatsu
2013-04-18 14:50 ` [PATCH v2 1/8] net: sh-eth: Remove ifdef from definition of bit of EDSR and GECMR Sergei Shtylyov
2013-05-07  2:57   ` Nobuhiro Iwamatsu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).