1*af873fceSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-only */ 23aa8793fSUlf Hansson /* 33aa8793fSUlf Hansson * Copyright (C) 2014 Linaro Ltd 43aa8793fSUlf Hansson * 53aa8793fSUlf Hansson * Author: Ulf Hansson <ulf.hansson@linaro.org> 63aa8793fSUlf Hansson */ 73aa8793fSUlf Hansson #ifndef _MMC_CORE_PWRSEQ_H 83aa8793fSUlf Hansson #define _MMC_CORE_PWRSEQ_H 93aa8793fSUlf Hansson 10066185d6SUlf Hansson #include <linux/types.h> 11066185d6SUlf Hansson 12066185d6SUlf Hansson struct mmc_host; 13066185d6SUlf Hansson struct device; 14066185d6SUlf Hansson struct module; 15d97a1e5dSSrinivas Kandagatla 163aa8793fSUlf Hansson struct mmc_pwrseq_ops { 173aa8793fSUlf Hansson void (*pre_power_on)(struct mmc_host *host); 183aa8793fSUlf Hansson void (*post_power_on)(struct mmc_host *host); 193aa8793fSUlf Hansson void (*power_off)(struct mmc_host *host); 20773a9ef8SUlf Hansson void (*reset)(struct mmc_host *host); 213aa8793fSUlf Hansson }; 223aa8793fSUlf Hansson 233aa8793fSUlf Hansson struct mmc_pwrseq { 24ffedbd22SJulia Lawall const struct mmc_pwrseq_ops *ops; 25d97a1e5dSSrinivas Kandagatla struct device *dev; 26d97a1e5dSSrinivas Kandagatla struct list_head pwrseq_node; 27d97a1e5dSSrinivas Kandagatla struct module *owner; 283aa8793fSUlf Hansson }; 293aa8793fSUlf Hansson 303aa8793fSUlf Hansson #ifdef CONFIG_OF 313aa8793fSUlf Hansson 32d97a1e5dSSrinivas Kandagatla int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq); 33d97a1e5dSSrinivas Kandagatla void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq); 34d97a1e5dSSrinivas Kandagatla 353aa8793fSUlf Hansson int mmc_pwrseq_alloc(struct mmc_host *host); 363aa8793fSUlf Hansson void mmc_pwrseq_pre_power_on(struct mmc_host *host); 373aa8793fSUlf Hansson void mmc_pwrseq_post_power_on(struct mmc_host *host); 383aa8793fSUlf Hansson void mmc_pwrseq_power_off(struct mmc_host *host); 39773a9ef8SUlf Hansson void mmc_pwrseq_reset(struct mmc_host *host); 403aa8793fSUlf Hansson void mmc_pwrseq_free(struct mmc_host *host); 413aa8793fSUlf Hansson 423aa8793fSUlf Hansson #else 433aa8793fSUlf Hansson mmc_pwrseq_register(struct mmc_pwrseq * pwrseq)44d97a1e5dSSrinivas Kandagatlastatic inline int mmc_pwrseq_register(struct mmc_pwrseq *pwrseq) 45d97a1e5dSSrinivas Kandagatla { 46d97a1e5dSSrinivas Kandagatla return -ENOSYS; 47d97a1e5dSSrinivas Kandagatla } mmc_pwrseq_unregister(struct mmc_pwrseq * pwrseq)48d97a1e5dSSrinivas Kandagatlastatic inline void mmc_pwrseq_unregister(struct mmc_pwrseq *pwrseq) {} mmc_pwrseq_alloc(struct mmc_host * host)493aa8793fSUlf Hanssonstatic inline int mmc_pwrseq_alloc(struct mmc_host *host) { return 0; } mmc_pwrseq_pre_power_on(struct mmc_host * host)503aa8793fSUlf Hanssonstatic inline void mmc_pwrseq_pre_power_on(struct mmc_host *host) {} mmc_pwrseq_post_power_on(struct mmc_host * host)513aa8793fSUlf Hanssonstatic inline void mmc_pwrseq_post_power_on(struct mmc_host *host) {} mmc_pwrseq_power_off(struct mmc_host * host)523aa8793fSUlf Hanssonstatic inline void mmc_pwrseq_power_off(struct mmc_host *host) {} mmc_pwrseq_reset(struct mmc_host * host)53773a9ef8SUlf Hanssonstatic inline void mmc_pwrseq_reset(struct mmc_host *host) {} mmc_pwrseq_free(struct mmc_host * host)543aa8793fSUlf Hanssonstatic inline void mmc_pwrseq_free(struct mmc_host *host) {} 553aa8793fSUlf Hansson 563aa8793fSUlf Hansson #endif 573aa8793fSUlf Hansson 583aa8793fSUlf Hansson #endif 59