From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9C4E9C2D0DB for ; Fri, 24 Jan 2020 13:13:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6FE6F206D5 for ; Fri, 24 Jan 2020 13:13:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P6IMwHE8" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389186AbgAXNNO (ORCPT ); Fri, 24 Jan 2020 08:13:14 -0500 Received: from mail-vk1-f193.google.com ([209.85.221.193]:39305 "EHLO mail-vk1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387486AbgAXNNO (ORCPT ); Fri, 24 Jan 2020 08:13:14 -0500 Received: by mail-vk1-f193.google.com with SMTP id t129so509722vkg.6 for ; Fri, 24 Jan 2020 05:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0pCJ51fgs/0G4N/AkTYuiiJRhKjkqBJy/ABL+0E/bFk=; b=P6IMwHE8uT8RMdr1P8rDQpRrJ5PNR4L4H7E0i7DQXVdviFO6LD475vzz1mjKOK1iuK aJERxWGDezcMiHDHs58NUqcgXYF2j4dEMNFJtigubdbAwW7CH95WNAXL9vXEb13GgBPs 00sCtxzu+hBjYlqlOLeDYcXG887pbfo1S0Nmjo47abdHXdfRBJQ/2HfQeO8R2jInTfPp fARl9XjAr32zEKJOQtTZBpNlkVYlB+yb7xrkmvb0YRgdOKav0ImuGbK0XGBLOcZ9YXF/ 2YtVULLz2da5RU43io9ze0nwFBk/FX2ubwO8cG0aRikoB5nDS5N0LxFQvbKWHNVJ+8xr e31Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0pCJ51fgs/0G4N/AkTYuiiJRhKjkqBJy/ABL+0E/bFk=; b=ZvAezFvZYnkZXdM3HGklkm4h2gw/kdgZFLosjQmKEw4f5vflT8kGqscyoa+XDpEJPn glMklLoLBzM91Wm2hgUdQfeaTaWmuo5Kt6Te2P0kN/fVZd7UuoTlyD/NssGCWFj2azXN dRJEPCgoZftKyqi2eEkVRP5X/t0g5Jh6RoCaae06GKOPpzhH9o7RVdjREkLtcsiIaJVq C5BLnVOeycLIaZZEPwJN/rZ/X+bKXNbJMSwybjp+zl8B7tM5OrI8KsyRm8KPNDy9lN77 nSQRy5cFCnFySlluBvsf/po4F4Rtsk6dScKsbcBzK1MF6vs6GeQ/ZqNE+fcG3FsyTyOy /8cQ== X-Gm-Message-State: APjAAAXgGvHdB6Bp6azjKw2Y+aE4ZvOGcmhWTLqA/c81AxhqB56vGTtw uTGMkoS4yNo1IGHaXVfpMdeaNYgcABJzYeNLM2tfFQ== X-Google-Smtp-Source: APXvYqwvweHW+//fi2a64HFcGs84CB60rRh0VyQGFxeZ6xd6bTwXqvSw/Zs/SJ/+x6Yw0TF8Gdlx6/fNzadVplvj68g= X-Received: by 2002:a1f:914b:: with SMTP id t72mr1847120vkd.101.1579871593005; Fri, 24 Jan 2020 05:13:13 -0800 (PST) MIME-Version: 1.0 References: <20200110134823.14882-1-ludovic.barre@st.com> <20200110134823.14882-8-ludovic.barre@st.com> In-Reply-To: <20200110134823.14882-8-ludovic.barre@st.com> From: Ulf Hansson Date: Fri, 24 Jan 2020 14:12:36 +0100 Message-ID: Subject: Re: [PATCH 7/9] mmc: mmci: add volt_switch callbacks To: Ludovic Barre Cc: Rob Herring , Srinivas Kandagatla , Maxime Coquelin , Alexandre Torgue , Linux ARM , Linux Kernel Mailing List , DTML , "linux-mmc@vger.kernel.org" , linux-stm32@st-md-mailman.stormreply.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 10 Jan 2020 at 14:49, Ludovic Barre wrote: > > This patch adds 2 voltage switch callbacks in mmci_host_ops: > -prep_volt_switch allows to prepare voltage switch before to > sent the SD_SWITCH_VOLTAGE command (cmd11). > -volt_switch callback allows to define specific action after > regulator set voltage. I am fine with adding these callbacks, however I strongly suggest to have a reference to "signal voltage" in the name of the callbacks. As to avoid confusion for what there are used for. Perhaps ->post_sig_volt_switch() and ->pre_sig_volt_switch() can work? > > Signed-off-by: Ludovic Barre > --- > drivers/mmc/host/mmci.c | 8 ++++++++ > drivers/mmc/host/mmci.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > index 00b473f57047..d76a59c06cb0 100644 > --- a/drivers/mmc/host/mmci.c > +++ b/drivers/mmc/host/mmci.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1207,6 +1208,9 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) > writel_relaxed(clks, host->base + MMCIDATATIMER); > } > > + if (host->ops->prep_volt_switch && cmd->opcode == SD_SWITCH_VOLTAGE) > + host->ops->prep_volt_switch(host); > + > if (/*interrupt*/0) > c |= MCI_CPSM_INTERRUPT; > > @@ -1820,6 +1824,7 @@ static int mmci_get_cd(struct mmc_host *mmc) > > static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) > { > + struct mmci_host *host = mmc_priv(mmc); > int ret = 0; > > if (!IS_ERR(mmc->supply.vqmmc)) { > @@ -1839,6 +1844,9 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) > break; > } > > + if (!ret && host->ops && host->ops->volt_switch) > + ret = host->ops->volt_switch(host, ios); > + > if (ret) > dev_warn(mmc_dev(mmc), "Voltage switch failed\n"); > } > diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h > index ddcdfb827996..c04a144259a2 100644 > --- a/drivers/mmc/host/mmci.h > +++ b/drivers/mmc/host/mmci.h > @@ -377,6 +377,8 @@ struct mmci_host_ops { > void (*set_clkreg)(struct mmci_host *host, unsigned int desired); > void (*set_pwrreg)(struct mmci_host *host, unsigned int pwr); > bool (*busy_complete)(struct mmci_host *host, u32 status, u32 err_msk); > + void (*prep_volt_switch)(struct mmci_host *host); > + int (*volt_switch)(struct mmci_host *host, struct mmc_ios *ios); > }; > > struct mmci_host { > -- > 2.17.1 > Kind regards Uffe From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 80A3DC32771 for ; Fri, 24 Jan 2020 13:13:18 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3FEFC206D5 for ; Fri, 24 Jan 2020 13:13:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="FpZZQW8X"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="P6IMwHE8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3FEFC206D5 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From: In-Reply-To:References:MIME-Version:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=OAClYRD65coTdYmC38QvaUWot4Tzz69Mn4BFRaNC9Pc=; b=FpZZQW8XVopg8m uVGLUmaO7eZKGeWGEKwVmmdifwpeLrcsqPZ/Kv9CeucAJVRR42UiK/vc5CpDBp8bfZ9lBGKuKbKj8 xOgcrxnXXWTagpOA3ZKcNwqWOg5zmS6KgR2XWCAzKhvKmHBGnm+ceSKJuEyAWd9JDtqeDyZ4Ur+0K 3BxROtEtyVggZHBEDJF12pDDkXW/a6PRhkADugERrxY5E51B1mkrldaPH7FA2RWUzZVx+JHwbtyHk miqdiU7vZbjxH7JidWojFIfWyPzAQjif9KcAdmjUuMYeA6hl6PXCXFUgAxF7MHQCNYx0KfKu2QM2n LjBntCB7d6Rs28lwurFw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1iuylx-0005oc-LV; Fri, 24 Jan 2020 13:13:17 +0000 Received: from mail-vk1-xa43.google.com ([2607:f8b0:4864:20::a43]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1iuylu-0005ns-G9 for linux-arm-kernel@lists.infradead.org; Fri, 24 Jan 2020 13:13:15 +0000 Received: by mail-vk1-xa43.google.com with SMTP id p191so507947vkf.8 for ; Fri, 24 Jan 2020 05:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0pCJ51fgs/0G4N/AkTYuiiJRhKjkqBJy/ABL+0E/bFk=; b=P6IMwHE8uT8RMdr1P8rDQpRrJ5PNR4L4H7E0i7DQXVdviFO6LD475vzz1mjKOK1iuK aJERxWGDezcMiHDHs58NUqcgXYF2j4dEMNFJtigubdbAwW7CH95WNAXL9vXEb13GgBPs 00sCtxzu+hBjYlqlOLeDYcXG887pbfo1S0Nmjo47abdHXdfRBJQ/2HfQeO8R2jInTfPp fARl9XjAr32zEKJOQtTZBpNlkVYlB+yb7xrkmvb0YRgdOKav0ImuGbK0XGBLOcZ9YXF/ 2YtVULLz2da5RU43io9ze0nwFBk/FX2ubwO8cG0aRikoB5nDS5N0LxFQvbKWHNVJ+8xr e31Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0pCJ51fgs/0G4N/AkTYuiiJRhKjkqBJy/ABL+0E/bFk=; b=mkkA6q43G0KopYjRVDuU8m8l+E82GxyULOPLTmmlB5qXxH76nv3WvtXFY4M5lhW0GT 1b9gDoiywsz+gsv2651PGYGbRFyvrP3BM7LYtklCpb8FTOasYpfarz6+d+StSB5HO1Cf tuiU332jJ2tGV22yMUZczKW7hJwhD6m/UrtDcGYH8rMwAKw0JW6UkcFn618EGLVcuhUZ Teo1xobcdGNskt0gX0+3SEElkbU3wkBw+5+RMmiTFBxBIoaSdxqX6djchuXwtXbDdFA/ mhJhvfDdZvyc59MotziJZ1KAI8hQkO1r98ro8UpAapaM21aApgO4gaU/i9vJX7QRBFn/ SMGQ== X-Gm-Message-State: APjAAAWNp/vACzTwuHuv7cW1yKUpC+siVUQqTkmepY9SkgzLbkPwNRnC RtcSAOb1ANk73i7XwtjJOafBAKzUWvIPQj396c0yUg== X-Google-Smtp-Source: APXvYqwvweHW+//fi2a64HFcGs84CB60rRh0VyQGFxeZ6xd6bTwXqvSw/Zs/SJ/+x6Yw0TF8Gdlx6/fNzadVplvj68g= X-Received: by 2002:a1f:914b:: with SMTP id t72mr1847120vkd.101.1579871593005; Fri, 24 Jan 2020 05:13:13 -0800 (PST) MIME-Version: 1.0 References: <20200110134823.14882-1-ludovic.barre@st.com> <20200110134823.14882-8-ludovic.barre@st.com> In-Reply-To: <20200110134823.14882-8-ludovic.barre@st.com> From: Ulf Hansson Date: Fri, 24 Jan 2020 14:12:36 +0100 Message-ID: Subject: Re: [PATCH 7/9] mmc: mmci: add volt_switch callbacks To: Ludovic Barre X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200124_051314_538057_BF6CF819 X-CRM114-Status: GOOD ( 17.23 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: DTML , Alexandre Torgue , "linux-mmc@vger.kernel.org" , Linux Kernel Mailing List , Rob Herring , Srinivas Kandagatla , Maxime Coquelin , linux-stm32@st-md-mailman.stormreply.com, Linux ARM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, 10 Jan 2020 at 14:49, Ludovic Barre wrote: > > This patch adds 2 voltage switch callbacks in mmci_host_ops: > -prep_volt_switch allows to prepare voltage switch before to > sent the SD_SWITCH_VOLTAGE command (cmd11). > -volt_switch callback allows to define specific action after > regulator set voltage. I am fine with adding these callbacks, however I strongly suggest to have a reference to "signal voltage" in the name of the callbacks. As to avoid confusion for what there are used for. Perhaps ->post_sig_volt_switch() and ->pre_sig_volt_switch() can work? > > Signed-off-by: Ludovic Barre > --- > drivers/mmc/host/mmci.c | 8 ++++++++ > drivers/mmc/host/mmci.h | 2 ++ > 2 files changed, 10 insertions(+) > > diff --git a/drivers/mmc/host/mmci.c b/drivers/mmc/host/mmci.c > index 00b473f57047..d76a59c06cb0 100644 > --- a/drivers/mmc/host/mmci.c > +++ b/drivers/mmc/host/mmci.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -1207,6 +1208,9 @@ mmci_start_command(struct mmci_host *host, struct mmc_command *cmd, u32 c) > writel_relaxed(clks, host->base + MMCIDATATIMER); > } > > + if (host->ops->prep_volt_switch && cmd->opcode == SD_SWITCH_VOLTAGE) > + host->ops->prep_volt_switch(host); > + > if (/*interrupt*/0) > c |= MCI_CPSM_INTERRUPT; > > @@ -1820,6 +1824,7 @@ static int mmci_get_cd(struct mmc_host *mmc) > > static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) > { > + struct mmci_host *host = mmc_priv(mmc); > int ret = 0; > > if (!IS_ERR(mmc->supply.vqmmc)) { > @@ -1839,6 +1844,9 @@ static int mmci_sig_volt_switch(struct mmc_host *mmc, struct mmc_ios *ios) > break; > } > > + if (!ret && host->ops && host->ops->volt_switch) > + ret = host->ops->volt_switch(host, ios); > + > if (ret) > dev_warn(mmc_dev(mmc), "Voltage switch failed\n"); > } > diff --git a/drivers/mmc/host/mmci.h b/drivers/mmc/host/mmci.h > index ddcdfb827996..c04a144259a2 100644 > --- a/drivers/mmc/host/mmci.h > +++ b/drivers/mmc/host/mmci.h > @@ -377,6 +377,8 @@ struct mmci_host_ops { > void (*set_clkreg)(struct mmci_host *host, unsigned int desired); > void (*set_pwrreg)(struct mmci_host *host, unsigned int pwr); > bool (*busy_complete)(struct mmci_host *host, u32 status, u32 err_msk); > + void (*prep_volt_switch)(struct mmci_host *host); > + int (*volt_switch)(struct mmci_host *host, struct mmc_ios *ios); > }; > > struct mmci_host { > -- > 2.17.1 > Kind regards Uffe _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel