Commit 6fb31841 authored by Russell King's avatar Russell King

[PCMCIA] Use struct resource rather than sys_start/sys_stop

Convert 16-bit PCMCIA socket drivers to use the struct resource
rather than the sys_start and sys_stop members of pccard_mem_map.
parent 3788632d
......@@ -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);
......
......@@ -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) {
......
......@@ -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);
......
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