Re: need help with GPIO
From: Laxmikant Rashinkar <hidden>
Date: 2008-09-02 17:07:49
Hi Marco, thanks for your feedback. I tried out your suggestion of using an offset address instead of an absolute address in the dts, but that did not help. I am still getting the error: LK_DEBUG: gpio.c : of_get_gpio : /localbus/upm@1,0: gpio controller /soc8349@e0000000/gpio-controller@c00: is not registered thanks LK ----- Original Message ---- From: Marco Stornelli <redacted> To: Laxmikant Rashinkar <redacted> Cc: <redacted> Sent: Monday, September 1, 2008 11:39:05 PM Subject: Re: need help with GPIO Laxmikant Rashinkar ha scritto:
Hi, I have a MPC8347 based embedded PC running Linux 2.6.27. I am trying to access a NAND device connected to the LBC and UPM. The Ready/Busy* pin of the NAND device is connected to the built in GPIO-1 on pin 4 (input). When I try to access the NAND device, the function of_get_gpio() from drivers/of/gpio.c gets called, and it reports that my GPIO is not registered. Here are the actual debug messages: LK_DEBUG: gpio.c : of_get_gpio : name=upm type=<NULL> index=0 LK_DEBUG: gpio.c : of_get_gpio : got property LK_DEBUG: gpio.c : of_get_gpio : nr_cell=3 LK_DEBUG: gpio.c : of_get_gpio : gc.name=gpio-controller gc.type=<NULL> gc->Data=0x0 LK_DEBUG: gpio.c : of_get_gpio : /localbus/upm@1,0: gpio controller /soc8349@e0000000/gpio-controller@e0000c00: is not registered When I check in /proc/device-tree/soc8349@e0000000/, I find that entries are present for both GPIOs are present. Here are debug registration messages, indicating that gpio registered successfully: ##### LK_DEBUG: of_plat_dev_create : NAME=soc8349 ##### LK_DEBUG: of_plat_dev_create : NAME=wdt ##### LK_DEBUG: of_plat_dev_create : NAME=i2c ##### LK_DEBUG: of_plat_dev_create : NAME=i2c ##### LK_DEBUG: of_plat_dev_create : NAME=spi ##### LK_DEBUG: of_plat_dev_create : NAME=dma ##### LK_DEBUG: of_plat_dev_create : NAME=usb ##### LK_DEBUG: of_plat_dev_create : NAME=usb ##### LK_DEBUG: of_plat_dev_create : NAME=mdio ##### LK_DEBUG: of_plat_dev_create : NAME=ethernet ##### LK_DEBUG: of_plat_dev_create : NAME=ethernet ##### LK_DEBUG: of_plat_dev_create : NAME=serial ##### LK_DEBUG: of_plat_dev_create : NAME=serial ##### LK_DEBUG: of_plat_dev_create : NAME=crypto ##### LK_DEBUG: of_plat_dev_create : NAME=pic ##### LK_DEBUG: of_plat_dev_create : NAME=gpio-controller ##### LK_DEBUG: of_plat_dev_create : NAME=gpio-controller ##### LK_DEBUG: of_plat_dev_create : NAME=localbus ##### LK_DEBUG: of_plat_dev_create : NAME=upm Most probably something is wrong in my device tree (listed below). Can someone please point me in the right direction?
Here you are using absolute addresses but you should use an offset from a base reg address, in your case e0000000.
gpio1: gpio-controller@e0000c00 { gpio1: gpio-controller@c00 { #gpio-cells = <2>;
compatible = "fsl,mpc8349-gpio-bank";reg = <0xc00 0x100>;
reg = <0xe0000c00 0x100>;
gpio-controller;
}; gpio2: gpio-controller@d00 { gpio2: gpio-controller@e0000d00 {
#gpio-cells = <2>;
compatible = "fsl,mpc8349-gpio-bank";reg = <0xd00 0x100>;
reg = <0xe0000d00 0x100>;
gpio-controller;
};
};
localbus {
compatible = "fsl,pq3-localbus", "simple-bus";
#address-cells = <2>;
#size-cells = <1>;
reg = <0xe0005000 0x100000>; // BRx, ORx, etc.
upm@1,0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,upm-nand";
reg = <3 0xa0000000 0x800>;
fsl,upm-addr-offset = <0x10>;
fsl,upm-cmd-offset = <0x08>;
gpios = <&gpio1 4 0>;
nand@0 {
#address-cells = <1>;
#size-cells = <1>;
compatible = "fsl,lbc-nand";
partition@0 {
label = "EVERYTHING";
reg = <0x00000000 0x01000000>;
};
};
};
};
pci0: pci@e0008500 {
cell-index = <1>;
interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
interrupt-map = <
/* IDSEL 0x11 */
0x8800 0x0 0x0 0x1 &ipic 20 0x8-- Marco Stornelli Embedded Software Engineer CoRiTeL - Consorzio di Ricerca sulle Telecomunicazioni http://www.coritel.it marco.stornelli@coritel.it +39 06 72582838