From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.7 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D0D6C433DB for ; Thu, 28 Jan 2021 22:14:08 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3E07E64DEE for ; Thu, 28 Jan 2021 22:14:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3E07E64DEE Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7xh25y1HNCgi9OoNz8Xl8M7Gp4wB2Aws36Y06U3U6vY=; b=biUlFAujGJzvHrT7FR8f/MZBW HNfjeftRRwBlvx42sFGTL5ozgXF8vgVnQZT0x2Vvy/1+gKDjM0x7YYGUz8tiq1OgLo+JVoXVPn9rZ 4I92q/6hL/kO6NCqHYgCCF6FRRL2q8ozATpOk4JdXsWi5LytJJuyfcOa4WLijkmSDOYR2RJ+u4FAg ZpIv0vEJm6YlN4MNv12LlFdfeBOt15R5qTdHl+Vrsc8g6dw/fW/kPoYiu+L9wEwRaL+A7B/8dYGKP OQ5NAsA7by+BDEcnNFn6sMrx1LVrSjpa3qhdsndRLGJ7VYFvbeHCCkCKJADGEQxOKxGbbhnI00PiC 5RniOjmYQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5FXF-0003wm-At; Thu, 28 Jan 2021 22:13:05 +0000 Received: from mail-wm1-x32a.google.com ([2a00:1450:4864:20::32a]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l5FXB-0003vV-4d for linux-arm-kernel@lists.infradead.org; Thu, 28 Jan 2021 22:13:01 +0000 Received: by mail-wm1-x32a.google.com with SMTP id m2so5470805wmm.1 for ; Thu, 28 Jan 2021 14:13:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=n/P5FFcNzsxODKKP+5LfDWtJfLSg3Bh91nzVHSKL8Hk=; b=S159UZzewbvZojYVyWKpOxEj77wOhftlSnoIJvLJGft2Fhdifw8BYGugje58RwCx6a RcGP5+b8pZtz/Ej/uesQJ0vyy8DvDdxPJpXUmNFBCaDFi2xJdRB2L4VNSqWyFZ/Hid7w nLOCNdoKR5gUHcCG3KFV43icWFQCGfXy4jsPl3WU5vhRIuqSTnD6GyqNpRiJHthp8+lZ RVcylz1J4Om7BD4U4qKVDz0qzt9c+l9cZhEXJ/qnqzLy+VJ8SL4gbVvgR3ozopoRFJ+a 6g5L8NC+fL4sM+rPPvmS4fK/umzvnAaplvl/8CN7CXb9HhFurpHUbS41e8qly+gPo2gP 6H2Q== 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:mime-version:content-transfer-encoding; bh=n/P5FFcNzsxODKKP+5LfDWtJfLSg3Bh91nzVHSKL8Hk=; b=FGGK3tA8HosOWy+iJIsN/3Hb3W/XRzQ7u9aB665e+qhxWgRa5ikmgebVQH4RbCW+7R wojkWpf3Ufk2UfUj8JmiFZYLC/ATIhUkBaQjm2rr5/yJQbYcTB8Hk0KtaUS+difDYzEn JAI2mYIjjV2huMOYwWwuhWgGkeZzRIKhhvVyBk65kfwZEQUVDHS2WPyv3sJoHjTj4Rid 7NyescRQhRO1pYxMiz3LhZboNcj926X9+nJzJ9kNlwGE3v9ukEwcHJsYe6RIxFt1dZtO xxtwgxuqdNMJar//H/lCwpc+ZViPaFrRTL0r4Ja3KG+YI9cs5uaniruGenhpNI89zAtv Wbvg== X-Gm-Message-State: AOAM530yAK7hLpQldig5NxUZ8m0KI+pp4VYdA7BDUBqL49iqDZcwN4Az erc/H0CBelpS3QYq5Usfd7w= X-Google-Smtp-Source: ABdhPJyYurIKduQc35t/+KvVQixNBy2wBDo76yhICMq1Tnh7ocxmAFtdddQS8Gr3mm+i8EOrGB2cBw== X-Received: by 2002:a05:600c:204d:: with SMTP id p13mr1171088wmg.42.1611871979942; Thu, 28 Jan 2021 14:12:59 -0800 (PST) Received: from adgra-XPS-15-9570.home (2a01cb0008bd27002d89afd37b57a164.ipv6.abo.wanadoo.fr. [2a01:cb00:8bd:2700:2d89:afd3:7b57:a164]) by smtp.gmail.com with ESMTPSA id c9sm5284110wrw.76.2021.01.28.14.12.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Jan 2021 14:12:59 -0800 (PST) From: Adrien Grassein To: Subject: [PATCH 2/2] phy: fsl-imx8mq-usb: handle resettable hubs Date: Thu, 28 Jan 2021 23:12:55 +0100 Message-Id: <20210128221255.2673992-2-adrien.grassein@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210128221255.2673992-1-adrien.grassein@gmail.com> References: <20210128221255.2673992-1-adrien.grassein@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210128_171301_236728_6B5359CE X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: peter.chen@nxp.com, devicetree@vger.kernel.org, festevam@gmail.com, s.hauer@pengutronix.de, linux-kernel@vger.kernel.org, rikard.falkeborn@gmail.com, kishon@ti.com, vkoul@kernel.org, robh+dt@kernel.org, linux-imx@nxp.com, kernel@pengutronix.de, Adrien Grassein , shawnguo@kernel.org, linux-arm-kernel@lists.infradead.org, jun.li@nxp.com Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Add an optional GPIO in the dtb description that will be used to reset the connected hub (if any). Signed-off-by: Adrien Grassein --- drivers/phy/freescale/phy-fsl-imx8mq-usb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c index a29b4a6f7c24..00abf7814fe9 100644 --- a/drivers/phy/freescale/phy-fsl-imx8mq-usb.c +++ b/drivers/phy/freescale/phy-fsl-imx8mq-usb.c @@ -4,6 +4,7 @@ #include #include #include +#include #include #include #include @@ -36,6 +37,7 @@ struct imx8mq_usb_phy { struct clk *clk; void __iomem *base; struct regulator *vbus; + struct gpio_desc *reset_gpio; }; static int imx8mq_usb_phy_init(struct phy *phy) @@ -111,6 +113,9 @@ static int imx8mq_phy_power_on(struct phy *phy) if (ret) return ret; + if (imx_phy->reset_gpio) + gpiod_set_value_cansleep(imx_phy->reset_gpio, 0); + return clk_prepare_enable(imx_phy->clk); } @@ -120,6 +125,8 @@ static int imx8mq_phy_power_off(struct phy *phy) clk_disable_unprepare(imx_phy->clk); regulator_disable(imx_phy->vbus); + if (imx_phy->reset_gpio) + gpiod_set_value_cansleep(imx_phy->reset_gpio, 1); return 0; } @@ -153,6 +160,7 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) struct device *dev = &pdev->dev; struct imx8mq_usb_phy *imx_phy; const struct phy_ops *phy_ops; + int ret; imx_phy = devm_kzalloc(dev, sizeof(*imx_phy), GFP_KERNEL); if (!imx_phy) @@ -180,6 +188,15 @@ static int imx8mq_usb_phy_probe(struct platform_device *pdev) if (IS_ERR(imx_phy->vbus)) return PTR_ERR(imx_phy->vbus); + imx_phy->reset_gpio = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); + if (IS_ERR(imx_phy->reset_gpio)) { + ret = PTR_ERR(imx_phy->reset_gpio); + if (ret == -ENXIO || ret == -ENODEV) + imx_phy->reset_gpio = NULL; + else + return PTR_ERR(imx_phy->reset_gpio); + } + phy_set_drvdata(imx_phy->phy, imx_phy); phy_provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel