xref: /openbsd-src/sys/dev/sdmmc/sdhcvar.h (revision 834ff46cdc127050471ec5871d62421e559b5881)
1*834ff46cSdlg /*	$OpenBSD: sdhcvar.h,v 1.17 2023/04/19 02:01:02 dlg Exp $	*/
2aae4fe77Suwe 
3aae4fe77Suwe /*
4aae4fe77Suwe  * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org>
5aae4fe77Suwe  *
6aae4fe77Suwe  * Permission to use, copy, modify, and distribute this software for any
7aae4fe77Suwe  * purpose with or without fee is hereby granted, provided that the above
8aae4fe77Suwe  * copyright notice and this permission notice appear in all copies.
9aae4fe77Suwe  *
10aae4fe77Suwe  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11aae4fe77Suwe  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12aae4fe77Suwe  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13aae4fe77Suwe  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14aae4fe77Suwe  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15aae4fe77Suwe  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16aae4fe77Suwe  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17aae4fe77Suwe  */
18aae4fe77Suwe 
19aae4fe77Suwe #ifndef _SDHCVAR_H_
20aae4fe77Suwe #define _SDHCVAR_H_
21aae4fe77Suwe 
22aae4fe77Suwe #include <machine/bus.h>
23aae4fe77Suwe 
24aae4fe77Suwe struct sdhc_host;
25aae4fe77Suwe 
26aae4fe77Suwe struct sdhc_softc {
27aae4fe77Suwe 	struct device sc_dev;
2881aa4bdcSfgsch 	struct sdhc_host **sc_host;
29aae4fe77Suwe 	int sc_nhosts;
30b9e2e1baSjsg 	u_int sc_flags;
317b2b2895Skettenis 	u_int sc_clkbase;
3288a093b3Skettenis 
33c6293583Skettenis 	bus_dma_tag_t sc_dmat;
34*834ff46cSdlg 	bus_size_t sc_dma_boundary;
35c6293583Skettenis 
36fa1cdcb1Spatrick 	void (*sc_bus_clock_pre)(struct sdhc_softc *, int, int);
37fa1cdcb1Spatrick 	void (*sc_bus_clock_post)(struct sdhc_softc *, int, int);
3888a093b3Skettenis 	int (*sc_card_detect)(struct sdhc_softc *);
39c2deed7fSkettenis 	int (*sc_signal_voltage)(struct sdhc_softc *, int);
40aae4fe77Suwe };
41aae4fe77Suwe 
42aae4fe77Suwe /* Host controller functions called by the attachment driver. */
43aae4fe77Suwe int	sdhc_host_found(struct sdhc_softc *, bus_space_tag_t,
44bfa5fdb5Spatrick 	    bus_space_handle_t, bus_size_t, int, uint64_t, uint64_t);
452c6678e4Sderaadt int	sdhc_activate(struct device *, int);
46aae4fe77Suwe void	sdhc_shutdown(void *);
47aae4fe77Suwe int	sdhc_intr(void *);
48aae4fe77Suwe 
49c6076839Skettenis void	sdhc_needs_discover(struct sdhc_softc *);
50c6076839Skettenis 
51b9e2e1baSjsg /* flag values */
52b9e2e1baSjsg #define SDHC_F_NOPWR0		(1 << 0)
53bfa5fdb5Spatrick #define SDHC_F_NONREMOVABLE	(1 << 1)
54bfa5fdb5Spatrick #define SDHC_F_32BIT_ACCESS	(1 << 2)
55bfa5fdb5Spatrick #define SDHC_F_NO_HS_BIT	(1 << 3)
56b9e2e1baSjsg 
57aae4fe77Suwe #endif
58