From patchwork Thu Oct 26 13:48:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Elder X-Patchwork-Id: 117237 Delivered-To: patch@linaro.org Received: by 10.80.245.45 with SMTP id t42csp732323edm; Thu, 26 Oct 2017 06:48:59 -0700 (PDT) X-Google-Smtp-Source: ABhQp+Qq+aSReUU/RiTLwjovCSe7Vfk33hB981TEngl6fe2wRgyNw1teZ+hlCh7N+2VgGWjWpXD0 X-Received: by 10.159.195.7 with SMTP id bd7mr4537614plb.43.1509025738878; Thu, 26 Oct 2017 06:48:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509025738; cv=none; d=google.com; s=arc-20160816; b=k4uRy11vMEkYGaG92tyB/FqoVrxm0bCyJRSdl7Bh9WQaV/Ax6nIN6xkAYov7AUozLb kCQ13l98gUMqzsp/9x1kStNezAtDe1kmE0HL01fS+lXVerGHJt2iE+tdt1Ai4Oudlntm YVMItD8cn1PImETgTWRyuOVU1NA4j54HPNJ5W4F6lnh0EGDH6rCA/fZeNZ9wcGJHBD9R h/VPJ0ois/t/NW9rEXQUk6zaqIabrk6uYLkJkFPY6SfVV5teSDVKfQc6nDkKHZ1vbwsx ffnqEjo2GcgPGUWIjI69Fqfp1pU1xjh7Agpl+MwqexpvyQyu/X/TjAKlzTaaGJg5wxOv d2rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=XeP1smwDry3c9qiog9IEZe5X/Be1I9gh2QGYdSkXi0A=; b=LMwt1aVHHgvqfnskDi/Yuy89XXkHV9PLjwgopO4YJS/yE2GXwP1zAxhcNkVMnF/m/3 fQNaMWUCjuuERKJmMVBNneRjjNUI83ZoUlciQPV6PPubij2jszN38GN7kIaw6gv+Ulkg dzduclDDbaJeT1n5G6EWDfcFS5voJbZkfnfaPzkg9yU6zvnvc0Q16xraQD3MOVy2A5Ok ChkCz4SIJpOgTeodzrhZcOB38DMn5kVxOKNr8HZsG6uPcJX6QUsPlezyGD0fYqdVCzDa ONUJSmWBHA5AtzGOCaAr7ZbS8LBcI7Su3Fot/ZoLJZ4C/1MoQsF9Wi+SWvT4URwRUQT+ zgCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ikIPkNCX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si3656111pfi.587.2017.10.26.06.48.58; Thu, 26 Oct 2017 06:48:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ikIPkNCX; spf=pass (google.com: best guess record for domain of linux-arm-msm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932386AbdJZNs5 (ORCPT + 10 others); Thu, 26 Oct 2017 09:48:57 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:49558 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932398AbdJZNsq (ORCPT ); Thu, 26 Oct 2017 09:48:46 -0400 Received: by mail-pg0-f67.google.com with SMTP id g6so2735443pgn.6 for ; Thu, 26 Oct 2017 06:48:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=RwSmRDT96kknKyvsVt1wNUC2pzG27JUHwH6nyJ+bjTo=; b=ikIPkNCXZ1Gu+tNRLzr79jLy5kwi20GGHH9QVoFhAGSQUEhQRal4fUs/ZGnyLaSI9Y V9Dkox/4wD9m3gB7sWcKqtzCvXAoofusU1pzB+NqahODdD9Wr3582zIQLTcajbfAPs8m Wm4wsflkkLd+aktyooOYGHE1ZRKjYRhbKi1+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=RwSmRDT96kknKyvsVt1wNUC2pzG27JUHwH6nyJ+bjTo=; b=GVzSYg//G1vw/kL5NgWO/67F0usKV4mdZ0F7H7S3QjcnA7YzM0QZThEnqrfOjddpqf opT7rXCZXM+sJUrN97yFF/6H9RFYO7SJOUD0MfsVW82z35p82t24d43iMy7lS3/snFWW 6N0mJq6yamE+M+TJkUzHlnNiwxvn/u32g+VpfFT2mgw+QFpBcrxi1HFauiIXFeimYEjb G5ZEzxAh7JKwIFHKWoN7g0WjKSMRkpKpu4gum8UCxthqYmzJRv9lFRnKB1N1imQ4tpOX +kjZE8ShKb/PlNgIUkeE/aKoiiULGOcyH61LmGvZYH96F5oHexlTmgbSWKs4n+pCClcA sQfA== X-Gm-Message-State: AMCzsaXD6sxdcrQ6MlXjHcYJQRC/cHLhSLbLop3D7gCQuhoqNqeogYfz cAwAV0SYnbFdn1BHB87kaICGeg== X-Received: by 10.159.218.137 with SMTP id w9mr4521045plp.139.1509025725550; Thu, 26 Oct 2017 06:48:45 -0700 (PDT) Received: from localhost.localdomain (h2.143.128.40.static.ip.windstream.net. [40.128.143.2]) by smtp.gmail.com with ESMTPSA id m74sm12271436pfi.2.2017.10.26.06.48.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 26 Oct 2017 06:48:44 -0700 (PDT) From: Alex Elder To: gregkh@linuxfoundation.org, stern@rowland.harvard.edu, balbi@kernel.org Cc: manjunath.goudar@linaro.org, bjorn.andersson@linaro.org, Linyu.Yuan@alcatel-sbell.com.cn, andy.gross@linaro.org, tony@atomide.com, linux-usb@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/3] usb: phy: remove phy-qcom-8x16-usb.c Date: Thu, 26 Oct 2017 08:48:27 -0500 Message-Id: <20171026134827.615-4-elder@linaro.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171026134827.615-1-elder@linaro.org> References: <20171026134827.615-1-elder@linaro.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org No Qualcomm SoC requires the "phy-qcom-8x16-usb.c" USB phy driver support any more, so remove the code. Suggested-by: Stephen Boyd Signed-off-by: Alex Elder Acked-by: Bjorn Andersson Acked-by: Andy Gross --- v2: Update the Kconfig file so it no longer offers to build this code, as suggested by Felipe Balbi. drivers/usb/phy/Kconfig | 14 -- drivers/usb/phy/Makefile | 1 - drivers/usb/phy/phy-qcom-8x16-usb.c | 366 ------------------------------------ 3 files changed, 381 deletions(-) delete mode 100644 drivers/usb/phy/phy-qcom-8x16-usb.c -- 2.11.0 -- To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/usb/phy/Kconfig b/drivers/usb/phy/Kconfig index f5775e5c9f52..0f8ab981d572 100644 --- a/drivers/usb/phy/Kconfig +++ b/drivers/usb/phy/Kconfig @@ -137,20 +137,6 @@ config USB_ISP1301 To compile this driver as a module, choose M here: the module will be called phy-isp1301. -config USB_QCOM_8X16_PHY - tristate "Qualcomm APQ8016/MSM8916 on-chip USB PHY controller support" - depends on ARCH_QCOM || COMPILE_TEST - depends on RESET_CONTROLLER - select USB_PHY - select USB_ULPI_VIEWPORT - help - Enable this to support the USB transceiver on Qualcomm 8x16 chipsets. - It handles PHY initialization, clock management, power management, - and workarounds required after resetting the hardware. - - To compile this driver as a module, choose M here: the - module will be called phy-qcom-8x16-usb. - config USB_MV_OTG tristate "Marvell USB OTG support" depends on USB_EHCI_MV && USB_MV_UDC && PM && USB_OTG diff --git a/drivers/usb/phy/Makefile b/drivers/usb/phy/Makefile index 61013f38abbe..8beefb7f2777 100644 --- a/drivers/usb/phy/Makefile +++ b/drivers/usb/phy/Makefile @@ -18,7 +18,6 @@ obj-$(CONFIG_TWL6030_USB) += phy-twl6030-usb.o obj-$(CONFIG_USB_EHCI_TEGRA) += phy-tegra-usb.o obj-$(CONFIG_USB_GPIO_VBUS) += phy-gpio-vbus-usb.o obj-$(CONFIG_USB_ISP1301) += phy-isp1301.o -obj-$(CONFIG_USB_QCOM_8X16_PHY) += phy-qcom-8x16-usb.o obj-$(CONFIG_USB_MV_OTG) += phy-mv-usb.o obj-$(CONFIG_USB_MXS_PHY) += phy-mxs-usb.o obj-$(CONFIG_USB_ULPI) += phy-ulpi.o diff --git a/drivers/usb/phy/phy-qcom-8x16-usb.c b/drivers/usb/phy/phy-qcom-8x16-usb.c deleted file mode 100644 index 679afeaaa9a8..000000000000 --- a/drivers/usb/phy/phy-qcom-8x16-usb.c +++ /dev/null @@ -1,366 +0,0 @@ -/* - * Copyright (c) 2015, Linaro Limited - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 and - * only version 2 as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define HSPHY_AHBBURST 0x0090 -#define HSPHY_AHBMODE 0x0098 -#define HSPHY_GENCONFIG 0x009c -#define HSPHY_GENCONFIG_2 0x00a0 - -#define HSPHY_USBCMD 0x0140 -#define HSPHY_ULPI_VIEWPORT 0x0170 -#define HSPHY_CTRL 0x0240 - -#define HSPHY_TXFIFO_IDLE_FORCE_DIS BIT(4) -#define HSPHY_SESS_VLD_CTRL_EN BIT(7) -#define HSPHY_POR_ASSERT BIT(0) -#define HSPHY_RETEN BIT(1) - -#define HSPHY_SESS_VLD_CTRL BIT(25) - -#define ULPI_PWR_CLK_MNG_REG 0x88 -#define ULPI_PWR_OTG_COMP_DISABLE BIT(0) - -#define ULPI_MISC_A 0x96 -#define ULPI_MISC_A_VBUSVLDEXTSEL BIT(1) -#define ULPI_MISC_A_VBUSVLDEXT BIT(0) - -#define HSPHY_3P3_MIN 3050000 /* uV */ -#define HSPHY_3P3_MAX 3300000 /* uV */ - -#define HSPHY_1P8_MIN 1800000 /* uV */ -#define HSPHY_1P8_MAX 1800000 /* uV */ - -#define HSPHY_VDD_MIN 5 -#define HSPHY_VDD_MAX 7 - -struct phy_8x16 { - struct usb_phy phy; - void __iomem *regs; - struct clk *core_clk; - struct clk *iface_clk; - struct regulator_bulk_data regulator[3]; - - struct reset_control *phy_reset; - - struct gpio_desc *switch_gpio; - struct notifier_block reboot_notify; -}; - -static int phy_8x16_notify_connect(struct usb_phy *phy, - enum usb_device_speed speed) -{ - struct phy_8x16 *qphy = container_of(phy, struct phy_8x16, phy); - u32 val; - - val = ULPI_MISC_A_VBUSVLDEXTSEL | ULPI_MISC_A_VBUSVLDEXT; - usb_phy_io_write(&qphy->phy, val, ULPI_SET(ULPI_MISC_A)); - - val = readl(qphy->regs + HSPHY_USBCMD); - val |= HSPHY_SESS_VLD_CTRL; - writel(val, qphy->regs + HSPHY_USBCMD); - - return 0; -} - -static int phy_8x16_notify_disconnect(struct usb_phy *phy, - enum usb_device_speed speed) -{ - struct phy_8x16 *qphy = container_of(phy, struct phy_8x16, phy); - u32 val; - - val = ULPI_MISC_A_VBUSVLDEXT | ULPI_MISC_A_VBUSVLDEXTSEL; - usb_phy_io_write(&qphy->phy, val, ULPI_CLR(ULPI_MISC_A)); - - val = readl(qphy->regs + HSPHY_USBCMD); - val &= ~HSPHY_SESS_VLD_CTRL; - writel(val, qphy->regs + HSPHY_USBCMD); - - return 0; -} - -static int phy_8x16_vbus_on(struct phy_8x16 *qphy) -{ - phy_8x16_notify_connect(&qphy->phy, USB_SPEED_UNKNOWN); - - /* Switch D+/D- lines to Device connector */ - gpiod_set_value_cansleep(qphy->switch_gpio, 0); - - return 0; -} - -static int phy_8x16_vbus_off(struct phy_8x16 *qphy) -{ - phy_8x16_notify_disconnect(&qphy->phy, USB_SPEED_UNKNOWN); - - /* Switch D+/D- lines to USB HUB */ - gpiod_set_value_cansleep(qphy->switch_gpio, 1); - - return 0; -} - -static int phy_8x16_vbus_notify(struct notifier_block *nb, unsigned long event, - void *ptr) -{ - struct usb_phy *usb_phy = container_of(nb, struct usb_phy, vbus_nb); - struct phy_8x16 *qphy = container_of(usb_phy, struct phy_8x16, phy); - - if (event) - phy_8x16_vbus_on(qphy); - else - phy_8x16_vbus_off(qphy); - - return NOTIFY_DONE; -} - -static int phy_8x16_init(struct usb_phy *phy) -{ - struct phy_8x16 *qphy = container_of(phy, struct phy_8x16, phy); - u32 val, init[] = {0x44, 0x6B, 0x24, 0x13}; - u32 addr = ULPI_EXT_VENDOR_SPECIFIC; - int idx, state; - - for (idx = 0; idx < ARRAY_SIZE(init); idx++) - usb_phy_io_write(phy, init[idx], addr + idx); - - reset_control_reset(qphy->phy_reset); - - /* Assert USB HSPHY_POR */ - val = readl(qphy->regs + HSPHY_CTRL); - val |= HSPHY_POR_ASSERT; - writel(val, qphy->regs + HSPHY_CTRL); - - /* - * wait for minimum 10 microseconds as suggested in HPG. - * Use a slightly larger value since the exact value didn't - * work 100% of the time. - */ - usleep_range(12, 15); - - /* Deassert USB HSPHY_POR */ - val = readl(qphy->regs + HSPHY_CTRL); - val &= ~HSPHY_POR_ASSERT; - writel(val, qphy->regs + HSPHY_CTRL); - - usleep_range(10, 15); - - writel(0x00, qphy->regs + HSPHY_AHBBURST); - writel(0x08, qphy->regs + HSPHY_AHBMODE); - - /* workaround for rx buffer collision issue */ - val = readl(qphy->regs + HSPHY_GENCONFIG); - val &= ~HSPHY_TXFIFO_IDLE_FORCE_DIS; - writel(val, qphy->regs + HSPHY_GENCONFIG); - - val = readl(qphy->regs + HSPHY_GENCONFIG_2); - val |= HSPHY_SESS_VLD_CTRL_EN; - writel(val, qphy->regs + HSPHY_GENCONFIG_2); - - val = ULPI_PWR_OTG_COMP_DISABLE; - usb_phy_io_write(phy, val, ULPI_SET(ULPI_PWR_CLK_MNG_REG)); - - state = extcon_get_state(qphy->phy.edev, EXTCON_USB); - if (state) - phy_8x16_vbus_on(qphy); - else - phy_8x16_vbus_off(qphy); - - val = usb_phy_io_read(&qphy->phy, ULPI_FUNC_CTRL); - val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; - val |= ULPI_FUNC_CTRL_OPMODE_NORMAL; - usb_phy_io_write(&qphy->phy, val, ULPI_FUNC_CTRL); - - return 0; -} - -static void phy_8x16_shutdown(struct usb_phy *phy) -{ - u32 val; - - /* Put the controller in non-driving mode */ - val = usb_phy_io_read(phy, ULPI_FUNC_CTRL); - val &= ~ULPI_FUNC_CTRL_OPMODE_MASK; - val |= ULPI_FUNC_CTRL_OPMODE_NONDRIVING; - usb_phy_io_write(phy, val, ULPI_FUNC_CTRL); -} - -static int phy_8x16_read_devicetree(struct phy_8x16 *qphy) -{ - struct device *dev = qphy->phy.dev; - int ret; - - qphy->core_clk = devm_clk_get(dev, "core"); - if (IS_ERR(qphy->core_clk)) - return PTR_ERR(qphy->core_clk); - - qphy->iface_clk = devm_clk_get(dev, "iface"); - if (IS_ERR(qphy->iface_clk)) - return PTR_ERR(qphy->iface_clk); - - qphy->regulator[0].supply = "v3p3"; - qphy->regulator[1].supply = "v1p8"; - qphy->regulator[2].supply = "vddcx"; - - ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(qphy->regulator), - qphy->regulator); - if (ret) - return ret; - - qphy->phy_reset = devm_reset_control_get(dev, "phy"); - if (IS_ERR(qphy->phy_reset)) - return PTR_ERR(qphy->phy_reset); - - qphy->switch_gpio = devm_gpiod_get_optional(dev, "switch", - GPIOD_OUT_LOW); - return PTR_ERR_OR_ZERO(qphy->switch_gpio); -} - -static int phy_8x16_reboot_notify(struct notifier_block *this, - unsigned long code, void *unused) -{ - struct phy_8x16 *qphy; - - qphy = container_of(this, struct phy_8x16, reboot_notify); - - /* - * Ensure that D+/D- lines are routed to uB connector, so - * we could load bootloader/kernel at next reboot_notify - */ - gpiod_set_value_cansleep(qphy->switch_gpio, 0); - return NOTIFY_DONE; -} - -static int phy_8x16_probe(struct platform_device *pdev) -{ - struct phy_8x16 *qphy; - struct resource *res; - struct usb_phy *phy; - int ret; - - qphy = devm_kzalloc(&pdev->dev, sizeof(*qphy), GFP_KERNEL); - if (!qphy) - return -ENOMEM; - - platform_set_drvdata(pdev, qphy); - - res = platform_get_resource(pdev, IORESOURCE_MEM, 0); - qphy->regs = devm_ioremap_resource(&pdev->dev, res); - if (IS_ERR(qphy->regs)) - return PTR_ERR(qphy->regs); - - phy = &qphy->phy; - phy->dev = &pdev->dev; - phy->label = dev_name(&pdev->dev); - phy->init = phy_8x16_init; - phy->shutdown = phy_8x16_shutdown; - phy->notify_connect = phy_8x16_notify_connect; - phy->notify_disconnect = phy_8x16_notify_disconnect; - phy->io_priv = qphy->regs + HSPHY_ULPI_VIEWPORT; - phy->io_ops = &ulpi_viewport_access_ops; - phy->type = USB_PHY_TYPE_USB2; - phy->vbus_nb.notifier_call = phy_8x16_vbus_notify; - phy->id_nb.notifier_call = NULL; - - ret = phy_8x16_read_devicetree(qphy); - if (ret < 0) - return ret; - - ret = clk_set_rate(qphy->core_clk, INT_MAX); - if (ret < 0) - dev_dbg(phy->dev, "Can't boost core clock\n"); - - ret = clk_prepare_enable(qphy->core_clk); - if (ret < 0) - return ret; - - ret = clk_prepare_enable(qphy->iface_clk); - if (ret < 0) - goto off_core; - - ret = regulator_bulk_enable(ARRAY_SIZE(qphy->regulator), - qphy->regulator); - if (WARN_ON(ret)) - goto off_clks; - - ret = usb_add_phy_dev(&qphy->phy); - if (ret) - goto off_power; - - qphy->reboot_notify.notifier_call = phy_8x16_reboot_notify; - register_reboot_notifier(&qphy->reboot_notify); - - return 0; - -off_power: - regulator_bulk_disable(ARRAY_SIZE(qphy->regulator), qphy->regulator); -off_clks: - clk_disable_unprepare(qphy->iface_clk); -off_core: - clk_disable_unprepare(qphy->core_clk); - return ret; -} - -static int phy_8x16_remove(struct platform_device *pdev) -{ - struct phy_8x16 *qphy = platform_get_drvdata(pdev); - - unregister_reboot_notifier(&qphy->reboot_notify); - - /* - * Ensure that D+/D- lines are routed to uB connector, so - * we could load bootloader/kernel at next reboot_notify - */ - gpiod_set_value_cansleep(qphy->switch_gpio, 0); - - usb_remove_phy(&qphy->phy); - - clk_disable_unprepare(qphy->iface_clk); - clk_disable_unprepare(qphy->core_clk); - regulator_bulk_disable(ARRAY_SIZE(qphy->regulator), qphy->regulator); - return 0; -} - -static const struct of_device_id phy_8x16_dt_match[] = { - { .compatible = "qcom,usb-8x16-phy" }, - { } -}; -MODULE_DEVICE_TABLE(of, phy_8x16_dt_match); - -static struct platform_driver phy_8x16_driver = { - .probe = phy_8x16_probe, - .remove = phy_8x16_remove, - .driver = { - .name = "phy-qcom-8x16-usb", - .of_match_table = phy_8x16_dt_match, - }, -}; -module_platform_driver(phy_8x16_driver); - -MODULE_LICENSE("GPL v2"); -MODULE_DESCRIPTION("Qualcomm APQ8016/MSM8916 chipsets USB transceiver driver");