[U-Boot] Pincontroller not getting initialized on imx6 in SPL with SPL_PINCTRL and OF_CONTROL

Simon Glass sjg at chromium.org
Sun Mar 10 21:51:01 UTC 2019


HI Adam,

On Fri, 22 Feb 2019 at 12:22, Adam Ford <aford173 at gmail.com> wrote:
>
> On Wed, Feb 20, 2019 at 11:38 AM Adam Ford <aford173 at gmail.com> wrote:
> >
> > On Wed, Feb 20, 2019 at 10:09 AM Lokesh Vutla <lokeshvutla at ti.com> wrote:
> > >
> > >
> > >
> > > On 2/20/2019 8:46 PM, Adam Ford wrote:
> > > > On Wed, Feb 20, 2019 at 7:49 AM Lokesh Vutla <lokeshvutla at ti.com> wrote:
> > > >>
> > > >> Hi Adam,
> > > >>
> > > >> On 20/02/19 7:01 PM, Adam Ford wrote:
> > > >>> I am trying to remove the manual pinmuxing code from the board file.
> > > >>> In an effort to accomplish this, I am trying to get SPL_OF_CONTROL and
> > > >>> SPL_PINCTRL to let me use the device tree(s) to initialize pin muxing.
> > > >>>
> > > >>> I have the following defined:
> > > >>>
> > > >>> CONFIG_SPL_PINCTRL=y
> > > >>> CONFIG_SPL_PINCTRL_FULL=y
> > > >>> CONFIG_SPL_PINCTRL_GENERIC=y
> > > >>> CONFIG_SPL_PINMUX=y
> > > >>>
> > > >>> along with
> > > >>> CONFIG_PINCTRL_IMX=y
> > > >>> CONFIG_PINCTRL_IMX6=y
> > > >>>
> > > >>> I put some debugging code into the imx6 pinctrl and I can see that
> > > >>> U-Boot initializes it, but that same debug message doesn't appear in
> > > >>> SPL.
> > > >>>
> > > >>> I looked through the spl build directory, and I can see the drivers
> > > >>> have been built, and the map file shows they exist, but for some
> > > >>> reason, it doesn't initalize.  If I remove the UART pin-muxing from my
> > > >>> board file, the text for SPL doesn't' appear at all, so it's clear
> > > >>> pinctrl isn't setting up the proper muxing yet.
> > > >>>
> > > >>> I am trying to figure out how/where the pinctrl system gets
> > > >>> initialized in SPL, and I was hoping someone might have some insight.
> > > >>
> > > >> Pinctrl will be set as part of device_probe() call[1] for each device.
> > > >
> > > > Thanks for the quick reply.  I took your suggestion and did a little
> > > > more digging.
> > > >
> > > >>
> > > >> Have you added u-boot,dm-spl for your pinctrl nodes? Try de-compiling spl dts
> > > >> and check if all required nodes are available.
> > > >
> > > > u-boot,dm-spl  is setup in a common imx6qdl-u-boot.dtsi file.  The spl
> > > > decompiled device tree show it.
> > > >
> > > > iomuxc at 20e0000 {
> > > >      compatible = "fsl,imx6q-iomuxc";
> > > >      reg = < 0x20e0000 0x4000 >;
> > > >      pinctrl-names = "default";
> > > >      pinctrl-0 = < 0x2b >;
> > > >      u-boot,dm-spl;
> > > >      phandle = < 0x21 >;
> > > >
> > > >      uart1grp {
> > > >           fsl,pins = < 0x2ac 0x694 0x920 0x01 0x03 0x1b0b1 0x2a8 0x690
> > > > 0x00 0x01 0x00 0x1b0b1 >;
> > > >           u-boot,dm-spl;
> > > >           phandle = < 0x1d >;
> > > >      };
> > > > };
> > > >
> > > > With some debugging enabled during the fdtdec, I can see some chatter
> > > > and references to it, but it looks like it cannot find it.
> > > >
> > > > U-Boot SPL 2019.04-rc2-03217-g2d08aa679e-dirty (Feb 20 2019 - 08:15:13 -0600)
> > > > fdtdec_get_int_array: ranges
> > > > get_prop_check_min_len: ranges
> > > > fdtdec_get_int_array: ranges
> > > > get_prop_check_min_len: ranges
> > > > Looking for 'gpio' at 1224, name gpio at 209c000
> > > >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> > > > Found seq 0
> > > > Looking for 'pinctrl' at 1700, name iomuxc at 20e0000
> > > >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> > > >    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
> > > >    - mmc1, /soc/aips-bus at 2100000/usdhc at 2194000
> > > >    - serial0, /soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2020000
> > > > Not found
> > > > fdtdec_get_int_array: ranges
> > > > get_prop_check_min_len: ranges
> > > > Looking for 'mmc' at 2940, name usdhc at 2190000
> > > >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> > > >    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
> > > > Found seq 0
> > > > Looking for 'mmc' at 3200, name usdhc at 2194000
> > > >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> > > >    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
> > > >    - mmc1, /soc/aips-bus at 2100000/usdhc at 2194000
> > > > Found seq 1
> > > > Trying to boot from USB SDP
> > > > SDP: initialize...
> > > > SDP: handle requests...
> > > > Downloading file of size 613070 to 0x177fffc0... done
> > > > Jumping to header at 0x177fffc0
> > > > Header Tag is not an IMX image
> > > >
> > > > What's interesting is that when looking for gpio and the two various
> > > > mmc's, the above function returns 'Found seq x' in SPL whereas the
> > > > pinctrl returns 'Not found'
> > >
> > > Okay, most likely your pinctrl driver is not ready yet.
> > > Your driver does not enables DM_FLAG_PRE_RELOC.
> > >
> > >  52 #if !CONFIG_IS_ENABLED(OF_CONTROL)
> > >  53         .flags = DM_FLAG_PRE_RELOC,
> > >  54 #endif
> > >
> > >
> > > Can you enable it and try again?
> >
> > I tried forcing the DM_FLAG_PRE_RELOC and I tried making various nodes
> > in the device tree u-boot,dm-pre-reloc instead of just u-boot,dm-spl;
> >
> > Either way I still can't get it to load.
> >
> > U-Boot SPL 2019.04-rc2-03218-gace08a038c-dirty (Feb 20 2019 - 11:30:08 -0600)
> > fdtdec_get_int_array: ranges
> > get_prop_check_min_len: ranges
> > fdtdec_get_int_array: ranges
> > get_prop_check_min_len: ranges
> > fdtdec_get_int_array: ranges
> > get_prop_check_min_len: ranges
> > Looking for 'gpio' at 1324, name gpio at 209c000
> >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> > Found seq 0
> > Looking for 'pinctrl' at 1800, name iomuxc at 20e0000
> >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> >    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
> >    - mmc1, /soc/aips-bus at 2100000/usdhc at 2194000
> >    - serial0, /soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2020000
> > Not found
> > fdtdec_get_int_array: ranges
> > get_prop_check_min_len: ranges
> > Looking for 'mmc' at 3040, name usdhc at 2190000
> >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> >    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
> > Found seq 0
> > Looking for 'mmc' at 3300, name usdhc at 2194000
> >    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> >    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
> >    - mmc1, /soc/aips-bus at 2100000/usdhc at 2194000
> > Found seq 1
> > Trying to boot from USB SDP
> > SDP: initialize...
> > SDP: handle requests...
> > Downloading file of size 613090 to 0x177fffc0... done
> > Jumping to header at 0x177fffc0
> > Header Tag is not an IMX image
> >
> > I still get nothing.
> >
> > Any thought as to why the 'pinctrl' node would be missing?  I would
> > expect something like '/soc/aips-bus at 2000000/iomuxc at 20e0000' to appear
> > in the list. Does it need an alias somehow?
> >
> > adam
> >
> > >
> > > Thanks and regards,
> > > Lokesh
> > >
> > > >
> > > > I looked at the U-Boot part of the log and it also returns 'Not Found'
> > > > but later in the sequence it initializes anyway.
> > > >
> > > > Looking for 'pinctrl' at 19064, name iomuxc at 20e0000
> > > >    - ethernet0, /soc/aips-bus at 2100000/ethernet at 2188000
> > > >   ... [bunch of entries deleted]
> > > >    - spi4, /soc/aips-bus at 2000000/spba-bus at 2000000/spi at 2018000
> > > > Not found
> > > >
> > > > Late this picks up, and we start initializing pins.  It seems like
> > > > something is manually calling the pinmux since the driver probe fails,
> > > > but it's not clear to me why it might fail.
> > > >
> > > >
> > > > Found seq 2
> > > > fdtdec_get_addr_size_fixed: reg: addr=020e0000, size=4000
> > > > fdtdec_get_bool: fsl,input-sel
> > > >
> > > > (see my added debug line)
> > > > initialized IMX pinctrl driver
> > > >
> > > > fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > > fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > > fdtdec_get_bool: fsl,dte-modes ʊ�  �1024 MiB
> > > > MMC:   fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > > fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > > fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > > FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> > > > fdtdec_get_config_int: load-environment
> > > > Loading Environment from NAND... OK
> > > > In:    serial
> > > > Out:   serial
> > > > Err:   serial
> > > > Net:   fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > > fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > >
> > > > Error: ethernet at 2188000 address not set.
> > > > fdtdec_get_int_array: fsl,pins
> > > > get_prop_check_min_len: fsl,pins
> > > >
> > > > Error: ethernet at 2188000 address not set.
> > > > eth-1: ethernet at 2188000
> > > > fdtdec_get_config_int: bootdelay
> > > > fdtdec_get_config_int: kernel-offset
> > > > fdtdec_get_config_int: rootdisk-offset
> > > > fdtdec_get_config_string: bootcmd
> > > > fdtdec_get_config_int: bootsecure
> > > > Hit any key to stop autoboot:  0
> > > > i.MX6 Logic #
> > > >
> > > >
> > > > adam
> > > >>
> > > >>
> > > >> [1]
> > > >> http://git.denx.de/?p=u-boot.git;a=blob;f=drivers/core/device.c;h=0d15e5062b66123cd364bd9803e076db7e7dd97c;hb=HEAD#l383
> > > >>
>
> Using your suggestion, looked at device.c and dug a little deeper and
> turned on more debugging.
>
> What I am finding is that the device tree is being assembled and
> various nodes are being bound to each other, but unfortunately, the
> probes never start.  I found a few boards (imx8 being one) where there
> is a dedicated spl which have probe functions, but I was hoping
> someone might be able to point me to the functions that actually call
> the probes so I can see if they're actually getting called and/or
> failing.
>
> U-Boot SPL 2019.04-rc2-03218-gace08a038c-dirty (Feb 21 2019 - 18:17:23 -0600)
> uclass_find_device_by_seq: 0 -1
> uclass_find_device_by_seq: 0 0
>    - -1 -1 'root_driver'
>    - not found
> parsing subnodes of "chosen"
> bind node aliases
> Device 'aliases' has no compatible string
> bind node soc
>    - attempt to match compatible string 'simple-bus'
> ofnode_read_bool: u-boot,dm-pre-reloc: false
> ofnode_read_bool: u-boot,dm-spl: true
>    - found match at 'generic_simple_bus'
> ofnode_read_u32_array: ranges: fdtdec_get_int_array: ranges
> get_prop_check_min_len: ranges
> bind node gpmi-nand at 112000
>    - attempt to match compatible string 'fsl,imx6q-gpmi-nand'
> No match for node 'gpmi-nand at 112000'
> bind node aips-bus at 2000000
>    - attempt to match compatible string 'fsl,aips-bus'
>    - attempt to match compatible string 'simple-bus'
> ofnode_read_bool: u-boot,dm-pre-reloc: false
> ofnode_read_bool: u-boot,dm-spl: true
>    - found match at 'generic_simple_bus'
> ofnode_read_u32_array: ranges: fdtdec_get_int_array: ranges
> get_prop_check_min_len: ranges
> bind node spba-bus at 2000000
>    - attempt to match compatible string 'fsl,spba-bus'
>    - attempt to match compatible string 'simple-bus'
> ofnode_read_bool: u-boot,dm-pre-reloc: false
> ofnode_read_bool: u-boot,dm-spl: true
>    - found match at 'generic_simple_bus'
> ofnode_read_u32_array: ranges: fdtdec_get_int_array: ranges
> get_prop_check_min_len: ranges
> bind node serial at 2020000
>    - attempt to match compatible string 'fsl,imx6q-uart'
>    - attempt to match compatible string 'fsl,imx21-uart'
> No match for node 'serial at 2020000'
> Bound device spba-bus at 2000000 to aips-bus at 2000000
> bind node gpio at 209c000
>    - attempt to match compatible string 'fsl,imx6q-gpio'
>    - attempt to match compatible string 'fsl,imx35-gpio'
> ofnode_read_bool: u-boot,dm-pre-reloc: false
> ofnode_read_bool: u-boot,dm-spl: true
>    - found match at 'gpio_mxc'
> Looking for 'gpio' at 1356, name gpio at 209c000
>    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
> Found seq 0
> Bound device gpio at 209c000 to aips-bus at 2000000
> bind node iomuxc at 20e0000
>    - attempt to match compatible string 'fsl,imx6q-iomuxc'
> ofnode_read_bool: u-boot,dm-pre-reloc: false
> ofnode_read_bool: u-boot,dm-spl: true
>    - found match at 'imx6-pinctrl'
> Looking for 'pinctrl' at 1832, name iomuxc at 20e0000
>    - gpio0, /soc/aips-bus at 2000000/gpio at 209c000
>    - mmc0, /soc/aips-bus at 2100000/usdhc at 2190000
>    - mmc1, /soc/aips-bus at 2100000/usdhc at 2194000
>    - serial0, /soc/aips-bus at 2000000/spba-bus at 2000000/serial at 2020000
> Not found

This seems odd. It is looking up an alias for pinctrl. This means that
there needs to be a pinctrl0 alias. This is probably a call to
uclass_get_device(). Is that valid, or should it be calling
uclass_first_device_err()?
[..]

Regards,
Simon


More information about the U-Boot mailing list