From patchwork Fri Mar 29 09:33:32 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 10876717 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C622D1575 for ; Fri, 29 Mar 2019 09:34:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABF5D287E0 for ; Fri, 29 Mar 2019 09:34:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9D9E328856; Fri, 29 Mar 2019 09:34:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 49AF2287E0 for ; Fri, 29 Mar 2019 09:34:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=/Pb9UBtZm6fpEQho5hylk7/Unao1o6IcH12DKcsbt90=; b=YKHCUO9NvTPg49 7sIcJE0SLvbOKqMAQtnbpokaPiGX+vk6TExX1Th0S6S1HfqIKTaPc9yk6d0/c+bK2OX3ZBRqOfyOF rAjZNLjX2XK2aY3+LxDCStiLLHoKb+rSlu6BrUtGMmh+1Y16ri+zX5MWrA77j7IOSfglsOiEw13Ro mIscOx6Cng8uRy8W9z+/O8+M8PV1lelgrMKFbaf/ALWPZ7Qrj/Y8S2ftSoXMNOmSLUevPv2f2JqwQ Enjkzapk7Bh+5ZlPENEF9lZ0t3PKIhJbqOzjpRsT0DUuw0npCUzyllPpcNg/zPZwI9adDgxOUEsHf QFFuOZ3t1XFXiNCZkI3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9nuD-0002RD-OB; Fri, 29 Mar 2019 09:34:33 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1h9ntU-0001V5-3b for linux-arm-kernel@lists.infradead.org; Fri, 29 Mar 2019 09:33:50 +0000 Received: by mail-wm1-x343.google.com with SMTP id h18so1976036wml.1 for ; Fri, 29 Mar 2019 02:33:48 -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=DRYpLdhisWUf0GIGCAaRr8tzI9apZJyZ2kQ04Edu9S8PT7G74jym8pisaw3bWfmU42 Ohix53HR4FBbl2g6wHQeBal13ecoU+UPDWqOUxkV6BYbDOv0gGyUcQB62rMmAL1DUmXN 2r2MDeqZcOXUnDQsyAgmZGbsK3GBZ73SpkpH22gwyleDuEg3PdWdDrFsg6KiDv3gyu+f tRpkXiI04++gXDxe85YSqjqZZyfW87xylp5Hecz+Ujs5UOjKZX1vDwL/fzk1c9cS+VK1 B/j2ExOY75Fsju8oweRL25K/z5j1fRjEm7fRG8OpsHdI41HvnQJEbWFupTa9dVWOGboI Kp8g== X-Gm-Message-State: APjAAAVfYcq1znqwz2WJAU0lscEUfGpn8jjws4k+AFrMmMbtXoZS9T2x BpCmVx0XadxkDa6wcQFCUzdkWdq4/Gg= X-Google-Smtp-Source: APXvYqxBhAX2VClwpi4aYDKKs3DFdRs9olKE3HhUScClXiKL60lGO7CW7XC2L6AlxrsLRV/60+rvBw== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190329_023348_322549_FC0FF59E X-CRM114-Status: GOOD ( 14.19 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Bartosz Golaszewski , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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)