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);
}
Exemple #2
0
static void *
eppcic_intr_establish(pcmcia_chipset_handle_t pch, struct pcmcia_function *pf,
                      int ipl, int (*ih_func)(void *), void *ih_arg)
{
    struct eppcic_handle *ph = (struct eppcic_handle *)pch;
    struct eppcic_softc *sc = ph->ph_sc;

    DPRINTFN(1, ("eppcic_intr_establish\n"));

    if (ph->ph_ih_func)
        return 0;

    ph->ph_ih_func = ih_func;
    ph->ph_ih_arg = ih_arg;
    return epgpio_intr_establish(sc->sc_gpio, ph->ph_port, ph->ph_ireq,
                                 LEVEL_SENSE | LOW_LEVEL,
                                 ipl, eppcic_intr_socket, ph);
}