1 Add support for 8bit reads/writes to SSB.
2 Index: linux-2.6.25.1/drivers/ssb/main.c
3 ===================================================================
4 --- linux-2.6.25.1.orig/drivers/ssb/main.c 2008-05-10 09:04:53.000000000 +0100
5 +++ linux-2.6.25.1/drivers/ssb/main.c 2008-05-10 09:05:38.000000000 +0100
6 @@ -508,6 +508,14 @@ error:
10 +static u8 ssb_ssb_read8(struct ssb_device *dev, u16 offset)
12 + struct ssb_bus *bus = dev->bus;
14 + offset += dev->core_index * SSB_CORE_SIZE;
15 + return readb(bus->mmio + offset);
18 static u16 ssb_ssb_read16(struct ssb_device *dev, u16 offset)
20 struct ssb_bus *bus = dev->bus;
21 @@ -524,6 +532,14 @@ static u32 ssb_ssb_read32(struct ssb_dev
22 return readl(bus->mmio + offset);
25 +static void ssb_ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
27 + struct ssb_bus *bus = dev->bus;
29 + offset += dev->core_index * SSB_CORE_SIZE;
30 + writeb(value, bus->mmio + offset);
33 static void ssb_ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
35 struct ssb_bus *bus = dev->bus;
36 @@ -542,8 +558,10 @@ static void ssb_ssb_write32(struct ssb_d
38 /* Ops for the plain SSB bus without a host-device (no PCI or PCMCIA). */
39 static const struct ssb_bus_ops ssb_ssb_ops = {
40 + .read8 = ssb_ssb_read8,
41 .read16 = ssb_ssb_read16,
42 .read32 = ssb_ssb_read32,
43 + .write8 = ssb_ssb_write8,
44 .write16 = ssb_ssb_write16,
45 .write32 = ssb_ssb_write32,
47 Index: linux-2.6.25.1/drivers/ssb/pci.c
48 ===================================================================
49 --- linux-2.6.25.1.orig/drivers/ssb/pci.c 2008-05-10 09:04:53.000000000 +0100
50 +++ linux-2.6.25.1/drivers/ssb/pci.c 2008-05-10 09:05:38.000000000 +0100
51 @@ -577,6 +577,19 @@ static inline int ssb_pci_assert_buspowe
55 +static u8 ssb_pci_read8(struct ssb_device *dev, u16 offset)
57 + struct ssb_bus *bus = dev->bus;
59 + if (unlikely(ssb_pci_assert_buspower(bus)))
61 + if (unlikely(bus->mapped_device != dev)) {
62 + if (unlikely(ssb_pci_switch_core(bus, dev)))
65 + return ioread8(bus->mmio + offset);
68 static u16 ssb_pci_read16(struct ssb_device *dev, u16 offset)
70 struct ssb_bus *bus = dev->bus;
71 @@ -603,6 +616,19 @@ static u32 ssb_pci_read32(struct ssb_dev
72 return ioread32(bus->mmio + offset);
75 +static void ssb_pci_write8(struct ssb_device *dev, u16 offset, u8 value)
77 + struct ssb_bus *bus = dev->bus;
79 + if (unlikely(ssb_pci_assert_buspower(bus)))
81 + if (unlikely(bus->mapped_device != dev)) {
82 + if (unlikely(ssb_pci_switch_core(bus, dev)))
85 + iowrite8(value, bus->mmio + offset);
88 static void ssb_pci_write16(struct ssb_device *dev, u16 offset, u16 value)
90 struct ssb_bus *bus = dev->bus;
91 @@ -631,8 +657,10 @@ static void ssb_pci_write32(struct ssb_d
93 /* Not "static", as it's used in main.c */
94 const struct ssb_bus_ops ssb_pci_ops = {
95 + .read8 = ssb_pci_read8,
96 .read16 = ssb_pci_read16,
97 .read32 = ssb_pci_read32,
98 + .write8 = ssb_pci_write8,
99 .write16 = ssb_pci_write16,
100 .write32 = ssb_pci_write32,
102 Index: linux-2.6.25.1/drivers/ssb/pcmcia.c
103 ===================================================================
104 --- linux-2.6.25.1.orig/drivers/ssb/pcmcia.c 2008-05-10 09:04:53.000000000 +0100
105 +++ linux-2.6.25.1/drivers/ssb/pcmcia.c 2008-05-10 09:05:38.000000000 +0100
106 @@ -172,6 +172,22 @@ static int select_core_and_segment(struc
110 +static u8 ssb_pcmcia_read8(struct ssb_device *dev, u16 offset)
112 + struct ssb_bus *bus = dev->bus;
113 + unsigned long flags;
117 + spin_lock_irqsave(&bus->bar_lock, flags);
118 + err = select_core_and_segment(dev, &offset);
120 + value = readb(bus->mmio + offset);
121 + spin_unlock_irqrestore(&bus->bar_lock, flags);
126 static u16 ssb_pcmcia_read16(struct ssb_device *dev, u16 offset)
128 struct ssb_bus *bus = dev->bus;
129 @@ -206,6 +222,20 @@ static u32 ssb_pcmcia_read32(struct ssb_
130 return (lo | (hi << 16));
133 +static void ssb_pcmcia_write8(struct ssb_device *dev, u16 offset, u8 value)
135 + struct ssb_bus *bus = dev->bus;
136 + unsigned long flags;
139 + spin_lock_irqsave(&bus->bar_lock, flags);
140 + err = select_core_and_segment(dev, &offset);
142 + writeb(value, bus->mmio + offset);
144 + spin_unlock_irqrestore(&bus->bar_lock, flags);
147 static void ssb_pcmcia_write16(struct ssb_device *dev, u16 offset, u16 value)
149 struct ssb_bus *bus = dev->bus;
150 @@ -238,8 +268,10 @@ static void ssb_pcmcia_write32(struct ss
152 /* Not "static", as it's used in main.c */
153 const struct ssb_bus_ops ssb_pcmcia_ops = {
154 + .read8 = ssb_pcmcia_read8,
155 .read16 = ssb_pcmcia_read16,
156 .read32 = ssb_pcmcia_read32,
157 + .write8 = ssb_pcmcia_write8,
158 .write16 = ssb_pcmcia_write16,
159 .write32 = ssb_pcmcia_write32,
161 Index: linux-2.6.25.1/include/linux/ssb/ssb.h
162 ===================================================================
163 --- linux-2.6.25.1.orig/include/linux/ssb/ssb.h 2008-05-10 09:04:53.000000000 +0100
164 +++ linux-2.6.25.1/include/linux/ssb/ssb.h 2008-05-10 09:05:38.000000000 +0100
165 @@ -72,8 +72,10 @@ struct ssb_device;
166 /* Lowlevel read/write operations on the device MMIO.
167 * Internal, don't use that outside of ssb. */
169 + u8 (*read8)(struct ssb_device *dev, u16 offset);
170 u16 (*read16)(struct ssb_device *dev, u16 offset);
171 u32 (*read32)(struct ssb_device *dev, u16 offset);
172 + void (*write8)(struct ssb_device *dev, u16 offset, u8 value);
173 void (*write16)(struct ssb_device *dev, u16 offset, u16 value);
174 void (*write32)(struct ssb_device *dev, u16 offset, u32 value);
176 @@ -348,6 +350,10 @@ void ssb_device_disable(struct ssb_devic
179 /* Device MMIO register read/write functions. */
180 +static inline u8 ssb_read8(struct ssb_device *dev, u16 offset)
182 + return dev->ops->read8(dev, offset);
184 static inline u16 ssb_read16(struct ssb_device *dev, u16 offset)
186 return dev->ops->read16(dev, offset);
187 @@ -356,6 +362,10 @@ static inline u32 ssb_read32(struct ssb_
189 return dev->ops->read32(dev, offset);
191 +static inline void ssb_write8(struct ssb_device *dev, u16 offset, u8 value)
193 + dev->ops->write8(dev, offset, value);
195 static inline void ssb_write16(struct ssb_device *dev, u16 offset, u16 value)
197 dev->ops->write16(dev, offset, value);