diff options
author | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-08-09 13:52:37 +0000 |
---|---|---|
committer | Patrick Wildt <patrick@cvs.openbsd.org> | 2018-08-09 13:52:37 +0000 |
commit | 920a2da943326c3d49e810751e691ecba806b367 (patch) | |
tree | 732de48e3247817bb9c3f4d383bc1a1d3a03b020 /sys | |
parent | bb821f078382ab811a3a69388b804a3480157791 (diff) |
Allow passing per-function cookies through the SD/MMC bus to SDIO
devices. This allows SDIO device drivers to read information from
the ACPI or FDT tables.
ok kettenis@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/sdmmc/sdmmc.c | 3 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmc_io.c | 3 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmcchip.h | 5 | ||||
-rw-r--r-- | sys/dev/sdmmc/sdmmcvar.h | 4 |
4 files changed, 11 insertions, 4 deletions
diff --git a/sys/dev/sdmmc/sdmmc.c b/sys/dev/sdmmc/sdmmc.c index 7a7fc01389e..87328f0bc47 100644 --- a/sys/dev/sdmmc/sdmmc.c +++ b/sys/dev/sdmmc/sdmmc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc.c,v 1.50 2018/03/20 04:18:40 jmatthew Exp $ */ +/* $OpenBSD: sdmmc.c,v 1.51 2018/08/09 13:52:36 patrick Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -119,6 +119,7 @@ sdmmc_attach(struct device *parent, struct device *self, void *aux) sc->sc_flags = saa->flags; sc->sc_caps = saa->caps; sc->sc_max_xfer = saa->max_xfer; + memcpy(&sc->sc_cookies, &saa->cookies, sizeof(sc->sc_cookies)); if (ISSET(sc->sc_caps, SMC_CAPS_DMA) && sc->sc_dmap == NULL) { error = bus_dmamap_create(sc->sc_dmat, MAXPHYS, SDMMC_MAXNSEGS, diff --git a/sys/dev/sdmmc/sdmmc_io.c b/sys/dev/sdmmc/sdmmc_io.c index 88d011677cb..157f40e6d68 100644 --- a/sys/dev/sdmmc/sdmmc_io.c +++ b/sys/dev/sdmmc/sdmmc_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmc_io.c,v 1.39 2018/06/17 17:10:17 patrick Exp $ */ +/* $OpenBSD: sdmmc_io.c,v 1.40 2018/08/09 13:52:36 patrick Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -160,6 +160,7 @@ sdmmc_io_scan(struct sdmmc_softc *sc) sf = sdmmc_function_alloc(sc); sf->number = i; sf->rca = sf0->rca; + sf->cookie = sc->sc_cookies[i]; SIMPLEQ_INSERT_TAIL(&sc->sf_head, sf, sf_list); } diff --git a/sys/dev/sdmmc/sdmmcchip.h b/sys/dev/sdmmc/sdmmcchip.h index a370bf10638..98b6d292399 100644 --- a/sys/dev/sdmmc/sdmmcchip.h +++ b/sys/dev/sdmmc/sdmmcchip.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcchip.h,v 1.11 2018/03/20 04:18:40 jmatthew Exp $ */ +/* $OpenBSD: sdmmcchip.h,v 1.12 2018/08/09 13:52:36 patrick Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -94,6 +94,8 @@ struct sdmmc_chip_functions { #define SDMMC_TIMING_HIGHSPEED 1 #define SDMMC_TIMING_MMC_DDR52 2 +#define SDMMC_MAX_FUNCTIONS 8 + struct sdmmcbus_attach_args { const char *saa_busname; sdmmc_chipset_tag_t sct; @@ -103,6 +105,7 @@ struct sdmmcbus_attach_args { int flags; int caps; long max_xfer; + void *cookies[SDMMC_MAX_FUNCTIONS]; }; void sdmmc_needs_discover(struct device *); diff --git a/sys/dev/sdmmc/sdmmcvar.h b/sys/dev/sdmmc/sdmmcvar.h index af8a2f85506..cd6a3637141 100644 --- a/sys/dev/sdmmc/sdmmcvar.h +++ b/sys/dev/sdmmc/sdmmcvar.h @@ -1,4 +1,4 @@ -/* $OpenBSD: sdmmcvar.h,v 1.29 2018/03/20 04:18:40 jmatthew Exp $ */ +/* $OpenBSD: sdmmcvar.h,v 1.30 2018/08/09 13:52:36 patrick Exp $ */ /* * Copyright (c) 2006 Uwe Stuehler <uwe@openbsd.org> @@ -146,6 +146,7 @@ struct sdmmc_function { int flags; #define SFF_ERROR 0x0001 /* function is poo; ignore it */ #define SFF_SDHC 0x0002 /* SD High Capacity card */ + void *cookie; /* pass extra info from bus to dev */ SIMPLEQ_ENTRY(sdmmc_function) sf_list; /* SD card I/O function members */ int number; /* I/O function number or -1 */ @@ -213,6 +214,7 @@ struct sdmmc_softc { void *sc_scsibus; /* SCSI bus emulation softc */ TAILQ_HEAD(, sdmmc_intr_handler) sc_intrq; /* interrupt handlers */ long sc_max_xfer; /* maximum transfer size */ + void *sc_cookies[SDMMC_MAX_FUNCTIONS]; /* pass extra info from bus to dev */ }; /* |