Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5640961yba; Thu, 11 Apr 2019 02:32:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqzEtGTLFyrDEYhoz1mVXRoFkqxtKO0qs6tNLTiIw4njxedVCAjNZf0wNeKqV4Ro+AWhk2FU X-Received: by 2002:a62:4290:: with SMTP id h16mr48472223pfd.8.1554975136742; Thu, 11 Apr 2019 02:32:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554975136; cv=none; d=google.com; s=arc-20160816; b=fmYF6QoKLvJEMPe8elkGvgOg3WQk1feDCpBt+EukSpjuthhh/MjoMxQTOM13tHbL99 pchIL8VyHIVRrVbO5EYgMNlnocr8tA8FJJZBx+F/7dHJF6lk3m7hZGuwqGXkKsMJYcFp B8piUDO05szJUQvsVvsU71obmUcjMF++fgTYWBlrSYZ4P1WbPbZBY/7yRoybFzk+6pSD sn0anLHp1QUsZlFekUCPpjugsfk9bDTR1JZRcaWk1NhN1WsqdotFaMuTelao84ZFjPkQ nxIH6PHA5GQevjm6Wlwj29dVoAxFyMsHRJ7wi9ZbBf7NqmD5+WvqjrrTDe74umKkvOBg 82hw== 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=WkiOzqo+5E8+PTnExhJYSKG8TC17kxUDe5ZrFElD/ZE=; b=e0e7tPI4VH1HwRV1Z2Ss8eVK7FAgjsUBkCYZEla3MsLbB/j82VY/yK2/4MBVKFa8yQ OLqmSWIF+nz5+wTNFBJA43Ox638CdEYVDkQIwT7l/gxVoIAAAI5LzvuKcp1182sT8wAt 5y6EcnC+bhdzNSa0bBZzX4qNXNA6PMuD2HAV+L6J9USK7R+15PQ1q2sgB6JmFo3BUFOT hIIM++LhYJFAF6rBijiV8jjxGrKUUQxLecRmxIMy8X27QNU3WCNWI5INky1QieiffhEP mY7l5QrpX27sIWFTafZk4hdVUdBw4WUTMmYDR48p4K5morCbCwp6gA8Fs4jSUOY9rSMB yukw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=pSiMv8vG; 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 l186si17085690pge.128.2019.04.11.02.32.00; Thu, 11 Apr 2019 02:32:16 -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; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=pSiMv8vG; 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 S1727219AbfDKJa6 (ORCPT + 99 others); Thu, 11 Apr 2019 05:30:58 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:36966 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727060AbfDKJag (ORCPT ); Thu, 11 Apr 2019 05:30:36 -0400 Received: by mail-wr1-f65.google.com with SMTP id w10so6380281wrm.4 for ; Thu, 11 Apr 2019 02:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WkiOzqo+5E8+PTnExhJYSKG8TC17kxUDe5ZrFElD/ZE=; b=pSiMv8vGTnAkAA5ZD/t+q0QDKbr3hGnuC9nvm1K+lxdLwzwA9OBpFqyNp+SvYFHIjO HBQ210SWTcRnBO5NG7ddnauELTGKgYpN/8Xo+PBi+qhuX1EKve/mnZZ2NhZTo44JIiAX HBZh/hx7zRDK2ywHDeUMOleKABL8ZaqSzV7sktZB5+QJY0B3FKdrzamUw6VvXytF1bIU /g/6c5l1jR8BAQS0TD0FAZCsx7xa6dEBNIEfxJ7NU6Xlq2QnszCNKj4foB+dzJwH1b9W AdHke2zNDyt+8kjdb3UcwwAEky3BsTONWrsFcB3NQQisS7sIIDkzVFGGOovAkUdsrRS6 hepQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WkiOzqo+5E8+PTnExhJYSKG8TC17kxUDe5ZrFElD/ZE=; b=cdi5ZxN/8bQ01sV5LAYRTm3ZloznmnF1FAYypZGS30WA41fri046JtLqLiMlNrMR2T cfUJZunqY6QBBDc78NvO/bBSHZAXrqv8ofrAcSwr0bcIpkHsqI4B5umJPCdhp0UEbfu6 rNPMFb+hTkpSy+Qu9qcfYWE+FFGQriiuBEdtTEDJJjmNKPfMVqB0/Sg+80Rk6jH1UcZW yGNq55rZ7wYnO9VWDTmy+PB1FgbjzZ3EH0+yu31bx3tV0FUT/RC9gPcJSeUda0F9r+Yg bJuwXncLw+eiTbzVYAggHEsbP7a6VZxsZwcHo4O0PZeky8k4FfnA9WQ+6y0khYbwvXUJ SEuw== X-Gm-Message-State: APjAAAUMlKgV0G223OFQtIHd+YJoKY9R99ad99/AOz2RwKNylz/ZSnxV hDlbHNznX6FhxrbqigsNbnwgKw== X-Received: by 2002:a05:6000:1152:: with SMTP id d18mr29433056wrx.32.1554975034451; Thu, 11 Apr 2019 02:30:34 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id a9sm37517228wrt.29.2019.04.11.02.30.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 02:30:33 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v4 4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Thu, 11 Apr 2019 11:30:22 +0200 Message-Id: <20190411093024.23555-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190411093024.23555-1-brgl@bgdev.pl> References: <20190411093024.23555-1-brgl@bgdev.pl> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bartosz Golaszewski Instead of directly using the vbus GPIO we should model it as a fixed regulator. Add all necessary fix-ups for the regulator to be registered and configure the vbus GPIO as its enable pin. Signed-off-by: Bartosz Golaszewski --- arch/arm/mach-davinci/board-omapl138-hawk.c | 49 +++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index e244c8648594..db177a6a7e48 100644 --- a/arch/arm/mach-davinci/board-omapl138-hawk.c +++ b/arch/arm/mach-davinci/board-omapl138-hawk.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -298,15 +299,50 @@ static const short da850_hawk_usb11_pins[] = { -1 }; -static struct gpiod_lookup_table hawk_usb_gpio_lookup = { +static struct regulator_consumer_supply hawk_usb_supplies[] = { + REGULATOR_SUPPLY("vbus", NULL), +}; + +static struct regulator_init_data hawk_usb_vbus_data = { + .consumer_supplies = hawk_usb_supplies, + .num_consumer_supplies = ARRAY_SIZE(hawk_usb_supplies), +}; + +static struct fixed_voltage_config hawk_usb_vbus = { + .supply_name = "vbus", + .microvolts = 3300000, + .init_data = &hawk_usb_vbus_data, +}; + +static struct platform_device hawk_usb_vbus_device = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &hawk_usb_vbus, + }, +}; + +static struct gpiod_lookup_table hawk_usb_oc_gpio_lookup = { .dev_id = "ohci-da8xx", .table = { - GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, "vbus", 0), GPIO_LOOKUP("davinci_gpio", DA850_USB1_OC_PIN, "oc", 0), { } }, }; +static struct gpiod_lookup_table hawk_usb_vbus_gpio_lookup = { + .dev_id = "reg-fixed-voltage.0", + .table = { + GPIO_LOOKUP("davinci_gpio", DA850_USB1_VBUS_PIN, NULL, 0), + { } + }, +}; + +static struct gpiod_lookup_table *hawk_usb_gpio_lookups[] = { + &hawk_usb_oc_gpio_lookup, + &hawk_usb_vbus_gpio_lookup, +}; + static struct da8xx_ohci_root_hub omapl138_hawk_usb11_pdata = { /* TPS2087 switch @ 5V */ .potpgt = (3 + 1) / 2, /* 3 ms max */ @@ -327,12 +363,19 @@ static __init void omapl138_hawk_usb_init(void) pr_warn("%s: USB PHY CLK registration failed: %d\n", __func__, ret); + gpiod_add_lookup_tables(hawk_usb_gpio_lookups, + ARRAY_SIZE(hawk_usb_gpio_lookups)); + ret = da8xx_register_usb_phy(); if (ret) pr_warn("%s: USB PHY registration failed: %d\n", __func__, ret); - gpiod_add_lookup_table(&hawk_usb_gpio_lookup); + ret = platform_device_register(&hawk_usb_vbus_device); + if (ret) { + pr_warn("%s: Unable to register the vbus supply\n", __func__); + return; + } ret = da8xx_register_usb11(&omapl138_hawk_usb11_pdata); if (ret) -- 2.21.0