#ifndef _SDMMC_CHIP_H_
#define _SDMMC_CHIP_H_
#include <machine/bus.h>
struct sdmmc_command;
typedef struct sdmmc_chip_functions *sdmmc_chipset_tag_t;
typedef void *sdmmc_chipset_handle_t;
struct sdmmc_chip_functions {
int (*host_reset)(sdmmc_chipset_handle_t);
u_int32_t (*host_ocr)(sdmmc_chipset_handle_t);
int (*host_maxblklen)(sdmmc_chipset_handle_t);
int (*card_detect)(sdmmc_chipset_handle_t);
int (*bus_power)(sdmmc_chipset_handle_t, u_int32_t);
int (*bus_clock)(sdmmc_chipset_handle_t, int, int);
int (*bus_width)(sdmmc_chipset_handle_t, int);
void (*exec_command)(sdmmc_chipset_handle_t,
struct sdmmc_command *);
void (*card_intr_mask)(sdmmc_chipset_handle_t, int);
void (*card_intr_ack)(sdmmc_chipset_handle_t);
int (*signal_voltage)(sdmmc_chipset_handle_t, int);
int (*execute_tuning)(sdmmc_chipset_handle_t, int);
int (*hibernate_init)(sdmmc_chipset_handle_t, void *);
};
#define sdmmc_chip_host_reset(tag, handle) \
((tag)->host_reset((handle)))
#define sdmmc_chip_host_ocr(tag, handle) \
((tag)->host_ocr((handle)))
#define sdmmc_chip_host_maxblklen(tag, handle) \
((tag)->host_maxblklen((handle)))
#define sdmmc_chip_card_detect(tag, handle) \
((tag)->card_detect((handle)))
#define sdmmc_chip_bus_power(tag, handle, ocr) \
((tag)->bus_power((handle), (ocr)))
#define sdmmc_chip_bus_clock(tag, handle, freq, timing) \
((tag)->bus_clock((handle), (freq), (timing)))
#define sdmmc_chip_bus_width(tag, handle, width) \
((tag)->bus_width((handle), (width)))
#define sdmmc_chip_exec_command(tag, handle, cmdp) \
((tag)->exec_command((handle), (cmdp)))
#define sdmmc_chip_card_intr_mask(tag, handle, enable) \
((tag)->card_intr_mask((handle), (enable)))
#define sdmmc_chip_card_intr_ack(tag, handle) \
((tag)->card_intr_ack((handle)))
#define sdmmc_chip_signal_voltage(tag, handle, voltage) \
((tag)->signal_voltage((handle), (voltage)))
#define sdmmc_chip_execute_tuning(tag, handle, timing) \
((tag)->execute_tuning((handle), (timing)))
#define SDMMC_SDCLK_OFF 0
#define SDMMC_SDCLK_400KHZ 400
#define SDMMC_SDCLK_25MHZ 25000
#define SDMMC_SDCLK_50MHZ 50000
#define SDMMC_SIGNAL_VOLTAGE_330 0
#define SDMMC_SIGNAL_VOLTAGE_180 1
#define SDMMC_TIMING_LEGACY 0
#define SDMMC_TIMING_HIGHSPEED 1
#define SDMMC_TIMING_UHS_SDR50 2
#define SDMMC_TIMING_UHS_SDR104 3
#define SDMMC_TIMING_MMC_DDR52 4
#define SDMMC_TIMING_MMC_HS200 5
#define SDMMC_MAX_FUNCTIONS 8
struct sdmmcbus_attach_args {
const char *saa_busname;
sdmmc_chipset_tag_t sct;
sdmmc_chipset_handle_t sch;
bus_dma_tag_t dmat;
bus_dmamap_t dmap;
int flags;
int caps;
long max_seg;
long max_xfer;
bus_size_t dma_boundary;
void *cookies[SDMMC_MAX_FUNCTIONS];
};
void sdmmc_needs_discover(struct device *);
void sdmmc_card_intr(struct device *);
void sdmmc_delay(u_int);
#endif