From patchwork Fri Oct 11 05:42:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Peter Chen X-Patchwork-Id: 11184827 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C55B615AB for ; Fri, 11 Oct 2019 05:42:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9C3FF21D56 for ; Fri, 11 Oct 2019 05:42:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="OLiVqi+f" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbfJKFmg (ORCPT ); Fri, 11 Oct 2019 01:42:36 -0400 Received: from mail-eopbgr60073.outbound.protection.outlook.com ([40.107.6.73]:62878 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726174AbfJKFmf (ORCPT ); Fri, 11 Oct 2019 01:42:35 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Uzv+jjc6qtWyYQOV9RSiykYLpcYz5sUaqtbIj8MykKxJ+iEfncmOfdr0Mz/yL8jueyif1VXUacb2U8/lLE1xlFfxdQFUHBUhqWCa4bP8rK1CyQtzUfz+rJ7Q3+jjrrHqIknmlCROz6FXDgB3TTxdatSeo+/2Pnz3VUjEJCsZdosEnLy0CUWYEjOfWsHk1Zzz8VVKd7cw+9PudG6vFKSRjfY+Saf6fB0kB6+krkFh63am3lvUjwFyb2QOTqfk6VSZgM6sbSizxwuGT9glLxFC05K1YeU0oMd2gaEFm4g9OgRvfZucqZa4qxUWvOlpkA70XF2F8xLR1wVI89+8c9czLA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eCnyjx2pNLho7fw8/gE7ZHKqHepncWcuOGmM7JFEO1E=; b=FfEXZuzJ5h7l9zBNSVFjLfvW8QWhL8TlLE59qz9InXciV4XRddFgHH5A6lgGds91GdCCbPhPFJabSki39gFVf7vCnCtzxGI656FYaM2ql4sgTXGtJ5rDrs9Qsv/WyqAPRXQpy/k6v1T6jlTypAa9UE/jRxf8mYWVX8Rpqe7RdE38Cprh9LqzyQLD0kJXUSBq9z1ciiw7bEHJQCZODgChdgX+2dHaJhdxpOcYoc7HncBuKMJRfQTL3GfmJ7P1m04U4oW+7oBZTg2SuitxGhS1skH4KXdljxSXG4k6cD+1bnCQY4XIxHaB0SCZouOjJZaceHZoUOYNv6Z7hW5ojzskQA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eCnyjx2pNLho7fw8/gE7ZHKqHepncWcuOGmM7JFEO1E=; b=OLiVqi+fabZulkn3mWrIzkM8sL93hAVIf6FR3sAPbKsLW76BzARKefcMcF0R/iM8pW+TKdl09fo9fkvzJbOqAGU7wMnU88xzdqfBr9aW1WZYOpWqTm6rXRHMwGuKNl8Dp9xWSVyZLvdZ1yYrIRayatoGtozUgHZfn1tffEKflVM= Received: from AM0PR04MB5314.eurprd04.prod.outlook.com (20.177.41.157) by AM0PR04MB4915.eurprd04.prod.outlook.com (20.176.215.212) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2347.16; Fri, 11 Oct 2019 05:42:31 +0000 Received: from AM0PR04MB5314.eurprd04.prod.outlook.com ([fe80::99b0:3cb8:e409:1798]) by AM0PR04MB5314.eurprd04.prod.outlook.com ([fe80::99b0:3cb8:e409:1798%6]) with mapi id 15.20.2347.021; Fri, 11 Oct 2019 05:42:31 +0000 From: Peter Chen To: "linux-usb@vger.kernel.org" CC: dl-linux-imx , "git@andred.net" , Peter Chen Subject: [PATCH 3/3] usb: chipidea: imx: pinctrl for HSIC is optional Thread-Topic: [PATCH 3/3] usb: chipidea: imx: pinctrl for HSIC is optional Thread-Index: AQHVf/as820hEURzI0yo31E55+YF3g== Date: Fri, 11 Oct 2019 05:42:31 +0000 Message-ID: <20191011054129.20502-3-peter.chen@nxp.com> References: <20191011054129.20502-1-peter.chen@nxp.com> In-Reply-To: <20191011054129.20502-1-peter.chen@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-mailer: git-send-email 2.17.1 x-clientproxiedby: TY2PR01CA0024.jpnprd01.prod.outlook.com (2603:1096:404:a::36) To AM0PR04MB5314.eurprd04.prod.outlook.com (2603:10a6:208:cd::29) authentication-results: spf=none (sender IP is ) smtp.mailfrom=peter.chen@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [119.31.174.66] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 0100a91d-004e-4f0d-2efd-08d74e0dcec6 x-ms-office365-filtering-ht: Tenant x-ms-traffictypediagnostic: AM0PR04MB4915:|AM0PR04MB4915: x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:569; x-forefront-prvs: 0187F3EA14 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(979002)(4636009)(376002)(366004)(136003)(396003)(39860400002)(346002)(189003)(199004)(6436002)(2501003)(446003)(2351001)(2616005)(14444005)(256004)(6512007)(8936002)(5640700003)(50226002)(66574012)(6916009)(486006)(8676002)(11346002)(476003)(186003)(81166006)(81156014)(44832011)(1076003)(26005)(386003)(305945005)(54906003)(52116002)(66946007)(102836004)(316002)(5660300002)(86362001)(36756003)(71190400001)(64756008)(66556008)(66446008)(6506007)(6486002)(66476007)(3846002)(6116002)(25786009)(478600001)(14454004)(71200400001)(76176011)(4326008)(7736002)(2906002)(99286004)(66066001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM0PR04MB4915;H:AM0PR04MB5314.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: fX/5iM0Gnfo82xheswE7SRDeai5b8BkJhQIz12MbkslBe2YJddDB6nbPv8vo+dkXHOCDzJRV9i8E/zH1/Pm8EjE1K2VSyufkozT+IfVDXZqVJJzsVrP8iRcw2mXgRzxjD9krUVYwG6MmA8tUwaKdSAbt5GjGGOFIxS9lKCoiMOxoD8mRly68Te0vlcSoxMLpWQJUV5oZAObWNqeFVxGg8HteiGee3vDGnBFbXk1TOQ963hng6NNwhca25Ieqqd6viwA3gPD7VFiKDmdHNHlwFjPcikgrGNRkiThNhgZmx2JE/1oB9yVZ8MjtYiXL15Rz4Fo4jqDHkfWkkH7qN+8DMX8gNTDiAumD683HRsPXLTcPNk2OcPSP4/FRFQUK0pHjSZ31gcn2vbqhwIuIvFVNUry11BE6u0gEZ57xTKukD2Y= Content-ID: MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0100a91d-004e-4f0d-2efd-08d74e0dcec6 X-MS-Exchange-CrossTenant-originalarrivaltime: 11 Oct 2019 05:42:31.0498 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: ROK63+rA1kkQYOxOXF/6Hr7C0CQxhO6nfIEv8KzC/MH/T2qTWXrhBhk99UCnyGlGZ8dfGZsZ/oDKLBu6muPAwg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB4915 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org For imx chipidea controllers, if they use mxs PHY, they need pinctrl for HSIC. Otherwise, it doesn't need pinctrl and usbmisc control. Like imx7d and imx8mm. Reported-by: AndréDraszik Signed-off-by: Peter Chen --- drivers/usb/chipidea/ci_hdrc_imx.c | 63 +++++++++++++++++------------- 1 file changed, 35 insertions(+), 28 deletions(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index c34fcc079cd4..d8e7eb2f97b9 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -274,11 +274,14 @@ static int ci_hdrc_imx_notify_event(struct ci_hdrc *ci, unsigned int event) switch (event) { case CI_HDRC_IMX_HSIC_ACTIVE_EVENT: - ret = pinctrl_select_state(data->pinctrl, - data->pinctrl_hsic_active); - if (ret) - dev_err(dev, "hsic_active select failed, err=%d\n", - ret); + if (data->pinctrl) { + ret = pinctrl_select_state(data->pinctrl, + data->pinctrl_hsic_active); + if (ret) + dev_err(dev, + "hsic_active select failed, err=%d\n", + ret); + } break; case CI_HDRC_IMX_HSIC_SUSPEND_EVENT: ret = imx_usbmisc_hsic_set_connect(data->usbmisc_data); @@ -306,7 +309,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) const struct ci_hdrc_imx_platform_flag *imx_platform_flag; struct device_node *np = pdev->dev.of_node; struct device *dev = &pdev->dev; - struct pinctrl_state *pinctrl_hsic_idle; of_id = of_match_device(ci_hdrc_imx_dt_ids, dev); if (!of_id) @@ -339,6 +341,33 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) return PTR_ERR(data->pinctrl); } + data->hsic_pad_regulator = + devm_regulator_get_optional(dev, "hsic"); + if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { + /* no pad regualator is needed */ + data->hsic_pad_regulator = NULL; + } else if (IS_ERR(data->hsic_pad_regulator)) { + if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER) + dev_err(dev, + "Get HSIC pad regulator error: %ld\n", + PTR_ERR(data->hsic_pad_regulator)); + return PTR_ERR(data->hsic_pad_regulator); + } + + if (data->hsic_pad_regulator) { + ret = regulator_enable(data->hsic_pad_regulator); + if (ret) { + dev_err(dev, + "Failed to enable HSIC pad regulator\n"); + return ret; + } + } + } + + /* HSIC pinctrl handling */ + if (data->pinctrl) { + struct pinctrl_state *pinctrl_hsic_idle; + pinctrl_hsic_idle = pinctrl_lookup_state(data->pinctrl, "idle"); if (IS_ERR(pinctrl_hsic_idle)) { dev_err(dev, @@ -361,28 +390,6 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) PTR_ERR(data->pinctrl_hsic_active)); return PTR_ERR(data->pinctrl_hsic_active); } - - data->hsic_pad_regulator = - devm_regulator_get_optional(dev, "hsic"); - if (PTR_ERR(data->hsic_pad_regulator) == -ENODEV) { - /* no pad regualator is needed */ - data->hsic_pad_regulator = NULL; - } else if (IS_ERR(data->hsic_pad_regulator)) { - if (PTR_ERR(data->hsic_pad_regulator) != -EPROBE_DEFER) - dev_err(dev, - "Get HSIC pad regulator error: %ld\n", - PTR_ERR(data->hsic_pad_regulator)); - return PTR_ERR(data->hsic_pad_regulator); - } - - if (data->hsic_pad_regulator) { - ret = regulator_enable(data->hsic_pad_regulator); - if (ret) { - dev_err(dev, - "Failed to enable HSIC pad regulator\n"); - return ret; - } - } } if (pdata.flags & CI_HDRC_PMQOS)