2 * drivers/pcmcia/sa1100_xp860.c
4 * XP860 PCMCIA specific routines
7 #include <linux/module.h>
8 #include <linux/kernel.h>
9 #include <linux/delay.h>
10 #include <linux/sched.h>
11 #include <linux/device.h>
12 #include <linux/init.h>
14 #include <asm/hardware.h>
15 #include <asm/mach-types.h>
17 #include "sa1100_generic.h"
19 #define NCR_A0VPP (1<<16)
20 #define NCR_A1VPP (1<<17)
22 static int xp860_pcmcia_hw_init(struct soc_pcmcia_socket
*skt
)
24 /* Set GPIO_A<3:0> to be outputs for PCMCIA/CF power controller: */
25 PA_DDR
&= ~(GPIO_GPIO0
| GPIO_GPIO1
| GPIO_GPIO2
| GPIO_GPIO3
);
27 /* MAX1600 to standby mode: */
28 PA_DWR
&= ~(GPIO_GPIO0
| GPIO_GPIO1
| GPIO_GPIO2
| GPIO_GPIO3
);
30 #error Consider the following comment
32 * 1- Please move GPDR initialisation where it is interrupt or preemption
33 * safe (like from xp860_map_io).
34 * 2- The GPCR line is bogus i.e. it will simply have absolutely no effect.
35 * Please see its definition in the SA1110 manual.
36 * 3- Please do not use NCR_* values!
38 GPDR
|= (NCR_A0VPP
| NCR_A1VPP
);
39 GPCR
&= ~(NCR_A0VPP
| NCR_A1VPP
);
41 return sa1111_pcmcia_hw_init(skt
);
45 xp860_pcmcia_configure_socket(struct soc_pcmcia_socket
*skt
, const socket_state_t
*state
)
47 unsigned int gpio_mask
, pa_dwr_mask
;
48 unsigned int gpio_set
, pa_dwr_set
;
51 /* Neponset uses the Maxim MAX1600, with the following connections:
52 #warning ^^^ This isn't a neponset!
56 * A0VCC SA-1111 GPIO A<1>
57 * A1VCC SA-1111 GPIO A<0>
58 * A0VPP CPLD NCR A0VPP
59 * A1VPP CPLD NCR A1VPP
60 * B0VCC SA-1111 GPIO A<2>
61 * B1VCC SA-1111 GPIO A<3>
62 * B0VPP ground (slot B is CF)
63 * B1VPP ground (slot B is CF)
68 * 12INB ground (slot B is CF)
70 * The MAX1600 CODE pin is tied to ground, placing the device in
71 * "Standard Intel code" mode. Refer to the Maxim data sheet for
72 * the corresponding truth table.
77 pa_dwr_mask
= GPIO_GPIO0
| GPIO_GPIO1
;
78 gpio_mask
= NCR_A0VPP
| NCR_A1VPP
;
82 case 0: pa_dwr_set
= 0; break;
83 case 33: pa_dwr_set
= GPIO_GPIO1
; break;
84 case 50: pa_dwr_set
= GPIO_GPIO0
; break;
88 case 0: gpio_set
= 0; break;
89 case 120: gpio_set
= NCR_A1VPP
; break;
92 if (state
->Vpp
== state
->Vcc
)
95 printk(KERN_ERR
"%s(): unrecognized Vpp %u\n",
96 __FUNCTION__
, state
->Vpp
);
103 pa_dwr_mask
= GPIO_GPIO2
| GPIO_GPIO3
;
107 switch (state
->Vcc
) {
109 case 0: pa_dwr_set
= 0; break;
110 case 33: pa_dwr_set
= GPIO_GPIO2
; break;
111 case 50: pa_dwr_set
= GPIO_GPIO3
; break;
114 if (state
->Vpp
!= state
->Vcc
&& state
->Vpp
!= 0) {
115 printk(KERN_ERR
"%s(): CF slot cannot support Vpp %u\n",
116 __FUNCTION__
, state
->Vpp
);
122 ret
= sa1111_pcmcia_configure_socket(skt
, state
);
126 local_irq_save(flags
);
127 PA_DWR
= (PA_DWR
& ~pa_dwr_mask
) | pa_dwr_set
;
129 GPCR
= gpio_set
^ gpio_mask
;
130 local_irq_restore(flags
);
136 static struct pcmcia_low_level xp860_pcmcia_ops
= {
137 .owner
= THIS_MODULE
,
138 .hw_init
= xp860_pcmcia_hw_init
,
139 .hw_shutdown
= sa1111_pcmcia_hw_shutdown
,
140 .socket_state
= sa1111_pcmcia_socket_state
,
141 .configure_socket
= xp860_pcmcia_configure_socket
,
142 .socket_init
= sa1111_pcmcia_socket_init
,
143 .socket_suspend
= sa1111_pcmcia_socket_suspend
,
146 int __init
pcmcia_xp860_init(struct device
*dev
)
150 if (machine_is_xp860())
151 ret
= sa11xx_drv_pcmcia_probe(dev
, &xp860_pcmcia_ops
, 0, 2);