This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SPI problem on DM365 (2.6.37)

Hi,

I am trying to enable SPI1 on dm365. I am using the latest kernel 2.6.37 form psp release

 

For this i added  in dm365.c

 

static struct davinci_spi_platform_data dm365_spi1_pdata = {
    .version     = SPI_VERSION_1,
    .num_chipselect = 2,
};

static struct resource dm365_spi1_resources[] = {
    {
        .start = 0x01c66800,
        .end   = 0x01c66fff,
        .flags = IORESOURCE_MEM,
    },
    {
        .start = IRQ_DM365_SPIINT3_0,
        .flags = IORESOURCE_IRQ,
    },
    {
        .start = 17,
        .flags = IORESOURCE_DMA,
    },
    {
        .start = 16,
        .flags = IORESOURCE_DMA,

    },
    {
        .start = EVENTQ_3,
        .flags = IORESOURCE_DMA,

    },
};

static struct platform_device dm365_spi1_device = {
    .name = "spi_davinci",
    .id = 1,
    .dev = {
        .dma_mask = &dm365_spi1_dma_mask,
        .coherent_dma_mask = DMA_BIT_MASK(32),
        .platform_data = &dm365_spi1_pdata,
    },
    .num_resources = ARRAY_SIZE(dm365_spi1_resources),
    .resource = dm365_spi1_resources,
};

void __init dm365_init_spi1(unsigned chipselect_mask,
        struct spi_board_info *info, unsigned len)
{
    davinci_cfg_reg(DM365_SPI1_SCLK);
    davinci_cfg_reg(DM365_SPI1_SDI);
    davinci_cfg_reg(DM365_SPI1_SDO);

    /* not all slaves will be wired up */
    if (chipselect_mask & BIT(0))
        davinci_cfg_reg(DM365_SPI1_SDENA0);
    if (chipselect_mask & BIT(1))
        davinci_cfg_reg(DM365_SPI1_SDENA1);

    spi_register_board_info(info, len);

    platform_device_register(&dm365_spi1_device);
}

 

 

In board-dm365evm.c

 

static struct spi_board_info dm365_evm_spi1_info[] __initconst = {
    {
        .modalias    = "spidev",
        .max_speed_hz    = 10 * 1000 * 1000,
        .bus_num    = 1,
        .chip_select    = 0,
        .mode        = SPI_MODE_0,
    },
};

in dm365 init

    dm365_init_spi1(BIT(0), dm365_evm_spi1_info,
            ARRAY_SIZE(dm365_evm_spi1_info));

 

In log i am getting

spi_davinci spi_davinci.0: DMA: supported
spi_davinci spi_davinci.0: DMA: RX channel: 15, TX channel: 14, event queue: 3
spi_davinci spi_davinci.0: Controller at 0xfec66000
spi_davinci spi_davinci.1: DMA: supported
spi_davinci spi_davinci.1: DMA: RX channel: 17, TX channel: 16, event queue: 3
spi_davinci spi_davinci.1: Controller at 0xfec66800

 

 

The problem is while i try to access /dev/spi1.0 then the board hangs.

Not getting any output.

But for /dev/spi0.0 i am getting the o/p signals

Is there is any problem in davinic_spi.c

 

Please clarify

Thanks And regards

Nikhil

  • Hi Nikhil,

    I'm trying to configure SPI1 and have patched up the relevant files as you have described above. but I couldn't find spidev1.0 on /dev. Boot log:

    spi_davinici spi_davinici.o: Controller at 0xfec66800

    However configuring the following set-up with the '.bus_num=0' instead of '.bus_num=1', mounts a spidev0.0 on the /dev

    static struct spi_board_info dm365_evm_spi1_info[] __initconst = { 
     {
            .modalias = "spidev",
            .platform_data = NULL,
            .controller_data = NULL,
            .mode = SPI_MODE_0,
            .irq = 0,
            .max_speed_hz = 2 * 1000 * 1000 /* max sample rate at 3V */ ,
            .bus_num = 0,
            .chip_select = 0,
        },
    };

    Not sure where the problem is? So do you have any idea what could prevent the creation of dev/spidev1.0?

  • Hi Nikhil,

    I'm trying to configure SPI1 and have patched up the relevant files as you have described above. but I couldn't find spidev1.0 on /dev. Boot log:

    spi_davinici spi_davinici.o: Controller at 0xfec66800

    However configuring the following set-up with the '.bus_num=0' instead of '.bus_num=1', mounts a spidev0.0 on the /dev

    static struct spi_board_info dm365_evm_spi1_info[] __initconst = { 
     {
            .modalias = "spidev",
            .platform_data = NULL,
            .controller_data = NULL,
            .mode = SPI_MODE_0,
            .irq = 0,
            .max_speed_hz = 2 * 1000 * 1000 /* max sample rate at 3V */ ,
            .bus_num = 0,
            .chip_select = 0,
        },
    };

    Not sure where the problem is? So do you have any idea what could prevent the creation of dev/spidev1.0?

    Thanks in advance

  • Hi Nikhil,

    I'm trying to configure SPI1 and have patched up the relevant files as you have described above. but I couldn't find spidev1.0 on /dev. Boot log:

    spi_davinici spi_davinici.o: Controller at 0xfec66800

    However configuring the following set-up with the '.bus_num=0' instead of '.bus_num=1', mounts a spidev0.0 on the /dev

    static struct spi_board_info dm365_evm_spi1_info[] __initconst = { 
     {
            .modalias = "spidev",
            .platform_data = NULL,
            .controller_data = NULL,
            .mode = SPI_MODE_0,
            .irq = 0,
            .max_speed_hz = 2 * 1000 * 1000 /* max sample rate at 3V */ ,
            .bus_num = 0,
            .chip_select = 0,
        },
    };

    Not sure where the problem is? So do you have any idea what could prevent the creation of dev/spidev1.0?

    Thanks in advance