Quantcast
Channel: Processors forum - Recent Threads
Viewing all articles
Browse latest Browse all 17527

SPI1 issue -> spi_write hangs on OMAPL138 LCDK

$
0
0

Hi,

I am using OMAPL138 LCDK (Hawkboard) with custom LCD hardware. LCD is interfaced over 16 bit RGB interface and 3 wire SPI1 configuration.

I have done necessary modification in kernel for SPI1 support and with the changes, probe function of the driver gets called correctly for SPI.

From probe function, I want to write data over spi. When I use spi_write() call of kernel, kernel gets hang at this location and console hangs.

Can anyone please help me in finding root cause ?

Following are the changes done in kernel.

static struct davinci_spi_config da850_ssd2119_spi_cfg = {
        .io_type        = SPI_IO_TYPE_DMA,
        .c2tdelay       = 8,
        .t2cdelay       = 8,
};

static struct spi_board_info lcd_spi_info[] = {
        {
                .modalias               = "da8xx_lcdc-spi",
                .platform_data          = &ssd2119_pdata1,
                .controller_data        = &da850_ssd2119_spi_cfg,
                .mode                   = SPI_MODE_0,
                .max_speed_hz           = 20000000,
                .bus_num                = 1,
                .chip_select            = 0,
        },
};

ret = da8xx_pinmux_setup(da850_spi1_pins);
if (ret)
    pr_warning("omapl138_hawk_init: spi1 mux setup failed: %d\n",
      ret);

Init code::
==============
        ret = da8xx_register_spi(1, lcd_spi_info, ARRAY_SIZE(lcd_spi_info));
        if (ret)
                pr_warning("======> omapl138_hawk_init: spi 0 registration failed: %d\n",
                                ret);
        else
                printk("======> omapl138_hawk_init: spi 0 initialized successfully\n");


SPI driver code:
==================
        par->spidrv.driver.name = "da8xx_lcdc-spi";
        par->spidrv.probe    = ssd2119_spidev_probe;
        par->spidrv.remove   = __devexit_p(ssd2119_spidev_remove);
        par->spidrv.shutdown = ssd2119_spidev_shutdown;
        par->spidrv.suspend  = ssd2119_spidev_suspend;
        par->spidrv.resume   = ssd2119_spidev_resume;

        ret = spi_register_driver(&par->spidrv);
        if (ret < 0) {
                dev_err(&device->dev, "couldn't register SPI Interface\n");
                goto spi_failure;
        }

Above code calls probe function correctly.
However, when spi_write is performed, it hangs the kernel.

static int ssd2119_control(struct spi_device *spi, unsigned char *reg, unsigned char *value_h, unsigned char *value_l)
{
        int ret;

        if (!spi)
                return -ENODEV;

        ret = spi_write(spi, (const unsigned char *)reg, sizeof(reg)); // Kernel hangs here...............
        return ret;
}

Any help will be highly appreciated.

Regards,
Sweta


Viewing all articles
Browse latest Browse all 17527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>