Skip to contentSkip to conversation

omap3_beagle: Finish current outstanding DM migrations

PATCH New Tom Rini 3 participants 6 messages Jun 30, 2020 – Jul 2, 2020

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 omap3_beagle: Finish current outstanding DM migrations

At this point in time we can now remove our legacy code and switch to enabling DM for USB and Ethernet.

Cc Derald D. Woods <[email protected]>
Cc Adam Ford <[email protected]>
---
 board/ti/beagle/beagle.c       | 70 ----------------------------------
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)
board/ti/beagle/beagle.c +0 -70
index 9139ad87d400..9ccd566da370 100644
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include <command.h>
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include <usb.h>
-#include <asm/ehci-omap.h>
-#endif
-
 #define TWL4030_I2C_BUS			0
 #define EXPANSION_EEPROM_I2C_BUS	1
 #define EXPANSION_EEPROM_I2C_ADDRESS	0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-	.multipoint     = 1,
-	.dyn_fifo       = 1,
-	.num_eps        = 16,
-	.ram_bits       = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-	.interface_type	= MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-	.mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-	.mode		= MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-	.config         = &musb_config,
-	.power          = 100,
-	.platform_ops	= &omap2430_ops,
-	.board_data	= &musb_board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
 	omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-	musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
-#endif
-
 	if (generate_fake_mac)
 		omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
 	twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-	if (val == BOOTSTAGE_ID_RUN_OS)
-		usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-		struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-	return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-	return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-	return usb_eth_initialize(bis);
-}
-#endif
configs/omap3_beagle_defconfig +4 -1
index ed7cb8f2ff63..b08ffc062d29 100644
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OMAP3=y
 CONFIG_USB_MUSB_GADGET=y
Signature · 1 line
2.17.1
#1 lore raw

PATCH 1/1 omap3_beagle: Finish current outstanding DM migrations

Quoted 129 lines · Tom Rini

At this point in time we can now remove our legacy code and switch to enabling DM for USB and Ethernet.

Cc Derald D. Woods <[email protected]>
Cc Adam Ford <[email protected]>
---
 board/ti/beagle/beagle.c       | 70 ----------------------------------
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)
board/ti/beagle/beagle.c +0 -70
index 9139ad87d400..9ccd566da370 100644
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include <command.h>
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include <usb.h>
-#include <asm/ehci-omap.h>
-#endif
-
 #define TWL4030_I2C_BUS                        0
 #define EXPANSION_EEPROM_I2C_BUS       1
 #define EXPANSION_EEPROM_I2C_ADDRESS   0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-       .multipoint     = 1,
-       .dyn_fifo       = 1,
-       .num_eps        = 16,
-       .ram_bits       = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-       .interface_type = MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-       .mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-       .mode           = MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-       .config         = &musb_config,
-       .power          = 100,
-       .platform_ops   = &omap2430_ops,
-       .board_data     = &musb_board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
        omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-       musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
-#endif
-
        if (generate_fake_mac)
                omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
        twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-       if (val == BOOTSTAGE_ID_RUN_OS)
-               usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-               struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-       return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-       return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-       return usb_eth_initialize(bis);
-}
-#endif
configs/omap3_beagle_defconfig +1 -1
index ed7cb8f2ff63..b08ffc062d29 100644
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y

configs/omap3_beagle_defconfig CONFIG_SYS_NAND_BUSWIDTH_16BIT=y · line 76

Quoted 4 lines
configs/omap3_beagle_defconfig +1 -0
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y

For my boards, I had to modify the -u-boot.dtsi files [1] because the gpmc driver didn't have a driver, so any sub-nodes disappeared leaving the Ethernet unavailable. With the fix Ethernet works.

[1] - https://gitlab.denx.de/u-boot/u-boot/-/commit/62ca4aa16fcfaaa15e40ed26fe6826878d55ac59

Quoted 12 lines
configs/omap3_beagle_defconfig +2 -1
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OMAP3=y
 CONFIG_USB_MUSB_GADGET=y
--

2.17.1

author
#2 lore raw

PATCH 1/1 omap3_beagle: Finish current outstanding DM migrations

Quoted 130 lines · Adam Ford
Quoted 129 lines · Tom Rini

At this point in time we can now remove our legacy code and switch to enabling DM for USB and Ethernet.

Cc Derald D. Woods <[email protected]>
Cc Adam Ford <[email protected]>
---
 board/ti/beagle/beagle.c       | 70 ----------------------------------
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)
board/ti/beagle/beagle.c +0 -70
index 9139ad87d400..9ccd566da370 100644
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include <command.h>
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include <usb.h>
-#include <asm/ehci-omap.h>
-#endif
-
 #define TWL4030_I2C_BUS                        0
 #define EXPANSION_EEPROM_I2C_BUS       1
 #define EXPANSION_EEPROM_I2C_ADDRESS   0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-       .multipoint     = 1,
-       .dyn_fifo       = 1,
-       .num_eps        = 16,
-       .ram_bits       = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-       .interface_type = MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-       .mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-       .mode           = MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-       .config         = &musb_config,
-       .power          = 100,
-       .platform_ops   = &omap2430_ops,
-       .board_data     = &musb_board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
        omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-       musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
-#endif
-
        if (generate_fake_mac)
                omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
        twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-       if (val == BOOTSTAGE_ID_RUN_OS)
-               usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-       .port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-       .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-       .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-               struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-       return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-       return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-       return usb_eth_initialize(bis);
-}
-#endif
configs/omap3_beagle_defconfig +1 -1
index ed7cb8f2ff63..b08ffc062d29 100644
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
Quoted 8 lines

configs/omap3_beagle_defconfig CONFIG_SYS_NAND_BUSWIDTH_16BIT=y · line 76

Quoted 4 lines
configs/omap3_beagle_defconfig +1 -0
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y

For my boards, I had to modify the -u-boot.dtsi files [1] because the gpmc driver didn't have a driver, so any sub-nodes disappeared leaving the Ethernet unavailable. With the fix Ethernet works.

Here beagle ethernet is via an onboard USB ethernet device. My networking tests are as stable as ever (I can't get NFS to work on any of them, but TFTP and EFI network are fine).

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200630/8d0a2fb5/attachment.sig>
#3 lore raw

PATCH 1/1 omap3_beagle: Finish current outstanding DM migrations

In reply to Tom Rini
Quoted 144 lines · Tom Rini

At this point in time we can now remove our legacy code and switch to enabling DM for USB and Ethernet.

Cc Derald D. Woods <[email protected]>
Cc Adam Ford <[email protected]>
---
 board/ti/beagle/beagle.c       | 70 ----------------------------------
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)
board/ti/beagle/beagle.c +0 -70
index 9139ad87d400..9ccd566da370 100644
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include <command.h>
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include <usb.h>
-#include <asm/ehci-omap.h>
-#endif
-
 #define TWL4030_I2C_BUS			0
 #define EXPANSION_EEPROM_I2C_BUS	1
 #define EXPANSION_EEPROM_I2C_ADDRESS	0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-	.multipoint     = 1,
-	.dyn_fifo       = 1,
-	.num_eps        = 16,
-	.ram_bits       = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-	.interface_type	= MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-	.mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-	.mode		= MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-	.config         = &musb_config,
-	.power          = 100,
-	.platform_ops	= &omap2430_ops,
-	.board_data	= &musb_board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
 	omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-	musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
-#endif
-
 	if (generate_fake_mac)
 		omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
 	twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-	if (val == BOOTSTAGE_ID_RUN_OS)
-		usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-		struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-	return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-	return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-	return usb_eth_initialize(bis);
-}
-#endif
configs/omap3_beagle_defconfig +4 -1
index ed7cb8f2ff63..b08ffc062d29 100644
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OMAP3=y
 CONFIG_USB_MUSB_GADGET=y
Signature · 1 line
2.17.1

I tested this patch on my BeagleBoard Rev. C4 and BeagleBoard xM.

NOTE:

I did have to perform a 'make menuconfig' and set DM_ETH and DM_USB manually though. It may be something cached in my build environment. I mention this because I did perform an additional operation before build.

After first use of defconfig:
---8<---------------------------------------------------

[...]
arm-cortexa8-linux-gnueabihf-ld.bfd: drivers/usb/host/built-in.o: in function `usb_lowlevel_stop':
u-boot/drivers/usb/host/ehci-hcd.c:1138: undefined reference to ehci_hcd_stop' arm-cortexa8-linux-gnueabihf-ld.bfd: drivers/usb/host/built-in.o: in function usb_lowlevel_init':
u-boot/drivers/usb/host/ehci-hcd.c:1153: undefined reference to `ehci_hcd_init' make[2]: *** [u-boot/Makefile:1755: u-boot] Error 1
make[1]: *** [Makefile:167: sub-make] Error 2

---8<---------------------------------------------------

Derald

author
#4 lore raw

PATCH 1/1 omap3_beagle: Finish current outstanding DM migrations

Quoted 167 lines · Derald D. Woods
Quoted 144 lines · Tom Rini

At this point in time we can now remove our legacy code and switch to enabling DM for USB and Ethernet.

Cc Derald D. Woods <[email protected]>
Cc Adam Ford <[email protected]>
---
 board/ti/beagle/beagle.c       | 70 ----------------------------------
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)
board/ti/beagle/beagle.c +0 -70
index 9139ad87d400..9ccd566da370 100644
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include <command.h>
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include <usb.h>
-#include <asm/ehci-omap.h>
-#endif
-
 #define TWL4030_I2C_BUS			0
 #define EXPANSION_EEPROM_I2C_BUS	1
 #define EXPANSION_EEPROM_I2C_ADDRESS	0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-	.multipoint     = 1,
-	.dyn_fifo       = 1,
-	.num_eps        = 16,
-	.ram_bits       = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-	.interface_type	= MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-	.mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-	.mode		= MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-	.config         = &musb_config,
-	.power          = 100,
-	.platform_ops	= &omap2430_ops,
-	.board_data	= &musb_board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
 	omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-	musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
-#endif
-
 	if (generate_fake_mac)
 		omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
 	twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-	if (val == BOOTSTAGE_ID_RUN_OS)
-		usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-		struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-	return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-	return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-	return usb_eth_initialize(bis);
-}
-#endif
configs/omap3_beagle_defconfig +4 -1
index ed7cb8f2ff63..b08ffc062d29 100644
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OMAP3=y
 CONFIG_USB_MUSB_GADGET=y
Signature · 1 line
2.17.1

I tested this patch on my BeagleBoard Rev. C4 and BeagleBoard xM.

NOTE:

I did have to perform a 'make menuconfig' and set DM_ETH and DM_USB manually though. It may be something cached in my build environment. I mention this because I did perform an additional operation before build.

After first use of defconfig:
---8<---------------------------------------------------

[...]
arm-cortexa8-linux-gnueabihf-ld.bfd: drivers/usb/host/built-in.o: in function `usb_lowlevel_stop':
u-boot/drivers/usb/host/ehci-hcd.c:1138: undefined reference to ehci_hcd_stop' arm-cortexa8-linux-gnueabihf-ld.bfd: drivers/usb/host/built-in.o: in function usb_lowlevel_init':
u-boot/drivers/usb/host/ehci-hcd.c:1153: undefined reference to `ehci_hcd_init' make[2]: *** [u-boot/Makefile:1755: u-boot] Error 1
make[1]: *** [Makefile:167: sub-make] Error 2

Quoted 1 line

---8<---------------------------------------------------

That's just very odd. If you start from a clean tree and apply the patch is it reproducible? Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200701/950ac34d/attachment.sig>
#5 lore raw

PATCH 1/1 omap3_beagle: Finish current outstanding DM migrations

Quoted 168 lines · Tom Rini
Quoted 167 lines · Derald D. Woods
Quoted 144 lines · Tom Rini

At this point in time we can now remove our legacy code and switch to enabling DM for USB and Ethernet.

Cc Derald D. Woods <[email protected]>
Cc Adam Ford <[email protected]>
---
 board/ti/beagle/beagle.c       | 70 ----------------------------------
 configs/omap3_beagle_defconfig |  5 ++-
 2 files changed, 4 insertions(+), 71 deletions(-)
board/ti/beagle/beagle.c +0 -70
index 9139ad87d400..9ccd566da370 100644
@@ -40,11 +40,6 @@
 #include "beagle.h"
 #include <command.h>
 
-#ifdef CONFIG_USB_EHCI_HCD
-#include <usb.h>
-#include <asm/ehci-omap.h>
-#endif
-
 #define TWL4030_I2C_BUS			0
 #define EXPANSION_EEPROM_I2C_BUS	1
 #define EXPANSION_EEPROM_I2C_ADDRESS	0x50
@@ -297,33 +292,6 @@ static void beagle_dvi_pup(void)
 }
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-static struct musb_hdrc_config musb_config = {
-	.multipoint     = 1,
-	.dyn_fifo       = 1,
-	.num_eps        = 16,
-	.ram_bits       = 12,
-};
-
-static struct omap_musb_board_data musb_board_data = {
-	.interface_type	= MUSB_INTERFACE_ULPI,
-};
-
-static struct musb_hdrc_platform_data musb_plat = {
-#if defined(CONFIG_USB_MUSB_HOST)
-	.mode           = MUSB_HOST,
-#elif defined(CONFIG_USB_MUSB_GADGET)
-	.mode		= MUSB_PERIPHERAL,
-#else
-#error "Please define either CONFIG_USB_MUSB_HOST or CONFIG_USB_MUSB_GADGET"
-#endif
-	.config         = &musb_config,
-	.power          = 100,
-	.platform_ops	= &omap2430_ops,
-	.board_data	= &musb_board_data,
-};
-#endif
-
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -506,10 +474,6 @@ int misc_init_r(void)
 	omap3_dss_enable();
 #endif
 
-#ifdef CONFIG_USB_MUSB_OMAP2PLUS
-	musb_register(&musb_plat, &musb_board_data, (void *)MUSB_BASE);
-#endif
-
 	if (generate_fake_mac)
 		omap_die_id_usbethaddr();
 
@@ -548,37 +512,3 @@ void board_mmc_power_init(void)
 	twl4030_power_mmc_init(0);
 }
 #endif
-
-#if defined(CONFIG_USB_EHCI_HCD) && !defined(CONFIG_SPL_BUILD)
-/* Call usb_stop() before starting the kernel */
-void show_boot_progress(int val)
-{
-	if (val == BOOTSTAGE_ID_RUN_OS)
-		usb_stop();
-}
-
-static struct omap_usbhs_board_data usbhs_bdata = {
-	.port_mode[0] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
-	.port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED
-};
-
-int ehci_hcd_init(int index, enum usb_init_type init,
-		struct ehci_hccr **hccr, struct ehci_hcor **hcor)
-{
-	return omap_ehci_hcd_init(index, &usbhs_bdata, hccr, hcor);
-}
-
-int ehci_hcd_stop(int index)
-{
-	return omap_ehci_hcd_stop();
-}
-
-#endif /* CONFIG_USB_EHCI_HCD */
-
-#if defined(CONFIG_USB_ETHER) && defined(CONFIG_USB_MUSB_GADGET)
-int board_eth_init(bd_t *bis)
-{
-	return usb_eth_initialize(bis);
-}
-#endif
configs/omap3_beagle_defconfig +4 -1
index ed7cb8f2ff63..b08ffc062d29 100644
@@ -3,11 +3,11 @@ CONFIG_ARM=y
 # CONFIG_SPL_USE_ARCH_MEMSET is not set
 CONFIG_ARCH_OMAP2PLUS=y
 CONFIG_SYS_MALLOC_F_LEN=0x4000
+CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_TARGET_OMAP3_BEAGLE=y
 CONFIG_SPL_SYS_MALLOC_F_LEN=0x400
 CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL=y
-CONFIG_SPL_TEXT_BASE=0x40200000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_BOOTCOMMAND="run findfdt; run distro_bootcmd"
 CONFIG_USE_PREBOOT=y
@@ -73,10 +73,13 @@ CONFIG_SYS_NAND_BUSWIDTH_16BIT=y
 CONFIG_SYS_NAND_U_BOOT_LOCATIONS=y
 CONFIG_SYS_NAND_U_BOOT_OFFS=0x80000
 CONFIG_SPL_NAND_SIMPLE=y
+CONFIG_DM_ETH=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_OMAP3_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+# CONFIG_SPL_DM_USB is not set
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OMAP3=y
 CONFIG_USB_MUSB_GADGET=y
Signature · 1 line
2.17.1

I tested this patch on my BeagleBoard Rev. C4 and BeagleBoard xM.

NOTE:

I did have to perform a 'make menuconfig' and set DM_ETH and DM_USB manually though. It may be something cached in my build environment. I mention this because I did perform an additional operation before build.

After first use of defconfig:
---8<---------------------------------------------------

[...]
arm-cortexa8-linux-gnueabihf-ld.bfd: drivers/usb/host/built-in.o: in function `usb_lowlevel_stop':
u-boot/drivers/usb/host/ehci-hcd.c:1138: undefined reference to ehci_hcd_stop' arm-cortexa8-linux-gnueabihf-ld.bfd: drivers/usb/host/built-in.o: in function usb_lowlevel_init':
u-boot/drivers/usb/host/ehci-hcd.c:1153: undefined reference to `ehci_hcd_init' make[2]: *** [u-boot/Makefile:1755: u-boot] Error 1
make[1]: *** [Makefile:167: sub-make] Error 2

Quoted 7 lines
Quoted 1 line

---8<---------------------------------------------------

That's just very odd. If you start from a clean tree and apply the patch is it reproducible? Thanks!

Signature · 1 line
Tom

I cleaned up my cached configs and the defconfig builds properly now. My redundancy was a bit too aggressive. All good.

Derald