similarity index 100%
rename from Documentation/devicetree/bindings/mmc/mmc-pwrseq-emmc.txt
rename to Documentation/devicetree/bindings/power/pwrseq/pwrseq-emmc.txt
similarity index 100%
rename from Documentation/devicetree/bindings/mmc/mmc-pwrseq-simple.txt
rename to Documentation/devicetree/bindings/power/pwrseq/pwrseq-simple.txt
@@ -21,8 +21,6 @@ config MMC_DEBUG
if MMC
-source "drivers/mmc/core/Kconfig"
-
source "drivers/mmc/card/Kconfig"
source "drivers/mmc/host/Kconfig"
@@ -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
@@ -25,6 +25,7 @@
#include <linux/pm_runtime.h>
#include <linux/pm_wakeup.h>
#include <linux/suspend.h>
+#include <linux/pwrseq.h>
#include <linux/fault-inject.h>
#include <linux/random.h>
#include <linux/slab.h>
@@ -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"
@@ -21,6 +21,7 @@
#include <linux/export.h>
#include <linux/leds.h>
#include <linux/slab.h>
+#include <linux/pwrseq.h>
#include <linux/mmc/host.h>
#include <linux/mmc/card.h>
@@ -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)
@@ -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"
@@ -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
similarity index 66%
rename from drivers/mmc/core/Kconfig
rename to drivers/power/pwrseq/Kconfig
@@ -1,7 +1,13 @@
-#
-# MMC core configuration
-#
-config PWRSEQ_EMMC
+menuconfig POWER_SEQ
+ default y if OF
+ bool "Hardware reset support for specific devices"
+ help
+ Provides drivers that implements specific power sequences for chips,
+ using the generic power sequence management interface.
+
+if POWER_SEQ
+
+config POWER_SEQ_EMMC
tristate "HW reset support for eMMC"
default y
depends on OF
@@ -12,7 +18,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 +28,5 @@ config PWRSEQ_SIMPLE
This driver can also be built as a module. If so, the module
will be called pwrseq_simple.
+
+endif
new file mode 100644
@@ -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
similarity index 90%
rename from drivers/mmc/core/pwrseq.c
rename to drivers/power/pwrseq/pwrseq.c
@@ -11,11 +11,10 @@
#include <linux/err.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/pwrseq.h>
#include <linux/mmc/host.h>
-#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)
{
similarity index 99%
rename from drivers/mmc/core/pwrseq_emmc.c
rename to drivers/power/pwrseq/pwrseq_emmc.c
@@ -17,11 +17,10 @@
#include <linux/err.h>
#include <linux/gpio/consumer.h>
#include <linux/reboot.h>
+#include <linux/pwrseq.h>
#include <linux/mmc/host.h>
-#include "pwrseq.h"
-
struct mmc_pwrseq_emmc {
struct mmc_pwrseq pwrseq;
struct notifier_block reset_nb;
similarity index 99%
rename from drivers/mmc/core/pwrseq_simple.c
rename to drivers/power/pwrseq/pwrseq_simple.c
@@ -16,11 +16,10 @@
#include <linux/device.h>
#include <linux/err.h>
#include <linux/gpio/consumer.h>
+#include <linux/pwrseq.h>
#include <linux/mmc/host.h>
-#include "pwrseq.h"
-
struct mmc_pwrseq_simple {
struct mmc_pwrseq pwrseq;
bool clk_enabled;
similarity index 94%
rename from drivers/mmc/core/pwrseq.h
rename to 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