From patchwork Mon Sep 27 02:57:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zhangfei Gao X-Patchwork-Id: 210662 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8R2vL0a032561 for ; Mon, 27 Sep 2010 02:57:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932420Ab0I0C5V (ORCPT ); Sun, 26 Sep 2010 22:57:21 -0400 Received: from mail-iw0-f174.google.com ([209.85.214.174]:64300 "EHLO mail-iw0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932323Ab0I0C5U (ORCPT ); Sun, 26 Sep 2010 22:57:20 -0400 Received: by iwn5 with SMTP id 5so4371473iwn.19 for ; Sun, 26 Sep 2010 19:57:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:date:message-id :subject:from:to:cc:content-type; bh=YuS/PYFjfYPoUHzg4W87vx/Jw+SZKuyad2jFqihrapQ=; b=E8OLl3Bj0D28SCcbmvDsd5hQTohQTFoCWB52kGw/OmWhD9LID334A+jtZWyzRsAsrY mrnwq3mri8xUZRptgSAj7IYoD9oI0dvHbbXDyFBXTAusU3+touE3xT5a+LgOuvG1sAYt cmyuXTKLl41dB3uhnC3GWSDaXFZ7SYkM7q3mA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:cc:content-type; b=k2KuB6ShWIZSSj2oQjfWCo5NZo0ljGPcfdu4iYesEtqA8f/GUFf20V8eYhBAFh+zxd bbqwE4J+vi3LdLXepg0lK0XuDGIYt+IqRoDVA+r/RiphuIYAfWi0sgbRT4I60Iyq8hu2 FPSOimP3MdKDwd8uLWO8qsl3ifK7SveftxaHA= MIME-Version: 1.0 Received: by 10.231.174.196 with SMTP id u4mr8403086ibz.19.1285556239902; Sun, 26 Sep 2010 19:57:19 -0700 (PDT) Received: by 10.231.206.203 with HTTP; Sun, 26 Sep 2010 19:57:19 -0700 (PDT) Date: Sun, 26 Sep 2010 22:57:19 -0400 Message-ID: Subject: [patch 1/3] sdhci-pltfm: add call back get_quirk From: zhangfei gao To: linux-mmc@vger.kernel.org Cc: Chris Ball , Wolfram Sang , eric.y.miao@gmail.com, Haojian Zhuang Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Mon, 27 Sep 2010 02:57:21 +0000 (UTC) From af7aa1232efd3bb3bf3eac151b71dba7d4a0c875 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao Date: Mon, 27 Sep 2010 10:33:38 -0400 Subject: [PATCH 2/3] dhci-pltfm: add call back get_quirk One driver may serve several device, each one may have different quirks instead of the initial one. Signed-off-by: Zhangfei Gao --- drivers/mmc/host/sdhci-pltfm.c | 8 ++++++-- include/linux/sdhci-pltfm.h | 1 + 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-pltfm.c b/drivers/mmc/host/sdhci-pltfm.c index 82d3d05..5c3c513 100644 --- a/drivers/mmc/host/sdhci-pltfm.c +++ b/drivers/mmc/host/sdhci-pltfm.c @@ -91,8 +91,7 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) host->ops = pdata->ops; else host->ops = &sdhci_pltfm_ops; - if (pdata) - host->quirks = pdata->quirks; + host->irq = platform_get_irq(pdev, 0); if (!request_mem_region(iomem->start, resource_size(iomem), @@ -115,6 +114,11 @@ static int __devinit sdhci_pltfm_probe(struct platform_device *pdev) goto err_plat_init; } + if (pdata && pdata->get_quirk) + host->quirks = pdata->get_quirk(host); + else if (pdata) + host->quirks = pdata->quirks; + ret = sdhci_add_host(host); if (ret) goto err_add_host; diff --git a/include/linux/sdhci-pltfm.h b/include/linux/sdhci-pltfm.h index 80c415e..0d20cb4 100644 --- a/include/linux/sdhci-pltfm.h +++ b/include/linux/sdhci-pltfm.h @@ -30,6 +30,7 @@ struct sdhci_pltfm_data { unsigned int quirks; int (*init)(struct sdhci_host *host, struct sdhci_pltfm_data *pdata, void* priv_pdata); void (*exit)(struct sdhci_host *host); + unsigned int (*get_quirk)(struct sdhci_host *host); struct sdhci_host *(*alloc_host)(struct device *dev); }; -- 1.7.0.4