ltib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Ltib] LPC EA3250 board, spi driver.


From: Соковых Олег Викторович
Subject: [Ltib] LPC EA3250 board, spi driver.
Date: Wed, 20 Oct 2010 11:24:09 +0700

Hi, everyone!!!

I downloaded release version ltib, because in the newest version ltib had problems with the ethernet controller (trouble with MAC address) and memory controller. In the version release, it works more consistently. Now, I want to have a spi driver.
In the /dev not created spidev0.0 devices. I wrote all the steps, please, what I'm doing wrong ?

In file "board-ea3250.c" I added following:

static struct platform_device spi_device = {
        .name           = "spi_device",
        .id             = 0,
        .dev            = {
                .platform_data  = &lpc32xx_spi0data,
        },
        .num_resources  = ARRAY_SIZE(spi_resources),
        .resource       = spi_resources,
};

static struct resource spi_resources[] = {
        [0] = {
                .start  = SPI1_BASE,
                .end    = SPI1_BASE + SZ_4K - 1,
                .flags  = IORESOURCE_MEM,
        },
        [1] = {
                .start  = IRQ_SPI1,
                .end    = IRQ_SPI1,
                .flags  = IORESOURCE_IRQ,
        },

};

struct lpc32xx_spi_cfg lpc32xx_spi0data =
{
        .num_cs         = 1, /* Only 1 chip select, don't add LCD controller */
        .spi_cs_setup   = &ea3250_spi_cs_setup,
        .spi_cs_set     = &ea3250_spi_cs_set,
};

static void ea3250_spi_cs_setup(int cs)
{
}

static int ea3250_spi_cs_set(int cs, int state)
{
        if (cs == CS_TP)
        {
                if (state != 0)
                {
                        /* Set chip select high */
                        __raw_writel(OUTP_STATE_GPO(
11),
                                GPIO_P3_OUTP_SET(GPIO_IOBASE));
                }
                else
                {
                        /* Set chip select low */
                        __raw_writel(OUTP_STATE_GPO(11),
                                GPIO_P3_OUTP_CLR(GPIO_IOBASE));
                }
        }

        else
        {
                /* Invalid chip select */
                return -ENODEV;
        }

        return 0;
}

static int __init ea3250_spi_register(void)
{

    struct spi_board_info spi_info =
    {
        .modalias = "spidev", /* Expose spi to userspace */
        .max_speed_hz = 500000, /* SPI Speed. */
        .bus_num = 0, /* McSPI Bus Number */
        .chip_select = 0, /* ChipSelect for McSPI */
        .mode = 0, /* SPI Mode */
    };

    return spi_register_board_info(&spi_info, 1);

}

/// In the same way added ads7846
arch_initcall(ea3250_spi_register);

static struct platform_device* ea3250_devs[] __initdata = {
...
  &spi_device,
...
};

2) In /etc/inittab wrote:
   null::sysinit:/bin/echo /sbin/mdev > /proc/sys/kernel/hotplug
   null::sysinit:/sbin/mdev -s
3) In /etc/mdev.conf:
   spidev0.0  0:0     666

But in /dev did not create device "spidev0.0".  (((
running the following command:

address@hidden /]# find / -name spi*
/lib/modules/2.6.27.8/kernel/drivers/spi
/lib/modules/2.6.27.8/kernel/drivers/spi/spidev.ko
/sys/devices/platform/spi_lpc32xx.0
/sys/devices/platform/spi_lpc32xx.0/spi_master:spi0
/sys/devices/platform/spi_lpc32xx.0/spi0.0
/sys/bus/platform/devices/spi_lpc32xx.0
/sys/bus/platform/drivers/spi_lpc32xx
/sys/bus/platform/drivers/spi_lpc32xx/spi_lpc32xx.0
/sys/bus/spi
/sys/bus/spi/devices/spi0.0
/sys/bus/spi/drivers/ads7846/spi0.0
/sys/bus/spi/drivers/spidev
/sys/class/spi_master
/sys/class/spi_master/spi0
/sys/class/spidev
/sys/module/spidev
/sys/module/spidev/drivers/spi:spidev
/proc/irq/20/spiirq

Kernel finded spi, but for some reason, are not created in /dev devices (((
What am I doing wrong?

ls /dev :
address@hidden drivers]# ls /dev
console             rtc0                tty43
cpu_dma_latency     sda                 tty44
event0              sda1                tty45
full                shm                 tty46
i2c-0               tty                 tty47
i2c-2               tty0                tty48
kmem                tty1                tty49
kmsg                tty10               tty5
log                 tty11               tty50
loop0               tty12               tty51
loop1               tty13               tty52
loop2               tty14               tty53
loop3               tty15               tty54
loop4               tty16               tty55
loop5               tty17               tty56
loop6               tty18               tty57
loop7               tty19               tty58
mem                 tty2                tty59
mice                tty20               tty6
mouse0              tty21               tty60
mtd0                tty22               tty61
mtd0ro              tty23               tty62
mtd1                tty24               tty63
mtd1ro              tty25               tty7
mtd2                tty26               tty8
mtd2ro              tty27               tty9
mtd3                tty28               ttyS0
mtd3ro              tty29               ttyS1
mtd4                tty3                ttyS2
mtd4ro              tty30               ttyS3
mtdblock0           tty31               urandom
mtdblock1           tty32               usbdev1.1
mtdblock2           tty33               usbdev1.1_ep00
mtdblock3           tty34               usbdev1.1_ep81
mtdblock4           tty35               usbdev1.2
network_latency     tty36               usbdev1.2_ep00
network_throughput  tty37               usbdev1.2_ep02
null                tty38               usbdev1.2_ep81
psaux               tty39               vcs
ptmx                tty4                vcsa
pts                 tty40               watchdog
random              tty41               zero
root                tty42

Thanks....

reply via email to

[Prev in Thread] Current Thread [Next in Thread]