From patchwork Wed Jun 30 17:30:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 468798 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, 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 E30DFC11F65 for ; Wed, 30 Jun 2021 17:30:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C107E61374 for ; Wed, 30 Jun 2021 17:30:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231879AbhF3RdY (ORCPT ); Wed, 30 Jun 2021 13:33:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39318 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbhF3RdX (ORCPT ); Wed, 30 Jun 2021 13:33:23 -0400 Received: from mail-io1-xd2e.google.com (mail-io1-xd2e.google.com [IPv6:2607:f8b0:4864:20::d2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 891D0C061756; Wed, 30 Jun 2021 10:30:54 -0700 (PDT) Received: by mail-io1-xd2e.google.com with SMTP id k16so4067256ios.10; Wed, 30 Jun 2021 10:30:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZkA2kH0ir4VrYzfKw+Bnoh3SYiMrQMASYfySQrKF/+Y=; b=CYOWm8fCgsuyBiZmVg9VMJvz55bY0z82J8rWYnHye6VjH/XpZePZRwsGsuioKNoAq2 E6T2ZuLyzVQ1R8v+yQcUF4S0/breKFE1hTzER5s/C6G6c2/YK/lC9FHGfybYKaL9zxAh NckQSaj2BM+6x7hM561eoR6YpRmdC0x3QuCdVO1oSjRtjd3fWeMC1WaC4+8hYjI6ggHN PSoIXhppVfuS23jYseAhBpADZtCFP0wVRgsP1wFchzmHmGx/DScmf90jJdGDn567dB5i 71yUvhePUFXLC3QxVU/XLcyhFj2MHkTWP6wZjTY3zEIDkraxmvbH+vNo9Wj5n1ayMGJw D67w== 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:mime-version :content-transfer-encoding; bh=ZkA2kH0ir4VrYzfKw+Bnoh3SYiMrQMASYfySQrKF/+Y=; b=BLu3FoJ3t78C8hP8lXO+Pq3H2MTvFWWQSt6bSlt63wK6CPDizDBVPumcPFK7GtOsX9 8AWJzUBHx3naHeDLN9Pyj0gne+/4yivn5LdstJwuFoWvD4DtMEYj0bdgADdrtouqyQhz x4koBhE5cqMfDF7Fl9qIQl/Hsj9sUDuKm5JZ7BR/nRoTQWQU+7tBVNLQHGsGlhuZzFAu d95iWCwyFap7QoJmW/IWVCxT3ryW3/H+fhtnhD2h9wYpUjvdn4ipLTuVU6qjmSK5WrvH 7EhTE7bn/BfhoHK6iN4dbgj4p/9ejw/aW2jx4cfDA9kMDJCtFnOZr/mFJegojqaJhDPd eIAQ== X-Gm-Message-State: AOAM533m5P+bRQEGzx4EtgDbuTb+0uldecQm6n5WTHrpg4UFYrxGWTYH urmygGYwi8ukh7BUO61lDapx6+Ua436UzWT/ X-Google-Smtp-Source: ABdhPJwhoD1OmmOWjhUbVu8iYuaFapecKT63UHWQ3u7fjWy/MwrRJmDbWqTC4dW1q1igmucH+gqYlg== X-Received: by 2002:a6b:3c01:: with SMTP id k1mr8622401iob.24.1625074253459; Wed, 30 Jun 2021 10:30:53 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan (c-73-37-219-234.hsd1.mn.comcast.net. [73.37.219.234]) by smtp.gmail.com with ESMTPSA id q19sm12207278ilc.70.2021.06.30.10.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 10:30:52 -0700 (PDT) From: Adam Ford To: linux-usb@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Greg Kroah-Hartman , Rob Herring , Geert Uytterhoeven , Magnus Damm , Yoshihiro Shimoda , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH 1/3] dt-bindings: usb: renesas, usbhs: Support external ref clock Date: Wed, 30 Jun 2021 12:30:40 -0500 Message-Id: <20210630173042.186394-1-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The usbhs driver expects a fixed external reference clock, but it could be sourced from a programmable clock instead of a fixed clock. Add support for an optional 4th reference clock. Signed-off-by: Adam Ford diff --git a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml index e67223d90bb7..2372d8c42979 100644 --- a/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml +++ b/Documentation/devicetree/bindings/usb/renesas,usbhs.yaml @@ -53,11 +53,12 @@ properties: clocks: minItems: 1 - maxItems: 3 + maxItems: 4 items: - description: USB 2.0 host - description: USB 2.0 peripheral - description: USB 2.0 clock selector + - description: Optional external reference clock interrupts: maxItems: 1 From patchwork Wed Jun 30 17:30:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 469202 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 7ECE5C11F6A for ; Wed, 30 Jun 2021 17:30:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 68BBD61374 for ; Wed, 30 Jun 2021 17:30:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232797AbhF3Rd0 (ORCPT ); Wed, 30 Jun 2021 13:33:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229963AbhF3Rd0 (ORCPT ); Wed, 30 Jun 2021 13:33:26 -0400 Received: from mail-io1-xd30.google.com (mail-io1-xd30.google.com [IPv6:2607:f8b0:4864:20::d30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BAE48C061756; Wed, 30 Jun 2021 10:30:55 -0700 (PDT) Received: by mail-io1-xd30.google.com with SMTP id l5so4085070iok.7; Wed, 30 Jun 2021 10:30:55 -0700 (PDT) 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=S/6SfVZWS0YYflq4a4eo7WY9BLDp47JLO2fbdfuvAO0=; b=uFXagmEtq03jeGCLgNbqFlj+DHIAjin6s+NHI3Fuev+APPI0tJwx8n/tp1ykgc/Ubh tswtID1mQXSHapvgG/BjT4agBZuyjMnFGSWGPbLSkHGxHLK8n+7wVwCf23I3ds06yEuo /ytvDqX48WE3wWWPmC5DSbBWcH5wX4s2QLWY/QDEnahjJB8exKo/ZEQVvE3vi/VNK4tx m7aMJeL8C8SSenwOwiJhjWXS/8UlD5JPeujDTeoM/a5HqOyaMbtZ3G4QXRLEaNa9Ttdc xQYe9Bto/mC8fMQRFwTMWvsewNRryz7hmZiYEC9CxJcYp2oTVo/xieORIP0WNCv85Uej 5C3w== 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=S/6SfVZWS0YYflq4a4eo7WY9BLDp47JLO2fbdfuvAO0=; b=labsB3EfzmyWUQOpITwaKll89T4626/wu2+C8QGK8BqISGwOxflXvd+9u4rDqmibRX UOOlyjc6BlDnc/pye0+mM+02O4m/R/x9TiLmthxmxijREHDwiAkY7v7V+x80byIQhbX2 WE/akYzFT1bQRXBtEHdiOyE+t5JvbAC3/hTawC7wh5bo+pUuh7riQeWspXziMy8xA8LD 9/KBqCflvx+qAvuZujwBjQ27LurE/KXH94ds0c4lLZCmo3RguwKGQB8zcV1+7bQ5D0z2 NfuNVPgyAnHfKE1QrF/Ck9F8ewAfN7Z6fWwTRc18fmPI7pMDnH5fR7vJAgFnvJmFP7uU H8cA== X-Gm-Message-State: AOAM5321O0ZCV561smkECRyHVXUA9nci76tvyjhS036/lDahxwLnb5Z5 EpqMsYeCwXIO1mQ0CVaFBiOASkcCYomqDIlg X-Google-Smtp-Source: ABdhPJzLhLnvayGj3GI+1wRlJkRK75PhYrGl4BaQF97tmg1P/JadDqGcHRzELsyB12YA/gWsZ2hzKg== X-Received: by 2002:a5e:8f03:: with SMTP id c3mr8370704iok.115.1625074254758; Wed, 30 Jun 2021 10:30:54 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan (c-73-37-219-234.hsd1.mn.comcast.net. [73.37.219.234]) by smtp.gmail.com with ESMTPSA id q19sm12207278ilc.70.2021.06.30.10.30.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 10:30:54 -0700 (PDT) From: Adam Ford To: linux-usb@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Greg Kroah-Hartman , Rob Herring , Geert Uytterhoeven , Magnus Damm , Yoshihiro Shimoda , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH 2/3] usb: renesas_usbhs: Enable support for more than two clks Date: Wed, 30 Jun 2021 12:30:41 -0500 Message-Id: <20210630173042.186394-2-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210630173042.186394-1-aford173@gmail.com> References: <20210630173042.186394-1-aford173@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The RZ/G2 boards expect there to be an external clock reference for USBHS controller, but this could be set by a programmable clock. For those devices using a programmable clock, there need to be two additional clocks beyond the internal reference clocks: rcar-usb2-clock-sel to specify we using an external clock, and the external reference clock itself. Make this driver dynamically enable all the clocks assigned to it instead of only enabling the first one or two clocks. Signed-off-by: Adam Ford diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c index 3af91b2b8f76..255e4bd68ed3 100644 --- a/drivers/usb/renesas_usbhs/common.c +++ b/drivers/usb/renesas_usbhs/common.c @@ -297,6 +297,8 @@ static bool usbhsc_is_multi_clks(struct usbhs_priv *priv) static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv) { + unsigned int i; + if (!usbhsc_is_multi_clks(priv)) return 0; @@ -309,11 +311,13 @@ static int usbhsc_clk_get(struct device *dev, struct usbhs_priv *priv) * To backward compatibility with old DT, this driver checks the return * value if it's -ENOENT or not. */ - priv->clks[1] = of_clk_get(dev_of_node(dev), 1); - if (PTR_ERR(priv->clks[1]) == -ENOENT) - priv->clks[1] = NULL; - else if (IS_ERR(priv->clks[1])) - return PTR_ERR(priv->clks[1]); + for (i = 1; i < ARRAY_SIZE(priv->clks); i++) { + priv->clks[1] = of_clk_get(dev->of_node, i); + if (PTR_ERR(priv->clks[i]) == -ENOENT) + priv->clks[i] = NULL; + else if (IS_ERR(priv->clks[i])) + return PTR_ERR(priv->clks[i]); + } return 0; } From patchwork Wed Jun 30 17:30:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 468797 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable 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 38AFEC11F69 for ; Wed, 30 Jun 2021 17:31:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2583A6147D for ; Wed, 30 Jun 2021 17:31:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232862AbhF3Rd3 (ORCPT ); Wed, 30 Jun 2021 13:33:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39328 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232802AbhF3Rd1 (ORCPT ); Wed, 30 Jun 2021 13:33:27 -0400 Received: from mail-il1-x129.google.com (mail-il1-x129.google.com [IPv6:2607:f8b0:4864:20::129]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 18C10C0617A8; Wed, 30 Jun 2021 10:30:57 -0700 (PDT) Received: by mail-il1-x129.google.com with SMTP id h3so3625754ilc.9; Wed, 30 Jun 2021 10:30:57 -0700 (PDT) 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=3KbPgH3Xk8vzy7N0rAGS5ZuHlPaO+BHPUcyIIVc3h3I=; b=u8HkHov21WA1HExul/8zyGWEsbf1N/U5ZMyWGWWpgejRWaeGKJT+r3zuHbAbzOtMnM +lbI3Eym1qhs8PFQ21FppbrjBC/jqwdr0FxownqnwE8vvztzUJudox3sJFUPczhtmJnn iRl6xvPqRP4GARFP1jPMJ9hZoRBIyrKrjAcAIxOs3vQPAX47OxhW1mnCLp2Z94ufA4Da dbwriB8AeK6tBe8V6l1yl4L8RaZ0B17+2DHEP5XaUrPnR8jPwJm4YctnNpduPfepQV2H KA8qGmWkeWRkiuBE8VyRuyB+M6qtfZRakkGlwHJZevmG9+drbNW0HwMvJ1uC0aHPVb/2 MkQQ== 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=3KbPgH3Xk8vzy7N0rAGS5ZuHlPaO+BHPUcyIIVc3h3I=; b=dhv2ecpqs+Sbytcvxtwi4KHr4V1JOcpISAGHXLrfpo9G4Xzx1WD1wp1fV+ys7Y/wIy 7XGA/5cE1ZcNhZQ29PaCOxK64o56YXnafQBLyS0hjm99fvKnPmlkKP7pzn9vi+7iCbIE drSSQLYQDZUOVWbsaPkz0uhgF/0/LhfStcG9lIAUtKvgXxcOrUTF6oPdKGj4VdpRjlOd qusTmNMzm8xboN7wkx+jWzpzZYhWQBUox7XAE2fGPfQMnFUn5rFg0XJLyv+IBm9l3BPE WVz6r3bf29eqkT/Fe0Dxy4nHtX0Jjl8AKJCrBpruetWc0kxEu8gtm44TBezA0GOJrz24 GV0g== X-Gm-Message-State: AOAM533m/HAM/+wu3e74GYjx8jvDjT8a99BLJDpV2vMg/oijmBbPCM5g 1Feqc9MXgfotOCNNSD/ToDOEyNBq/AxGemVU X-Google-Smtp-Source: ABdhPJxkQ7etaWYt01MmObyEx/AcGL616JW9qRgYnObv+//ZvlM0vNWrHrAk86WLeywUHb7iZNF4BA== X-Received: by 2002:a05:6e02:1d04:: with SMTP id i4mr13985844ila.149.1625074256038; Wed, 30 Jun 2021 10:30:56 -0700 (PDT) Received: from aford-IdeaCentre-A730.lan (c-73-37-219-234.hsd1.mn.comcast.net. [73.37.219.234]) by smtp.gmail.com with ESMTPSA id q19sm12207278ilc.70.2021.06.30.10.30.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Jun 2021 10:30:55 -0700 (PDT) From: Adam Ford To: linux-usb@vger.kernel.org Cc: aford@beaconembedded.com, Adam Ford , Greg Kroah-Hartman , Rob Herring , Geert Uytterhoeven , Magnus Damm , Yoshihiro Shimoda , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-renesas-soc@vger.kernel.org Subject: [PATCH 3/3] arm64: dts: renesas: beacon: Fix HSUSB ref clock references Date: Wed, 30 Jun 2021 12:30:42 -0500 Message-Id: <20210630173042.186394-3-aford173@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210630173042.186394-1-aford173@gmail.com> References: <20210630173042.186394-1-aford173@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org The RZ/G2 boards expect there to be an external clock reference for USBHS controller. For the Beacon boards, this reference clock is controlled by a programmable versaclock. Because the RZ/G2 family has a special clock driver when using an external clock, the third clock reference in the USBHS node needs to point to this special clock, called usb2_clksel, and the 4th clock is the versaclock. Signed-off-by: Adam Ford diff --git a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi b/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi index e3c8b2fe143e..bcbf7eb5195b 100644 --- a/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi +++ b/arch/arm64/boot/dts/renesas/beacon-renesom-baseboard.dtsi @@ -313,6 +313,7 @@ &hscif1 { }; &hsusb { + clocks = <&cpg CPG_MOD 704>, <&cpg CPG_MOD 703>, <&usb2_clksel>, <&versaclock6_som 3>; dr_mode = "otg"; status = "okay"; };