ssb: Add support for 8bit register access
This adds support for 8bit wide register reads/writes. This is needed in order to support the gigabit ethernet core. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
这个提交包含在:
@@ -572,6 +572,19 @@ static inline int ssb_pci_assert_buspower(struct ssb_bus *bus)
|
||||
}
|
||||
#endif /* DEBUG */
|
||||
|
||||
static u8 ssb_pci_read8(struct ssb_device *dev, u16 offset)
|
||||
{
|
||||
struct ssb_bus *bus = dev->bus;
|
||||
|
||||
if (unlikely(ssb_pci_assert_buspower(bus)))
|
||||
return 0xFF;
|
||||
if (unlikely(bus->mapped_device != dev)) {
|
||||
if (unlikely(ssb_pci_switch_core(bus, dev)))
|
||||
return 0xFF;
|
||||
}
|
||||
return ioread8(bus->mmio + offset);
|
||||
}
|
||||
|
||||
static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset)
|
||||
{
|
||||
struct ssb_bus *bus = dev->bus;
|
||||
@@ -598,6 +611,19 @@ static u32 ssb_pci_read32(struct ssb_device *dev, u16 offset)
|
||||
return ioread32(bus->mmio + offset);
|
||||
}
|
||||
|
||||
static void ssb_pci_write8(struct ssb_device *dev, u16 offset, u8 value)
|
||||
{
|
||||
struct ssb_bus *bus = dev->bus;
|
||||
|
||||
if (unlikely(ssb_pci_assert_buspower(bus)))
|
||||
return;
|
||||
if (unlikely(bus->mapped_device != dev)) {
|
||||
if (unlikely(ssb_pci_switch_core(bus, dev)))
|
||||
return;
|
||||
}
|
||||
iowrite8(value, bus->mmio + offset);
|
||||
}
|
||||
|
||||
static void ssb_pci_write16(struct ssb_device *dev, u16 offset, u16 value)
|
||||
{
|
||||
struct ssb_bus *bus = dev->bus;
|
||||
@@ -626,8 +652,10 @@ static void ssb_pci_write32(struct ssb_device *dev, u16 offset, u32 value)
|
||||
|
||||
/* Not "static", as it's used in main.c */
|
||||
const struct ssb_bus_ops ssb_pci_ops = {
|
||||
.read8 = ssb_pci_read8,
|
||||
.read16 = ssb_pci_read16,
|
||||
.read32 = ssb_pci_read32,
|
||||
.write8 = ssb_pci_write8,
|
||||
.write16 = ssb_pci_write16,
|
||||
.write32 = ssb_pci_write32,
|
||||
};
|
||||
|
在新工单中引用
屏蔽一个用户