blob: 8d0e7584eafd4ce7075d8a860dcf0b5dc0b8b289 [file] [log] [blame]
Rafał Miłecki482f0532011-05-18 02:06:36 +02001/*
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łeckic0b4c002011-05-18 02:06:37 +020028static inline u16 b43_bus_ssb_read16(struct b43_bus_dev *dev, u16 offset)
29{
30 return ssb_read16(dev->sdev, offset);
31}
32static inline u32 b43_bus_ssb_read32(struct b43_bus_dev *dev, u16 offset)
33{
34 return ssb_read32(dev->sdev, offset);
35}
36static inline
37void b43_bus_ssb_write16(struct b43_bus_dev *dev, u16 offset, u16 value)
38{
39 ssb_write16(dev->sdev, offset, value);
40}
41static inline
42void b43_bus_ssb_write32(struct b43_bus_dev *dev, u16 offset, u32 value)
43{
44 ssb_write32(dev->sdev, offset, value);
45}
46static inline
47void 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}
52static inline
53void 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łecki482f0532011-05-18 02:06:36 +020059struct 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łeckic0b4c002011-05-18 02:06:37 +020066 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łeckia18c7152011-05-18 02:06:40 +020073 dev->dev = sdev->dev;
74 dev->dma_dev = sdev->dma_dev;
75 dev->irq = sdev->irq;
76
Rafał Miłeckic244e082011-05-18 02:06:41 +020077 dev->chip_id = sdev->bus->chip_id;
78 dev->chip_rev = sdev->bus->chip_rev;
79 dev->chip_pkg = sdev->bus->chip_package;
80
Rafał Miłecki05814832011-05-18 02:06:39 +020081 dev->bus_sprom = &sdev->bus->sprom;
82
Rafał Miłecki21d889d2011-05-18 02:06:38 +020083 dev->core_id = sdev->id.coreid;
84 dev->core_rev = sdev->id.revision;
85
Rafał Miłecki482f0532011-05-18 02:06:36 +020086 return dev;
87}