All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
@ 2013-05-07  5:08 Nobuhiro Iwamatsu
  2013-05-07 14:44 ` Sergei Shtylyov
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-05-07  5:08 UTC (permalink / raw)
  To: netdev; +Cc: yoshihiro.shimoda.uh, sergei.shtylyov, Nobuhiro Iwamatsu

Some sh-eth devices may have two ether devices inside.
And the function of TSU is accessed from each ether device.
In this case, sh-eth need to remap address using devm_ioremap(),
without using devm_ioremap_resource().
tsu_shared_reg of sh_eth_cpu_data is used for this control.

Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
---
V2:
  - Change variable name from tsu_multi_reg to tsu_shared_reg.
  - Update commit message.

 drivers/net/ethernet/renesas/sh_eth.c |   11 ++++++++++-
 drivers/net/ethernet/renesas/sh_eth.h |    1 +
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 33dc6f2..489be0e 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -610,6 +610,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data_giga = {
 	.no_trimd	= 1,
 	.no_ade		= 1,
 	.tsu		= 1,
+	.tsu_shared_reg	= 1,
 };
 
 static struct sh_eth_cpu_data *sh_eth_get_cpu_data(struct sh_eth_private *mdp)
@@ -691,6 +692,8 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 #if defined(CONFIG_CPU_SUBTYPE_SH7734)
 	.hw_crc     = 1,
 	.select_mii = 1,
+#else
+	.tsu_shared_reg	= 1,
 #endif
 };
 
@@ -844,6 +847,7 @@ static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 static struct sh_eth_cpu_data sh_eth_my_cpu_data = {
 	.eesipr_value	= DMAC_M_RFRMER | DMAC_M_ECI | 0x003fffff,
 	.tsu		= 1,
+	.tsu_shared_reg	= 1,
 };
 #endif
 
@@ -2750,7 +2754,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 			ret = -ENODEV;
 			goto out_release;
 		}
-		mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
+
+		if (mdp->cd->tsu_shared_reg)
+			mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,
+					resource_size(rtsu));
+		else
+			mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
 		if (IS_ERR(mdp->tsu_addr)) {
 			ret = PTR_ERR(mdp->tsu_addr);
 			goto out_release;
diff --git a/drivers/net/ethernet/renesas/sh_eth.h b/drivers/net/ethernet/renesas/sh_eth.h
index 1ddc9f2..26cb8a0 100644
--- a/drivers/net/ethernet/renesas/sh_eth.h
+++ b/drivers/net/ethernet/renesas/sh_eth.h
@@ -472,6 +472,7 @@ struct sh_eth_cpu_data {
 	unsigned tpauser:1;		/* EtherC have TPAUSER */
 	unsigned bculr:1;		/* EtherC have BCULR */
 	unsigned tsu:1;			/* EtherC have TSU */
+	unsigned tsu_shared_reg:1;	/* EtherC have TSU shared register */
 	unsigned hw_swap:1;		/* E-DMAC have DE bit in EDMR */
 	unsigned rpadir:1;		/* E-DMAC have RPADIR */
 	unsigned no_trimd:1;		/* E-DMAC DO NOT have TRIMD */
-- 
1.7.10.4

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

* Re: [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
  2013-05-07  5:08 [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register Nobuhiro Iwamatsu
@ 2013-05-07 14:44 ` Sergei Shtylyov
  2013-06-04 17:19   ` Sergei Shtylyov
  2013-06-03 22:07 ` Sergei Shtylyov
  2018-01-02 17:27 ` Sergei Shtylyov
  2 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2013-05-07 14:44 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

Hello.

    You shouldn't have posted this patch (and the subsequent series) 
during the merge window, as David will probably tell you.

On 07-05-2013 9:08, Nobuhiro Iwamatsu wrote:

> Some sh-eth devices may have two ether devices inside.

    You probably meant to say: "some SoCs may have two Ether devices 
inside".

> And the function of TSU is accessed from each ether device.
> In this case, sh-eth need to remap address using devm_ioremap(),
> without using devm_ioremap_resource().

    You could use devm_ioremap_resource() for the 1st Ether instance, 
and devm_ioremap() for the 2nd, couldn't you?

> tsu_shared_reg of sh_eth_cpu_data is used for this control.

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

WBR, Sergei

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

* Re: [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
  2013-05-07  5:08 [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register Nobuhiro Iwamatsu
  2013-05-07 14:44 ` Sergei Shtylyov
@ 2013-06-03 22:07 ` Sergei Shtylyov
  2013-06-05 14:21   ` Sergei Shtylyov
  2018-01-02 17:27 ` Sergei Shtylyov
  2 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2013-06-03 22:07 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

Hello.

On 05/07/2013 09:08 AM, Nobuhiro Iwamatsu wrote:

> Some sh-eth devices may have two ether devices inside.
> And the function of TSU is accessed from each ether device.
> In this case, sh-eth need to remap address using devm_ioremap(),
> without using devm_ioremap_resource().
> tsu_shared_reg of sh_eth_cpu_data is used for this control.
>
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
[...]

> @@ -2750,7 +2754,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>   			ret = -ENODEV;
>   			goto out_release;
>   		}

     This patch is not good anymore since in the meanwhile the above 
check got removed.
Iwamatsu-san, are you going to respin this patch and the next series of 
9 patches any time
soon. I need them to base my work on.

> -		mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
> +
> +		if (mdp->cd->tsu_shared_reg)
> +			mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,
> +					resource_size(rtsu));
> +		else
> +			mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
>

WBR, Sergei

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

* Re: [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
  2013-05-07 14:44 ` Sergei Shtylyov
@ 2013-06-04 17:19   ` Sergei Shtylyov
  2013-06-05  5:12     ` Nobuhiro Iwamatsu
  0 siblings, 1 reply; 7+ messages in thread
From: Sergei Shtylyov @ 2013-06-04 17:19 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

Hello.

On 05/07/2013 06:44 PM, I wrote:

>    You shouldn't have posted this patch (and the subsequent series) 
> during the merge window, as David will probably tell you.
>
> On 07-05-2013 9:08, Nobuhiro Iwamatsu wrote:
>
>> Some sh-eth devices may have two ether devices inside.
>
>    You probably meant to say: "some SoCs may have two Ether devices 
> inside".
>
>> And the function of TSU is accessed from each ether device.
>> In this case, sh-eth need to remap address using devm_ioremap(),
>> without using devm_ioremap_resource().
>
>    You could use devm_ioremap_resource() for the 1st Ether instance, 
> and devm_ioremap() for the 2nd, couldn't you?

     Wait, you can't have the same resource on both platform devices, 
that's a resource conflict.

>
>> tsu_shared_reg of sh_eth_cpu_data is used for this control.
>
>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
>

WBR, Sergei

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

* Re: [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
  2013-06-04 17:19   ` Sergei Shtylyov
@ 2013-06-05  5:12     ` Nobuhiro Iwamatsu
  0 siblings, 0 replies; 7+ messages in thread
From: Nobuhiro Iwamatsu @ 2013-06-05  5:12 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: netdev, yoshihiro.shimoda.uh

Hi,

(2013/06/05 2:19), Sergei Shtylyov wrote:
> Hello.
>
> On 05/07/2013 06:44 PM, I wrote:
>
>> You shouldn't have posted this patch (and the subsequent series) during the merge window, as David will probably tell you.
>>
>> On 07-05-2013 9:08, Nobuhiro Iwamatsu wrote:
>>
>>> Some sh-eth devices may have two ether devices inside.
>>
>> You probably meant to say: "some SoCs may have two Ether devices inside".
>>
>>> And the function of TSU is accessed from each ether device.
>>> In this case, sh-eth need to remap address using devm_ioremap(),
>>> without using devm_ioremap_resource().
>>
>> You could use devm_ioremap_resource() for the 1st Ether instance, and devm_ioremap() for the 2nd, couldn't you?
>

Yes, hmm. I will rewrite this patch.

> Wait, you can't have the same resource on both platform devices, that's a resource conflict.

yes, therefore, we are using lock in sh_eth_set_multicast_list function.

>
>>
>>> tsu_shared_reg of sh_eth_cpu_data is used for this control.
>>
>>> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
>>
>
> WBR, Sergei
>
>

Best regards,
   Nobuhiro

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

* Re: [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
  2013-06-03 22:07 ` Sergei Shtylyov
@ 2013-06-05 14:21   ` Sergei Shtylyov
  0 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2013-06-05 14:21 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu; +Cc: netdev, yoshihiro.shimoda.uh

Hello.

On 04-06-2013 2:07, Sergei Shtylyov wrote:

>> Some sh-eth devices may have two ether devices inside.
>> And the function of TSU is accessed from each ether device.
>> In this case, sh-eth need to remap address using devm_ioremap(),
>> without using devm_ioremap_resource().
>> tsu_shared_reg of sh_eth_cpu_data is used for this control.

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

>> @@ -2750,7 +2754,12 @@ static int sh_eth_drv_probe(struct
>> platform_device *pdev)
>>               ret = -ENODEV;
>>               goto out_release;
>>           }

>      This patch is not good anymore since in the meanwhile the above
> check got removed.
> Iwamatsu-san, are you going to respin this patch and the next series of
> 9 patches any time
> soon. I need them to base my work on.

    So, I have taken the following series in my own hands and will 
repost it soon. Your authorship will be kept. And I've left this patch 
for you to deal with since I'm not directly interested in it.

WBR, Sergei

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

* Re: [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register
  2013-05-07  5:08 [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register Nobuhiro Iwamatsu
  2013-05-07 14:44 ` Sergei Shtylyov
  2013-06-03 22:07 ` Sergei Shtylyov
@ 2018-01-02 17:27 ` Sergei Shtylyov
  2 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2018-01-02 17:27 UTC (permalink / raw)
  To: Nobuhiro Iwamatsu, netdev; +Cc: yoshihiro.shimoda.uh

Hello!

On 05/07/2013 09:08 AM, Nobuhiro Iwamatsu wrote:

> Some sh-eth devices may have two ether devices inside.
> And the function of TSU is accessed from each ether device.
> In this case, sh-eth need to remap address using devm_ioremap(),
> without using devm_ioremap_resource().
> tsu_shared_reg of sh_eth_cpu_data is used for this control.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> ---
> V2:
>    - Change variable name from tsu_multi_reg to tsu_shared_reg.
>    - Update commit message.
> 
>   drivers/net/ethernet/renesas/sh_eth.c |   11 ++++++++++-
>   drivers/net/ethernet/renesas/sh_eth.h |    1 +
>   2 files changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
> index 33dc6f2..489be0e 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
[...]
> @@ -2750,7 +2754,12 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
>   			ret = -ENODEV;
>   			goto out_release;
>   		}
> -		mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
> +
> +		if (mdp->cd->tsu_shared_reg)
> +			mdp->tsu_addr = devm_ioremap(&pdev->dev, rtsu->start,
> +					resource_size(rtsu));

    I now think there's no need for a special flag -- we can just use 'devno' 
(at least for the pure platform devices). The DT probing case remains unsolved 
though (might make sense to look at the resource #0, whether it has 0x800 set 
or not)...

> +		else
> +			mdp->tsu_addr = devm_ioremap_resource(&pdev->dev, rtsu);
>   		if (IS_ERR(mdp->tsu_addr)) {
>   			ret = PTR_ERR(mdp->tsu_addr);
>   			goto out_release;

MBR, Sergei

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

end of thread, other threads:[~2018-01-02 17:27 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-07  5:08 [PATCH v2] net: sh-eth: Add flag to determine the type of TSU register Nobuhiro Iwamatsu
2013-05-07 14:44 ` Sergei Shtylyov
2013-06-04 17:19   ` Sergei Shtylyov
2013-06-05  5:12     ` Nobuhiro Iwamatsu
2013-06-03 22:07 ` Sergei Shtylyov
2013-06-05 14:21   ` Sergei Shtylyov
2018-01-02 17:27 ` Sergei Shtylyov

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.