diff options
author | Rafał Miłecki <zajec5@gmail.com> | 2011-05-17 08:00:00 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-05-19 13:54:06 -0400 |
commit | 620d785ba9066d5436857ec8e7c104c7b1c467e1 (patch) | |
tree | 8a33af61bebee83ece4f0e930a3b2a19e275cc2a | |
parent | ac56703e0e790509963ee42cddebe706fbd3b74c (diff) |
b43: add helpers for block R/W ops
Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | drivers/net/wireless/b43/b43.h | 12 | ||||
-rw-r--r-- | drivers/net/wireless/b43/pio.c | 20 |
2 files changed, 22 insertions, 10 deletions
diff --git a/drivers/net/wireless/b43/b43.h b/drivers/net/wireless/b43/b43.h index fd69d6ae6b88..02eca1833e9b 100644 --- a/drivers/net/wireless/b43/b43.h +++ b/drivers/net/wireless/b43/b43.h | |||
@@ -897,6 +897,18 @@ static inline void b43_write32(struct b43_wldev *dev, u16 offset, u32 value) | |||
897 | ssb_write32(dev->sdev, offset, value); | 897 | ssb_write32(dev->sdev, offset, value); |
898 | } | 898 | } |
899 | 899 | ||
900 | static inline void b43_block_read(struct b43_wldev *dev, void *buffer, | ||
901 | size_t count, u16 offset, u8 reg_width) | ||
902 | { | ||
903 | ssb_block_read(dev->sdev, buffer, count, offset, reg_width); | ||
904 | } | ||
905 | |||
906 | static inline void b43_block_write(struct b43_wldev *dev, const void *buffer, | ||
907 | size_t count, u16 offset, u8 reg_width) | ||
908 | { | ||
909 | ssb_block_write(dev->sdev, buffer, count, offset, reg_width); | ||
910 | } | ||
911 | |||
900 | static inline bool b43_using_pio_transfers(struct b43_wldev *dev) | 912 | static inline bool b43_using_pio_transfers(struct b43_wldev *dev) |
901 | { | 913 | { |
902 | return dev->__using_pio_transfers; | 914 | return dev->__using_pio_transfers; |
diff --git a/drivers/net/wireless/b43/pio.c b/drivers/net/wireless/b43/pio.c index af0596d0faef..72ab94df7569 100644 --- a/drivers/net/wireless/b43/pio.c +++ b/drivers/net/wireless/b43/pio.c | |||
@@ -339,7 +339,7 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, | |||
339 | ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; | 339 | ctl |= B43_PIO_TXCTL_WRITELO | B43_PIO_TXCTL_WRITEHI; |
340 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); | 340 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); |
341 | 341 | ||
342 | ssb_block_write(dev->sdev, data, (data_len & ~1), | 342 | b43_block_write(dev, data, (data_len & ~1), |
343 | q->mmio_base + B43_PIO_TXDATA, | 343 | q->mmio_base + B43_PIO_TXDATA, |
344 | sizeof(u16)); | 344 | sizeof(u16)); |
345 | if (data_len & 1) { | 345 | if (data_len & 1) { |
@@ -351,7 +351,7 @@ static u16 tx_write_2byte_queue(struct b43_pio_txqueue *q, | |||
351 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); | 351 | b43_piotx_write16(q, B43_PIO_TXCTL, ctl); |
352 | tail[0] = data[data_len - 1]; | 352 | tail[0] = data[data_len - 1]; |
353 | tail[1] = 0; | 353 | tail[1] = 0; |
354 | ssb_block_write(dev->sdev, tail, 2, | 354 | b43_block_write(dev, tail, 2, |
355 | q->mmio_base + B43_PIO_TXDATA, | 355 | q->mmio_base + B43_PIO_TXDATA, |
356 | sizeof(u16)); | 356 | sizeof(u16)); |
357 | } | 357 | } |
@@ -393,7 +393,7 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, | |||
393 | B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31; | 393 | B43_PIO8_TXCTL_16_23 | B43_PIO8_TXCTL_24_31; |
394 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); | 394 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); |
395 | 395 | ||
396 | ssb_block_write(dev->sdev, data, (data_len & ~3), | 396 | b43_block_write(dev, data, (data_len & ~3), |
397 | q->mmio_base + B43_PIO8_TXDATA, | 397 | q->mmio_base + B43_PIO8_TXDATA, |
398 | sizeof(u32)); | 398 | sizeof(u32)); |
399 | if (data_len & 3) { | 399 | if (data_len & 3) { |
@@ -421,7 +421,7 @@ static u32 tx_write_4byte_queue(struct b43_pio_txqueue *q, | |||
421 | break; | 421 | break; |
422 | } | 422 | } |
423 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); | 423 | b43_piotx_write32(q, B43_PIO8_TXCTL, ctl); |
424 | ssb_block_write(dev->sdev, tail, 4, | 424 | b43_block_write(dev, tail, 4, |
425 | q->mmio_base + B43_PIO8_TXDATA, | 425 | q->mmio_base + B43_PIO8_TXDATA, |
426 | sizeof(u32)); | 426 | sizeof(u32)); |
427 | } | 427 | } |
@@ -657,11 +657,11 @@ data_ready: | |||
657 | 657 | ||
658 | /* Get the preamble (RX header) */ | 658 | /* Get the preamble (RX header) */ |
659 | if (q->rev >= 8) { | 659 | if (q->rev >= 8) { |
660 | ssb_block_read(dev->sdev, rxhdr, sizeof(*rxhdr), | 660 | b43_block_read(dev, rxhdr, sizeof(*rxhdr), |
661 | q->mmio_base + B43_PIO8_RXDATA, | 661 | q->mmio_base + B43_PIO8_RXDATA, |
662 | sizeof(u32)); | 662 | sizeof(u32)); |
663 | } else { | 663 | } else { |
664 | ssb_block_read(dev->sdev, rxhdr, sizeof(*rxhdr), | 664 | b43_block_read(dev, rxhdr, sizeof(*rxhdr), |
665 | q->mmio_base + B43_PIO_RXDATA, | 665 | q->mmio_base + B43_PIO_RXDATA, |
666 | sizeof(u16)); | 666 | sizeof(u16)); |
667 | } | 667 | } |
@@ -697,7 +697,7 @@ data_ready: | |||
697 | skb_reserve(skb, 2); | 697 | skb_reserve(skb, 2); |
698 | skb_put(skb, len + padding); | 698 | skb_put(skb, len + padding); |
699 | if (q->rev >= 8) { | 699 | if (q->rev >= 8) { |
700 | ssb_block_read(dev->sdev, skb->data + padding, (len & ~3), | 700 | b43_block_read(dev, skb->data + padding, (len & ~3), |
701 | q->mmio_base + B43_PIO8_RXDATA, | 701 | q->mmio_base + B43_PIO8_RXDATA, |
702 | sizeof(u32)); | 702 | sizeof(u32)); |
703 | if (len & 3) { | 703 | if (len & 3) { |
@@ -705,7 +705,7 @@ data_ready: | |||
705 | BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4); | 705 | BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 4); |
706 | 706 | ||
707 | /* Read the last few bytes. */ | 707 | /* Read the last few bytes. */ |
708 | ssb_block_read(dev->sdev, tail, 4, | 708 | b43_block_read(dev, tail, 4, |
709 | q->mmio_base + B43_PIO8_RXDATA, | 709 | q->mmio_base + B43_PIO8_RXDATA, |
710 | sizeof(u32)); | 710 | sizeof(u32)); |
711 | switch (len & 3) { | 711 | switch (len & 3) { |
@@ -724,7 +724,7 @@ data_ready: | |||
724 | } | 724 | } |
725 | } | 725 | } |
726 | } else { | 726 | } else { |
727 | ssb_block_read(dev->sdev, skb->data + padding, (len & ~1), | 727 | b43_block_read(dev, skb->data + padding, (len & ~1), |
728 | q->mmio_base + B43_PIO_RXDATA, | 728 | q->mmio_base + B43_PIO_RXDATA, |
729 | sizeof(u16)); | 729 | sizeof(u16)); |
730 | if (len & 1) { | 730 | if (len & 1) { |
@@ -732,7 +732,7 @@ data_ready: | |||
732 | BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2); | 732 | BUILD_BUG_ON(sizeof(wl->pio_tailspace) < 2); |
733 | 733 | ||
734 | /* Read the last byte. */ | 734 | /* Read the last byte. */ |
735 | ssb_block_read(dev->sdev, tail, 2, | 735 | b43_block_read(dev, tail, 2, |
736 | q->mmio_base + B43_PIO_RXDATA, | 736 | q->mmio_base + B43_PIO_RXDATA, |
737 | sizeof(u16)); | 737 | sizeof(u16)); |
738 | skb->data[len + padding - 1] = tail[0]; | 738 | skb->data[len + padding - 1] = tail[0]; |