From patchwork Thu Aug 12 20:41:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12434239 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 33F88C432BE for ; Thu, 12 Aug 2021 20:42:30 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id EB98F610A8 for ; Thu, 12 Aug 2021 20:42:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org EB98F610A8 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=vlVCOPzZxpJD/UP58NWxmaNFasBd5pnaSgMb2UzxQ1Y=; b=QdqGbMaclqzt4n LgUNoWo9LR5CapCREqcDfFlpCF3Vj+jYodZ5T+7027Z8GHiofIw+R9ZJji1bILsfy8RLbHyKEuSiY kk457VTRbKIqYQZmUdD7QQSmDDlm4KJ7N2pOfBUV91HhNBsQdlKjWJtP0pn89OJY6POyHelopQYHw OTkqmP5+wLo7e7/+1CuXEaKGtgjjIXK3UtZe08C0r9G2q/Dy1NbXd9ctWTT9dduoltnUs/tE0OrO1 CNjg2riKFWg3QvyP7VFHdKJ/fc82s+BOCQ/tN8hptQ9tMuQSLTXa1Ob75tzEKF1mCkkjDnz1rQk+K tB1ANQbd5z74vbmZPg9w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHX3-00BBbZ-5N; Thu, 12 Aug 2021 20:42:29 +0000 Received: from mail-qk1-x72a.google.com ([2607:f8b0:4864:20::72a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHWa-00BBOm-70; Thu, 12 Aug 2021 20:42:01 +0000 Received: by mail-qk1-x72a.google.com with SMTP id f23so8203230qkk.13; Thu, 12 Aug 2021 13:41:59 -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=ochq/82t5xUPXvIID1znrVTmhLe5E8Izsp9c+gWvjrs=; b=Ed+L/+HybSvG4ub6uDGYR4D3031+XqS2vV/V6Zxga1iPxvcAIKPkTXPVoHkCVCs+Jc OKUpjvQMuusgI+rqnw2LTK+aJ2VxMT5xjukAFHS3q+mwW19KSl6HlxU63WGj3x3RBAvr MOxZmmj52Fo0YcckO8dSOhTrhBgiP/5R1ePBp9JKzIxrBtfztUWJVSOBO1JfHLFdW7Ba hspMqOkcp9js009uvTsU7HDcdWMpXA0UoLF0DX8sgc+tZBK0fMs8MFs+UTAtwUJOk+IX WwjfNLmZKGHiCxD4PV3ngGlugVyUsslMv0PxzSi4LsJAmzoGCndHxLA6WC6pg748Bk/W oy/w== 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=ochq/82t5xUPXvIID1znrVTmhLe5E8Izsp9c+gWvjrs=; b=i9UcV4/NQ6+0JllXiP0fcNPkeK89OCMF0Q4zvL2z3F5m4W3vFkkrU79FIvJUrSkTY7 9NUX87ZEKh75WLuUxJdpf+HMX/afxzblNB5GuCOY16Ko03R6TRUdDvV/xrnMClA+/PEz PfLwF0oTYmuaQyI1mBsynTHNatg33UPQDBhAa5LyArc/KhDuH5B+qVwd6oc3KyOualw8 MMPN7TBBu7yrYBBBE1ziVJh/zRoul0yKiDrNgughMiDt1h9cdA31c+KggKwbFfzHAP7c AQhS8rdrpIcvpVBzywVHlHrN7sj9JHpC5dqGrAYPQXEQiv7cIurYb1xWkRVqmJeQwbvY Ltgg== X-Gm-Message-State: AOAM5314e/5u8Lb8+vPLHrbHi7r28w+UuhJLS4oKolZB6KetbA6GyXcE vpu7Mfl9t8DE402hVwvfT74= X-Google-Smtp-Source: ABdhPJxc8txTOhaH5bN7e5C0ZZdy7/xbhS9z9tOTuYM+5y6GbHfXe3ZldmfmU/BYBbYY0BHqOmGbkQ== X-Received: by 2002:a37:43ca:: with SMTP id q193mr6552744qka.459.1628800919041; Thu, 12 Aug 2021 13:41:59 -0700 (PDT) Received: from master-laptop.sparksnet ([2601:153:980:85b1:e89f:d077:9161:1bd7]) by smtp.gmail.com with ESMTPSA id m16sm1940361qki.19.2021.08.12.13.41.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 13:41:58 -0700 (PDT) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Rob Herring , Heiko Stuebner Cc: Peter Geis , 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 v2 2/8] dt-bindings: phy: phy-rockchip-inno-usb2: add rk3568 documentation Date: Thu, 12 Aug 2021 16:41:10 -0400 Message-Id: <20210812204116.2303617-3-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812204116.2303617-1-pgwipeout@gmail.com> References: <20210812204116.2303617-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_134200_300382_86591A3B X-CRM114-Status: GOOD ( 11.18 ) 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 --- .../bindings/phy/phy-rockchip-inno-usb2.yaml | 31 ++++++++++++++++--- 1 file changed, 27 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..d2a749c3f9a3 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,9 @@ properties: description: Phandle to the extcon device providing the cable state for the otg phy. + interrupts: + description: Muxed interrupt for both ports + rockchip,usbgrf: $ref: /schemas/types.yaml#/definitions/phandle description: @@ -78,8 +82,6 @@ properties: required: - "#phy-cells" - - interrupts - - interrupt-names otg-port: type: object @@ -109,8 +111,6 @@ properties: required: - "#phy-cells" - - interrupts - - interrupt-names required: - compatible @@ -120,6 +120,29 @@ required: - host-port - otg-port +allOf: + - if: + properties: + compatible: + contains: + const: rockchip,rk3568-usb2phy + then: + properties: + interrupts: + maxItems: 1 + required: + - interrupts + else: + properties: + host-port: + required: + - interrupts + - interrupt-names + otg-port: + required: + - interrupts + - interrupt-names + additionalProperties: false examples: From patchwork Thu Aug 12 20:41:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12434241 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 AF573C4338F for ; Thu, 12 Aug 2021 20:42:51 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 74FC4610CD for ; Thu, 12 Aug 2021 20:42:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 74FC4610CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=g/dmMqQiLD4nARwFWWVu1nwOeIws9yQGyftGbEigV/g=; b=FAVYQIg00h/GWd 20GO+1gxZZZ79yz3lI3MguE4KZWlKhmwfdgSpdFjeDRL2ndJutjW9gZAvYYwviNcxzLFrWX7F2XKk Gcz66Z1hNUlltgZPOTdSSVSCo/IHljZhyjbNGO3EhrnpR2B1CTxUwbYFS6qG/JtrRH9LhdTdPYsU1 pTMn144ZcKAvzseHJYWRSXwiS9L4dv0XWOw3ieh12SST5mWTAYckFU0rlQF4oI6pq9cvtPoY8/vti cHLuI0ojszA8B3aoXjWrenzwX7RraeOjxHKrG8KQuYOx7UAKp5SLeIQZlr8JEt+W9YNFjMP/wBx4R UkZhd7R7RUUqenYo8GoQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHXO-00BBmz-Gg; Thu, 12 Aug 2021 20:42:50 +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 1mEHWb-00BBP9-2n; Thu, 12 Aug 2021 20:42:02 +0000 Received: by mail-qk1-x734.google.com with SMTP id y130so8265002qkb.6; Thu, 12 Aug 2021 13:42:00 -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=ggW256M3SIcZiGvGqGuspKz5dguh2TkojKgtWRP6iJo=; b=t1W1hIvV0te5vPrxMds68WtR52qT21pqllsiWQ4EdrsevpXRuUZnxXIl5qHRbeUKud 9PN6GoVqsYPuDsx7pi32SNuSqOfURq9S31XUJV/AlJd0iywelRrQmbl/OkkSbSIU9aj1 Mtb23C5te0dfzD8gkBPfn7Zn7O1BmMZZ2Vj2ptM9z69YebxBooi4wimZ4liyXX2ddbch OrYgutQBIxSZfehRX8I8oI6UUch0Re8p5DMgGbrbTH6AehG0dHunC65FbcJV2TSgrxQc RbHAseLHF2JwHcI2FEDLV18o9MijWzchENcsVLda2q16CcVzVCETsEAeHlmbl+LQ+vxn Es2A== 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=ggW256M3SIcZiGvGqGuspKz5dguh2TkojKgtWRP6iJo=; b=Mv5lmooHzVmusl0cSE8DG/HPU2sCb97MgRPMj19ik00U3dMyXeA2sEsGAYmhekzIxY JHBZPnRqay585gY/d2sjH2RgfLF9nol7VC1pfkN/+HqR9VCZrcvqdQqBDrhphc200G0B Zix2TQTyz4BphUcPNPJ34kdx2s8Tp9s9JeYvrPhIg5xlywQ+azIPrOp9G8nStqbw1G8Y jLRmDnFEV2iKVkWnotlpaDgho2hHZTp/RzZ2Uw388bo2JQpeZEh+2ob1A/OYo7SLxhmO 8tI76o9OBQ9eimt9pjNSu6ww6t2FCm0hPQVaZHBvFPIapWsw0HQbbVO1rXVI+9mqie+r qY/A== X-Gm-Message-State: AOAM532RFUlMhZ0OixsZxtMdx8X4yySraRCShr0xlRQBHka5kWfCaIpW wu9NspyP1Wo9fNdOK1iqmGk= X-Google-Smtp-Source: ABdhPJwz50s1sUzGtczLj6lnVE9J9Egy2qsDbNPpOk2wPPVMdrvu2dFxJKuLLxvmd8wuc8hmQwDo8Q== X-Received: by 2002:a37:9643:: with SMTP id y64mr6224821qkd.213.1628800920037; Thu, 12 Aug 2021 13:42:00 -0700 (PDT) Received: from master-laptop.sparksnet ([2601:153:980:85b1:e89f:d077:9161:1bd7]) by smtp.gmail.com with ESMTPSA id m16sm1940361qki.19.2021.08.12.13.41.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 13:41:59 -0700 (PDT) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/8] phy: phy-rockchip-inno-usb2: support #address_cells = 2 Date: Thu, 12 Aug 2021 16:41:11 -0400 Message-Id: <20210812204116.2303617-4-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812204116.2303617-1-pgwipeout@gmail.com> References: <20210812204116.2303617-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_134201_169002_1258E73F X-CRM114-Status: GOOD ( 14.41 ) 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 --- 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 beacac1dd253..5d2916143df7 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1098,12 +1098,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 Thu Aug 12 20:41:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12434243 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 47739C4338F for ; Thu, 12 Aug 2021 20:43:11 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 0DE0F610CC for ; Thu, 12 Aug 2021 20:43:10 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0DE0F610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=5/DN/ltfNo6N4QB/wXVVBHw7XuNaS6mDHmt4CicCitw=; b=BIjA0Lv8hZhwjk HLHsRiVdmnBU+5VbSynteI33Va53GZGI0ZqQSMKNllmvgpTwawXqeMES5T9QHLsqNQHN9dQNjJ3yS g0iRzNXg5eaAqPaHvJvlVUNnv5HbEtrmd1jAt0QVhcaOYngjgGWmSr2ckh9hgQTErYgCSh7I4wkra zzcDjp6Nlpy3hQzoPeNnqhzMg7yuJ5MLLXmt3PSdczWXSrLGskjkg8H3r61FcwwSqxPsY0WNgRNmX g26nQ2vAkp7b51+g5z3I6NDcsIXZ0oljRX9kLntHG25tkvwlFc2NtIwxN30QiXAaKhCO2vBCLb5QL Oh1+ty8NK5CKvjSD+4iA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHXi-00BByL-8c; Thu, 12 Aug 2021 20:43:10 +0000 Received: from mail-qt1-x834.google.com ([2607:f8b0:4864:20::834]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHWc-00BBPt-1v; Thu, 12 Aug 2021 20:42:03 +0000 Received: by mail-qt1-x834.google.com with SMTP id d2so6397082qto.6; Thu, 12 Aug 2021 13:42:01 -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=yXImnqZERav+3w/cyHb8wggYxQXzQW+9n8PpB8P0B2M=; b=usm5jESwVuEx39403DEzOX/iOpRPGkXcTdPc6I/xDG/6cl72ZcYCdVnAoCHJUeyZ9/ KD5H3a0mCF5PjztxPo+5cr6SHbpbiJPCCEptDNN/2/bkj/O5kkopxXhmWAyjqLumLWO7 aBfLXfcVC3Iv2KZtneyMTow7xHrRF7uuAUkxYwj6T5rTu4p3JBhjzsxPogYFZYD2KIkp h7VKKq6nD43UXSmTVJfcHKt2LDJqfSIFIWtIoVqIyOtOYWweeB75a+LG0eSsvl4JqSgi dBx1CjNXqcBlGLgxRS/cObY47JiCHWKWbyaSmXh0DoktqUH1u8G0p1YV0EV9yIgXAMpE L9Eg== 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=yXImnqZERav+3w/cyHb8wggYxQXzQW+9n8PpB8P0B2M=; b=Ctt2LkbC1CVFA5kJZvxRemUgvshUdpUVWSfmOHPmZtMO+wxdj4GWC6S0uzxhakyuBZ yRd4twIaKUndzpbJ9P28BFx4S7QaF7v+9vgt+yuohykgma8GVhwxHc7GkcYbaaI6xJrU tacfpwJXQ8CyP/Nb9XhtecKU2RRu6kXaUq0WNlqVQsfS63epik32avP1ZQowjImL6Cr3 WjodvluQ3udEiJtJb54SJrCsEHncapA1r6+P9oQMKcOc8A+AeMPhSnmAfj6NNBVGFZ/2 yLSKW08UU/8vzDwD+aj9Q+RN7OfHG4SH5EK8FkzcKBkLU25Ht3kEBh1yMl4KiqsynG/X NjxQ== X-Gm-Message-State: AOAM532D5fd9wqGkfMsQH3z/tPF8RfmIjL6F9GPyS9hx6DFJLud3yWiK NBIOZwV04NgENERpVY7LlPM= X-Google-Smtp-Source: ABdhPJy2RX7/mb2/P2Gi72QdHX2DsNgx/ybOEpWl/TEzJP8z0OZU2joHZRJ1zmu0jAe+6w9/N6s6dg== X-Received: by 2002:a05:622a:2c8:: with SMTP id a8mr5634300qtx.137.1628800921025; Thu, 12 Aug 2021 13:42:01 -0700 (PDT) Received: from master-laptop.sparksnet ([2601:153:980:85b1:e89f:d077:9161:1bd7]) by smtp.gmail.com with ESMTPSA id m16sm1940361qki.19.2021.08.12.13.42.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 13:42:00 -0700 (PDT) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 4/8] phy: phy-rockchip-inno-usb2: support standalone phy nodes Date: Thu, 12 Aug 2021 16:41:12 -0400 Message-Id: <20210812204116.2303617-5-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812204116.2303617-1-pgwipeout@gmail.com> References: <20210812204116.2303617-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_134202_145077_1A1D4436 X-CRM114-Status: GOOD ( 13.29 ) 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 --- 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 5d2916143df7..84a0c1d697da 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1081,12 +1081,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 Thu Aug 12 20:41:13 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12434245 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=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 0058BC4338F for ; Thu, 12 Aug 2021 20:43:43 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id BDFFC610CD for ; Thu, 12 Aug 2021 20:43:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BDFFC610CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=4mLYnogpjYjLKQ7JkbJEHh4Loo0KrrFH+B8rvt0gdm8=; b=TJSrwlaYmLH85j OHzR9zr9YriPPnVoomxuebjcrYqHqMgFzb9FnLZo7Sf+94FJH0QtnAwthDJrIauiuTcO92gsSz7VI hW2NhXp+LzvcGTBnu9+PO5X/HjT66B/pBK/CgBqA/DWF4bzAxscLxzDF82IArvDgPZAkd0votvQxu czJCXf7HGsm94eIhKwFNTtq0pFJx0mZ73e/JPX8o9Gks2OAeG4vWGrSCYZQZdwBkx6Bo7cLbsZAmC XgB/fOQhjKQjor396eXp2RM25wKsyRfiAKGu1AVHSjhvwob2HkTvTPqpauWnWc7r+Hqyskv6pRn1c YCx5oJLLZnqVSok55sHQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHYD-00BCH3-Sf; Thu, 12 Aug 2021 20:43:41 +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 1mEHWc-00BBQS-VJ; Thu, 12 Aug 2021 20:42:04 +0000 Received: by mail-qk1-x734.google.com with SMTP id t3so8235447qkg.11; Thu, 12 Aug 2021 13:42:02 -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=jV3+d13+BlvVKdHvamJ73f10IOo4fLZB7GTSxjSftek=; b=Zuzv/I+FVw2M1t/wdbOUlEGYA5wI6WSjciqkWH6PkNENhgzU7aEEOSpytnvm6JeFx2 4yfRx0/OqCAaXHSirS/WBw8P3LYKXW73J3xBwgI4bZkRcPMLQJwZ9jpmlMAm0lQW++II 9t7Q/GGv2IqZpo3msgGdg8gQ0vQSxckuX2fY4Alo+u4JiWe+OWkD161oAC9q9L0m4Wdn r4cXp1qL9SFiEg80fluK6LUxXsfpHX635NZSep6qMh9mBf1YdnsZx00VuOk0w0ojM6RE 7WZQXXLie1tVGh5AAk6FYKjo62SGBTwgVqDANoDVRgLgnqHaF/Ys04FYF1hqj4wj7Kp/ tp6Q== 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=jV3+d13+BlvVKdHvamJ73f10IOo4fLZB7GTSxjSftek=; b=YyeuW0RIxo1P3uR4eTwOOeg2JD7muI7W+Hn8/XXzVub9f5+lXuEIv68/OUAAye1fS4 EaFg4AE3QIQ3nIHEw9qNOGvwwgfXJgn4PZfxgJK0aDESswZt6hwaCPJsrnP7ZKUl6JBe Dx4W7x0Yc8VDNagswGuGJHImyrQOFQEkM8MbnUblGFkmSDDQNJZ1UUcCUQl31qY9KlHr fHde1otztfd3qgXtbS36Qsr8NBmwnjWsfmlD4Mr+dQAhOvvCCJGDFYMMgRsW1uHXD6+C pueqNze2q7aX6EwJnVrRaX/E/RFPTpz/XVVOYsuq8A4V8e/JOki+6EaQLhRNsVV4iUxN Yj1Q== X-Gm-Message-State: AOAM533oDGEBsz+Qu4T1tb1aqI2Qx1hB+YRr2KSm3kxNOad6XSDBKPQ9 oosaSHJ24CmXh2pmAToebuw= X-Google-Smtp-Source: ABdhPJyrnT6PORGjrTDgySqbzkzSUbFYzqIA1bWHZIgwb7kGDQIv/+5gNYYb0UkJSgl3ItgM3Weaiw== X-Received: by 2002:a05:620a:22b0:: with SMTP id p16mr6668847qkh.346.1628800922084; Thu, 12 Aug 2021 13:42:02 -0700 (PDT) Received: from master-laptop.sparksnet ([2601:153:980:85b1:e89f:d077:9161:1bd7]) by smtp.gmail.com with ESMTPSA id m16sm1940361qki.19.2021.08.12.13.42.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 13:42:01 -0700 (PDT) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 5/8] phy: phy-rockchip-inno-usb2: support muxed interrupts Date: Thu, 12 Aug 2021 16:41:13 -0400 Message-Id: <20210812204116.2303617-6-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812204116.2303617-1-pgwipeout@gmail.com> References: <20210812204116.2303617-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_134203_084074_0C2032B9 X-CRM114-Status: GOOD ( 21.34 ) 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 --- 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 84a0c1d697da..fdeb2e7c937a 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]; }; @@ -934,6 +936,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) @@ -947,18 +1045,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; } @@ -1007,44 +1096,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; @@ -1124,6 +1179,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(pdev, 0); platform_set_drvdata(pdev, rphy); ret = rockchip_usb2phy_extcon_register(rphy); @@ -1201,6 +1257,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 Thu Aug 12 20:41:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Geis X-Patchwork-Id: 12434247 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=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 BDC49C4338F for ; Thu, 12 Aug 2021 20:44:29 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 89949610CC for ; Thu, 12 Aug 2021 20:44:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 89949610CC Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=0VKCae/RKExxtzHk/8MRci7I/c8sFO65ZTO8N/FytzY=; b=4oIscoiBMUoV3e AUHWa8Vi2cgjKCo15LUbQ0DMWb8vcXDvm/nhvDsUZiYHikqPVxCRBPueD8g7P/mwNlkknGtoDxz4c LogQIjY5gJymdjeTGwS9mfkfVUpRWMBGXm3F6Z+7duJt5vYRQc618CSOzgZSO7mJzGBxpC/EXQzJK ACwa6eILdauwKEB7ah0zevCmTH5TF8ejELsJIyzCUzSKYIdfw8gH7iiyDB7BGeaKAykNfhcE2mssG /nrCJh3WRkU5MYV6r2zDw4t4xzb6frfC70NSXWXEAnmmDaxUjl7UKmX0UD2OgvPMvxS+Gjgnx17Cc Or6HHnNMb1pRf5c2sKXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHYy-00BChP-4c; Thu, 12 Aug 2021 20:44:28 +0000 Received: from mail-qv1-xf36.google.com ([2607:f8b0:4864:20::f36]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mEHWe-00BBRG-7n; Thu, 12 Aug 2021 20:42:05 +0000 Received: by mail-qv1-xf36.google.com with SMTP id c14so28297qvs.9; Thu, 12 Aug 2021 13:42:03 -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=4fH6A/BcmiXnSJNIz36CupSiUjhhUBPUWUzzeHlruOE=; b=egHFOLfly8AjKOqcXJyLVExDLf6LQcj/wgdtZZlG5HWIU+cPfiscKiz0rCyST76G8o R29ekx00ati+bx0XNynb2U9MyzPCgFER6DrNzBCe6sx/4JmE0BzGTabFbGP5POS1kmdG sRFtNYWNtS2yP9Q9bMekpEjPMEb7VsysanYbWDUQE5LjXew+VClPpizjFVE20Zn+q7OL ygoF7ioTB1CcezHpNHEQqB6ZU17m5K6EEtO2sIp0+RarAbhJRdF7B3hYIIQiPlvi8Uqn AjREhqExwBJMw02IxVR3Ewz6TBNy/Jf6zIZ2I4/gPIZjqaU/21pyGuV5gjL4WQ82k1YA ge/A== 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=4fH6A/BcmiXnSJNIz36CupSiUjhhUBPUWUzzeHlruOE=; b=AmQLMRC5go/w2pvOeG7wVLbtw/MuHNTcK62V5GY83qh+OR3YUSvjc1D+DqnsqHxSaI PXluVkZ6l4yYbzUuMK8R9t1tg94ujewbxgs2VDZj6vja6NdckpJwjKpJjMs4sHFbT5dS QBTpsE83SodSom9bB+Mtoa48LjUy8iaKLwObOzW4DPnrb16QWCQiDMaRqf4qbJ36+3/P YvUTfFvLfXAtwpU/hb1QItOtD8PCKz0FLG8lUaVV3Zz3a7ZrQk1HXr8POc8UJ20UwQBu ZmHLUWNDUERkMWT9cTSyflOiCX0DCemB5MmDNsbEvI9cQjd2DWeOnTpgOP78OD9kFcdT 6eBQ== X-Gm-Message-State: AOAM532g8rlmzrUJoa35ugU1gPR24YV756i18ecQsjqYAkzpg2PhlCft cP0cLxm68UjZloBzRqkqDmw= X-Google-Smtp-Source: ABdhPJwO8BKYR3rqA3vonlPaweauwBXBAV9qhXKsuNnD9drM/Byn6GLIlelcDUcBbLDmR3/VIErhxg== X-Received: by 2002:a05:6214:dce:: with SMTP id 14mr5852702qvt.34.1628800923135; Thu, 12 Aug 2021 13:42:03 -0700 (PDT) Received: from master-laptop.sparksnet ([2601:153:980:85b1:e89f:d077:9161:1bd7]) by smtp.gmail.com with ESMTPSA id m16sm1940361qki.19.2021.08.12.13.42.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 Aug 2021 13:42:02 -0700 (PDT) From: Peter Geis To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner Cc: Peter Geis , linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 6/8] phy: phy-rockchip-inno-usb2: add rk3568 support Date: Thu, 12 Aug 2021 16:41:14 -0400 Message-Id: <20210812204116.2303617-7-pgwipeout@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210812204116.2303617-1-pgwipeout@gmail.com> References: <20210812204116.2303617-1-pgwipeout@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210812_134204_331268_C92262C8 X-CRM114-Status: GOOD ( 13.85 ) 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 --- 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 fdeb2e7c937a..74420c439a07 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1100,6 +1100,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; @@ -1509,6 +1510,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, @@ -1558,6 +1622,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 }, {} };