Dear All:
             Hi, i have portting linux 2.6.35 SocketCAN sja1000 driver to my 
s3c6410 ARM11 2.6.29.6 Kernel.Following is tips:

1)
#ifdef CONFIG_CAN_SJA1000
static struct resource s3c6410_sja1000_resources[] = {
        {
                .start   = S3C64XX_SJA1000_CS_ADDR, //USE CS4
                .end     = S3C64XX_SJA1000_CS_ADDR + 0x100 - 1,
                .flags   = IORESOURCE_MEM,
        }, {
                /*SJA1000 Use GPN2*/
                .start   = S3C_EINT(2),
                .end     = S3C_EINT(2),
                .flags   = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWEDGE,
        },
};

struct sja1000_platform_data s3c6410_sja1000_platform_data = {
        .osc_freq       = 16000000,
        .ocr            = OCR_TX1_PULLDOWN | OCR_TX0_PUSHPULL,
        .cdr            = CDR_CBP,
};

static struct platform_device s3c6410_sja1000 = {
        .name = "sja1000_platform",
        .dev = {
                .platform_data = &s3c6410_sja1000_platform_data,
        },
        .resource = s3c6410_sja1000_resources,
        .num_resources = ARRAY_SIZE(s3c6410_sja1000_resources),
};
#endif

2)I modify drivers/net/can/sja1000/sja1000_platform.c ,
void __iomem  *data_regs,*ale_regs;
static u8 sp_read_reg8(const struct sja1000_priv *priv, int reg)
{
        writeb(reg,ale_regs);
        return readb(data_regs);
}

static void sp_write_reg8(const struct sja1000_priv *priv, int reg, u8 val)
{
        writeb(reg,ale_regs);
        writeb(val,data_regs);
}

in sp_probe,i add following:

        /*S3C64XX,S3C64XX_GPN1->ALE,S3C64XX_GPN3->DATA,S3C64XX_GPK11->RESET*/
        data_regs = ioremap_nocache(S3C64XX_GPN(3), resource_size(res_mem));
        if (!addr) {
                err = -ENOMEM;
                iounmap(data_regs);
        }
        ale_regs = ioremap_nocache(S3C64XX_GPN(1), resource_size(res_mem));
        if (!addr) {
                err = -ENOMEM;
                iounmap(ale_regs);
        }

        /*CAN_RST*/
        s3c_gpio_cfgpin(S3C64XX_GPK(11),S3C_GPIO_OUTPUT);
        gpio_set_value(S3C64XX_GPK(11), 1);
        /*CAN RST*/
        dev = alloc_sja1000dev(0);
         .....


After downing zImage to my s3c6410,

[root@s3c6410 /]# ifconfig -a
can0      Link encap:UNSPEC  HWaddr 
00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 
          NOARP  MTU:16  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:10
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:103
[root@s3c6410 /]# ifconfig can0 up
sja1000_platform sja1000_platform.0: bit-timing not yet defined
ifconfig: SIOCSIFFLAGS: Invalid argument
[root@s3c64xx /]# cat /proc/interrupts

there are no my CAN interrupt

according to above error,i need to use iproute to "ip link set can0 up type can 
bitrate 1000000"?
please review my code,if there are some issue?

B.R
Tommy

        

_______________________________________________
Socketcan-users mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/socketcan-users

Reply via email to