From patchwork Fri Sep 21 11:53:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yoshihiro Shimoda X-Patchwork-Id: 10609927 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 A48D014BD for ; Fri, 21 Sep 2018 11:55:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 937AD2CC66 for ; Fri, 21 Sep 2018 11:55:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85A292D9A0; Fri, 21 Sep 2018 11:55:51 +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,DKIM_SIGNED, DKIM_VALID,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 EE12C2CC66 for ; Fri, 21 Sep 2018 11:55:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389867AbeIURoP (ORCPT ); Fri, 21 Sep 2018 13:44:15 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:23472 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389879AbeIURn6 (ORCPT ); Fri, 21 Sep 2018 13:43:58 -0400 Received: from unknown (HELO relmlir4.idc.renesas.com) ([10.200.68.154]) by relmlie2.idc.renesas.com with ESMTP; 21 Sep 2018 20:55:24 +0900 Received: from relmlii2.idc.renesas.com (relmlii2.idc.renesas.com [10.200.68.66]) by relmlir4.idc.renesas.com (Postfix) with ESMTP id 22AD974130; Fri, 21 Sep 2018 20:55:24 +0900 (JST) X-IronPort-AV: E=Sophos;i="5.54,284,1534777200"; d="scan'208";a="293141294" Received: from mail-ty1jpn01lp0184.outbound.protection.outlook.com (HELO JPN01-TY1-obe.outbound.protection.outlook.com) ([23.103.139.184]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-GCM-SHA384; 21 Sep 2018 20:55:23 +0900 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesasgroup.onmicrosoft.com; s=selector1-renesas-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ZHnQvTZrTiHqNBH5gBdwfGvJ6i8eJmu52SiL7tv8w0o=; b=BdIzqttiZc3Ep+sAc37l4DTW1IWE9cb5qYZADOvtezktaVP+Re2tIxag8eFX9xCBZh1tOLfeRBa3UrcVW2hL3ngXuWJ6no3coD1m0WMQq6IpZZFKUwpq0uNpq4TZOLlfl3oWOhQSg+Q+Gm5Aw3F3ggKTOi6BqB8zXqkdjbZ3Pq8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=<>; Received: from localhost.localdomain (211.11.155.144) by OSBPR01MB2296.jpnprd01.prod.outlook.com (2603:1096:603:26::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 11:55:22 +0000 From: Yoshihiro Shimoda To: kishon@ti.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-renesas-soc@vger.kernel.org, Yoshihiro Shimoda Subject: [PATCH 8/8] phy: renesas: rcar-gen3-usb2: add is_otg_channel to use "role" sysfs Date: Fri, 21 Sep 2018 20:53:24 +0900 Message-Id: <1537530804-19399-9-git-send-email-yoshihiro.shimoda.uh@renesas.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1537530804-19399-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> References: <1537530804-19399-1-git-send-email-yoshihiro.shimoda.uh@renesas.com> MIME-Version: 1.0 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: TYXPR01CA0065.jpnprd01.prod.outlook.com (2603:1096:403:a::35) To OSBPR01MB2296.jpnprd01.prod.outlook.com (2603:1096:603:26::17) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 84b148fd-de51-4508-14c5-08d61fb91c84 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(8559020)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020);SRVR:OSBPR01MB2296; X-Microsoft-Exchange-Diagnostics: 1;OSBPR01MB2296;3:kn4TmWQuWxJOn0w6vuY53pNXUlA0d9YL2m5dgDa2/NYYJtnPV3TKhcuHyatZ/a5jjqH6hrnoxr1DSkjCfRtcGi/YkgpY3H08tdLFIPqsCiOTw86tJj+ZBO3tHY7Nw1sBYW5MJV7jcNEH1KzGE5cCv8KmnpjBP6Qs+5rqhJqQPJF6181wQ3kLaS26eBN0xbjyth9K3N60I8125xQTwNkYdY8+qEZrH+tLN/WWIurVTq3hzAutdRv4p5s3V4y/BVAj;25:V3SvOiyNtTLSCpQrOuZ2Mgs4gnXg7EtfDDc1ivwBiv7v1a2raEPraZT/gmrAUdNKzNWm4XcDy7oLBgetdYAlGDtdmcbH7zQ1mQajhKCk/gj9U04SH7+jph6EL2NWnq8/C7IcG89b+rklV/x2KLesyGuJ18ah7DP6Cv5ebLVKE5itHESKplrKeJRGvPi8esej/oOT/J9ivvoCDd3dQ6OTofYARmOrVke66zaRnE0YEnh8v8YjrC5hPYsFWjsqcnPvPsobZoMb1YFgEVtqHltY/Awy1Vw3MAF88lS7Mmo3ofxtV1kws0vaamN9RGKmAiRK4AiTdWKU+VOMDTete3WdAw==;31:6l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ZdZi4pFbQ== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(3002001)(10201501046)(93006095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061750153)(20161123564045)(20161123562045)(20161123558120)(20161123560045)(201708071742011)(7699051);SRVR:OSBPR01MB2296;BCL:0;PCL:0;RULEID:;SRVR:OSBPR01MB2296; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(6069001)(346002)(376002)(39860400002)(136003)(396003)(366004)(199004)(189003)(66066001)(4326008)(52116002)(107886003)(6512007)(486006)(6506007)(42882007)(51416003)(386003)(47776003)(78352004)(476003)(26005)(6486002)(105586002)(11346002)(956004)(2616005)(53936002)(446003)(36756003)(76176011)(69590400006)(16526019)(25786009)(97736004)(50466002)(81166006)(5660300001)(50226002)(16586007)(8676002)(6116002)(3846002)(81156014)(68736007)(316002)(48376002)(14444005)(106356001)(498600001)(8936002)(305945005)(2906002)(7736002)(3720700003);DIR:OUT;SFP:1102;SCL:1;SRVR:OSBPR01MB2296;H:localhost.localdomain;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:0;MX:0; Received-SPF: None (protection.outlook.com: localhost.localdomain does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: 1;OSBPR01MB2296;23:14htaXDLNpKtuPO3b34tfIL/YfZBcFGStUSCWswcbiBzC+3PohIKQmH1ni+eZWnL49pcR8j2xx+Ruj3sN9sW5tUaFpLO1489UHtEvIqKZdHshnYv4watzFA5geydAwiDd5b4RkoacO2gtWBrRiaeCQP7x5jW61n5ifyU4vHJTy+8PFvoF80io1fybbR0v6ATv/T3ao+rmGgo/8SbMXwiWCe4axrWX3KxbHfpcD1PsKspj6epu/71OC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pLwgMLShRGNCAvDi8BmX4YHfztjdpzIVQFTGbUQNXY+jTwQ+nzfB/6pmY6tGLBPLcYOttejsm7H5rqJEWovbjB2FvUqWS0RDbpgM0sZyeqqYJx8Kv4DYoINW67p3DmJP3IawwsQ8zOCn6+ZNAEhJvHogNdLuiDHR6DeUc7y+HJL0rHEj SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1;OSBPR01MB2296;20:Y3PL55bnCjZQDCn8/XD8D2WblwUDKti5zgpQsoka5G8HFYWWtCR/cWysf3Lc7aDneBlvdw5rT+QIcRbhgBqkO96YG+ajqWUMavZb0euBqsI/U8YkAQYKX65WpRxYzpvmXevad1IOXGVs/sbnqBVCNEBmzPQ0SqwQTLsbvv3RWzU= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 11:55:22.5951 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 84b148fd-de51-4508-14c5-08d61fb91c84 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSBPR01MB2296 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 Even if a board doesn't have otg pins connection, this hardware can change the role by a register setting. So, this patch adds "is_otg_channel" for it. Signed-off-by: Yoshihiro Shimoda Reviewed-by: Simon Horman --- drivers/phy/renesas/phy-rcar-gen3-usb2.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/phy/renesas/phy-rcar-gen3-usb2.c b/drivers/phy/renesas/phy-rcar-gen3-usb2.c index 3f2efe5..9903aef 100644 --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c @@ -86,8 +86,19 @@ struct rcar_gen3_chan { struct work_struct work; enum usb_dr_mode dr_mode; bool extcon_host; + bool is_otg_channel; bool uses_otg_pins; }; +/* + * Combination about is_otg_channel and uses_otg_pins: + * + * Parameters || Behaviors + * is_otg_channel | uses_otg_pins || irqs | role sysfs + * ---------------------+---------------++--------------+------------ + * true | true || enabled | enabled + * true | false || disabled | enabled + * false | any || disabled | disabled + */ static void rcar_gen3_phy_usb2_work(struct work_struct *work) { @@ -244,7 +255,7 @@ static ssize_t role_store(struct device *dev, struct device_attribute *attr, bool is_b_device; enum phy_mode cur_mode, new_mode; - if (!ch->uses_otg_pins || !ch->phy->init_count) + if (!ch->is_otg_channel || !ch->phy->init_count) return -EIO; if (!strncmp(buf, "host", strlen("host"))) @@ -282,7 +293,7 @@ static ssize_t role_show(struct device *dev, struct device_attribute *attr, { struct rcar_gen3_chan *ch = dev_get_drvdata(dev); - if (!ch->uses_otg_pins || !ch->phy->init_count) + if (!ch->is_otg_channel || !ch->phy->init_count) return -EIO; return sprintf(buf, "%s\n", rcar_gen3_is_host(ch) ? "host" : @@ -320,7 +331,7 @@ static int rcar_gen3_phy_usb2_init(struct phy *p) writel(USB2_OC_TIMSET_INIT, usb2_base + USB2_OC_TIMSET); /* Initialize otg part */ - if (channel->uses_otg_pins) + if (channel->is_otg_channel) rcar_gen3_init_otg(channel); return 0; @@ -444,6 +455,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) if (channel->dr_mode != USB_DR_MODE_UNKNOWN) { int ret; + channel->is_otg_channel = true; channel->uses_otg_pins = !of_property_read_bool(dev->of_node, "renesas,no-otg-pins"); channel->extcon = devm_extcon_dev_allocate(dev, @@ -487,7 +499,7 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) dev_err(dev, "Failed to register PHY provider\n"); ret = PTR_ERR(provider); goto error; - } else if (channel->uses_otg_pins) { + } else if (channel->is_otg_channel) { int ret; ret = device_create_file(dev, &dev_attr_role); @@ -507,7 +519,7 @@ static int rcar_gen3_phy_usb2_remove(struct platform_device *pdev) { struct rcar_gen3_chan *channel = platform_get_drvdata(pdev); - if (channel->uses_otg_pins) + if (channel->is_otg_channel) device_remove_file(&pdev->dev, &dev_attr_role); pm_runtime_disable(&pdev->dev);