b43: Always use block-I/O for the PIO data registers

On SDIO the PIO data register seems to be hardwired to LE. So
the MACCTL bit has no effect on the endianness.
So also use block-I/O for the last word of the packet. block-I/O is always LE.

Signed-off-by: Michael Buesch <mb@bu3sch.de>
Tested-by: Albert Herranz <albert_herranz@yahoo.es>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
This commit is contained in:
Michael Buesch 2009-09-23 18:51:21 +02:00 коммит произвёл John W. Linville
Родитель 1f08e84ff6
Коммит b96ab540c1
1 изменённых файлов: 38 добавлений и 22 удалений

Просмотреть файл

@ -340,10 +340,15 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q,
q->mmio_base + B43_PIO_TXDATA, q->mmio_base + B43_PIO_TXDATA,
sizeof(u16)); sizeof(u16));
if (data_len & 1) { if (data_len & 1) {
u8 tail[2] = { 0, };
/* Write the last byte. */ /* Write the last byte. */
ctl &= ~B43_PIO_TXCTL_WRITEHI; ctl &= ~B43_PIO_TXCTL_WRITEHI;
b43_piotx_write16(q, B43_PIO_TXCTL, ctl); b43_piotx_write16(q, B43_PIO_TXCTL, ctl);
b43_piotx_write16(q, B43_PIO_TXDATA, data[data_len - 1]); tail[0] = data[data_len - 1];
ssb_block_write(dev->dev, tail, 2,
q->mmio_base + B43_PIO_TXDATA,
sizeof(u16));
} }
return ctl; return ctl;
@ -386,26 +391,31 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q,
q->mmio_base + B43_PIO8_TXDATA, q->mmio_base + B43_PIO8_TXDATA,
sizeof(u32)); sizeof(u32));
if (data_len & 3) { if (data_len & 3) {
u32 value = 0; u8 tail[4] = { 0, };
/* Write the last few bytes. */ /* Write the last few bytes. */
ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 | ctl &= ~(B43_PIO8_TXCTL_8_15 | B43_PIO8_TXCTL_16_23 |
B43_PIO8_TXCTL_24_31); B43_PIO8_TXCTL_24_31);
data = &(data[data_len - 1]);
switch (data_len & 3) { switch (data_len & 3) {
case 3: case 3:
ctl |= B43_PIO8_TXCTL_16_23; ctl |= B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_8_15;
value |= (u32)(*data) << 16; tail[0] = data[data_len - 3];
data--; tail[1] = data[data_len - 2];
tail[2] = data[data_len - 1];
break;
case 2: case 2:
ctl |= B43_PIO8_TXCTL_8_15; ctl |= B43_PIO8_TXCTL_8_15;
value |= (u32)(*data) << 8; tail[0] = data[data_len - 2];
data--; tail[1] = data[data_len - 1];
break;
case 1: case 1:
value |= (u32)(*data); tail[0] = data[data_len - 1];
break;
} }
b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); b43_piotx_write32(q, B43_PIO8_TXCTL, ctl);
b43_piotx_write32(q, B43_PIO8_TXDATA, value); ssb_block_write(dev->dev, tail, 4,
q->mmio_base + B43_PIO8_TXDATA,
sizeof(u32));
} }
return ctl; return ctl;
@ -693,21 +703,25 @@ data_ready:
q->mmio_base + B43_PIO8_RXDATA, q->mmio_base + B43_PIO8_RXDATA,
sizeof(u32)); sizeof(u32));
if (len & 3) { if (len & 3) {
u32 value; u8 tail[4] = { 0, };
char *data;
/* Read the last few bytes. */ /* Read the last few bytes. */
value = b43_piorx_read32(q, B43_PIO8_RXDATA); ssb_block_read(dev->dev, tail, 4,
data = &(skb->data[len + padding - 1]); q->mmio_base + B43_PIO8_RXDATA,
sizeof(u32));
switch (len & 3) { switch (len & 3) {
case 3: case 3:
*data = (value >> 16); skb->data[len + padding - 3] = tail[0];
data--; skb->data[len + padding - 2] = tail[1];
skb->data[len + padding - 1] = tail[2];
break;
case 2: case 2:
*data = (value >> 8); skb->data[len + padding - 2] = tail[0];
data--; skb->data[len + padding - 1] = tail[1];
break;
case 1: case 1:
*data = value; skb->data[len + padding - 1] = tail[0];
break;
} }
} }
} else { } else {
@ -715,11 +729,13 @@ data_ready:
q->mmio_base + B43_PIO_RXDATA, q->mmio_base + B43_PIO_RXDATA,
sizeof(u16)); sizeof(u16));
if (len & 1) { if (len & 1) {
u16 value; u8 tail[2] = { 0, };
/* Read the last byte. */ /* Read the last byte. */
value = b43_piorx_read16(q, B43_PIO_RXDATA); ssb_block_read(dev->dev, tail, 2,
skb->data[len + padding - 1] = value; q->mmio_base + B43_PIO_RXDATA,
sizeof(u16));
skb->data[len + padding - 1] = tail[0];
} }
} }