static void
eppcic_config_socket(struct eppcic_handle *ph)
{
	struct eppcic_softc *sc = ph->ph_sc;
	eppcic_chipset_tag_t pcic = sc->sc_pcic;
	struct pcmciabus_attach_args paa;
	int wait;

	paa.paa_busname = "pcmcia";
	paa.pct = (pcmcia_chipset_tag_t)&eppcic_functions;
	paa.pch = (pcmcia_chipset_handle_t)ph;
	ph->ph_card = config_found_ia((void*)sc, "pcmciabus", &paa,
				      eppcic_print);
	
	epgpio_intr_establish(sc->sc_gpio, ph->ph_port, ph->ph_cd[0],
			      EDGE_TRIGGER | FALLING_EDGE | DEBOUNCE,
			      IPL_TTY, eppcic_intr_carddetect, ph);
	epgpio_intr_establish(sc->sc_gpio, ph->ph_port, ph->ph_cd[1],
			      EDGE_TRIGGER | RISING_EDGE | DEBOUNCE,
			      IPL_TTY, eppcic_intr_carddetect, ph);
	wait = (pcic->power_ctl)(sc, ph->ph_socket, POWER_OFF);
	delay(wait);


	ph->ph_status[0] = epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_cd[0]);
	ph->ph_status[1] = epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_cd[1]);

	DPRINTFN(1, ("eppcic_config_socket: cd1=%d, cd2=%d\n",ph->ph_status[0],ph->ph_status[1]));

	ph->ph_run = 1;
	kthread_create(PRI_NONE, 0, NULL, eppcic_event_thread, ph,
	    &ph->ph_event_thread, "%s,%d", device_xname(sc->sc_dev),
	    ph->ph_socket);
}
Example #2
0
uint32_t
armadillo9iic_bb_read_bits(void *cookie)
{
	struct armadillo9iic_softc *sc = cookie;
	uint32_t bits = 0;

	bits |= epgpio_read(sc->sc_gpio, sc->sc_port, sc->sc_sda) << sc->sc_sda;
	bits |= epgpio_read(sc->sc_gpio, sc->sc_port, sc->sc_scl) << sc->sc_scl;

	return bits;
}
Example #3
0
static void
eppcic_attach_socket(struct eppcic_handle *ph)
{
    struct eppcic_softc *sc = ph->ph_sc;

    ph->ph_width = 16;
    ph->ph_vcc = 3;
    ph->ph_event_thread = NULL;
    ph->ph_run = 0;
    ph->ph_ih_func = NULL;
    ph->ph_ih_arg = NULL;
    epgpio_in(sc->sc_gpio, ph->ph_port, ph->ph_cd[0]);
    epgpio_in(sc->sc_gpio, ph->ph_port, ph->ph_cd[1]);
    epgpio_in(sc->sc_gpio, ph->ph_port, ph->ph_vs[0]);
    epgpio_in(sc->sc_gpio, ph->ph_port, ph->ph_vs[1]);
    ph->ph_status[0] = epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_cd[0]);
    ph->ph_status[1] = epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_cd[1]);
}
Example #4
0
static int
eppcic_intr_carddetect(void *arg)
{
    struct eppcic_handle *ph = arg;
    struct eppcic_softc *sc = ph->ph_sc;
    int nstatus[2];

    nstatus[0] = epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_cd[0]);
    nstatus[1] = epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_cd[1]);

    DPRINTFN(1, ("eppcic_intr: cd1=%#x, cd2=%#x\n",nstatus[0],nstatus[1]));

    if (nstatus[0] != ph->ph_status[0] || nstatus[1] != ph->ph_status[1]) {
        ph->ph_status[0] = nstatus[0];
        ph->ph_status[1] = nstatus[1];
        wakeup(ph);
    }
    return 0;
}
Example #5
0
static int
eppcic_get_voltage(struct eppcic_handle *ph)
{
    struct eppcic_softc *sc = ph->ph_sc;
    eppcic_chipset_tag_t pcic = sc->sc_pcic;
    int cap, vcc = 0;

    cap = (pcic->power_capability)(sc, ph->ph_socket);
    if (epgpio_read(sc->sc_gpio, ph->ph_port, ph->ph_vs[0])) {
        if (cap | VCC_5V)
            vcc = 5;
        else
            printf("%s: unsupported Vcc 5 Volts",
                   sc->sc_dev.dv_xname);
    } else {
        if (cap | VCC_3V)
            vcc = 3;
        else
            printf("%s: unsupported Vcc 3.3 Volts",
                   sc->sc_dev.dv_xname);
    }
    DPRINTFN(1, ("eppcic_get_voltage: vs1=%d, vs2=%d (%dV)\n",epgpio_read_bit(sc->sc_gpio, ph->ph_port, ph->ph_vs[0]),epgpio_read_bit(sc->sc_gpio, ph->ph_port, ph->ph_vs[1]),vcc));
    return vcc;
}