Commit ec03a9f4 authored by Linus Torvalds's avatar Linus Torvalds

Merge bk://bk.arm.linux.org.uk/linux-2.6-pcmcia

into ppc970.osdl.org:/home/torvalds/v2.6/linux
parents 00f0340a 5c26f69d
......@@ -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;
......
......@@ -114,8 +114,6 @@ set_cis_map(struct pcmcia_socket *s, unsigned int card_offset, unsigned int flag
printk(KERN_NOTICE "cs: unable to map card memory!\n");
return NULL;
}
mem->sys_start = mem->res->start;
mem->sys_stop = mem->res->end;
s->cis_virt = ioremap(mem->res->start, s->map_size);
}
mem->card_start = card_offset;
......@@ -124,7 +122,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;
}
......
......@@ -1886,11 +1886,6 @@ int pcmcia_request_window(client_handle_t *handle, win_req_t *req, window_handle
(*handle)->dev_info, s);
if (!win->ctl.res)
return CS_IN_USE;
win->ctl.sys_start = win->ctl.res->start;
win->ctl.sys_stop = win->ctl.res->end;
} else {
win->ctl.sys_start = req->Base;
win->ctl.sys_stop = req->Base + req->Size - 1;
}
(*handle)->state |= CLIENT_WIN_REQ(w);
......@@ -1912,7 +1907,11 @@ 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;
} 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;
......
......@@ -422,7 +422,7 @@ static int i82092aa_init(struct pcmcia_socket *sock)
int i;
struct resource res = { .start = 0, .end = 0x0fff };
pccard_io_map io = { 0, 0, 0, 0, 1 };
pccard_mem_map mem = { .res = &res, .sys_stop = 0x0fff, };
pccard_mem_map mem = { .res = &res, };
enter("i82092aa_init");
......@@ -706,11 +706,15 @@ static int i82092aa_set_io_map(struct pcmcia_socket *socket, struct pccard_io_ma
static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_map *mem)
{
unsigned int sock = container_of(socket, struct socket_info, socket)->number;
struct socket_info *sock_info = container_of(socket, struct socket_info, socket);
unsigned int sock = sock_info->number;
struct pci_bus_region region;
unsigned short base, i;
unsigned char map;
enter("i82092aa_set_mem_map");
pcibios_resource_to_bus(sock_info->dev, &region, mem->res);
map = mem->map;
if (map > 4) {
......@@ -719,10 +723,10 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
}
if ( (mem->card_start > 0x3ffffff) || (mem->sys_start > mem->sys_stop) ||
if ( (mem->card_start > 0x3ffffff) || (region.start > region.end) ||
(mem->speed > 1000) ) {
leave("i82092aa_set_mem_map: invalid address / speed");
printk("invalid mem map for socket %i : %lx to %lx with a start of %x \n",sock,mem->sys_start, mem->sys_stop, mem->card_start);
printk("invalid mem map for socket %i : %lx to %lx with a start of %x \n",sock,region.start, region.end, mem->card_start);
return -EINVAL;
}
......@@ -731,11 +735,11 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
indirect_resetbit(sock, I365_ADDRWIN, I365_ENA_MEM(map));
/* printk("set_mem_map: Setting map %i range to %x - %x on socket %i, speed is %i, active = %i \n",map, mem->sys_start,mem->sys_stop,sock,mem->speed,mem->flags & MAP_ACTIVE); */
/* printk("set_mem_map: Setting map %i range to %x - %x on socket %i, speed is %i, active = %i \n",map, region.start,region.end,sock,mem->speed,mem->flags & MAP_ACTIVE); */
/* write the start address */
base = I365_MEM(map);
i = (mem->sys_start >> 12) & 0x0fff;
i = (region.start >> 12) & 0x0fff;
if (mem->flags & MAP_16BIT)
i |= I365_MEM_16BIT;
if (mem->flags & MAP_0WS)
......@@ -744,7 +748,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
/* write the stop address */
i= (mem->sys_stop >> 12) & 0x0fff;
i= (region.end >> 12) & 0x0fff;
switch (to_cycles(mem->speed)) {
case 0:
break;
......@@ -763,7 +767,7 @@ static int i82092aa_set_mem_map(struct pcmcia_socket *socket, struct pccard_mem_
/* card start */
i = ((mem->card_start - mem->sys_start) >> 12) & 0x3fff;
i = ((mem->card_start - region.start) >> 12) & 0x3fff;
if (mem->flags & MAP_WRPROT)
i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) {
......
......@@ -1159,13 +1159,13 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem)
debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, %#5.5lx-%#5.5"
"lx, %#5.5x)\n", sock, mem->map, mem->flags, mem->speed,
mem->sys_start, mem->sys_stop, mem->card_start);
mem->res->start, mem->res->end, mem->card_start);
map = mem->map;
if ((map > 4) || (mem->card_start > 0x3ffffff) ||
(mem->sys_start > mem->sys_stop) || (mem->speed > 1000))
(mem->res->start > mem->res->end) || (mem->speed > 1000))
return -EINVAL;
if ((mem->sys_start > 0xffffff) || (mem->sys_stop > 0xffffff))
if ((mem->res->start > 0xffffff) || (mem->res->end > 0xffffff))
return -EINVAL;
/* Turn off the window before changing anything */
......@@ -1173,12 +1173,12 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem)
i365_bclr(sock, I365_ADDRWIN, I365_ENA_MEM(map));
base = I365_MEM(map);
i = (mem->sys_start >> 12) & 0x0fff;
i = (mem->res->start >> 12) & 0x0fff;
if (mem->flags & MAP_16BIT) i |= I365_MEM_16BIT;
if (mem->flags & MAP_0WS) i |= I365_MEM_0WS;
i365_set_pair(sock, base+I365_W_START, i);
i = (mem->sys_stop >> 12) & 0x0fff;
i = (mem->res->end >> 12) & 0x0fff;
switch (to_cycles(mem->speed)) {
case 0: break;
case 1: i |= I365_MEM_WS0; break;
......@@ -1187,7 +1187,7 @@ static int i365_set_mem_map(u_short sock, struct pccard_mem_map *mem)
}
i365_set_pair(sock, base+I365_W_STOP, i);
i = ((mem->card_start - mem->sys_start) >> 12) & 0x3fff;
i = ((mem->card_start - mem->res->start) >> 12) & 0x3fff;
if (mem->flags & MAP_WRPROT) i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) i |= I365_MEM_REG;
i365_set_pair(sock, base+I365_W_OFF, i);
......@@ -1309,7 +1309,7 @@ static int pcic_init(struct pcmcia_socket *s)
int i;
struct resource res = { .start = 0, .end = 0x1000 };
pccard_io_map io = { 0, 0, 0, 0, 1 };
pccard_mem_map mem = { .res = &res, .sys_stop = 0x1000, };
pccard_mem_map mem = { .res = &res, };
for (i = 0; i < 2; i++) {
io.map = i;
......
......@@ -502,10 +502,10 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
return -EINVAL;
}
if ((mem->sys_start > mem->sys_stop) || (mem->speed > 1000)) {
if ((mem->res->start > mem->res->end) || (mem->speed > 1000)) {
printk("pd6729_set_mem_map: invalid address / speed");
/* printk("invalid mem map for socket %i : %lx to %lx with a start of %x\n",
sock, mem->sys_start, mem->sys_stop, mem->card_start); */
sock, mem->res->start, mem->res->end, mem->card_start); */
return -EINVAL;
}
......@@ -515,7 +515,7 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
/* write the start address */
base = I365_MEM(map);
i = (mem->sys_start >> 12) & 0x0fff;
i = (mem->res->start >> 12) & 0x0fff;
if (mem->flags & MAP_16BIT)
i |= I365_MEM_16BIT;
if (mem->flags & MAP_0WS)
......@@ -524,7 +524,7 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
/* write the stop address */
i= (mem->sys_stop >> 12) & 0x0fff;
i= (mem->res->end >> 12) & 0x0fff;
switch (to_cycles(mem->speed)) {
case 0:
break;
......@@ -543,11 +543,11 @@ static int pd6729_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map
/* Take care of high byte */
indirect_write(socket, PD67_EXT_INDEX, PD67_MEM_PAGE(map));
indirect_write(socket, PD67_EXT_DATA, mem->sys_start >> 24);
indirect_write(socket, PD67_EXT_DATA, mem->res->start >> 24);
/* card start */
i = ((mem->card_start - mem->sys_start) >> 12) & 0x3fff;
i = ((mem->card_start - mem->res->start) >> 12) & 0x3fff;
if (mem->flags & MAP_WRPROT)
i |= I365_MEM_WRPROT;
if (mem->flags & MAP_ATTRIB) {
......@@ -577,7 +577,7 @@ static int pd6729_init(struct pcmcia_socket *sock)
int i;
struct resource res = { .end = 0x0fff };
pccard_io_map io = { 0, 0, 0, 0, 1 };
pccard_mem_map mem = { .res = &res, .sys_stop = 0x0fff };
pccard_mem_map mem = { .res = &res, };
pd6729_set_socket(sock, &dead_socket);
for (i = 0; i < 2; i++) {
......
......@@ -301,8 +301,6 @@ static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *in
{
int ret = -1;
s->cis_mem.sys_start = res->start;
s->cis_mem.sys_stop = res->end;
s->cis_mem.res = res;
s->cis_virt = ioremap(res->start, s->map_size);
if (s->cis_virt) {
......@@ -312,8 +310,6 @@ static int readable(struct pcmcia_socket *s, struct resource *res, cisinfo_t *in
s->cis_virt = NULL;
destroy_cis_cache(s);
}
s->cis_mem.sys_start = 0;
s->cis_mem.sys_stop = 0;
s->cis_mem.res = NULL;
if ((ret != 0) || (info->Chains == 0))
return 0;
......@@ -332,8 +328,6 @@ static int checksum(struct pcmcia_socket *s, struct resource *res)
map.map = 0;
map.flags = MAP_ACTIVE;
map.speed = 0;
map.sys_start = res->start;
map.sys_stop = res->end;
map.res = res;
map.card_start = 0;
s->ops->set_mem_map(s, &map);
......
......@@ -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;
}
......@@ -662,6 +660,7 @@ static void soc_pcmcia_cpufreq_unregister(void)
int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops, int first, int nr)
{
struct skt_dev_info *sinfo;
struct soc_pcmcia_socket *skt;
int ret, i;
down(&soc_pcmcia_sockets_lock);
......@@ -679,7 +678,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
* Initialise the per-socket structure.
*/
for (i = 0; i < nr; i++) {
struct soc_pcmcia_socket *skt = &sinfo->skt[i];
skt = &sinfo->skt[i];
skt->socket.ops = &soc_common_pcmcia_operations;
skt->socket.owner = ops->owner;
......@@ -777,7 +776,7 @@ int soc_common_drv_pcmcia_probe(struct device *dev, struct pcmcia_low_level *ops
goto out;
do {
struct soc_pcmcia_socket *skt = &sinfo->skt[i];
skt = &sinfo->skt[i];
del_timer_sync(&skt->poll_timer);
pcmcia_unregister_socket(&skt->socket);
......
......@@ -829,15 +829,15 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m
debug(1, "SetMemMap(%d, %d, %#2.2x, %d ns, "
"%#5.5lx-%#5.5lx, %#5.5x)\n", psock, mem->map, mem->flags,
mem->speed, mem->sys_start, mem->sys_stop, mem->card_start);
mem->speed, mem->res->start, mem->res->end, mem->card_start);
if ((mem->map > 3) || (mem->card_start > 0x3ffffff) ||
(mem->sys_start > 0xffffff) || (mem->sys_stop > 0xffffff) ||
(mem->sys_start > mem->sys_stop) || (mem->speed > 1000))
(mem->res->start > 0xffffff) || (mem->res->end > 0xffffff) ||
(mem->res->start > mem->res->end) || (mem->speed > 1000))
return -EINVAL;
tcic_setw(TCIC_ADDR+2, TCIC_ADR2_INDREG | (psock << TCIC_SS_SHFT));
addr = TCIC_MWIN(psock, mem->map);
base = mem->sys_start; len = mem->sys_stop - mem->sys_start;
base = mem->res->start; len = mem->res->end - mem->res->start;
if ((len & (len+1)) || (base & len)) return -EINVAL;
if (len == 0x0fff)
base = (base >> TCIC_MBASE_HA_SHFT) | TCIC_MBASE_4K_BIT;
......@@ -846,7 +846,7 @@ static int tcic_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *m
tcic_setw(TCIC_ADDR, addr + TCIC_MBASE_X);
tcic_setw(TCIC_DATA, base);
mmap = mem->card_start - mem->sys_start;
mmap = mem->card_start - mem->res->start;
mmap = (mmap >> TCIC_MMAP_CA_SHFT) & TCIC_MMAP_CA_MASK;
if (mem->flags & MAP_ATTRIB) mmap |= TCIC_MMAP_REG;
tcic_setw(TCIC_ADDR, addr + TCIC_MMAP_X);
......@@ -870,7 +870,7 @@ static int tcic_init(struct pcmcia_socket *s)
int i;
struct resource res = { .start = 0, .end = 0x1000 };
pccard_io_map io = { 0, 0, 0, 0, 1 };
pccard_mem_map mem = { .res = &res, .sys_stop = 0x1000, };
pccard_mem_map mem = { .res = &res, };
for (i = 0; i < 2; i++) {
io.map = i;
......
......@@ -343,14 +343,17 @@ static int yenta_set_io_map(struct pcmcia_socket *sock, struct pccard_io_map *io
static int yenta_set_mem_map(struct pcmcia_socket *sock, struct pccard_mem_map *mem)
{
struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
struct pci_bus_region region;
int map;
unsigned char addr, enable;
unsigned int start, stop, card_start;
unsigned short word;
pcibios_resource_to_bus(socket->dev, &region, mem->res);
map = mem->map;
start = mem->sys_start;
stop = mem->sys_stop;
start = region.start;
stop = region.end;
card_start = mem->card_start;
if (map > 4 || start > stop || ((start ^ stop) >> 24) ||
......@@ -447,7 +450,7 @@ static void yenta_clear_maps(struct yenta_socket *socket)
int i;
struct resource res = { .start = 0, .end = 0x0fff };
pccard_io_map io = { 0, 0, 0, 0, 1 };
pccard_mem_map mem = { .res = &res, .sys_stop = 0x0fff, };
pccard_mem_map mem = { .res = &res, };
yenta_set_socket(&socket->socket, &dead_socket);
for (i = 0; i < 2; i++) {
......
......@@ -103,7 +103,7 @@ typedef struct pccard_mem_map {
u_char 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