can: sja1000 platform data fixes
authorWolfgang Grandegger <wg@grandegger.com>
Tue, 18 May 2010 05:39:48 +0000 (22:39 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 May 2010 05:39:48 +0000 (22:39 -0700)
The member "clock" of struct "sja1000_platform_data" is documented as
"CAN bus oscillator frequency in Hz" but it's actually used as the CAN
clock frequency, which is half of it. To avoid further confusion, this
patch fixes it by renaming the member to "osc_freq". That way, also
non mainline users will notice the change. The platform code for the
relevant boards is updated accordingly. Furthermore, pre-defined
values are now used for the members "ocr" and "cdr".

Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/arm/mach-mx2/pcm970-baseboard.c
arch/arm/mach-mx3/mach-pcm037.c
drivers/net/can/sja1000/sja1000_platform.c
include/linux/can/platform/sja1000.h

index 4aafd5b8b85b48d400cdf00841a8fdfa63ef33b9..f490a406d57e737b46a343cb0c780e83f72cb056 100644 (file)
@@ -201,9 +201,9 @@ static struct resource pcm970_sja1000_resources[] = {
 };
 
 struct sja1000_platform_data pcm970_sja1000_platform_data = {
-       .clock          = 16000000 / 2,
-       .ocr            = 0x40 | 0x18,
-       .cdr            = 0x40,
+       .osc_freq       = 16000000,
+       .ocr            = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
+       .cdr            = CDR_CBP,
 };
 
 static struct platform_device pcm970_sja1000 = {
index 2df1ec55a97e6565980b27fd0ade0754921b20e1..78ecd751549b68e0ef2894ad49fba56208601b24 100644 (file)
@@ -530,9 +530,9 @@ static struct resource pcm970_sja1000_resources[] = {
 };
 
 struct sja1000_platform_data pcm970_sja1000_platform_data = {
-       .clock          = 16000000 / 2,
-       .ocr            = 0x40 | 0x18,
-       .cdr            = 0x40,
+       .osc_freq       = 16000000,
+       .ocr            = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
+       .cdr            = CDR_CBP,
 };
 
 static struct platform_device pcm970_sja1000 = {
index b65cabb361ab8ce07bc8a45a5da2000f12b4d654..d9fadc489b32dc75f09c0d55d63b9e85b90f143c 100644 (file)
@@ -111,7 +111,8 @@ static int sp_probe(struct platform_device *pdev)
        dev->irq = res_irq->start;
        priv->irq_flags = res_irq->flags & (IRQF_TRIGGER_MASK | IRQF_SHARED);
        priv->reg_base = addr;
-       priv->can.clock.freq = pdata->clock;
+       /* The CAN clock frequency is half the oscillator clock frequency */
+       priv->can.clock.freq = pdata->osc_freq / 2;
        priv->ocr = pdata->ocr;
        priv->cdr = pdata->cdr;
 
index 01ee2aeb048df36e535982e20b30c7b004e1a5c9..96f8fcc78d787a3b826967b77328ea6f4e1dc8ef 100644 (file)
@@ -26,7 +26,7 @@
 #define OCR_TX_SHIFT      2
 
 struct sja1000_platform_data {
-       u32 clock;      /* CAN bus oscillator frequency in Hz */
+       u32 osc_freq;   /* CAN bus oscillator frequency in Hz */
 
        u8 ocr;         /* output control register */
        u8 cdr;         /* clock divider register */