From patchwork Tue Jul 16 08:49:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 1132533 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=none (p=none dis=none) header.from=denx.de Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 45nvJq0M30z9sNj for ; Tue, 16 Jul 2019 18:51:39 +1000 (AEST) Received: by lists.denx.de (Postfix, from userid 105) id B4CCFC21E15; Tue, 16 Jul 2019 08:51:08 +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=none 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 22117C21DAF; Tue, 16 Jul 2019 08:51:07 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 94555C21DED; Tue, 16 Jul 2019 08:50:18 +0000 (UTC) Received: from mail-out.m-online.net (mail-out.m-online.net [212.18.0.9]) by lists.denx.de (Postfix) with ESMTPS id 58A78C21E26 for ; Tue, 16 Jul 2019 08:50:15 +0000 (UTC) Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 45nvHC1NCdz1rLG9; Tue, 16 Jul 2019 10:50:15 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 45nvHC1GrBz1qwLP; Tue, 16 Jul 2019 10:50:15 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id RL-9i9WdZntg; Tue, 16 Jul 2019 10:50:14 +0200 (CEST) X-Auth-Info: oC3hHlt2lGpSTbnEfcTIYzKy8BYobfqFUhY0g2smLNI= Received: from mail-internal.denx.de (p578adb1c.dip0.t-ipconnect.de [87.138.219.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPSA; Tue, 16 Jul 2019 10:50:14 +0200 (CEST) Received: from pollux.denx.de (pollux [192.168.1.1]) by mail-internal.denx.de (Postfix) with ESMTP id BC6E6185867; Tue, 16 Jul 2019 10:49:12 +0200 (CEST) Received: by pollux.denx.de (Postfix, from userid 515) id B9B4F1A00A1; Tue, 16 Jul 2019 10:49:12 +0200 (CEST) From: Heiko Schocher To: U-Boot Mailing List Date: Tue, 16 Jul 2019 10:49:07 +0200 Message-Id: <20190716084907.1568340-6-hs@denx.de> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190716084907.1568340-1-hs@denx.de> References: <20190716084907.1568340-1-hs@denx.de> MIME-Version: 1.0 Cc: Marek Vasut , Ramon Fried , Igor Opaniuk , Marcel Ziswiler , Maxime Ripard , Sven Schwermer Subject: [U-Boot] [PATCH v1 5/5] usb, ohci, pci: add DM support for PCI-based OHCI USB controller 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" add new DM based PCI driver ohci-pci for PCI-based OHCI USB support. Signed-off-by: Heiko Schocher --- drivers/usb/host/Kconfig | 7 +++++ drivers/usb/host/Makefile | 1 + drivers/usb/host/ohci-pci.c | 52 +++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) create mode 100644 drivers/usb/host/ohci-pci.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index b1188bcbf5..96954d1673 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -235,6 +235,13 @@ config USB_OHCI_HCD based system where you're not sure, the "lspci -v" entry will list the right "prog-if" for your USB controller(s): EHCI, OHCI, or UHCI. +config USB_OHCI_PCI + bool "Support for PCI-based OHCI USB controller" + depends on DM_USB + default n + help + Enables support for the PCI-based OHCI controller. + if USB_OHCI_HCD config USB_OHCI_GENERIC diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index 6aa574f6f7..dd13528475 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -16,6 +16,7 @@ obj-$(CONFIG_USB_R8A66597_HCD) += r8a66597-hcd.o obj-$(CONFIG_USB_SL811HS) += sl811-hcd.o obj-$(CONFIG_USB_OHCI_EP93XX) += ohci-ep93xx.o obj-$(CONFIG_USB_OHCI_LPC32XX) += ohci-lpc32xx.o +obj-$(CONFIG_USB_OHCI_PCI) += ohci-pci.o obj-$(CONFIG_USB_OHCI_GENERIC) += ohci-generic.o # echi diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c new file mode 100644 index 0000000000..4c1c778672 --- /dev/null +++ b/drivers/usb/host/ohci-pci.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2019 + * Heiko Schocher, DENX Software Engineering, hs@denx.de. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "ohci.h" + +static int ohci_pci_probe(struct udevice *dev) +{ + struct ohci_regs *regs; + + regs = dm_pci_map_bar(dev, PCI_BASE_ADDRESS_0, PCI_REGION_MEM); + return ohci_register(dev, regs); +} + +static int ohci_pci_remove(struct udevice *dev) +{ + return ohci_deregister(dev); +} + +static const struct udevice_id ohci_pci_ids[] = { + { .compatible = "ohci-pci" }, + { } +}; + +U_BOOT_DRIVER(ohci_pci) = { + .name = "ohci_pci", + .id = UCLASS_USB, + .probe = ohci_pci_probe, + .remove = ohci_pci_remove, + .of_match = ohci_pci_ids, + .ops = &ohci_usb_ops, + .platdata_auto_alloc_size = sizeof(struct usb_platdata), + .priv_auto_alloc_size = sizeof(ohci_t), + .flags = DM_FLAG_ALLOC_PRIV_DMA, +}; + +static struct pci_device_id ohci_pci_supported[] = { + { PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_OHCI, ~0) }, + {}, +}; + +U_BOOT_PCI_DEVICE(ohci_pci, ohci_pci_supported);