Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4527338imm; Sat, 21 Jul 2018 23:00:09 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc6yV3uoHN9PQqbsushINFKGkAF3lFSiGmQkxDi3IZRUrVOW1ST7/OLfl2pG20RYQRneNHf X-Received: by 2002:a17:902:784d:: with SMTP id e13-v6mr7933024pln.197.1532239209806; Sat, 21 Jul 2018 23:00:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532239209; cv=none; d=google.com; s=arc-20160816; b=hsKAgtUjMZu5BpC3cCCouO7SHN6bbZzuNODk71Bs5eFPULFTV16YoaD1iuQqc2c8SI zY+8JFYY/0dd/s2ILvc9TXyuUvESoKRl7kyP7nZ7d/Ksip3z+CmefnqgEi8zm4BCVcDV fsHu+YUJeI1vCwvTng4GrovZJm5ptyLs35sb2dUccJxfcxArGEcLZZC4EVZgob7p9LYk GvGpLottYeEYDYRSO/G0tCWa6GYCVeHMacSOInooTiE2LuPpGMJpFqYRmYH6KN+2IMeX icsxcMT1pCd4N43b42lpV/vgC84QxEOTcTkSEaD4duYKipqBxmIQl86NEYcaYIfp/P83 XtWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=9dhYOCfqcceK4ouHjlXBUIqT6C7+ZiVwe9AEjyMqNA4=; b=QizmETHHOOTW3i6BQBgoaq0Y0ZL7CpVbUx6GN0L6SubHuU0zkrlPEWexGeqwFV7DOj yDH4IyZCh0bVaisKpzQN5qdIouvF942PICNc0GR1Wx4BH7G+NN9YcFgde2Lx0vP8V5Pl BOTN+NNh0PGHHB5MtqbDuxU0IPI8RSRu4tEmkM3m40c7+e3GNL6j0CD1Y5/ZQMhFMRZF Fph5TiNC/1E/Ptl8wJgKZwwBTtFEVTcXRdPpmeAU8K+rx5ZsKtHe/Z/lfTA8u+C0M0cC v3+YPaKdivU+b/UKFROretbRz42YJf5OUS3nzEg8gBLsV6y8X5wHhNPNXi/IJXhrpgUP sniQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u21-v6si5883503pgn.86.2018.07.21.22.59.55; Sat, 21 Jul 2018 23:00:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728152AbeGVGyT (ORCPT + 99 others); Sun, 22 Jul 2018 02:54:19 -0400 Received: from hermes.aosc.io ([199.195.250.187]:45403 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbeGVGyT (ORCPT ); Sun, 22 Jul 2018 02:54:19 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 795BC9F54C; Sun, 22 Jul 2018 05:58:45 +0000 (UTC) From: Icenowy Zheng To: Rob Herring , Maxime Ripard , Chen-Yu Tsai , Kishon Vijay Abraham I Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com, Icenowy Zheng Subject: [PATCH v3 2/9] phy: sun4i-usb: add support for H6 USB2 PHY Date: Sun, 22 Jul 2018 13:57:32 +0800 Message-Id: <20180722055739.26464-3-icenowy@aosc.io> In-Reply-To: <20180722055739.26464-1-icenowy@aosc.io> References: <20180722055739.26464-1-icenowy@aosc.io> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The USB 2.0 PHY on Allwinner H6 SoC is similar to older Allwinner SoCs, with some USB0 quirk like A83T and PHY index 1/2 missing. Add support for it. Signed-off-by: Icenowy Zheng Reviewed-by: Chen-Yu Tsai --- Changes in v3: - Added Chen-Yu's Review tag. drivers/phy/allwinner/phy-sun4i-usb.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index 881078ff73f6..ae16854a770a 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -115,6 +115,7 @@ enum sun4i_usb_phy_type { sun8i_r40_phy, sun8i_v3s_phy, sun50i_a64_phy, + sun50i_h6_phy, }; struct sun4i_usb_phy_cfg { @@ -295,7 +296,8 @@ static int sun4i_usb_phy_init(struct phy *_phy) return ret; } - if (data->cfg->type == sun8i_a83t_phy) { + if (data->cfg->type == sun8i_a83t_phy || + data->cfg->type == sun50i_h6_phy) { if (phy->index == 0) { val = readl(data->base + data->cfg->phyctl_offset); val |= PHY_CTL_VBUSVLDEXT; @@ -344,7 +346,8 @@ static int sun4i_usb_phy_exit(struct phy *_phy) struct sun4i_usb_phy_data *data = to_sun4i_usb_phy_data(phy); if (phy->index == 0) { - if (data->cfg->type == sun8i_a83t_phy) { + if (data->cfg->type == sun8i_a83t_phy || + data->cfg->type == sun50i_h6_phy) { void __iomem *phyctl = data->base + data->cfg->phyctl_offset; @@ -959,6 +962,17 @@ static const struct sun4i_usb_phy_cfg sun50i_a64_cfg = { .phy0_dual_route = true, }; +static const struct sun4i_usb_phy_cfg sun50i_h6_cfg = { + .num_phys = 4, + .type = sun50i_h6_phy, + .disc_thresh = 3, + .phyctl_offset = REG_PHYCTL_A33, + .dedicated_clocks = true, + .enable_pmu_unk1 = true, + .phy0_dual_route = true, + .missing_phys = BIT(1) | BIT(2), +}; + static const struct of_device_id sun4i_usb_phy_of_match[] = { { .compatible = "allwinner,sun4i-a10-usb-phy", .data = &sun4i_a10_cfg }, { .compatible = "allwinner,sun5i-a13-usb-phy", .data = &sun5i_a13_cfg }, @@ -972,6 +986,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-h6-usb-phy", .data = &sun50i_h6_cfg }, { }, }; MODULE_DEVICE_TABLE(of, sun4i_usb_phy_of_match); -- 2.18.0