From patchwork Tue Nov 10 06:40:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lee X-Patchwork-Id: 11893385 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=-12.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY, 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 54C18C388F7 for ; Tue, 10 Nov 2020 06:41:52 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 DAB8B20639 for ; Tue, 10 Nov 2020 06:41:51 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="kiftmseL" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DAB8B20639 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=allwinnertech.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=wtQKlBy6DA7JOE5fFPmxNaSEwuMxjPY46d1LspF8ENk=; b=kiftmseLgLEGTA0WcROVSVoSO zNIkPYQttBxJ4U/F+j8Je/dvLUveZMuwnBjtKaH6RcQVnZFv1z8fAVhnFN7buczg7eRJBZzSb53sN +n3M9ynXcONV1pxNStT10AavTu+aOjx5crgVF8XpaDuRetRnka8gCos+A3RcyB/ZqK7TokHWQZ9sL w4j1WWWS+IsI81p2D1t7LLMLtzZUycTOwtdee/wELPk04Y2/10ZAG1MZkZKERnT+ip3iP2yZZchId Zb68g497orahyHTSdLd0LXu6u/kcvsKuXshHnxhFjPQ9Gap3A1NvtpSVuHUc1odZjXptSQArlANre DqL8OlW1w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcNKg-0001lH-VB; Tue, 10 Nov 2020 06:40:47 +0000 Received: from smtp2207-205.mail.aliyun.com ([121.197.207.205]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcNKe-0001k4-5i for linux-arm-kernel@lists.infradead.org; Tue, 10 Nov 2020 06:40:45 +0000 X-Alimail-AntiSpam: AC=CONTINUE; BC=0.316818|-1; CH=blue; DM=|OVERLOAD|false|; DS=CONTINUE|ham_system_inform|0.414304-0.00181664-0.58388; FP=11418629599924430517|1|1|17|0|-1|-1|-1; HT=ay29a033018047194; MF=frank@allwinnertech.com; NM=1; PH=DS; RN=11; RT=11; SR=0; TI=SMTPD_---.IuonUmF_1604990436; Received: from allwinnertech.com(mailfrom:frank@allwinnertech.com fp:SMTPD_---.IuonUmF_1604990436) by smtp.aliyun-inc.com(10.147.40.233); Tue, 10 Nov 2020 14:40:40 +0800 From: Frank Lee To: tiny.windzz@gmail.com Subject: [RESEND PATCH 13/19] phy: sun4i-usb: add support for A100 USB PHY Date: Tue, 10 Nov 2020 14:40:32 +0800 Message-Id: X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201110_014044_451673_D26E3E9A X-CRM114-Status: GOOD ( 11.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Randy Dunlap , linux-kernel@vger.kernel.org, Maxime Ripard , Kishon Vijay Abraham I , Vinod Koul , Krzysztof Kozlowski , Yangtao Li , Colin Ian King , Chen-Yu Tsai , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Yangtao Li Add support for a100's usb phy, which with 2 PHYs. Signed-off-by: Yangtao Li --- drivers/phy/allwinner/phy-sun4i-usb.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index a6900495baa5..1a0e403131e7 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -107,6 +107,7 @@ enum sun4i_usb_phy_type { sun8i_r40_phy, sun8i_v3s_phy, sun50i_a64_phy, + sun50i_a100_phy, sun50i_h6_phy, }; @@ -289,7 +290,13 @@ static int sun4i_usb_phy_init(struct phy *_phy) } if (data->cfg->type == sun8i_a83t_phy || + data->cfg->type == sun50i_a100_phy || data->cfg->type == sun50i_h6_phy) { + if (phy->pmu && data->cfg->enable_pmu_unk1) { + val = readl(phy->pmu + REG_PMU_UNK1); + writel(val & ~BIT(3), phy->pmu + REG_PMU_UNK1); + } + if (phy->index == 0) { val = readl(data->base + data->cfg->phyctl_offset); val |= PHY_CTL_VBUSVLDEXT; @@ -339,6 +346,7 @@ static int sun4i_usb_phy_exit(struct phy *_phy) if (phy->index == 0) { if (data->cfg->type == sun8i_a83t_phy || + data->cfg->type == sun50i_a100_phy || data->cfg->type == sun50i_h6_phy) { void __iomem *phyctl = data->base + data->cfg->phyctl_offset; @@ -960,6 +968,16 @@ static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = { .phy0_dual_route = true, }; +static const struct sun4i_usb_phy_cfg sun50i_a100_cfg = { + .num_phys = 2, + .type = sun50i_a100_phy, + .disc_thresh = 3, + .phyctl_offset = REG_PHYCTL_A33, + .dedicated_clocks = true, + .enable_pmu_unk1 = true, + .phy0_dual_route = true, +}; + static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = { .num_phys = 4, .type = sun50i_h6_phy, @@ -983,6 +1001,7 @@ static const struct of_device_id sun4i_usb_phy_of_match[] = { { .compatible = "allwinner,sun8i-v3s-usb-phy", .data = &sun8i_v3s_cfg }, { .compatible = "allwinner,sun50i-a64-usb-phy", .data = &sun50i_a64_cfg}, + { .compatible = "allwinner,sun50i-a100-usb-phy", .data = &sun50i_a100_cfg }, { .compatible = "allwinner,sun50i-h6-usb-phy", .data = &sun50i_h6_cfg }, { }, };