From patchwork Tue Aug 24 15:27:02 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Hannemann X-Patchwork-Id: 177352 Return-path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on void.printf.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.9 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.2.5 Envelope-to: chris@printf.net Delivery-date: Tue, 24 Aug 2010 16:27:20 +0100 Received: from lists.laptop.org ([18.85.2.145] helo=mail.laptop.org) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1OnvPD-0003de-RZ for chris@printf.net; Tue, 24 Aug 2010 16:27:20 +0100 Received: by mail.laptop.org (Postfix) id 77694243EF; Tue, 24 Aug 2010 11:27:00 -0400 (EDT) Delivered-To: cjb@laptop.org Received: from spam.laptop.org (spam.laptop.org [18.85.46.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.laptop.org (Postfix) with ESMTPS id 99BC9243F3 for ; Tue, 24 Aug 2010 11:26:58 -0400 (EDT) X-ASG-Debug-ID: 1282663632-0b74759f0003-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id QdCeLlNRLl1wCreK for ; Tue, 24 Aug 2010 11:27:13 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755421Ab0HXP1M (ORCPT ); Tue, 24 Aug 2010 11:27:12 -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 S1755420Ab0HXP1L (ORCPT ); Tue, 24 Aug 2010 11:27:11 -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:06 +0200 (CEST) X-IronPort-AV: E=Sophos; i="4.56,263,1280700000"; d="scan'208"; a="69947768" 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 o7OFR59f024551; 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 X-ASG-Orig-Subj: [PATCH 4/4] ARM: mach-shmobile: ap4evb: Fix hotplug for SDHI1 Subject: [PATCH 4/4] ARM: mach-shmobile: ap4evb: Fix hotplug for SDHI1 Date: Tue, 24 Aug 2010 17:27:02 +0200 Message-id: <1282663622-20564-5-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-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Barracuda-Connect: vger.kernel.org[209.132.180.67] X-Barracuda-Start-Time: 1282663633 X-Barracuda-URL: http://18.85.46.23:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at laptop.org X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.5 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.38904 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c index 95935c8..2e90ce4 100644 --- a/arch/arm/mach-shmobile/board-ap4evb.c +++ b/arch/arm/mach-shmobile/board-ap4evb.c @@ -235,6 +235,18 @@ static struct platform_device smc911x_device = { }, }; +/* + * The card detect pin of the top SD/MMC slot (CN7) is active low and is + * connected to GPIO A22 of SH7372 (GPIO_PORT41). + */ +static int slot_cn7_get_cd(struct platform_device *pdev) +{ + if (gpio_is_valid(GPIO_PORT41)) + return !gpio_get_value(GPIO_PORT41); + else + return -ENXIO; +} + /* SH_MMCIF */ static struct resource sh_mmcif_resources[] = { [0] = { @@ -261,6 +273,7 @@ static struct sh_mmcif_plat_data sh_mmcif_plat = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA | MMC_CAP_NEEDS_POLL, + .get_cd = slot_cn7_get_cd, }; static struct platform_device sh_mmcif_device = { @@ -310,6 +323,8 @@ static struct sh_mobile_sdhi_info sdhi1_info = { .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, .tmio_ocr_mask = MMC_VDD_165_195, .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, + .tmio_caps = MMC_CAP_NEEDS_POLL, + .get_cd = slot_cn7_get_cd, }; static struct resource sdhi1_resources[] = { @@ -948,6 +963,10 @@ static void __init ap4evb_init(void) gpio_no_direction(GPIO_PORT9CR); /* FSIAOBT needs no direction */ gpio_no_direction(GPIO_PORT10CR); /* FSIAOLR needs no direction */ + /* card detect pin for MMC slot (CN7) */ + gpio_request(GPIO_PORT41, NULL); + gpio_direction_input(GPIO_PORT41); + /* set SPU2 clock to 119.6 MHz */ clk = clk_get(NULL, "spu_clk"); if (!IS_ERR(clk)) {