Commit e57a9192 authored by Russell King's avatar Russell King

[PCMCIA] Don't use sys_start for static-mapped sockets.

Add static_start element to pccard_mem_map - which is used by
statically mapped sockets to return the physical address which
should be used to access the memory region.
parent f2dbb513
......@@ -566,7 +566,6 @@ static int
au1000_pcmcia_set_mem_map(unsigned int sock, struct pccard_mem_map *map)
{
unsigned int speed;
unsigned long start;
u_long flags;
if(map->map>=MAX_WIN){
......@@ -588,25 +587,19 @@ au1000_pcmcia_set_mem_map(unsigned int sock, struct pccard_mem_map *map)
}
spin_lock_irqsave(&pcmcia_lock, flags);
start=map->sys_start;
if(map->sys_stop==0)
map->sys_stop=MAP_SIZE-1;
if (map->flags & MAP_ATTRIB) {
map->sys_start = pcmcia_socket[sock].phys_attr +
map->static_start = pcmcia_socket[sock].phys_attr +
map->card_start;
}
else {
map->sys_start = pcmcia_socket[sock].phys_mem +
map->static_start = pcmcia_socket[sock].phys_mem +
map->card_start;
}
map->sys_stop=map->sys_start+(map->sys_stop-start);
pcmcia_socket[sock].mem_map[map->map]=*map;
spin_unlock_irqrestore(&pcmcia_lock, flags);
debug(3, "set_mem_map %d start %x stop %x card_start %x\n",
map->map, map->sys_start, map->sys_stop,
debug(3, "set_mem_map %d start %x card_start %x\n",
map->map, map->static_start,
map->card_start);
return 0;
......
......@@ -124,7 +124,7 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
if (s->features & SS_CAP_STATIC_MAP) {
if (s->cis_virt)
iounmap(s->cis_virt);
s->cis_virt = ioremap(mem->sys_start, s->map_size);
s->cis_virt = ioremap(mem->static_start, s->map_size);
}
return s->cis_virt;
}
......
......@@ -1912,7 +1912,13 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
s->state |= SOCKET_WIN_REQ(w);
/* Return window handle */
req->Base = win->ctl.sys_start;
if (s->features & SS_CAP_STATIC_MAP) {
req->Base = win->ctl.static_start;
win->ctl.sys_start = req->Base;
win->ctl.sys_stop = req->Base + req->Size - 1;
} else {
req->Base = win->ctl.res->start;
}
*wh = win;
return CS_SUCCESS;
......
......@@ -636,19 +636,17 @@ static int hs_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem)
hs_socket_t *sp = container_of(s, struct hs_socket_t, socket);
struct pccard_mem_map *smem;
int map = mem->map;
unsigned long paddr, size;
unsigned long paddr;
#if 0
DPRINTK("hs_set_mem_map(sock=%d, map=%d, flags=0x%x, sys_start=0x%08lx, sys_end=0x%08lx, card_start=0x%08x)\n",
sock, map, mem->flags, mem->sys_start, mem->sys_stop, mem->card_start);
DPRINTK("hs_set_mem_map(sock=%d, map=%d, flags=0x%x, card_start=0x%08x)\n",
sock, map, mem->flags, mem->card_start);
#endif
if (map >= MAX_WIN)
return -EINVAL;
smem = &sp->mem_maps[map];
size = mem->sys_stop - mem->sys_start + 1;
paddr = sp->mem_base; /* base of Attribute mapping */
if (!(mem->flags & MAP_ATTRIB))
paddr += HD64465_PCC_WINDOW; /* base of Common mapping */
......@@ -660,8 +658,7 @@ static int hs_set_mem_map(struct pcmcia_socket *s, struct pccard_mem_map *mem)
* queries our fixed mapping. I wish this fact had been
* documented - Greg Banks.
*/
mem->sys_start = paddr;
mem->sys_stop = paddr + size - 1;
mem->static_start = paddr;
*smem = *mem;
......
......@@ -448,9 +448,7 @@ soc_common_pcmcia_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
skt->ops->set_timing(skt);
map->sys_stop -= map->sys_start;
map->sys_stop += res->start + map->card_start;
map->sys_start = res->start + map->card_start;
map->static_start = res->start + map->card_start;
return 0;
}
......
......@@ -104,6 +104,7 @@ typedef struct pccard_mem_map {
u_char flags;
u_short speed;
u_long sys_start, sys_stop;
u_long static_start;
u_int card_start;
struct resource *res;
} pccard_mem_map;
......
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