netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next-2.6 0/2] can: sja1000: sja1000_platform.c fixes
@ 2010-03-19 10:47 Yegor Yefremov
  2010-03-19 10:49 ` [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition Yegor Yefremov
  0 siblings, 1 reply; 8+ messages in thread
From: Yegor Yefremov @ 2010-03-19 10:47 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w

Here are two sja1000_platform.c related fixes:

SJA1000: allow shared interrupt definition
SJA1000: add read/write routines for 8, 16 and 32-bit register access

Best regards,
Yegor

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

* Re: [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition
  2010-03-19 10:47 [PATCH net-next-2.6 0/2] can: sja1000: sja1000_platform.c fixes Yegor Yefremov
@ 2010-03-19 10:49 ` Yegor Yefremov
       [not found]   ` <4BA356A4.5040205-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
  0 siblings, 1 reply; 8+ messages in thread
From: Yegor Yefremov @ 2010-03-19 10:49 UTC (permalink / raw)
  To: netdev; +Cc: socketcan-core

SJA1000: allow shared interrupt definition

extend the AND mask, so that IRQF_SHARED flag remains

Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>

diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index 628374c..bec0d3d 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -90,7 +90,7 @@ static int sp_probe(struct platform_device *pdev)
 	priv = netdev_priv(dev);
 
 	dev->irq = res_irq->start;
-	priv->irq_flags = res_irq->flags & IRQF_TRIGGER_MASK;
+	priv->irq_flags = res_irq->flags & (IRQF_TRIGGER_MASK | IRQF_SHARED);
 	priv->reg_base = addr;
 	priv->read_reg = sp_read_reg;
 	priv->write_reg = sp_write_reg;


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

* Re: [PATCH net-next-2.6 2/2] can: sja1000: add read/write routines for 8, 16 and 32-bit register access
       [not found]   ` <4BA356A4.5040205-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
@ 2010-03-19 10:50     ` Yegor Yefremov
       [not found]       ` <4BA35704.2060909-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
  2010-03-19 13:13     ` [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition Wolfgang Grandegger
  1 sibling, 1 reply; 8+ messages in thread
From: Yegor Yefremov @ 2010-03-19 10:50 UTC (permalink / raw)
  To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w

SJA1000: add read/write routines for 8, 16 and 32-bit register access

add routines for 8, 16 and 32-bit access like in 
drivers/i2c/busses/i2c-pca-platform.c

Signed-off-by: Yegor Yefremov <yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

Index: net-next-2.6/drivers/net/can/sja1000/sja1000_platform.c
===================================================================
--- net-next-2.6.orig/drivers/net/can/sja1000/sja1000_platform.c
+++ net-next-2.6/drivers/net/can/sja1000/sja1000_platform.c
@@ -37,16 +37,36 @@ MODULE_AUTHOR("Sascha Hauer <s.hauer@pen
 MODULE_DESCRIPTION("Socket-CAN driver for SJA1000 on the platform bus");
 MODULE_LICENSE("GPL v2");
 
-static u8 sp_read_reg(const struct sja1000_priv *priv, int reg)
+static u8 sp_read_reg8(const struct sja1000_priv *priv, int reg)
 {
 	return ioread8(priv->reg_base + reg);
 }
 
-static void sp_write_reg(const struct sja1000_priv *priv, int reg, u8 val)
+static void sp_write_reg8(const struct sja1000_priv *priv, int reg, u8 val)
 {
 	iowrite8(val, priv->reg_base + reg);
 }
 
+static u8 sp_read_reg16(const struct sja1000_priv *priv, int reg)
+{
+	return ioread8(priv->reg_base + reg * 2);
+}
+
+static void sp_write_reg16(const struct sja1000_priv *priv, int reg, u8 val)
+{
+	iowrite8(val, priv->reg_base + reg * 2);
+}
+
+static u8 sp_read_reg32(const struct sja1000_priv *priv, int reg)
+{
+	return ioread8(priv->reg_base + reg * 4);
+}
+
+static void sp_write_reg32(const struct sja1000_priv *priv, int reg, u8 val)
+{
+	iowrite8(val, priv->reg_base + reg * 4);
+}
+
 static int sp_probe(struct platform_device *pdev)
 {
 	int err;
@@ -92,12 +112,26 @@ static int sp_probe(struct platform_devi
 	dev->irq = res_irq->start;
 	priv->irq_flags = res_irq->flags & (IRQF_TRIGGER_MASK | IRQF_SHARED);
 	priv->reg_base = addr;
-	priv->read_reg = sp_read_reg;
-	priv->write_reg = sp_write_reg;
 	priv->can.clock.freq = pdata->clock;
 	priv->ocr = pdata->ocr;
 	priv->cdr = pdata->cdr;
 
+	switch (res_mem->flags & IORESOURCE_MEM_TYPE_MASK) {
+	case IORESOURCE_MEM_32BIT:
+		priv->read_reg = sp_read_reg32;
+		priv->write_reg = sp_write_reg32;
+		break;
+	case IORESOURCE_MEM_16BIT:
+		priv->read_reg = sp_read_reg16;
+		priv->write_reg = sp_write_reg16;
+		break;
+	case IORESOURCE_MEM_8BIT:
+	default:
+		priv->read_reg = sp_read_reg8;
+		priv->write_reg = sp_write_reg8;
+		break;
+	}
+
 	dev_set_drvdata(&pdev->dev, dev);
 	SET_NETDEV_DEV(dev, &pdev->dev);

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

* Re: [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition
       [not found]   ` <4BA356A4.5040205-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
  2010-03-19 10:50     ` [PATCH net-next-2.6 2/2] can: sja1000: add read/write routines for 8, 16 and 32-bit register access Yegor Yefremov
@ 2010-03-19 13:13     ` Wolfgang Grandegger
  2010-03-22  3:36       ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfgang Grandegger @ 2010-03-19 13:13 UTC (permalink / raw)
  To: yegor_sub1-ZJVcf1zZPRSebONBosFW4Q
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA

Yegor Yefremov wrote:
> SJA1000: allow shared interrupt definition
> 
> extend the AND mask, so that IRQF_SHARED flag remains
> 
> Signed-off-by: Yegor Yefremov <yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

Thanks,

Wolfgang.

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

* Re: [PATCH net-next-2.6 2/2] can: sja1000: add read/write routines for 8, 16 and 32-bit register access
       [not found]       ` <4BA35704.2060909-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
@ 2010-03-19 13:14         ` Wolfgang Grandegger
  2010-03-20  3:56         ` Wolfram Sang
  1 sibling, 0 replies; 8+ messages in thread
From: Wolfgang Grandegger @ 2010-03-19 13:14 UTC (permalink / raw)
  To: yegor_sub1-ZJVcf1zZPRSebONBosFW4Q
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA

Yegor Yefremov wrote:
> SJA1000: add read/write routines for 8, 16 and 32-bit register access
> 
> add routines for 8, 16 and 32-bit access like in 
> drivers/i2c/busses/i2c-pca-platform.c
> 
> Signed-off-by: Yegor Yefremov <yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

Acked-by: Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>

Thanks,

Wolfgang.

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

* Re: [PATCH net-next-2.6 2/2] can: sja1000: add read/write routines for 8, 16 and 32-bit register access
       [not found]       ` <4BA35704.2060909-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
  2010-03-19 13:14         ` Wolfgang Grandegger
@ 2010-03-20  3:56         ` Wolfram Sang
  2010-03-22  3:37           ` David Miller
  1 sibling, 1 reply; 8+ messages in thread
From: Wolfram Sang @ 2010-03-20  3:56 UTC (permalink / raw)
  To: Yegor Yefremov
  Cc: socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA


[-- Attachment #1.1: Type: text/plain, Size: 561 bytes --]

On Fri, Mar 19, 2010 at 11:50:44AM +0100, Yegor Yefremov wrote:
> SJA1000: add read/write routines for 8, 16 and 32-bit register access
> 
> add routines for 8, 16 and 32-bit access like in 
> drivers/i2c/busses/i2c-pca-platform.c
> 
> Signed-off-by: Yegor Yefremov <yegorslists-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>

Acked-by: Wolfram Sang <w.sang-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 188 bytes --]

_______________________________________________
Socketcan-core mailing list
Socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
https://lists.berlios.de/mailman/listinfo/socketcan-core

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

* Re: [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition
  2010-03-19 13:13     ` [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition Wolfgang Grandegger
@ 2010-03-22  3:36       ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-03-22  3:36 UTC (permalink / raw)
  To: wg; +Cc: yegor_sub1, netdev, socketcan-core

From: Wolfgang Grandegger <wg@grandegger.com>
Date: Fri, 19 Mar 2010 14:13:12 +0100

> Yegor Yefremov wrote:
>> SJA1000: allow shared interrupt definition
>> 
>> extend the AND mask, so that IRQF_SHARED flag remains
>> 
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Acked-by: Wolfgang Grandegger <wg@grandegger.com>

Applied.

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

* Re: [PATCH net-next-2.6 2/2] can: sja1000: add read/write routines for 8, 16 and 32-bit register access
  2010-03-20  3:56         ` Wolfram Sang
@ 2010-03-22  3:37           ` David Miller
  0 siblings, 0 replies; 8+ messages in thread
From: David Miller @ 2010-03-22  3:37 UTC (permalink / raw)
  To: w.sang; +Cc: yegor_sub1, netdev, socketcan-core

From: Wolfram Sang <w.sang@pengutronix.de>
Date: Sat, 20 Mar 2010 04:56:39 +0100

> On Fri, Mar 19, 2010 at 11:50:44AM +0100, Yegor Yefremov wrote:
>> SJA1000: add read/write routines for 8, 16 and 32-bit register access
>> 
>> add routines for 8, 16 and 32-bit access like in 
>> drivers/i2c/busses/i2c-pca-platform.c
>> 
>> Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com>
> 
> Acked-by: Wolfram Sang <w.sang@pengutronix.de>

Applied.

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

end of thread, other threads:[~2010-03-22  3:36 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 10:47 [PATCH net-next-2.6 0/2] can: sja1000: sja1000_platform.c fixes Yegor Yefremov
2010-03-19 10:49 ` [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition Yegor Yefremov
     [not found]   ` <4BA356A4.5040205-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
2010-03-19 10:50     ` [PATCH net-next-2.6 2/2] can: sja1000: add read/write routines for 8, 16 and 32-bit register access Yegor Yefremov
     [not found]       ` <4BA35704.2060909-ZJVcf1zZPRSebONBosFW4Q@public.gmane.org>
2010-03-19 13:14         ` Wolfgang Grandegger
2010-03-20  3:56         ` Wolfram Sang
2010-03-22  3:37           ` David Miller
2010-03-19 13:13     ` [PATCH net-next-2.6 1/2] can: sja1000: allow shared interrupt definition Wolfgang Grandegger
2010-03-22  3:36       ` David Miller

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