From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11FE7C10F13 for ; Thu, 11 Apr 2019 09:31:31 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C733620850 for ; Thu, 11 Apr 2019 09:31:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ddT7r9wb"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=bgdev-pl.20150623.gappssmtp.com header.i=@bgdev-pl.20150623.gappssmtp.com header.b="LKWFbZDw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C733620850 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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=kTNCFU7mE6/l+LK91U9mQtsPLx+/8whcpYxm4HUAaBE=; b=ddT7r9wbA2ZJF3 vIp2u+ncxC4qTZNbEC7H6f8zAwrjvGFu6DHwr3NpzXlvegNG3gpYlUDiT2cvpK7JT/ZPbf2VDJY5L WkfF0U18Nur9zDUdGJWvB03dWqv4nhm/YXIrtaTIubrQzMul5fgIf8pu9Z+THsJ23RTCexcXnL2wa D0QAP3AuXdAtNoMRPE7/2EJmKwlAWmmOK7ILGsx3yzyJoOhCCLdT+wW3PTmJRk0/ARO/2SjQyU2bd DtYksG9UX62QZdn3RFaEZ3QE4GYndi0cZIZC6w7SNVMdmcPouMGDHHqWAjv8e80FjVSF477PQyWhH RA0DJ4WsWeulSR5TS+mQ==; 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 1hEW3N-0005Rj-4y; Thu, 11 Apr 2019 09:31:29 +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 1hEW2X-0004LA-5n for linux-arm-kernel@lists.infradead.org; Thu, 11 Apr 2019 09:30:41 +0000 Received: by mail-wm1-x343.google.com with SMTP id o25so5785857wmf.5 for ; Thu, 11 Apr 2019 02:30: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=gyAH0wiE/i5zzvDeE8RjO1VQwB5hV38XLhGYRf7RuPY=; b=LKWFbZDwyDIE9VBr6ZDku3pb8lR9hY4EYrV44XAhbR/fmjLWPCxnw3Krj21LVhqRTL YPBAPpxboZOOsae32hg1KEvxzNeEzuqgz9c7x2WtxgQdNFU/W1LE0/BOSOa0sYpDWQgr KNritHHpzh8a/BK7iC+SS49TfrsLKuEFHrrbEaVIcpoZ9OwdKd9Z4lHXWbGmSDLbDkYr 8+NVPjZVZHiCBz9JxBt7hcGe2hLlKeV3K99wlW0Nl3aRIN8lzhvXYY9xOSczTINuTBFx n2ubV4JS4+fDrLXAd+6t1kE2Gu6uX/d71iIwtW21xKzQ1hVjv6HPfwg2lBEhXCvsw3+4 LGbg== 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=gyAH0wiE/i5zzvDeE8RjO1VQwB5hV38XLhGYRf7RuPY=; b=fWZmp1dbmznCFPokiUWqGORTq8zUCfKNLx5rr2elz8ivUmPI4LQR6FmhQ+3nXpmCDJ RL5rscEj+a6r4waoRapEm09JnOEaPj+eQEN0ShdB9YXKmfRs1MoJHWT/XEEnaOo8Z163 j94R4MTtzUBLVkDkpii69yYrAnwdUGy9wmIDhLfQ2W8j0ddHvkqsWpNcINJTPhGthzUS 10KGZPq8LtMRvtQsvv6OZgGsqBp3f2dHpTOPjwLK5fdXHrxCcuiwjSaPK3kPnPa04HGn uX/6TNUTx0gL14UY6p2axTc6Rio4eQQwCvdYF+tCPzMe6oLQr0tj+d8G1Y0xvT1lCmG8 +KSg== X-Gm-Message-State: APjAAAVrPw4uj1hBCGa9GKZ5Qxmw92DgWHbSpS3cItPy/GSat1EznwBp PwWUbvDqKwRyZXz6bNc6Xfdw3A== X-Google-Smtp-Source: APXvYqzArDrbBVSw7R46IuYWlEMH89mmBiFePh3BpDkGU+eWOvyfu00TsWGYAn256PJYMX5byeDLaQ== X-Received: by 2002:a1c:cf0b:: with SMTP id f11mr5794968wmg.26.1554975035679; Thu, 11 Apr 2019 02:30:35 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Apr 2019 02:30:35 -0700 (PDT) From: Bartosz Golaszewski To: Sekhar Nori , Kevin Hilman , Alan Stern , Greg Kroah-Hartman Subject: [PATCH v4 5/6] ARM: davinci: da830-evm: add a fixed regulator for ohci-da8xx Date: Thu, 11 Apr 2019 11:30:23 +0200 Message-Id: <20190411093024.23555-6-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190411_023037_448464_F763A84A X-CRM114-Status: GOOD ( 14.23 ) 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.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-da830-evm.c | 49 +++++++++++++++++++++++-- 1 file changed, 46 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-davinci/board-da830-evm.c b/arch/arm/mach-davinci/board-da830-evm.c index e3d74e43c47d..51a892702e27 100644 --- a/arch/arm/mach-davinci/board-da830-evm.c +++ b/arch/arm/mach-davinci/board-da830-evm.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -53,15 +54,50 @@ static const short da830_evm_usb11_pins[] = { -1 }; -static struct gpiod_lookup_table da830_evm_usb_gpio_lookup = { +static struct regulator_consumer_supply da830_evm_usb_supplies[] = { + REGULATOR_SUPPLY("vbus", NULL), +}; + +static struct regulator_init_data da830_evm_usb_vbus_data = { + .consumer_supplies = da830_evm_usb_supplies, + .num_consumer_supplies = ARRAY_SIZE(da830_evm_usb_supplies), +}; + +static struct fixed_voltage_config da830_evm_usb_vbus = { + .supply_name = "vbus", + .microvolts = 33000000, + .init_data = &da830_evm_usb_vbus_data, +}; + +static struct platform_device da830_evm_usb_vbus_device = { + .name = "reg-fixed-voltage", + .id = 0, + .dev = { + .platform_data = &da830_evm_usb_vbus, + }, +}; + +static struct gpiod_lookup_table da830_evm_usb_oc_gpio_lookup = { .dev_id = "ohci-da8xx", .table = { - GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0), GPIO_LOOKUP("davinci_gpio", ON_BD_USB_OVC, "oc", 0), { } }, }; +static struct gpiod_lookup_table da830_evm_usb_vbus_gpio_lookup = { + .dev_id = "reg-fixed-voltage.0", + .table = { + GPIO_LOOKUP("davinci_gpio", ON_BD_USB_DRV, "vbus", 0), + { } + }, +}; + +static struct gpiod_lookup_table *da830_evm_usb_gpio_lookups[] = { + &da830_evm_usb_oc_gpio_lookup, + &da830_evm_usb_vbus_gpio_lookup, +}; + static struct da8xx_ohci_root_hub da830_evm_usb11_pdata = { /* TPS2065 switch @ 5V */ .potpgt = (3 + 1) / 2, /* 3 ms max */ @@ -76,6 +112,9 @@ static __init void da830_evm_usb_init(void) pr_warn("%s: USB PHY CLK registration failed: %d\n", __func__, ret); + gpiod_add_lookup_tables(da830_evm_usb_gpio_lookups, + ARRAY_SIZE(da830_evm_usb_gpio_lookups)); + ret = da8xx_register_usb_phy(); if (ret) pr_warn("%s: USB PHY registration failed: %d\n", @@ -101,7 +140,11 @@ static __init void da830_evm_usb_init(void) return; } - gpiod_add_lookup_table(&da830_evm_usb_gpio_lookup); + ret = platform_device_register(&da830_evm_usb_vbus_device); + if (ret) { + pr_warn("%s: Unable to register the vbus supply\n", __func__); + return; + } ret = da8xx_register_usb11(&da830_evm_usb11_pdata); if (ret) -- 2.21.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel