aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ssb/pci.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-02-20 13:08:10 -0500
committerJohn W. Linville <linville@tuxdriver.com>2008-02-29 15:37:26 -0500
commitffc7689ddae5cbe12bde437ae0f2b386d568b5cd (patch)
tree638e7dcf083c88cf45763953aa244504d357a220 /drivers/ssb/pci.c
parent004c872e78d433f84f0a5cd4db7a6c780c0946e1 (diff)
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>
Diffstat (limited to 'drivers/ssb/pci.c')
-rw-r--r--drivers/ssb/pci.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/ssb/pci.c b/drivers/ssb/pci.c
index b434df75047..1facc7620fc 100644
--- a/drivers/ssb/pci.c
+++ b/drivers/ssb/pci.c
@@ -572,6 +572,19 @@ static inline int ssb_pci_assert_buspower(struct ssb_bus *bus)
572} 572}
573#endif /* DEBUG */ 573#endif /* DEBUG */
574 574
575static u8 ssb_pci_read8(struct ssb_device *dev, u16 offset)
576{
577 struct ssb_bus *bus = dev->bus;
578
579 if (unlikely(ssb_pci_assert_buspower(bus)))
580 return 0xFF;
581 if (unlikely(bus->mapped_device != dev)) {
582 if (unlikely(ssb_pci_switch_core(bus, dev)))
583 return 0xFF;
584 }
585 return ioread8(bus->mmio + offset);
586}
587
575static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset) 588static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset)
576{ 589{
577 struct ssb_bus *bus = dev->bus; 590 struct ssb_bus *bus = dev->bus;
@@ -598,6 +611,19 @@ static u32 ssb_pci_read32(struct ssb_device *dev, u16 offset)
598 return ioread32(bus->mmio + offset); 611 return ioread32(bus->mmio + offset);
599} 612}
600 613
614static void ssb_pci_write8(struct ssb_device *dev, u16 offset, u8 value)
615{
616 struct ssb_bus *bus = dev->bus;
617
618 if (unlikely(ssb_pci_assert_buspower(bus)))
619 return;
620 if (unlikely(bus->mapped_device != dev)) {
621 if (unlikely(ssb_pci_switch_core(bus, dev)))
622 return;
623 }
624 iowrite8(value, bus->mmio + offset);
625}
626
601static void ssb_pci_write16(struct ssb_device *dev, u16 offset, u16 value) 627static void ssb_pci_write16(struct ssb_device *dev, u16 offset, u16 value)
602{ 628{
603 struct ssb_bus *bus = dev->bus; 629 struct ssb_bus *bus = dev->bus;
@@ -626,8 +652,10 @@ static void ssb_pci_write32(struct ssb_device *dev, u16 offset, u32 value)
626 652
627/* Not "static", as it's used in main.c */ 653/* Not "static", as it's used in main.c */
628const struct ssb_bus_ops ssb_pci_ops = { 654const struct ssb_bus_ops ssb_pci_ops = {
655 .read8 = ssb_pci_read8,
629 .read16 = ssb_pci_read16, 656 .read16 = ssb_pci_read16,
630 .read32 = ssb_pci_read32, 657 .read32 = ssb_pci_read32,
658 .write8 = ssb_pci_write8,
631 .write16 = ssb_pci_write16, 659 .write16 = ssb_pci_write16,
632 .write32 = ssb_pci_write32, 660 .write32 = ssb_pci_write32,
633}; 661};