Commit a1d05002 authored by Russell King's avatar Russell King

pcmcia: soc_common: add CF socket state helper

Add a helper to get the voltage state of CF sockets, where the voltage
sense pins are not wired up.  Switch assabet and cerf to use this
helper.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 6ac95d82
...@@ -31,13 +31,6 @@ static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt) ...@@ -31,13 +31,6 @@ static int assabet_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
return 0; return 0;
} }
static void
assabet_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
state->vs_3v = 1; /* Can only apply 3.3V on Assabet. */
state->vs_Xv = 0;
}
static int static int
assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state) assabet_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, const socket_state_t *state)
{ {
...@@ -90,7 +83,7 @@ static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt) ...@@ -90,7 +83,7 @@ static void assabet_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
static struct pcmcia_low_level assabet_pcmcia_ops = { static struct pcmcia_low_level assabet_pcmcia_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.hw_init = assabet_pcmcia_hw_init, .hw_init = assabet_pcmcia_hw_init,
.socket_state = assabet_pcmcia_socket_state, .socket_state = soc_common_cf_socket_state,
.configure_socket = assabet_pcmcia_configure_socket, .configure_socket = assabet_pcmcia_configure_socket,
.socket_suspend = assabet_pcmcia_socket_suspend, .socket_suspend = assabet_pcmcia_socket_suspend,
}; };
......
...@@ -45,13 +45,6 @@ static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt) ...@@ -45,13 +45,6 @@ static void cerf_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
gpio_free(CERF_GPIO_CF_RESET); gpio_free(CERF_GPIO_CF_RESET);
} }
static void
cerf_pcmcia_socket_state(struct soc_pcmcia_socket *skt, struct pcmcia_state *state)
{
state->vs_3v = 1;
state->vs_Xv = 0;
}
static int static int
cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt, cerf_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
const socket_state_t *state) const socket_state_t *state)
...@@ -77,7 +70,7 @@ static struct pcmcia_low_level cerf_pcmcia_ops = { ...@@ -77,7 +70,7 @@ static struct pcmcia_low_level cerf_pcmcia_ops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.hw_init = cerf_pcmcia_hw_init, .hw_init = cerf_pcmcia_hw_init,
.hw_shutdown = cerf_pcmcia_hw_shutdown, .hw_shutdown = cerf_pcmcia_hw_shutdown,
.socket_state = cerf_pcmcia_socket_state, .socket_state = soc_common_cf_socket_state,
.configure_socket = cerf_pcmcia_configure_socket, .configure_socket = cerf_pcmcia_configure_socket,
}; };
......
...@@ -229,6 +229,18 @@ static void soc_pcmcia_hw_disable(struct soc_pcmcia_socket *skt) ...@@ -229,6 +229,18 @@ static void soc_pcmcia_hw_disable(struct soc_pcmcia_socket *skt)
irq_set_irq_type(skt->stat[i].irq, IRQ_TYPE_NONE); irq_set_irq_type(skt->stat[i].irq, IRQ_TYPE_NONE);
} }
/*
* The CF 3.0 specification says that cards tie VS1 to ground and leave
* VS2 open. Many implementations do not wire up the VS signals, so we
* provide hard-coded values as per the CF 3.0 spec.
*/
void soc_common_cf_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state)
{
state->vs_3v = 1;
}
EXPORT_SYMBOL_GPL(soc_common_cf_socket_state);
static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt) static unsigned int soc_common_pcmcia_skt_state(struct soc_pcmcia_socket *skt)
{ {
struct pcmcia_state state; struct pcmcia_state state;
......
...@@ -143,6 +143,8 @@ void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt); ...@@ -143,6 +143,8 @@ void soc_pcmcia_remove_one(struct soc_pcmcia_socket *skt);
int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt); int soc_pcmcia_add_one(struct soc_pcmcia_socket *skt);
int soc_pcmcia_request_gpiods(struct soc_pcmcia_socket *skt); int soc_pcmcia_request_gpiods(struct soc_pcmcia_socket *skt);
void soc_common_cf_socket_state(struct soc_pcmcia_socket *skt,
struct pcmcia_state *state);
#ifdef CONFIG_PCMCIA_DEBUG #ifdef CONFIG_PCMCIA_DEBUG
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment