static int stork_pcmcia_init(struct pcmcia_init *init) { int irq, res; printk("in stork_pcmcia_init\n"); sa1100_stork_pcmcia_init = *init; /* Enable CF bus: */ storkSetLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON); /* All those are inputs */ GPDR &= ~(GPIO_STORK_PCMCIA_A_CARD_DETECT | GPIO_STORK_PCMCIA_B_CARD_DETECT | GPIO_STORK_PCMCIA_A_RDY| GPIO_STORK_PCMCIA_B_RDY); /* Set transition detect */ set_GPIO_IRQ_edge( GPIO_STORK_PCMCIA_A_CARD_DETECT | GPIO_STORK_PCMCIA_B_CARD_DETECT, GPIO_BOTH_EDGES ); set_GPIO_IRQ_edge( GPIO_STORK_PCMCIA_A_RDY| GPIO_STORK_PCMCIA_B_RDY, GPIO_FALLING_EDGE ); /* Register interrupts */ irq = IRQ_GPIO_STORK_PCMCIA_A_CARD_DETECT; res = request_irq( irq, init->handler, SA_INTERRUPT, "PCMCIA_CD0", NULL ); if( res < 0 ) goto irq_err; irq = IRQ_GPIO_STORK_PCMCIA_B_CARD_DETECT; res = request_irq( irq, init->handler, SA_INTERRUPT, "PCMCIA_CD1", NULL ); if( res < 0 ) goto irq_err; return 2; irq_err: printk( KERN_ERR __FUNCTION__ ": Request for IRQ %u failed\n", irq ); return -1; }
static int stork_pcmcia_socket_init(int sock) { storkSetLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON); if (sock == 0) set_GPIO_IRQ_edge(GPIO_STORK_PCMCIA_A_CARD_DETECT, GPIO_BOTH_EDGES); else if (sock == 1) set_GPIO_IRQ_edge(GPIO_STORK_PCMCIA_B_CARD_DETECT, GPIO_BOTH_EDGES); return 0; }
static int stork_pcmcia_configure_socket(const struct pcmcia_configure *configure) { int card = configure->sock; unsigned long flags; int DETECT, RDY, POWER, RESET; if (card > 1) return -1; printk(__FUNCTION__ ": socket=%d vcc=%d vpp=%d reset=%d\n", card, configure->vcc, configure->vpp, configure->reset); save_flags_cli(flags); if (card == 0) { DETECT = GPIO_STORK_PCMCIA_A_CARD_DETECT; RDY = GPIO_STORK_PCMCIA_A_RDY; POWER = STORK_PCMCIA_A_POWER_ON; RESET = STORK_PCMCIA_A_RESET; } else { DETECT = GPIO_STORK_PCMCIA_B_CARD_DETECT; RDY = GPIO_STORK_PCMCIA_B_RDY; POWER = STORK_PCMCIA_B_POWER_ON; RESET = STORK_PCMCIA_B_RESET; } /* if (storkTestGPIO(DETECT)) { printk("no card detected - but resetting anyway\r\n"); } */ switch (configure->vcc) { case 0: /* storkClearLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON); */ storkClearLatchA(POWER); break; case 50: case 33: storkSetLatchA(STORK_PCMCIA_PULL_UPS_POWER_ON); storkSetLatchA(POWER); break; default: printk(KERN_ERR "%s(): unrecognized Vcc %u\n", __FUNCTION__, configure->vcc); restore_flags(flags); return -1; } if (configure->reset) storkSetLatchB(RESET); else storkClearLatchB(RESET); restore_flags(flags); /* silently ignore vpp and speaker enables. */ printk(__FUNCTION__ ": finished\n"); return 0; }