From patchwork Mon Mar 26 13:50:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Jacques Hiblot X-Patchwork-Id: 890968 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=ti.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ti.com header.i=@ti.com header.b="nB2v8ITt"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 408wY64WFJz9s32 for ; Tue, 27 Mar 2018 00:51:38 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id 0944FC21F31; Mon, 26 Mar 2018 13:51:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id B3910C21EF7; Mon, 26 Mar 2018 13:50:46 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 7B9A5C21E26; Mon, 26 Mar 2018 13:50:44 +0000 (UTC) Received: from lelnx194.ext.ti.com (lelnx194.ext.ti.com [198.47.27.80]) by lists.denx.de (Postfix) with ESMTPS id F3A95C21E68 for ; Mon, 26 Mar 2018 13:50:43 +0000 (UTC) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by lelnx194.ext.ti.com (8.15.1/8.15.1) with ESMTP id w2QDodSU002509; Mon, 26 Mar 2018 08:50:39 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1522072239; bh=SgOJC8RteXs0GT9iEljuGyPfZPKarkXpB3SZHrn0K4k=; h=From:To:CC:Subject:Date:In-Reply-To:References; b=nB2v8ITtl1ZmSMhDqCZQBRLXFigoNUQ8ZVl7vagwEuzRWJ5INn1xl2Pvsc6alFmB5 27zfSFqVSu9tq+7l+US5AM/3tUvPae2BKZUvlyb5ZnBr3gpVU+TNATvNCGnfyGWdXE Z4igzNmDlSIcgs/Jqy0JUnCYKIRooZeWfKxmIRKM= Received: from DFLE101.ent.ti.com (dfle101.ent.ti.com [10.64.6.22]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2QDodGu002415; Mon, 26 Mar 2018 08:50:39 -0500 Received: from DFLE104.ent.ti.com (10.64.6.25) by DFLE101.ent.ti.com (10.64.6.22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1261.35; Mon, 26 Mar 2018 08:50:38 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE104.ent.ti.com (10.64.6.25) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.1261.35 via Frontend Transport; Mon, 26 Mar 2018 08:50:38 -0500 Received: from localhost (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id w2QDocsM027604; Mon, 26 Mar 2018 08:50:38 -0500 From: Jean-Jacques Hiblot To: , Date: Mon, 26 Mar 2018 15:50:25 +0200 Message-ID: <1522072233-31121-3-git-send-email-jjhiblot@ti.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1522072233-31121-1-git-send-email-jjhiblot@ti.com> References: <1522072233-31121-1-git-send-email-jjhiblot@ti.com> MIME-Version: 1.0 X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Cc: Alexey Brodkin , u-boot@lists.denx.de, Hiroyuki Yokoyama , Ran Wang , Stefan Roese Subject: [U-Boot] [PATCH v3 02/10] usb: omap5: Add glue logic to support DM for USB host X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 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" The omap5 uses the dwc3. The dwc3 supports the driver model but it requires some glue logic to load the the driver. Signed-off-by: Jean-Jacques Hiblot --- Changes in v3: - use the live tree API in the omap5 glue logic Changes in v2: None drivers/usb/host/Kconfig | 10 +++++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/dwc3-omap-glue.c | 60 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 71 insertions(+) create mode 100644 drivers/usb/host/dwc3-omap-glue.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index a7249b7..ae34eeb 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -79,6 +79,16 @@ config USB_XHCI_DRA7XX_INDEX Select the DRA7XX xHCI USB index. Current supported values: 0, 1. +config USB_DM_XHCI_OMAP + bool "Support for OMAP family on-chip xHCI USB controller (DM version)" + depends on DM_USB + depends on ARCH_OMAP2PLUS + default y if DRA7XX + help + Enables support for the on-chip xHCI controller on TI OMAP family SoCs + using the Driver Model. + This driver provides the glue logic to probe the generic dwc3 driver. + config USB_XHCI_FSL bool "Support for NXP Layerscape on-chip xHCI USB controller" default y if ARCH_LS1021A || FSL_LSCH3 || FSL_LSCH2 diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 9819489..a47446a 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -59,6 +59,7 @@ obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o obj-$(CONFIG_USB_XHCI_PCI) += xhci-pci.o obj-$(CONFIG_USB_XHCI_RCAR) += xhci-rcar.o obj-$(CONFIG_USB_XHCI_STI) += dwc3-sti-glue.o +obj-$(CONFIG_USB_DM_XHCI_OMAP) += dwc3-omap-glue.o # designware obj-$(CONFIG_USB_DWC2) += dwc2.o diff --git a/drivers/usb/host/dwc3-omap-glue.c b/drivers/usb/host/dwc3-omap-glue.c new file mode 100644 index 0000000..5ce3af6 --- /dev/null +++ b/drivers/usb/host/dwc3-omap-glue.c @@ -0,0 +1,60 @@ +/* + * OMAP5 family DWC3 specific Glue layer + * + * Copyright (c) 2017 + * Jean-Jacques Hiblot + * based on dwc3-sti-glue + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include +#include +#include +#include + +DECLARE_GLOBAL_DATA_PTR; + +static inline bool is_ofnode_compatible(ofnode node, const char *compat) +{ + const void *fdt = gd->fdt_blob; + + if (ofnode_is_np(node)) + return of_device_is_compatible(ofnode_to_np(node), compat, + NULL, NULL); + else + return !fdt_node_check_compatible(fdt, ofnode_to_offset(node), + compat); +} + +static int omap5_dwc3_glue_bind(struct udevice *dev) +{ + bool found = false; + ofnode node; + + dev_for_each_subnode(node, dev) { + if (is_ofnode_compatible(node, "snps,dwc3")) { + found = true; + break; + } + } + + if (!found) { + dev_err(dev, "Can't find subnode compatible with dwc3"); + return -ENOENT; + } + + return dm_scan_fdt_dev(dev); +} + +static const struct udevice_id omap5_dwc3_glue_ids[] = { + { .compatible = "ti,dwc3" }, + { } +}; + +U_BOOT_DRIVER(dwc3_omap5_glue) = { + .name = "dwc3_omap5_glue", + .id = UCLASS_MISC, + .of_match = omap5_dwc3_glue_ids, + .bind = omap5_dwc3_glue_bind, +};