Skip to content
Snippets Groups Projects
Select Git revision
  • master
1 result

f.cc

Blame
  • pxa2xx_mainstone.c 4.26 KiB
    /*
     * linux/drivers/pcmcia/pxa2xx_mainstone.c
     *
     * Mainstone PCMCIA specific routines.
     *
     * Created:	May 12, 2004
     * Author:	Nicolas Pitre
     * Copyright:	MontaVista Software Inc.
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/kernel.h>
    #include <linux/errno.h>
    #include <linux/interrupt.h>
    #include <linux/platform_device.h>
    
    #include <pcmcia/ss.h>
    
    #include <asm/mach-types.h>
    #include <asm/irq.h>
    
    #include <mach/pxa2xx-regs.h>
    #include <mach/mainstone.h>
    
    #include "soc_common.h"
    
    
    static int mst_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
    {
    	/*
    	 * Setup default state of GPIO outputs
    	 * before we enable them as outputs.
    	 */
    	if (skt->nr == 0) {
    		skt->socket.pci_irq = MAINSTONE_S0_IRQ;
    		skt->stat[SOC_STAT_CD].irq = MAINSTONE_S0_CD_IRQ;
    		skt->stat[SOC_STAT_CD].name = "PCMCIA0 CD";
    		skt->stat[SOC_STAT_BVD1].irq = MAINSTONE_S0_STSCHG_IRQ;
    		skt->stat[SOC_STAT_BVD1].name = "PCMCIA0 STSCHG";
    	} else {
    		skt->socket.pci_irq = MAINSTONE_S1_IRQ;
    		skt->stat[SOC_STAT_CD].irq = MAINSTONE_S1_CD_IRQ;
    		skt->stat[SOC_STAT_CD].name = "PCMCIA1 CD";
    		skt->stat[SOC_STAT_BVD1].irq = MAINSTONE_S1_STSCHG_IRQ;
    		skt->stat[SOC_STAT_BVD1].name = "PCMCIA1 STSCHG";
    	}
    	return 0;
    }
    
    static unsigned long mst_pcmcia_status[2];
    
    static void mst_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
    				    struct pcmcia_state *state)
    {
    	unsigned long status, flip;
    
    	status = (skt->nr == 0) ? MST_PCMCIA0 : MST_PCMCIA1;
    	flip = (status ^ mst_pcmcia_status[skt->nr]) & MST_PCMCIA_nSTSCHG_BVD1;
    
    	/*
    	 * Workaround for STSCHG which can't be deasserted:
    	 * We therefore disable/enable corresponding IRQs
    	 * as needed to avoid IRQ locks.
    	 */
    	if (flip) {