Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp913536imm; Thu, 4 Oct 2018 05:31:48 -0700 (PDT) X-Google-Smtp-Source: ACcGV63a36SEKv0bcu38hVBI1KSY3XLlKIEStNad+snvlyee5Gj0fbUFONp23kgVv/K0BrVNa7pO X-Received: by 2002:a63:4e4e:: with SMTP id o14-v6mr5675549pgl.181.1538656308069; Thu, 04 Oct 2018 05:31:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538656307; cv=none; d=google.com; s=arc-20160816; b=n8lyYJIA7VCxOmUJdLkRl2ksmh9aFDcSdK43rd/6gjMhL+4ggzq7//CK/cB5w3Ex/s ocbZTJ6DXqy+Fc7IRxBYILLJtoEkiGGDI8qdagWAxF9/dfHTMePqBYoLQbWSwEoi0HO/ tfF1AtHhwQeOv1C9HHpX9PK5jXpjtanO5bHfjGLI2vdSsyk8XGdLkocBUvBQ4qY5xyyq HDSQ/3h3lNm55RPAe4qrvTxA8mloM5K5E2/zohBgNyaQEqT/w9hR49+Vtb6bSd7DFEcy mHa/kqqMZNRckeLWExGX7Jq4zzgDO/JlCh+Xz99ZThYvdru74+irh4sZZN0qvqlkylYq zUKw== 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; bh=ZAiTI98ZGRnzDhLN6O1tTGX7jl0KqS+l6qvGdi7b0dY=; b=PeiyczZJhMPI8AIGYFwVPcSP2R7LVZReOVS/MUK0Qm1p1KFR/FUDesj8Ls/tA71P+o Y72L4RFtQi+YEQQ4IEAuBfWWnHrendVp3DDsO6PoNuWfRNEPpGbfZMoRVw36AyEXYfKq XQnClWcsbOHT8sqEHy0cHcIioJlOfEqly+mp4hW6f4mAhd9gitETq0ZKVeJdUJlo/uT+ gCj1gK+QS2RbGxAcT+gc0rDQHiqmhcTWWT/VhO4Rf73o4rvwDsBYf9tzmTl0N+it/dgI 60NhkjxaDqlyJHd7xcsybGWiPhD+6CqKflm5wJBqacM/HQrEPCGuIzqH8YR5Jn+BSQiQ VvUA== 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 o125-v6si3452637pgo.302.2018.10.04.05.31.30; Thu, 04 Oct 2018 05:31:47 -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 S1727729AbeJDTWu (ORCPT + 99 others); Thu, 4 Oct 2018 15:22:50 -0400 Received: from hermes.aosc.io ([199.195.250.187]:43936 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727586AbeJDTWu (ORCPT ); Thu, 4 Oct 2018 15:22:50 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id CC2DE6687F; Thu, 4 Oct 2018 12:29:42 +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 v4 02/10] phy: sun4i-usb: add support for missing USB PHY index Date: Thu, 4 Oct 2018 20:28:47 +0800 Message-Id: <20181004122855.22981-3-icenowy@aosc.io> In-Reply-To: <20181004122855.22981-1-icenowy@aosc.io> References: <20181004122855.22981-1-icenowy@aosc.io> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The new Allwinner H6 SoC's USB2 PHY has two holes -- USB1 (which is a 3.0 port with dedicated PHY) and USB2 (which doesn't exist at all). Add support for this kind of missing USB PHY index. Signed-off-by: Icenowy Zheng Reviewed-by: Chen-Yu Tsai --- No changes in v4. Changes in v3: - Added Chen-Yu's Review tag. drivers/phy/allwinner/phy-sun4i-usb.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/phy/allwinner/phy-sun4i-usb.c b/drivers/phy/allwinner/phy-sun4i-usb.c index d4dcd39b8d76..881078ff73f6 100644 --- a/drivers/phy/allwinner/phy-sun4i-usb.c +++ b/drivers/phy/allwinner/phy-sun4i-usb.c @@ -126,6 +126,7 @@ struct sun4i_usb_phy_cfg { bool dedicated_clocks; bool enable_pmu_unk1; bool phy0_dual_route; + int missing_phys; }; struct sun4i_usb_phy_data { @@ -646,6 +647,9 @@ static struct phy *sun4i_usb_phy_xlate(struct device *dev, if (args->args[0] >= data->cfg->num_phys) return ERR_PTR(-ENODEV); + if (data->cfg->missing_phys & BIT(args->args[0])) + return ERR_PTR(-ENODEV); + return data->phys[args->args[0]].phy; } @@ -741,6 +745,9 @@ static int sun4i_usb_phy_probe(struct platform_device *pdev) struct sun4i_usb_phy *phy = data->phys + i; char name[16]; + if (data->cfg->missing_phys & BIT(i)) + continue; + snprintf(name, sizeof(name), "usb%d_vbus", i); phy->vbus = devm_regulator_get_optional(dev, name); if (IS_ERR(phy->vbus)) { -- 2.18.0