Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4414517img; Tue, 26 Mar 2019 08:58:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwf5BsWpTn4xGvzaQk+slck/S7FscRlUzpwWnZ2cyzK3lUG9sJmeGhoSoHHUKtR0IihdWnN X-Received: by 2002:a62:574d:: with SMTP id l74mr31309074pfb.9.1553615916346; Tue, 26 Mar 2019 08:58:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553615916; cv=none; d=google.com; s=arc-20160816; b=xYDvpIHKV6NkEuc4zLy6g5LeC8mdIiEDMhaVCv7+F0VaD370Nxi7tWN1mRi1V0zOoc wuQziWqcZKQijd9ML4cGNHnIMu0rjcnd1s7Mi39eQxltD9HVtYml034mD6ky76iVtII+ tD1ilZcc4a8wTe4+KV9TSgHhoNOeTc6Pt4Prkc0FYgZ6ktYi/eZ1EtxozrIUcnqLrs+8 9nn8IrUdx7UtEYohXmmycAF+oz5SlyuuJBt/BqYcPaTsP6QTq5l9aIcjWhssTp2tXkpb kiSkLih41QWWon1/dZZXX6lhaOvduchcuFOjK/x+u846wi/M7eBTOxUrK97ULnLGxT4A lv4Q== 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=6RoQu7lKq5HUjsOpqb5VBB45JH3hBOA4zTqWoTxIGD0=; b=xdrDxQsK12LG1pY7twB/vlhRwZIe8Yu59qubfWAXoa8BKWOzvC/bJA28eRl9yajgp9 WxhYpxEVXOYIfTKMb+T+5NTTMWVxwv4rk4HRtvydHpLZO0TINJvUg7dMXfZiAHnt4UD/ 6N79mkxvOpoeAY3BdSWLB+iAFVrGDRznTTrvW7FLsZst+c7njQ8NyGm8vwLgfg0s711X VUoqUaowZOyu5VEtDU9lIeUkyfgfi4dQIscwwhdgDpgtEZv62KpoKo1MZAW6rmRByFhV UIAVtTnaCkICCelbNxUSfa46IJ6Y97+nrzR/thym8YW5MUXRAwEIo1W3KlaukIH3JUWq stHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b="2AHMFk/n"; 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 d9si18196268pln.403.2019.03.26.08.58.20; Tue, 26 Mar 2019 08:58:36 -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="2AHMFk/n"; 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 S1730451AbfCZP5k (ORCPT + 99 others); Tue, 26 Mar 2019 11:57:40 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39700 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731489AbfCZP5i (ORCPT ); Tue, 26 Mar 2019 11:57:38 -0400 Received: by mail-wr1-f68.google.com with SMTP id j9so14984636wrn.6 for ; Tue, 26 Mar 2019 08:57:37 -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=6RoQu7lKq5HUjsOpqb5VBB45JH3hBOA4zTqWoTxIGD0=; b=2AHMFk/nV5es0CsmlQNEAIl+UXjXuD9BY51qYWm4ehk9X8dG1QUsoNCAXpMvlhH7Yf IN5YEtJVEBJfAUOj69n6pKbfvWQKkf+zgH78/S+OXP7aL5vS+rVnXVaEAlpe22TZMwjh oIA+xxnD09PC1d7gp7X/fJzWrb1AMAtBHgtzTtdYOO0gXAX8FQv/kXiXxgHh/1LqRKSa pKd+xwZqf6SVmOt/B42PXgO/2/fVML/+pCAdpTdozi90nJxPzhlXTXaTDpI0Gauj0AEd HX6AvkpZFtqrfhzFw0K3UJPbZcZjitIKe2xPxJ6ItfyseU7XMHkqe6jjG4q/b8lBn81K KUbA== 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=6RoQu7lKq5HUjsOpqb5VBB45JH3hBOA4zTqWoTxIGD0=; b=hGGLQamF0CRz7dmA1F8r+QRd4SEvCFaahH4i3d5kF42pnNS1wEYMct3XHdrVxoJrUx 2K2NsQUUPMJNlUISHCgNSNs3B38+h+H4104s+BbxRsj2n/K9DAzzZ+YrLb0EaRZ6zYDn RxtM8x6uUizF9gzCxlB8g6TBebcKsdj54UpGKAl+8VSS1dOtOsRhUdq3L7AKn957JNgv U8O2XvZtto1Kp2mRSgVHoP1vpFdPAkVd7qd6DudgqfrmYGu2DP2KZTfg24Y8QlY4XMOG /6Zp8c9VNNU0iEltwVbCnfvTLgjTcgKPJMvOwbARpeL4XTnCV/Hz+cp9BsV6xaJ62fY5 ymxQ== X-Gm-Message-State: APjAAAXIiBEnydTlWj63B5j14xm2pqAJSb02tlve48x+2OCq+PoxDMFm kOfQu/TiTg7CMD3ubv78AvDaGA== X-Received: by 2002:a5d:5190:: with SMTP id k16mr2329572wrv.10.1553615856848; Tue, 26 Mar 2019 08:57:36 -0700 (PDT) Received: from debian-brgl.home ([2a01:cb1d:af:5b00:6d6c:8493:1ab5:dad7]) by smtp.gmail.com with ESMTPSA id 204sm28522999wmc.1.2019.03.26.08.57.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Mar 2019 08:57:36 -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 1/3] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Tue, 26 Mar 2019 16:57:26 +0100 Message-Id: <20190326155728.5432-2-brgl@bgdev.pl> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326155728.5432-1-brgl@bgdev.pl> References: <20190326155728.5432-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 | 48 +++++++++++++++++++-- 1 file changed, 45 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-omapl138-hawk.c b/arch/arm/mach-davinci/board-omapl138-hawk.c index 0896af2bed24..ea7110e47e8a 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,14 +299,48 @@ 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 = 1, + .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.1", + .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 */ @@ -326,12 +361,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.20.1