2 * drivers/pcmcia/sa1100_h3600.c
4 * PCMCIA implementation routines for H3600
5 * All true functionality is shuttled off to the
6 * pcmcia implementation for the current sleeve
9 /****************************************************/
10 /* Common functions used by the different sleeves */
11 /****************************************************/
13 #include <linux/module.h>
14 #include <linux/init.h>
15 #include <linux/kernel.h>
16 #include <linux/sched.h>
17 #include <linux/i2c.h>
19 #include <linux/sysctl.h>
21 #include <asm/hardware.h>
25 //#include <asm/arch-sa1100/h3600.h>
26 #include <asm/hardware/ipaq-ops.h>
27 #include <asm/ipaq-sleeve.h>
29 #include "h3600_pcmcia.h"
31 int timing_increment_ns
;
33 static struct pcmcia_irqs cd_irqs
[] = {
34 { 0, 0, "PCMCIA CD0" },
35 { 1, 0, "PCMCIA CD1" },
39 h3600_common_pcmcia_init(struct soc_pcmcia_socket
*skt
)
41 /* Enable PCMCIA/CF bus: */
42 ipaq_sleeve_clear_egpio(IPAQ_EGPIO_OPT_RESET
);
43 ipaq_sleeve_clear_egpio(IPAQ_EGPIO_CARD_RESET
);
45 skt
->irq
= ipaq_sleeve_egpio_irq (skt
->nr
== 0 ? IPAQ_EGPIO_PCMCIA_IRQ0
:
46 IPAQ_EGPIO_PCMCIA_IRQ1
);
48 cd_irqs
[skt
->nr
].irq
= ipaq_sleeve_egpio_irq (skt
->nr
== 0 ? IPAQ_EGPIO_PCMCIA_CD0_N
:
49 IPAQ_EGPIO_PCMCIA_CD1_N
);
51 set_irq_type (cd_irqs
[skt
->nr
].irq
, IRQT_BOTHEDGE
);
53 return soc_pcmcia_request_irqs(skt
, cd_irqs
, ARRAY_SIZE(cd_irqs
));
55 EXPORT_SYMBOL(h3600_common_pcmcia_init
);
58 h3600_common_pcmcia_shutdown(struct soc_pcmcia_socket
*skt
)
60 soc_pcmcia_free_irqs(skt
, cd_irqs
, ARRAY_SIZE(cd_irqs
));
62 EXPORT_SYMBOL(h3600_common_pcmcia_shutdown
);
65 h3600_common_pcmcia_socket_state(struct soc_pcmcia_socket
*skt
,
66 struct pcmcia_state
*state
)
68 memset(state
, 0, sizeof (*state
));
72 state
->detect
= (ipaq_sleeve_read_egpio(IPAQ_EGPIO_PCMCIA_CD0_N
)==0)?1:0;
73 state
->ready
= (ipaq_sleeve_read_egpio(IPAQ_EGPIO_PCMCIA_IRQ0
))?1:0;
76 state
->detect
= (ipaq_sleeve_read_egpio(IPAQ_EGPIO_PCMCIA_CD1_N
)==0)?1:0;
77 state
->ready
= (ipaq_sleeve_read_egpio(IPAQ_EGPIO_PCMCIA_IRQ1
))?1:0;
83 EXPORT_SYMBOL(h3600_common_pcmcia_socket_state
);
86 h3600_common_pcmcia_socket_init(struct soc_pcmcia_socket
*skt
)
89 ipaq_sleeve_clear_egpio(IPAQ_EGPIO_OPT_RESET
);
91 set_current_state(TASK_UNINTERRUPTIBLE
);
92 schedule_timeout(10*HZ
/ 1000);
95 EXPORT_SYMBOL(h3600_common_pcmcia_socket_init
);
98 h3600_common_pcmcia_socket_suspend(struct soc_pcmcia_socket
*skt
)
103 h3600_egpio_set_irq_type(IPAQ_EGPIO_PCMCIA_IRQ0
, IRQT_NOEDGE
);
104 h3600_egpio_set_irq_type(IPAQ_EGPIO_PCMCIA_CD0_N
, IRQT_NOEDGE
);
107 h3600_egpio_set_irq_type(IPAQ_EGPIO_PCMCIA_IRQ1
, IRQT_NOEDGE
);
108 h3600_egpio_set_irq_type(IPAQ_EGPIO_PCMCIA_CD1_N
, IRQT_NOEDGE
);
113 EXPORT_SYMBOL(h3600_common_pcmcia_socket_suspend
);
115 /****************************************************/
116 /* Swapping functions for PCMCIA operations */
117 /****************************************************/
120 h3600_pcmcia_suspend_sockets (void)
125 h3600_pcmcia_resume_sockets (void)
129 EXPORT_SYMBOL(h3600_pcmcia_suspend_sockets
);
130 EXPORT_SYMBOL(h3600_pcmcia_resume_sockets
);