1e63fbd7bSEmmanuel Vadot /* 2e63fbd7bSEmmanuel Vadot * Copyright 2019 Emmanuel Vadot <manu@freebsd.org> 3e63fbd7bSEmmanuel Vadot * Copyright (c) 2017 Ian Lepore <ian@freebsd.org> All rights reserved. 4e63fbd7bSEmmanuel Vadot * 5e63fbd7bSEmmanuel Vadot * Redistribution and use in source and binary forms, with or without 6e63fbd7bSEmmanuel Vadot * modification, are permitted provided that the following conditions are 7e63fbd7bSEmmanuel Vadot * met: 8e63fbd7bSEmmanuel Vadot * 9e63fbd7bSEmmanuel Vadot * 1. Redistributions of source code must retain the above copyright 10e63fbd7bSEmmanuel Vadot * notice, this list of conditions and the following disclaimer. 11e63fbd7bSEmmanuel Vadot * 2. Redistributions in binary form must reproduce the above copyright 12e63fbd7bSEmmanuel Vadot * notice, this list of conditions and the following disclaimer in the 13e63fbd7bSEmmanuel Vadot * documentation and/or other materials provided with the distribution. 14e63fbd7bSEmmanuel Vadot * 15e63fbd7bSEmmanuel Vadot * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16e63fbd7bSEmmanuel Vadot * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17e63fbd7bSEmmanuel Vadot * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 18e63fbd7bSEmmanuel Vadot * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE 19e63fbd7bSEmmanuel Vadot * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 20e63fbd7bSEmmanuel Vadot * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 21e63fbd7bSEmmanuel Vadot * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 22e63fbd7bSEmmanuel Vadot * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 23e63fbd7bSEmmanuel Vadot * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 24e63fbd7bSEmmanuel Vadot * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 25e63fbd7bSEmmanuel Vadot * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26e63fbd7bSEmmanuel Vadot */ 27e63fbd7bSEmmanuel Vadot 28e63fbd7bSEmmanuel Vadot #ifndef _MMC_FDT_HELPERS_H_ 29e63fbd7bSEmmanuel Vadot #define _MMC_FDT_HELPERS_H_ 30e63fbd7bSEmmanuel Vadot 31e63fbd7bSEmmanuel Vadot #include <dev/gpio/gpiobusvar.h> 32e63fbd7bSEmmanuel Vadot #include <dev/ofw/ofw_bus.h> 33e63fbd7bSEmmanuel Vadot 34*b2f0caf1SEmmanuel Vadot #include <dev/regulator/regulator.h> 35e63fbd7bSEmmanuel Vadot 368a8166e5SBartlomiej Grzesik #include <dev/mmc/mmc_helpers.h> 37e63fbd7bSEmmanuel Vadot 388a8166e5SBartlomiej Grzesik #define mmc_fdt_helper mmc_helper /* For backwards compatibility */ 39e63fbd7bSEmmanuel Vadot 40e63fbd7bSEmmanuel Vadot typedef void (*mmc_fdt_cd_handler)(device_t dev, bool present); 41e63fbd7bSEmmanuel Vadot 428a8166e5SBartlomiej Grzesik int mmc_fdt_parse(device_t dev, phandle_t node, struct mmc_helper *helper, struct mmc_host *host); 438a8166e5SBartlomiej Grzesik int mmc_fdt_gpio_setup(device_t dev, phandle_t node, struct mmc_helper *helper, mmc_fdt_cd_handler handler); 448a8166e5SBartlomiej Grzesik void mmc_fdt_gpio_teardown(struct mmc_helper *helper); 458a8166e5SBartlomiej Grzesik bool mmc_fdt_gpio_get_present(struct mmc_helper *helper); 468a8166e5SBartlomiej Grzesik bool mmc_fdt_gpio_get_readonly(struct mmc_helper *helper); 478a8166e5SBartlomiej Grzesik void mmc_fdt_set_power(struct mmc_helper *helper, enum mmc_power_mode power_mode); 48e63fbd7bSEmmanuel Vadot 49e63fbd7bSEmmanuel Vadot #endif 50