From patchwork Wed Aug 30 13:36:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Bee X-Patchwork-Id: 13370260 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 EF3E0C6FA8F for ; Wed, 30 Aug 2023 13:38:48 +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=QA1Z1ZbwrF7TZ8ljM5+cZ68HOIxxrtsxBFtsH336ZLI=; b=bjmhvBc3H6OCuo NsuMKI37CoHvBpyn52u9/F76wZOYRO1Ly7PHFbpNLe4B82JDMhUL/GHLnV7mMSjQ4pnO8LYyowTKP b64nZT56yCZOElrB5RBGujy6U0BFPE+pzpNAytr7p4rkRKLXQ/Xdr3XmyDvVyIwlJtAQfj2gzbAsT 9SSf6FEsGdmC6x6pDM5HHLgmdFW31hT8l8QVFsiHZQnBCpnSWkoc4ZcOsW9G6fJi/x9g4BgvUHCvB B1ePO4cJYrYUGeiAjKk8CPFAsF6S+KVMywepNPtE+EDZng48E/lLo/IFpZO/1hQ1sOvtGAbnxfiZd 6Lsydw2R2BG6LrY7qs3Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qbLPE-00DacH-2G; Wed, 30 Aug 2023 13:38:48 +0000 Received: from mail-wm1-x32f.google.com ([2a00:1450:4864:20::32f]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qbLPB-00DaaZ-2Y; Wed, 30 Aug 2023 13:38:47 +0000 Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fe4cdb72b9so55385475e9.0; Wed, 30 Aug 2023 06:38:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693402723; x=1694007523; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=MBe21p78bEGeinGOeEZ5dbYwb28pfpjkSo3Y7gdPnoA=; b=bW8l1UdsJ16GQn5VpGXyo1Y0YFnA2Hp+gBCeF0HT4uMHZ66AQQOBIez72D4n63TgDs a4w8sw2UvTAbr/PoYvfiEwIhozEdNAsOalkJgGXC4sJP+jzcbZQZWPj/ByIulSLMpjvN JURBvbq+GJxXVAtWyrvYyV/4giEgKuAuyQcRSB8j9e8LGBZ/OXv0mSa3peA0DvAJEY1S vpvO2dYkuvA//kH/b1GjQJYiWfwb+0c7m7bJ1S2419GBjZHTRQ4xX9YwGrB3FTMITFdl TtV4+rGGkd2dIYYUg7tkFi24LBy5meFcrmEHsW0XAyQGXun2QvhUxaMbiN8yyhba+eTE d3GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693402723; x=1694007523; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=MBe21p78bEGeinGOeEZ5dbYwb28pfpjkSo3Y7gdPnoA=; b=IPaSOc6I5N09IJ2i/ohqbnfCYsiWo+fbHrdbzfb4j1cXul6QTlIoSA1IO6UU01kaZe danDLUCXe2FKpU3qrX1N8Z2a4PC7bxeIjkgSnvnC4KIpfJ9ZPRQMYJyFDnVzWaCmfdA9 e60vC9N14ZWB2FFlUmptawPKZpnc+H5derclLCZIqUikePdB39EakSmVpiRvZhVY0noh xheiBH9bUaBokYg9E1wLorMnBFbOwZ8r8LkAx848nmFO5HLlFTddACrPowxeSq/Pwiso 74ZHBvRvCI0Tip1rTkvPbzsaM96N9jfpuM6iMigzcufMGQjgfIU5pWhnuCsUh2USr9g2 J41g== X-Gm-Message-State: AOJu0YwqnNdR7QbYfJOJCloENMmxdzakw/9ekr3GL3nfUgFlgOpzjSRj 9mPXDpnb3lgBgRUrt3CEN00QJYASXw== X-Google-Smtp-Source: AGHT+IEpDe6p2bk26/qpet9gXv/RWnuOE+JScc/Osk+9IK0/HLUMMbVMFqo56cM5drEZGpVyQ+6BZQ== X-Received: by 2002:a05:600c:21c5:b0:3f8:f382:8e1f with SMTP id x5-20020a05600c21c500b003f8f3828e1fmr2026172wmj.24.1693402722599; Wed, 30 Aug 2023 06:38:42 -0700 (PDT) Received: from U4.lan ([2001:9e8:b963:7410:17bb:6f65:50d0:b82b]) by smtp.gmail.com with ESMTPSA id x14-20020a05600c2a4e00b003fed70fb09dsm2326343wme.26.2023.08.30.06.38.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Aug 2023 06:38:42 -0700 (PDT) From: Alex Bee To: Kishon Vijay Abraham I , Vinod Koul , Heiko Stuebner , Conor Dooley , Krzysztof Kozlowski , Rob Herring Cc: linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, Alex Bee Subject: [PATCH v2 2/5] phy: phy-rockchip-inno-usb2: Add RK3128 support Date: Wed, 30 Aug 2023 15:36:23 +0200 Message-ID: <20230830133623.83075-6-knaerzche@gmail.com> X-Mailer: git-send-email 2.42.0 In-Reply-To: <20230830133623.83075-2-knaerzche@gmail.com> References: <20230830133623.83075-2-knaerzche@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230830_063845_830435_AE1D5E41 X-CRM114-Status: GOOD ( 12.67 ) 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 Add registers to support the 2-port usb2 phy found in RK312x SoC familiy. Signed-off-by: Alex Bee --- drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index a4a1716e67bd..9ea08be533cc 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -1374,6 +1374,53 @@ static int rockchip_usb2phy_probe(struct platform_device *pdev) return ret; } +static const struct rockchip_usb2phy_cfg rk3128_phy_cfgs[] = { + { + .reg = 0x17c, + .num_ports = 2, + .clkout_ctl = { 0x0190, 15, 15, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x017c, 8, 0, 0, 0x1d1 }, + .bvalid_det_en = { 0x017c, 14, 14, 0, 1 }, + .bvalid_det_st = { 0x017c, 15, 15, 0, 1 }, + .bvalid_det_clr = { 0x017c, 15, 15, 0, 1 }, + .idfall_det_en = { 0x01a0, 2, 2, 0, 1 }, + .idfall_det_st = { 0x01a0, 3, 3, 0, 1 }, + .idfall_det_clr = { 0x01a0, 3, 3, 0, 1 }, + .idrise_det_en = { 0x01a0, 0, 0, 0, 1 }, + .idrise_det_st = { 0x01a0, 1, 1, 0, 1 }, + .idrise_det_clr = { 0x01a0, 1, 1, 0, 1 }, + .ls_det_en = { 0x017c, 12, 12, 0, 1 }, + .ls_det_st = { 0x017c, 13, 13, 0, 1 }, + .ls_det_clr = { 0x017c, 13, 13, 0, 1 }, + .utmi_bvalid = { 0x014c, 5, 5, 0, 1 }, + .utmi_id = { 0x014c, 8, 8, 0, 1 }, + .utmi_ls = { 0x014c, 7, 6, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0x0194, 8, 0, 0, 0x1d1 }, + .ls_det_en = { 0x0194, 14, 14, 0, 1 }, + .ls_det_st = { 0x0194, 15, 15, 0, 1 }, + .ls_det_clr = { 0x0194, 15, 15, 0, 1 } + } + }, + .chg_det = { + .opmode = { 0x017c, 3, 0, 5, 1 }, + .cp_det = { 0x02c0, 6, 6, 0, 1 }, + .dcp_det = { 0x02c0, 5, 5, 0, 1 }, + .dp_det = { 0x02c0, 7, 7, 0, 1 }, + .idm_sink_en = { 0x0184, 8, 8, 0, 1 }, + .idp_sink_en = { 0x0184, 7, 7, 0, 1 }, + .idp_src_en = { 0x0184, 9, 9, 0, 1 }, + .rdm_pdwn_en = { 0x0184, 10, 10, 0, 1 }, + .vdm_src_en = { 0x0184, 12, 12, 0, 1 }, + .vdp_src_en = { 0x0184, 11, 11, 0, 1 }, + }, + }, + { /* sentinel */ } +}; + static const struct rockchip_usb2phy_cfg rk3228_phy_cfgs[] = { { .reg = 0x760, @@ -1749,6 +1796,7 @@ static const struct rockchip_usb2phy_cfg rv1108_phy_cfgs[] = { static const struct of_device_id rockchip_usb2phy_dt_match[] = { { .compatible = "rockchip,px30-usb2phy", .data = &rk3328_phy_cfgs }, + { .compatible = "rockchip,rk3128-usb2phy", .data = &rk3128_phy_cfgs }, { .compatible = "rockchip,rk3228-usb2phy", .data = &rk3228_phy_cfgs }, { .compatible = "rockchip,rk3308-usb2phy", .data = &rk3308_phy_cfgs }, { .compatible = "rockchip,rk3328-usb2phy", .data = &rk3328_phy_cfgs },