public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] soft-i2c and i2c-gpio issues with at91
@ 2015-05-22 14:35 Matt Wood
  2015-05-26  4:30 ` Heiko Schocher
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Wood @ 2015-05-22 14:35 UTC (permalink / raw)
  To: u-boot

Hi all, I am trying to get a bitbanged i2c port working with u-boot on an
Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
drivers however when I try to select the bus on the u-boot command line I
consistently get an error in gpio-uclass:

_gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed

_gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios', failed to
request GPIO index 0: -19

Each driver always fails at the get_dev_by_offset routine.

I suspect some issue with the way the GPIO is defined or is not setup
correctly.  Has anyone seen this or have any advice on where to look?

This is the relevant part of the device tree:

aliases {

                i2c0 = "/soft-i2c at 1";

};


soft-i2c at 1 {

                #address-cells = <1>;

                #size-cells = <0>;

/*              compatible = "soft-i2c"; */

                compatible = "i2c-gpio";

/*              clock-frequency = <100000>; */

/*              pinctrl-names = "default";

                pinctrl-0 = <&pinctrl_soft_i2c>; */

                /* Define the proper GPIO pins */


/*


                clock-pin = <&pioA 31 0>;

                data-pin = <&pioA 30 0>; */

                gpios = <&pioA 30 0     /* SDA */

                         &pioA 31 0>;   /* SCL */


                i2c-gpio,sda-open-drain;

                i2c-gpio,scl-open-drain;

                i2c-gpio,delay-us =<3>;


        };

};


Thanks, Matt.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-22 14:35 [U-Boot] soft-i2c and i2c-gpio issues with at91 Matt Wood
@ 2015-05-26  4:30 ` Heiko Schocher
  2015-05-26 13:47   ` Simon Glass
  0 siblings, 1 reply; 9+ messages in thread
From: Heiko Schocher @ 2015-05-26  4:30 UTC (permalink / raw)
  To: u-boot

Hello Matt,

Am 22.05.2015 16:35, schrieb Matt Wood:
> Hi all, I am trying to get a bitbanged i2c port working with u-boot on an
> Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
> drivers however when I try to select the bus on the u-boot command line I
> consistently get an error in gpio-uclass:

I am not sure, if DM is supported on this plattform yet, I added
Andreas Biesmann (AT91) and Simon Glass (DM) to Cc, maybe one of them
can help you here ...

bye,
Heiko
>
> _gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed
>
> _gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios', failed to
> request GPIO index 0: -19
>
> Each driver always fails at the get_dev_by_offset routine.
>
> I suspect some issue with the way the GPIO is defined or is not setup
> correctly.  Has anyone seen this or have any advice on where to look?
>
> This is the relevant part of the device tree:
>
> aliases {
>
>                  i2c0 = "/soft-i2c at 1";
>
> };
>
>
> soft-i2c at 1 {
>
>                  #address-cells = <1>;
>
>                  #size-cells = <0>;
>
> /*              compatible = "soft-i2c"; */
>
>                  compatible = "i2c-gpio";
>
> /*              clock-frequency = <100000>; */
>
> /*              pinctrl-names = "default";
>
>                  pinctrl-0 = <&pinctrl_soft_i2c>; */
>
>                  /* Define the proper GPIO pins */
>
>
> /*
>
>
>                  clock-pin = <&pioA 31 0>;
>
>                  data-pin = <&pioA 30 0>; */
>
>                  gpios = <&pioA 30 0     /* SDA */
>
>                           &pioA 31 0>;   /* SCL */
>
>
>                  i2c-gpio,sda-open-drain;
>
>                  i2c-gpio,scl-open-drain;
>
>                  i2c-gpio,delay-us =<3>;
>
>
>          };
>
> };
>
>
> Thanks, Matt.
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
>

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-26  4:30 ` Heiko Schocher
@ 2015-05-26 13:47   ` Simon Glass
  2015-05-26 14:33     ` Matt Wood
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2015-05-26 13:47 UTC (permalink / raw)
  To: u-boot

(adding Przemyslaw who uses the I2C GPIO driver)

Hi,

On 25 May 2015 at 22:30, Heiko Schocher <hs@denx.de> wrote:
> Hello Matt,
>
> Am 22.05.2015 16:35, schrieb Matt Wood:
>>
>> Hi all, I am trying to get a bitbanged i2c port working with u-boot on an
>> Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
>> drivers however when I try to select the bus on the u-boot command line I
>> consistently get an error in gpio-uclass:
>
>
> I am not sure, if DM is supported on this plattform yet, I added
> Andreas Biesmann (AT91) and Simon Glass (DM) to Cc, maybe one of them
> can help you here ...
>
> bye,
> Heiko
>
>>
>> _gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed
>>
>> _gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios', failed
>> to
>> request GPIO index 0: -19
>>
>> Each driver always fails at the get_dev_by_offset routine.
>>
>> I suspect some issue with the way the GPIO is defined or is not setup
>> correctly.  Has anyone seen this or have any advice on where to look?
>>
>> This is the relevant part of the device tree:
>>
>> aliases {
>>
>>                  i2c0 = "/soft-i2c at 1";
>>
>> };
>>
>>
>> soft-i2c at 1 {
>>
>>                  #address-cells = <1>;
>>
>>                  #size-cells = <0>;
>>
>> /*              compatible = "soft-i2c"; */
>>
>>                  compatible = "i2c-gpio";
>>
>> /*              clock-frequency = <100000>; */
>>
>> /*              pinctrl-names = "default";
>>
>>                  pinctrl-0 = <&pinctrl_soft_i2c>; */
>>
>>                  /* Define the proper GPIO pins */
>>
>>
>> /*
>>
>>
>>                  clock-pin = <&pioA 31 0>;
>>
>>                  data-pin = <&pioA 30 0>; */
>>
>>                  gpios = <&pioA 30 0     /* SDA */
>>
>>                           &pioA 31 0>;   /* SCL */
>>
>>
>>                  i2c-gpio,sda-open-drain;
>>
>>                  i2c-gpio,scl-open-drain;
>>
>>                  i2c-gpio,delay-us =<3>;
>>
>>
>>          };
>>
>> };

Can you post the output of 'dm tree' and 'dm uclass'? I wonder if your
GPIO driver is not connected up properly?

Are you using i2c-gpio.c? That driver should work as is on any
platform with only device tree additions.

Regards,
Simon

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-26 13:47   ` Simon Glass
@ 2015-05-26 14:33     ` Matt Wood
  2015-05-26 14:41       ` Simon Glass
  0 siblings, 1 reply; 9+ messages in thread
From: Matt Wood @ 2015-05-26 14:33 UTC (permalink / raw)
  To: u-boot

Hi Simon, yes I currently have i2c-gpio enabled.  Below is the output of
both commands.  Looks like the GPIO driver is not setup as you suspected.
However I'm confused on what specifically is needed to enable it.  Are you
talking about a DT entry?  In looking at other DTS files I did not see
anything in particular that called out GPIO.  Can you point me to what I'm
missing?

Thanks, Matt.

U-Boot> dm tree
 Class       Probed   Name
----------------------------------------
 root        [ + ]    root_driver
 simple_bus  [   ]    |-- ahb
 simple_bus  [   ]    |   `-- apb
 simple_bus  [   ]    |       `-- pinctrl at fc06a000
 i2c         [   ]    `-- soft-i2c at 1
U-Boot> dm uclass
uclass 0: root
- * root_driver @ 3fb58028, seq 0, (req -1)

Cannot find uclass for id 1: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 2: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 3: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 4: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 5: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 6: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 7: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 8: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
uclass 9: simple_bus
-   ahb @ 3fb580a0
-   apb @ 3fb580f8
-   pinctrl at fc06a000 @ 3fb58150

uclass 10: gpio
Cannot find uclass for id 11: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 12: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 13: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 14: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 15: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 16: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
uclass 17: i2c
-   soft-i2c at 1 @ 3fb581c8, seq -1, (req 0)

uclass 18: i2c_generic
Cannot find uclass for id 19: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 20: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 21: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 22: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 23: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 24: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 25: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 26: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 27: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 28: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 29: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 30: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 31: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id

On Tue, May 26, 2015 at 9:47 AM, Simon Glass <sjg@chromium.org> wrote:

> (adding Przemyslaw who uses the I2C GPIO driver)
>
> Hi,
>
> On 25 May 2015 at 22:30, Heiko Schocher <hs@denx.de> wrote:
> > Hello Matt,
> >
> > Am 22.05.2015 16:35, schrieb Matt Wood:
> >>
> >> Hi all, I am trying to get a bitbanged i2c port working with u-boot on
> an
> >> Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
> >> drivers however when I try to select the bus on the u-boot command line
> I
> >> consistently get an error in gpio-uclass:
> >
> >
> > I am not sure, if DM is supported on this plattform yet, I added
> > Andreas Biesmann (AT91) and Simon Glass (DM) to Cc, maybe one of them
> > can help you here ...
> >
> > bye,
> > Heiko
> >
> >>
> >> _gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed
> >>
> >> _gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios',
> failed
> >> to
> >> request GPIO index 0: -19
> >>
> >> Each driver always fails at the get_dev_by_offset routine.
> >>
> >> I suspect some issue with the way the GPIO is defined or is not setup
> >> correctly.  Has anyone seen this or have any advice on where to look?
> >>
> >> This is the relevant part of the device tree:
> >>
> >> aliases {
> >>
> >>                  i2c0 = "/soft-i2c at 1";
> >>
> >> };
> >>
> >>
> >> soft-i2c at 1 {
> >>
> >>                  #address-cells = <1>;
> >>
> >>                  #size-cells = <0>;
> >>
> >> /*              compatible = "soft-i2c"; */
> >>
> >>                  compatible = "i2c-gpio";
> >>
> >> /*              clock-frequency = <100000>; */
> >>
> >> /*              pinctrl-names = "default";
> >>
> >>                  pinctrl-0 = <&pinctrl_soft_i2c>; */
> >>
> >>                  /* Define the proper GPIO pins */
> >>
> >>
> >> /*
> >>
> >>
> >>                  clock-pin = <&pioA 31 0>;
> >>
> >>                  data-pin = <&pioA 30 0>; */
> >>
> >>                  gpios = <&pioA 30 0     /* SDA */
> >>
> >>                           &pioA 31 0>;   /* SCL */
> >>
> >>
> >>                  i2c-gpio,sda-open-drain;
> >>
> >>                  i2c-gpio,scl-open-drain;
> >>
> >>                  i2c-gpio,delay-us =<3>;
> >>
> >>
> >>          };
> >>
> >> };
>
> Can you post the output of 'dm tree' and 'dm uclass'? I wonder if your
> GPIO driver is not connected up properly?
>
> Are you using i2c-gpio.c? That driver should work as is on any
> platform with only device tree additions.
>
> Regards,
> Simon
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-26 14:33     ` Matt Wood
@ 2015-05-26 14:41       ` Simon Glass
  2015-05-26 17:23         ` Matt Wood
  0 siblings, 1 reply; 9+ messages in thread
From: Simon Glass @ 2015-05-26 14:41 UTC (permalink / raw)
  To: u-boot

Hi Matt,

On 26 May 2015 at 08:33, Matt Wood <mattwood2000@gmail.com> wrote:
> Hi Simon, yes I currently have i2c-gpio enabled.  Below is the output of
> both commands.  Looks like the GPIO driver is not setup as you suspected.
> However I'm confused on what specifically is needed to enable it.  Are you
> talking about a DT entry?  In looking at other DTS files I did not see
> anything in particular that called out GPIO.  Can you point me to what I'm
> missing?

Looking at the kernel device tree files it looks like the GPIO node is
hidden inside ahb/apb/pinctrl. Since they are all compatible with
'simple-bus' it should still work.

But you will need to create an of_match entry in at91_gpio.c. See
s5p_gpio.c for an example. You should add the compatible ID referenced
in the pioA node of your device tree.

Then you should see GPIO nodes in your driver model tree. Without
these i2c cannot use GPIO.

Regards,
Simon

>
> Thanks, Matt.
>
> U-Boot> dm tree
>  Class       Probed   Name
> ----------------------------------------
>  root        [ + ]    root_driver
>  simple_bus  [   ]    |-- ahb
>  simple_bus  [   ]    |   `-- apb
>  simple_bus  [   ]    |       `-- pinctrl at fc06a000
>  i2c         [   ]    `-- soft-i2c at 1
> U-Boot> dm uclass
> uclass 0: root
> - * root_driver @ 3fb58028, seq 0, (req -1)
>
> Cannot find uclass for id 1: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 2: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 3: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 4: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 5: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 6: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 7: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 8: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> uclass 9: simple_bus
> -   ahb @ 3fb580a0
> -   apb @ 3fb580f8
> -   pinctrl at fc06a000 @ 3fb58150
>
> uclass 10: gpio
> Cannot find uclass for id 11: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 12: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 13: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 14: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 15: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 16: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> uclass 17: i2c
> -   soft-i2c at 1 @ 3fb581c8, seq -1, (req 0)
>
> uclass 18: i2c_generic
> Cannot find uclass for id 19: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 20: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 21: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 22: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 23: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 24: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 25: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 26: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 27: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 28: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 29: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 30: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
> Cannot find uclass for id 31: please add the UCLASS_DRIVER() declaration for
> this UCLASS_... id
>
> On Tue, May 26, 2015 at 9:47 AM, Simon Glass <sjg@chromium.org> wrote:
>>
>> (adding Przemyslaw who uses the I2C GPIO driver)
>>
>> Hi,
>>
>> On 25 May 2015 at 22:30, Heiko Schocher <hs@denx.de> wrote:
>> > Hello Matt,
>> >
>> > Am 22.05.2015 16:35, schrieb Matt Wood:
>> >>
>> >> Hi all, I am trying to get a bitbanged i2c port working with u-boot on
>> >> an
>> >> Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
>> >> drivers however when I try to select the bus on the u-boot command line
>> >> I
>> >> consistently get an error in gpio-uclass:
>> >
>> >
>> > I am not sure, if DM is supported on this plattform yet, I added
>> > Andreas Biesmann (AT91) and Simon Glass (DM) to Cc, maybe one of them
>> > can help you here ...
>> >
>> > bye,
>> > Heiko
>> >
>> >>
>> >> _gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed
>> >>
>> >> _gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios',
>> >> failed
>> >> to
>> >> request GPIO index 0: -19
>> >>
>> >> Each driver always fails at the get_dev_by_offset routine.
>> >>
>> >> I suspect some issue with the way the GPIO is defined or is not setup
>> >> correctly.  Has anyone seen this or have any advice on where to look?
>> >>
>> >> This is the relevant part of the device tree:
>> >>
>> >> aliases {
>> >>
>> >>                  i2c0 = "/soft-i2c at 1";
>> >>
>> >> };
>> >>
>> >>
>> >> soft-i2c at 1 {
>> >>
>> >>                  #address-cells = <1>;
>> >>
>> >>                  #size-cells = <0>;
>> >>
>> >> /*              compatible = "soft-i2c"; */
>> >>
>> >>                  compatible = "i2c-gpio";
>> >>
>> >> /*              clock-frequency = <100000>; */
>> >>
>> >> /*              pinctrl-names = "default";
>> >>
>> >>                  pinctrl-0 = <&pinctrl_soft_i2c>; */
>> >>
>> >>                  /* Define the proper GPIO pins */
>> >>
>> >>
>> >> /*
>> >>
>> >>
>> >>                  clock-pin = <&pioA 31 0>;
>> >>
>> >>                  data-pin = <&pioA 30 0>; */
>> >>
>> >>                  gpios = <&pioA 30 0     /* SDA */
>> >>
>> >>                           &pioA 31 0>;   /* SCL */
>> >>
>> >>
>> >>                  i2c-gpio,sda-open-drain;
>> >>
>> >>                  i2c-gpio,scl-open-drain;
>> >>
>> >>                  i2c-gpio,delay-us =<3>;
>> >>
>> >>
>> >>          };
>> >>
>> >> };
>>
>> Can you post the output of 'dm tree' and 'dm uclass'? I wonder if your
>> GPIO driver is not connected up properly?
>>
>> Are you using i2c-gpio.c? That driver should work as is on any
>> platform with only device tree additions.
>>
>> Regards,
>> Simon
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-26 14:41       ` Simon Glass
@ 2015-05-26 17:23         ` Matt Wood
  2015-05-26 22:40           ` Simon Glass
  2015-05-27 11:32           ` Przemyslaw Marczak
  0 siblings, 2 replies; 9+ messages in thread
From: Matt Wood @ 2015-05-26 17:23 UTC (permalink / raw)
  To: u-boot

Thank you Simon.  Getting there, but now I get a data abort and system
reset when trying to set the i2c bus.  I need to chase this down, but if
you have any suggestions I'd appreciate it.

Below is the output of dm tree and dm uclass.

Thanks, Matt.

U-Boot> i2c dev 3
Setting bus to 3
data abort
pc : [<3ff714a0>]          lr : [<3ff7148c>]
reloc pc : [<26f194a0>]    lr : [<26f1948c>]
sp : 3fb52168  ip : 0000001f     fp : 00000000
r10: 00000003  r9 : 3fb57ee0     r8 : 3ffa5588
r7 : 3ff92ff4  r6 : 3fb581c8     r5 : 0000001f  r4 : 00000000
r3 : 00000001  r2 : 00000000     r1 : 80000000  r0 : ea000016
Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
RomBOOT

U-Boot> dm tree
 Class       Probed   Name
----------------------------------------
 root        [ + ]    root_driver
 simple_bus  [   ]    |-- ahb
 simple_bus  [   ]    |   `-- apb
 simple_bus  [   ]    |       `-- pinctrl at fc06a000
 gpio        [   ]    |           |-- gpio at fc06a000
 gpio        [   ]    |           |-- gpio at fc06b000
 gpio        [   ]    |           |-- gpio at fc06c000
 gpio        [   ]    |           `-- gpio at fc06d000
 i2c         [   ]    `-- gpio-i2c at 1

U-Boot> dm uclass
uclass 0: root
- * root_driver @ 3fb58028, seq 0, (req -1)

Cannot find uclass for id 1: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 2: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 3: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 4: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 5: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 6: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 7: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
Cannot find uclass for id 8: please add the UCLASS_DRIVER() declaration for
this UCLASS_... id
uclass 9: simple_bus
-   ahb @ 3fb580a0
-   apb @ 3fb580f8
-   pinctrl at fc06a000 @ 3fb58150

uclass 10: gpio
-   gpio at fc06a000 @ 3fb581c8
-   gpio at fc06b000 @ 3fb58220
-   gpio at fc06c000 @ 3fb58278
-   gpio at fc06d000 @ 3fb582d0

Cannot find uclass for id 11: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 12: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 13: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 14: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 15: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 16: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
uclass 17: i2c
-   gpio-i2c at 1 @ 3fb58348, seq -1, (req 3)

uclass 18: i2c_generic
Cannot find uclass for id 19: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 20: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 21: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 22: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 23: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 24: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 25: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 26: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 27: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 28: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 29: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 30: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id
Cannot find uclass for id 31: please add the UCLASS_DRIVER() declaration
for this UCLASS_... id

On Tue, May 26, 2015 at 10:41 AM, Simon Glass <sjg@chromium.org> wrote:

> Hi Matt,
>
> On 26 May 2015 at 08:33, Matt Wood <mattwood2000@gmail.com> wrote:
> > Hi Simon, yes I currently have i2c-gpio enabled.  Below is the output of
> > both commands.  Looks like the GPIO driver is not setup as you suspected.
> > However I'm confused on what specifically is needed to enable it.  Are
> you
> > talking about a DT entry?  In looking at other DTS files I did not see
> > anything in particular that called out GPIO.  Can you point me to what
> I'm
> > missing?
>
> Looking at the kernel device tree files it looks like the GPIO node is
> hidden inside ahb/apb/pinctrl. Since they are all compatible with
> 'simple-bus' it should still work.
>
> But you will need to create an of_match entry in at91_gpio.c. See
> s5p_gpio.c for an example. You should add the compatible ID referenced
> in the pioA node of your device tree.
>
> Then you should see GPIO nodes in your driver model tree. Without
> these i2c cannot use GPIO.
>
> Regards,
> Simon
>
> >
> > Thanks, Matt.
> >
> > U-Boot> dm tree
> >  Class       Probed   Name
> > ----------------------------------------
> >  root        [ + ]    root_driver
> >  simple_bus  [   ]    |-- ahb
> >  simple_bus  [   ]    |   `-- apb
> >  simple_bus  [   ]    |       `-- pinctrl at fc06a000
> >  i2c         [   ]    `-- soft-i2c at 1
> > U-Boot> dm uclass
> > uclass 0: root
> > - * root_driver @ 3fb58028, seq 0, (req -1)
> >
> > Cannot find uclass for id 1: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 2: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 3: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 4: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 5: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 6: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 7: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 8: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > uclass 9: simple_bus
> > -   ahb @ 3fb580a0
> > -   apb @ 3fb580f8
> > -   pinctrl at fc06a000 @ 3fb58150
> >
> > uclass 10: gpio
> > Cannot find uclass for id 11: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 12: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 13: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 14: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 15: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 16: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > uclass 17: i2c
> > -   soft-i2c at 1 @ 3fb581c8, seq -1, (req 0)
> >
> > uclass 18: i2c_generic
> > Cannot find uclass for id 19: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 20: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 21: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 22: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 23: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 24: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 25: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 26: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 27: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 28: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 29: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 30: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> > Cannot find uclass for id 31: please add the UCLASS_DRIVER() declaration
> for
> > this UCLASS_... id
> >
> > On Tue, May 26, 2015 at 9:47 AM, Simon Glass <sjg@chromium.org> wrote:
> >>
> >> (adding Przemyslaw who uses the I2C GPIO driver)
> >>
> >> Hi,
> >>
> >> On 25 May 2015 at 22:30, Heiko Schocher <hs@denx.de> wrote:
> >> > Hello Matt,
> >> >
> >> > Am 22.05.2015 16:35, schrieb Matt Wood:
> >> >>
> >> >> Hi all, I am trying to get a bitbanged i2c port working with u-boot
> on
> >> >> an
> >> >> Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
> >> >> drivers however when I try to select the bus on the u-boot command
> line
> >> >> I
> >> >> consistently get an error in gpio-uclass:
> >> >
> >> >
> >> > I am not sure, if DM is supported on this plattform yet, I added
> >> > Andreas Biesmann (AT91) and Simon Glass (DM) to Cc, maybe one of them
> >> > can help you here ...
> >> >
> >> > bye,
> >> > Heiko
> >> >
> >> >>
> >> >> _gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed
> >> >>
> >> >> _gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios',
> >> >> failed
> >> >> to
> >> >> request GPIO index 0: -19
> >> >>
> >> >> Each driver always fails at the get_dev_by_offset routine.
> >> >>
> >> >> I suspect some issue with the way the GPIO is defined or is not setup
> >> >> correctly.  Has anyone seen this or have any advice on where to look?
> >> >>
> >> >> This is the relevant part of the device tree:
> >> >>
> >> >> aliases {
> >> >>
> >> >>                  i2c0 = "/soft-i2c at 1";
> >> >>
> >> >> };
> >> >>
> >> >>
> >> >> soft-i2c at 1 {
> >> >>
> >> >>                  #address-cells = <1>;
> >> >>
> >> >>                  #size-cells = <0>;
> >> >>
> >> >> /*              compatible = "soft-i2c"; */
> >> >>
> >> >>                  compatible = "i2c-gpio";
> >> >>
> >> >> /*              clock-frequency = <100000>; */
> >> >>
> >> >> /*              pinctrl-names = "default";
> >> >>
> >> >>                  pinctrl-0 = <&pinctrl_soft_i2c>; */
> >> >>
> >> >>                  /* Define the proper GPIO pins */
> >> >>
> >> >>
> >> >> /*
> >> >>
> >> >>
> >> >>                  clock-pin = <&pioA 31 0>;
> >> >>
> >> >>                  data-pin = <&pioA 30 0>; */
> >> >>
> >> >>                  gpios = <&pioA 30 0     /* SDA */
> >> >>
> >> >>                           &pioA 31 0>;   /* SCL */
> >> >>
> >> >>
> >> >>                  i2c-gpio,sda-open-drain;
> >> >>
> >> >>                  i2c-gpio,scl-open-drain;
> >> >>
> >> >>                  i2c-gpio,delay-us =<3>;
> >> >>
> >> >>
> >> >>          };
> >> >>
> >> >> };
> >>
> >> Can you post the output of 'dm tree' and 'dm uclass'? I wonder if your
> >> GPIO driver is not connected up properly?
> >>
> >> Are you using i2c-gpio.c? That driver should work as is on any
> >> platform with only device tree additions.
> >>
> >> Regards,
> >> Simon
> >
> >
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-26 17:23         ` Matt Wood
@ 2015-05-26 22:40           ` Simon Glass
  2015-05-27 11:32           ` Przemyslaw Marczak
  1 sibling, 0 replies; 9+ messages in thread
From: Simon Glass @ 2015-05-26 22:40 UTC (permalink / raw)
  To: u-boot

Hi Matt,

On 26 May 2015 at 11:23, Matt Wood <mattwood2000@gmail.com> wrote:
>
> Thank you Simon.  Getting there, but now I get a data abort and system reset when trying to set the i2c bus.  I need to chase this down, but if you have any suggestions I'd appreciate it.

Suggest putting your reply at the bottom so people on the mailing list
can follow it.

>
> Below is the output of dm tree and dm uclass.
>
> Thanks, Matt.
>
> U-Boot> i2c dev 3
> Setting bus to 3
> data abort
> pc : [<3ff714a0>]          lr : [<3ff7148c>]
> reloc pc : [<26f194a0>]    lr : [<26f1948c>]

You can look in System.map to find that reloc pc, or even addr2line if you like.

This will probe your device. So check that your probe() method is
correct. You can post it here if you like.

> sp : 3fb52168  ip : 0000001f     fp : 00000000
> r10: 00000003  r9 : 3fb57ee0     r8 : 3ffa5588
> r7 : 3ff92ff4  r6 : 3fb581c8     r5 : 0000001f  r4 : 00000000
> r3 : 00000001  r2 : 00000000     r1 : 80000000  r0 : ea000016
> Flags: nzCv  IRQs off  FIQs off  Mode SVC_32
> Resetting CPU ...
>
> resetting ...
> RomBOOT
>
> U-Boot> dm tree
>  Class       Probed   Name
> ----------------------------------------
>  root        [ + ]    root_driver
>  simple_bus  [   ]    |-- ahb
>  simple_bus  [   ]    |   `-- apb
>  simple_bus  [   ]    |       `-- pinctrl at fc06a000
>  gpio        [   ]    |           |-- gpio at fc06a000
>  gpio        [   ]    |           |-- gpio at fc06b000
>  gpio        [   ]    |           |-- gpio at fc06c000
>  gpio        [   ]    |           `-- gpio at fc06d000
>  i2c         [   ]    `-- gpio-i2c at 1

Do you have a reg property? It should be the address of this I2C
peripheral in the memory map.

>
> U-Boot> dm uclass
> uclass 0: root
> - * root_driver @ 3fb58028, seq 0, (req -1)
>
> Cannot find uclass for id 1: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 2: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 3: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 4: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 5: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 6: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 7: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 8: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> uclass 9: simple_bus
> -   ahb @ 3fb580a0
> -   apb @ 3fb580f8
> -   pinctrl at fc06a000 @ 3fb58150
>
> uclass 10: gpio
> -   gpio at fc06a000 @ 3fb581c8
> -   gpio at fc06b000 @ 3fb58220
> -   gpio at fc06c000 @ 3fb58278
> -   gpio at fc06d000 @ 3fb582d0
>
> Cannot find uclass for id 11: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 12: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 13: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 14: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 15: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 16: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> uclass 17: i2c
> -   gpio-i2c at 1 @ 3fb58348, seq -1, (req 3)
>
> uclass 18: i2c_generic
> Cannot find uclass for id 19: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 20: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 21: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 22: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 23: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 24: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 25: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 26: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 27: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 28: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 29: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 30: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
> Cannot find uclass for id 31: please add the UCLASS_DRIVER() declaration for this UCLASS_... id
>
> On Tue, May 26, 2015 at 10:41 AM, Simon Glass <sjg@chromium.org> wrote:
>>
>> Hi Matt,
>>
>> On 26 May 2015 at 08:33, Matt Wood <mattwood2000@gmail.com> wrote:
>> > Hi Simon, yes I currently have i2c-gpio enabled.  Below is the output of
>> > both commands.  Looks like the GPIO driver is not setup as you suspected.
>> > However I'm confused on what specifically is needed to enable it.  Are you
>> > talking about a DT entry?  In looking at other DTS files I did not see
>> > anything in particular that called out GPIO.  Can you point me to what I'm
>> > missing?
>>
>> Looking at the kernel device tree files it looks like the GPIO node is
>> hidden inside ahb/apb/pinctrl. Since they are all compatible with
>> 'simple-bus' it should still work.
>>
>> But you will need to create an of_match entry in at91_gpio.c. See
>> s5p_gpio.c for an example. You should add the compatible ID referenced
>> in the pioA node of your device tree.
>>
>> Then you should see GPIO nodes in your driver model tree. Without
>> these i2c cannot use GPIO.
>>
>> Regards,
>> Simon
>>
>> >
>> > Thanks, Matt.
>> >
>> > U-Boot> dm tree
>> >  Class       Probed   Name
>> > ----------------------------------------
>> >  root        [ + ]    root_driver
>> >  simple_bus  [   ]    |-- ahb
>> >  simple_bus  [   ]    |   `-- apb
>> >  simple_bus  [   ]    |       `-- pinctrl at fc06a000
>> >  i2c         [   ]    `-- soft-i2c at 1
>> > U-Boot> dm uclass
>> > uclass 0: root
>> > - * root_driver @ 3fb58028, seq 0, (req -1)
>> >
>> > Cannot find uclass for id 1: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 2: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 3: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 4: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 5: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 6: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 7: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 8: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > uclass 9: simple_bus
>> > -   ahb @ 3fb580a0
>> > -   apb @ 3fb580f8
>> > -   pinctrl at fc06a000 @ 3fb58150
>> >
>> > uclass 10: gpio
>> > Cannot find uclass for id 11: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 12: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 13: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 14: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 15: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 16: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > uclass 17: i2c
>> > -   soft-i2c at 1 @ 3fb581c8, seq -1, (req 0)
>> >
>> > uclass 18: i2c_generic
>> > Cannot find uclass for id 19: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 20: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 21: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 22: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 23: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 24: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 25: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 26: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 27: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 28: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 29: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 30: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> > Cannot find uclass for id 31: please add the UCLASS_DRIVER() declaration for
>> > this UCLASS_... id
>> >
>> > On Tue, May 26, 2015 at 9:47 AM, Simon Glass <sjg@chromium.org> wrote:
>> >>
>> >> (adding Przemyslaw who uses the I2C GPIO driver)
>> >>
>> >> Hi,
>> >>
>> >> On 25 May 2015 at 22:30, Heiko Schocher <hs@denx.de> wrote:
>> >> > Hello Matt,
>> >> >
>> >> > Am 22.05.2015 16:35, schrieb Matt Wood:
>> >> >>
>> >> >> Hi all, I am trying to get a bitbanged i2c port working with u-boot on
>> >> >> an
>> >> >> Atmel SAMA5D3 platform.  I have added DT bindings to support the I2C
>> >> >> drivers however when I try to select the bus on the u-boot command line
>> >> >> I
>> >> >> consistently get an error in gpio-uclass:
>> >> >
>> >> >
>> >> > I am not sure, if DM is supported on this plattform yet, I added
>> >> > Andreas Biesmann (AT91) and Simon Glass (DM) to Cc, maybe one of them
>> >> > can help you here ...
>> >> >
>> >> > bye,
>> >> > Heiko
>> >> >
>> >> >>
>> >> >> _gpio_request_by_name_nodev: uclass_get_device_by_of_offset failed
>> >> >>
>> >> >> _gpio_request_by_name_nodev: Node 'soft-i2c at 1', property 'gpios',
>> >> >> failed
>> >> >> to
>> >> >> request GPIO index 0: -19
>> >> >>
>> >> >> Each driver always fails at the get_dev_by_offset routine.
>> >> >>
>> >> >> I suspect some issue with the way the GPIO is defined or is not setup
>> >> >> correctly.  Has anyone seen this or have any advice on where to look?
>> >> >>
>> >> >> This is the relevant part of the device tree:
>> >> >>
>> >> >> aliases {
>> >> >>
>> >> >>                  i2c0 = "/soft-i2c at 1";
>> >> >>
>> >> >> };
>> >> >>
>> >> >>
>> >> >> soft-i2c at 1 {
>> >> >>
>> >> >>                  #address-cells = <1>;
>> >> >>
>> >> >>                  #size-cells = <0>;
>> >> >>
>> >> >> /*              compatible = "soft-i2c"; */
>> >> >>
>> >> >>                  compatible = "i2c-gpio";
>> >> >>
>> >> >> /*              clock-frequency = <100000>; */
>> >> >>
>> >> >> /*              pinctrl-names = "default";
>> >> >>
>> >> >>                  pinctrl-0 = <&pinctrl_soft_i2c>; */
>> >> >>
>> >> >>                  /* Define the proper GPIO pins */
>> >> >>
>> >> >>
>> >> >> /*
>> >> >>
>> >> >>
>> >> >>                  clock-pin = <&pioA 31 0>;
>> >> >>
>> >> >>                  data-pin = <&pioA 30 0>; */
>> >> >>
>> >> >>                  gpios = <&pioA 30 0     /* SDA */
>> >> >>
>> >> >>                           &pioA 31 0>;   /* SCL */
>> >> >>
>> >> >>
>> >> >>                  i2c-gpio,sda-open-drain;
>> >> >>
>> >> >>                  i2c-gpio,scl-open-drain;
>> >> >>
>> >> >>                  i2c-gpio,delay-us =<3>;
>> >> >>
>> >> >>
>> >> >>          };
>> >> >>
>> >> >> };
>> >>
>> >> Can you post the output of 'dm tree' and 'dm uclass'? I wonder if your
>> >> GPIO driver is not connected up properly?
>> >>
>> >> Are you using i2c-gpio.c? That driver should work as is on any
>> >> platform with only device tree additions.
>> >>
>> >> Regards,
>> >> Simon
>> >
>> >
>
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-26 17:23         ` Matt Wood
  2015-05-26 22:40           ` Simon Glass
@ 2015-05-27 11:32           ` Przemyslaw Marczak
  2015-05-27 19:21             ` Matt Wood
  1 sibling, 1 reply; 9+ messages in thread
From: Przemyslaw Marczak @ 2015-05-27 11:32 UTC (permalink / raw)
  To: u-boot

Hi all,

On 05/26/2015 07:23 PM, Matt Wood wrote:
> Thank you Simon.  Getting there, but now I get a data abort and system
> reset when trying to set the i2c bus.  I need to chase this down, but if
> you have any suggestions I'd appreciate it.
>
> Below is the output of dm tree and dm uclass.
>
> Thanks, Matt.
>
> U-Boot> i2c dev 3

...snip...

You should first be sure that dm gpio for your board is working properly.

Are you able to test the output state of some GPIOs on your board, e.g. 
by the LED?
If yes, then you can test it with gpio command or just using some 
dm_gpio..() calls for some GPIO with the LED.

And about your data abort.
I can't check your board config/driver at present but will try to give 
you a quick suggestion.

So, when you type i2c dev 3, then the i2c device:

"gpio-i2c at 1 @ 3fb58348, seq -1, (req 3)"

  with alias number 3 (as you requested) is probed.

One of the routine is calling the function:
  * i2c_gpio_ofdata_to_platdata() in gpio-i2c.c - probably succeeds.

Then,
* post_probe() of i2c uclass is called, and next:
* i2c_post_probe() - from drivers/i2c/i2c-uclass.c, this goes to:
* i2c_gpio_set_bus_speed() - from gpio-i2c.c

And here probably starts the magic which ends by data abort.
The driver just operates on GPIOs defined in your device tree.

If you enable the gpio command (CONFIG_CMD_GPIO), then you can easy 
test, that change state of some GPIO pins works properly, or you can 
make some test by printing the results of dm_gpio..() calls in somewhere.

Best regards,
--
Przemyslaw Marczak
Samsung R&D Institute Poland
Samsung Electronics
p.marczak at samsung.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] soft-i2c and i2c-gpio issues with at91
  2015-05-27 11:32           ` Przemyslaw Marczak
@ 2015-05-27 19:21             ` Matt Wood
  0 siblings, 0 replies; 9+ messages in thread
From: Matt Wood @ 2015-05-27 19:21 UTC (permalink / raw)
  To: u-boot

On Wed, May 27, 2015 at 7:32 AM, Przemyslaw Marczak <p.marczak@samsung.com>
wrote:

> Hi all,
>
> On 05/26/2015 07:23 PM, Matt Wood wrote:
>
>> Thank you Simon.  Getting there, but now I get a data abort and system
>> reset when trying to set the i2c bus.  I need to chase this down, but if
>> you have any suggestions I'd appreciate it.
>>
>> Below is the output of dm tree and dm uclass.
>>
>> Thanks, Matt.
>>
>> U-Boot> i2c dev 3
>>
>
> ...snip...
>
> You should first be sure that dm gpio for your board is working properly.
>
> Are you able to test the output state of some GPIOs on your board, e.g. by
> the LED?
> If yes, then you can test it with gpio command or just using some
> dm_gpio..() calls for some GPIO with the LED.
>
> And about your data abort.
> I can't check your board config/driver at present but will try to give you
> a quick suggestion.
>
> So, when you type i2c dev 3, then the i2c device:
>
> "gpio-i2c at 1 @ 3fb58348, seq -1, (req 3)"
>
>  with alias number 3 (as you requested) is probed.
>
> One of the routine is calling the function:
>  * i2c_gpio_ofdata_to_platdata() in gpio-i2c.c - probably succeeds.
>
> Then,
> * post_probe() of i2c uclass is called, and next:
> * i2c_post_probe() - from drivers/i2c/i2c-uclass.c, this goes to:
> * i2c_gpio_set_bus_speed() - from gpio-i2c.c
>
> And here probably starts the magic which ends by data abort.
> The driver just operates on GPIOs defined in your device tree.
>
> If you enable the gpio command (CONFIG_CMD_GPIO), then you can easy test,
> that change state of some GPIO pins works properly, or you can make some
> test by printing the results of dm_gpio..() calls in somewhere.
>
> Best regards,
> --
> Przemyslaw Marczak
> Samsung R&D Institute Poland
> Samsung Electronics
> p.marczak at samsung.com


OK very interesting, I enabled CONFIG_CMD_GPIO and if I do a "gpio status"
I get a data abort and reset, however if I simply do a "gpio
set/clear/toggle ..." on a known pin, the output of the pin changes
accordingly.  I'm not sure specifically what this means but I know the GPIO
driver model is at least partly working.

Anyway, due to time constraints I went back to the old I2C driver interface
as I don't have time to debug this anymore:
https://github.com/linux4sam/u-boot-at91/commit/7ff618b526a04b7fb72df1a3e04a91fe40b6ccf3

Thanks Josh for pointing me to this, I can successfully read the EEPROM I'm
after.

Regards, Matt.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-05-27 19:21 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-22 14:35 [U-Boot] soft-i2c and i2c-gpio issues with at91 Matt Wood
2015-05-26  4:30 ` Heiko Schocher
2015-05-26 13:47   ` Simon Glass
2015-05-26 14:33     ` Matt Wood
2015-05-26 14:41       ` Simon Glass
2015-05-26 17:23         ` Matt Wood
2015-05-26 22:40           ` Simon Glass
2015-05-27 11:32           ` Przemyslaw Marczak
2015-05-27 19:21             ` Matt Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox