From: Peng Fan Date: Mon, 11 Apr 2016 13:34:21 +0800 Subject: [U-Boot] [RFC 1/2] mmc: introduce mmc_power_init and pwrup hook function In-Reply-To: References: <1458091947-10397-1-git-send-email-van.freenix@gmail.com> Message-ID: <20160411053419.GB8379@linux-7smt.suse> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Simon, On Sat, Apr 09, 2016 at 12:34:13PM -0600, Simon Glass wrote: >Hi Peng, > >On 15 March 2016 at 19:32, Peng Fan wrote: >> In device tree, there is vmmc-supply property for SD/MMC. >> Introduce mmc_power_init function and pwrup hook function to let >> the specific drivers handle vmmc-supply. >> >> mmc_power_init will first invoke board_mmc_power_init to >> avoid break boards which already implement board_mmc_power_init. >> >> Then if pwrup hook functions have been implemented for different >> mmc drivers, pwrup will be invoked. >> >> Signed-off-by: Peng Fan >> Cc: Pantelis Antoniou >> Cc: Andrew Gabbasov >> Cc: Simon Glass >> Cc: Stephen Warren >> Cc: Clemens Gruber >> Cc: Eric Nelson >> Cc: Stefano Babic >> Cc: Fabio Estevam >> --- >> drivers/mmc/mmc.c | 15 ++++++++++++++- >> include/mmc.h | 1 + >> 2 files changed, 15 insertions(+), 1 deletion(-) > >Acked-by: Simon Glass > >I wonder if there is a way to handle this property generically? Now I do not have a better idea for this (: Or we directly more the following piece code to driver/mmc/mmc.c? And Add a device entry for struct mmc. static int xxx_pwrup(struct mmc *mmc) { #ifdef CONFIG_DM_MMC struct udevice *vmmc_supply; int ret; ret = device_get_supply_regulator(mmc->dev, "vmmc-supply", &vmmc_supply); if (ret) { debug("No vmmc supply\n"); return 0; } ret = regulator_set_enable(vmmc_supply, true); if (ret) { puts("Error enabling VMMC supply\n"); return ret; } #endif return 0; } Thanks, Peng. > >Regards, >Simon