[BACK]Return to scoop_mmc.c CVS log [TXT][DIR] Up to [local] / sys / arch / zaurus / dev

Annotation of sys/arch/zaurus/dev/scoop_mmc.c, Revision 1.1.1.1

1.1       nbrk        1: /*     $OpenBSD: scoop_mmc.c,v 1.1 2007/03/18 20:53:10 uwe Exp $       */
                      2:
                      3: /*
                      4:  * Copyright (c) 2007 Uwe Stuehler <uwe@openbsd.org>
                      5:  *
                      6:  * Permission to use, copy, modify, and distribute this software for any
                      7:  * purpose with or without fee is hereby granted, provided that the above
                      8:  * copyright notice and this permission notice appear in all copies.
                      9:  *
                     10:  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
                     11:  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
                     12:  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
                     13:  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
                     14:  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
                     15:  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
                     16:  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
                     17:  */
                     18:
                     19: /* Attachment driver for pxammc(4) on Zaurus */
                     20:
                     21: #include <sys/param.h>
                     22: #include <sys/device.h>
                     23: #include <sys/systm.h>
                     24:
                     25: #include <dev/sdmmc/sdmmcreg.h>
                     26:
                     27: #include <arch/arm/xscale/pxammcvar.h>
                     28: #include <arch/zaurus/dev/zaurus_scoopvar.h>
                     29:
                     30: int    scoop_mmc_match(struct device *, void *, void *);
                     31: void   scoop_mmc_attach(struct device *, struct device *, void *);
                     32:
                     33: struct cfattach pxammc_scoop_ca = {
                     34:        sizeof(struct pxammc_softc), scoop_mmc_match,
                     35:        scoop_mmc_attach
                     36: };
                     37:
                     38: u_int32_t scoop_mmc_get_ocr(void *);
                     39: int      scoop_mmc_set_power(void *, u_int32_t);
                     40:
                     41: int
                     42: scoop_mmc_match(struct device *parent, void *match, void *aux)
                     43: {
                     44:        return pxammc_match();
                     45: }
                     46:
                     47: void
                     48: scoop_mmc_attach(struct device *parent, struct device *self, void *aux)
                     49: {
                     50:        struct pxammc_softc *sc = (struct pxammc_softc *)self;
                     51:
                     52:        sc->tag.cookie = (void *)sc;
                     53:        sc->tag.get_ocr = scoop_mmc_get_ocr;
                     54:        sc->tag.set_power = scoop_mmc_set_power;
                     55:
                     56:        pxammc_attach(sc, aux);
                     57: }
                     58:
                     59: u_int32_t
                     60: scoop_mmc_get_ocr(void *cookie)
                     61: {
                     62:        return MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V;
                     63: }
                     64:
                     65: int
                     66: scoop_mmc_set_power(void *cookie, u_int32_t ocr)
                     67: {
                     68:        if (ISSET(ocr, MMC_OCR_3_2V_3_3V | MMC_OCR_3_3V_3_4V)) {
                     69:                scoop_set_sdmmc_power(1);
                     70:                return 0;
                     71:        } else if (ocr != 0) {
                     72:                printf("scoop_mmc_set_power: unsupported OCR (%#x)\n", ocr);
                     73:                return EINVAL;
                     74:        } else {
                     75:                scoop_set_sdmmc_power(0);
                     76:                return 0;
                     77:        }
                     78: }

CVSweb