1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #ifndef _SDMMC_CHIP_H_
20 #define _SDMMC_CHIP_H_
21
22 struct sdmmc_command;
23
24 typedef struct sdmmc_chip_functions *sdmmc_chipset_tag_t;
25 typedef void *sdmmc_chipset_handle_t;
26
27 struct sdmmc_chip_functions {
28
29 int (*host_reset)(sdmmc_chipset_handle_t);
30
31 u_int32_t (*host_ocr)(sdmmc_chipset_handle_t);
32 int (*host_maxblklen)(sdmmc_chipset_handle_t);
33
34 int (*card_detect)(sdmmc_chipset_handle_t);
35
36 int (*bus_power)(sdmmc_chipset_handle_t, u_int32_t);
37 int (*bus_clock)(sdmmc_chipset_handle_t, int);
38
39 void (*exec_command)(sdmmc_chipset_handle_t,
40 struct sdmmc_command *);
41
42 void (*card_intr_mask)(sdmmc_chipset_handle_t, int);
43 void (*card_intr_ack)(sdmmc_chipset_handle_t);
44 };
45
46
47 #define sdmmc_chip_host_reset(tag, handle) \
48 ((tag)->host_reset((handle)))
49
50 #define sdmmc_chip_host_ocr(tag, handle) \
51 ((tag)->host_ocr((handle)))
52 #define sdmmc_chip_host_maxblklen(tag, handle) \
53 ((tag)->host_maxblklen((handle)))
54
55 #define sdmmc_chip_card_detect(tag, handle) \
56 ((tag)->card_detect((handle)))
57
58 #define sdmmc_chip_bus_power(tag, handle, ocr) \
59 ((tag)->bus_power((handle), (ocr)))
60 #define sdmmc_chip_bus_clock(tag, handle, freq) \
61 ((tag)->bus_clock((handle), (freq)))
62
63 #define sdmmc_chip_exec_command(tag, handle, cmdp) \
64 ((tag)->exec_command((handle), (cmdp)))
65
66 #define sdmmc_chip_card_intr_mask(tag, handle, enable) \
67 ((tag)->card_intr_mask((handle), (enable)))
68 #define sdmmc_chip_card_intr_ack(tag, handle) \
69 ((tag)->card_intr_ack((handle)))
70
71
72 #define SDMMC_SDCLK_OFF 0
73 #define SDMMC_SDCLK_400KHZ 400
74 #define SDMMC_SDCLK_25MHZ 25000
75
76 struct sdmmcbus_attach_args {
77 const char *saa_busname;
78 sdmmc_chipset_tag_t sct;
79 sdmmc_chipset_handle_t sch;
80 };
81
82 void sdmmc_needs_discover(struct device *);
83 void sdmmc_card_intr(struct device *);
84 void sdmmc_delay(u_int);
85
86 #endif