diff mbox

ARM: shmobile: set proper DMA masks for Ether devices

Message ID 201402120255.25037.sergei.shtylyov@cogentembedded.com (mailing list archive)
State Changes Requested
Headers show

Commit Message

Sergei Shtylyov Feb. 11, 2014, 11:55 p.m. UTC
Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA addressing
ability.  Currently, the code works without DMA masks but in the future, when
support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the 'sh_eth' driver,
the DMA masks should start to matter...

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
The patch is against 'renesas-devel-v3.14-rc1-20140207' tag in Simon Horman's
'renesas.git' repo... 

 arch/arm/mach-shmobile/board-armadillo800eva.c |    2 ++
 arch/arm/mach-shmobile/board-bockw.c           |   21 ++++++++++++++-------
 arch/arm/mach-shmobile/board-genmai.c          |   19 ++++++++++++++-----
 arch/arm/mach-shmobile/board-koelsch.c         |   16 ++++++++++++----
 arch/arm/mach-shmobile/board-lager.c           |   19 ++++++++++++++-----
 5 files changed, 56 insertions(+), 21 deletions(-)

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

Comments

Simon Horman Feb. 12, 2014, 1:35 a.m. UTC | #1
On Wed, Feb 12, 2014 at 02:55:24AM +0300, Sergei Shtylyov wrote:
> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA addressing
> ability.  Currently, the code works without DMA masks but in the future, when
> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the 'sh_eth' driver,
> the DMA masks should start to matter...
> 
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Hi Sergei,

please split this series up so there is a separate patch for each board.

Thanks

> 
> ---
> The patch is against 'renesas-devel-v3.14-rc1-20140207' tag in Simon Horman's
> 'renesas.git' repo... 
> 
>  arch/arm/mach-shmobile/board-armadillo800eva.c |    2 ++
>  arch/arm/mach-shmobile/board-bockw.c           |   21 ++++++++++++++-------
>  arch/arm/mach-shmobile/board-genmai.c          |   19 ++++++++++++++-----
>  arch/arm/mach-shmobile/board-koelsch.c         |   16 ++++++++++++----
>  arch/arm/mach-shmobile/board-lager.c           |   19 ++++++++++++++-----
>  5 files changed, 56 insertions(+), 21 deletions(-)
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sergei Shtylyov Feb. 12, 2014, 11:32 a.m. UTC | #2
Hello.

On 12-02-2014 5:35, Simon Horman wrote:

>> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
>> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA addressing
>> ability.  Currently, the code works without DMA masks but in the future, when
>> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the 'sh_eth' driver,
>> the DMA masks should start to matter...

>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

> Hi Sergei,

> please split this series up so there is a separate patch for each board.

    Hm, I, contrariwise, gathered all board patches in the single patch. Could 
you elaborate on why you deem it necessary to split it?

> Thanks

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Dooks Feb. 12, 2014, 11:49 a.m. UTC | #3
On 11/02/14 23:55, Sergei Shtylyov wrote:
> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA addressing
> ability.  Currently, the code works without DMA masks but in the future, when
> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the 'sh_eth' driver,
> the DMA masks should start to matter...
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

Hi, do you have a git branch available with all the changes for getting
ethernet working on rcar please?
Sergei Shtylyov Feb. 12, 2014, 1:25 p.m. UTC | #4
Hello.

On 12-02-2014 15:49, Ben Dooks wrote:

>> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
>> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA addressing
>> ability.  Currently, the code works without DMA masks but in the future, when
>> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the 'sh_eth' driver,
>> the DMA masks should start to matter...

>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

> Hi, do you have a git branch available with all the changes for getting
> ethernet working on rcar please?

    Depends on whether you want it working via DT or mere platform devices. If 
the second, it's 3.14-rc1. If DT, I don't have a branch, only several patches 
to apply atop of the current 'renesas.git' repo's 'devel' branch that I've 
posted last week (note that only R8A779x is currently supported by these 
patches and NFS boot timeout is still an issue with them).

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Dooks Feb. 12, 2014, 2:28 p.m. UTC | #5
On 12/02/14 13:25, Sergei Shtylyov wrote:
> Hello.
>
> On 12-02-2014 15:49, Ben Dooks wrote:
>
>>> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
>>> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA
>>> addressing
>>> ability.  Currently, the code works without DMA masks but in the
>>> future, when
>>> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the
>>> 'sh_eth' driver,
>>> the DMA masks should start to matter...
>
>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
>> Hi, do you have a git branch available with all the changes for getting
>> ethernet working on rcar please?
>
>     Depends on whether you want it working via DT or mere platform
> devices. If the second, it's 3.14-rc1. If DT, I don't have a branch,
> only several patches to apply atop of the current 'renesas.git' repo's
> 'devel' branch that I've posted last week (note that only R8A779x is
> currently supported by these patches and NFS boot timeout is still an
> issue with them).

ok, I have a slightly earlier version which seems to work with nfs
boot for me.
Sergei Shtylyov Feb. 12, 2014, 2:58 p.m. UTC | #6
Hello.

On 12-02-2014 18:28, Ben Dooks wrote:

>>>> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
>>>> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA
>>>> addressing
>>>> ability.  Currently, the code works without DMA masks but in the
>>>> future, when
>>>> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the
>>>> 'sh_eth' driver,
>>>> the DMA masks should start to matter...

>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

>>> Hi, do you have a git branch available with all the changes for getting
>>> ethernet working on rcar please?

>>     Depends on whether you want it working via DT or mere platform
>> devices. If the second, it's 3.14-rc1. If DT, I don't have a branch,
>> only several patches to apply atop of the current 'renesas.git' repo's
>> 'devel' branch that I've posted last week (note that only R8A779x is
>> currently supported by these patches and NFS boot timeout is still an
>> issue with them).

> ok, I have a slightly earlier version which seems to work with nfs
> boot for me.

    There's no "slightly earlier version" (unless you mean DT support for 
BOCK-W posted months ago). Issue with NFS is not fatal, it boots fine, just 
somewhat slow.

WBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Ben Dooks Feb. 12, 2014, 3:11 p.m. UTC | #7
On 12/02/14 14:58, Sergei Shtylyov wrote:
> Hello.
>
> On 12-02-2014 18:28, Ben Dooks wrote:
>
>>>>> Ether MAC is a DMA-capable device and so should have 'dev.dma_mask'
>>>>> and
>>>>> 'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA
>>>>> addressing
>>>>> ability.  Currently, the code works without DMA masks but in the
>>>>> future, when
>>>>> support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the
>>>>> 'sh_eth' driver,
>>>>> the DMA masks should start to matter...
>
>>>>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
>>>> Hi, do you have a git branch available with all the changes for getting
>>>> ethernet working on rcar please?
>
>>>     Depends on whether you want it working via DT or mere platform
>>> devices. If the second, it's 3.14-rc1. If DT, I don't have a branch,
>>> only several patches to apply atop of the current 'renesas.git' repo's
>>> 'devel' branch that I've posted last week (note that only R8A779x is
>>> currently supported by these patches and NFS boot timeout is still an
>>> issue with them).
>
>> ok, I have a slightly earlier version which seems to work with nfs
>> boot for me.
>
>     There's no "slightly earlier version" (unless you mean DT support
> for BOCK-W posted months ago). Issue with NFS is not fatal, it boots
> fine, just somewhat slow.

I think actually the version we have in our tree may be an rework
of that. It is a while since we looked at it.

My aim is to rebuild on the newer release and use that going forward
as we are trying to stick as close as possible to the mainline.
Simon Horman Feb. 12, 2014, 11:45 p.m. UTC | #8
On Wed, Feb 12, 2014 at 03:32:32PM +0400, Sergei Shtylyov wrote:
> Hello.
> 
> On 12-02-2014 5:35, Simon Horman wrote:
> 
> >>Ether MAC is a DMA-capable device and so should have 'dev.dma_mask' and
> >>'dev.coherent_dma_mask' fields set properly, to reflect 32-bit DMA addressing
> >>ability.  Currently, the code works without DMA masks but in the future, when
> >>support for NETIF_F_HIGHDMA & NETIF_F_SG would be added to the 'sh_eth' driver,
> >>the DMA masks should start to matter...
> 
> >>Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> 
> >Hi Sergei,
> 
> >please split this series up so there is a separate patch for each board.
> 
>    Hm, I, contrariwise, gathered all board patches in the single
> patch. Could you elaborate on why you deem it necessary to split it?

In my experience it helps to have the patches split out for two reasons:
1. If there is a problem on one board its patch can be reverted without
   having to bother with making a partial revert in order to leave the
   other boards alone.
2. It makes backporting easier in the case where there is interest in
   one board but not another.

Moreover, the boards are separate entities and in general I would
like their patches to be separate. The same goes for SoCs.

I realise this is more fine-grained than what other maintainers prefer
but it is an approach that seems to work well for us.
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

Index: renesas/arch/arm/mach-shmobile/board-armadillo800eva.c
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/board-armadillo800eva.c
+++ renesas/arch/arm/mach-shmobile/board-armadillo800eva.c
@@ -383,6 +383,8 @@  static struct platform_device sh_eth_dev
 	.id = -1,
 	.dev = {
 		.platform_data = &sh_eth_platdata,
+		.dma_mask = &sh_eth_device.dev.coherent_dma_mask,
+		.coherent_dma_mask = DMA_BIT_MASK(32),
 	},
 	.resource = sh_eth_resources,
 	.num_resources = ARRAY_SIZE(sh_eth_resources),
Index: renesas/arch/arm/mach-shmobile/board-bockw.c
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/board-bockw.c
+++ renesas/arch/arm/mach-shmobile/board-bockw.c
@@ -1,9 +1,9 @@ 
 /*
  * Bock-W board support
  *
- * Copyright (C) 2013  Renesas Solutions Corp.
+ * Copyright (C) 2013-2014  Renesas Solutions Corp.
  * Copyright (C) 2013  Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
- * Copyright (C) 2013  Cogent Embedded, Inc.
+ * Copyright (C) 2013-2014  Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -235,6 +235,17 @@  static struct sh_eth_plat_data ether_pla
 	.no_ether_link	= 1,
 };
 
+static struct platform_device_info ether_info __initdata = {
+	.parent		= &platform_bus,
+	.name		= "r8a777x-ether",
+	.id		= -1,
+	.res		= ether_resources,
+	.num_res	= ARRAY_SIZE(ether_resources),
+	.data		= &ether_platform_data,
+	.size_data	= sizeof(ether_platform_data),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
 /* I2C */
 static struct i2c_board_info i2c0_devices[] = {
 	{
@@ -592,11 +603,7 @@  static void __init bockw_init(void)
 	r8a7778_init_irq_extpin(1);
 	r8a7778_add_standard_devices();
 
-	platform_device_register_resndata(&platform_bus, "r8a777x-ether", -1,
-					  ether_resources,
-					  ARRAY_SIZE(ether_resources),
-					  &ether_platform_data,
-					  sizeof(ether_platform_data));
+	platform_device_register_full(&ether_info);
 
 	platform_device_register_full(&vin0_info);
 	/* VIN1 has a pin conflict with Ether */
Index: renesas/arch/arm/mach-shmobile/board-genmai.c
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/board-genmai.c
+++ renesas/arch/arm/mach-shmobile/board-genmai.c
@@ -1,8 +1,9 @@ 
 /*
  * Genmai board support
  *
- * Copyright (C) 2013  Renesas Solutions Corp.
+ * Copyright (C) 2013-2014  Renesas Solutions Corp.
  * Copyright (C) 2013  Magnus Damm
+ * Copyright (C) 2014  Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -43,6 +44,17 @@  static const struct resource ether_resou
 	DEFINE_RES_IRQ(gic_iid(359)),
 };
 
+static const struct platform_device_info ether_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "r7s72100-ether",
+	.id		= -1,
+	.res		= ether_resources,
+	.num_res	= ARRAY_SIZE(ether_resources),
+	.data		= &ether_pdata,
+	.size_data	= sizeof(ether_pdata),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
 /* RSPI */
 #define RSPI_RESOURCE(idx, baseaddr, irq)				\
 static const struct resource rspi##idx##_resources[] __initconst = {	\
@@ -82,10 +94,7 @@  static void __init genmai_add_standard_d
 	r7s72100_clock_init();
 	r7s72100_add_dt_devices();
 
-	platform_device_register_resndata(&platform_bus, "r7s72100-ether", -1,
-					  ether_resources,
-					  ARRAY_SIZE(ether_resources),
-					  &ether_pdata, sizeof(ether_pdata));
+	platform_device_register_full(&ether_info);
 
 	r7s72100_register_rspi(0);
 	r7s72100_register_rspi(1);
Index: renesas/arch/arm/mach-shmobile/board-koelsch.c
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/board-koelsch.c
+++ renesas/arch/arm/mach-shmobile/board-koelsch.c
@@ -109,6 +109,17 @@  static const struct resource ether_resou
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+static const struct platform_device_info ether_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "r8a7791-ether",
+	.id		= -1,
+	.res		= ether_resources,
+	.num_res	= ARRAY_SIZE(ether_resources),
+	.data		= &ether_pdata,
+	.size_data	= sizeof(ether_pdata),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
 /* LEDS */
 static struct gpio_led koelsch_leds[] = {
 	{
@@ -297,10 +308,7 @@  static void __init koelsch_add_standard_
 				  ARRAY_SIZE(koelsch_pinctrl_map));
 	r8a7791_pinmux_init();
 	r8a7791_add_standard_devices();
-	platform_device_register_resndata(&platform_bus, "r8a7791-ether", -1,
-					  ether_resources,
-					  ARRAY_SIZE(ether_resources),
-					  &ether_pdata, sizeof(ether_pdata));
+	platform_device_register_full(&ether_info);
 	platform_device_register_data(&platform_bus, "leds-gpio", -1,
 				      &koelsch_leds_pdata,
 				      sizeof(koelsch_leds_pdata));
Index: renesas/arch/arm/mach-shmobile/board-lager.c
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/board-lager.c
+++ renesas/arch/arm/mach-shmobile/board-lager.c
@@ -1,8 +1,9 @@ 
 /*
  * Lager board support
  *
- * Copyright (C) 2013  Renesas Solutions Corp.
+ * Copyright (C) 2013-2014  Renesas Solutions Corp.
  * Copyright (C) 2013  Magnus Damm
+ * Copyright (C) 2014  Cogent Embedded, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -260,6 +261,17 @@  static const struct resource ether_resou
 	DEFINE_RES_IRQ(gic_spi(162)),
 };
 
+static const struct platform_device_info ether_info __initconst = {
+	.parent		= &platform_bus,
+	.name		= "r8a7790-ether",
+	.id		= -1,
+	.res		= ether_resources,
+	.num_res	= ARRAY_SIZE(ether_resources),
+	.data		= &ether_pdata,
+	.size_data	= sizeof(ether_pdata),
+	.dma_mask	= DMA_BIT_MASK(32),
+};
+
 /* SPI Flash memory (Spansion S25FL512SAGMFIG11 64Mb) */
 static struct mtd_partition spi_flash_part[] = {
 	/* Reserved for user loader program, read-only */
@@ -681,10 +693,7 @@  static void __init lager_add_standard_de
 					  mmcif1_resources, ARRAY_SIZE(mmcif1_resources),
 					  &mmcif1_pdata, sizeof(mmcif1_pdata));
 
-	platform_device_register_resndata(&platform_bus, "r8a7790-ether", -1,
-					  ether_resources,
-					  ARRAY_SIZE(ether_resources),
-					  &ether_pdata, sizeof(ether_pdata));
+	platform_device_register_full(&ether_info);
 
 	lager_add_du_device();