From patchwork Mon Sep 1 03:35:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gao, Yunpeng" X-Patchwork-Id: 4816011 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 072F9C0338 for ; Mon, 1 Sep 2014 03:34:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D24E2200FF for ; Mon, 1 Sep 2014 03:33:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A64D8200F4 for ; Mon, 1 Sep 2014 03:33:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbaIADdz (ORCPT ); Sun, 31 Aug 2014 23:33:55 -0400 Received: from mga09.intel.com ([134.134.136.24]:6168 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751942AbaIADdy (ORCPT ); Sun, 31 Aug 2014 23:33:54 -0400 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga102.jf.intel.com with ESMTP; 31 Aug 2014 20:27:52 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,439,1406617200"; d="scan'208";a="566384910" Received: from spark-hp-compaq-8000-elite-cmt-pc.bj.intel.com ([172.16.181.71]) by orsmga001.jf.intel.com with ESMTP; 31 Aug 2014 20:33:52 -0700 From: Yunpeng Gao To: linux-mmc@vger.kernel.org Cc: Yunpeng Gao , Chuanxiao Dong Subject: [PATCH v2] mmc: sdhci-acpi: add probe_slot method for emmc/sd/sdio Date: Mon, 1 Sep 2014 11:35:40 +0800 Message-Id: <1409542540-18267-1-git-send-email-yunpeng.gao@intel.com> X-Mailer: git-send-email 1.7.9.5 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-8.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Similar to sdhci-pci controller, also add probe_slot and remove_slot method in the sdhci-acpi driver. This is the v2 version patch and fixed checkpatch errors. Signed-off-by: Yunpeng Gao Signed-off-by: Chuanxiao Dong --- drivers/mmc/host/sdhci-acpi.c | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/drivers/mmc/host/sdhci-acpi.c b/drivers/mmc/host/sdhci-acpi.c index 8ce3c28..0f610e8 100644 --- a/drivers/mmc/host/sdhci-acpi.c +++ b/drivers/mmc/host/sdhci-acpi.c @@ -67,6 +67,8 @@ struct sdhci_acpi_slot { unsigned int caps2; mmc_pm_flag_t pm_caps; unsigned int flags; + int (*probe_slot)(struct platform_device *); + int (*remove_slot)(struct platform_device *); }; struct sdhci_acpi_host { @@ -122,11 +124,57 @@ static const struct sdhci_acpi_chip sdhci_acpi_chip_int = { .ops = &sdhci_acpi_ops_int, }; +static int sdhci_acpi_emmc_probe_slot(struct platform_device *pdev) +{ + struct sdhci_acpi_host *c = platform_get_drvdata(pdev); + struct sdhci_host *host; + + if (!c || !c->host) + return 0; + + host = c->host; + + /* Platform specific code during emmc proble slot goes here */ + + return 0; +} + +static int sdhci_acpi_sdio_probe_slot(struct platform_device *pdev) +{ + struct sdhci_acpi_host *c = platform_get_drvdata(pdev); + struct sdhci_host *host; + + if (!c || !c->host) + return 0; + + host = c->host; + + /* Platform specific code during emmc proble slot goes here */ + + return 0; +} + +static int sdhci_acpi_sd_probe_slot(struct platform_device *pdev) +{ + struct sdhci_acpi_host *c = platform_get_drvdata(pdev); + struct sdhci_host *host; + + if (!c || !c->host || !c->slot) + return 0; + + host = c->host; + + /* Platform specific code during emmc proble slot goes here */ + + return 0; +} + static const struct sdhci_acpi_slot sdhci_acpi_slot_int_emmc = { .chip = &sdhci_acpi_chip_int, .caps = MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE | MMC_CAP_HW_RESET, .caps2 = MMC_CAP2_HC_ERASE_SZ, .flags = SDHCI_ACPI_RUNTIME_PM, + .probe_slot = sdhci_acpi_emmc_probe_slot, }; static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { @@ -135,12 +183,14 @@ static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sdio = { .caps = MMC_CAP_NONREMOVABLE | MMC_CAP_POWER_OFF_CARD, .flags = SDHCI_ACPI_RUNTIME_PM, .pm_caps = MMC_PM_KEEP_POWER, + .probe_slot = sdhci_acpi_sdio_probe_slot, }; static const struct sdhci_acpi_slot sdhci_acpi_slot_int_sd = { .flags = SDHCI_ACPI_SD_CD | SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL | SDHCI_ACPI_RUNTIME_PM, .quirks2 = SDHCI_QUIRK2_CARD_ON_NEEDS_BUS_ON, + .probe_slot = sdhci_acpi_sd_probe_slot, }; struct sdhci_acpi_uid_slot { @@ -275,6 +325,11 @@ static int sdhci_acpi_probe(struct platform_device *pdev) } if (c->slot) { + if (c->slot->probe_slot) { + err = c->slot->probe_slot(pdev); + if (err) + goto err_free; + } if (c->slot->chip) { host->ops = c->slot->chip->ops; host->quirks |= c->slot->chip->quirks; @@ -332,6 +387,9 @@ static int sdhci_acpi_remove(struct platform_device *pdev) pm_runtime_put_noidle(dev); } + if (c->slot && c->slot->remove_slot) + c->slot->remove_slot(pdev); + dead = (sdhci_readl(c->host, SDHCI_INT_STATUS) == ~0); sdhci_remove_host(c->host, dead); sdhci_free_host(c->host);