PERFORCE change 106636 for review
Warner Losh
imp at FreeBSD.org
Sun Sep 24 23:51:30 PDT 2006
http://perforce.freebsd.org/chv.cgi?CH=106636
Change 106636 by imp at imp_lighthouse on 2006/09/25 06:51:28
Flesh out the host adapter concept a little. Fill in the right
default values for the atmel device.
Affected files ...
.. //depot/projects/arm/src/sys/arm/at91/at91_mci.c#4 edit
.. //depot/projects/arm/src/sys/dev/mmc/bridge.h#2 edit
.. //depot/projects/arm/src/sys/dev/mmc/mmcreg.h#4 edit
Differences ...
==== //depot/projects/arm/src/sys/arm/at91/at91_mci.c#4 (text+ko) ====
@@ -53,6 +53,8 @@
#include <arm/at91/at91var.h>
#include <arm/at91/at91_mcireg.h>
#include <arm/at91/at91_pdcreg.h>
+#include <dev/mmc/bridge.h>
+#include <dev/mmc/mmcreg.h>
struct at91_mci_softc {
void *intrhand; /* Interrupt handle */
@@ -62,9 +64,7 @@
struct mtx sc_mtx;
bus_dma_tag_t dmatag;
bus_dmamap_t map;
- struct disk *disk; /* XXX support only one card for */
- int nb_cards;
- struct proc *p;
+ struct mmc_host host;
};
static inline uint32_t
@@ -133,6 +133,7 @@
/* XXX: asumes MCK = 60MHz */
struct at91_mci_softc *sc = device_get_softc(dev);
int err;
+ device_t child;
sc->dev = dev;
err = at91_mci_activate(dev);
@@ -166,7 +167,12 @@
AT91_MCI_LOCK_DESTROY(sc);
goto out;
}
- device_add_child(dev, "mmc", 0);
+ sc->host.f_min = 375000;
+ sc->host.f_max = 25000000;
+ sc->host.host_ocr = MMC_OCR_320_330 | MMC_OCR_330_340;
+ sc->host.caps = MMC_CAP_4_BIT_DATA;
+ child = device_add_child(dev, "mmc", 0);
+ device_set_ivars(dev, &sc->host);
err = bus_generic_attach(dev);
out:;
if (err)
==== //depot/projects/arm/src/sys/dev/mmc/bridge.h#2 (text+ko) ====
@@ -73,16 +73,24 @@
struct mmc_ios {
uint32_t clock; /* Speed of the clock in Hz to move data */
- enum mmc_vdd vdd; /* Voltage to apply to the power pins */
+ enum mmc_vdd vdd; /* Voltage to apply to the power pins/ */
enum mmc_bus_mode bus_mode;
enum mmc_chip_select chip_select;
enum mmc_bus_width bus_width;
};
-#define MMC_CAP_4_BIT_DATA (1UL << 0) /* Host can do 4-bit xfers */
-
enum mmc_card_mode {
mode_mmc, mode_sd
};
+struct mmc_host {
+ int f_min;
+ int f_max;
+ uint32_t host_ocr;
+ uint32_t caps;
+#define MMC_CAP_4_BIT_DATA (1 << 0) /* Can do 4-bit data transfers */
+#define MMC_CAP_8_BIT_DATA (1 << 1) /* Can do 8-bit data transfers */
+ enum mmc_card_mode mode;
+};
+
#endif /* DEV_MMC_BRIDGE_H */
==== //depot/projects/arm/src/sys/dev/mmc/mmcreg.h#4 (text+ko) ====
@@ -389,4 +389,31 @@
////////////////////////////////////////////////////////////////////////////////
+/* OCR bits */
+#define MMC_OCR_145_150 (1U << 0) /* Vdd voltage 1.45 ~ 1.50 */
+#define MMC_OCR_150_155 (1U << 1) /* Vdd voltage 1.50 ~ 1.50 */
+#define MMC_OCR_155_160 (1U << 2) /* Vdd voltage 1.55 ~ 1.60 */
+#define MMC_OCR_160_165 (1U << 3) /* Vdd voltage 1.60 ~ 1.65 */
+#define MMC_OCR_165_170 (1U << 4) /* Vdd voltage 1.65 ~ 1.70 */
+#define MMC_OCR_170_180 (1U << 5) /* Vdd voltage 1.70 ~ 1.80 */
+#define MMC_OCR_180_190 (1U << 6) /* Vdd voltage 1.80 ~ 1.90 */
+#define MMC_OCR_190_200 (1U << 7) /* Vdd voltage 1.90 ~ 2.00 */
+#define MMC_OCR_200_210 (1U << 8) /* Vdd voltage 2.00 ~ 2.10 */
+#define MMC_OCR_210_220 (1U << 9) /* Vdd voltage 2.10 ~ 2.20 */
+#define MMC_OCR_220_230 (1U << 10) /* Vdd voltage 2.20 ~ 2.30 */
+#define MMC_OCR_230_240 (1U << 11) /* Vdd voltage 2.30 ~ 2.40 */
+#define MMC_OCR_240_250 (1U << 12) /* Vdd voltage 2.40 ~ 2.50 */
+#define MMC_OCR_250_260 (1U << 13) /* Vdd voltage 2.50 ~ 2.60 */
+#define MMC_OCR_260_270 (1U << 14) /* Vdd voltage 2.60 ~ 2.70 */
+#define MMC_OCR_270_280 (1U << 15) /* Vdd voltage 2.70 ~ 2.80 */
+#define MMC_OCR_280_290 (1U << 16) /* Vdd voltage 2.80 ~ 2.90 */
+#define MMC_OCR_290_300 (1U << 17) /* Vdd voltage 2.90 ~ 3.00 */
+#define MMC_OCR_300_310 (1U << 18) /* Vdd voltage 3.00 ~ 3.10 */
+#define MMC_OCR_310_320 (1U << 19) /* Vdd voltage 3.10 ~ 3.20 */
+#define MMC_OCR_320_330 (1U << 20) /* Vdd voltage 3.20 ~ 3.30 */
+#define MMC_OCR_330_340 (1U << 21) /* Vdd voltage 3.30 ~ 3.40 */
+#define MMC_OCR_340_350 (1U << 22) /* Vdd voltage 3.40 ~ 3.50 */
+#define MMC_OCR_350_360 (1U << 23) /* Vdd voltage 3.50 ~ 3.60 */
+#define MMC_OCR_CARD_BUSY (1U << 31) /* Card Power up status */
+
#endif /* DEV_MMCREG_H */
More information about the p4-projects
mailing list