Access the GPIO from SPI Driver

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Access the GPIO from SPI Driver

2,758 次查看
satyavenkatasan
Contributor I

Dear Freescale,

 

 

 

I'm using the freescale IMX6SLEVK board and using the Linux kernel 3.10.17 for me development.

 

I'm trying to add the driver support for ili9163fb LCD with the reference of

https://github.com/ngreatorex/st7735fb/blob/master/st7735fb/st7735fb.c

 

I have define the GPIO's in dtsi file

 

&ecspi1 {

    fsl,spi-num-chipselects = <1>;

    cs-gpios  = <&gpio4 11 0>;

    rst-gpios = <&gpio4 10 0>;

    dc-gpios  = <&gpio3 05 0>;

 

    pinctrl-names = "default";

    pinctrl-0 = <&pinctrl_ecspi1_1>;

    status = "okay";

 

    LCD: ili9163fb@0 {

        #address-cells = <1>;

        #size-cells = <1>;

        compatible = "lcd,ili9163fb";

        spi-max-frequency = <4000000>;

        reg = <0>;

    };

};

 

// pin configurations as below

 

ecspi1 {
   pinctrl_ecspi1_1: ecspigrp_lcd {
   fsl,pins = <
   MX6SL_PAD_ECSPI1_SCLK__ECSPI1_SCLK    0x004100B1
   MX6SL_PAD_ECSPI1_MOSI__ECSPI1_MOSI    0x004100B1
   MX6SL_PAD_ECSPI1_SS0__GPIO4_IO11    0x00410070
   MX6SL_PAD_ECSPI1_MISO__GPIO4_IO10    0x00410070
   MX6SL_PAD_LCD_DAT17__GPIO3_IO05   0x00410070
   >;   
   };   

    };

 

inside the  "st7735fb_probe (struct spi_device *spi)" function

1st line i.e.

int chip = spi_get_device_id(spi)->driver_data;  got executed that time kernel is crashing with various debug messages.


if I comment the 1st line and

 

if (chip != ST7735_DISPLAY_AF_TFT18) {
pr_err("%s: only the %s device is supported\n", DRVNAME,
to_spi_driver(spi->dev.driver)->id_table->name);
return -EINVAL;
}
if (!pdata) {
pr_err("%s: platform data required for rst and dc info\n",
DRVNAME);
return -EINVAL;
}

 

then it is getting execute up to

 

par = info->par;
par->info = info;
par->spi = spi;

 

And it is crashing at

 

par->rst = pdata->rst_gpio;

par->dc = pdata->dc_gpio;

 

I have attached the error log file.

 

if I comment these two line rest everything is fine but I couldn't see any signals in the CRO.

 

I am suspecting the GPIO's are not getting assigned. can you tell me how to assign & access the GPIO's.

 

 

 

Thanks & Regards,

Satya.

Original Attachment has been moved to: Error-log-file.zip

0 项奖励
回复
1 回复

954 次查看
alejandrolozan1
NXP Employee
NXP Employee

Hi,

You can get the gpios from the dtb using of_get_named_gpio

pwn_gpio = of_get_named_gpio(dev->of_node, "pwn-gpios", 0);

The returned value is an integer. And I assume that pdata->rst_gpio and pdata->dc_gpio are intengers. If so, you can do something like:

pdata->rst_gpio = of_get_named_gpio(dev->of_node, "rst-gpios", 0);

pdata->dc_gpio = of_get_named_gpio(dev->of_node, "dc-gpios", 0);

And I am not sure but

    rst-gpios = <&gpio4 10 0>;

    dc-gpios  = <&gpio3 05 0>;

should be in the LCD node.

I hope that helps,

Alejandro

0 项奖励
回复