Hello, I am trying to use a weak function in able to provide a board specific initialisation. To be more specific, I am trying to use the __weak board_ehci_hcd_init function in the usb driver code which is called in ehci_hcd_init, the strong function being defined in the board file. This is on lines similar to what I see in the ehci-mx6 driver and some mx6 board files like nitrogen's.
Getting a linker error on compiling which is perplexing me at the moment. [snip] drivers/usb/host/built-in.o: In function `ehci_hcd_init': /home/sanchayan/uboot/u-boot/drivers/usb/host/ehci-vf.c:185: undefined reference to `board_echi_hcd_init' /home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD (crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22 assertion fail /cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:7498 /home/sanchayan/gcc-linaro/bin/arm-linux-gnueabihf-ld.bfd: BFD (crosstool-NG linaro-1.13.1-2012.09-20120921 - Linaro GCC 2012.09) 2.22 assertion fail /cbuild/slaves/oort14/crosstool-ng/builds/arm-linux-gnueabihf-linux/.build/src/binutils-2.22/bfd/elf32-arm.c:13830 /bin/sh: line 1: 1110 Segmentation fault (core dumped) Perhaps I am overlooking something trivial? A diff is attached, the changes are minimal. I am using our local branch of uboot at 2015.04 and the gcc linaro toolchain. Thanks & Regards, Sanchayan Maity.
diff --git a/arch/arm/include/asm/arch-vf610/iomux-vf610.h b/arch/arm/include/asm/arch-vf610/iomux-vf610.h index d9257ae..294513c 100644 --- a/arch/arm/include/asm/arch-vf610/iomux-vf610.h +++ b/arch/arm/include/asm/arch-vf610/iomux-vf610.h @@ -109,6 +109,7 @@ enum { VF610_PAD_PTD18__NF_IO2 = IOMUX_PAD(0x0130, 0x0130, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL), VF610_PAD_PTD17__NF_IO1 = IOMUX_PAD(0x0134, 0x0134, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL), VF610_PAD_PTD16__NF_IO0 = IOMUX_PAD(0x0138, 0x0138, 2, __NA_, 0, VF610_NFC_IO_PAD_CTRL), + VF610_PAD_PTD4__GPIO_83 = IOMUX_PAD(0x014C, 0x014C, 0, __NA_, 0, VF610_GPIO_PAD_CTRL), VF610_PAD_PTB24__NF_WE_B = IOMUX_PAD(0x0178, 0x0178, 5, __NA_, 0, VF610_NFC_CN_PAD_CTRL), VF610_PAD_PTB25__NF_CE0_B = IOMUX_PAD(0x017c, 0x017c, 5, __NA_, 0, VF610_NFC_CN_PAD_CTRL), diff --git a/board/toradex/colibri_vf/colibri_vf.c b/board/toradex/colibri_vf/colibri_vf.c index 59c8c5b..1554ac7 100644 --- a/board/toradex/colibri_vf/colibri_vf.c +++ b/board/toradex/colibri_vf/colibri_vf.c @@ -24,6 +24,7 @@ #include <i2c.h> #include <g_dnl.h> #include <asm/gpio.h> +#include <usb/ehci-fsl.h> #include "../common/configblock.h" @@ -38,6 +39,12 @@ DECLARE_GLOBAL_DATA_PTR; #define ENET_PAD_CTRL (PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_HIGH | \ PAD_CTL_DSE_50ohm | PAD_CTL_OBE_IBE_ENABLE) +#define USB_PEN_GPIO 83 + +static const iomux_v3_cfg_t usb_pads[] = { + VF610_PAD_PTD4__GPIO_83, +}; + int dram_init(void) { static const struct ddr3_jedec_timings timings = { @@ -503,3 +510,20 @@ int ft_board_setup(void *blob, bd_t *bd) return fsl_dcu_fixedfb_setup(blob); } #endif + +#ifdef CONFIG_USB_EHCI_VF +int board_ehci_hcd_init(int port) +{ + imx_iomux_v3_setup_multiple_pads(usb_pads, ARRAY_SIZE(usb_pads)); + + /* + * USB0 is used as USB Client and USB1 is used + * as USB host on Colibri Vybrid Modules. + */ + + if (port) + gpio_direction_output(USB_PEN_GPIO, 0); + + return 0; +} +#endif diff --git a/drivers/usb/host/ehci-vf.c b/drivers/usb/host/ehci-vf.c index 4aa3b9c..6fc9016 100644 --- a/drivers/usb/host/ehci-vf.c +++ b/drivers/usb/host/ehci-vf.c @@ -161,6 +161,11 @@ static void usb_oc_config(int index) __raw_writel(val, ctrl); } +int __weak board_ehci_hcd_init(int port) +{ + return 0; +} + int ehci_hcd_init(int index, enum usb_init_type init, struct ehci_hccr **hccr, struct ehci_hcor **hcor) { @@ -176,6 +181,9 @@ int ehci_hcd_init(int index, enum usb_init_type init, ehci = (struct usb_ehci *)nc_reg_bases[index]; + /* Do board specific initialisation */ + board_echi_hcd_init(index); + usb_power_config(index); usb_oc_config(index); usb_internal_phy_clock_gate(index);
_______________________________________________ U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot