Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4527602imm; Sat, 21 Jul 2018 23:00:27 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfx4VV/ZjkCT3QNKm1Jb1w+G96ZDl/KJnG8om4stSbOiNLRK0x0+SCyESpkOluv/r6X0eN/ X-Received: by 2002:a17:902:c6b:: with SMTP id 98-v6mr8074594pls.37.1532239227174; Sat, 21 Jul 2018 23:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532239227; cv=none; d=google.com; s=arc-20160816; b=e21cbGyqIxcPfXqaI1D/GbFKJR6C9I2ArGyO5/qyEvnqOjQLpFS2wnHeFWt6guTAkE E4k+Np+zBMepELmEExRhiAU5mWHFJCoqyG9xnVRxsL976a0NNZN5l5YhxeZA0m3PVhLi BCixh0XahQO1xlX+1jhcyXrsPacnJGPbMhC/xKt+V9YJk7UUAgfD7VqjgpSnsGRfUA6L QFHKOd1Mqkr9Rfs6eGiGUCAeBoMuEWOPXBve0RUFdYNxIGxlLIIDEagqfuXMmvUH4BB2 HyJOtwh3sBgTYcGEWPsJV1Lwux3IbFKAhAmWDu4FklcN6E+iG2GcFdFdtImK1r9flJOc kf7A== 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=K1fWEsI3M5B18el8Z0U2jMXxM6qVBDk6Um8EbAXFUEY=; b=nP+NMYP7fTuQVp++RyKfmWGUUQkah5Aqb0uKUaGBMtg+R6nT8R9F+On0toaiwNqAC2 odCiTIPa7x5PwD76xBgXD6IBbFccpGGdh+s+/s27DLQz5tGT3P3R/VADDWKcZLdFltBk KRNvtkIqmSyVy9S3iwDIVXOTA0oD9YD8iB6HLTJbTs/92v6yITIv8FEmHLHFqVERrq3M sf82CUGzxI/v4MdCKubFrwiFgWrsAiU0A/0HBNBuUcF5zkokVwlENg8nHlLeHij68cRl kpHQEJ6ac63PJIiiJDDGu0tmxz/CyexPEbw6/pGRs931xLEyB0N38Uykzo+KDSCsGkK+ SdPg== 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 r21-v6si5798422pgu.55.2018.07.21.23.00.12; Sat, 21 Jul 2018 23:00:27 -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 S1728053AbeGVGx6 (ORCPT + 99 others); Sun, 22 Jul 2018 02:53:58 -0400 Received: from hermes.aosc.io ([199.195.250.187]:45371 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727768AbeGVGx6 (ORCPT ); Sun, 22 Jul 2018 02:53:58 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 7291C9F163; Sun, 22 Jul 2018 05:58:25 +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 1/9] phy: sun4i-usb: add support for missing USB PHY index Date: Sun, 22 Jul 2018 13:57:31 +0800 Message-Id: <20180722055739.26464-2-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 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 --- 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