From patchwork Thu May 5 12:34:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 9024441 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AAD679F30C for ; Thu, 5 May 2016 12:40:10 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 75AD3203A4 for ; Thu, 5 May 2016 12:40:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0EB77203B8 for ; Thu, 5 May 2016 12:40:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757205AbcEEMkE (ORCPT ); Thu, 5 May 2016 08:40:04 -0400 Received: from mailout4.w1.samsung.com ([210.118.77.14]:54521 "EHLO mailout4.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753786AbcEEMe5 (ORCPT ); Thu, 5 May 2016 08:34:57 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout4.w1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0O6P00NFVEY53860@mailout4.w1.samsung.com>; Thu, 05 May 2016 13:34:53 +0100 (BST) X-AuditID: cbfec7f4-f796c6d000001486-31-572b3deddee0 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id D2.B4.05254.DED3B275; Thu, 5 May 2016 13:34:53 +0100 (BST) Received: from AMDC2174.DIGITAL.local ([106.120.53.17]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0O6P00KEEEXN8E00@eusync4.samsung.com>; Thu, 05 May 2016 13:34:53 +0100 (BST) From: Krzysztof Kozlowski To: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mmc@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, Ulf Hansson , Sebastian Reichel , Dmitry Eremin-Solenikov , David Woodhouse , Greg Kroah-Hartman , Mark Brown Cc: tjakobi@math.uni-bielefeld.de, m.szyprowski@samsung.com, hverkuil@xs4all.nl, Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [RFC v2 02/13] power/mmc: Move pwrseq drivers to power/pwrseq Date: Thu, 05 May 2016 14:34:15 +0200 Message-id: <1462451666-17945-3-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1462451666-17945-1-git-send-email-k.kozlowski@samsung.com> References: <1462451666-17945-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsVy+t/xa7pvbbXDDa6v57XYOGM9q8XUh0/Y LCY9ec9sMf/IOVaLiSsnM1s0L17PZnFq8jMmi9cvDC02Pb7GanF51xw2iyP/+xktPvceYbSY cX4fk8WiZa3MFmuP3GW3OL27xKJt9QdWi+Nrwx2EPHbOusvusXmFlsemVZ1sHneu7WHz2D93 DVBoSb3Hv2PsHn1bVjF6fN4k53Hq62f2AK4oLpuU1JzMstQifbsEroybl56wFpz0rfi/v52p gfGQQxcjJ4eEgInE5hkP2SBsMYkL99YD2VwcQgJLGSVO9vSyQDiNTBKb939jBKliEzCW2Lx8 CViViMANZolXOyczgzjMAjsYJf4uu8MCUiUs4CYx78sxJhCbRUBVYvnN72A7eAXcJaZt/soC sU9O4uSxyawgNqeAh8TZX/PBbCGgmkO/pzNOYORdwMiwilE0tTS5oDgpPddQrzgxt7g0L10v OT93EyMk3L/sYFx8zOoQowAHoxIP74H5WuFCrIllxZW5hxglOJiVRHjlgdEixJuSWFmVWpQf X1Sak1p8iFGag0VJnHfurvchQgLpiSWp2ampBalFMFkmDk6pBsbq6d9sJqZuXduyKEbGcZ1E +wb7VldR5wMbuaO8LF+dumEksrOIL05Zcm3/3ZlvnS/u7Lqa//VZt8PH099FWIKjXzvzFsxy O9g/2cIlXOS+f95aEbepT8+y13WrlWfcU9pce9n//nTermvT52mX9AtNW6HUcrzjY62kiEi4 29L7/wV7+xZflVFiKc5INNRiLipOBABBdDpycwIAAA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-9.0 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 The MMC power sequence drivers are useful also outside of MMC world: for USB devices needed a hard-reset before probing. Before extending and re-using pwrseq drivers, move them to a new place. The commit does not introduce significant changes in the pwrseq drivers code so still all the functions are prefixed with "mmc_pwrseq". However the MMC-specific pwrseq functions has to be now exported and everything is hidden not by CONFIG_OF but by new CONFIG_POWER_SEQ option. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Javier Martinez Canillas --- drivers/mmc/Kconfig | 2 -- drivers/mmc/core/Makefile | 3 --- drivers/mmc/core/core.c | 2 +- drivers/mmc/core/host.c | 2 +- drivers/power/Kconfig | 1 + drivers/power/Makefile | 1 + drivers/{mmc/core => power/pwrseq}/Kconfig | 17 ++++++++++++----- drivers/power/pwrseq/Makefile | 3 +++ drivers/{mmc/core => power/pwrseq}/pwrseq.c | 8 ++++++-- drivers/{mmc/core => power/pwrseq}/pwrseq_emmc.c | 3 +-- drivers/{mmc/core => power/pwrseq}/pwrseq_simple.c | 3 +-- {drivers/mmc/core => include/linux}/pwrseq.h | 6 +++--- 12 files changed, 30 insertions(+), 21 deletions(-) rename drivers/{mmc/core => power/pwrseq}/Kconfig (71%) create mode 100644 drivers/power/pwrseq/Makefile rename drivers/{mmc/core => power/pwrseq}/pwrseq.c (90%) rename drivers/{mmc/core => power/pwrseq}/pwrseq_emmc.c (99%) rename drivers/{mmc/core => power/pwrseq}/pwrseq_simple.c (99%) rename {drivers/mmc/core => include/linux}/pwrseq.h (94%) diff --git a/drivers/mmc/Kconfig b/drivers/mmc/Kconfig index f2eeb38efa65..7ade379e0634 100644 --- a/drivers/mmc/Kconfig +++ b/drivers/mmc/Kconfig @@ -21,8 +21,6 @@ config MMC_DEBUG if MMC -source "drivers/mmc/core/Kconfig" - source "drivers/mmc/card/Kconfig" source "drivers/mmc/host/Kconfig" diff --git a/drivers/mmc/core/Makefile b/drivers/mmc/core/Makefile index f007151dfdc6..a901d3cd09d3 100644 --- a/drivers/mmc/core/Makefile +++ b/drivers/mmc/core/Makefile @@ -8,7 +8,4 @@ mmc_core-y := core.o bus.o host.o \ sdio.o sdio_ops.o sdio_bus.o \ sdio_cis.o sdio_io.o sdio_irq.o \ quirks.o slot-gpio.o -mmc_core-$(CONFIG_OF) += pwrseq.o -obj-$(CONFIG_PWRSEQ_SIMPLE) += pwrseq_simple.o -obj-$(CONFIG_PWRSEQ_EMMC) += pwrseq_emmc.o mmc_core-$(CONFIG_DEBUG_FS) += debugfs.o diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 99275e40bf2f..0f145ff6e4f1 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -43,7 +44,6 @@ #include "bus.h" #include "host.h" #include "sdio_bus.h" -#include "pwrseq.h" #include "mmc_ops.h" #include "sd_ops.h" diff --git a/drivers/mmc/core/host.c b/drivers/mmc/core/host.c index e0a3ee16c0d3..98164a352dfb 100644 --- a/drivers/mmc/core/host.c +++ b/drivers/mmc/core/host.c @@ -21,6 +21,7 @@ #include #include #include +#include #include #include @@ -29,7 +30,6 @@ #include "core.h" #include "host.h" #include "slot-gpio.h" -#include "pwrseq.h" #define cls_dev_to_mmc_host(d) container_of(d, struct mmc_host, class_dev) diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 421770ddafa3..2702aca6cd2c 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig @@ -511,5 +511,6 @@ config AXP20X_POWER endif # POWER_SUPPLY +source "drivers/power/pwrseq/Kconfig" source "drivers/power/reset/Kconfig" source "drivers/power/avs/Kconfig" diff --git a/drivers/power/Makefile b/drivers/power/Makefile index e46b75d448a5..02f9d5da2e76 100644 --- a/drivers/power/Makefile +++ b/drivers/power/Makefile @@ -71,6 +71,7 @@ obj-$(CONFIG_POWER_AVS) += avs/ obj-$(CONFIG_CHARGER_SMB347) += smb347-charger.o obj-$(CONFIG_CHARGER_TPS65090) += tps65090-charger.o obj-$(CONFIG_CHARGER_TPS65217) += tps65217_charger.o +obj-$(CONFIG_POWER_SEQ) += pwrseq/ obj-$(CONFIG_POWER_RESET) += reset/ obj-$(CONFIG_AXP288_FUEL_GAUGE) += axp288_fuel_gauge.o obj-$(CONFIG_AXP288_CHARGER) += axp288_charger.o diff --git a/drivers/mmc/core/Kconfig b/drivers/power/pwrseq/Kconfig similarity index 71% rename from drivers/mmc/core/Kconfig rename to drivers/power/pwrseq/Kconfig index 250f223aaa80..b5d2d6c65f28 100644 --- a/drivers/mmc/core/Kconfig +++ b/drivers/power/pwrseq/Kconfig @@ -1,7 +1,12 @@ -# -# MMC core configuration -# -config PWRSEQ_EMMC +menuconfig POWER_SEQ + default y if OF + bool "Hardware reset support for specific devices" + help + Provides drivers which reset the specific device before... + +if POWER_SEQ + +config POWER_SEQ_EMMC tristate "HW reset support for eMMC" default y depends on OF @@ -12,7 +17,7 @@ config PWRSEQ_EMMC This driver can also be built as a module. If so, the module will be called pwrseq_emmc. -config PWRSEQ_SIMPLE +config POWER_SEQ_SIMPLE tristate "Simple HW reset support for MMC" default y depends on OF @@ -22,3 +27,5 @@ config PWRSEQ_SIMPLE This driver can also be built as a module. If so, the module will be called pwrseq_simple. + +endif diff --git a/drivers/power/pwrseq/Makefile b/drivers/power/pwrseq/Makefile new file mode 100644 index 000000000000..9e40e4b9068b --- /dev/null +++ b/drivers/power/pwrseq/Makefile @@ -0,0 +1,3 @@ +obj-$(CONFIG_POWER_SEQ) += pwrseq.o +obj-$(CONFIG_POWER_SEQ_SIMPLE) += pwrseq_simple.o +obj-$(CONFIG_POWER_SEQ_EMMC) += pwrseq_emmc.o diff --git a/drivers/mmc/core/pwrseq.c b/drivers/power/pwrseq/pwrseq.c similarity index 90% rename from drivers/mmc/core/pwrseq.c rename to drivers/power/pwrseq/pwrseq.c index 9386c4771814..66310d7643cc 100644 --- a/drivers/mmc/core/pwrseq.c +++ b/drivers/power/pwrseq/pwrseq.c @@ -11,11 +11,10 @@ #include #include #include +#include #include -#include "pwrseq.h" - static DEFINE_MUTEX(pwrseq_list_mutex); static LIST_HEAD(pwrseq_list); @@ -51,6 +50,7 @@ int mmc_pwrseq_alloc(struct mmc_host *host) return 0; } +EXPORT_SYMBOL_GPL(mmc_pwrseq_alloc); void mmc_pwrseq_pre_power_on(struct mmc_host *host) { @@ -59,6 +59,7 @@ void mmc_pwrseq_pre_power_on(struct mmc_host *host) if (pwrseq && pwrseq->ops->pre_power_on) pwrseq->ops->pre_power_on(host); } +EXPORT_SYMBOL_GPL(mmc_pwrseq_pre_power_on); void mmc_pwrseq_post_power_on(struct mmc_host *host) { @@ -67,6 +68,7 @@ void mmc_pwrseq_post_power_on(struct mmc_host *host) if (pwrseq && pwrseq->ops->post_power_on) pwrseq->ops->post_power_on(host); } +EXPORT_SYMBOL_GPL(mmc_pwrseq_post_power_on); void mmc_pwrseq_power_off(struct mmc_host *host) { @@ -75,6 +77,7 @@ void mmc_pwrseq_power_off(struct mmc_host *host) if (pwrseq && pwrseq->ops->power_off) pwrseq->ops->power_off(host); } +EXPORT_SYMBOL_GPL(mmc_pwrseq_power_off); void mmc_pwrseq_free(struct mmc_host *host) { @@ -85,6 +88,7 @@ void mmc_pwrseq_free(struct mmc_host *host) host->pwrseq = NULL; } } +EXPORT_SYMBOL_GPL(mmc_pwrseq_free); int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) { diff --git a/drivers/mmc/core/pwrseq_emmc.c b/drivers/power/pwrseq/pwrseq_emmc.c similarity index 99% rename from drivers/mmc/core/pwrseq_emmc.c rename to drivers/power/pwrseq/pwrseq_emmc.c index adc9c0c614fb..a0583ed46d7f 100644 --- a/drivers/mmc/core/pwrseq_emmc.c +++ b/drivers/power/pwrseq/pwrseq_emmc.c @@ -17,11 +17,10 @@ #include #include #include +#include #include -#include "pwrseq.h" - struct mmc_pwrseq_emmc { struct mmc_pwrseq pwrseq; struct notifier_block reset_nb; diff --git a/drivers/mmc/core/pwrseq_simple.c b/drivers/power/pwrseq/pwrseq_simple.c similarity index 99% rename from drivers/mmc/core/pwrseq_simple.c rename to drivers/power/pwrseq/pwrseq_simple.c index 450d907c6e6c..786f1db53a3f 100644 --- a/drivers/mmc/core/pwrseq_simple.c +++ b/drivers/power/pwrseq/pwrseq_simple.c @@ -16,11 +16,10 @@ #include #include #include +#include #include -#include "pwrseq.h" - struct mmc_pwrseq_simple { struct mmc_pwrseq pwrseq; bool clk_enabled; diff --git a/drivers/mmc/core/pwrseq.h b/include/linux/pwrseq.h similarity index 94% rename from drivers/mmc/core/pwrseq.h rename to include/linux/pwrseq.h index d69e751f148b..e230670c1d8d 100644 --- a/drivers/mmc/core/pwrseq.h +++ b/include/linux/pwrseq.h @@ -23,7 +23,7 @@ struct mmc_pwrseq { struct module *owner; }; -#ifdef CONFIG_OF +#ifdef CONFIG_POWER_SEQ int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq); void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); @@ -34,7 +34,7 @@ void mmc_pwrseq_post_power_on(struct mmc_host *host); void mmc_pwrseq_power_off(struct mmc_host *host); void mmc_pwrseq_free(struct mmc_host *host); -#else +#else /* CONFIG_POWER_SEQ */ static inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) { @@ -47,6 +47,6 @@ static inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} static inline void mmc_pwrseq_power_off(struct mmc_host *host) {} static inline void mmc_pwrseq_free(struct mmc_host *host) {} -#endif +#endif /* CONFIG_POWER_SEQ */ #endif