Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3702368imu; Mon, 28 Jan 2019 09:17:39 -0800 (PST) X-Google-Smtp-Source: ALg8bN4/zoyaCTjEcmBdj9iu5LNCVT0RrYwZL5Ozjw+kDUZqhQ8vD2snM0k0/LooZT3NqR84Amo+ X-Received: by 2002:a63:101:: with SMTP id 1mr20579177pgb.152.1548695859376; Mon, 28 Jan 2019 09:17:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548695859; cv=none; d=google.com; s=arc-20160816; b=u8vb0t6I/COZE2TWuYZ9wDfPZ9VCyryRdY259DeFqBP5Al7d91MdgNmXBXcXg+0IlH rwxF51AfVk3BKLM1QeCyLeKPdvmLh1cLDMIu4PWH8gRUFo3kKvOJ1mNEfM/M0l1Rge3B Z6qLahLwEfNzJbJ0i7LpCDDO70KKvqlznli6JzWL0UWXonCiTZxbmSokyUBlGDplKlN4 XA6ctib2oqzqS5B70m3aJT7Hh7Z3gLPEnvKbJRaDZnON/2r7GemBNQTXZZ+E+c4/c+Db hRql2zTTc5uDKUTpKJYi78eoX+y5HdBEpLtrR7CE0M/4Fb0KMxxp1Cp6YpVPqbbz7nXy PZnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=of9eVyH6zQbioL4luBnYGWrOVshE9YGw304Zq0/ckGw=; b=YYCIGHAp0lF+pwFhY3NrEGdLpMNbmP/yRjmRynSGvbxo9gIWmcZmG2NvAc7hMy7/tb tN/XmovdTqRwTywP83ta8fbF6Pvq527lF8QfEfTF+yRtKhzTxaZ0319rwoeoNgbWh7iR Qb56zG0Y/toVLDdXOKf5x9fmWSHJGksFp/sMCoJbCfhf1+x9xKaadjZGZeay70i6a1RU wnTs+9c75l5RebI6OyU5YjbrfDd512b4Fmfitc7pYpUMpU6mU1yijSQxP2e3+UtmQWX4 bI3xf/kABrhQavlWm2Dqnj6XDW+JcZmi6ZW7Vn0R8Bbauc2XqTwgq60yV9pwYcj1yx4q 8/ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gUxHwdBF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y40si35199608pla.251.2019.01.28.09.17.24; Mon, 28 Jan 2019 09:17:39 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=gUxHwdBF; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731425AbfA1QGE (ORCPT + 99 others); Mon, 28 Jan 2019 11:06:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:53996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730072AbfA1QGC (ORCPT ); Mon, 28 Jan 2019 11:06:02 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 940F020989; Mon, 28 Jan 2019 16:06:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691562; bh=xRz9z9fe4cnM7O27lB9bmw/V8TQEWxMYuGqXPSOQKgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gUxHwdBFsmOQCP086AQxJmcLOOuVT43/IMcvyhmXGj7NphqIQgSJPUS2ohkqj03Vr LLYhN965XNlqaHmUomkRDQL+5YFG8Q+M0YPbSQNgVNXlpzwwul2lsS/00D0TFkuz8D OZQuiekyHsu+hGPcSpVXG4S3O/n2mYM05kZw+JZ8= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Icenowy Zheng , Kishon Vijay Abraham I , Sasha Levin Subject: [PATCH AUTOSEL 4.19 142/258] phy: sun4i-usb: add support for missing USB PHY index Date: Mon, 28 Jan 2019 10:57:28 -0500 Message-Id: <20190128155924.51521-142-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Icenowy Zheng [ Upstream commit 2659392e5c08dff626e6db1d739adff58a94604d ] 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 Signed-off-by: Kishon Vijay Abraham I Signed-off-by: Sasha Levin --- 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.19.1