[RFC v1 7/7] usb: onboard-hub: Add conditional compilation for I2C initialization

Anand Moon linux.amoon at gmail.com
Fri May 9 11:17:18 CEST 2025


Hi Neil,

On Fri, 9 May 2025 at 13:27, Neil Armstrong <neil.armstrong at linaro.org> wrote:
>
> On 09/05/2025 09:02, Anand Moon wrote:
> > Add conditional compilation for the usb5744_i2c_init() function based
> > on the CONFIG_DM_I2C configuration, to avoid compilation failure.
> >
> >    CC      net/net-common.o
> >    AR      net/built-in.o
> >    LDS     u-boot.lds
> >    LD      u-boot
> > aarch64-linux-gnu-ld.bfd: common/usb_onboard_hub.o: in function `usb5744_i2c_init':
> > /home/amoon/mainline/u-boot/amlogic/u-boot-maineline/common/usb_onboard_hub.c:74:(.text.usb5744_i2c_init+0xfc): undefined reference to `i2c_get_chip'
> > aarch64-linux-gnu-ld.bfd: /home/amoon/mainline/u-boot/amlogic/u-boot-maineline/common/usb_onboard_hub.c:89:(.text.usb5744_i2c_init+0x1a0): undefined reference to `dm_i2c_write'
> > aarch64-linux-gnu-ld.bfd: /home/amoon/mainline/u-boot/amlogic/u-boot-maineline/common/usb_onboard_hub.c:96:(.text.usb5744_i2c_init+0x1c8): undefined reference to `dm_i2c_write'
> > aarch64-linux-gnu-ld.bfd: /home/amoon/mainline/u-boot/amlogic/u-boot-maineline/common/usb_onboard_hub.c:104:(.text.usb5744_i2c_init+0x1f0): undefined reference to `dm_i2c_write'
> > Segmentation fault (core dumped)
> > make: *** [Makefile:1824: u-boot] Error 139
> > make: *** Deleting file 'u-boot'
> >
> > Signed-off-by: Anand Moon <linux.amoon at gmail.com>
> > ---
> >   common/usb_onboard_hub.c | 4 ++++
> >   1 file changed, 4 insertions(+)
> >
> > diff --git a/common/usb_onboard_hub.c b/common/usb_onboard_hub.c
> > index 1242513c631..92e3f3a92c9 100644
> > --- a/common/usb_onboard_hub.c
> > +++ b/common/usb_onboard_hub.c
> > @@ -30,6 +30,7 @@ struct onboard_hub_data {
> >       int (*init)(struct udevice *dev);
> >   };
> >
> > +#if CONFIG_IS_ENABLED(DM_I2C)
> >   static int usb5744_i2c_init(struct udevice *dev)
> >   {
> >       /*
> > @@ -109,6 +110,7 @@ static int usb5744_i2c_init(struct udevice *dev)
> >
> >       return 0;
> >   }
> > +#endif
> >
> >   int usb_onboard_hub_reset(struct udevice *dev)
> >   {
> > @@ -222,7 +224,9 @@ static const struct onboard_hub_data usb2514_data = {
> >   };
> >
> >   static const struct onboard_hub_data usb5744_data = {
> > +#if CONFIG_IS_ENABLED(DM_I2C)
> >       .init = usb5744_i2c_init,
> > +#endif
> >       .power_on_delay_us = 1000,
> >       .reset_us = 5,
> >   };
>
> I think you should completely disable usb5744_data in this case
>
Let me check this. I will update it in the next version.
> Neil

Thanks
-Anand


More information about the U-Boot mailing list