From patchwork Tue Jun 6 17:09:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2906 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id BD2433F042 for ; Tue, 6 Jun 2023 19:10:03 +0200 (CEST) Received: by mail-pg1-f199.google.com with SMTP id 41be03b00d2f7-53f84f75bf4sf2259717a12.3 for ; Tue, 06 Jun 2023 10:10:03 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1686071402; cv=pass; d=google.com; s=arc-20160816; b=WsxfCa+yHZFGTmjWoskT7FGLAa0KNwH1hH9Rp4gN7ARloql2EK3UlTrwSP57kkFIzU 8iERJI61wtcrbp+mBsA0b3XIikbezVApGKeWb8QseTDx184Ric38/3z+vj21ueAo6ZOd 6+QB75Z6rhL5SVwEPsa7Ksl03RybYuWUfKkj2HBnk7I+ZfLgdHVYMNCXfmaePwHeJ2/H 5l5teudg2kT6yNZZvCuLBIAAzRS95vXo4DeTA5aYd3rTjgAw1AqmAxckLs1KfvaQeMzy nlpUcDAR0OVji8P3+zUV6zR/MdcGL+0IgaqoJHGTDP9NRDbiH7od9PsPIdGCD0cIazpy m4kg== 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:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=rzPDohmwku/wwf1G49hCyL5tIT+q5L8JJxkBQfD10+A=; b=YP1Qsla5SttU02GIt+7SPZ2tulGuJn/VLtndHnUxO9l10E+SA2e5EuIyc2J+UHrRw/ G9T7cAuE47NCLayrdkXs7Sbu2KYlksh59E9GvVnNTGBZR1LbLvO+ZHy+zrf2fFBipH+6 84ZXMmcoBJRVQDrLJ/Xjus3gUAf6vPOZo++2VlXH9NK7sGpAM+une4RrpPuwbdiPwP+s u4oI+Aj4aegaHo8rHYxP4aB5AWxvqtAgaEgN+PkOrsWk1dQTwIJuJQWTqYyb/XhKY7fL 1cpBaa3dxzbTEbFIt3LEygMx5H+YExMVsgUEZT/B8L/KmEWwHR9nGaK1LClUTK67Tky5 wAHg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YX0RPVkm; 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; t=1686071402; x=1688663402; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=rzPDohmwku/wwf1G49hCyL5tIT+q5L8JJxkBQfD10+A=; b=EeNobEyIjfOhzk1qugPsHLSjSFv0rDB4AvfhtnvsHVTxkmKKRTy5g6sW67TaAiOUUJ p3wlhm6RcSnZrZsI2ZPzPoMZ+slJX95KSIjkuWmJs17s9d6zij5uCDc1xlRD2j/IHsEw 4TR171WI6mGNqbi1fwAmjUgWVLkPkALqSmkmc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686071402; x=1688663402; 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=rzPDohmwku/wwf1G49hCyL5tIT+q5L8JJxkBQfD10+A=; b=BG5WMJ3d5aarMsxeyvsuliAK7XQlrhaGXbwL6aT7eZfjHbHFGlLxSn4n77eB8A9Q9C UQQ4nltd9Yw711Y7lb2/DcEHYUSWN2Agq2TjTnweJMW9sykSRta8TjseolWirZXefNOH KcpvsEim7Y3O1XcIkI+6BPI/oYu4MdmFUG1tCZciD/KfNYMEmWb2tp7LX7K9YoYWe17G uUIkqzHYpNJmnrKWj1AVBedGidxdvaRCzSg0Ai60YS/PZEPG8bDLej8OPwO4eGoXCVxH XWAyx2tl+LL+670F4Nc+nKuV1kaICB0vf0LMnuOlHAaLiX1PGz28hSogzY8hvkYQpQ0N HzkQ== X-Gm-Message-State: AC+VfDw2RtOZZhTp8aHYqqCwQKQ59sKTBlS7ZL0aVCHoOWG0s2J7pB8U r2/2srOiqo+3QW7idGsir6+hWT7j X-Google-Smtp-Source: ACHHUZ69vGNV7DsQkh2RuYd+gYcldeATInUx6vl0fIMCaohqkxErS3+5ZQKqSC52X8VcmIYGZDLJAw== X-Received: by 2002:a05:6a20:4419:b0:103:ef39:a832 with SMTP id ce25-20020a056a20441900b00103ef39a832mr272278pzb.23.1686071402471; Tue, 06 Jun 2023 10:10:02 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:903:22cf:b0:1b0:3f34:8957 with SMTP id y15-20020a17090322cf00b001b03f348957ls2128977plg.0.-pod-prod-01-us; Tue, 06 Jun 2023 10:10:01 -0700 (PDT) X-Received: by 2002:a17:902:d509:b0:1b1:9f51:9ffb with SMTP id b9-20020a170902d50900b001b19f519ffbmr1942043plg.26.1686071401540; Tue, 06 Jun 2023 10:10:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686071401; cv=none; d=google.com; s=arc-20160816; b=nWXiGLwCEjmlzIZX2TeTywOTT+hz1sfXvaVExv/p2iaZkyyf63vD+Fxx9LfNFsNfi/ 6Fg9pmGyfni54iVmsHaqCDojA6w6630eVasfkzaz6KnERkXdbE+qeVba56RaaMdrqrDj 8COkfWmy5WHwxUre/gAL/agjPDwxW+9rjKdwaYrddNlAMeZFds9RNmcPQ+VgYCYSdgiv IfmXKIuQ6q4jbotXxuj7OX3kAw565pD+FCDC8VNSmzGrFvNSMjnjrEZJ1AJe8f+XP0Lx wxxCUSLOC437ItuFbK3a6LplQMMFfkbtl4TNUDNt6oKDjGWkBRx1vYgg1/Oo0zMWJV6T q/pw== 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=sr1K9l80upKXGWVzSR8+pyCAPneB1GI2wk0Q6eotpK8=; b=AjnbIb1Wyx5IBpgefLrxUdFMUXYeH9Oxlxv5EK6lzvUccHFwFov3cCNSoEBJJQ5k9h 68Xo46AgHvMI8WRk8bGbfYMz72LcgyA156poDaCnvcQ4t+2ZhweBVKr5x1dlKn0MoM5z 7v9zrfpFXGhEa5YmmM7A1d/jddzr86rZq7dYLII/ToMsyQso16FozRkAOXhQJvDWckXw 1FEPEw88VhtVBowT0m/YxvOa6Yu8po9Xwe1ps3hCBq6u9jTpNqkERxvfwVEtQLaosPTQ e9BwNjbrt/ep8oe5IMgH3CPKORQyaVD6afG236CZtDF74vlNE4/Tiw8D3VTYihlm+UnW TMSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YX0RPVkm; 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 e2-20020a170902f1c200b001a80af7be79sor2428135plc.9.2023.06.06.10.10.01 for (Google Transport Security); Tue, 06 Jun 2023 10:10:01 -0700 (PDT) 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:a17:902:d34b:b0:1ac:6d4c:c26a with SMTP id l11-20020a170902d34b00b001ac6d4cc26amr1658742plk.14.1686071401261; Tue, 06 Jun 2023 10:10:01 -0700 (PDT) Received: from localhost.localdomain ([2401:4900:2001:f7d3:5b78:1d82:fb5f:608c]) by smtp.gmail.com with ESMTPSA id bc8-20020a170902930800b001ab0159b9edsm8695129plb.250.2023.06.06.10.09.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Jun 2023 10:10:00 -0700 (PDT) From: Jagan Teki To: Kever Yang , Simon Glass , Philipp Tomsich Cc: Jonas Karlman , u-boot@lists.denx.de, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 5/7] phy: rockchip-inno-usb2: Add USB2 PHY for RK3328 Date: Tue, 6 Jun 2023 22:39:16 +0530 Message-Id: <20230606170918.45581-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230606170918.45581-1-jagan@amarulasolutions.com> References: <20230606170918.45581-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=YX0RPVkm; 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 Content-Type: text/plain; charset="UTF-8" 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: , USB2.0 Host and OTG controllers in RK3328 are using USB2PHY. Add support for it. Signed-off-by: Jagan Teki Reviewed-by: Xavier Drudis Ferran Reviewed-by: Kever Yang --- Changes for v2: - add clkout_ctl drivers/phy/rockchip/phy-rockchip-inno-usb2.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c index e43a5ba9b5..d8738f891d 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-usb2.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-usb2.c @@ -345,6 +345,36 @@ bind_fail: return ret; } +static const struct rockchip_usb2phy_cfg rk3328_usb2phy_cfgs[] = { + { + .reg = 0x100, + .clkout_ctl = { 0x108, 4, 4, 1, 0 }, + .port_cfgs = { + [USB2PHY_PORT_OTG] = { + .phy_sus = { 0x0100, 15, 0, 0, 0x1d1 }, + .bvalid_det_en = { 0x0110, 3, 2, 0, 3 }, + .bvalid_det_st = { 0x0114, 3, 2, 0, 3 }, + .bvalid_det_clr = { 0x0118, 3, 2, 0, 3 }, + .ls_det_en = { 0x0110, 0, 0, 0, 1 }, + .ls_det_st = { 0x0114, 0, 0, 0, 1 }, + .ls_det_clr = { 0x0118, 0, 0, 0, 1 }, + .utmi_avalid = { 0x0120, 10, 10, 0, 1 }, + .utmi_bvalid = { 0x0120, 9, 9, 0, 1 }, + .utmi_ls = { 0x0120, 5, 4, 0, 1 }, + }, + [USB2PHY_PORT_HOST] = { + .phy_sus = { 0x104, 15, 0, 0, 0x1d1 }, + .ls_det_en = { 0x110, 1, 1, 0, 1 }, + .ls_det_st = { 0x114, 1, 1, 0, 1 }, + .ls_det_clr = { 0x118, 1, 1, 0, 1 }, + .utmi_ls = { 0x120, 17, 16, 0, 1 }, + .utmi_hstdet = { 0x120, 19, 19, 0, 1 } + } + }, + }, + { /* sentinel */ } +}; + static const struct rockchip_usb2phy_cfg rk3399_usb2phy_cfgs[] = { { .reg = 0xe450, @@ -498,6 +528,10 @@ static const struct rockchip_usb2phy_cfg rk3588_phy_cfgs[] = { }; static const struct udevice_id rockchip_usb2phy_ids[] = { + { + .compatible = "rockchip,rk3328-usb2phy", + .data = (ulong)&rk3328_usb2phy_cfgs, + }, { .compatible = "rockchip,rk3399-usb2phy", .data = (ulong)&rk3399_usb2phy_cfgs,