From patchwork Wed Apr 10 14:48:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 10894113 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DF7AF13B5 for ; Wed, 10 Apr 2019 14:55:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C52B22880C for ; Wed, 10 Apr 2019 14:55:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9996289E8; Wed, 10 Apr 2019 14:55:40 +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=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 51D9C2880C for ; Wed, 10 Apr 2019 14:55:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732939AbfDJOzj (ORCPT ); Wed, 10 Apr 2019 10:55:39 -0400 Received: from relmlor1.renesas.com ([210.160.252.171]:21761 "EHLO relmlie5.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1732919AbfDJOzj (ORCPT ); Wed, 10 Apr 2019 10:55:39 -0400 X-IronPort-AV: E=Sophos;i="5.60,332,1549897200"; d="scan'208";a="12864633" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 10 Apr 2019 23:55:37 +0900 Received: from be1yocto.ree.adwin.renesas.com (unknown [172.29.43.62]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 246EE42272B3; Wed, 10 Apr 2019 23:55:34 +0900 (JST) From: Biju Das To: Kishon Vijay Abraham I , Alan Stern , Yoshihiro Shimoda Cc: Biju Das , Simon Horman , Wolfram Sang , Simon Horman , Geert Uytterhoeven , Kuninori Morimoto , Chris Paterson , Fabrizio Castro , linux-renesas-soc@vger.kernel.org Subject: [PATCH V5 04/13] phy: rcar-gen3-usb2: Add support for r8a77470 Date: Wed, 10 Apr 2019 15:48:41 +0100 Message-Id: <1554907730-14792-5-git-send-email-biju.das@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1554907730-14792-1-git-send-email-biju.das@bp.renesas.com> References: <1554907730-14792-1-git-send-email-biju.das@bp.renesas.com> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch adds support for r8a77470 (RZ/G1C). We can reuse this driver for initializing timing/interrupt generation registers. Signed-off-by: Biju Das Reviewed-by: Yoshihiro Shimoda Tested-by: Yoshihiro Shimoda --- V4-->V5 * Incorporated Kishan and Shimoda-san's review comment https://patchwork.kernel.org/patch/10893387/ V3-->V4 * Incorporated Kishan and Shimoda-san's review comment https://patchwork.kernel.org/patch/10883265/ V2-->V3 * Incorporated shimoda-san's review comment Ref: https://patchwork.kernel.org/patch/10655855/ --- drivers/phy/renesas/Kconfig | 2 +- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 39 +++++++++++++++++++++++++++----- 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/drivers/phy/renesas/Kconfig b/drivers/phy/renesas/Kconfig index e340a92..111bdca 100644 --- a/drivers/phy/renesas/Kconfig +++ b/drivers/phy/renesas/Kconfig @@ -19,7 +19,7 @@ config PHY_RCAR_GEN3_PCIE config PHY_RCAR_GEN3_USB2 tristate "Renesas R-Car generation 3 USB 2.0 PHY driver" depends on ARCH_RENESAS - depends on EXTCON + depends on EXTCON || !EXTCON # if EXTCON=m, this cannot be built-in depends on USB_SUPPORT select GENERIC_PHY select USB_COMMON diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index 0a34782..e3a88b9 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -393,6 +393,12 @@ static const struct phy_ops rcar_gen3_phy_usb2_ops = { .owner = THIS_MODULE, }; +static const struct phy_ops rz_g1c_phy_usb2_ops = { + .init = rcar_gen3_phy_usb2_init, + .exit = rcar_gen3_phy_usb2_exit, + .owner = THIS_MODULE, +}; + static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) { struct rcar_gen3_chan *ch = _ch; @@ -411,11 +417,27 @@ static irqreturn_t rcar_gen3_phy_usb2_irq(int irq, void *_ch) } static const struct of_device_id rcar_gen3_phy_usb2_match_table[] = { - { .compatible = "renesas,usb2-phy-r8a7795" }, - { .compatible = "renesas,usb2-phy-r8a7796" }, - { .compatible = "renesas,usb2-phy-r8a77965" }, - { .compatible = "renesas,rcar-gen3-usb2-phy" }, - { } + { + .compatible = "renesas,usb2-phy-r8a77470", + .data = &rz_g1c_phy_usb2_ops, + }, + { + .compatible = "renesas,usb2-phy-r8a7795", + .data = &rcar_gen3_phy_usb2_ops, + }, + { + .compatible = "renesas,usb2-phy-r8a7796", + .data = &rcar_gen3_phy_usb2_ops, + }, + { + .compatible = "renesas,usb2-phy-r8a77965", + .data = &rcar_gen3_phy_usb2_ops, + }, + { + .compatible = "renesas,rcar-gen3-usb2-phy", + .data = &rcar_gen3_phy_usb2_ops, + }, + { /* sentinel */ }, }; MODULE_DEVICE_TABLE(of, rcar_gen3_phy_usb2_match_table); @@ -431,6 +453,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) struct rcar_gen3_chan *channel; struct phy_provider *provider; struct resource *res; + const struct phy_ops *phy_usb2_ops; int irq, ret = 0; if (!dev->of_node) { @@ -481,7 +504,11 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) * And then, phy-core will manage runtime pm for this device. */ pm_runtime_enable(dev); - channel->phy = devm_phy_create(dev, NULL, &rcar_gen3_phy_usb2_ops); + phy_usb2_ops = of_device_get_match_data(dev); + if (!phy_usb2_ops) + return -EINVAL; + + channel->phy = devm_phy_create(dev, NULL, phy_usb2_ops); if (IS_ERR(channel->phy)) { dev_err(dev, "Failed to create USB2 PHY\n"); ret = PTR_ERR(channel->phy);