Rafał Miłecki | 482f053 | 2011-05-18 02:06:36 +0200 | [diff] [blame] | 1 | /* |
| 2 | |
| 3 | Broadcom B43 wireless driver |
| 4 | Bus abstraction layer |
| 5 | |
| 6 | This program is free software; you can redistribute it and/or modify |
| 7 | it under the terms of the GNU General Public License as published by |
| 8 | the Free Software Foundation; either version 2 of the License, or |
| 9 | (at your option) any later version. |
| 10 | |
| 11 | This program is distributed in the hope that it will be useful, |
| 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | GNU General Public License for more details. |
| 15 | |
| 16 | You should have received a copy of the GNU General Public License |
| 17 | along with this program; see the file COPYING. If not, write to |
| 18 | the Free Software Foundation, Inc., 51 Franklin Steet, Fifth Floor, |
| 19 | Boston, MA 02110-1301, USA. |
| 20 | |
| 21 | */ |
| 22 | |
| 23 | #include "b43.h" |
| 24 | #include "bus.h" |
| 25 | |
| 26 | |
| 27 | /* SSB */ |
Rafał Miłecki | c0b4c00 | 2011-05-18 02:06:37 +0200 | [diff] [blame] | 28 | static inline u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset) |
| 29 | { |
| 30 | return ssb_read16(dev->sdev, offset); |
| 31 | } |
| 32 | static inline u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset) |
| 33 | { |
| 34 | return ssb_read32(dev->sdev, offset); |
| 35 | } |
| 36 | static inline |
| 37 | void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value) |
| 38 | { |
| 39 | ssb_write16(dev->sdev, offset, value); |
| 40 | } |
| 41 | static inline |
| 42 | void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value) |
| 43 | { |
| 44 | ssb_write32(dev->sdev, offset, value); |
| 45 | } |
| 46 | static inline |
| 47 | void b43_bus_ssb_block_read(struct b43_bus_dev *dev, void *buffer, |
| 48 | size_t count, u16 offset, u8 reg_width) |
| 49 | { |
| 50 | ssb_block_read(dev->sdev, buffer, count, offset, reg_width); |
| 51 | } |
| 52 | static inline |
| 53 | void b43_bus_ssb_block_write(struct b43_bus_dev *dev, const void *buffer, |
| 54 | size_t count, u16 offset, u8 reg_width) |
| 55 | { |
| 56 | ssb_block_write(dev->sdev, buffer, count, offset, reg_width); |
| 57 | } |
| 58 | |
Rafał Miłecki | 482f053 | 2011-05-18 02:06:36 +0200 | [diff] [blame] | 59 | struct b43_bus_dev *b43_bus_dev_ssb_init(struct ssb_device *sdev) |
| 60 | { |
| 61 | struct b43_bus_dev *dev = kzalloc(sizeof(*dev), GFP_KERNEL); |
| 62 | |
| 63 | dev->bus_type = B43_BUS_SSB; |
| 64 | dev->sdev = sdev; |
| 65 | |
Rafał Miłecki | c0b4c00 | 2011-05-18 02:06:37 +0200 | [diff] [blame] | 66 | dev->read16 = b43_bus_ssb_read16; |
| 67 | dev->read32 = b43_bus_ssb_read32; |
| 68 | dev->write16 = b43_bus_ssb_write16; |
| 69 | dev->write32 = b43_bus_ssb_write32; |
| 70 | dev->block_read = b43_bus_ssb_block_read; |
| 71 | dev->block_write = b43_bus_ssb_block_write; |
| 72 | |
Rafał Miłecki | a18c715 | 2011-05-18 02:06:40 +0200 | [diff] [blame^] | 73 | dev->dev = sdev->dev; |
| 74 | dev->dma_dev = sdev->dma_dev; |
| 75 | dev->irq = sdev->irq; |
| 76 | |
Rafał Miłecki | 0581483 | 2011-05-18 02:06:39 +0200 | [diff] [blame] | 77 | dev->bus_sprom = &sdev->bus->sprom; |
| 78 | |
Rafał Miłecki | 21d889d | 2011-05-18 02:06:38 +0200 | [diff] [blame] | 79 | dev->core_id = sdev->id.coreid; |
| 80 | dev->core_rev = sdev->id.revision; |
| 81 | |
Rafał Miłecki | 482f053 | 2011-05-18 02:06:36 +0200 | [diff] [blame] | 82 | return dev; |
| 83 | } |