Commit 9da4bc6d authored by Dominik Brodowski's avatar Dominik Brodowski

[PATCH] pcmcia: remove get_socket callback

The .get_socket callback is never used by the PCMCIA core, therefore remove
it.
Signed-off-by: default avatarDominik Brodowski <linux@dominikbrodowski.net>
parent 7f316b03
......@@ -241,23 +241,6 @@ au1x00_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
return 0;
}
/* au1x00_pcmcia_get_socket()
* Implements the get_socket() operation for the in-kernel PCMCIA
* service (formerly SS_GetSocket in Card Services). Not a very
* exciting routine.
*
* Returns: 0
*/
static int
au1x00_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
struct au1000_pcmcia_socket *skt = to_au1000_socket(sock);
debug("for sock %u\n", skt->nr);
*state = skt->cs_state;
return 0;
}
/* au1x00_pcmcia_set_socket()
* Implements the set_socket() operation for the in-kernel PCMCIA
* service (formerly SS_SetSocket in Card Services). We more or
......@@ -352,7 +335,6 @@ static struct pccard_operations au1x00_pcmcia_operations = {
.init = au1x00_pcmcia_sock_init,
.suspend = au1x00_pcmcia_suspend,
.get_status = au1x00_pcmcia_get_status,
.get_socket = au1x00_pcmcia_get_socket,
.set_socket = au1x00_pcmcia_set_socket,
.set_io_map = au1x00_pcmcia_set_io_map,
.set_mem_map = au1x00_pcmcia_set_mem_map,
......
......@@ -417,18 +417,6 @@ static int hs_get_status(struct pcmcia_socket *s, u_int *value)
/*============================================================*/
static int hs_get_socket(struct pcmcia_socket *s, socket_state_t *state)
{
hs_socket_t *sp = container_of(s, struct hs_socket_t, socket);
DPRINTK("hs_get_socket(%d)\n", sock);
*state = sp->state;
return 0;
}
/*============================================================*/
static int hs_set_socket(struct pcmcia_socket *s, socket_state_t *state)
{
hs_socket_t *sp = container_of(s, struct hs_socket_t, socket);
......@@ -749,7 +737,6 @@ static irqreturn_t hs_interrupt(int irq, void *dev, struct pt_regs *regs)
static struct pccard_operations hs_operations = {
.init = hs_init,
.get_status = hs_get_status,
.get_socket = hs_get_socket,
.set_socket = hs_set_socket,
.set_io_map = hs_set_io_map,
.set_mem_map = hs_set_mem_map,
......
......@@ -66,7 +66,6 @@ static struct pci_driver i82092aa_pci_drv = {
static struct pccard_operations i82092aa_operations = {
.init = i82092aa_init,
.get_status = i82092aa_get_status,
.get_socket = i82092aa_get_socket,
.set_socket = i82092aa_set_socket,
.set_io_map = i82092aa_set_io_map,
.set_mem_map = i82092aa_set_mem_map,
......@@ -482,78 +481,6 @@ static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
}
static int i82092aa_get_socket(struct pcmcia_socket *socket, socket_state_t *state)
{
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
unsigned char reg,vcc,vpp;
enter("i82092aa_get_socket");
state->flags = 0;
state->Vcc = 0;
state->Vpp = 0;
state->io_irq = 0;
state->csc_mask = 0;
/* First the power status of the socket */
reg = indirect_read(sock,I365_POWER); /* PCTRL - Power Control Register */
if (reg & I365_PWR_AUTO)
state->flags |= SS_PWR_AUTO; /* Automatic Power Switch */
if (reg & I365_PWR_OUT)
state->flags |= SS_OUTPUT_ENA; /* Output signals are enabled */
vcc = reg & I365_VCC_MASK; vpp = reg & I365_VPP1_MASK;
if (reg & I365_VCC_5V) { /* Can still be 3.3V, in this case the Vcc value will be overwritten later */
state->Vcc = 50;
if (vpp == I365_VPP1_5V)
state->Vpp = 50;
if (vpp == I365_VPP1_12V)
state->Vpp = 120;
}
if ((reg & I365_VCC_3V)==I365_VCC_3V)
state->Vcc = 33;
/* Now the IO card, RESET flags and IO interrupt */
reg = indirect_read(sock, I365_INTCTL); /* IGENC, Interrupt and General Control */
if ((reg & I365_PC_RESET)==0)
state->flags |= SS_RESET;
if (reg & I365_PC_IOCARD)
state->flags |= SS_IOCARD; /* This is an IO card */
/* Set the IRQ number */
if (sockets[sock].dev!=NULL)
state->io_irq = sockets[sock].dev->irq;
/* Card status change */
reg = indirect_read(sock, I365_CSCINT); /* CSCICR, Card Status Change Interrupt Configuration */
if (reg & I365_CSC_DETECT)
state->csc_mask |= SS_DETECT; /* Card detect is enabled */
if (state->flags & SS_IOCARD) {/* IO Cards behave different */
if (reg & I365_CSC_STSCHG)
state->csc_mask |= SS_STSCHG;
} else {
if (reg & I365_CSC_BVD1)
state->csc_mask |= SS_BATDEAD;
if (reg & I365_CSC_BVD2)
state->csc_mask |= SS_BATWARN;
if (reg & I365_CSC_READY)
state->csc_mask |= SS_READY;
}
leave("i82092aa_get_socket");
return 0;
}
static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state)
{
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
......
......@@ -29,7 +29,6 @@ static irqreturn_t i82092aa_interrupt(int irq, void *dev, struct pt_regs *regs);
static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value);
static int i82092aa_get_socket(struct pcmcia_socket *socket, socket_state_t *state);
static int i82092aa_set_socket(struct pcmcia_socket *socket, socket_state_t *state);
static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_map *io);
static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem);
......
......@@ -940,78 +940,6 @@ static int i365_get_status(u_short sock, u_int *value)
/*====================================================================*/
static int i365_get_socket(u_short sock, socket_state_t *state)
{
struct i82365_socket *t = &socket[sock];
u_char reg, vcc, vpp;
reg = i365_get(sock, I365_POWER);
state->flags = (reg & I365_PWR_AUTO) ? SS_PWR_AUTO : 0;
state->flags |= (reg & I365_PWR_OUT) ? SS_OUTPUT_ENA : 0;
vcc = reg & I365_VCC_MASK; vpp = reg & I365_VPP1_MASK;
state->Vcc = state->Vpp = 0;
if (t->flags & IS_CIRRUS) {
if (i365_get(sock, PD67_MISC_CTL_1) & PD67_MC1_VCC_3V) {
if (reg & I365_VCC_5V) state->Vcc = 33;
if (vpp == I365_VPP1_5V) state->Vpp = 33;
} else {
if (reg & I365_VCC_5V) state->Vcc = 50;
if (vpp == I365_VPP1_5V) state->Vpp = 50;
}
if (vpp == I365_VPP1_12V) state->Vpp = 120;
} else if (t->flags & IS_VG_PWR) {
if (i365_get(sock, VG469_VSELECT) & VG469_VSEL_VCC) {
if (reg & I365_VCC_5V) state->Vcc = 33;
if (vpp == I365_VPP1_5V) state->Vpp = 33;
} else {
if (reg & I365_VCC_5V) state->Vcc = 50;
if (vpp == I365_VPP1_5V) state->Vpp = 50;
}
if (vpp == I365_VPP1_12V) state->Vpp = 120;
} else if (t->flags & IS_DF_PWR) {
if (vcc == I365_VCC_3V) state->Vcc = 33;
if (vcc == I365_VCC_5V) state->Vcc = 50;
if (vpp == I365_VPP1_5V) state->Vpp = 50;
if (vpp == I365_VPP1_12V) state->Vpp = 120;
} else {
if (reg & I365_VCC_5V) {
state->Vcc = 50;
if (vpp == I365_VPP1_5V) state->Vpp = 50;
if (vpp == I365_VPP1_12V) state->Vpp = 120;
}
}
/* IO card, RESET flags, IO interrupt */
reg = i365_get(sock, I365_INTCTL);
state->flags |= (reg & I365_PC_RESET) ? 0 : SS_RESET;
if (reg & I365_PC_IOCARD) state->flags |= SS_IOCARD;
state->io_irq = reg & I365_IRQ_MASK;
/* speaker control */
if (t->flags & IS_CIRRUS) {
if (i365_get(sock, PD67_MISC_CTL_1) & PD67_MC1_SPKR_ENA)
state->flags |= SS_SPKR_ENA;
}
/* Card status change mask */
reg = i365_get(sock, I365_CSCINT);
state->csc_mask = (reg & I365_CSC_DETECT) ? SS_DETECT : 0;
if (state->flags & SS_IOCARD)
state->csc_mask |= (reg & I365_CSC_STSCHG) ? SS_STSCHG : 0;
else {
state->csc_mask |= (reg & I365_CSC_BVD1) ? SS_BATDEAD : 0;
state->csc_mask |= (reg & I365_CSC_BVD2) ? SS_BATWARN : 0;
state->csc_mask |= (reg & I365_CSC_READY) ? SS_READY : 0;
}
debug(1, "GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x\n", sock, state->flags,
state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
return 0;
} /* i365_get_socket */
/*====================================================================*/
static int i365_set_socket(u_short sock, socket_state_t *state)
{
struct i82365_socket *t = &socket[sock];
......@@ -1265,16 +1193,6 @@ static int pcic_get_status(struct pcmcia_socket *s, u_int *value)
LOCKED(i365_get_status(sock, value));
}
static int pcic_get_socket(struct pcmcia_socket *s, socket_state_t *state)
{
unsigned int sock = container_of(s, struct i82365_socket, socket)->number;
if (socket[sock].flags & IS_ALIVE)
return -EINVAL;
LOCKED(i365_get_socket(sock, state));
}
static int pcic_set_socket(struct pcmcia_socket *s, socket_state_t *state)
{
unsigned int sock = container_of(s, struct i82365_socket, socket)->number;
......@@ -1324,7 +1242,6 @@ static int pcic_init(struct pcmcia_socket *s)
static struct pccard_operations pcic_operations = {
.init = pcic_init,
.get_status = pcic_get_status,
.get_socket = pcic_get_socket,
.set_socket = pcic_set_socket,
.set_io_map = pcic_set_io_map,
.set_mem_map = pcic_set_mem_map,
......
......@@ -480,25 +480,6 @@ static int _pcc_get_status(u_short sock, u_int *value)
/*====================================================================*/
static int _pcc_get_socket(u_short sock, socket_state_t *state)
{
// pcc_socket_t *t = &socket[sock];
state->flags = 0;
state->csc_mask = SS_DETECT;
state->csc_mask |= SS_READY;
state->io_irq = 0;
state->Vcc = 33; /* 3.3V fixed */
state->Vpp = 33;
debug(3, "m32r_cfc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x\n", sock, state->flags,
state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
return 0;
} /* _get_socket */
/*====================================================================*/
static int _pcc_set_socket(u_short sock, socket_state_t *state)
{
debug(3, "m32r_cfc: SetSocket(%d, flags %#3.3x, Vcc %d, Vpp %d, "
......@@ -667,18 +648,6 @@ static int pcc_get_status(struct pcmcia_socket *s, u_int *value)
LOCKED(_pcc_get_status(sock, value));
}
static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state)
{
unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
if (socket[sock].flags & IS_ALIVE) {
debug(3, "m32r_cfc: pcc_get_socket: sock(%d) -EINVAL\n", sock);
return -EINVAL;
}
debug(3, "m32r_cfc: pcc_get_socket: sock(%d)\n", sock);
LOCKED(_pcc_get_socket(sock, state));
}
static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state)
{
unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
......@@ -724,7 +693,6 @@ static int pcc_init(struct pcmcia_socket *s)
static struct pccard_operations pcc_operations = {
.init = pcc_init,
.get_status = pcc_get_status,
.get_socket = pcc_get_socket,
.set_socket = pcc_set_socket,
.set_io_map = pcc_set_io_map,
.set_mem_map = pcc_set_mem_map,
......
......@@ -429,16 +429,6 @@ static int _pcc_get_status(u_short sock, u_int *value)
/*====================================================================*/
static int _pcc_get_socket(u_short sock, socket_state_t *state)
{
debug(3, "m32r-pcc: GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x\n", sock, state->flags,
state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
return 0;
} /* _get_socket */
/*====================================================================*/
static int _pcc_set_socket(u_short sock, socket_state_t *state)
{
u_long reg = 0;
......@@ -641,15 +631,6 @@ static int pcc_get_status(struct pcmcia_socket *s, u_int *value)
LOCKED(_pcc_get_status(sock, value));
}
static int pcc_get_socket(struct pcmcia_socket *s, socket_state_t *state)
{
unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
if (socket[sock].flags & IS_ALIVE)
return -EINVAL;
LOCKED(_pcc_get_socket(sock, state));
}
static int pcc_set_socket(struct pcmcia_socket *s, socket_state_t *state)
{
unsigned int sock = container_of(s, struct pcc_socket, socket)->number;
......@@ -687,7 +668,6 @@ static int pcc_init(struct pcmcia_socket *s)
static struct pccard_operations pcc_operations = {
.init = pcc_init,
.get_status = pcc_get_status,
.get_socket = pcc_get_socket,
.set_socket = pcc_set_socket,
.set_io_map = pcc_set_io_map,
.set_mem_map = pcc_set_mem_map,
......
......@@ -823,17 +823,6 @@ static int m8xx_get_status(struct pcmcia_socket *sock, unsigned int *value)
return 0;
}
static int m8xx_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
int lsock = container_of(sock, struct socket_info, socket)->slot;
*state = socket[lsock].state; /* copy the whole structure */
dprintk("GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x\n", lsock, state->flags,
state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
return 0;
}
static int m8xx_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
int lsock = container_of(sock, struct socket_info, socket)->slot;
......@@ -1169,7 +1158,6 @@ static struct pccard_operations m8xx_services = {
.init = m8xx_sock_init,
.suspend = m8xx_suspend,
.get_status = m8xx_get_status,
.get_socket = m8xx_get_socket,
.set_socket = m8xx_set_socket,
.set_io_map = m8xx_set_io_map,
.set_mem_map = m8xx_set_mem_map,
......
......@@ -304,75 +304,6 @@ static int pd6729_get_status(struct pcmcia_socket *sock, u_int *value)
}
static int pd6729_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
struct pd6729_socket *socket
= container_of(sock, struct pd6729_socket, socket);
unsigned char reg, vcc, vpp;
state->flags = 0;
state->Vcc = 0;
state->Vpp = 0;
state->io_irq = 0;
state->csc_mask = 0;
/* First the power status of the socket */
reg = indirect_read(socket, I365_POWER);
if (reg & I365_PWR_AUTO)
state->flags |= SS_PWR_AUTO; /* Automatic Power Switch */
if (reg & I365_PWR_OUT)
state->flags |= SS_OUTPUT_ENA; /* Output signals are enabled */
vcc = reg & I365_VCC_MASK; vpp = reg & I365_VPP1_MASK;
if (reg & I365_VCC_5V) {
state->Vcc = (indirect_read(socket, PD67_MISC_CTL_1) &
PD67_MC1_VCC_3V) ? 33 : 50;
if (vpp == I365_VPP1_5V) {
if (state->Vcc == 50)
state->Vpp = 50;
else
state->Vpp = 33;
}
if (vpp == I365_VPP1_12V)
state->Vpp = 120;
}
/* Now the IO card, RESET flags and IO interrupt */
reg = indirect_read(socket, I365_INTCTL);
if ((reg & I365_PC_RESET) == 0)
state->flags |= SS_RESET;
if (reg & I365_PC_IOCARD)
state->flags |= SS_IOCARD; /* This is an IO card */
/* Set the IRQ number */
state->io_irq = socket->card_irq;
/* Card status change */
reg = indirect_read(socket, I365_CSCINT);
if (reg & I365_CSC_DETECT)
state->csc_mask |= SS_DETECT; /* Card detect is enabled */
if (state->flags & SS_IOCARD) {/* IO Cards behave different */
if (reg & I365_CSC_STSCHG)
state->csc_mask |= SS_STSCHG;
} else {
if (reg & I365_CSC_BVD1)
state->csc_mask |= SS_BATDEAD;
if (reg & I365_CSC_BVD2)
state->csc_mask |= SS_BATWARN;
if (reg & I365_CSC_READY)
state->csc_mask |= SS_READY;
}
return 0;
}
static int pd6729_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
struct pd6729_socket *socket
......@@ -640,7 +571,6 @@ static int pd6729_init(struct pcmcia_socket *sock)
static struct pccard_operations pd6729_operations = {
.init = pd6729_init,
.get_status = pd6729_get_status,
.get_socket = pd6729_get_socket,
.set_socket = pd6729_set_socket,
.set_io_map = pd6729_set_io_map,
.set_mem_map = pd6729_set_mem_map,
......
......@@ -296,25 +296,6 @@ soc_common_pcmcia_get_status(struct pcmcia_socket *sock, unsigned int *status)
}
/*
* Implements the get_socket() operation for the in-kernel PCMCIA
* service (formerly SS_GetSocket in Card Services). Not a very
* exciting routine.
*
* Returns: 0
*/
static int
soc_common_pcmcia_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
struct soc_pcmcia_socket *skt = to_soc_pcmcia_socket(sock);
debug(skt, 2, "\n");
*state = skt->cs_state;
return 0;
}
/*
* Implements the set_socket() operation for the in-kernel PCMCIA
* service (formerly SS_SetSocket in Card Services). We more or
......@@ -528,7 +509,6 @@ static struct pccard_operations soc_common_pcmcia_operations = {
.init = soc_common_pcmcia_sock_init,
.suspend = soc_common_pcmcia_suspend,
.get_status = soc_common_pcmcia_get_status,
.get_socket = soc_common_pcmcia_get_socket,
.set_socket = soc_common_pcmcia_set_socket,
.set_io_map = soc_common_pcmcia_set_io_map,
.set_mem_map = soc_common_pcmcia_set_mem_map,
......
......@@ -181,13 +181,6 @@ static void tcic_setl(u_char reg, u_int data)
outw(data >> 16, tcic_base+reg+2);
}
static u_char tcic_aux_getb(u_short reg)
{
u_char mode = (tcic_getb(TCIC_MODE) & TCIC_MODE_PGMMASK) | reg;
tcic_setb(TCIC_MODE, mode);
return tcic_getb(TCIC_AUX);
}
static void tcic_aux_setb(u_short reg, u_char data)
{
u_char mode = (tcic_getb(TCIC_MODE) & TCIC_MODE_PGMMASK) | reg;
......@@ -644,59 +637,6 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value)
/*====================================================================*/
static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
u_short psock = container_of(sock, struct tcic_socket, socket)->psock;
u_char reg;
u_short scf1, scf2;
tcic_setl(TCIC_ADDR, (psock << TCIC_ADDR_SS_SHFT)
| TCIC_ADDR_INDREG | TCIC_SCF1(psock));
scf1 = tcic_getw(TCIC_DATA);
state->flags = (scf1 & TCIC_SCF1_IOSTS) ? SS_IOCARD : 0;
state->flags |= (scf1 & TCIC_SCF1_DMA_MASK) ? SS_DMA_MODE : 0;
state->flags |= (scf1 & TCIC_SCF1_SPKR) ? SS_SPKR_ENA : 0;
if (tcic_getb(TCIC_SCTRL) & TCIC_SCTRL_ENA)
state->flags |= SS_OUTPUT_ENA;
state->io_irq = scf1 & TCIC_SCF1_IRQ_MASK;
if (state->io_irq == 1) state->io_irq = 11;
reg = tcic_getb(TCIC_PWR);
state->Vcc = state->Vpp = 0;
if (reg & TCIC_PWR_VCC(psock)) {
if (reg & TCIC_PWR_VPP(psock))
state->Vcc = 50;
else
state->Vcc = state->Vpp = 50;
} else {
if (reg & TCIC_PWR_VPP(psock)) {
state->Vcc = 50;
state->Vpp = 120;
}
}
reg = tcic_aux_getb(TCIC_AUX_ILOCK);
state->flags |= (reg & TCIC_ILOCK_CRESET) ? SS_RESET : 0;
/* Card status change interrupt mask */
tcic_setw(TCIC_ADDR, TCIC_SCF2(psock));
scf2 = tcic_getw(TCIC_DATA);
state->csc_mask = (scf2 & TCIC_SCF2_MCD) ? 0 : SS_DETECT;
if (state->flags & SS_IOCARD) {
state->csc_mask |= (scf2 & TCIC_SCF2_MLBAT1) ? 0 : SS_STSCHG;
} else {
state->csc_mask |= (scf2 & TCIC_SCF2_MLBAT1) ? 0 : SS_BATDEAD;
state->csc_mask |= (scf2 & TCIC_SCF2_MLBAT2) ? 0 : SS_BATWARN;
state->csc_mask |= (scf2 & TCIC_SCF2_MRDY) ? 0 : SS_READY;
}
debug(1, "GetSocket(%d) = flags %#3.3x, Vcc %d, Vpp %d, "
"io_irq %d, csc_mask %#2.2x\n", psock, state->flags,
state->Vcc, state->Vpp, state->io_irq, state->csc_mask);
return 0;
} /* tcic_get_socket */
/*====================================================================*/
static int tcic_set_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
u_short psock = container_of(sock, struct tcic_socket, socket)->psock;
......@@ -874,7 +814,6 @@ static int tcic_init(struct pcmcia_socket *s)
static struct pccard_operations tcic_operations = {
.init = tcic_init,
.get_status = tcic_get_status,
.get_socket = tcic_get_socket,
.set_socket = tcic_set_socket,
.set_io_map = tcic_set_io_map,
.set_mem_map = tcic_set_mem_map,
......
......@@ -301,75 +301,6 @@ static int pccard_get_status(struct pcmcia_socket *sock, u_int *value)
return 0;
}
static inline u_char get_Vcc_value(uint8_t voltage)
{
switch (voltage) {
case VCC_STATUS_3V:
return 33;
case VCC_STATUS_5V:
return 50;
default:
break;
}
return 0;
}
static inline u_char get_Vpp_value(uint8_t power, u_char Vcc)
{
if ((power & 0x03) == 0x01 || (power & 0x03) == 0x02)
return Vcc;
return 0;
}
static int pccard_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
unsigned int slot;
uint8_t power, voltage, control, cscint;
if (sock == NULL || sock->sock >= CARD_MAX_SLOTS || state == NULL)
return -EINVAL;
slot = sock->sock;
power = exca_read_byte(slot, I365_POWER);
voltage = exca_read_byte(slot, CARD_VOLTAGE_SELECT);
state->Vcc = get_Vcc_value(voltage);
state->Vpp = get_Vpp_value(power, state->Vcc);
state->flags = 0;
if (power & POWER_ENABLE)
state->flags |= SS_PWR_AUTO;
if (power & I365_PWR_OUT)
state->flags |= SS_OUTPUT_ENA;
control = exca_read_byte(slot, I365_INTCTL);
if (control & I365_PC_IOCARD)
state->flags |= SS_IOCARD;
if (!(control & I365_PC_RESET))
state->flags |= SS_RESET;
cscint = exca_read_byte(slot, I365_CSCINT);
state->csc_mask = 0;
if (state->flags & SS_IOCARD) {
if (cscint & I365_CSC_STSCHG)
state->flags |= SS_STSCHG;
} else {
if (cscint & I365_CSC_BVD1)
state->csc_mask |= SS_BATDEAD;
if (cscint & I365_CSC_BVD2)
state->csc_mask |= SS_BATWARN;
}
if (cscint & I365_CSC_READY)
state->csc_mask |= SS_READY;
if (cscint & I365_CSC_DETECT)
state->csc_mask |= SS_DETECT;
return 0;
}
static inline uint8_t set_Vcc_value(u_char Vcc)
{
switch (Vcc) {
......@@ -551,7 +482,6 @@ static int pccard_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
static struct pccard_operations vrc4171_pccard_operations = {
.init = pccard_init,
.get_status = pccard_get_status,
.get_socket = pccard_get_socket,
.set_socket = pccard_set_socket,
.set_io_map = pccard_set_io_map,
.set_mem_map = pccard_set_mem_map,
......
......@@ -198,48 +198,6 @@ static int cardu_get_status(unsigned int sock, u_int *value)
return 0;
}
static inline u_char get_Vcc_value(uint8_t val)
{
switch (val & VCC_MASK) {
case VCC_3V:
return 33;
case VCC_5V:
return 50;
}
return 0;
}
static inline u_char get_Vpp_value(uint8_t val)
{
switch (val & VPP_MASK) {
case VPP_12V:
return 120;
case VPP_VCC:
return get_Vcc_value(val);
}
return 0;
}
static int cardu_get_socket(unsigned int sock, socket_state_t *state)
{
vrc4173_socket_t *socket = &cardu_sockets[sock];
uint8_t val;
val = exca_readb(socket, PWR_CNT);
state->Vcc = get_Vcc_value(val);
state->Vpp = get_Vpp_value(val);
state->flags = 0;
if (val & CARD_OUT_EN) state->flags |= SS_OUTPUT_ENA;
val = exca_readb(socket, INT_GEN_CNT);
if (!(val & CARD_REST0)) state->flags |= SS_RESET;
if (val & CARD_TYPE_IO) state->flags |= SS_IOCARD;
return 0;
}
static inline uint8_t set_Vcc_value(u_char Vcc)
{
switch (Vcc) {
......@@ -431,7 +389,6 @@ static struct pccard_operations cardu_operations = {
.register_callback = cardu_register_callback,
.inquire_socket = cardu_inquire_socket,
.get_status = cardu_get_status,
.get_socket = cardu_get_socket,
.set_socket = cardu_set_socket,
.get_io_map = cardu_get_io_map,
.set_io_map = cardu_set_io_map,
......
......@@ -224,95 +224,6 @@ static int yenta_get_status(struct pcmcia_socket *sock, unsigned int *value)
return 0;
}
static void yenta_get_power(struct yenta_socket *socket, socket_state_t *state)
{
if (!(cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) &&
(socket->flags & YENTA_16BIT_POWER_EXCA)) {
u8 reg, vcc, vpp;
reg = exca_readb(socket, I365_POWER);
vcc = reg & I365_VCC_MASK;
vpp = reg & I365_VPP1_MASK;
state->Vcc = state->Vpp = 0;
if (socket->flags & YENTA_16BIT_POWER_DF) {
if (vcc == I365_VCC_3V)
state->Vcc = 33;
if (vcc == I365_VCC_5V)
state->Vcc = 50;
if (vpp == I365_VPP1_5V)
state->Vpp = state->Vcc;
if (vpp == I365_VPP1_12V)
state->Vpp = 120;
} else {
if (reg & I365_VCC_5V) {
state->Vcc = 50;
if (vpp == I365_VPP1_5V)
state->Vpp = 50;
if (vpp == I365_VPP1_12V)
state->Vpp = 120;
}
}
} else {
u32 control;
control = cb_readl(socket, CB_SOCKET_CONTROL);
switch (control & CB_SC_VCC_MASK) {
case CB_SC_VCC_5V: state->Vcc = 50; break;
case CB_SC_VCC_3V: state->Vcc = 33; break;
default: state->Vcc = 0;
}
switch (control & CB_SC_VPP_MASK) {
case CB_SC_VPP_12V: state->Vpp = 120; break;
case CB_SC_VPP_5V: state->Vpp = 50; break;
case CB_SC_VPP_3V: state->Vpp = 33; break;
default: state->Vpp = 0;
}
}
}
static int yenta_get_socket(struct pcmcia_socket *sock, socket_state_t *state)
{
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
u8 reg;
u32 control;
control = cb_readl(socket, CB_SOCKET_CONTROL);
yenta_get_power(socket, state);
state->io_irq = socket->io_irq;
if (cb_readl(socket, CB_SOCKET_STATE) & CB_CBCARD) {
u16 bridge = config_readw(socket, CB_BRIDGE_CONTROL);
if (bridge & CB_BRIDGE_CRST)
state->flags |= SS_RESET;
return 0;
}
/* 16-bit card state.. */
reg = exca_readb(socket, I365_POWER);
state->flags = (reg & I365_PWR_AUTO) ? SS_PWR_AUTO : 0;
state->flags |= (reg & I365_PWR_OUT) ? SS_OUTPUT_ENA : 0;
reg = exca_readb(socket, I365_INTCTL);
state->flags |= (reg & I365_PC_RESET) ? 0 : SS_RESET;
state->flags |= (reg & I365_PC_IOCARD) ? SS_IOCARD : 0;
reg = exca_readb(socket, I365_CSCINT);
state->csc_mask = (reg & I365_CSC_DETECT) ? SS_DETECT : 0;
if (state->flags & SS_IOCARD) {
state->csc_mask |= (reg & I365_CSC_STSCHG) ? SS_STSCHG : 0;
} else {
state->csc_mask |= (reg & I365_CSC_BVD1) ? SS_BATDEAD : 0;
state->csc_mask |= (reg & I365_CSC_BVD2) ? SS_BATWARN : 0;
state->csc_mask |= (reg & I365_CSC_READY) ? SS_READY : 0;
}
return 0;
}
static void yenta_set_power(struct yenta_socket *socket, socket_state_t *state)
{
/* some birdges require to use the ExCA registers to power 16bit cards */
......@@ -828,7 +739,6 @@ static struct pccard_operations yenta_socket_operations = {
.init = yenta_sock_init,
.suspend = yenta_sock_suspend,
.get_status = yenta_get_status,
.get_socket = yenta_get_socket,
.set_socket = yenta_set_socket,
.set_io_map = yenta_set_io_map,
.set_mem_map = yenta_set_mem_map,
......
......@@ -119,7 +119,6 @@ struct pccard_operations {
int (*init)(struct pcmcia_socket *sock);
int (*suspend)(struct pcmcia_socket *sock);
int (*get_status)(struct pcmcia_socket *sock, u_int *value);
int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
int (*set_io_map)(struct pcmcia_socket *sock, struct pccard_io_map *io);
int (*set_mem_map)(struct pcmcia_socket *sock, struct pccard_mem_map *mem);
......
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