From patchwork Wed Dec 15 21:02:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12679429 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 CF669C433F5 for ; Wed, 15 Dec 2021 21:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UaAs95kU+9NFtfUKAK/WcKgSA6H/x7gUfYXbvFb6PH8=; b=ZsdKLFOjuuxwps 8NwcA7nF9vnp+CNsX2H900IWrNeJX43mlXoUeprFFh54iG8NCPjI+l4FU2f9O0JY6QUg7XmdpjFtG D3H0dPmtfo+JLyKDhtxuta4+DoWrnPB0vWpDjWjG5fxgngqlvfmaopoq9b2HzFuJpE2WaI84X7JLB qNfTJ85b6fPQWQ2MsuQ3HFl02Lbake4zbs2YLpgokRHBym2EscYO9d98g+aQ6LZcHU6K0FTpmJlHY QosyBVC6b5SqXAdmFfvRe/vZPke2bfTK9h4pWzK4PAHUkOFdlrlfzYArsEa8TT6jVVPWENFs7YNxD mMD2YTqL0pe5JRJjrVDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbQs-002igd-62; Wed, 15 Dec 2021 21:03:26 +0000 Received: from mail-qt1-x830.google.com ([2607:f8b0:4864:20::830]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbQT-002iW6-Pn; Wed, 15 Dec 2021 21:03:03 +0000 Received: by mail-qt1-x830.google.com with SMTP id m25so23211431qtq.13; Wed, 15 Dec 2021 13:03:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Qtvoh3tWKPnOw1Z92Liu2Y3L35YeCARO/v2RhKvSqa0=; b=mtzYePaF3q6HIoiwUrD0Qpoz7PMauWz+vbmYJ+etGbJ+OJRihIBkniO1SJtHiYRvBA IWAyQW69QJiqB8j5Nx4u0aivp7TATGW+K6mrQAjEeEDN5q1V5kbNCR9vDoKFgOGr47Ol NXJcJIpg6es+Ku0I6+uFDD2KW2nx3T0zXhQKr5sOuZ3d6pZ1ntQ3lY86HAy/4NCQEess bpOhLYfvUo5wSZFFowYAcCig4XlKqjKf99PPPd1cZdXk6dsnBv/USG70cVj9Rfrzm/65 FqunVFl+qqIxwchUM4kipSLPbISHrIKn4BdcgWzz1bUbQPIGW06zFWJCpuMfjYuzsb6R xNEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Qtvoh3tWKPnOw1Z92Liu2Y3L35YeCARO/v2RhKvSqa0=; b=pO3BcEh325x0Sjm5taInoklx4HZGKJc2sG7x+O6E9TVqvXH5tjsoM8/mRSePiiGRD0 R4sbi8YCTmvKNejuWYEYRS5JGpDlBIp2VY5Qw7H/Wfb0vT2osOWhfJkjAuThyPv0ecLO fW5LcKmpgqn9x+NPBDSDtYZ64qds3DWIYwuesQKq1RAHtXEFinWpD+DX0DEYi4GfrdZr hQOLzU8S766FoHGEQRxPItB5NQZgz/oMMSXs8EraR2O5QI3ODD1kHQKr5zww5u9glNHh hV7SyRBZtywkuZJxNeINlR/HryrgZ13pxvUB4gOO5G7j4PZc2a+t2q9JL54WQqr5Erx3 GIoQ== X-Gm-Message-State: AOAM533SVdIjD9WbVY+EmCl6Lv09BmvJZX3QesuIRxaRCH445wY7I+zs sPmGyYUN/8Vb+ZAS0H60x2pSzRNHcmT4UA== X-Google-Smtp-Source: ABdhPJzCgrybsdVfbHcMg+6x0kMS2UAJKkjdtqiz97/N6CuLvJ+knNOQtRgNMNMWkdBoAQCjKsaXuA== X-Received: by 2002:ac8:5e4a:: with SMTP id i10mr14343170qtx.569.1639602180345; Wed, 15 Dec 2021 13:03:00 -0800 (PST) Received: from master-x64.sparksnet (c-98-233-193-225.hsd1.md.comcast.net. [98.233.193.225]) by smtp.gmail.com with ESMTPSA id a20sm1644356qkh.63.2021.12.15.13.02.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 13:02:59 -0800 (PST) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Heiko Stuebner Cc: Peter Geis , Johan Jonker , Rob Herring , linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 2/8] dt-bindings: phy: phy-rockchip-inno-usb2: add rk3568 documentation Date: Wed, 15 Dec 2021 16:02:46 -0500 Message-Id: <20211215210252.120923-3-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215210252.120923-1-pgwipeout@gmail.com> References: <20211215210252.120923-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_130301_859037_13491761 X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The rk3568 usb2phy node is a standalone node with a single muxed interrupt. Add documentation for it to phy-rockchip-inno-usb2. Signed-off-by: Peter Geis Reviewed-by: Rob Herring --- This was the best solution I've come up with for this. I avoided creating another binding since this is such a simple change to the actual driver and would likely require renaming the existing binding. I've tested that this correctly flags if the interrupts are missing or incorrectly assigned on both rk356x and rk3399. Thank you Johan and Rob for your constructive feedback. .../bindings/phy/phy-rockchip-inno-usb2.yaml | 44 +++++++++++++++++-- 1 file changed, 40 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml index 5bebd86bf8b6..4b75289735eb 100644 --- a/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml +++ b/Documentation/devicetree/bindings/phy/phy-rockchip-inno-usb2.yaml @@ -18,6 +18,7 @@ properties: - rockchip,rk3328-usb2phy - rockchip,rk3366-usb2phy - rockchip,rk3399-usb2phy + - rockchip,rk3568-usb2phy - rockchip,rv1108-usb2phy reg: @@ -50,6 +51,10 @@ properties: description: Phandle to the extcon device providing the cable state for the otg phy. + interrupts: + description: Muxed interrupt for both ports + maxItems: 1 + rockchip,usbgrf: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -67,6 +72,7 @@ properties: interrupts: description: host linestate interrupt + maxItems: 1 interrupt-names: const: linestate @@ -78,8 +84,6 @@ properties: required: - "#phy-cells" - - interrupts - - interrupt-names otg-port: type: object @@ -109,8 +113,6 @@ properties: required: - "#phy-cells" - - interrupts - - interrupt-names required: - compatible @@ -120,6 +122,40 @@ required: - host-port - otg-port +allOf: + - if: + properties: + compatible: + contains: + const: rockchip,rk3568-usb2phy + + then: + properties: + host-port: + properties: + interrupts: false + + otg-port: + properties: + interrupts: false + + required: + - interrupts + + else: + properties: + interrupts: false + + host-port: + required: + - interrupts + - interrupt-names + + otg-port: + required: + - interrupts + - interrupt-names + additionalProperties: false examples: From patchwork Wed Dec 15 21:02:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12679431 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 AC2F8C433F5 for ; Wed, 15 Dec 2021 21:03:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=0onquYIKtFz8yeiJXAV736/hkmn4YV9AuoE77STgFdQ=; b=kguqxOoxxdxaxW 8r9SCPXO5mUk+T27CfjdoYagUdTUcEPXb/aVUH1M6wCIeTv6xCIO3WFOPGyrY7hi3xvJ14xVwvBus P+VWx6scZ/4vfBnaobyiuYXf8+bpSD/4zDv+kVAR0vLLZuTwAErsRZ1umSjhwNNQSlivOCQj6eHPl 8byJLA+iGVy0ColaD3zqbpJl6PkVafFaXVeOuFKB1IlhsDVaTuphorbmVIL8PC6Ypqo80Zjz/GpdG STBIp8PrwEB7eYOph3wGoEnAcZ98AW44UqfuOLxY8qxLoOd5WljQs27wi8zL87K14aHOaUBAFcc2U jgl9MCBl4/hyY+iAIn7A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbR4-002ikx-52; Wed, 15 Dec 2021 21:03:38 +0000 Received: from mail-qv1-xf33.google.com ([2607:f8b0:4864:20::f33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbQU-002iWb-Uu; Wed, 15 Dec 2021 21:03:04 +0000 Received: by mail-qv1-xf33.google.com with SMTP id o10so1033725qvc.5; Wed, 15 Dec 2021 13:03:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=df9+jLGWpWWmT9NM3fIUAh5IVXi+6QBCR7ad2jz9wxs=; b=JzeCQwWGA2Y/dMp1IC8Y1WVUbgo5GqL9++OUCRZzN+3uREgW8CmSli1xUFG3hD34VO iSBckW1mjWpPLH+TBXPVe6C6AS1b1PybBiFfJ8rk20C0mvzdZgF0CvrVNV/RUNZK9lot DzhYCTou5DyMyM2BJ1LcwYhitMfRUqCyjSGTfV34Ds9fR6sDjdgDYvtIQb1VM205cM/B LVjPh0E2yPZzstwuuj7IQWmnvoeeC1bN3CKwZ56z7Ht2BFD1X6HZQZuqRQCk3P60p9it UFG4VxenQrnkUCWtDvqRR8PazIl2VlYuQ3nkKfSXWR3jjTvlut3hHx44wvIzseEC1Kt/ Tijg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=df9+jLGWpWWmT9NM3fIUAh5IVXi+6QBCR7ad2jz9wxs=; b=qPY49BKZlfFFTgAoO9cSkKz4WklFjZHIrrjwgn05nU7mjSJgombrpOHY1lYBZ0E4tb VNHN1F7aAjb1Act8cxlIDyd8nMUPiTPA7HpANdw9KJ8BJfgvVweukv5pCDze1ocK3Vrl hEp7pihuiQijIvpRvzAvANyK4zMrBWbljNs32dkEgInLDYAZP/Oapaz2eS19XuYEGSHo 1kiyBBHttQPw2URIJacMmYviDKZHVsWErttdgjIh3gDVl0mx8jBAGSIrqEiaOF67wlMF UYK89N1Jtz3XQ5ItbQw4BRh7UXnNWIU1mUQi7k8/C40BwEArRK5ZoPMQaLQz3ThbS4A8 JMBw== X-Gm-Message-State: AOAM531VkeNqjvX9cHaUVceFTfQMKDptsXnaEp0sX044Wa5FTVoSGCof rJbf7P0v1TRcROwcg1OLjVHEgifqB3cY0w== X-Google-Smtp-Source: ABdhPJzHXdQm0FRg98q5/QgMAlc0JVYTPSGVQQd9VCPiFNJsnjMNmYl5B1HSmn6brcszCZCQc+qC+g== X-Received: by 2002:a05:6214:260c:: with SMTP id gu12mr13331158qvb.87.1639602181519; Wed, 15 Dec 2021 13:03:01 -0800 (PST) Received: from master-x64.sparksnet (c-98-233-193-225.hsd1.md.comcast.net. [98.233.193.225]) by smtp.gmail.com with ESMTPSA id a20sm1644356qkh.63.2021.12.15.13.03.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 13:03:01 -0800 (PST) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Michael Riesch , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 3/8] phy: phy-rockchip-inno-usb2: support #address_cells = 2 Date: Wed, 15 Dec 2021 16:02:47 -0500 Message-Id: <20211215210252.120923-4-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215210252.120923-1-pgwipeout@gmail.com> References: <20211215210252.120923-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_130303_024002_1678481C X-CRM114-Status: GOOD ( 13.03 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org New Rockchip devices have the usb phy nodes as standalone devices. These nodes have register nodes with #address_cells = 2, but only use 32 bit addresses. Adjust the driver to check if the returned address is "0", and adjust the index in that case. Signed-off-by: Peter Geis Tested-by: Michael Riesch --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 1938365abbb3..5cfa7169d879 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1091,12 +1091,21 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) rphy->usbgrf = NULL; } - if (of_property_read_u32(np, "reg", ®)) { + if (of_property_read_u32_index(np, "reg", 0, ®)) { dev_err(dev, "the reg property is not assigned in %pOFn node\n", np); return -EINVAL; } + /* support address_cells=2 */ + if (reg == 0) { + if (of_property_read_u32_index(np, "reg", 1, ®)) { + dev_err(dev, "the reg property is not assigned in %pOFn node\n", + np); + return -EINVAL; + } + } + rphy->dev = dev; phy_cfgs = match->data; rphy->chg_state = USB_CHG_STATE_UNDEFINED; From patchwork Wed Dec 15 21:02:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12679433 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 DD4B9C433EF for ; Wed, 15 Dec 2021 21:03:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=W0q7zZhvUnDgiD3xsYSdzap3AMQKJfcLEMQocvaXhP4=; b=1LtICOrIHyOtfZ YuQ/6qOPVIjRqBN3wy3ZEtpnYNQN3AEjHLlUhK7n0aVRA93K88zvN9Nc4SI8k2XyZeJtjKw7jjAWL 1hQtXyGFYge0FMjR3B6MclQnCY2tqYR5VkbUlNkLmge1fvCYutpxY519O5TGUYOz9HvkTrIOYNYjT geb3uHDt3sxuQ13++Uqi3/kE5g3fJ5UA6j28ejKosVg3IiZn/fFAImV10gd8XdKABTlebBXvJTFCA 07p6lzF2jNG11UPF3qsLJ2RY8U9uqcG7CMzj+O+nRf/MGB29+UcMf+cOzR9/5ZGh4LtcwQ6EgbY/m uZulDMMDiue5/jhGrQvA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbRI-002irU-AX; Wed, 15 Dec 2021 21:03:52 +0000 Received: from mail-qk1-x734.google.com ([2607:f8b0:4864:20::734]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbQW-002iXr-Cu; Wed, 15 Dec 2021 21:03:05 +0000 Received: by mail-qk1-x734.google.com with SMTP id l25so12082766qkl.5; Wed, 15 Dec 2021 13:03:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dxn6GGaZuVidLca/WMl3sqT9jVHJLPvQP6VZiUsVJrY=; b=XaWurc0R+0NGNOVmgUDJyVMha1V09ZYhzefIqaFhfkj0OWCWJ2k2r296h/SAHvtQ4+ NuTgnojrPxsYbSqfv296jcpMCB1OJbHpbWwEhzXk0OSplmoiAQy4DA652/H53A8EZhka 4LCfn7mdyifEhwEIJ4AoE7nuPfAIwjCZONbsY2DCmQmIuF/bsjQOTfdpJA33ffWfHyZL M1imDOgnAb9viTpFk3htBEeCa9uJCBbenjA4+TGWsmYROojLlM2IaSDMd3Ag8c1Xam9d VocniaETqsUqF5oqKT6P+KHxsB85eVTfaGDDq4jCStFPQcetcGG3eSmzcS4UvAJRwO3G vWhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dxn6GGaZuVidLca/WMl3sqT9jVHJLPvQP6VZiUsVJrY=; b=zJufZig5LaO1yq/2P+0tW8W9vkA47n+wHJHedu/gv7WA+HmiG2J7+m2r8dR46Fsa+B gMlT/+04gxB3/9f6RJbi9wLtDfR2Qmce/FuWNhIOgo2mNirJJgM6sX0qQOnRnAiW91ev /XxQgGwR2uwExTOjlC/parjygfcH736Sm91XREsAiNstgPLB2bEWjL0mxItoWYNwSqbK AJCj1msVTUGlZcD5RtujeyoA+KHMOw/keIu8mMqxTkH6tOj6QJ0TfxxVB4mRaWzaKXqm QtJOEvHjKeUE1pYTJ2vwKsNfxxcnrXRdtNq1bFvdCPsDKf5B2dZCzxwoflxggIGm/Hj1 JHiA== X-Gm-Message-State: AOAM530N5l4EJtVoOMc4ubVpKbY+MSizTTDdcrj5VSLwrWuMV19ozAjE oi/zVU8AEBDAOvY2aKlsWm4= X-Google-Smtp-Source: ABdhPJwz8LraXYh5bgWPQ24gKaH1IILFk+lRM2zMLltMoydsz/oJ62aRgdKdO2xo/lVSfOzWaIbFzg== X-Received: by 2002:a37:3d6:: with SMTP id 205mr10120606qkd.250.1639602182773; Wed, 15 Dec 2021 13:03:02 -0800 (PST) Received: from master-x64.sparksnet (c-98-233-193-225.hsd1.md.comcast.net. [98.233.193.225]) by smtp.gmail.com with ESMTPSA id a20sm1644356qkh.63.2021.12.15.13.03.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 13:03:02 -0800 (PST) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Michael Riesch , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 4/8] phy: phy-rockchip-inno-usb2: support standalone phy nodes Date: Wed, 15 Dec 2021 16:02:48 -0500 Message-Id: <20211215210252.120923-5-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215210252.120923-1-pgwipeout@gmail.com> References: <20211215210252.120923-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_130304_483750_5752726E X-CRM114-Status: GOOD ( 11.81 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org New Rockchip devices have the usb2 phy devices as standalone nodes instead of children of the grf node. Allow the driver to find the grf node from a phandle. Signed-off-by: Peter Geis Tested-by: Michael Riesch --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 5cfa7169d879..29e3a0da8c26 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1074,12 +1074,19 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) return -EINVAL; } - if (!dev->parent || !dev->parent->of_node) - return -EINVAL; + if (!dev->parent || !dev->parent->of_node) { + rphy->grf = syscon_regmap_lookup_by_phandle(np, "rockchip,usbgrf"); + if (IS_ERR(rphy->grf)) { + dev_err(dev, "failed to locate usbgrf\n"); + return PTR_ERR(rphy->grf); + } + } - rphy->grf = syscon_node_to_regmap(dev->parent->of_node); - if (IS_ERR(rphy->grf)) - return PTR_ERR(rphy->grf); + else { + rphy->grf = syscon_node_to_regmap(dev->parent->of_node); + if (IS_ERR(rphy->grf)) + return PTR_ERR(rphy->grf); + } if (of_device_is_compatible(np, "rockchip,rv1108-usb2phy")) { rphy->usbgrf = From patchwork Wed Dec 15 21:02:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12679435 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 5AFDEC433EF for ; Wed, 15 Dec 2021 21:04:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uBoO0afeclG2zfGdgIXTx6Z2IKgZmabJhTLj7ihifa8=; b=zej+ximHRl2ReU eIRfN4sNj5Ff65wmb0GlTZ50V9oXgrKoebqNpL0bfQJm+ygHPZ/KQ01h4W/19vH23wd025F7qPqYg dmx24BpEfU0BAenFTp0C8I990kr9zd1P2JJ8IaoLsjfuVmPX2FIhf1g71cttFrF4rvzH0cyT0QOkT ytOoeerIUZ5BsdTMNhEiHU6+qFZaED4iT+EV5sJREmYu/6zxXh8QYwoAFmn+UJ+JPsEm/2wA1hhvW pX0kjoLklQjshkzydcVD/DUARAfO0scc+rroegcs1IAEXivemq/KGUZVmE+IWC9iY/SMca0L5XHAe G0sJ3qCBtszZFcF2uF5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbRh-002j5r-Mc; Wed, 15 Dec 2021 21:04:17 +0000 Received: from mail-qv1-xf35.google.com ([2607:f8b0:4864:20::f35]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbQX-002iZ1-TM; Wed, 15 Dec 2021 21:03:07 +0000 Received: by mail-qv1-xf35.google.com with SMTP id gu12so21476528qvb.6; Wed, 15 Dec 2021 13:03:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cnamIWiam6by9Jdhi724L3CQvNB2/lSRkVxwvCCRpTo=; b=E1AEu1MGDxZu4j9qDkDta96pULE2hKFf4bJroAvAfoO6ZR1WTD2ERJD10H4LjEyEeI dTQKhY6wVd3TJVuMAb/bffsIFdIwL2YZiftTd5KOw8m+JM1uh69nSPCqoakNr5fIyHap h+55/q9gAcX6H85tvC9BsJzN0fsPEn4lYjeISWXbIb2gJ1+48TidjdfjpK+XsMixD4H/ oFI/YiPt47j041oTRZpU3m99Q4pz56J1PTqfXcW7iSRtXHHyTr8AtDHEyzBY5PfTRJgh +rWmMQpk/K3/4+Kv2w7HCiGZr+/foO9LibEUcWulrEO6IUhtTALAzS6wp+AxASB6GsvI 8DQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cnamIWiam6by9Jdhi724L3CQvNB2/lSRkVxwvCCRpTo=; b=P/6hky5EMzNLijqQ8PyPVjTcJcHT3qbu8/S8oL0Kf6lPFbMh4zD8/CZJg/JDC7jus5 P+jkl7jUukME/gPgJEtRgDbO1oMDYuHmBhs/Ih9juUAGr07R1TzON+kl6wbccsRomZP/ 2RTj6JhbWQWVJ/EZJXgE7fiGITVHvk/NUXKfyuvYeUFxJzYS9PPzTiCM1Izuryg++iRB 53LnH+8/lS60T0zX4BJDkwfFBkodZ/mfIP3m1ai0QY2G2XB+9vCjcAF8NxHEh8DB5CgY 2v01eodpu1l6KS3vlJzrHgYbyvFCffCOtEhQ/D7eHRRDWTYadg0Lq66PjTp4HW6uGdvl 74sQ== X-Gm-Message-State: AOAM5320kFqozk08rx6UWoMxYvR+LT8TcjbCcJZWT+SVKTqtk72t/Cwm Yj8XdXdhuj6AxXg2riEy5+4= X-Google-Smtp-Source: ABdhPJyifKmch0bI2sQrC3Chf/fDbNCvoFrt+qpN0s4H2EE7hzMscwXnhgQhMaapBWbNRPcoFcccHQ== X-Received: by 2002:a05:6214:1bcb:: with SMTP id m11mr10695510qvc.0.1639602184347; Wed, 15 Dec 2021 13:03:04 -0800 (PST) Received: from master-x64.sparksnet (c-98-233-193-225.hsd1.md.comcast.net. [98.233.193.225]) by smtp.gmail.com with ESMTPSA id a20sm1644356qkh.63.2021.12.15.13.03.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 13:03:03 -0800 (PST) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Michael Riesch , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/8] phy: phy-rockchip-inno-usb2: support muxed interrupts Date: Wed, 15 Dec 2021 16:02:49 -0500 Message-Id: <20211215210252.120923-6-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215210252.120923-1-pgwipeout@gmail.com> References: <20211215210252.120923-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_130306_001542_77DC6709 X-CRM114-Status: GOOD ( 19.96 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The rk3568 usb2phy has a single muxed interrupt that handles all interrupts. Allow the driver to plug in only a single interrupt as necessary. Signed-off-by: Peter Geis Tested-by: Michael Riesch --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 168 +++++++++++++----- 1 file changed, 119 insertions(+), 49 deletions(-) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 29e3a0da8c26..285958fdab38 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -204,6 +204,7 @@ struct rockchip_usb2phy_port { * @dcd_retries: The retry count used to track Data contact * detection process. * @edev: extcon device for notification registration + * @irq: muxed interrupt for single irq configuration * @phy_cfg: phy register configuration, assigned by driver data. * @ports: phy port instance. */ @@ -218,6 +219,7 @@ struct rockchip_usb2phy { enum power_supply_type chg_type; u8 dcd_retries; struct extcon_dev *edev; + int irq; const struct rockchip_usb2phy_cfg *phy_cfg; struct rockchip_usb2phy_port ports[USB2PHY_NUM_PORTS]; }; @@ -927,6 +929,102 @@ static irqreturn_t rockchip_usb2phy_otg_mux_irq(int irq, void *data) return IRQ_NONE; } +static irqreturn_t rockchip_usb2phy_irq(int irq, void *data) +{ + struct rockchip_usb2phy *rphy = data; + struct rockchip_usb2phy_port *rport; + irqreturn_t ret = IRQ_NONE; + unsigned int index; + + for (index = 0; index < rphy->phy_cfg->num_ports; index++) { + rport = &rphy->ports[index]; + if (!rport->phy) + continue; + + /* Handle linestate irq for both otg port and host port */ + ret = rockchip_usb2phy_linestate_irq(irq, rport); + } + + return ret; +} + +static int rockchip_usb2phy_port_irq_init(struct rockchip_usb2phy *rphy, + struct rockchip_usb2phy_port *rport, + struct device_node *child_np) +{ + int ret; + + /* + * If the usb2 phy used combined irq for otg and host port, + * don't need to init otg and host port irq separately. + */ + if (rphy->irq > 0) + return 0; + + switch (rport->port_id) { + case USB2PHY_PORT_HOST: + rport->ls_irq = of_irq_get_byname(child_np, "linestate"); + if (rport->ls_irq < 0) { + dev_err(rphy->dev, "no linestate irq provided\n"); + return rport->ls_irq; + } + + ret = devm_request_threaded_irq(rphy->dev, rport->ls_irq, NULL, + rockchip_usb2phy_linestate_irq, + IRQF_ONESHOT, + "rockchip_usb2phy", rport); + if (ret) { + dev_err(rphy->dev, "failed to request linestate irq handle\n"); + return ret; + } + break; + case USB2PHY_PORT_OTG: + /* + * Some SoCs use one interrupt with otg-id/otg-bvalid/linestate + * interrupts muxed together, so probe the otg-mux interrupt first, + * if not found, then look for the regular interrupts one by one. + */ + rport->otg_mux_irq = of_irq_get_byname(child_np, "otg-mux"); + if (rport->otg_mux_irq > 0) { + ret = devm_request_threaded_irq(rphy->dev, rport->otg_mux_irq, + NULL, + rockchip_usb2phy_otg_mux_irq, + IRQF_ONESHOT, + "rockchip_usb2phy_otg", + rport); + if (ret) { + dev_err(rphy->dev, + "failed to request otg-mux irq handle\n"); + return ret; + } + } else { + rport->bvalid_irq = of_irq_get_byname(child_np, "otg-bvalid"); + if (rport->bvalid_irq < 0) { + dev_err(rphy->dev, "no vbus valid irq provided\n"); + ret = rport->bvalid_irq; + return ret; + } + + ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq, + NULL, + rockchip_usb2phy_bvalid_irq, + IRQF_ONESHOT, + "rockchip_usb2phy_bvalid", + rport); + if (ret) { + dev_err(rphy->dev, + "failed to request otg-bvalid irq handle\n"); + return ret; + } + } + break; + default: + return -EINVAL; + } + + return 0; +} + static int rockchip_usb2phy_host_port_init(struct rockchip_usb2phy *rphy, struct rockchip_usb2phy_port *rport, struct device_node *child_np) @@ -940,18 +1038,9 @@ static int rockchip_usb2phy_host_port_init(struct rockchip_usb2phy *rphy, mutex_init(&rport->mutex); INIT_DELAYED_WORK(&rport->sm_work, rockchip_usb2phy_sm_work); - rport->ls_irq = of_irq_get_byname(child_np, "linestate"); - if (rport->ls_irq < 0) { - dev_err(rphy->dev, "no linestate irq provided\n"); - return rport->ls_irq; - } - - ret = devm_request_threaded_irq(rphy->dev, rport->ls_irq, NULL, - rockchip_usb2phy_linestate_irq, - IRQF_ONESHOT, - "rockchip_usb2phy", rport); + ret = rockchip_usb2phy_port_irq_init(rphy, rport, child_np); if (ret) { - dev_err(rphy->dev, "failed to request linestate irq handle\n"); + dev_err(rphy->dev, "failed to setup host irq\n"); return ret; } @@ -1000,44 +1089,10 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, INIT_DELAYED_WORK(&rport->chg_work, rockchip_chg_detect_work); INIT_DELAYED_WORK(&rport->otg_sm_work, rockchip_usb2phy_otg_sm_work); - /* - * Some SoCs use one interrupt with otg-id/otg-bvalid/linestate - * interrupts muxed together, so probe the otg-mux interrupt first, - * if not found, then look for the regular interrupts one by one. - */ - rport->otg_mux_irq = of_irq_get_byname(child_np, "otg-mux"); - if (rport->otg_mux_irq > 0) { - ret = devm_request_threaded_irq(rphy->dev, rport->otg_mux_irq, - NULL, - rockchip_usb2phy_otg_mux_irq, - IRQF_ONESHOT, - "rockchip_usb2phy_otg", - rport); - if (ret) { - dev_err(rphy->dev, - "failed to request otg-mux irq handle\n"); - goto out; - } - } else { - rport->bvalid_irq = of_irq_get_byname(child_np, "otg-bvalid"); - if (rport->bvalid_irq < 0) { - dev_err(rphy->dev, "no vbus valid irq provided\n"); - ret = rport->bvalid_irq; - goto out; - } - - ret = devm_request_threaded_irq(rphy->dev, rport->bvalid_irq, - NULL, - rockchip_usb2phy_bvalid_irq, - IRQF_ONESHOT, - "rockchip_usb2phy_bvalid", - rport); - if (ret) { - dev_err(rphy->dev, - "failed to request otg-bvalid irq handle\n"); - goto out; - } - } + ret = rockchip_usb2phy_port_irq_init(rphy, rport, child_np); + if (ret) { + dev_err(rphy->dev, "failed to init irq for host port\n"); + goto out; if (!IS_ERR(rphy->edev)) { rport->event_nb.notifier_call = rockchip_otg_event; @@ -1117,6 +1172,7 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) phy_cfgs = match->data; rphy->chg_state = USB_CHG_STATE_UNDEFINED; rphy->chg_type = POWER_SUPPLY_TYPE_UNKNOWN; + rphy->irq = platform_get_irq_optional(pdev, 0); platform_set_drvdata(pdev, rphy); ret = rockchip_usb2phy_extcon_register(rphy); @@ -1196,6 +1252,20 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) } provider = devm_of_phy_provider_register(dev, of_phy_simple_xlate); + + if (rphy->irq > 0) { + ret = devm_request_threaded_irq(rphy->dev, rphy->irq, NULL, + rockchip_usb2phy_irq, + IRQF_ONESHOT, + "rockchip_usb2phy", + rphy); + if (ret) { + dev_err(rphy->dev, + "failed to request usb2phy irq handle\n"); + goto put_child; + } + } + return PTR_ERR_OR_ZERO(provider); put_child: From patchwork Wed Dec 15 21:02:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12679437 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 791E7C433FE for ; Wed, 15 Dec 2021 21:04:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=rTgqLjuuGP7SUPS39Gms0PFyU14LQiGhB2drkAWm4OI=; b=QeIAi82KNsCCSQ fnGnP6UvRzgTOId+Z/gcHWuoluNqYuVuMH3UaPX45IOTYFNii32ipIxGD17GtYdT3pRx4aOiY3DjV vg7yAYb6SJOujAbFYr7E9Dwtn9oOQwrZt3Trr4Mc5kDFf4koYW32Gnb7WV9FxypP3LJD8BwLUYmm3 trVAHj5X2cHyUlYW9Yl1EBdTjwBmY+DKiposUZ9goaKhzXLPsZXAdCmNSqqVSqal56LdRsNCfghmo 38mLLidEVsVtdZJI5LAQ3XrCzPHTj51b4kjs/L6z856o1Yp2X9d/pfY+XWL/jE7YTntzmlX4ZBPIR 3zn36dujiMQm9MYTz5XA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbS6-002jMY-Le; Wed, 15 Dec 2021 21:04:42 +0000 Received: from mail-qk1-x736.google.com ([2607:f8b0:4864:20::736]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mxbQZ-002iZt-Aj; Wed, 15 Dec 2021 21:03:08 +0000 Received: by mail-qk1-x736.google.com with SMTP id 193so21347812qkh.10; Wed, 15 Dec 2021 13:03:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=js1jSO4OFQ7U7dS2izOYemvuMGJjz15gack2xht55jQ=; b=PtnYZZC4ELrFfJxFdXB/6jicCKg5x9/uj9D0bTr4fEufKEE7dleAzzjWUIwmbuclzD 2R7MySzIs+F1/17ZqnIQ8ipu+R1pSn+sdruOYeQyLSzm95/bR4jouhkg5bfcgBSZEDSs PC++lAgq14GowmWLAb7atAfctc2JJvxJp2PyQu446TCmjei8BQBg3SKeRA2AAT6mtmuw 4XMNx0T01o7sVZE5+CkbL3ucb+13a2z4MvBO1xRt9xhgiCmPhW9ekq+LHWyp+r54AFQv i8h2JnEUforYH3LHdXHYm1f67Wdo1olwmWQ1G8mq6C42jI+cjfQnilIfvV38rtc9S9b9 HEvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=js1jSO4OFQ7U7dS2izOYemvuMGJjz15gack2xht55jQ=; b=MCFPefLOEHAPa35SuVshA67xI2TibHYK1Im4Io/pNPJHOklRVnUCWZxRr0lwnkqVrv M160TdU9rEiQlib+iwi3s6XsqnSOtU/xrjjNnoxblAWUwVRlu7VuZ0DZfUPkV3QrQjnk 1G59FC31d2ogPX8FFI4dJ5mlFkEXH6lgr4I95bY0RCyFtvybjK7f12BXpipVjQkcFohB I0anKeuJQ/QhCXlI3Yzl57XeQxmrBot39W9aScQYknvMDlB6u058aH+YMvYkfMAxAvul WMTQOju+sWmhPHFw6cfBZFzHHzr7oO8BAbF1zNJo/hTDux6rH68VUhxAEgIrziEE/GCJ h8dQ== X-Gm-Message-State: AOAM530NX5taeCBK+vr9xprZuOU1AL3jA5VOxWkcrBuUXV54rV2/RXwp 9DL70a41faiofSdljLx9lfg= X-Google-Smtp-Source: ABdhPJxgxGpTirbr48viDuS6QNylWAPqepFaT7ltRmbj/eF8GAp+AmJ96662/GcMqD0KghZz+Y1GHg== X-Received: by 2002:a37:6716:: with SMTP id b22mr10005020qkc.123.1639602185799; Wed, 15 Dec 2021 13:03:05 -0800 (PST) Received: from master-x64.sparksnet (c-98-233-193-225.hsd1.md.comcast.net. [98.233.193.225]) by smtp.gmail.com with ESMTPSA id a20sm1644356qkh.63.2021.12.15.13.03.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 13:03:05 -0800 (PST) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , Michael Riesch , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/8] phy: phy-rockchip-inno-usb2: add rk3568 support Date: Wed, 15 Dec 2021 16:02:50 -0500 Message-Id: <20211215210252.120923-7-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215210252.120923-1-pgwipeout@gmail.com> References: <20211215210252.120923-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211215_130307_402783_61CC967B X-CRM114-Status: GOOD ( 12.45 ) X-BeenThere: linux-phy@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux Phy Mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-phy" Errors-To: linux-phy-bounces+linux-phy=archiver.kernel.org@lists.infradead.org The rk3568 usb2phy is a standalone device with a single muxed interrupt. Add support for the registers to the usb2phy driver. Signed-off-by: Peter Geis Tested-by: Michael Riesch --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index 285958fdab38..bdc5a861891c 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1093,6 +1093,7 @@ static int rockchip_usb2phy_otg_port_init(struct rockchip_usb2phy *rphy, if (ret) { dev_err(rphy->dev, "failed to init irq for host port\n"); goto out; + } if (!IS_ERR(rphy->edev)) { rport->event_nb.notifier_call = rockchip_otg_event; @@ -1504,6 +1505,69 @@ static const struct rockchip_usb2phy_cfg rk3399_phy_cfgs[] = { { /* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + { + .reg = 0xfe8a0000, + .num_ports = 2, + .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x0000, 8, 0, 0, 0x1d1 }, + .bvalid_det_en = { 0x0080, 2, 2, 0, 1 }, + .bvalid_det_st = { 0x0084, 2, 2, 0, 1 }, + .bvalid_det_clr = { 0x0088, 2, 2, 0, 1 }, + .utmi_avalid = { 0x00c0, 10, 10, 0, 1 }, + .utmi_bvalid = { 0x00c0, 9, 9, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { + /* Select suspend control from controller */ + .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d2 }, + .ls_det_en = { 0x0080, 1, 1, 0, 1 }, + .ls_det_st = { 0x0084, 1, 1, 0, 1 }, + .ls_det_clr = { 0x0088, 1, 1, 0, 1 }, + .utmi_ls = { 0x00c0, 17, 16, 0, 1 }, + .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 } + } + }, + .chg_det = { + .opmode = { 0x0000, 3, 0, 5, 1 }, + .cp_det = { 0x00c0, 24, 24, 0, 1 }, + .dcp_det = { 0x00c0, 23, 23, 0, 1 }, + .dp_det = { 0x00c0, 25, 25, 0, 1 }, + .idm_sink_en = { 0x0008, 8, 8, 0, 1 }, + .idp_sink_en = { 0x0008, 7, 7, 0, 1 }, + .idp_src_en = { 0x0008, 9, 9, 0, 1 }, + .rdm_pdwn_en = { 0x0008, 10, 10, 0, 1 }, + .vdm_src_en = { 0x0008, 12, 12, 0, 1 }, + .vdp_src_en = { 0x0008, 11, 11, 0, 1 }, + }, + }, + { + .reg = 0xfe8b0000, + .num_ports = 2, + .clkout_ctl = { 0x0008, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x0000, 8, 0, 0x1d2, 0x1d1 }, + .ls_det_en = { 0x0080, 0, 0, 0, 1 }, + .ls_det_st = { 0x0084, 0, 0, 0, 1 }, + .ls_det_clr = { 0x0088, 0, 0, 0, 1 }, + .utmi_ls = { 0x00c0, 5, 4, 0, 1 }, + .utmi_hstdet = { 0x00c0, 7, 7, 0, 1 } + }, + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0x0004, 8, 0, 0x1d2, 0x1d1 }, + .ls_det_en = { 0x0080, 1, 1, 0, 1 }, + .ls_det_st = { 0x0084, 1, 1, 0, 1 }, + .ls_det_clr = { 0x0088, 1, 1, 0, 1 }, + .utmi_ls = { 0x00c0, 17, 16, 0, 1 }, + .utmi_hstdet = { 0x00c0, 19, 19, 0, 1 } + } + }, + }, + { /* sentinel */ } +}; + static const struct rockchip_usb2phy_cfg rv1108_phy_cfgs[] = { { .reg = 0x100, @@ -1553,6 +1617,7 @@ static const struct of_device_id rockchip_usb2phy_dt_match[] = { { .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs }, { .compatible = "rockchip,rk3366-usb2phy", .data = &rk3366_phy_cfgs }, { .compatible = "rockchip,rk3399-usb2phy", .data = &rk3399_phy_cfgs }, + { .compatible = "rockchip,rk3568-usb2phy", .data = &rk3568_phy_cfgs }, { .compatible = "rockchip,rv1108-usb2phy", .data = &rv1108_phy_cfgs }, {} };