From patchwork Mon May 11 07:57:22 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Wang X-Patchwork-Id: 1177 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 44E163F08B for ; Mon, 11 May 2020 09:57:35 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id c3sf6782814plz.13 for ; Mon, 11 May 2020 00:57:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1589183854; cv=pass; d=google.com; s=arc-20160816; b=qP9+nnh1KMZk4/+gZob8xjJGUKubnL6LT5zbyZmLZ5us67qXh3Hew2fN/6IoYvDBt5 3pc4vDW6FWuTFRHMI9QJg3ESj4eIhKXTPzj/AluoW57QVDcia1AJDS1b00S8WCvJZ/xw j5nc1O0a0cbqQfNvRdJ4t3s/nXZsmpdDPtVQR0u+Ee/0vxB4Bx4CI8R0r+qKd870Ap5i UB5K2QZmsTceyhkGMhWHKLi+9jjziUoEaxZpHoI/N6DC6S+jGe9mD7emkxQBd0qfDqol a1p94WaiolHxbTnwg3616m+jpsQDHg4IgbKRhZ2Ax+RDUfM/MvsJHBmAO2cF7D+TaB8F d6YQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:references:in-reply-to:message-id:date :subject:cc:to:from:mime-version:sender:dkim-signature; bh=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=nIcvy9rfNgKKeyoTNI54nNdx7/IR+5h60h1MIxdXlMh+QOtDkTDIUY36ebcUzSR9UH fb+iGeo9RY/gPzPJAvZWPOXHro5T7UYjwXl/wk9TzWqrBHonyYrHFNFMW45JR9s7qgNu FnU1FxZXlYk2+AvXnDxhOSdnqfrAadUOVLcirGy4YpCMk7U1R8FjUP/WDtaJ/TgfM2oK Cio6s7JbbNrYRm0wYxGhQ3ejrns5/OypDRlt9qGnRMYeMfdd9XwOV6FCJiUGjzO/gxiC OK2BMymw/S0OFjPMWaUk0Xp3xHqGpE13kUyak3TCO6YHJpV4fXO78KrrCRtWgrhHY29Q kdDg== ARC-Authentication-Results: i=2; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=sender:mime-version:from:to:cc:subject:date:message-id:in-reply-to :references:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=q9CMLvAU5wduuyQRM6zc2zPYsPSx/YFE1Ett/rjE5WqFOf5/oWAgVe+lVUjC2LM3wo 8mFtQbPJd3Kc3LIH7pNU5HYVSPs6eMLTmASb8WCMxdIZMroTfa2IU0niT1zrDFMx6AA4 dMjzBhk/VMTPiG8CQ7WiqDhDXmFREZoQr4yn0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:mime-version:from:to:cc:subject:date :message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=d0SB3aTUd19bg2a4MG4AqnXF9C1S5PuzUbNz6JPp0tU=; b=g1ryeIGrcPiVhaBbrgssIGQc9jRwbSTN+7mh7PL1seIfwBSjdUOuhARuAhXUkuI7tb l1Zxr377qPu8ImQJPEuAKXXChcNnOAkF+naXSzabbeXyjzje5rE3ycr6HsrkULx6wMML KdUS6H3EIFvTUoGVkp4oLfWmkUE2y5/iBa01Yf2HnWj9eijg3L6IB99GkQmfUICu+xJo W2RPpMdMn03xJQuXG69R8NDELSQdOr8AFbLWs968XeAAVSBn26YxibVZ22xnQP9bfT9+ MibrLK7tFIPSeAlAuWkiekGaquU6G6I+89Ge/GYhOMO2SHy7xiThyCV6FUT+w9BiLMcI uedg== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: AGi0PuaPdCLvkQLc2m9tT/F0LjWz21HkYQhOXSThVvV3Yoit9rYYgDKA dh6czTPQzv2r7ETEdiq5ixAy3EM3 X-Google-Smtp-Source: APiQypI1kztm4nw8O0wI46J6OVRmT8yhk/GRg976iSraxwdUqAKU+8dRYXuhyRfOxe122wiQF+IGjA== X-Received: by 2002:a17:90a:154e:: with SMTP id y14mr21547027pja.180.1589183853988; Mon, 11 May 2020 00:57:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8a98:: with SMTP id x24ls16186928pjn.0.gmail; Mon, 11 May 2020 00:57:33 -0700 (PDT) X-Received: by 2002:a17:90a:3b42:: with SMTP id t2mr21223506pjf.11.1589183853562; Mon, 11 May 2020 00:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589183853; cv=none; d=google.com; s=arc-20160816; b=xXaNGvIrSyWcsLxmq5PId6OrA3R4X99bOifGDe7YwFskfRUsboDVpbUOv4mZtgqjRf r7i9Q6SfltEpuHDuScwCqoFBUD5Xq6cG+PcZVxNzgb3fAyIuQBLluLNDVBIBBSnN6HEa 4/6fJIELCcOSHFna+wDUt69fPTm/TexTIdZCgzKh9G9C4WdcEEVGmjhL4xbB4PD+YZp4 o4NPR9HcJOJGMdFI4+hqA8302zEc2xw7S2lQzxOBDZc/BZkU8nCY9YJhAZSB9n26LRxX UnfohLSaBoqnEkaKgwmH5u1X+k7Nm81hHnvSjGWDpVOq8a57XBORiHkyjwdDDco+WMxA rBJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=fPji1BXGpDPzcbBdAXGma0ZIvWKW+zQmloAR7c+Ty3M=; b=M249E3G//kS95LA5VhNB/vVUdSWUr8KIl/R6nM0FLuwcn1fyFgDKgXhBJXDmwmxYG0 WCVvDxNaidwElLwLqx0JAsTWJKrp+e5IB3dnQJ3j+b7/QphF0/Paao4hhCjFbCwJYs6b lo1Xqs12+04qcYes36VzsW0AQ9ZRurczhKqz1Jtntltw2s5XWtv+L6Jz3MbYDzqHKn7B 46pX6m2hl55jqR0dykPqGM2Y5cS2AV/zagZZK4ezFlgEMeAEfxWZysllmG74JxcfvtB/ 0AX9LnUZ51JRqLI0GwS4PZUZd4xGXqkL3WXgGgCorSLLWY6NgQ+dggJ/WLVhRv22hGuv hzvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Received: from lucky1.263xmail.com (lucky1.263xmail.com. [211.157.147.131]) by mx.google.com with ESMTPS id 72si7053950ple.53.2020.05.11.00.57.33 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 May 2020 00:57:33 -0700 (PDT) Received-SPF: pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) client-ip=211.157.147.131; Received: from localhost (unknown [192.168.167.209]) by lucky1.263xmail.com (Postfix) with ESMTP id 2B1A8A1FF6; Mon, 11 May 2020 15:57:32 +0800 (CST) X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-ADDR-CHECKED4: 1 X-ANTISPAM-LEVEL: 2 X-ABS-CHECKED: 0 Received: from localhost.localdomain (unknown [58.22.7.114]) by smtp.263.net (postfix) whith ESMTP id P21665T139939416696576S1589183847395463_; Mon, 11 May 2020 15:57:32 +0800 (CST) X-IP-DOMAINF: 1 X-UNIQUE-TAG: X-RL-SENDER: frank.wang@rock-chips.com X-SENDER: wmc@rock-chips.com X-LOGIN-NAME: frank.wang@rock-chips.com X-FST-TO: heiko@sntech.de X-SENDER-IP: 58.22.7.114 X-ATTACHMENT-NUM: 0 X-DNS-TYPE: 0 X-System-Flag: 0 From: Frank Wang To: heiko@sntech.de, marex@denx.de, bmeng.cn@gmail.com, philipp.tomsich@theobroma-systems.com, klaus.goger@theobroma-systems.com, jagan@amarulasolutions.com, sjg@chromium.org, kever.yang@rock-chips.com Cc: u-boot@lists.denx.de, linux-rockchip@lists.infradead.org, linux-amarula@amarulasolutions.com, marek.belisko@gmail.com, william.wu@rock-chips.com, jianing.ren@rock-chips.com, chenjh@rock-chips.com, wmc@rock-chips.com, Frank Wang Subject: [PATCH v4 13/16] driver: usb: drop legacy rockchip xhci driver Date: Mon, 11 May 2020 15:57:22 +0800 Message-Id: <20200511075725.26665-4-frank.wang@rock-chips.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200511075725.26665-1-frank.wang@rock-chips.com> References: <20200511075330.26462-1-frank.wang@rock-chips.com> <20200511075725.26665-1-frank.wang@rock-chips.com> X-Original-Sender: frank.wang@rock-chips.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of frank.wang@rock-chips.com designates 211.157.147.131 as permitted sender) smtp.mailfrom=frank.wang@rock-chips.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , We have changed to use dwc3 generic driver for usb3.0 host, so the legacy Rockchip's xHCI driver is not needed, and drop it. Signed-off-by: Frank Wang Reviewed-by: Jagan Teki --- drivers/usb/host/Kconfig | 9 -- drivers/usb/host/Makefile | 1 - drivers/usb/host/xhci-rockchip.c | 196 ------------------------------- 3 files changed, 206 deletions(-) delete mode 100644 drivers/usb/host/xhci-rockchip.c diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 2f381dc958..088931a6b9 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig @@ -53,15 +53,6 @@ config USB_XHCI_PCI help Enables support for the PCI-based xHCI controller. -config USB_XHCI_ROCKCHIP - bool "Support for Rockchip on-chip xHCI USB controller" - depends on ARCH_ROCKCHIP - depends on DM_REGULATOR - depends on DM_USB - default y - help - Enables support for the on-chip xHCI controller on Rockchip SoCs. - config USB_XHCI_RCAR bool "Renesas RCar USB 3.0 support" default y diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile index e8e3b17e42..29d4f87e38 100644 --- a/drivers/usb/host/Makefile +++ b/drivers/usb/host/Makefile @@ -48,7 +48,6 @@ obj-$(CONFIG_USB_XHCI_BRCM) += xhci-brcm.o obj-$(CONFIG_USB_XHCI_HCD) += xhci.o xhci-mem.o xhci-ring.o obj-$(CONFIG_USB_XHCI_DWC3) += xhci-dwc3.o obj-$(CONFIG_USB_XHCI_DWC3_OF_SIMPLE) += dwc3-of-simple.o -obj-$(CONFIG_USB_XHCI_ROCKCHIP) += xhci-rockchip.o obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o obj-$(CONFIG_USB_XHCI_FSL) += xhci-fsl.o obj-$(CONFIG_USB_XHCI_MTK) += xhci-mtk.o diff --git a/drivers/usb/host/xhci-rockchip.c b/drivers/usb/host/xhci-rockchip.c deleted file mode 100644 index b67722fe45..0000000000 --- a/drivers/usb/host/xhci-rockchip.c +++ /dev/null @@ -1,196 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0+ -/* - * Copyright (c) 2016 Rockchip, Inc. - * Authors: Daniel Meng - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -struct rockchip_xhci_platdata { - fdt_addr_t hcd_base; - struct udevice *vbus_supply; -}; - -/* - * Contains pointers to register base addresses - * for the usb controller. - */ -struct rockchip_xhci { - struct usb_platdata usb_plat; - struct xhci_ctrl ctrl; - struct xhci_hccr *hcd; - struct dwc3 *dwc3_reg; -}; - -static int xhci_usb_ofdata_to_platdata(struct udevice *dev) -{ - struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); - int ret = 0; - - /* - * Get the base address for XHCI controller from the device node - */ - plat->hcd_base = dev_read_addr(dev); - if (plat->hcd_base == FDT_ADDR_T_NONE) { - pr_err("Can't get the XHCI register base address\n"); - return -ENXIO; - } - - /* Vbus regulator */ - ret = device_get_supply_regulator(dev, "vbus-supply", - &plat->vbus_supply); - if (ret) - debug("Can't get VBus regulator!\n"); - - return 0; -} - -/* - * rockchip_dwc3_phy_setup() - Configure USB PHY Interface of DWC3 Core - * @dwc: Pointer to our controller context structure - * @dev: Pointer to ulcass device - */ -static void rockchip_dwc3_phy_setup(struct dwc3 *dwc3_reg, - struct udevice *dev) -{ - u32 reg; - u32 utmi_bits; - - /* Set dwc3 usb2 phy config */ - reg = readl(&dwc3_reg->g_usb2phycfg[0]); - - if (dev_read_bool(dev, "snps,dis-enblslpm-quirk")) - reg &= ~DWC3_GUSB2PHYCFG_ENBLSLPM; - - utmi_bits = dev_read_u32_default(dev, "snps,phyif-utmi-bits", -1); - if (utmi_bits == 16) { - reg |= DWC3_GUSB2PHYCFG_PHYIF; - reg &= ~DWC3_GUSB2PHYCFG_USBTRDTIM_MASK; - reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_16BIT; - } else if (utmi_bits == 8) { - reg &= ~DWC3_GUSB2PHYCFG_PHYIF; - reg &= ~DWC3_GUSB2PHYCFG_USBTRDTIM_MASK; - reg |= DWC3_GUSB2PHYCFG_USBTRDTIM_8BIT; - } - - if (dev_read_bool(dev, "snps,dis-u2-freeclk-exists-quirk")) - reg &= ~DWC3_GUSB2PHYCFG_U2_FREECLK_EXISTS; - - if (dev_read_bool(dev, "snps,dis-u2-susphy-quirk")) - reg &= ~DWC3_GUSB2PHYCFG_SUSPHY; - - writel(reg, &dwc3_reg->g_usb2phycfg[0]); -} - -static int rockchip_xhci_core_init(struct rockchip_xhci *rkxhci, - struct udevice *dev) -{ - int ret; - - ret = dwc3_core_init(rkxhci->dwc3_reg); - if (ret) { - pr_err("failed to initialize core\n"); - return ret; - } - - rockchip_dwc3_phy_setup(rkxhci->dwc3_reg, dev); - - /* We are hard-coding DWC3 core to Host Mode */ - dwc3_set_mode(rkxhci->dwc3_reg, DWC3_GCTL_PRTCAP_HOST); - - return 0; -} - -static int rockchip_xhci_core_exit(struct rockchip_xhci *rkxhci) -{ - return 0; -} - -static int xhci_usb_probe(struct udevice *dev) -{ - struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); - struct rockchip_xhci *ctx = dev_get_priv(dev); - struct xhci_hcor *hcor; - int ret; - - ctx->hcd = (struct xhci_hccr *)plat->hcd_base; - ctx->dwc3_reg = (struct dwc3 *)((char *)(ctx->hcd) + DWC3_REG_OFFSET); - hcor = (struct xhci_hcor *)((uint64_t)ctx->hcd + - HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase))); - - if (plat->vbus_supply) { - ret = regulator_set_enable(plat->vbus_supply, true); - if (ret) { - pr_err("XHCI: failed to set VBus supply\n"); - return ret; - } - } - - ret = rockchip_xhci_core_init(ctx, dev); - if (ret) { - pr_err("XHCI: failed to initialize controller\n"); - return ret; - } - - return xhci_register(dev, ctx->hcd, hcor); -} - -static int xhci_usb_remove(struct udevice *dev) -{ - struct rockchip_xhci_platdata *plat = dev_get_platdata(dev); - struct rockchip_xhci *ctx = dev_get_priv(dev); - int ret; - - ret = xhci_deregister(dev); - if (ret) - return ret; - ret = rockchip_xhci_core_exit(ctx); - if (ret) - return ret; - - if (plat->vbus_supply) { - ret = regulator_set_enable(plat->vbus_supply, false); - if (ret) - pr_err("XHCI: failed to set VBus supply\n"); - } - - return ret; -} - -static const struct udevice_id xhci_usb_ids[] = { - { .compatible = "rockchip,rk3328-xhci" }, - { } -}; - -U_BOOT_DRIVER(usb_xhci) = { - .name = "xhci_rockchip", - .id = UCLASS_USB, - .of_match = xhci_usb_ids, - .ofdata_to_platdata = xhci_usb_ofdata_to_platdata, - .probe = xhci_usb_probe, - .remove = xhci_usb_remove, - .ops = &xhci_usb_ops, - .bind = dm_scan_fdt_dev, - .platdata_auto_alloc_size = sizeof(struct rockchip_xhci_platdata), - .priv_auto_alloc_size = sizeof(struct rockchip_xhci), - .flags = DM_FLAG_ALLOC_PRIV_DMA, -}; - -static const struct udevice_id usb_phy_ids[] = { - { .compatible = "rockchip,rk3328-usb3-phy" }, - { } -}; - -U_BOOT_DRIVER(usb_phy) = { - .name = "usb_phy_rockchip", - .of_match = usb_phy_ids, -};