From patchwork Wed Mar 14 14:20:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lee Jones X-Patchwork-Id: 7295 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id D879723E0C for ; Wed, 14 Mar 2012 14:20:14 +0000 (UTC) Received: from mail-iy0-f180.google.com (mail-iy0-f180.google.com [209.85.210.180]) by fiordland.canonical.com (Postfix) with ESMTP id 9F7CBA18759 for ; Wed, 14 Mar 2012 14:20:14 +0000 (UTC) Received: by mail-iy0-f180.google.com with SMTP id e36so3236838iag.11 for ; Wed, 14 Mar 2012 07:20:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=x-forwarded-to:x-forwarded-for:delivered-to:received-spf:from:to:cc :subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=9NIa0RjayTo3guAbp0OT67N3uOilZ1c0pLZFCSGoD14=; b=aMebXYixIm3AXbMw64NjOttqlEq84meZdhxicI1eecXNAIPQenotOqunXp0T5vdK13 Hjem0VFu+Kdda87gGhXh1SRjRcg605JOO1s4RBtzVPj8fqdxm8YHmvIsdyz/zkJ6pu+X 7ZI22fEYbtmdN4truDZKkURqJGPZ4/BJ2Z5N4R7ps1OcHfce+hxhuuhsy80GqNk19taj YS88jtok2s9ttAexTsukVJe2QnLL7M6dojQYst9yLVqeuk34oy5Ck3WLxQ+KWp6VXpmv z/7xqfoIM49VMjPtp1Ksv7md+49qO5wStdPhrwWQFpN2gL9e0NXqcGeDn4UcfylIg+zo sugQ== Received: by 10.50.158.133 with SMTP id wu5mr12121347igb.50.1331734814416; Wed, 14 Mar 2012 07:20:14 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.231.53.18 with SMTP id k18csp11183ibg; Wed, 14 Mar 2012 07:20:13 -0700 (PDT) Received: by 10.180.87.8 with SMTP id t8mr17478321wiz.15.1331734813103; Wed, 14 Mar 2012 07:20:13 -0700 (PDT) Received: from mail-wi0-f178.google.com (mail-wi0-f178.google.com [209.85.212.178]) by mx.google.com with ESMTPS id f16si5700852wiw.41.2012.03.14.07.20.12 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Mar 2012 07:20:13 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) client-ip=209.85.212.178; Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.178 is neither permitted nor denied by best guess record for domain of lee.jones@linaro.org) smtp.mail=lee.jones@linaro.org Received: by mail-wi0-f178.google.com with SMTP id hq7so2152552wib.13 for ; Wed, 14 Mar 2012 07:20:12 -0700 (PDT) Received: by 10.180.79.135 with SMTP id j7mr17321264wix.19.1331734812611; Wed, 14 Mar 2012 07:20:12 -0700 (PDT) Received: from localhost.localdomain (cpc1-aztw13-0-0-cust473.18-1.cable.virginmedia.com. [77.102.241.218]) by mx.google.com with ESMTPS id d7sm17077247wiz.6.2012.03.14.07.20.10 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 14 Mar 2012 07:20:11 -0700 (PDT) From: Lee Jones To: linux-arm-kernel@lists.infradead.org Cc: cjb@laptop.org, arnd@arndb.de, niklas.hernaeus@linaro.org, linux-mmc@vger.kernel.org, Lee Jones Subject: [PATCH 3/5] MMC: mmci: Add generic Device Tree bindings to mmci core code Date: Wed, 14 Mar 2012 14:20:01 +0000 Message-Id: <1331734803-17954-4-git-send-email-lee.jones@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1331734803-17954-1-git-send-email-lee.jones@linaro.org> References: <1331734803-17954-1-git-send-email-lee.jones@linaro.org> X-Gm-Message-State: ALoCoQk7whsmcXZpdYV9Fl01HMWR6cHt/4azGHZgUuuQou4JyjKWHVAbPuPJQGhd7vCk5dwVnJbo This adds the necessary bindings for collection of shared attributes used in the mmci driver. Signed-off-by: Lee Jones --- drivers/mmc/host/mmci.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 43 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c index 23b41a5..9132ca8 100644 --- a/drivers/mmc/host/mmci.c +++ b/drivers/mmc/host/mmci.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include @@ -1056,11 +1057,47 @@ static const struct mmc_host_ops mmci_ops = { .get_cd = mmci_get_cd, }; +#ifdef CONFIG_OF +static void mmci_dt_populate_generic_pdata(struct device_node *np, + struct mmci_platform_data *pdata) +{ + const void *prop; + int len; + + of_property_read_u32(np, "wp-gpios", &pdata->gpio_wp); + if (!pdata->gpio_wp) + pdata->gpio_wp = -1; + + of_property_read_u32(np, "cd-gpios", &pdata->gpio_cd); + if (!pdata->gpio_cd) + pdata->gpio_cd = -1; + + if (of_get_property(np, "cd-invert", NULL)) + pdata->cd_invert = true; + else + pdata->cd_invert = false; + + of_property_read_u32(np, "clock_frequency", &pdata->f_max); + if (!pdata->f_max) + pr_warning("%s has no 'clock_frequency' property\n", np->full_name); + + if (of_get_property(np, "mmc_cap_4_bit_data", NULL)) + pdata->capabilities |= MMC_CAP_4_BIT_DATA; + if (of_get_property(np, "mmc_cap_8_bit_data", NULL)) + pdata->capabilities |= MMC_CAP_8_BIT_DATA; + if (of_get_property(np, "mmc_cap_mmc_highspeed", NULL)) + pdata->capabilities |= MMC_CAP_MMC_HIGHSPEED; + if (of_get_property(np, "mmc_cap_sd_highspeed", NULL)) + pdata->capabilities |= MMC_CAP_SD_HIGHSPEED; +} +#endif + extern int __devinit mmci_probe(struct amba_device *dev, const struct amba_id *id) { struct mmci_platform_data *plat = dev->dev.platform_data; struct variant_data *variant = id->data; + struct device_node *np = dev->dev.of_node; struct mmci_host *host; struct mmc_host *mmc; int ret; @@ -1071,6 +1108,12 @@ extern int __devinit mmci_probe(struct amba_device *dev, goto out; } +#ifdef CONFIG_OF + if (np) + /* GPIOs, card detect invert, max freq, capabilites etc ... */ + mmci_dt_populate_generic_pdata(np, plat); +#endif + ret = amba_request_regions(dev, DRIVER_NAME); if (ret) goto out;