From patchwork Thu Feb 9 14:30:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2710 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 024283F046 for ; Thu, 9 Feb 2023 15:32:08 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id m16-20020a62a210000000b005a851506993sf1137895pff.4 for ; Thu, 09 Feb 2023 06:32:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1675953126; cv=pass; d=google.com; s=arc-20160816; b=O/oWtRA4GARzZXAwLkK2mYqHxKxNRPbQqv8WFYe2qz+X5Z9FhStCr0YFAqitmZkLnr R1nR9YZxy3dJ7aYeNX/EMcGPzV1+EQL8C+SlfqBXa2RtdpW2eEqvhFLlpHJQdDc2wDzB wlsn1qRtZBWGAsW9Sl4sn4PKCy/A/cytcKFqSpveKcev0iKwu+zU0N/OvC4n2uQ132z8 jo6LEQsLnyGBv3I4sZ/EHn2mXYdsVkYBDEh93yZ7+7JCCl9mRREEfAPZ46dT+jOzO1N/ duOitI6eUniGjLwh839/N367AnjqxpsF7azdXNIlB+WwbgDm+8WzbLkdCxeu4WWsp68F i3UQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=AGdkpyt8HpQUBuEI2jZS3Ko7D+ikFODhr2GUQgzPnvE=; b=T+LgCN24blIorV9Mc/EqjjRzUjvgPoaiMz0Br4Sn+NPyHt0qcsc92gEoaQR3pftltD AhLBjsvACuF4TTdLt1u88i/+KKFGXX6KYGl1IkHc8TrO4RbZhEaiXqEKWjR1iA2jrQWV 2+CirOW9wAfpopg3xI3ZLxtRYKCWEM7ZZsHcYrg1qdBApaury31eCUGvZbaOgW+jayFg WvIdLN+6vYgoi1yB3tVH755BnIQEnjBUUM5Hh+Uw5Zaxys0fGnUYL0pPOCObH5KkGrmX BqL0Lt6rCTPmXeVYumoaaZO8rdwlaKlzdbcNSfRF0JTA558vnB63xJlTGmTrJL0g8mwJ kHwA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EZQLyhSo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender: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=AGdkpyt8HpQUBuEI2jZS3Ko7D+ikFODhr2GUQgzPnvE=; b=Y4ko2PKafoPl7eyJKkfhki335mwol7zcGb5OUVOyzLHHmbAUlGem+Fz1FG3FbxDmp3 XmZA68zuinO0qeB4v474JUEZsx65t+q6mLkQ7//biyden+oMAMYxiGt/56I1+EMIGpV4 xhmAdGXeIura4mb++fvLkYB7ndsq5tOGm56PM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender :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=AGdkpyt8HpQUBuEI2jZS3Ko7D+ikFODhr2GUQgzPnvE=; b=y5amHkS2N+CSJA/TA9OHXleWYzekg4YcdLjcdwgpkzcH4OMcsGjQOe8CngkUfLM/9q drZVzuVT6HA6heIWsYG22Hx5Wap6wgCUD10X6AZWXEZfUICwryBa4qTJjk1Eo6EAQDtu NykmVzrDpzupG8RfOIdm05CTlq4JAKZ2QkijpQBrn5rWJTraFE7DhA0Kd0+ndAabE0wE SCcU9wGX9CE5HMB2ynuakG5TOVufcxCHPXc+o6oy38Eu2LG0XpZ5d74rMFRt9+9fIgZ0 qGuVYZWvNIDM/kpTqu+UUQ1tmovmK9BPY5RPQKGQw+plor55B8gPAGOogE1Ro2beIvQf pEZw== X-Gm-Message-State: AO0yUKUsUfJcbsqZ/9z4uyoCb39Tiq8rbd004OfEckp4Vh+UG5bh81Sa xJcRQg6NdyAEd5jZZzzIYLoWHjrDPrSbcQ== X-Google-Smtp-Source: AK7set+cZNbHf8jUBpmnNWluSQIhumA7RPnD2b1M4iL5QKKdhMmnKzsHztQcPPSAhlO7EmJ1rRrGRg== X-Received: by 2002:a17:902:d889:b0:199:21af:cba0 with SMTP id b9-20020a170902d88900b0019921afcba0mr2890050plz.23.1675953126748; Thu, 09 Feb 2023 06:32:06 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:10c:0:b0:4f1:7806:2186 with SMTP id 12-20020a63010c000000b004f178062186ls490911pgb.10.-pod-prod-gmail; Thu, 09 Feb 2023 06:32:06 -0800 (PST) X-Received: by 2002:aa7:8f34:0:b0:5a8:3273:f431 with SMTP id y20-20020aa78f34000000b005a83273f431mr6232216pfr.13.1675953125800; Thu, 09 Feb 2023 06:32:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675953125; cv=none; d=google.com; s=arc-20160816; b=xfSL4VltMOpDYNGKHz5ih4N6A9qkZHN9v90YyExx0s8YkxjHoBqvYLgyXYnqKFcJD3 2Xjxz0olkuUf1yUTGd/1bxjKZuwr1vc3EH/kKJHLkwgyE+L1jHM1lZ3hm6v80PpE4zYj ZMsY5yIhhD3dVFH+53XGhwjVoIwrCGhJVYMwOeRWf6Zr979BeCrcJk+4v8EJCm1A834H syZFgURVhgmob1CD/LZa/wCZUAy/kaRoWXEpNcWkbnJ+oR1KdzTMKT/2k2npZiIQsE/R fX0EdonBcrho1QhkZGQlHVP3vnELpD+JYiOjWLICcwBumcEazd8QYDSr1XFHlwuhj1Xk 5Bag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=5wL2gZfIb82QlSMdIE/Fs9xPxYBOaRS0aaCrUFBAWFw=; b=RUs8Ykq6Iyz97O7SG8/GN1tKD4z2Vc5AipKWQ8lbMj2g+kFpM/iDEijP+Q6xQPGg7D LiMQCIJvEBjxudZmO9nIalax3VJR9OllfBqKabIYws9cjQL7XB9KLIAjBZAIO/rTKMMM D3g0c1/5dzkRNbORxaEcX+1nXjr84ee6RhfsRoAU8mb0S8AkmvnJFRYypAWO9yaQHkhG /NWT24DJSBVgCPo6ceqX4uuLkWiG2m9BKNNoKfQpMk2qeiAB+8AHjRpm9wxhoZ4GpjbE GbR68AL5Frf4sYmKxHY26iaB82lIQ8ayM47V3wGNsy6DNOBXLYc/OG0GYPXeAcMMrHIg Z1cw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EZQLyhSo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id i22-20020aa787d6000000b00582d770ffe4sor892129pfo.3.2023.02.09.06.32.05 for (Google Transport Security); Thu, 09 Feb 2023 06:32:05 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a62:2587:0:b0:5a8:5fa0:3d6 with SMTP id l129-20020a622587000000b005a85fa003d6mr1611635pfl.19.1675953125485; Thu, 09 Feb 2023 06:32:05 -0800 (PST) Received: from localhost.localdomain ([183.83.141.79]) by smtp.gmail.com with ESMTPSA id j7-20020aa783c7000000b005938bd2bfd3sm1501226pfn.120.2023.02.09.06.32.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Feb 2023 06:32:04 -0800 (PST) From: Jagan Teki To: Kever Yang , Philipp Tomsich , Simon Glass Cc: u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Manoj Sai , Ren Jianing , Jagan Teki Subject: [PATCH v3 6/7] phy: rockchip-inno-usb2: Add USB2 PHY for rk3568 Date: Thu, 9 Feb 2023 20:00:59 +0530 Message-Id: <20230209143100.113376-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230209143100.113376-1-jagan@amarulasolutions.com> References: <20230209143100.113376-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=EZQLyhSo; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Manoj Sai RK3568 has two USB 2.0 PHYs, and each PHY has two ports, the OTG port of PHY0 support OTG mode with charging detection function, they are similar to previous Rockchip SoCs. However, there are three different designs for RK3568 USB 2.0 PHY. 1. RK3568 uses independent USB GRF module for each USB 2.0 PHY. 2. RK3568 accesses the registers of USB 2.0 PHY IP directly by APB. 3. The two ports of USB 2.0 PHY share one interrupt. This patch only PHY1 with necessary attributes required to function USBPHY1 on U-Boot. Co-developed-by: Ren Jianing Signed-off-by: Ren Jianing Co-developed-by: Jagan Teki Signed-off-by: Jagan Teki Signed-off-by: Manoj Sai --- Changes for v3: - new patch drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index a01148db22..38cd0f0f33 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -298,11 +298,40 @@ static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { { /* sentinel */ } }; +static const struct rockchip_usb2phy_cfg rk3568_phy_cfgs[] = { + { + .reg = 0xfe8b0000, + .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 udevice_id rockchip_usb2phy_ids[] = { { .compatible = "rockchip,rk3399-usb2phy", .data = (ulong)&rk3399_usb2phy_cfgs, }, + { + .compatible = "rockchip,rk3568-usb2phy", + .data = (ulong)&rk3568_phy_cfgs, + }, { /* sentinel */ } };