netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource.
@ 2014-07-25  6:19 Mugunthan V N
  2014-07-25  7:38 ` Marc Kleine-Budde
  2014-07-25 10:49 ` Wolfram Sang
  0 siblings, 2 replies; 4+ messages in thread
From: Mugunthan V N @ 2014-07-25  6:19 UTC (permalink / raw)
  To: Wolfgang Grandegger
  Cc: Marc Kleine-Budde, Pavel Machek, Thor Thayer, Prabhakar Lad,
	Thomas Gleixner, Wolfram Sang, Chen Gang, George Cherian,
	linux-can, netdev, linux-kernel, Mugunthan V N

From: George Cherian <george.cherian@ti.com>

The raminit register is shared register for both can0 and can1.
Using devm_ioremap_resource fails the mapping for can1 interface
leading to a non functional can interface.

Signed-off-by: George Cherian <george.cherian@ti.com>
Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
---
 drivers/net/can/c_can/c_can_platform.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index e29b6d0..5dede6e 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -278,7 +278,8 @@ static int c_can_plat_probe(struct platform_device *pdev)
 			break;
 		}
 
-		priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
+		priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start,
+						     resource_size(res));
 		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
 			dev_info(&pdev->dev, "control memory is not used for raminit\n");
 		else
-- 
2.0.2.673.g9ab0882


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

* Re: [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource.
  2014-07-25  6:19 [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource Mugunthan V N
@ 2014-07-25  7:38 ` Marc Kleine-Budde
  2014-07-25 10:49 ` Wolfram Sang
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2014-07-25  7:38 UTC (permalink / raw)
  To: Mugunthan V N, Wolfgang Grandegger
  Cc: Pavel Machek, Thor Thayer, Prabhakar Lad, Thomas Gleixner,
	Wolfram Sang, Chen Gang, George Cherian, linux-can, netdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 802 bytes --]

On 07/25/2014 08:19 AM, Mugunthan V N wrote:
> From: George Cherian <george.cherian@ti.com>
> 
> The raminit register is shared register for both can0 and can1.
> Using devm_ioremap_resource fails the mapping for can1 interface
> leading to a non functional can interface.
> 
> Signed-off-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

Applied to can, I've adjusted the commit message a bit, mentioning the
patch, that introduced the regression.

Thanks,
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

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

* Re: [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource.
  2014-07-25  6:19 [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource Mugunthan V N
  2014-07-25  7:38 ` Marc Kleine-Budde
@ 2014-07-25 10:49 ` Wolfram Sang
  2014-07-25 13:06   ` Marc Kleine-Budde
  1 sibling, 1 reply; 4+ messages in thread
From: Wolfram Sang @ 2014-07-25 10:49 UTC (permalink / raw)
  To: Mugunthan V N
  Cc: Wolfgang Grandegger, Marc Kleine-Budde, Pavel Machek, Thor Thayer,
	Prabhakar Lad, Thomas Gleixner, Chen Gang, George Cherian,
	linux-can, netdev, linux-kernel

Am 25-07-2014 08:19, schrieb Mugunthan V N:
> From: George Cherian <george.cherian@ti.com>
> 
> The raminit register is shared register for both can0 and can1.
> Using devm_ioremap_resource fails the mapping for can1 interface
> leading to a non functional can interface.
> 
> Signed-off-by: George Cherian <george.cherian@ti.com>
> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>

The patch is a hack, or? It simply works because we drop all sanity 
checking on the resource.

I am on holiday and can't really check, yet I believe the AM335x has 
devicetree support for accessing single bits in SYSCONF. This is what 
needs to be applied here, too, AFAICT.

> ---
>  drivers/net/can/c_can/c_can_platform.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/can/c_can/c_can_platform.c
> b/drivers/net/can/c_can/c_can_platform.c
> index e29b6d0..5dede6e 100644
> --- a/drivers/net/can/c_can/c_can_platform.c
> +++ b/drivers/net/can/c_can/c_can_platform.c
> @@ -278,7 +278,8 @@ static int c_can_plat_probe(struct platform_device 
> *pdev)
>  			break;
>  		}
> 
> -		priv->raminit_ctrlreg = devm_ioremap_resource(&pdev->dev, res);
> +		priv->raminit_ctrlreg = devm_ioremap(&pdev->dev, res->start,
> +						     resource_size(res));
>  		if (IS_ERR(priv->raminit_ctrlreg) || priv->instance < 0)
>  			dev_info(&pdev->dev, "control memory is not used for raminit\n");
>  		else

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

* Re: [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource.
  2014-07-25 10:49 ` Wolfram Sang
@ 2014-07-25 13:06   ` Marc Kleine-Budde
  0 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2014-07-25 13:06 UTC (permalink / raw)
  To: Wolfram Sang, Mugunthan V N
  Cc: Wolfgang Grandegger, Pavel Machek, Thor Thayer, Prabhakar Lad,
	Thomas Gleixner, Chen Gang, George Cherian, linux-can, netdev,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1284 bytes --]

On 07/25/2014 12:49 PM, Wolfram Sang wrote:
> Am 25-07-2014 08:19, schrieb Mugunthan V N:
>> From: George Cherian <george.cherian@ti.com>
>>
>> The raminit register is shared register for both can0 and can1.
>> Using devm_ioremap_resource fails the mapping for can1 interface
>> leading to a non functional can interface.
>>
>> Signed-off-by: George Cherian <george.cherian@ti.com>
>> Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com>
> 
> The patch is a hack, or? It simply works because we drop all sanity
> checking on the resource.

Well, thinking about it, yes, a bit.

> I am on holiday and can't really check, yet I believe the AM335x has
> devicetree support for accessing single bits in SYSCONF. This is what
> needs to be applied here, too, AFAICT.

I cannot find any generic driver for the sysconf, USB and Ethernet have
an extra driver for their shared register space. I think the d_can can
access the raminit register via a syscon driver.

Enjoy your holiday :)
Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 242 bytes --]

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

end of thread, other threads:[~2014-07-25 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25  6:19 [can-next PATCH 1/1] net: can: c_can_platform: Use devm_ioremap instead of devm_ioremap_resource Mugunthan V N
2014-07-25  7:38 ` Marc Kleine-Budde
2014-07-25 10:49 ` Wolfram Sang
2014-07-25 13:06   ` Marc Kleine-Budde

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