bus.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. Broadcom B43 wireless driver
  3. Bus abstraction layer
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; see the file COPYING. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include "b43.h"
  18. #include "bus.h"
  19. /* SSB */
  20. static inline u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset)
  21. {
  22. return ssb_read16(dev->sdev, offset);
  23. }
  24. static inline u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset)
  25. {
  26. return ssb_read32(dev->sdev, offset);
  27. }
  28. static inline
  29. void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
  30. {
  31. ssb_write16(dev->sdev, offset, value);
  32. }
  33. static inline
  34. void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
  35. {
  36. ssb_write32(dev->sdev, offset, value);
  37. }
  38. static inline
  39. void b43_bus_ssb_block_read(struct b43_bus_dev *dev, void *buffer,
  40. size_t count, u16 offset, u8 reg_width)
  41. {
  42. ssb_block_read(dev->sdev, buffer, count, offset, reg_width);
  43. }
  44. static inline
  45. void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer,
  46. size_t count, u16 offset, u8 reg_width)
  47. {
  48. ssb_block_write(dev->sdev, buffer, count, offset, reg_width);
  49. }
  50. struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev)
  51. {
  52. struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL);
  53. dev->bus_type = B43_BUS_SSB;
  54. dev->sdev = sdev;
  55. dev->read16 = b43_bus_ssb_read16;
  56. dev->read32 = b43_bus_ssb_read32;
  57. dev->write16 = b43_bus_ssb_write16;
  58. dev->write32 = b43_bus_ssb_write32;
  59. dev->block_read = b43_bus_ssb_block_read;
  60. dev->block_write = b43_bus_ssb_block_write;
  61. return dev;
  62. }