Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1343583ybb; Fri, 29 Mar 2019 02:36:24 -0700 (PDT) X-Google-Smtp-Source: APXvYqy4qlBWaSPqF8sUgt+47mDIkYXZcPv2nuYU3XSj7AFT38ltlExWa0yBexYqKXMgZvWuSDMX X-Received: by 2002:a17:902:e90b:: with SMTP id cs11mr46872010plb.197.1553852184461; Fri, 29 Mar 2019 02:36:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553852184; cv=none; d=google.com; s=arc-20160816; b=BRwMjnPTN02DkI2o28FBISn6QhBeFJkxs0MjzkwWoKTwC65c7U8hf9Sp7ANWPBTYgV Eetq3s0zNM8BEWfBVJzaWPgHSlP4Y+sqpusSSxc6R/84X26rrTbqeRKz0tsBHiPNrJuW M17f4di7mPAx4G0d12PCJoDVE3vGF8IIF3ZZ7KgxpDj+uLUtJxEzJd//D43wMWVfQjN5 t+NkqvyY69jCWy7ckeAq3swxEoQr3Xe78xIPHX4yykIm5xqE3SNZ20WzZRdjI1ad9iZz Xdof7hPW2WjvyFiksvlCQCjmYSuVBivXQZmuS2pPRXKBiWKcSNAxMrVbtnn05yORmvfV jUtw== 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=JM1IFJaq9Fzy9jb7gkxjcG7uHNdo0C9cZXORwZYID2s=; b=rAsdsOgB8nmFRuxPXcrcNT/7U7pDZ5qERgxKk+ueC0bLNtglXp2eErFM4AWj6U3+Ji TxeSOhkzbJy/tRgzOhTamDwkpaxf3SFZ9FiVLVje4XB/yDWRaZQPCTq/3VmS/5kM16uI cq3Az8el+/zP8khl4olfS508q3qNo4peXsvzuROWz7H6slH2y9Ohry83oWwwc9NTxI9n +3H5Rs56NrYwkH/D+DpfE/uxnwxIcFbXBgTu769bmdR/WGozCKaTFIZJxG9IBIXDEHBD KetPjOgW3I9NfCo+vo5yFiOYJNRRVE/xBN4kX7lmlD0UTCYZoE8aTQctB5fMEGwv+zXS XWkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20150623.gappssmtp.com header.s=20150623 header.b=D0JHjCon; 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 p188si1427466pfp.123.2019.03.29.02.36.09; Fri, 29 Mar 2019 02:36:24 -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=D0JHjCon; 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 S1728886AbfC2JeG (ORCPT + 99 others); Fri, 29 Mar 2019 05:34:06 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:55127 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728630AbfC2Jds (ORCPT ); Fri, 29 Mar 2019 05:33:48 -0400 Received: by mail-wm1-f65.google.com with SMTP id c1so609182wml.4 for ; Fri, 29 Mar 2019 02:33:47 -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=JM1IFJaq9Fzy9jb7gkxjcG7uHNdo0C9cZXORwZYID2s=; b=D0JHjConPyyO0cRxQv1PUTZqVI3WTeq57J3FAP2XyHi2rJUUNI5ZC5L7oc/E6tlcJN pKNHgYGDM1aPFyKvAHOx5g33iVr1PTs45fCR7PCDPkoMwaK3YfH7RUk2J3PBNkEA4rBx sYENWcWooDcJodHMYVS5WMlwCz84djynJF+xtLKkE856uw5WapRrfx8t5I/axUlT05el Z28geVAWnsVKjM6IiysviN72ZTQI5oAQAAgMrm8iM9YB/HhM7CiR+4s/ZaZHhKAFbuf/ Gajlg7u54ny33L+HlpaZvMnZhVpGiBVJahmZS8Qsum5UFEK40GnEuuS3GpBfj74Ty3x+ hdng== 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=JM1IFJaq9Fzy9jb7gkxjcG7uHNdo0C9cZXORwZYID2s=; b=o7iWJbOqyoOQgfE4NCQsGttQnp3PQKZCniNByZIq+B2rT0oY3PwpGEBnpwsIuqG64x C9B5p21HHemutavJdcAT/QOp4Zyb4+yoj23kQOQJ/k1eDDGqW8tqATAF8pjX9ORizC9H JPN89fxN7SRcu0tY0YrmJYQFtUPNKAe1qQ85XgjJNTWZQmZ6BaOfJ/lnf/iN6ESxcqer ZjDnyee0cVYKjHhXs2SSqWGP/swCGyOvI2cAonvYnXQpTaNFmTG8BJHV48HoN5uLJnuw 6Jl1v1sZOXYwiyQ+JE0Gsq9vOZdycbBolkVsbc/eRuffWlD5MaQl1USJx2JL7Krx5k4Z USUA== X-Gm-Message-State: APjAAAXMqP/UaYxukX7vAGgAFLLyuePhlYubxQubi2LsJwG9snC/L9ph nQZoTq5gHoVbBJCHZ8KvdWWUcg== X-Received: by 2002:a1c:f115:: with SMTP id p21mr3028614wmh.93.1553852026829; Fri, 29 Mar 2019 02:33:46 -0700 (PDT) Received: from localhost.localdomain (aputeaux-684-1-29-77.w90-86.abo.wanadoo.fr. [90.86.254.77]) by smtp.gmail.com with ESMTPSA id s12sm1957125wmj.42.2019.03.29.02.33.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 02:33:46 -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 v2 4/6] ARM: davinci: omapl138-hawk: add a fixed regulator for ohci-da8xx Date: Fri, 29 Mar 2019 10:33:32 +0100 Message-Id: <20190329093334.3885-5-brgl@bgdev.pl> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190329093334.3885-1-brgl@bgdev.pl> References: <20190329093334.3885-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..0039b4d4c935 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 = 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 */ @@ -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