From patchwork Tue Jul 21 01:12:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grazvydas Ignotas X-Patchwork-Id: 6831791 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 038FC9F38B for ; Tue, 21 Jul 2015 01:15:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0BA6320693 for ; Tue, 21 Jul 2015 01:15:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 286322064D for ; Tue, 21 Jul 2015 01:15:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHM7C-0006QJ-2O; Tue, 21 Jul 2015 01:13:02 +0000 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZHM6m-0006J0-Ez for linux-arm-kernel@lists.infradead.org; Tue, 21 Jul 2015 01:12:37 +0000 Received: by wibxm9 with SMTP id xm9so106124437wib.0 for ; Mon, 20 Jul 2015 18:12:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=h2omHo0VQ/qRWzjmnFk5aztGGZw/4BipF+MbCQnbJ9w=; b=VdpQ5hxecJOglsYT6bDTkXQkoVRop9geQx/Hd1bG6nMhoXF3yosGUYVefn+pgVbzsZ ynhi6nMQThkrhLR9NpCF613neoGR2ZcHR4tf4BWFfeI7cfCw+To+7CEMBvZLNYCNo+B5 +nL23qQziocIcUUbSJc7UXF5zQcL4KwdkmHLrjjS3/qPQRzJxwDf0nbOTZqrApkin9JQ N30uNxlmjQ+xXA5TRnrd/N6BPvAz/7CsOwfatViSU5DbTCEaGW9lKqwULzLHXWAxo4/j ttlX226AreuFIs9iEZuQ/YRrW/FrRnzHa4OXVYkE6x/zPjfp+lgXEq1k0gYsUHannAKt j+SA== X-Received: by 10.194.58.109 with SMTP id p13mr66184545wjq.36.1437441134935; Mon, 20 Jul 2015 18:12:14 -0700 (PDT) Received: from localhost.localdomain ([5.20.220.27]) by smtp.gmail.com with ESMTPSA id b13sm14276837wic.15.2015.07.20.18.12.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 20 Jul 2015 18:12:14 -0700 (PDT) From: Grazvydas Ignotas To: linux-omap@vger.kernel.org Subject: [PATCH 4/4] ARM: OMAP2+: omap3-pandora: add wifi support Date: Tue, 21 Jul 2015 04:12:01 +0300 Message-Id: <1437441121-31658-4-git-send-email-notasas@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1437441121-31658-1-git-send-email-notasas@gmail.com> References: <1437441121-31658-1-git-send-email-notasas@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150720_181236_666331_843F79EA X-CRM114-Status: GOOD ( 15.86 ) X-Spam-Score: -2.7 (--) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Tony Lindgren , devicetree@vger.kernel.org, Grazvydas Ignotas , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add wl1251 support via pdata-quirks as it's driver lacks DT support. MMC3 is marked disabled in DT so that MMC3 instance of hsmmc driver is probed using platform data with special card init callback. Signed-off-by: Grazvydas Ignotas --- arch/arm/boot/dts/omap3-pandora-common.dtsi | 5 ++ arch/arm/mach-omap2/pdata-quirks.c | 101 ++++++++++++++++++++++++++++ 2 files changed, 106 insertions(+) diff --git a/arch/arm/boot/dts/omap3-pandora-common.dtsi b/arch/arm/boot/dts/omap3-pandora-common.dtsi index 6e82c4a..f2084e6 100644 --- a/arch/arm/boot/dts/omap3-pandora-common.dtsi +++ b/arch/arm/boot/dts/omap3-pandora-common.dtsi @@ -514,6 +514,11 @@ /*wp-gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;*/ /* GPIO_127 */ }; +/* mmc3 is probed using pdata-quirks to pass wl1251 card data */ +&mmc3 { + status = "disabled"; +}; + /* bluetooth*/ &uart1 { }; diff --git a/arch/arm/mach-omap2/pdata-quirks.c b/arch/arm/mach-omap2/pdata-quirks.c index 3c97aa49..95f6724 100644 --- a/arch/arm/mach-omap2/pdata-quirks.c +++ b/arch/arm/mach-omap2/pdata-quirks.c @@ -14,6 +14,11 @@ #include #include #include +#include +#include +#include +#include +#include #include #include @@ -25,6 +30,7 @@ #include "omap_device.h" #include "omap-secure.h" #include "soc.h" +#include "hsmmc.h" struct pdata_init { const char *compatible; @@ -269,14 +275,109 @@ static void __init omap3_tao3530_legacy_init(void) hsmmc2_internal_input_clk(); } +/* omap3pandora legacy devices */ +#define PANDORA_WIFI_IRQ_GPIO 21 +#define PANDORA_WIFI_NRESET_GPIO 23 + static struct platform_device pandora_backlight = { .name = "pandora-backlight", .id = -1, }; +static struct regulator_consumer_supply pandora_vmmc3_supply[] = { + REGULATOR_SUPPLY("vmmc", "omap_hsmmc.2"), +}; + +static struct regulator_init_data pandora_vmmc3 = { + .constraints = { + .valid_ops_mask = REGULATOR_CHANGE_STATUS, + }, + .num_consumer_supplies = ARRAY_SIZE(pandora_vmmc3_supply), + .consumer_supplies = pandora_vmmc3_supply, +}; + +static struct fixed_voltage_config pandora_vwlan = { + .supply_name = "vwlan", + .microvolts = 1800000, /* 1.8V */ + .gpio = PANDORA_WIFI_NRESET_GPIO, + .startup_delay = 50000, /* 50ms */ + .enable_high = 1, + .init_data = &pandora_vmmc3, +}; + +static struct platform_device pandora_vwlan_device = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &pandora_vwlan, + }, +}; + +static void pandora_wl1251_init_card(struct mmc_card *card) +{ + /* + * We have TI wl1251 attached to MMC3. Pass this information to + * SDIO core because it can't be probed by normal methods. + */ + if (card->type == MMC_TYPE_SDIO || card->type == MMC_TYPE_SD_COMBO) { + card->quirks |= MMC_QUIRK_NONSTD_SDIO; + card->cccr.wide_bus = 1; + card->cis.vendor = 0x104c; + card->cis.device = 0x9066; + card->cis.blksize = 512; + card->cis.max_dtr = 24000000; + card->ocr = 0x80; + } +} + +static struct omap2_hsmmc_info pandora_mmc3[] = { + { + .mmc = 3, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, + .gpio_cd = -EINVAL, + .gpio_wp = -EINVAL, + .init_card = pandora_wl1251_init_card, + }, + {} /* Terminator */ +}; + +static void __init pandora_wl1251_init(void) +{ + struct wl1251_platform_data pandora_wl1251_pdata; + int ret; + + memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); + + pandora_wl1251_pdata.power_gpio = -1; + + ret = gpio_request_one(PANDORA_WIFI_IRQ_GPIO, GPIOF_IN, "wl1251 irq"); + if (ret < 0) + goto fail; + + pandora_wl1251_pdata.irq = gpio_to_irq(PANDORA_WIFI_IRQ_GPIO); + if (pandora_wl1251_pdata.irq < 0) + goto fail_irq; + + pandora_wl1251_pdata.use_eeprom = true; + ret = wl1251_set_platform_data(&pandora_wl1251_pdata); + if (ret < 0) + goto fail_irq; + + return; + +fail_irq: + gpio_free(PANDORA_WIFI_IRQ_GPIO); +fail: + pr_err("wl1251 board initialisation failed\n"); +} + static void __init omap3_pandora_legacy_init(void) { platform_device_register(&pandora_backlight); + platform_device_register(&pandora_vwlan_device); + omap_hsmmc_init(pandora_mmc3); + omap_hsmmc_late_init(pandora_mmc3); + pandora_wl1251_init(); } #endif /* CONFIG_ARCH_OMAP3 */