Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3643475yba; Tue, 9 Apr 2019 01:30:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqwl+8iqAkGBtsyK4MlaQtfMghqeTX9BiXRzh3ahomiAdXt7RG16TG+JNZfnN58IE98zV2VN X-Received: by 2002:a65:448b:: with SMTP id l11mr33223368pgq.185.1554798615193; Tue, 09 Apr 2019 01:30:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554798615; cv=none; d=google.com; s=arc-20160816; b=DjT135LSd0etsFh7SEx8GeC4hV/7Ra76LwplDMeFDTOyLU+WRacMjHYIkokkMCawQ3 ydFvcKcSYOzi1TVSedNcFqBkc7fRyLkiKQLaITMpKNHhv3tzv7ihWpmeart2e7AklUuF p5hBzQut9jh/6/soN8yUut0x0DGQadWES9yHuLJP7a6ejftEydYVk7WKfiPz4/EN7OTB xEOhYi2Iw0iF20TYXjPf3U/Z0W8oLqEKUMHzKWvGd9DVs07Tgo6ndavy+NBGdIi9QEQA vJgeklK30xf8wqeuqT+m60zQ8EhpSgdwv0pJh62nVfPU5gHHO7d8JPL1YFzIavU+THsP JgYg== 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=IYtJs+a5WYmydzS+GfkReYv2cNn/2qqJE3f4mcipvk4ae9FQ+q+efxxEI6yvfXYUPT ACjf2Z75oy3tw2G7LD0tH4yANMkeDm+gjrxbK27qEEYMrQVzk1mqkJaldypk5Eh+Wabh Xl7dLOXdOA2e8LsPZd7McPEm3sB6jDt1ECEesBN7ZUVwD0vZc1MJS87h9fwAqUPSOxPz s9XaIH7ZbkYqjUFXY08wTwNTrKoMIzKI+ymHTVFn8orlgGZTi6RDlAilXMpqh0q1/wVC uJ7UV6nIDTRAGWOSzfRTCDts0xBp6kRlyNNDiP40cXxoNLPXiT8OofEiSBsNt7ScFUif Q/5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=s99I0hVk; 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 u19si23660559pga.100.2019.04.09.01.29.59; Tue, 09 Apr 2019 01:30:15 -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=s99I0hVk; 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 S1726814AbfDII3I (ORCPT + 99 others); Tue, 9 Apr 2019 04:29:08 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33264 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726765AbfDII3H (ORCPT ); Tue, 9 Apr 2019 04:29:07 -0400 Received: by mail-wr1-f67.google.com with SMTP id q1so19704698wrp.0 for ; Tue, 09 Apr 2019 01:29:05 -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=s99I0hVkurOugcw1p2GVsy9/iolntxChb1wMHFhKwdWsGTYowrVBedaTcoohRv1I2I qqWs6ADvHGqaBJcOVWBmvS1Trdj1RdsLOmorucGdN5FbA2BV6+SZ4wEtQfuZ7mjqIq+k B31JBuG048iRnXknjb8+nMWglaY6g8O8UkPcniFG0pGt15WOJA5vJm8yZ1/8xhIzfF1k dUl/u15wFJnPd9u2vo35AOshy90KiK9wJZJDMdKJz+jWjEUG+rWrI3JWKYvjXTUv8nqx wmC7iY0IpWJLzeAuPFlKThI2lA6DdCWQ+P0ar6F18+uGJv3r931t8Y8K3OqeJFsuQYK+ 21+g== 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=OhKZ9p0aj2dNliClZkFhATez0taJ5e4K8k8fX23pkn/PjCWimkkyYUvS+2f6J7ALPz HX4Ni3tjrQAwrJ2wyyqQnwSuYSSbJJvnQWZKFJUrqbs8IybmB4JwYD3NyFUF0F4W/x83 TQ7S1NFxAN4nlVPEwD16UzzZ/WaJ2rwlJEmO9EI9afaeWA2BUGOB9Zw55fSfB6KBeh28 WrLSqvs/3nFfIWMIL5yf0/2WUQE5lqB/OM6dTq0lq5mpCy34FPha5zZXhQ/dHW6KOhU2 QMw5BInshF3EwHF9Q4SjJbcl3O6MxfujyJUXmaMNpe3Hxk0vSU/LJZUGmFltbNgl6Nq8 pRrA== X-Gm-Message-State: APjAAAUtU1THe/1JteTHiz1ONAf+uBlElTRSdsYaD8rb1D/h/9EOJz/W NIk+Kpg1b4MPIX4+vjAXyX6Ljw== X-Received: by 2002:adf:f285:: with SMTP id k5mr6966620wro.110.1554798545229; Tue, 09 Apr 2019 01:29:05 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id c20sm59968651wre.28.2019.04.09.01.29.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 Apr 2019 01:29:04 -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 v3 4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Tue, 9 Apr 2019 10:28:53 +0200 Message-Id: <20190409082855.15373-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190409082855.15373-1-brgl@bgdev.pl> References: <20190409082855.15373-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