From patchwork Fri Mar 29 21:05:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 2366671 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 865A43FD40 for ; Fri, 29 Mar 2013 21:05:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757051Ab3C2VF4 (ORCPT ); Fri, 29 Mar 2013 17:05:56 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:61990 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756872Ab3C2VF4 (ORCPT ); Fri, 29 Mar 2013 17:05:56 -0400 Received: from axis700.grange (dslb-178-001-229-203.pools.arcor-ip.net [178.1.229.203]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0MITil-1UMWNR0YhT-00493f; Fri, 29 Mar 2013 22:05:54 +0100 Received: from 6a.grange (6a.grange [192.168.1.11]) by axis700.grange (Postfix) with ESMTPS id BC1BC40BB6; Fri, 29 Mar 2013 22:05:53 +0100 (CET) Received: from lyakh by 6a.grange with local (Exim 4.72) (envelope-from ) id 1ULgUi-0001Fl-FL; Fri, 29 Mar 2013 22:05:52 +0100 From: Guennadi Liakhovetski To: linux-sh@vger.kernel.org Cc: Simon Horman , Magnus Damm , Laurent Pinchart , Guennadi Liakhovetski Subject: [PATCH v3 3/5] ARM: shmobile: mackerel: switch SDHI and MMCIF interfaces to slot-gpio Date: Fri, 29 Mar 2013 22:05:50 +0100 Message-Id: <1364591152-4780-4-git-send-email-g.liakhovetski@gmx.de> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1364591152-4780-1-git-send-email-g.liakhovetski@gmx.de> References: <1364591152-4780-1-git-send-email-g.liakhovetski@gmx.de> X-Provags-ID: V02:K0:KczKcnLXXSVKRzC8h0GgXccw8BdlWRrHV6WiaebOYme hkFOjrjQ4QQ1RInrRbEuK1wiytQliBkTXEa84eVWFBW2APFCxj ffVJfsStoGjVdzaiYV9sztHXfCLFyLiRwjec0REAoD9x8V/3Vt /5idfccojh+zTWQazQQcfZaDwsEBoh68kG3Snd5EE/T64Hqw0i E09bA9i6Q4Uxh8b1s1KP2LSl5baLF2O7HV3kJjPMGknoysa5o7 PpP3+fL4jhGsQBgwaxG4+Geuyjs1XqtHADQSMyB0BXJ5ES2sBb l07KYQ+w/k/NOyQ5S8uc7TQ0/3xlPzGV6Oz4qIDiJRURSR3BDy UvEHPcjf7PkvPsSNpHXzO/8RB1iR0rA7yb5hOyww9amk+SgS6/ A0Xv5Vfrm8qeQ== Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Both SDHI and MMCIF drivers can use the standard slot-gpio card-detection functions. Switch mackerel to using them instead of platform callbacks. Signed-off-by: Guennadi Liakhovetski --- arch/arm/mach-shmobile/board-mackerel.c | 39 +++++++++--------------------- 1 files changed, 12 insertions(+), 27 deletions(-) diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c index 734565d..a47a1116 100644 --- a/arch/arm/mach-shmobile/board-mackerel.c +++ b/arch/arm/mach-shmobile/board-mackerel.c @@ -963,15 +963,6 @@ static struct platform_device nand_flash_device = { }, }; -/* - * The card detect pin of the top SD/MMC slot (CN7) is active low and is - * connected to GPIO A22 of SH7372 (GPIO 41). - */ -static int slot_cn7_get_cd(struct platform_device *pdev) -{ - return !gpio_get_value(41); -} - /* SDHI0 */ static struct sh_mobile_sdhi_info sdhi0_info = { .dma_slave_tx = SHDMA_SLAVE_SDHI0_TX, @@ -1011,13 +1002,15 @@ static struct platform_device sdhi0_device = { #if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE) /* SDHI1 */ + +/* GPIO 41 can trigger IRQ8, but it is used by USBHS1, we have to poll */ static struct sh_mobile_sdhi_info sdhi1_info = { .dma_slave_tx = SHDMA_SLAVE_SDHI1_TX, .dma_slave_rx = SHDMA_SLAVE_SDHI1_RX, - .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, + .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD, .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_NEEDS_POLL, - .get_cd = slot_cn7_get_cd, + .cd_gpio = 41, }; static struct resource sdhi1_resources[] = { @@ -1052,23 +1045,19 @@ static struct platform_device sdhi1_device = { }; #endif +/* SDHI2 */ + /* * The card detect pin of the top SD/MMC slot (CN23) is active low and is - * connected to GPIO SCIFB_SCK of SH7372 (162). + * connected to GPIO SCIFB_SCK of SH7372 (GPIO 162). */ -static int slot_cn23_get_cd(struct platform_device *pdev) -{ - return !gpio_get_value(162); -} - -/* SDHI2 */ static struct sh_mobile_sdhi_info sdhi2_info = { .dma_slave_tx = SHDMA_SLAVE_SDHI2_TX, .dma_slave_rx = SHDMA_SLAVE_SDHI2_RX, - .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE, + .tmio_flags = TMIO_MMC_WRPROTECT_DISABLE | TMIO_MMC_USE_GPIO_CD, .tmio_caps = MMC_CAP_SD_HIGHSPEED | MMC_CAP_SDIO_IRQ | MMC_CAP_NEEDS_POLL, - .get_cd = slot_cn23_get_cd, + .cd_gpio = 162, }; static struct resource sdhi2_resources[] = { @@ -1127,7 +1116,9 @@ 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, + .use_cd_gpio = true, + /* card detect pin for SD/MMC slot (CN7) */ + .cd_gpio = 41, .slave_id_tx = SHDMA_SLAVE_MMCIF_TX, .slave_id_rx = SHDMA_SLAVE_MMCIF_RX, }; @@ -1475,12 +1466,6 @@ static void __init mackerel_init(void) /* SDHI0 PORT172 card-detect IRQ26 */ gpio_request(GPIO_FN_IRQ26_172, NULL); - /* card detect pin for MMC slot (CN7) */ - gpio_request_one(41, GPIOF_IN, NULL); - - /* card detect pin for microSD slot (CN23) */ - gpio_request_one(162, GPIOF_IN, NULL); - /* FLCTL */ gpio_request(GPIO_FN_D0_NAF0, NULL); gpio_request(GPIO_FN_D1_NAF1, NULL);