From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id AF54DC48BE8 for ; Fri, 18 Jun 2021 14:57:56 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 06D2561260 for ; Fri, 18 Jun 2021 14:57:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 06D2561260 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B145182BDD; Fri, 18 Jun 2021 16:57:50 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="jXi5S9zD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3102282BD8; Fri, 18 Jun 2021 16:57:45 +0200 (CEST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 5C9A482BC9 for ; Fri, 18 Jun 2021 16:57:41 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=kernel.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=pali@kernel.org Received: by mail.kernel.org (Postfix) with ESMTPSA id 62AA46128C; Fri, 18 Jun 2021 14:57:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1624028259; bh=BUiOF0GlZCfYj2wtyFJ6xwNp0DhlMR3U3wgf0WLwexY=; h=From:To:Cc:Subject:Date:From; b=jXi5S9zDOmgjmi7aj7GfzsF3fHRAdcvsKWV+G4NC+vkZQzEb+m3tylIHrwDV9g5gg ylLiaVmgY04NgimMP5CF4PNbC/HEAJ288CpTxDRfjVGHubKn/+unhUgAiwBw9wkYiO CXumzEpt/pJf1QV7RLZK8S6mY3P93/QMUtYNwyyOaEs+d8b+vutKk7+qc0fDgeg/dp IkewcSNfOmxTdCwNa/9OOewmk7KMHfoz+gUjvPm8qv3WLiPNgayYMEHH7S2tydbrDI 9aEW1JW6DtAA68gXu3iX6BvwQGUxEYWTvJ4M7E+mg7MACVz5n+Llrm9IPYe9gf3mYb +QA4g0gSywrSA== Received: by pali.im (Postfix) id CD974B0B; Fri, 18 Jun 2021 16:57:36 +0200 (CEST) From: =?UTF-8?q?Pali=20Roh=C3=A1r?= To: Lokesh Vutla , Tom Rini , Simon Glass Cc: Ivaylo Dimitrov , Merlijn Wajer , maemo-leste@lists.dyne.org, u-boot@lists.denx.de, Pavel Machek Subject: [PATCH 1/2] DM_USB: allow building without OF_CONTROL Date: Fri, 18 Jun 2021 16:57:23 +0200 Message-Id: <20210618145724.2558-1-pali@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean From: Ivaylo Dimitrov 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 Tested-by: Pali Rohár --- 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 a73481d18c14..e1cf0200b72c 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 ba11a188ca64..c6b042a68440 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 5edd4e413576..2cf5873a3278 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 f6975730bf8d..cb0593a724f0 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 e3b616c3266a..71dc578550f5 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