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.

cs_gpio Linux Kernel

Other Parts Discussed in Thread: ADS7846

Hi,


In Linux kernel version 3.8 there is a patch for cs_gpio which enables GPIO to be selected as cs in spi driver.


I am using kernel 2.6.37 and need this patch and was wondering if there is one available for linux kernel 2.6.37

Thanks

Ali

  • Hi Ali,
    Could you please share the patch which is released for linux 3.8.
    We can try it out that for linux2.6.37.
  • Hi Titus,

    I am not 100% sure but I believe its this one

    https://www.ivancso.net/gitblit/commitdiff/;jsessionid=1iuyxrx3mbtonmhswkhgribce?r=github-ivan/net-next.git&h=743179849015dc71bb2ea63d8cd4bfa7fdfb4bc6


    Thanks

    Ali
  • Ali, I hope we discussed about this already right ?

    http://e2e.ti.com/support/embedded/linux/f/354/t/368940#pi239031349=1

    Still are you facing any problem.
    Able to see any signal transitions on that GPIO which is configured as CS ?

    We can use GPIO as CS directly for SPI device.
    This patch is required if you are using latest kernel version which could support DTS.

    http://docs.blackfin.uclinux.org/doku.php?id=spi
  • Hi Titus,

    I was not able to get this working on gingerbread. I then moved from the kernel and started again for Icecream. I'll try the same approch and ask when stuck then. I am not using latest kernel. Its 2.6.37 I am using.
  • Hi Titus,

    I just specified the .controller_data to (void *)138 which is the GPIO connected to the chip select of GPIO expander and I am not sure why its not working. Just as background. SPI 2.0 CS 0 is connected to touchscreen and I am using driver ads7846 for this. The SPI 2.0 CS 1 is not connected at all. But I have Two GPIO expanders on the same bus which are connected via GPIO 138 and 136 to their specific CS pins.

    This is what I have in my board specific file.

    static struct spi_board_info xra1405_spi_info[] = {
    [0] = {
    .modalias = "xra1405",
    .bus_num = 2,
    .chip_select = 1,
    .max_speed_hz = 12000000,
    .controller_data = (void *)138,
    .irq = OMAP_GPIO_IRQ(HAWK_III_IO_IRQ),
    },
    };

    OMAP3_MUX(SDMMC2_DAT6, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), /* GPIO138, IO_CS0 */
    OMAP3_MUX(SDMMC2_DAT4, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), /* GPIO136, IO_CS1 */
    OMAP3_MUX(ETK_D14, OMAP_MUX_MODE4 | OMAP_PIN_INPUT), /* GPIO28, nIRQ_CS */

    and in the main routine I have

    static void __init HAWK_III_init(void)
    {
    if (gpio_request(138,"GPIO138")<0)
    printk(KERN_ERR "Can't get GPIO138\n");
    gpio_direction_output(138, 0);
    gpio_set_value(138, 0);
    if (gpio_request(136,"GPIO136")<0)
    printk(KERN_ERR "Can't get GPIO138\n");
    gpio_direction_output(136, 0);
    gpio_set_value(136, 0);

    spi_register_board_info(xra1405_spi_info,
    ARRAY_SIZE(xra1405_spi_info));
    }

    I am not sure how to go about this as I think I should register SPI bus as normal same as I did for ADS7846 driver but then communicating with GPIO expander set the appropriate GPIO line as high to talk to the right one and once finished lower the GPIO line.

    Please advise what your thoughts would be on this.