:: [maemo-leste] DM_USB patches
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Ivaylo Dimitrov
Datum:  
To: Pali Rohár
CC: maemo-leste
Betreff: [maemo-leste] DM_USB patches
>From d309bb2b0ab8a6c50686c681bdea12fbb3292442 Mon Sep 17 00:00:00 2001
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@???>
Date: Fri, 18 Jun 2021 15:06:39 +0300
Subject: [PATCH 2/2] Nokia RX-51: Enable CONFIG_DM_USB to remove deprecation
warning

Also disable various options that are auto-enabled by default, but not
really applicable to RX-51.

Enable CONFIG_SYS_THUMB_BUILD, otherwise the resulting binary becomes too
large to be useful on a real hardware.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@???>
---
configs/nokia_rx51_defconfig | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/configs/nokia_rx51_defconfig b/configs/nokia_rx51_defconfig
index 3548aab0e1..a06f499b49 100644
--- a/configs/nokia_rx51_defconfig
+++ b/configs/nokia_rx51_defconfig
@@ -1,5 +1,5 @@
CONFIG_ARM=y
-# CONFIG_SYS_THUMB_BUILD is not set
+CONFIG_SYS_THUMB_BUILD=y
CONFIG_ARCH_OMAP2PLUS=y
CONFIG_SYS_TEXT_BASE=0x80008000
CONFIG_NR_DRAM_BANKS=2
@@ -42,6 +42,7 @@ CONFIG_CMD_ONENAND=y
CONFIG_CMD_EXT2=y
CONFIG_CMD_EXT4=y
CONFIG_CMD_FAT=y
+CONFIG_CMD_FDT=n
CONFIG_MTDIDS_DEFAULT="onenand0=onenand"
CONFIG_MTDPARTS_DEFAULT="mtdparts=onenand:128k(bootloader)ro,384k(config),256k(log),2m(kernel),2m(initfs),-(rootfs)"
CONFIG_ENV_OVERWRITE=y
@@ -61,6 +62,9 @@ CONFIG_CONS_INDEX=3
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_OF_LIBFDT_OVERLAY=n
+CONFIG_EFI_LOADER=n
CONFIG_USB_MUSB_UDC=y
CONFIG_USB_OMAP3=y
CONFIG_CFB_CONSOLE=y
--
2.20.1

>From 5661d39b4e60485d2308e3635b7c130e4652f706 Mon Sep 17 00:00:00 2001
From: Ivaylo Dimitrov <ivo.g.dimitrov.75@???>
Date: Fri, 18 Jun 2021 15:03:03 +0300
Subject: [PATCH 1/2] DM_USB: allow building without OF_CONTROL

Currently DM_USB requires OF_CONTROL to be enabled, otherwise link errors
occur. On the other hand OF_CONTROL requires board code to be migrated to
DT, which is not always possible or required.

Fix that by conditionally compiling OF_CONTROL specific sections in USB
related drivers code in the same way like it is done in the other drivers.
Also, auto select OF_LIBFDT if DM_USB is selected but OF_CONTROL is not.
Introduce a new Kconfig option OF_NODE used to compile of_node.c in case
OF_CONTROL is not enabled. Fix deprecation warning condition as well.

Signed-off-by: Ivaylo Dimitrov <ivo.g.dimitrov.75@???>
---
 Makefile                      | 3 +--
 common/usb_hub.c              | 2 ++
 drivers/core/Makefile         | 7 ++++++-
 drivers/usb/Kconfig           | 6 ++++++
 drivers/usb/host/usb-uclass.c | 5 ++++-
 5 files changed, 19 insertions(+), 4 deletions(-)


diff --git a/Makefile b/Makefile
index a73481d18c..e1cf0200b7 100644
--- a/Makefile
+++ b/Makefile
@@ -1114,8 +1114,7 @@ ifneq ($(CONFIG_DM),y)
     @echo >&2 "See doc/driver-model/migration.rst for more info."
     @echo >&2 "===================================================="
 endif
-    $(call deprecated,CONFIG_DM_USB CONFIG_OF_CONTROL CONFIG_BLK,\
-        USB,v2019.07,$(CONFIG_USB))
+    $(call deprecated,CONFIG_DM_USB CONFIG_BLK,USB,v2019.07,$(CONFIG_USB))
     $(call deprecated,CONFIG_DM_PCI,PCI,v2019.07,$(CONFIG_PCI))
     $(call deprecated,CONFIG_DM_VIDEO,video,v2019.07,\
         $(CONFIG_LCD)$(CONFIG_VIDEO))
diff --git a/common/usb_hub.c b/common/usb_hub.c
index ba11a188ca..c6b042a684 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -956,7 +956,9 @@ U_BOOT_DRIVER(usb_generic_hub) = {
 UCLASS_DRIVER(usb_hub) = {
     .id        = UCLASS_USB_HUB,
     .name        = "usb_hub",
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
     .post_bind    = dm_scan_fdt_dev,
+#endif
     .post_probe    = usb_hub_post_probe,
     .child_pre_probe    = usb_child_pre_probe,
     .per_child_auto    = sizeof(struct usb_device),
diff --git a/drivers/core/Makefile b/drivers/core/Makefile
index 5edd4e4135..2cf5873a32 100644
--- a/drivers/core/Makefile
+++ b/drivers/core/Makefile
@@ -15,6 +15,11 @@ obj-$(CONFIG_$(SPL_)OF_LIVE) += of_access.o of_addr.o
 ifndef CONFIG_DM_DEV_READ_INLINE
 obj-$(CONFIG_OF_CONTROL) += read.o
 endif
-obj-$(CONFIG_OF_CONTROL) += of_extra.o ofnode.o read_extra.o
+obj-$(CONFIG_OF_CONTROL) += of_extra.o read_extra.o
+ifdef CONFIG_OF_NODE
+obj-y += ofnode.o
+else
+obj-$(CONFIG_OF_CONTROL) += ofnode.o
+endif


ccflags-$(CONFIG_DM_DEBUG) += -DDEBUG
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index f6975730bf..cb0593a724 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -33,9 +33,15 @@ menuconfig USB

if USB

+config OF_NODE
+    bool
+    default n
+
 config DM_USB
     bool "Enable driver model for USB"
     depends on USB && DM
+    select OF_LIBFDT if !OF_CONTROL
+    select OF_NODE if !OF_CONTROL
     help
       Enable driver model for USB. The USB interface is then implemented
       by the USB uclass. Multiple USB controllers of different types
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
index e3b616c326..71dc578550 100644
--- a/drivers/usb/host/usb-uclass.c
+++ b/drivers/usb/host/usb-uclass.c
@@ -770,6 +770,7 @@ int usb_detect_change(void)


 static int usb_child_post_bind(struct udevice *dev)
 {
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
     struct usb_dev_plat *plat = dev_get_parent_plat(dev);
     int val;


@@ -787,7 +788,7 @@ static int usb_child_post_bind(struct udevice *dev)
         plat->id.match_flags |= USB_DEVICE_ID_MATCH_INT_CLASS;
         plat->id.bInterfaceClass = val;
     }
-
+#endif
     return 0;
 }


@@ -848,7 +849,9 @@ UCLASS_DRIVER(usb) = {
     .id        = UCLASS_USB,
     .name        = "usb",
     .flags        = DM_UC_FLAG_SEQ_ALIAS,
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
     .post_bind    = dm_scan_fdt_dev,
+#endif
     .priv_auto    = sizeof(struct usb_uclass_priv),
     .per_child_auto    = sizeof(struct usb_device),
     .per_device_auto    = sizeof(struct usb_bus_priv),
-- 
2.20.1