From patchwork Tue Aug 24 15:27:00 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Hannemann X-Patchwork-Id: 126831 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.4/8.14.3) with ESMTP id o7OFR9sV020495 for ; Tue, 24 Aug 2010 15:27:29 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755416Ab0HXP1L (ORCPT ); Tue, 24 Aug 2010 11:27:11 -0400 Received: from mta-1.ms.rz.RWTH-Aachen.DE ([134.130.7.72]:49635 "EHLO mta-1.ms.rz.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752803Ab0HXP1K (ORCPT ); Tue, 24 Aug 2010 11:27:10 -0400 Content-transfer-encoding: 7BIT Received: from ironport-out-1.rz.rwth-aachen.de ([134.130.5.40]) by mta-1.ms.rz.RWTH-Aachen.de (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008)) with ESMTP id <0L7N0031SXL59UG0@mta-1.ms.rz.RWTH-Aachen.de>; Tue, 24 Aug 2010 17:27:05 +0200 (CEST) X-IronPort-AV: E=Sophos; i="4.56,263,1280700000"; d="scan'208"; a="69947763" Received: from smarthost-2.ms.rz.rwth-aachen.de (HELO smarthost.rwth-aachen.de) ([134.130.7.90]) by ironport-in-1.rz.rwth-aachen.de with ESMTP; Tue, 24 Aug 2010 17:27:05 +0200 Received: from localhost.localdomain (informatik-4-137-226-12-76.nn.RWTH-Aachen.DE [137.226.12.76] (may be forged)) by smarthost.rwth-aachen.de (8.14.4+Sun/8.13.8/1) with ESMTP id o7OFR59d024551; Tue, 24 Aug 2010 17:27:05 +0200 (CEST) From: Arnd Hannemann To: ian@mnementh.co.uk Cc: sameo@linux.intel.com, linux-mmc@vger.kernel.org, linux-sh@vger.kernel.org, yusuke.goda.sx@renesas.com, Arnd Hannemann Subject: [PATCH 2/4] sh_mobile_sdhi: Allow the platform to specify get_cd handler Date: Tue, 24 Aug 2010 17:27:00 +0200 Message-id: <1282663622-20564-3-git-send-email-arnd@arndnet.de> X-Mailer: git-send-email 1.7.0.4 In-reply-to: <1282663622-20564-1-git-send-email-arnd@arndnet.de> References: <1282663622-20564-1-git-send-email-arnd@arndnet.de> Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 24 Aug 2010 15:27:30 +0000 (UTC) diff --git a/drivers/mfd/sh_mobile_sdhi.c b/drivers/mfd/sh_mobile_sdhi.c index cd16459..7c23630 100644 --- a/drivers/mfd/sh_mobile_sdhi.c +++ b/drivers/mfd/sh_mobile_sdhi.c @@ -65,6 +65,17 @@ static void sh_mobile_sdhi_set_pwr(struct platform_device *tmio, int state) p->set_pwr(pdev, state); } +static int sh_mobile_sdhi_get_cd(struct platform_device *tmio) +{ + struct platform_device *pdev = to_platform_device(tmio->dev.parent); + struct sh_mobile_sdhi_info *p = pdev->dev.platform_data; + + if (p && p->get_cd) + return p->get_cd(pdev); + else + return -ENOSYS; +} + static int __init sh_mobile_sdhi_probe(struct platform_device *pdev) { struct sh_mobile_sdhi *priv; @@ -106,10 +117,12 @@ static int __init sh_mobile_sdhi_probe(struct platform_device *pdev) mmc_data->hclk = clk_get_rate(priv->clk); mmc_data->set_pwr = sh_mobile_sdhi_set_pwr; + mmc_data->get_cd = sh_mobile_sdhi_get_cd; mmc_data->capabilities = MMC_CAP_MMC_HIGHSPEED; if (p) { mmc_data->flags = p->tmio_flags; mmc_data->ocr_mask = p->tmio_ocr_mask; + mmc_data->capabilities |= p->tmio_caps; } if (p && p->dma_slave_tx >= 0 && p->dma_slave_rx >= 0) { diff --git a/include/linux/mfd/sh_mobile_sdhi.h b/include/linux/mfd/sh_mobile_sdhi.h index 4906780..c981b95 100644 --- a/include/linux/mfd/sh_mobile_sdhi.h +++ b/include/linux/mfd/sh_mobile_sdhi.h @@ -7,8 +7,10 @@ struct sh_mobile_sdhi_info { int dma_slave_tx; int dma_slave_rx; unsigned long tmio_flags; + unsigned long tmio_caps; u32 tmio_ocr_mask; /* available MMC voltages */ void (*set_pwr)(struct platform_device *pdev, int state); + int (*get_cd)(struct platform_device *pdev); }; #endif /* __SH_MOBILE_SDHI_H__ */