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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 33EFFCED628 for ; Wed, 9 Oct 2024 08:34:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=qaO6OZB9LNJ3CfL5hJwIDOwEl1I05oLk0c+YGhPFN5E=; b=awL6sXySsh/lu4sorp59cjzhY2 bHS0htETR2LQf5zsC53W1O4RbiswLLZwYejLuxbkSTqzULfJCP/38Lvah0fF4EGNPi3GWMKu22dRL CtklX/X6qUiZf/+mVRXOjp5XiA5wJ5OAtXK5IGdCAIcdnL05FCuKh3HagFkb0b5JVO6SzQJVUGkys 6g2WVg3UTxgtH6x84oFQgGPNy92FJrzjNoJW//dI4+eNoUSO+74lXyZJNc4A1ug+pg+XwnoRDtora yBI89HwCiR7NTzfs121JKmIZt1LAXcuS+LMY5kT6vdvk0D95geeuT7/ZAsBbGG2E070aOJrRc012R I1YdzpQQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1syS95-00000008TsB-29Sa; Wed, 09 Oct 2024 08:34:11 +0000 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1syS6K-00000008SsW-0I43 for linux-arm-kernel@lists.infradead.org; Wed, 09 Oct 2024 08:31:22 +0000 Received: by mail-lf1-x12f.google.com with SMTP id 2adb3069b0e04-5398cc2fcb7so7463866e87.1 for ; Wed, 09 Oct 2024 01:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1728462678; x=1729067478; darn=lists.infradead.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=qaO6OZB9LNJ3CfL5hJwIDOwEl1I05oLk0c+YGhPFN5E=; b=VwMKNg/27QpeAyKI9fgak9FmuQq/iiO57FcEY13YbqqMbMMTbHVpCbxPUM6WbOGJKS qyGiySBgoaoyeduae7kcmWcOBB838dIOrlHDvaQAL3SP47Xvg7FtnZSSEI/f+rkzQCP0 YELbsWOkDPYMytxO3OAXkwI3bj4xxXjF26BD2oiiU17taaBi4M3H4pZQ7f1Edv4wJHwh z0XLu46LSnRCyyaRJksIoeku/gBfyuQHRmskXZ3m1iZebbVFT5uDtBSpAb9sg/OGUZqN scExRU+UEfIPn9GfbFsu8mpQEEtG6P+Ii0jbPXykHXkO1osUSK96nd5NspWQ4lMuVu/2 dehw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728462678; x=1729067478; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=qaO6OZB9LNJ3CfL5hJwIDOwEl1I05oLk0c+YGhPFN5E=; b=PmsXFbeb64KImgRetWW19JVGOUNGe4DAno4098bVUwI0kRd2DJTAE4O9EWUNQKXUxo DTg03JJuN+OL4oJX3ZplEObWzt1Gtg8F0mDf5ANQw7RiZUW47LZv5xpSIL6h923muaIv E+1ICwNvGNdRpMz3QpwSIkmGyolAqPgPozg1y1+zXO9XbE/mFIpvltGJAF3V4OGAt1lG o66TF/koIHzgRVpoorc6n5whxmPykXjU9NaPeFBCBIPjQ1MDxWu68mZ/eoC0ZKu8u4GU oeYTyMgqcgEcQhpw8KPyHgWLrKR+x3jbN4qBdtanM3+cIJVEpccdWn76Vdl4zheS7Tun mNfw== X-Forwarded-Encrypted: i=1; AJvYcCWZb1bl5LQAPR6tMIfjcX6jU11PSV6TdIx4hyk6wd6aXws2Vyh1152cUHI1HzcDYV1TZpPgtq20PRDBxEKUKDkD@lists.infradead.org X-Gm-Message-State: AOJu0YwFWAO+2YyqfPJqb484xjq44ZuKhpUew1ZE9wgTvup6Mb6WAPLJ BlyBmbsrMcf0g0ybDIFserQu3/sb5780qESb8Nz3a66XXUlO+4zZeqJkVmbVPuU= X-Google-Smtp-Source: AGHT+IF3Q2wQGloa2V2XDPn7TmJqK0nuOUzhIW/QGvZ0irAUv57avGXp68LqGJgfaKW8c/fHZTF7TA== X-Received: by 2002:a05:6512:68f:b0:539:9f52:9e6 with SMTP id 2adb3069b0e04-539c49728d1mr835853e87.54.1728462677850; Wed, 09 Oct 2024 01:31:17 -0700 (PDT) Received: from [192.168.50.4] ([82.78.167.23]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a992e664fb9sm627251866b.88.2024.10.09.01.31.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 09 Oct 2024 01:31:17 -0700 (PDT) Message-ID: <229582da-270d-4188-a202-50e41493c7cb@tuxon.dev> Date: Wed, 9 Oct 2024 11:31:15 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 10/16] phy: renesas: rcar-gen3-usb2: Add support to initialize the bus Content-Language: en-US To: Geert Uytterhoeven Cc: vkoul@kernel.org, kishon@kernel.org, robh@kernel.org, krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de, geert+renesas@glider.be, magnus.damm@gmail.com, gregkh@linuxfoundation.org, mturquette@baylibre.com, sboyd@kernel.org, yoshihiro.shimoda.uh@renesas.com, biju.das.jz@bp.renesas.com, ulf.hansson@linaro.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org, linux-pm@vger.kernel.org, Claudiu Beznea References: <20240822152801.602318-1-claudiu.beznea.uj@bp.renesas.com> <20240822152801.602318-11-claudiu.beznea.uj@bp.renesas.com> From: claudiu beznea In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241009_013120_147094_2754016E X-CRM114-Status: GOOD ( 25.90 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi, Geert, On 08.10.2024 17:57, Geert Uytterhoeven wrote: > Hi Claudiu, > > On Thu, Aug 22, 2024 at 5:28 PM Claudiu wrote: >> >> From: Claudiu Beznea >> >> The Renesas RZ/G3S need to initialize the USB BUS before transferring data >> due to hardware limitation. As the register that need to be touched for >> this is in the address space of the USB PHY, and the UBS PHY need to be >> initialized before any other USB drivers handling data transfer, add >> support to initialize the USB BUS. >> >> As the USB PHY is probed before any other USB drivers that enables >> clocks and de-assert the reset signals and the BUS initialization is done >> in the probe phase, we need to add code to de-assert reset signal and >> runtime resume the device (which enables its clocks) before accessing >> the registers. >> >> As the reset signals are not required by the USB PHY driver for the other >> USB PHY hardware variants, the reset signals and runtime PM was handled >> only in the function that initialize the USB BUS. >> >> The PHY initialization was done right after runtime PM enable to have >> all in place when the PHYs are registered. >> >> Signed-off-by: Claudiu Beznea > > Thanks for your patch, which is now commit 4eae16375357a2a7 ("phy: > renesas: rcar-gen3-usb2: Add support to initialize the bus") in > v6.12-rc1. > >> --- a/drivers/phy/renesas/phy-rcar-gen3-usb2.c >> +++ b/drivers/phy/renesas/phy-rcar-gen3-usb2.c >> @@ -650,6 +658,35 @@ static enum usb_dr_mode rcar_gen3_get_dr_mode(struct device_node *np) >> return candidate; >> } >> >> +static int rcar_gen3_phy_usb2_init_bus(struct rcar_gen3_chan *channel) >> +{ >> + struct device *dev = channel->dev; >> + int ret; >> + u32 val; >> + >> + channel->rstc = devm_reset_control_array_get_shared(dev); >> + if (IS_ERR(channel->rstc)) >> + return PTR_ERR(channel->rstc); >> + >> + ret = pm_runtime_resume_and_get(dev); >> + if (ret) >> + return ret; >> + >> + ret = reset_control_deassert(channel->rstc); >> + if (ret) >> + goto rpm_put; >> + >> + val = readl(channel->base + USB2_AHB_BUS_CTR); >> + val &= ~USB2_AHB_BUS_CTR_MBL_MASK; >> + val |= USB2_AHB_BUS_CTR_MBL_INCR4; >> + writel(val, channel->base + USB2_AHB_BUS_CTR); >> + >> +rpm_put: >> + pm_runtime_put(dev); >> + >> + return ret; >> +} >> + >> static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) >> { >> const struct rcar_gen3_phy_drv_data *phy_data; >> @@ -703,6 +740,15 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) >> goto error; >> } >> >> + platform_set_drvdata(pdev, channel); >> + channel->dev = dev; > > Unrelated change? That's a leftover from the removal of the suspend to RAM support from the initial work (internal only) of this series. I'll keep it in mid to remove it on the following patches, if needed. > >> + >> + if (phy_data->init_bus) { >> + ret = rcar_gen3_phy_usb2_init_bus(channel); >> + if (ret) >> + goto error; >> + } >> + >> channel->soc_no_adp_ctrl = phy_data->no_adp_ctrl; >> if (phy_data->no_adp_ctrl) >> channel->obint_enable_bits = USB2_OBINT_IDCHG_EN; >> @@ -733,9 +779,6 @@ static int rcar_gen3_phy_usb2_probe(struct platform_device *pdev) >> channel->vbus = NULL; >> } >> >> - platform_set_drvdata(pdev, channel); >> - channel->dev = dev; >> - >> provider = devm_of_phy_provider_register(dev, rcar_gen3_phy_usb2_xlate); >> if (IS_ERR(provider)) { >> dev_err(dev, "Failed to register PHY provider\n"); > > The reset is not asserted in the error path, only in .remove(). > > Oh, Christophe already sent a fix for that... > "[PATCH v3] phy: renesas: rcar-gen3-usb2: Fix an error handling path > in rcar_gen3_phy_usb2_probe()" > https://lore.kernel.org/all/290b25827e3f0742808940719455ff0c5cb9d01d.1726329925.git.christophe.jaillet@wanadoo.fr Yes, I messed this when removing the suspend to RAM from my initial work on this (internal only). Thanks Christophe for handling it. Thank you, Claudiu Beznea > >> @@ -762,6 +805,7 @@ static void rcar_gen3_phy_usb2_remove(struct platform_device *pdev) >> if (channel->is_otg_channel) >> device_remove_file(&pdev->dev, &dev_attr_role); >> >> + reset_control_assert(channel->rstc); >> pm_runtime_disable(&pdev->dev); >> }; > > The rest LGTM. > > Gr{oetje,eeting}s, > > Geert >