From patchwork Thu Jun 26 06:23:27 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Yang X-Patchwork-Id: 4425871 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 6C8D4BEEAA for ; Thu, 26 Jun 2014 06:23:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 835EE2038C for ; Thu, 26 Jun 2014 06:23:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 386D320379 for ; Thu, 26 Jun 2014 06:23:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754299AbaFZGXo (ORCPT ); Thu, 26 Jun 2014 02:23:44 -0400 Received: from mail-pd0-f182.google.com ([209.85.192.182]:35804 "EHLO mail-pd0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753060AbaFZGXn (ORCPT ); Thu, 26 Jun 2014 02:23:43 -0400 Received: by mail-pd0-f182.google.com with SMTP id y13so2613075pdi.41 for ; Wed, 25 Jun 2014 23:23:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=13pVd4iVq9NtwoQHLs3Hmni+rc1GABwPD4ZdvSG0ctE=; b=UrJUxgNvqErFyA8d0pH5FdpyABDmRfAidaPLROyj03aViGKAIgKJ7qUIrpU6K35/D0 izfRv9NU71xIni0UGtjNtbVQkllrVoKGp5DDszRl7Ez3FCnep+ZYx0qfJSb2jkwd8QHq IWXv8J42/folynloi4njdk3hsHLhLTTXQw48IByY9RtESeS6eKklcXB9nrTkg1NSoLxm H+h5cnr5mwLhnaTbHQ7cXH1mPr6BN0ETRWmIl1gU6Soy6PCe38HU/HwWFNKQNJeAR2j7 SKrFn6RfsrhfuRbXVCAvJpxnmthb2cPFFbM09j66GlV/Uoc5Q0ohwcie2K80lirjmhkz ZIYA== X-Received: by 10.68.231.196 with SMTP id ti4mr18707575pbc.48.1403763823067; Wed, 25 Jun 2014 23:23:43 -0700 (PDT) Received: from localhost.localdomain ([124.219.7.128]) by mx.google.com with ESMTPSA id gi1sm8217238pbd.15.2014.06.25.23.23.40 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 23:23:42 -0700 (PDT) From: Vincent Yang X-Google-Original-From: Vincent Yang To: chris@printf.net, linux-mmc@vger.kernel.org Cc: devicetree@vger.kernel.org, anton@enomsg.org, linuxppc-dev@lists.ozlabs.org, patches@linaro.org, andy.green@linaro.org, jaswinder.singh@linaro.org, Vincent.Yang@tw.fujitsu.com Subject: [RFC PATCH v2 1/6] mmc: sdhci: add quirk for voltage switch callback Date: Thu, 26 Jun 2014 14:23:27 +0800 Message-Id: <1403763812-5495-2-git-send-email-Vincent.Yang@tw.fujitsu.com> X-Mailer: git-send-email 1.9.0 In-Reply-To: <1403763812-5495-1-git-send-email-Vincent.Yang@tw.fujitsu.com> References: <1403763812-5495-1-git-send-email-Vincent.Yang@tw.fujitsu.com> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham 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 This patch defines a quirk to do a callback when switching voltages so do controller-specific actions. It is a preparation and will be used by Fujitsu SDHCI controller f_sdh30 driver. Signed-off-by: Vincent Yang --- drivers/mmc/host/sdhci.c | 5 +++++ drivers/mmc/host/sdhci.h | 1 + include/linux/mmc/sdhci.h | 2 ++ 3 files changed, 8 insertions(+) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 47055f3..d62262b 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1763,6 +1763,11 @@ static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host, ctrl |= SDHCI_CTRL_VDD_180; sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); + /* Some controller need to do more when switching */ + if ((host->quirks2 & SDHCI_QUIRK2_VOLTAGE_SWITCH) && + host->ops->voltage_switch) + host->ops->voltage_switch(host); + /* Wait for 5ms */ usleep_range(5000, 5500); diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 4a5cd5e..63c7a46 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -292,6 +292,7 @@ struct sdhci_ops { void (*adma_workaround)(struct sdhci_host *host, u32 intmask); void (*platform_init)(struct sdhci_host *host); void (*card_event)(struct sdhci_host *host); + void (*voltage_switch)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 08abe99..5433f04 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -98,6 +98,8 @@ struct sdhci_host { #define SDHCI_QUIRK2_BROKEN_HS200 (1<<6) /* Controller does not support DDR50 */ #define SDHCI_QUIRK2_BROKEN_DDR50 (1<<7) +/* Do a callback when switching voltages so do controller-specific actions */ +#define SDHCI_QUIRK2_VOLTAGE_SWITCH (1<<8) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */