From patchwork Tue Apr 15 08:33:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 28399 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f197.google.com (mail-ie0-f197.google.com [209.85.223.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7E7C02036A for ; Tue, 15 Apr 2014 08:35:21 +0000 (UTC) Received: by mail-ie0-f197.google.com with SMTP id rd18sf51495360iec.8 for ; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id:cc :precedence:list-id:list-unsubscribe:list-archive:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :content-type:content-transfer-encoding; bh=cq4GUIWPPz2stv+HJiNkJNTLfT898jY/6pa2vTlV1Z0=; b=c1U/ruCt1Fah/0mp9icTDK6e/RsbqVpJJh4uUTPtMk0imjIbqwmTsIN1rQQqM8p2tK 3Tt8/UFLQCNZ3efBJx7dKLBErspksRuG9s7Tu8kTnrmylNb8Ls/In6NQ7jgMWEhz3p9f +XDbs+2cPShtw1pJJ/f4P1m60gvLe1Q4RO1PxpzYttbPkIHNRaEbdK/NIPgH6zM7jo3a 5OBmkoRTh5Mm4ZDRWDIz1BcwS+H2eYIqPMBsaOumUPTHyPbNBRrkt9zaZpeftecsoFZ0 skgoUAJftbQZROjfs/43/JcIja7zvQlmWy2l5A3EzrYh1fIjSlTBKVaUh2qDTFuQvGDQ 3/QQ== X-Gm-Message-State: ALoCoQmsLRgtXThIsREbh36wTAj9NLXtZhHhtRbBGDI3SeA1KmgzwFYiUdq2CI7MRjSpPF7aObwH X-Received: by 10.43.45.1 with SMTP id ui1mr208683icb.1.1397550920808; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.26.119 with SMTP id 110ls41421qgu.20.gmail; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) X-Received: by 10.52.104.33 with SMTP id gb1mr173423vdb.45.1397550920710; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) Received: from mail-ve0-f169.google.com (mail-ve0-f169.google.com [209.85.128.169]) by mx.google.com with ESMTPS id j5si3272635veb.183.2014.04.15.01.35.20 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 15 Apr 2014 01:35:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.169; Received: by mail-ve0-f169.google.com with SMTP id pa12so9064530veb.0 for ; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) X-Received: by 10.52.15.132 with SMTP id x4mr177018vdc.31.1397550920625; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp212902vcb; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) X-Received: by 10.140.31.6 with SMTP id e6mr452088qge.101.1397550920215; Tue, 15 Apr 2014 01:35:20 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id m17si7910963qga.65.2014.04.15.01.35.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Apr 2014 01:35:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; 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 1WZyoj-0000bR-Ok; Tue, 15 Apr 2014 08:34:09 +0000 Received: from mail-wi0-f170.google.com ([209.85.212.170]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WZyog-0000Sg-Ok for linux-arm-kernel@lists.infradead.org; Tue, 15 Apr 2014 08:34:07 +0000 Received: by mail-wi0-f170.google.com with SMTP id bs8so6488701wib.3 for ; Tue, 15 Apr 2014 01:33:44 -0700 (PDT) X-Received: by 10.194.202.229 with SMTP id kl5mr464916wjc.86.1397550824589; Tue, 15 Apr 2014 01:33:44 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id hp5sm28724391wjb.0.2014.04.15.01.33.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Apr 2014 01:33:43 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org Subject: [PATCH] ARM: integrator: add MMCI device to IM-PD1 Date: Tue, 15 Apr 2014 10:33:39 +0200 Message-Id: <1397550819-8209-1-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140415_013406_952609_1AB4F74B X-CRM114-Status: GOOD ( 15.86 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.3.2 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.212.170 listed in list.dnswl.org] Cc: Alexandre Courbot , Linus Walleij X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.169 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The IM-PD1 logic module daughterboard holds an MMCI block, which we can now provide using platform resources such as proper GPIO lines etc. We add the GPIO table dynamically and using the new GPIO descriptor mechanism. Tested and hey, it works: root@integrator:/ mount /dev/mmcblk0p1 /mnt/ root@integrator:/ ls /mnt/ ARM U-BOOT.EXE u-boot.bin u-boot.srec u-pad.bin Cc: Alexandre Courbot Signed-off-by: Linus Walleij Reviewed-by: Alexandre Courbot --- arch/arm/mach-integrator/impd1.c | 48 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/arch/arm/mach-integrator/impd1.c b/arch/arm/mach-integrator/impd1.c index 0e870ea818c4..29767cfc98bc 100644 --- a/arch/arm/mach-integrator/impd1.c +++ b/arch/arm/mach-integrator/impd1.c @@ -20,10 +20,13 @@ #include #include #include +#include +#include #include #include #include #include +#include #include #include "lm.h" @@ -52,6 +55,14 @@ void impd1_tweak_control(struct device *dev, u32 mask, u32 val) EXPORT_SYMBOL(impd1_tweak_control); /* + * MMC support + */ +static struct mmci_platform_data mmc_data = { + .ocr_mask = MMC_VDD_32_33|MMC_VDD_33_34, + .cd_invert = 1, +}; + +/* * CLCD support */ #define PANEL PROSPECTOR @@ -291,6 +302,7 @@ static struct impd1_device impd1_devs[] = { .offset = 0x00700000, .irq = { 7, 8 }, .id = 0x00041181, + .platform_data = &mmc_data, }, { .offset = 0x00800000, .irq = { 9 }, @@ -367,6 +379,42 @@ static int __init impd1_probe(struct lm_device *dev) pc_base = dev->resource.start + idev->offset; snprintf(devname, 32, "lm%x:%5.5lx", dev->id, idev->offset >> 12); + + /* Add GPIO descriptor lookup table for the PL061 block */ + if (idev->offset == 0x00400000) { + struct gpiod_lookup_table *lookup; + char *chipname; + char *mmciname; + + lookup = devm_kzalloc(&dev->dev, + sizeof(*lookup) + 3 * sizeof(struct gpiod_lookup), + GFP_KERNEL); + chipname = devm_kstrdup(&dev->dev, devname, GFP_KERNEL); + mmciname = kasprintf(GFP_KERNEL, "lm%x:00700", dev->id); + lookup->dev_id = mmciname; + /* + * Offsets on GPIO block 1: + * 3 = MMC WP (write protect) + * 4 = MMC CD (card detect) + * + * Offsets on GPIO block 2: + * 0 = Up key + * 1 = Down key + * 2 = Left key + * 3 = Right key + * 4 = Key lower left + * 5 = Key lower right + */ + /* We need the two MMCI GPIO entries */ + lookup->table[0].chip_label = chipname; + lookup->table[0].chip_hwnum = 3; + lookup->table[0].con_id = "wp"; + lookup->table[1].chip_label = chipname; + lookup->table[1].chip_hwnum = 4; + lookup->table[1].con_id = "cd"; + gpiod_add_lookup_table(lookup); + } + d = amba_ahb_device_add_res(&dev->dev, devname, pc_base, SZ_4K, irq1, irq2, idev->platform_data, idev->id,