Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1919535imm; Fri, 6 Jul 2018 08:44:07 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf76K7PxZtLvQm/mR41+LvKaDj1laeUTak7lNuCBE9Gb+fOBSfkraJsfnsaG0LnNHcO1md9 X-Received: by 2002:a17:902:a9:: with SMTP id a38-v6mr10952139pla.102.1530891847692; Fri, 06 Jul 2018 08:44:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530891847; cv=none; d=google.com; s=arc-20160816; b=Vs+5+H+b4JqE6C2YFL4PrXxjTgjO92xqCDqPaFFlDUSNxq26oZo/4IEqqTUhdG8Y/O q+I8m5Goyugj0/UaKEkvZmVNzAFkjfWKlOqDhSdcpOGzGytba/CQBQU1YaVC4dMWnoZe WlmVOnQwDWUEUO0ClmD21IwdvY14dgdRCECqb5GZUpSRIIzzrzQtFeBlLPX9MeEV9Yzu yEWBH4h2ArWcmLQfSh0CvKdP0mFRCk2Y95IzLy1vzNJ45ScM0606tO4qWjWo0ivrR5xM 2VvlktKvMkrY+IokU6BmbeYz/ZdaxN7NtBjJ+Ttgbq18E0CkVyFoOBu6XZGEpJRJgm9Q VT5g== 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=t3v/lk4Pg8UuyJUDUy31cCdIyb93uVxhK48DhxbasHk=; b=F+9HPC8GFtkuZiVKasznD6J46aFiQHWbwzieSJh4B3aA38JDiEHD9l3HSy1yrprJGe 3LrfntN+bkhRGpwd8AGHp0KN6yvJS1SPDt2ppo+mKt5H2eYw7wbTyYZZ9os5h101IlIV TOkv1vyOqEAyACyZZJpZSIzcXzSPH8NnXlWMq4AW1Bd0qmkIchRqVYqmarv8tQhBXbZ3 lDakv8Wwps/mZlierglIfCKMRqcrxZbdttoRwr3IVwlzHoJnSevhDayHPEup3DMSyD3s pw4Md/Gf9DRY3Zx9v+oA7uhh1SG3vJVXUozq3chW7YzjWEXM0H9owyQitt9bMYp9pceG Hjmw== 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 d26-v6si8442692pgd.32.2018.07.06.08.43.52; Fri, 06 Jul 2018 08:44:07 -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 S933273AbeGFPmY (ORCPT + 99 others); Fri, 6 Jul 2018 11:42:24 -0400 Received: from hermes.aosc.io ([199.195.250.187]:53572 "EHLO hermes.aosc.io" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932598AbeGFPmX (ORCPT ); Fri, 6 Jul 2018 11:42:23 -0400 Received: from localhost (localhost [127.0.0.1]) (Authenticated sender: icenowy@aosc.io) by hermes.aosc.io (Postfix) with ESMTPSA id 8CD9D643CB; Fri, 6 Jul 2018 15:40:04 +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 v2 1/9] phy: sun4i-usb: add support for missing USB PHY index Date: Fri, 6 Jul 2018 23:37:57 +0800 Message-Id: <20180706153805.25842-2-icenowy@aosc.io> In-Reply-To: <20180706153805.25842-1-icenowy@aosc.io> References: <20180706153805.25842-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 --- 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.17.1