netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] SH: fix platform Ether support
@ 2013-08-17 22:13 Sergei Shtylyov
  2013-08-17 22:15 ` [PATCH 1/2] SH7619: fix " Sergei Shtylyov
  2013-08-17 22:19 ` [PATCH 2/2] SolutionEngine7724: " Sergei Shtylyov
  0 siblings, 2 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-08-17 22:13 UTC (permalink / raw)
  To: netdev, lethal, linux-sh, davem

Hello.

   [Resending with correct David's email.]

   Here's a couple of patches fixing Ether support on some SH platforms.
They are against David Miller's 'net.git' (and also apply to 'net-next.git)
since they are prerequisite for the 'sh_eth' driver cleanup patchset that will
be posted a bit later. David, can I ask you to push these patches thru your
tree for that reason?

[1/2] SH7619: fix Ether support
[2/2] SolutionEngine7724: fix Ether support

WBR, Sergei

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

* [PATCH 1/2] SH7619: fix Ether support
  2013-08-17 22:13 [PATCH 0/2] SH: fix platform Ether support Sergei Shtylyov
@ 2013-08-17 22:15 ` Sergei Shtylyov
  2013-08-21  0:05   ` David Miller
  2013-08-21 14:20   ` Sergei Shtylyov
  2013-08-17 22:19 ` [PATCH 2/2] SolutionEngine7724: " Sergei Shtylyov
  1 sibling, 2 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-08-17 22:15 UTC (permalink / raw)
  To: netdev; +Cc: lethal, linux-sh, davem

The 'sh_eth' driver's probe will crash as the platform code is hopelessly behind
the platform data -- it passes PHY ID instead of 'struct sh_eth_plat_data *'.
Strangely, both commit d88a3ea6fa4c (SH7619 add ethernet controler support) that
added the platform code and commit 71557a37adb5 ([netdrvr] sh_eth: Add  SH7619
support)  were done  in about  the same time, yet the latter one added 'struct
sh_eth_plat_data' and the platform code didn't ever get updated...

Add the proper platform data and fix off-by-one memory resource end error, while
at it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: stable@vger.kernel.org

---
 arch/sh/kernel/cpu/sh2/setup-sh7619.c |   12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

Index: net/arch/sh/kernel/cpu/sh2/setup-sh7619.c
===================================================================
--- net.orig/arch/sh/kernel/cpu/sh2/setup-sh7619.c
+++ net/arch/sh/kernel/cpu/sh2/setup-sh7619.c
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/serial.h>
 #include <linux/serial_sci.h>
+#include <linux/sh_eth.h>
 #include <linux/sh_timer.h>
 #include <linux/io.h>
 
@@ -110,10 +111,17 @@ static struct platform_device scif2_devi
 	},
 };
 
+static struct sh_eth_plat_data eth_platform_data = {
+	.phy		= 1,
+	.edmac_endian	= EDMAC_LITTLE_ENDIAN,
+	.register_type	= SH_ETH_REG_FAST_SH3_SH2,
+	.phy_interace	= PHY_INTERFACE_MODE_MII,
+};
+
 static struct resource eth_resources[] = {
 	[0] = {
 		.start = 0xfb000000,
-		.end =   0xfb0001c8,
+		.end = 0xfb0001c7,
 		.flags = IORESOURCE_MEM,
 	},
 	[1] = {
@@ -127,7 +135,7 @@ static struct platform_device eth_device
 	.name = "sh7619-ether",
 	.id = -1,
 	.dev = {
-		.platform_data = (void *)1,
+		.platform_data = &eth_platform_data,
 	},
 	.num_resources = ARRAY_SIZE(eth_resources),
 	.resource = eth_resources,

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

* [PATCH 2/2] SolutionEngine7724: fix Ether support
  2013-08-17 22:13 [PATCH 0/2] SH: fix platform Ether support Sergei Shtylyov
  2013-08-17 22:15 ` [PATCH 1/2] SH7619: fix " Sergei Shtylyov
@ 2013-08-17 22:19 ` Sergei Shtylyov
  2013-08-21  0:05   ` David Miller
  2013-08-21 18:58   ` Sergei Shtylyov
  1 sibling, 2 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-08-17 22:19 UTC (permalink / raw)
  To: netdev, lethal, linux-sh, davem

The Ether platform data is behind the declaration of 'struct sh_eth_plat_data'
as it's lacking the initializers for the 'register_type' and 'phy_interface'
fields -- it means they'll be implicitly and wrongly set to SH_ETH_REG_GIGABIT
and PHY_INTERFACE_MODE_NA. Initialize the fields explicitly and fix off-by-one
error in the Ether memory resource end, while at it...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Cc: stable@vger.kernel.org

---
 arch/sh/boards/mach-se/7724/setup.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Index: net/arch/sh/boards/mach-se/7724/setup.c
===================================================================
--- net.orig/arch/sh/boards/mach-se/7724/setup.c
+++ net/arch/sh/boards/mach-se/7724/setup.c
@@ -365,7 +365,7 @@ static struct platform_device keysc_devi
 static struct resource sh_eth_resources[] = {
 	[0] = {
 		.start = SH_ETH_ADDR,
-		.end   = SH_ETH_ADDR + 0x1FC,
+		.end   = SH_ETH_ADDR + 0x1FC - 1,
 		.flags = IORESOURCE_MEM,
 	},
 	[1] = {
@@ -377,6 +377,8 @@ static struct resource sh_eth_resources[
 static struct sh_eth_plat_data sh_eth_plat = {
 	.phy = 0x1f, /* SMSC LAN8187 */
 	.edmac_endian = EDMAC_LITTLE_ENDIAN,
+	.register_type = SH_ETH_REG_FAST_SH4,
+	.phy_interace = PHY_INTERFACE_MODE_MII,
 };
 
 static struct platform_device sh_eth_device = {

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

* Re: [PATCH 1/2] SH7619: fix Ether support
  2013-08-17 22:15 ` [PATCH 1/2] SH7619: fix " Sergei Shtylyov
@ 2013-08-21  0:05   ` David Miller
  2013-08-21 14:20   ` Sergei Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2013-08-21  0:05 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: netdev, lethal, linux-sh

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sun, 18 Aug 2013 02:15:42 +0400

> The 'sh_eth' driver's probe will crash as the platform code is hopelessly behind
> the platform data -- it passes PHY ID instead of 'struct sh_eth_plat_data *'.
> Strangely, both commit d88a3ea6fa4c (SH7619 add ethernet controler support) that
> added the platform code and commit 71557a37adb5 ([netdrvr] sh_eth: Add  SH7619
> support)  were done  in about  the same time, yet the latter one added 'struct
> sh_eth_plat_data' and the platform code didn't ever get updated...
> 
> Add the proper platform data and fix off-by-one memory resource end error, while
> at it...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Applied.

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

* Re: [PATCH 2/2] SolutionEngine7724: fix Ether support
  2013-08-17 22:19 ` [PATCH 2/2] SolutionEngine7724: " Sergei Shtylyov
@ 2013-08-21  0:05   ` David Miller
  2013-08-21 18:58   ` Sergei Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: David Miller @ 2013-08-21  0:05 UTC (permalink / raw)
  To: sergei.shtylyov; +Cc: netdev, lethal, linux-sh

From: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date: Sun, 18 Aug 2013 02:19:09 +0400

> The Ether platform data is behind the declaration of 'struct sh_eth_plat_data'
> as it's lacking the initializers for the 'register_type' and 'phy_interface'
> fields -- it means they'll be implicitly and wrongly set to SH_ETH_REG_GIGABIT
> and PHY_INTERFACE_MODE_NA. Initialize the fields explicitly and fix off-by-one
> error in the Ether memory resource end, while at it...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Applied.

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

* Re: [PATCH 1/2] SH7619: fix Ether support
  2013-08-17 22:15 ` [PATCH 1/2] SH7619: fix " Sergei Shtylyov
  2013-08-21  0:05   ` David Miller
@ 2013-08-21 14:20   ` Sergei Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-08-21 14:20 UTC (permalink / raw)
  To: netdev; +Cc: lethal, linux-sh, davem

Hello.

On 18-08-2013 2:15, Sergei Shtylyov wrote:

> The 'sh_eth' driver's probe will crash as the platform code is hopelessly behind
> the platform data -- it passes PHY ID instead of 'struct sh_eth_plat_data *'.
> Strangely, both commit d88a3ea6fa4c (SH7619 add ethernet controler support) that
> added the platform code and commit 71557a37adb5 ([netdrvr] sh_eth: Add  SH7619
> support)  were done  in about  the same time, yet the latter one added 'struct
> sh_eth_plat_data' and the platform code didn't ever get updated...
>
> Add the proper platform data and fix off-by-one memory resource end error, while
> at it...

> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Cc: stable@vger.kernel.org

> ---
>   arch/sh/kernel/cpu/sh2/setup-sh7619.c |   12 ++++++++++--
>   1 file changed, 10 insertions(+), 2 deletions(-)

> Index: net/arch/sh/kernel/cpu/sh2/setup-sh7619.c
> ===================================================================
> --- net.orig/arch/sh/kernel/cpu/sh2/setup-sh7619.c
> +++ net/arch/sh/kernel/cpu/sh2/setup-sh7619.c
[...]
> @@ -110,10 +111,17 @@ static struct platform_device scif2_devi
>   	},
>   };
>
> +static struct sh_eth_plat_data eth_platform_data = {
> +	.phy		= 1,
> +	.edmac_endian	= EDMAC_LITTLE_ENDIAN,
> +	.register_type	= SH_ETH_REG_FAST_SH3_SH2,
> +	.phy_interace	= PHY_INTERFACE_MODE_MII,

    Grr, I forgot to compile test this patch as the kbuild test robot just 
told me... s/phy_interace/phy_interface/. I'll send a fix today.

WBR, Sergei


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

* Re: [PATCH 2/2] SolutionEngine7724: fix Ether support
  2013-08-17 22:19 ` [PATCH 2/2] SolutionEngine7724: " Sergei Shtylyov
  2013-08-21  0:05   ` David Miller
@ 2013-08-21 18:58   ` Sergei Shtylyov
  1 sibling, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-08-21 18:58 UTC (permalink / raw)
  To: netdev, lethal, linux-sh, davem

Hello.

On 08/18/2013 02:19 AM, Sergei Shtylyov wrote:

> The Ether platform data is behind the declaration of 'struct sh_eth_plat_data'
> as it's lacking the initializers for the 'register_type' and 'phy_interface'
> fields -- it means they'll be implicitly and wrongly set to SH_ETH_REG_GIGABIT
> and PHY_INTERFACE_MODE_NA. Initialize the fields explicitly and fix off-by-one
> error in the Ether memory resource end, while at it...

> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Cc: stable@vger.kernel.org

> ---
>   arch/sh/boards/mach-se/7724/setup.c |    4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)

> Index: net/arch/sh/boards/mach-se/7724/setup.c
> ===================================================================
> --- net.orig/arch/sh/boards/mach-se/7724/setup.c
> +++ net/arch/sh/boards/mach-se/7724/setup.c
[...]
> @@ -377,6 +377,8 @@ static struct resource sh_eth_resources[
>   static struct sh_eth_plat_data sh_eth_plat = {
>   	.phy = 0x1f, /* SMSC LAN8187 */
>   	.edmac_endian = EDMAC_LITTLE_ENDIAN,
> +	.register_type = SH_ETH_REG_FAST_SH4,
> +	.phy_interace = PHY_INTERFACE_MODE_MII,

     Darn, "interace" here too, this time spotted by myself. Obviously, I did 
copy&paste the same mistake.

WBR, Sergei

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

end of thread, other threads:[~2013-08-21 18:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-17 22:13 [PATCH 0/2] SH: fix platform Ether support Sergei Shtylyov
2013-08-17 22:15 ` [PATCH 1/2] SH7619: fix " Sergei Shtylyov
2013-08-21  0:05   ` David Miller
2013-08-21 14:20   ` Sergei Shtylyov
2013-08-17 22:19 ` [PATCH 2/2] SolutionEngine7724: " Sergei Shtylyov
2013-08-21  0:05   ` David Miller
2013-08-21 18:58   ` Sergei Shtylyov

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