From patchwork Mon Nov 7 20:39:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Axel Haslam X-Patchwork-Id: 9416051 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id DCFFA6022E for ; Mon, 7 Nov 2016 20:44:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CCA7328D24 for ; Mon, 7 Nov 2016 20:44:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE43328E03; Mon, 7 Nov 2016 20:44:08 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 2ECEA28D24 for ; Mon, 7 Nov 2016 20:44:08 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c3qka-0002Cg-Bf; Mon, 07 Nov 2016 20:42:40 +0000 Received: from mail-wm0-x22d.google.com ([2a00:1450:400c:c09::22d]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c3qii-0001J5-7I for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2016 20:40:46 +0000 Received: by mail-wm0-x22d.google.com with SMTP id a197so206634183wmd.0 for ; Mon, 07 Nov 2016 12:40:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cqErCec5vitBZnTg5z3WsUFIMLk7et6BtYrc51EHMac=; b=zAsdqU2hTS+OHDXZKWtMflkCgY/H4lxjIswbMIAQ1Vo1vud6XPbcxJE4c6Ie0fDs0w lfgdQvsa2+Y4wJvh3uvoinrO2GKU7sTsB+cjF6bkkMlh+93XzoJUiM7O8HksyqfZnyvl RKG2lDhlhjxZSyKFC/DuGEwvR2LYt5xVAAbaSADEQdNytxNHffqIHp9J+SZnkwgz6isr VJnrRAktx9QaHS5oxCW/ee1zlg3RTrpxF/pAtdbdiFe/ooemLKjDZTbqHVOoo+7NMEmF jrR4LkRpjDu7rOERcbt6eDN9KEJZWw5uls6oJoK+UcLZJUpEikTPnV+hPIaZu8IVaUCv xKYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cqErCec5vitBZnTg5z3WsUFIMLk7et6BtYrc51EHMac=; b=KAyXsS0vSxAEgxT/BTovj4lwYxgF/lzNJ0hJ6oCnegJuXFLEGuUBMIPZ0DINL7l/M7 4IufHYLQ1lwYBN3Ba66Swr8sh47PZwgBfSY30n13eMbQxGc+UJHa7y7/o2L8wWvWn7Wy Wo6dTi85QlySfJkEPbrAsBp+4AWsbpXUhw3II38EXQ5ZaBoRalLUkSldV8ODckiuHzch yfKhXwdrCiurgyaWlRfxvXTUdBoM3gQ4Bf/wQbr4ETM5jImBO/wlcj9p4U1Y8u1FiJyI 96SmNYoUcCz4z3/sP4rcyVRw5tTobSb5oIiT5GEZ8SGilxX7RvEa8jMYE4xM03Wi/9QW oNig== X-Gm-Message-State: ABUngvc+6JAbR20jtrmaWGYL93Zo8DOKO9RT6jP45PrUZ3jJuDDjk5w6Qkdx0OMUqd+zu8uE X-Received: by 10.28.165.137 with SMTP id o131mr3738061wme.9.1478551222494; Mon, 07 Nov 2016 12:40:22 -0800 (PST) Received: from localhost.localdomain (ANice-652-1-139-209.w83-201.abo.wanadoo.fr. [83.201.210.209]) by smtp.gmail.com with ESMTPSA id r7sm19626644wjp.43.2016.11.07.12.40.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 07 Nov 2016 12:40:22 -0800 (PST) From: Axel Haslam To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org, nsekhar@ti.com, khilman@kernel.org, david@lechnology.com, robh+dt@kernel.org Subject: [PATCH v3 06/10] USB: ohci: da8xx: Remove ohci platform callbacks Date: Mon, 7 Nov 2016 21:39:44 +0100 Message-Id: <20161107203948.28324-7-ahaslam@baylibre.com> X-Mailer: git-send-email 2.10.1.502.g6598894 In-Reply-To: <20161107203948.28324-1-ahaslam@baylibre.com> References: <20161107203948.28324-1-ahaslam@baylibre.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161107_124044_682604_52556630 X-CRM114-Status: GOOD ( 17.67 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, Axel Haslam , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Now that all ohci users are are using a regulator, we can remove the platform callbacks and data. potpgt is no longer necessary as a power on delay time can be specified for the regulator itself. Signed-off-by: Axel Haslam --- arch/arm/mach-davinci/board-da830-evm.c | 2 +- arch/arm/mach-davinci/board-omapl138-hawk.c | 2 +- arch/arm/mach-davinci/include/mach/da8xx.h | 2 +- arch/arm/mach-davinci/usb-da8xx.c | 3 +- drivers/usb/host/ohci-da8xx.c | 84 ++--------------------------- include/linux/platform_data/usb-davinci.h | 20 ------- 6 files changed, 9 insertions(+), 104 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index 16a401a..cb67885 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -129,7 +129,7 @@ static __init void da830_evm_usb_init(void) if (ret) pr_warn("fail to add ohci regulator\n"); - ret = da8xx_register_usb11(NULL); + ret = da8xx_register_usb11(); if (ret) pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret); } diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index a252404..cbe7324 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -197,7 +197,7 @@ static __init void omapl138_hawk_usb_init(void) pr_warn("%s: USB PHY registration failed: %d\n", __func__, ret); - ret = da8xx_register_usb11(NULL); + ret = da8xx_register_usb11(); if (ret) pr_warn("%s: USB 1.1 registration failed: %d\n", __func__, ret); diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h index 43322be..6096402 100644 --- a/arch/arm/mach-davinci/include/mach/da8xx.h +++ b/arch/arm/mach-davinci/include/mach/da8xx.h @@ -91,7 +91,7 @@ int da8xx_register_spi_bus(int instance, unsigned num_chipselect); int da8xx_register_watchdog(void); int da8xx_register_usb_phy(void); int da8xx_register_usb20(unsigned mA, unsigned potpgt); -int da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata); +int da8xx_register_usb11(void); int da8xx_register_usb_refclkin(int rate); int da8xx_register_usb20_phy_clk(bool use_usb_refclkin); int da8xx_register_usb11_phy_clk(bool use_usb_refclkin); diff --git a/arch/arm/mach-davinci/usb-da8xx.c b/arch/arm/mach-davinci/usb-da8xx.c index c6feecf..4ea91bb 100644 --- a/arch/arm/mach-davinci/usb-da8xx.c +++ b/arch/arm/mach-davinci/usb-da8xx.c @@ -119,9 +119,8 @@ static struct platform_device da8xx_usb11_device = { .resource = da8xx_usb11_resources, }; -int __init da8xx_register_usb11(struct da8xx_ohci_root_hub *pdata) +int __init da8xx_register_usb11(void) { - da8xx_usb11_device.dev.platform_data = pdata; return platform_device_register(&da8xx_usb11_device); } diff --git a/drivers/usb/host/ohci-da8xx.c b/drivers/usb/host/ohci-da8xx.c index 0a4b885..3dcbf1f 100644 --- a/drivers/usb/host/ohci-da8xx.c +++ b/drivers/usb/host/ohci-da8xx.c @@ -89,12 +89,8 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); int ret; - if (hub && hub->set_power) - return hub->set_power(1, on); - if (!da8xx_ohci->vbus_reg) return 0; @@ -121,11 +117,6 @@ static int ohci_da8xx_set_power(struct usb_hcd *hcd, int on) static int ohci_da8xx_get_power(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); - - if (hub && hub->get_power) - return hub->get_power(1); if (da8xx_ohci->vbus_reg) return regulator_is_enabled(da8xx_ohci->vbus_reg); @@ -137,13 +128,9 @@ static int ohci_da8xx_get_oci(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); unsigned int flags; int ret; - if (hub && hub->get_oci) - return hub->get_oci(1); - if (!da8xx_ohci->vbus_reg) return 0; @@ -159,29 +146,9 @@ static int ohci_da8xx_get_oci(struct usb_hcd *hcd) return 0; } -static int ohci_da8xx_has_set_power(struct usb_hcd *hcd) +static int ohci_da8xx_has_regulator(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); - - if (hub && hub->set_power) - return 1; - - if (da8xx_ohci->vbus_reg) - return 1; - - return 0; -} - -static int ohci_da8xx_has_oci(struct usb_hcd *hcd) -{ - struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); - struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); - - if (hub && hub->get_oci) - return 1; if (da8xx_ohci->vbus_reg) return 1; @@ -189,30 +156,9 @@ static int ohci_da8xx_has_oci(struct usb_hcd *hcd) return 0; } -static int ohci_da8xx_has_potpgt(struct usb_hcd *hcd) -{ - struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); - - if (hub && hub->potpgt) - return 1; - - return 0; -} - /* * Handle the port over-current indicator change. */ -static void ohci_da8xx_ocic_handler(struct da8xx_ohci_root_hub *hub, - unsigned port) -{ - ocic_mask |= 1 << port; - - /* Once over-current is detected, the port needs to be powered down */ - if (hub->get_oci(port) > 0) - hub->set_power(port, 0); -} - static int ohci_da8xx_regulator_event(struct notifier_block *nb, unsigned long event, void *data) { @@ -233,12 +179,9 @@ static int ohci_da8xx_register_notify(struct usb_hcd *hcd) { struct da8xx_ohci_hcd *da8xx_ohci = to_da8xx_ohci(hcd); struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); int ret = 0; - if (hub && hub->ocic_notify) - ret = hub->ocic_notify(ohci_da8xx_ocic_handler); - else if (da8xx_ohci->vbus_reg) { + if (da8xx_ohci->vbus_reg) { da8xx_ohci->nb.notifier_call = ohci_da8xx_regulator_event; ret = devm_regulator_register_notifier(da8xx_ohci->vbus_reg, &da8xx_ohci->nb); @@ -250,19 +193,9 @@ static int ohci_da8xx_register_notify(struct usb_hcd *hcd) return ret; } -static void ohci_da8xx_unregister_notify(struct usb_hcd *hcd) -{ - struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); - - if (hub && hub->ocic_notify) - hub->ocic_notify(NULL); -} - static int ohci_da8xx_reset(struct usb_hcd *hcd) { struct device *dev = hcd->self.controller; - struct da8xx_ohci_root_hub *hub = dev_get_platdata(dev); struct ohci_hcd *ohci = hcd_to_ohci(hcd); int result; u32 rh_a; @@ -291,20 +224,14 @@ static int ohci_da8xx_reset(struct usb_hcd *hcd) * register's default value, so that ohci_hub_control() could return * the correct hub descriptor... */ - rh_a = ohci_readl(ohci, &ohci->regs->roothub.a); - if (ohci_da8xx_has_set_power(hcd)) { + if (ohci_da8xx_has_regulator(hcd)) { + rh_a = ohci_readl(ohci, &ohci->regs->roothub.a); rh_a &= ~RH_A_NPS; rh_a |= RH_A_PSM; - } - if (ohci_da8xx_has_oci(hcd)) { rh_a &= ~RH_A_NOCP; rh_a |= RH_A_OCPM; + ohci_writel(ohci, rh_a, &ohci->regs->roothub.a); } - if (ohci_da8xx_has_potpgt(hcd)) { - rh_a &= ~RH_A_POTPGT; - rh_a |= hub->potpgt << 24; - } - ohci_writel(ohci, rh_a, &ohci->regs->roothub.a); return result; } @@ -479,7 +406,6 @@ static int ohci_da8xx_remove(struct platform_device *pdev) { struct usb_hcd *hcd = platform_get_drvdata(pdev); - ohci_da8xx_unregister_notify(hcd); usb_remove_hcd(hcd); usb_put_hcd(hcd); diff --git a/include/linux/platform_data/usb-davinci.h b/include/linux/platform_data/usb-davinci.h index 0926e99..58f4be0 100644 --- a/include/linux/platform_data/usb-davinci.h +++ b/include/linux/platform_data/usb-davinci.h @@ -11,26 +11,6 @@ #ifndef __ASM_ARCH_USB_H #define __ASM_ARCH_USB_H -struct da8xx_ohci_root_hub; - -typedef void (*da8xx_ocic_handler_t)(struct da8xx_ohci_root_hub *hub, - unsigned port); - -/* Passed as the platform data to the OHCI driver */ -struct da8xx_ohci_root_hub { - /* Switch the port power on/off */ - int (*set_power)(unsigned port, int on); - /* Read the port power status */ - int (*get_power)(unsigned port); - /* Read the port over-current indicator */ - int (*get_oci)(unsigned port); - /* Over-current indicator change notification (pass NULL to disable) */ - int (*ocic_notify)(da8xx_ocic_handler_t handler); - - /* Time from power on to power good (in 2 ms units) */ - u8 potpgt; -}; - void davinci_setup_usb(unsigned mA, unsigned potpgt_ms); #endif /* ifndef __ASM_ARCH_USB_H */