Commit b7949fda authored by Dominik Brodowski's avatar Dominik Brodowski Committed by Russell King

[PCMCIA] Remove inquire_socket

Remove the inquire_socket callback by moving the (static) capability
information to the top-level of struct pcmcia_socket.
parent 34438384
...@@ -169,7 +169,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void ...@@ -169,7 +169,7 @@ int read_cb_mem(struct pcmcia_socket * s, int space, u_int addr, u_int len, void
DEBUG(3, "cs: read_cb_mem(%d, %#x, %u)\n", space, addr, len); DEBUG(3, "cs: read_cb_mem(%d, %#x, %u)\n", space, addr, len);
dev = pci_find_slot(s->cap.cb_dev->subordinate->number, 0); dev = pci_find_slot(s->cb_dev->subordinate->number, 0);
if (!dev) if (!dev)
goto fail; goto fail;
...@@ -239,7 +239,7 @@ static void cardbus_assign_irqs(struct pci_bus *bus, int irq) ...@@ -239,7 +239,7 @@ static void cardbus_assign_irqs(struct pci_bus *bus, int irq)
int cb_alloc(struct pcmcia_socket * s) int cb_alloc(struct pcmcia_socket * s)
{ {
struct pci_bus *bus = s->cap.cb_dev->subordinate; struct pci_bus *bus = s->cb_dev->subordinate;
struct pci_dev *dev; struct pci_dev *dev;
unsigned int max, pass; unsigned int max, pass;
...@@ -258,17 +258,17 @@ int cb_alloc(struct pcmcia_socket * s) ...@@ -258,17 +258,17 @@ int cb_alloc(struct pcmcia_socket * s)
*/ */
pci_bus_size_bridges(bus); pci_bus_size_bridges(bus);
pci_bus_assign_resources(bus); pci_bus_assign_resources(bus);
cardbus_assign_irqs(bus, s->cap.pci_irq); cardbus_assign_irqs(bus, s->pci_irq);
pci_enable_bridges(bus); pci_enable_bridges(bus);
pci_bus_add_devices(bus); pci_bus_add_devices(bus);
s->irq.AssignedIRQ = s->cap.pci_irq; s->irq.AssignedIRQ = s->pci_irq;
return CS_SUCCESS; return CS_SUCCESS;
} }
void cb_free(struct pcmcia_socket * s) void cb_free(struct pcmcia_socket * s)
{ {
struct pci_dev *bridge = s->cap.cb_dev; struct pci_dev *bridge = s->cb_dev;
cb_release_cis_mem(s); cb_release_cis_mem(s);
......
...@@ -87,8 +87,8 @@ void release_cis_mem(struct pcmcia_socket *s) ...@@ -87,8 +87,8 @@ void release_cis_mem(struct pcmcia_socket *s)
if (s->cis_mem.sys_start != 0) { if (s->cis_mem.sys_start != 0) {
s->cis_mem.flags &= ~MAP_ACTIVE; s->cis_mem.flags &= ~MAP_ACTIVE;
s->ss_entry->set_mem_map(s, &s->cis_mem); s->ss_entry->set_mem_map(s, &s->cis_mem);
if (!(s->cap.features & SS_CAP_STATIC_MAP)) if (!(s->features & SS_CAP_STATIC_MAP))
release_mem_region(s->cis_mem.sys_start, s->cap.map_size); release_mem_region(s->cis_mem.sys_start, s->map_size);
iounmap(s->cis_virt); iounmap(s->cis_virt);
s->cis_mem.sys_start = 0; s->cis_mem.sys_start = 0;
s->cis_virt = NULL; s->cis_virt = NULL;
...@@ -104,26 +104,26 @@ static unsigned char * ...@@ -104,26 +104,26 @@ static unsigned char *
set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags) set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flags)
{ {
pccard_mem_map *mem = &s->cis_mem; pccard_mem_map *mem = &s->cis_mem;
if (!(s->cap.features & SS_CAP_STATIC_MAP) && if (!(s->features & SS_CAP_STATIC_MAP) &&
mem->sys_start == 0) { mem->sys_start == 0) {
int low = !(s->cap.features & SS_CAP_PAGE_REGS); int low = !(s->features & SS_CAP_PAGE_REGS);
validate_mem(s); validate_mem(s);
mem->sys_start = 0; mem->sys_start = 0;
if (find_mem_region(&mem->sys_start, s->cap.map_size, if (find_mem_region(&mem->sys_start, s->map_size,
s->cap.map_size, low, "card services", s)) { s->map_size, low, "card services", s)) {
printk(KERN_NOTICE "cs: unable to map card memory!\n"); printk(KERN_NOTICE "cs: unable to map card memory!\n");
return NULL; return NULL;
} }
mem->sys_stop = mem->sys_start+s->cap.map_size-1; mem->sys_stop = mem->sys_start+s->map_size-1;
s->cis_virt = ioremap(mem->sys_start, s->cap.map_size); s->cis_virt = ioremap(mem->sys_start, s->map_size);
} }
mem->card_start = card_offset; mem->card_start = card_offset;
mem->flags = flags; mem->flags = flags;
s->ss_entry->set_mem_map(s, mem); s->ss_entry->set_mem_map(s, mem);
if (s->cap.features & SS_CAP_STATIC_MAP) { if (s->features & SS_CAP_STATIC_MAP) {
if (s->cis_virt) if (s->cis_virt)
iounmap(s->cis_virt); iounmap(s->cis_virt);
s->cis_virt = ioremap(mem->sys_start, s->cap.map_size); s->cis_virt = ioremap(mem->sys_start, s->map_size);
} }
return s->cis_virt; return s->cis_virt;
} }
...@@ -178,21 +178,21 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, ...@@ -178,21 +178,21 @@ int read_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
addr *= 2; addr *= 2;
} }
card_offset = addr & ~(s->cap.map_size-1); card_offset = addr & ~(s->map_size-1);
while (len) { while (len) {
sys = set_cis_map(s, card_offset, flags); sys = set_cis_map(s, card_offset, flags);
if (!sys) { if (!sys) {
memset(ptr, 0xff, len); memset(ptr, 0xff, len);
return -1; return -1;
} }
end = sys + s->cap.map_size; end = sys + s->map_size;
sys = sys + (addr & (s->cap.map_size-1)); sys = sys + (addr & (s->map_size-1));
for ( ; len > 0; len--, buf++, sys += inc) { for ( ; len > 0; len--, buf++, sys += inc) {
if (sys == end) if (sys == end)
break; break;
*buf = readb(sys); *buf = readb(sys);
} }
card_offset += s->cap.map_size; card_offset += s->map_size;
addr = 0; addr = 0;
} }
} }
...@@ -239,20 +239,20 @@ void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr, ...@@ -239,20 +239,20 @@ void write_cis_mem(struct pcmcia_socket *s, int attr, u_int addr,
addr *= 2; addr *= 2;
} }
card_offset = addr & ~(s->cap.map_size-1); card_offset = addr & ~(s->map_size-1);
while (len) { while (len) {
sys = set_cis_map(s, card_offset, flags); sys = set_cis_map(s, card_offset, flags);
if (!sys) if (!sys)
return; /* FIXME: error */ return; /* FIXME: error */
end = sys + s->cap.map_size; end = sys + s->map_size;
sys = sys + (addr & (s->cap.map_size-1)); sys = sys + (addr & (s->map_size-1));
for ( ; len > 0; len--, buf++, sys += inc) { for ( ; len > 0; len--, buf++, sys += inc) {
if (sys == end) if (sys == end)
break; break;
writeb(*buf, sys); writeb(*buf, sys);
} }
card_offset += s->cap.map_size; card_offset += s->map_size;
addr = 0; addr = 0;
} }
} }
...@@ -418,7 +418,7 @@ int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple) ...@@ -418,7 +418,7 @@ int pcmcia_get_first_tuple(client_handle_t handle, tuple_t *tuple)
tuple->TupleLink = tuple->Flags = 0; tuple->TupleLink = tuple->Flags = 0;
#ifdef CONFIG_CARDBUS #ifdef CONFIG_CARDBUS
if (s->state & SOCKET_CARDBUS) { if (s->state & SOCKET_CARDBUS) {
struct pci_dev *dev = s->cap.cb_dev; struct pci_dev *dev = s->cb_dev;
u_int ptr; u_int ptr;
pci_bus_read_config_dword(dev->subordinate, 0, PCI_CARDBUS_CIS, &ptr); pci_bus_read_config_dword(dev->subordinate, 0, PCI_CARDBUS_CIS, &ptr);
tuple->CISOffset = ptr & ~7; tuple->CISOffset = ptr & ~7;
......
...@@ -352,7 +352,6 @@ static int pcmcia_add_socket(struct class_device *class_dev) ...@@ -352,7 +352,6 @@ static int pcmcia_add_socket(struct class_device *class_dev)
spin_lock_init(&socket->lock); spin_lock_init(&socket->lock);
init_socket(socket); init_socket(socket);
socket->ss_entry->inquire_socket(socket, &socket->cap);
init_completion(&socket->thread_done); init_completion(&socket->thread_done);
init_waitqueue_head(&socket->thread_wait); init_waitqueue_head(&socket->thread_wait);
...@@ -871,8 +870,8 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base, ...@@ -871,8 +870,8 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
*base, align); *base, align);
align = 0; align = 0;
} }
if ((s->cap.features & SS_CAP_STATIC_MAP) && s->cap.io_offset) { if ((s->features & SS_CAP_STATIC_MAP) && s->io_offset) {
*base = s->cap.io_offset | (*base & 0x0fff); *base = s->io_offset | (*base & 0x0fff);
return 0; return 0;
} }
/* Check for an already-allocated window that must conflict with /* Check for an already-allocated window that must conflict with
...@@ -919,7 +918,7 @@ static void release_io_space(struct pcmcia_socket *s, ioaddr_t base, ...@@ -919,7 +918,7 @@ static void release_io_space(struct pcmcia_socket *s, ioaddr_t base,
ioaddr_t num) ioaddr_t num)
{ {
int i; int i;
if(!(s->cap.features & SS_CAP_STATIC_MAP)) if(!(s->features & SS_CAP_STATIC_MAP))
release_region(base, num); release_region(base, num);
for (i = 0; i < MAX_IO_WIN; i++) { for (i = 0; i < MAX_IO_WIN; i++) {
if ((s->io[i].BasePort <= base) && if ((s->io[i].BasePort <= base) &&
...@@ -1136,7 +1135,7 @@ int pcmcia_get_configuration_info(client_handle_t handle, ...@@ -1136,7 +1135,7 @@ int pcmcia_get_configuration_info(client_handle_t handle,
config->Function = fn; config->Function = fn;
config->Vcc = s->socket.Vcc; config->Vcc = s->socket.Vcc;
config->Vpp1 = config->Vpp2 = s->socket.Vpp; config->Vpp1 = config->Vpp2 = s->socket.Vpp;
config->Option = s->cap.cb_dev->subordinate->number; config->Option = s->cb_dev->subordinate->number;
if (s->state & SOCKET_CARDBUS_CONFIG) { if (s->state & SOCKET_CARDBUS_CONFIG) {
config->Attributes = CONF_VALID_CLIENT; config->Attributes = CONF_VALID_CLIENT;
config->IntType = INT_CARDBUS; config->IntType = INT_CARDBUS;
...@@ -1309,7 +1308,7 @@ struct pci_bus *pcmcia_lookup_bus(client_handle_t handle) ...@@ -1309,7 +1308,7 @@ struct pci_bus *pcmcia_lookup_bus(client_handle_t handle)
if (!(s->state & SOCKET_CARDBUS)) if (!(s->state & SOCKET_CARDBUS))
return NULL; return NULL;
return s->cap.cb_dev->subordinate; return s->cb_dev->subordinate;
} }
EXPORT_SYMBOL(pcmcia_lookup_bus); EXPORT_SYMBOL(pcmcia_lookup_bus);
...@@ -1681,7 +1680,7 @@ int pcmcia_release_irq(client_handle_t handle, irq_req_t *req) ...@@ -1681,7 +1680,7 @@ int pcmcia_release_irq(client_handle_t handle, irq_req_t *req)
} }
#ifdef CONFIG_PCMCIA_PROBE #ifdef CONFIG_PCMCIA_PROBE
if (req->AssignedIRQ != s->cap.pci_irq) if (req->AssignedIRQ != s->pci_irq)
undo_irq(req->Attributes, req->AssignedIRQ); undo_irq(req->Attributes, req->AssignedIRQ);
#endif #endif
...@@ -1706,7 +1705,7 @@ int pcmcia_release_window(window_handle_t win) ...@@ -1706,7 +1705,7 @@ int pcmcia_release_window(window_handle_t win)
s->state &= ~SOCKET_WIN_REQ(win->index); s->state &= ~SOCKET_WIN_REQ(win->index);
/* Release system memory */ /* Release system memory */
if(!(s->cap.features & SS_CAP_STATIC_MAP)) if(!(s->features & SS_CAP_STATIC_MAP))
release_mem_region(win->base, win->size); release_mem_region(win->base, win->size);
win->handle->state &= ~CLIENT_WIN_REQ(win->index); win->handle->state &= ~CLIENT_WIN_REQ(win->index);
...@@ -1931,22 +1930,22 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) ...@@ -1931,22 +1930,22 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
return CS_IN_USE; return CS_IN_USE;
/* Short cut: if there are no ISA interrupts, then it is PCI */ /* Short cut: if there are no ISA interrupts, then it is PCI */
if (!s->cap.irq_mask) { if (!s->irq_mask) {
irq = s->cap.pci_irq; irq = s->pci_irq;
ret = (irq) ? 0 : CS_IN_USE; ret = (irq) ? 0 : CS_IN_USE;
#ifdef CONFIG_PCMCIA_PROBE #ifdef CONFIG_PCMCIA_PROBE
} else if (s->irq.AssignedIRQ != 0) { } else if (s->irq.AssignedIRQ != 0) {
/* If the interrupt is already assigned, it must match */ /* If the interrupt is already assigned, it must match */
irq = s->irq.AssignedIRQ; irq = s->irq.AssignedIRQ;
if (req->IRQInfo1 & IRQ_INFO2_VALID) { if (req->IRQInfo1 & IRQ_INFO2_VALID) {
u_int mask = req->IRQInfo2 & s->cap.irq_mask; u_int mask = req->IRQInfo2 & s->irq_mask;
ret = ((mask >> irq) & 1) ? 0 : CS_BAD_ARGS; ret = ((mask >> irq) & 1) ? 0 : CS_BAD_ARGS;
} else } else
ret = ((req->IRQInfo1&IRQ_MASK) == irq) ? 0 : CS_BAD_ARGS; ret = ((req->IRQInfo1&IRQ_MASK) == irq) ? 0 : CS_BAD_ARGS;
} else { } else {
ret = CS_IN_USE; ret = CS_IN_USE;
if (req->IRQInfo1 & IRQ_INFO2_VALID) { if (req->IRQInfo1 & IRQ_INFO2_VALID) {
u_int try, mask = req->IRQInfo2 & s->cap.irq_mask; u_int try, mask = req->IRQInfo2 & s->irq_mask;
for (try = 0; try < 2; try++) { for (try = 0; try < 2; try++) {
for (irq = 0; irq < 32; irq++) for (irq = 0; irq < 32; irq++)
if ((mask >> irq) & 1) { if ((mask >> irq) & 1) {
...@@ -1967,7 +1966,7 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req) ...@@ -1967,7 +1966,7 @@ int pcmcia_request_irq(client_handle_t handle, irq_req_t *req)
if (request_irq(irq, req->Handler, if (request_irq(irq, req->Handler,
((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) || ((req->Attributes & IRQ_TYPE_DYNAMIC_SHARING) ||
(s->functions > 1) || (s->functions > 1) ||
(irq == s->cap.pci_irq)) ? SA_SHIRQ : 0, (irq == s->pci_irq)) ? SA_SHIRQ : 0,
handle->dev_info, req->Instance)) handle->dev_info, req->Instance))
return CS_IN_USE; return CS_IN_USE;
} }
...@@ -2005,13 +2004,13 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle ...@@ -2005,13 +2004,13 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
/* Window size defaults to smallest available */ /* Window size defaults to smallest available */
if (req->Size == 0) if (req->Size == 0)
req->Size = s->cap.map_size; req->Size = s->map_size;
align = (((s->cap.features & SS_CAP_MEM_ALIGN) || align = (((s->features & SS_CAP_MEM_ALIGN) ||
(req->Attributes & WIN_STRICT_ALIGN)) ? (req->Attributes & WIN_STRICT_ALIGN)) ?
req->Size : s->cap.map_size); req->Size : s->map_size);
if (req->Size & (s->cap.map_size-1)) if (req->Size & (s->map_size-1))
return CS_BAD_SIZE; return CS_BAD_SIZE;
if ((req->Base && (s->cap.features & SS_CAP_STATIC_MAP)) || if ((req->Base && (s->features & SS_CAP_STATIC_MAP)) ||
(req->Base & (align-1))) (req->Base & (align-1)))
return CS_BAD_BASE; return CS_BAD_BASE;
if (req->Base) if (req->Base)
...@@ -2031,10 +2030,10 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle ...@@ -2031,10 +2030,10 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
win->base = req->Base; win->base = req->Base;
win->size = req->Size; win->size = req->Size;
if (!(s->cap.features & SS_CAP_STATIC_MAP) && if (!(s->features & SS_CAP_STATIC_MAP) &&
find_mem_region(&win->base, win->size, align, find_mem_region(&win->base, win->size, align,
(req->Attributes & WIN_MAP_BELOW_1MB) || (req->Attributes & WIN_MAP_BELOW_1MB) ||
!(s->cap.features & SS_CAP_PAGE_REGS), !(s->features & SS_CAP_PAGE_REGS),
(*handle)->dev_info, s)) (*handle)->dev_info, s))
return CS_IN_USE; return CS_IN_USE;
(*handle)->state |= CLIENT_WIN_REQ(w); (*handle)->state |= CLIENT_WIN_REQ(w);
......
...@@ -68,7 +68,6 @@ static struct pccard_operations i82092aa_operations = { ...@@ -68,7 +68,6 @@ static struct pccard_operations i82092aa_operations = {
.init = i82092aa_init, .init = i82092aa_init,
.suspend = i82092aa_suspend, .suspend = i82092aa_suspend,
.register_callback = i82092aa_register_callback, .register_callback = i82092aa_register_callback,
.inquire_socket = i82092aa_inquire_socket,
.get_status = i82092aa_get_status, .get_status = i82092aa_get_status,
.get_socket = i82092aa_get_socket, .get_socket = i82092aa_get_socket,
.set_socket = i82092aa_set_socket, .set_socket = i82092aa_set_socket,
...@@ -85,7 +84,6 @@ struct socket_info { ...@@ -85,7 +84,6 @@ struct socket_info {
2 = card but not initialized, 2 = card but not initialized,
3 = operational card */ 3 = operational card */
int io_base; /* base io address of the socket */ int io_base; /* base io address of the socket */
socket_cap_t cap;
unsigned int pending_events; /* Pending events on this interface */ unsigned int pending_events; /* Pending events on this interface */
...@@ -140,10 +138,10 @@ static int __init i82092aa_pci_probe(struct pci_dev *dev, const struct pci_devic ...@@ -140,10 +138,10 @@ static int __init i82092aa_pci_probe(struct pci_dev *dev, const struct pci_devic
for (i = 0;i<socket_count;i++) { for (i = 0;i<socket_count;i++) {
sockets[i].card_state = 1; /* 1 = present but empty */ sockets[i].card_state = 1; /* 1 = present but empty */
sockets[i].io_base = pci_resource_start(dev, 0); sockets[i].io_base = pci_resource_start(dev, 0);
sockets[i].cap.features |= SS_CAP_PCCARD; sockets[i].socket.features |= SS_CAP_PCCARD;
sockets[i].cap.map_size = 0x1000; sockets[i].socket.map_size = 0x1000;
sockets[i].cap.irq_mask = 0; sockets[i].socket.irq_mask = 0;
sockets[i].cap.pci_irq = dev->irq; sockets[i].socket.pci_irq = dev->irq;
sockets[i].number = i; sockets[i].number = i;
...@@ -487,16 +485,6 @@ static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handl ...@@ -487,16 +485,6 @@ static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handl
return 0; return 0;
} /* i82092aa_register_callback */ } /* i82092aa_register_callback */
static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap)
{
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
enter("i82092aa_inquire_socket");
*cap = sockets[sock].cap;
leave("i82092aa_inquire_socket");
return 0;
} /* i82092aa_inquire_socket */
static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value) static int i82092aa_get_status(struct pcmcia_socket *socket, u_int *value)
{ {
unsigned int sock = container_of(socket, struct socket_info, socket)->number; unsigned int sock = container_of(socket, struct socket_info, socket)->number;
......
...@@ -36,7 +36,6 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_ ...@@ -36,7 +36,6 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
static int i82092aa_init(struct pcmcia_socket *socket); static int i82092aa_init(struct pcmcia_socket *socket);
static int i82092aa_suspend(struct pcmcia_socket *socket); static int i82092aa_suspend(struct pcmcia_socket *socket);
static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info); static int i82092aa_register_callback(struct pcmcia_socket *socket, void (*handler)(void *, unsigned int), void * info);
static int i82092aa_inquire_socket(struct pcmcia_socket *socket, socket_cap_t *cap);
#endif #endif
...@@ -161,7 +161,6 @@ struct i82365_socket { ...@@ -161,7 +161,6 @@ struct i82365_socket {
u_short type, flags; u_short type, flags;
struct pcmcia_socket socket; struct pcmcia_socket socket;
unsigned int number; unsigned int number;
socket_cap_t cap;
ioaddr_t ioaddr; ioaddr_t ioaddr;
u_short psock; u_short psock;
u_char cs_irq, intr; u_char cs_irq, intr;
...@@ -758,9 +757,9 @@ static void __init add_pcic(int ns, int type) ...@@ -758,9 +757,9 @@ static void __init add_pcic(int ns, int type)
/* Update socket interrupt information, capabilities */ /* Update socket interrupt information, capabilities */
for (i = 0; i < ns; i++) { for (i = 0; i < ns; i++) {
t[i].cap.features |= SS_CAP_PCCARD; t[i].socket.features |= SS_CAP_PCCARD;
t[i].cap.map_size = 0x1000; t[i].socket.map_size = 0x1000;
t[i].cap.irq_mask = mask; t[i].socket.irq_mask = mask;
t[i].cs_irq = isa_irq; t[i].cs_irq = isa_irq;
} }
...@@ -907,7 +906,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev, ...@@ -907,7 +906,7 @@ static irqreturn_t pcic_interrupt(int irq, void *dev,
active = 0; active = 0;
for (i = 0; i < sockets; i++) { for (i = 0; i < sockets; i++) {
if ((socket[i].cs_irq != irq) && if ((socket[i].cs_irq != irq) &&
(socket[i].cap.pci_irq != irq)) (socket[i].socket.pci_irq != irq))
continue; continue;
handled = 1; handled = 1;
ISA_LOCK(i, flags); ISA_LOCK(i, flags);
...@@ -979,15 +978,6 @@ static int pcic_register_callback(struct pcmcia_socket *s, void (*handler)(void ...@@ -979,15 +978,6 @@ static int pcic_register_callback(struct pcmcia_socket *s, void (*handler)(void
/*====================================================================*/ /*====================================================================*/
static int pcic_inquire_socket(struct pcmcia_socket *s, socket_cap_t *cap)
{
unsigned int sock = container_of(s, struct i82365_socket, socket)->number;
*cap = socket[sock].cap;
return 0;
} /* pcic_inquire_socket */
/*====================================================================*/
static int i365_get_status(u_short sock, u_int *value) static int i365_get_status(u_short sock, u_int *value)
{ {
u_int status; u_int status;
...@@ -1109,7 +1099,7 @@ static int i365_set_socket(u_short sock, socket_state_t *state) ...@@ -1109,7 +1099,7 @@ static int i365_set_socket(u_short sock, socket_state_t *state)
/* IO card, RESET flag, IO interrupt */ /* IO card, RESET flag, IO interrupt */
reg = t->intr; reg = t->intr;
if (state->io_irq != t->cap.pci_irq) reg |= state->io_irq; if (state->io_irq != t->socket.pci_irq) reg |= state->io_irq;
reg |= (state->flags & SS_RESET) ? 0 : I365_PC_RESET; reg |= (state->flags & SS_RESET) ? 0 : I365_PC_RESET;
reg |= (state->flags & SS_IOCARD) ? I365_PC_IOCARD : 0; reg |= (state->flags & SS_IOCARD) ? I365_PC_IOCARD : 0;
i365_set(sock, I365_INTCTL, reg); i365_set(sock, I365_INTCTL, reg);
...@@ -1414,7 +1404,6 @@ static struct pccard_operations pcic_operations = { ...@@ -1414,7 +1404,6 @@ static struct pccard_operations pcic_operations = {
.init = pcic_init, .init = pcic_init,
.suspend = pcic_suspend, .suspend = pcic_suspend,
.register_callback = pcic_register_callback, .register_callback = pcic_register_callback,
.inquire_socket = pcic_inquire_socket,
.get_status = pcic_get_status, .get_status = pcic_get_status,
.get_socket = pcic_get_socket, .get_socket = pcic_get_socket,
.set_socket = pcic_set_socket, .set_socket = pcic_set_socket,
......
...@@ -345,17 +345,17 @@ static int cis_readable(struct pcmcia_socket *s, u_long base) ...@@ -345,17 +345,17 @@ static int cis_readable(struct pcmcia_socket *s, u_long base)
cisinfo_t info1, info2; cisinfo_t info1, info2;
int ret; int ret;
s->cis_mem.sys_start = base; s->cis_mem.sys_start = base;
s->cis_mem.sys_stop = base+s->cap.map_size-1; s->cis_mem.sys_stop = base+s->map_size-1;
s->cis_virt = ioremap(base, s->cap.map_size); s->cis_virt = ioremap(base, s->map_size);
ret = pcmcia_validate_cis(s->clients, &info1); ret = pcmcia_validate_cis(s->clients, &info1);
/* invalidate mapping and CIS cache */ /* invalidate mapping and CIS cache */
iounmap(s->cis_virt); iounmap(s->cis_virt);
destroy_cis_cache(s); destroy_cis_cache(s);
if ((ret != 0) || (info1.Chains == 0)) if ((ret != 0) || (info1.Chains == 0))
return 0; return 0;
s->cis_mem.sys_start = base+s->cap.map_size; s->cis_mem.sys_start = base+s->map_size;
s->cis_mem.sys_stop = base+2*s->cap.map_size-1; s->cis_mem.sys_stop = base+2*s->map_size-1;
s->cis_virt = ioremap(base+s->cap.map_size, s->cap.map_size); s->cis_virt = ioremap(base+s->map_size, s->map_size);
ret = pcmcia_validate_cis(s->clients, &info2); ret = pcmcia_validate_cis(s->clients, &info2);
iounmap(s->cis_virt); iounmap(s->cis_virt);
destroy_cis_cache(s); destroy_cis_cache(s);
...@@ -367,14 +367,14 @@ static int checksum(struct pcmcia_socket *s, u_long base) ...@@ -367,14 +367,14 @@ static int checksum(struct pcmcia_socket *s, u_long base)
{ {
int i, a, b, d; int i, a, b, d;
s->cis_mem.sys_start = base; s->cis_mem.sys_start = base;
s->cis_mem.sys_stop = base+s->cap.map_size-1; s->cis_mem.sys_stop = base+s->map_size-1;
s->cis_virt = ioremap(base, s->cap.map_size); s->cis_virt = ioremap(base, s->map_size);
s->cis_mem.card_start = 0; s->cis_mem.card_start = 0;
s->cis_mem.flags = MAP_ACTIVE; s->cis_mem.flags = MAP_ACTIVE;
s->ss_entry->set_mem_map(s, &s->cis_mem); s->ss_entry->set_mem_map(s, &s->cis_mem);
/* Don't bother checking every word... */ /* Don't bother checking every word... */
a = 0; b = -1; a = 0; b = -1;
for (i = 0; i < s->cap.map_size; i += 44) { for (i = 0; i < s->map_size; i += 44) {
d = readl(s->cis_virt+i); d = readl(s->cis_virt+i);
a += d; b &= d; a += d; b &= d;
} }
...@@ -384,7 +384,7 @@ static int checksum(struct pcmcia_socket *s, u_long base) ...@@ -384,7 +384,7 @@ static int checksum(struct pcmcia_socket *s, u_long base)
static int checksum_match(struct pcmcia_socket *s, u_long base) static int checksum_match(struct pcmcia_socket *s, u_long base)
{ {
int a = checksum(s, base), b = checksum(s, base+s->cap.map_size); int a = checksum(s, base), b = checksum(s, base+s->map_size);
return ((a == b) && (a >= 0)); return ((a == b) && (a >= 0));
} }
...@@ -405,19 +405,19 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s) ...@@ -405,19 +405,19 @@ static int do_mem_probe(u_long base, u_long num, struct pcmcia_socket *s)
bad = fail = 0; bad = fail = 0;
step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff); step = (num < 0x20000) ? 0x2000 : ((num>>4) & ~0x1fff);
/* cis_readable wants to map 2x map_size */ /* cis_readable wants to map 2x map_size */
if (step < 2 * s->cap.map_size) if (step < 2 * s->map_size)
step = 2 * s->cap.map_size; step = 2 * s->map_size;
for (i = j = base; i < base+num; i = j + step) { for (i = j = base; i < base+num; i = j + step) {
if (!fail) { if (!fail) {
for (j = i; j < base+num; j += step) for (j = i; j < base+num; j += step)
if ((check_mem_resource(j, step, s->cap.cb_dev) == 0) && if ((check_mem_resource(j, step, s->cb_dev) == 0) &&
cis_readable(s, j)) cis_readable(s, j))
break; break;
fail = ((i == base) && (j == base+num)); fail = ((i == base) && (j == base+num));
} }
if (fail) { if (fail) {
for (j = i; j < base+num; j += 2*step) for (j = i; j < base+num; j += 2*step)
if ((check_mem_resource(j, 2*step, s->cap.cb_dev) == 0) && if ((check_mem_resource(j, 2*step, s->cb_dev) == 0) &&
checksum_match(s, j) && checksum_match(s, j + step)) checksum_match(s, j) && checksum_match(s, j + step))
break; break;
} }
...@@ -456,7 +456,7 @@ void validate_mem(struct pcmcia_socket *s) ...@@ -456,7 +456,7 @@ void validate_mem(struct pcmcia_socket *s)
static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 }; static u_char order[] = { 0xd0, 0xe0, 0xc0, 0xf0 };
static int hi = 0, lo = 0; static int hi = 0, lo = 0;
u_long b, i, ok = 0; u_long b, i, ok = 0;
int force_low = !(s->cap.features & SS_CAP_PAGE_REGS); int force_low = !(s->features & SS_CAP_PAGE_REGS);
if (!probe_mem) if (!probe_mem)
return; return;
...@@ -540,7 +540,7 @@ int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align, ...@@ -540,7 +540,7 @@ int find_io_region(ioaddr_t *base, ioaddr_t num, ioaddr_t align,
for (try = (try >= m->base) ? try : try+align; for (try = (try >= m->base) ? try : try+align;
(try >= m->base) && (try+num <= m->base+m->num); (try >= m->base) && (try+num <= m->base+m->num);
try += align) { try += align) {
if (request_io_resource(try, num, name, s->cap.cb_dev) == 0) { if (request_io_resource(try, num, name, s->cb_dev) == 0) {
*base = try; *base = try;
ret = 0; ret = 0;
goto out; goto out;
...@@ -572,7 +572,7 @@ int find_mem_region(u_long *base, u_long num, u_long align, ...@@ -572,7 +572,7 @@ int find_mem_region(u_long *base, u_long num, u_long align,
for (try = (try >= m->base) ? try : try+align; for (try = (try >= m->base) ? try : try+align;
(try >= m->base) && (try+num <= m->base+m->num); (try >= m->base) && (try+num <= m->base+m->num);
try += align) { try += align) {
if (request_mem_resource(try, num, name, s->cap.cb_dev) == 0) { if (request_mem_resource(try, num, name, s->cb_dev) == 0) {
*base = try; *base = try;
ret = 0; ret = 0;
goto out; goto out;
......
...@@ -129,14 +129,6 @@ static int tcic_timer_pending; ...@@ -129,14 +129,6 @@ static int tcic_timer_pending;
static int sockets; static int sockets;
static struct tcic_socket socket_table[2]; static struct tcic_socket socket_table[2];
static socket_cap_t tcic_cap = {
/* only 16-bit cards, memory windows must be size-aligned */
.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN,
.irq_mask = 0x4cf8, /* irq 14, 11, 10, 7, 6, 5, 4, 3 */
.map_size = 0x1000, /* 4K minimum window size */
/* No PCI or CardBus support */
};
/*====================================================================*/ /*====================================================================*/
/* Trick when selecting interrupts: the TCIC sktirq pin is supposed /* Trick when selecting interrupts: the TCIC sktirq pin is supposed
...@@ -444,6 +436,14 @@ static int __init init_tcic(void) ...@@ -444,6 +436,14 @@ static int __init init_tcic(void)
socket_table[sockets].handler = NULL; socket_table[sockets].handler = NULL;
socket_table[sockets].info = NULL; socket_table[sockets].info = NULL;
socket_table[sockets].id = get_tcic_id(); socket_table[sockets].id = get_tcic_id();
/* only 16-bit cards, memory windows must be size-aligned */
/* No PCI or CardBus support */
socket_table[sockets].socket.features = SS_CAP_PCCARD | SS_CAP_MEM_ALIGN;
/* irq 14, 11, 10, 7, 6, 5, 4, 3 */
socket_table[sockets].socket.irq_mask = 0x4cf8;
/* 4K minimum window size */
socket_table[sockets].socket.map_size = 0x1000;
sockets++; sockets++;
} }
...@@ -478,11 +478,13 @@ static int __init init_tcic(void) ...@@ -478,11 +478,13 @@ static int __init init_tcic(void)
else else
for (i = mask = 0; i < 16; i++) for (i = mask = 0; i < 16; i++)
mask |= (1<<irq_list[i]); mask |= (1<<irq_list[i]);
mask &= tcic_cap.irq_mask;
/* irq 14, 11, 10, 7, 6, 5, 4, 3 */
mask &= 0x4cf8;
/* Scan interrupts */ /* Scan interrupts */
mask = irq_scan(mask); mask = irq_scan(mask);
tcic_cap.irq_mask = mask; for (i=0;i<sockets;i++)
socket_table[i].socket.irq_mask = mask;
/* Check for only two interrupts available */ /* Check for only two interrupts available */
scan = (mask & (mask-1)); scan = (mask & (mask-1));
...@@ -501,7 +503,7 @@ static int __init init_tcic(void) ...@@ -501,7 +503,7 @@ static int __init init_tcic(void)
if (cs_irq == 0) poll_interval = HZ; if (cs_irq == 0) poll_interval = HZ;
} }
if (tcic_cap.irq_mask & (1 << 11)) if (socket_table[0].socket.irq_mask & (1 << 11))
printk("sktirq is irq 11, "); printk("sktirq is irq 11, ");
if (cs_irq != 0) if (cs_irq != 0)
printk("status change on irq %d\n", cs_irq); printk("status change on irq %d\n", cs_irq);
...@@ -679,14 +681,6 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value) ...@@ -679,14 +681,6 @@ static int tcic_get_status(struct pcmcia_socket *sock, u_int *value)
/*====================================================================*/ /*====================================================================*/
static int tcic_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
{
*cap = tcic_cap;
return 0;
} /* tcic_inquire_socket */
/*====================================================================*/
static int tcic_get_socket(struct pcmcia_socket *sock, socket_state_t *state) 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_short psock = container_of(sock, struct tcic_socket, socket)->psock;
...@@ -925,7 +919,6 @@ static struct pccard_operations tcic_operations = { ...@@ -925,7 +919,6 @@ static struct pccard_operations tcic_operations = {
.init = tcic_init, .init = tcic_init,
.suspend = tcic_suspend, .suspend = tcic_suspend,
.register_callback = tcic_register_callback, .register_callback = tcic_register_callback,
.inquire_socket = tcic_inquire_socket,
.get_status = tcic_get_status, .get_status = tcic_get_status,
.get_socket = tcic_get_socket, .get_socket = tcic_get_socket,
.set_socket = tcic_set_socket, .set_socket = tcic_set_socket,
......
...@@ -515,22 +515,13 @@ static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mas ...@@ -515,22 +515,13 @@ static unsigned int yenta_probe_irq(struct yenta_socket *socket, u32 isa_irq_mas
*/ */
static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask) static void yenta_get_socket_capabilities(struct yenta_socket *socket, u32 isa_irq_mask)
{ {
socket->cap.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS; socket->socket.features |= SS_CAP_PAGE_REGS | SS_CAP_PCCARD | SS_CAP_CARDBUS;
socket->cap.map_size = 0x1000; socket->socket.map_size = 0x1000;
socket->cap.pci_irq = socket->cb_irq; socket->socket.pci_irq = socket->cb_irq;
socket->cap.irq_mask = yenta_probe_irq(socket, isa_irq_mask); socket->socket.irq_mask = yenta_probe_irq(socket, isa_irq_mask);
socket->cap.cb_dev = socket->dev; socket->socket.cb_dev = socket->dev;
printk("Yenta IRQ list %04x, PCI irq%d\n", socket->cap.irq_mask, socket->cb_irq); printk("Yenta IRQ list %04x, PCI irq%d\n", socket->socket.irq_mask, socket->cb_irq);
}
static int yenta_inquire_socket(struct pcmcia_socket *sock, socket_cap_t *cap)
{
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
*cap = socket->cap;
return 0;
} }
...@@ -793,7 +784,6 @@ static struct pccard_operations yenta_socket_operations = { ...@@ -793,7 +784,6 @@ static struct pccard_operations yenta_socket_operations = {
.init = yenta_init, .init = yenta_init,
.suspend = yenta_suspend, .suspend = yenta_suspend,
.register_callback = yenta_register_callback, .register_callback = yenta_register_callback,
.inquire_socket = yenta_inquire_socket,
.get_status = yenta_get_status, .get_status = yenta_get_status,
.get_socket = yenta_get_socket, .get_socket = yenta_get_socket,
.set_socket = yenta_set_socket, .set_socket = yenta_set_socket,
......
...@@ -101,7 +101,6 @@ struct yenta_socket { ...@@ -101,7 +101,6 @@ struct yenta_socket {
void *base; void *base;
void (*handler)(void *, unsigned int); void (*handler)(void *, unsigned int);
void *info; void *info;
socket_cap_t cap;
spinlock_t event_lock; spinlock_t event_lock;
unsigned int events; unsigned int events;
struct work_struct tq_task; struct work_struct tq_task;
......
...@@ -52,16 +52,6 @@ ...@@ -52,16 +52,6 @@
#define SS_XVCARD 0x2000 #define SS_XVCARD 0x2000
#define SS_PENDING 0x4000 #define SS_PENDING 0x4000
/* for InquireSocket */
typedef struct socket_cap_t {
u_int features;
u_int irq_mask;
u_int map_size;
ioaddr_t io_offset;
u_char pci_irq;
struct pci_dev *cb_dev;
} socket_cap_t;
/* InquireSocket capabilities */ /* InquireSocket capabilities */
#define SS_CAP_PAGE_REGS 0x0001 #define SS_CAP_PAGE_REGS 0x0001
#define SS_CAP_VIRTUAL_BUS 0x0002 #define SS_CAP_VIRTUAL_BUS 0x0002
...@@ -133,7 +123,6 @@ struct pccard_operations { ...@@ -133,7 +123,6 @@ struct pccard_operations {
int (*init)(struct pcmcia_socket *sock); int (*init)(struct pcmcia_socket *sock);
int (*suspend)(struct pcmcia_socket *sock); int (*suspend)(struct pcmcia_socket *sock);
int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info); int (*register_callback)(struct pcmcia_socket *sock, void (*handler)(void *, unsigned int), void * info);
int (*inquire_socket)(struct pcmcia_socket *sock, socket_cap_t *cap);
int (*get_status)(struct pcmcia_socket *sock, u_int *value); int (*get_status)(struct pcmcia_socket *sock, u_int *value);
int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state); int (*get_socket)(struct pcmcia_socket *sock, socket_state_t *state);
int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state); int (*set_socket)(struct pcmcia_socket *sock, socket_state_t *state);
...@@ -183,7 +172,6 @@ struct pcmcia_socket { ...@@ -183,7 +172,6 @@ struct pcmcia_socket {
spinlock_t lock; spinlock_t lock;
struct pccard_operations * ss_entry; struct pccard_operations * ss_entry;
socket_state_t socket; socket_state_t socket;
socket_cap_t cap;
u_int state; u_int state;
u_short functions; u_short functions;
u_short lock_count; u_short lock_count;
...@@ -209,6 +197,15 @@ struct pcmcia_socket { ...@@ -209,6 +197,15 @@ struct pcmcia_socket {
/* deprecated */ /* deprecated */
unsigned int sock; /* socket number */ unsigned int sock; /* socket number */
/* socket capabilities */
u_int features;
u_int irq_mask;
u_int map_size;
ioaddr_t io_offset;
u_char pci_irq;
struct pci_dev * cb_dev;
/* state thread */ /* state thread */
struct semaphore skt_sem; /* protects socket h/w state */ struct semaphore skt_sem; /* protects socket h/w state */
......
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