13 #include <linux/serial.h>
14 #include <linux/serial_core.h>
16 #include <linux/time.h>
24 return ssb_read32(mcore->dev, offset);
27 static inline void mips_write32(
struct ssb_mipscore *mcore,
31 ssb_write32(mcore->dev, offset, value);
34 static const u32 ipsflag_irq_mask[] = {
42 static const u32 ipsflag_irq_shift[] = {
67 if (ssb_irqflag(dev) == irqflag)
87 irqflag = ssb_irqflag(dev);
91 for (irq = 1; irq <= 4; irq++) {
92 tmp = ((ipsflag & ipsflag_irq_mask[
irq]) >> ipsflag_irq_shift[irq]);
97 if ((1 << irqflag) & ssb_read32(mdev,
SSB_INTVEC))
104 static void clear_irq(
struct ssb_bus *bus,
unsigned int irq)
114 ipsflag_irq_mask[irq]);
118 static void set_irq(
struct ssb_device *dev,
unsigned int irq)
123 u32 irqflag = ssb_irqflag(dev);
132 else if (oldirq != 5)
133 clear_irq(bus, oldirq);
140 if ((ipsflag & ipsflag_irq_mask[irq]) != ipsflag_irq_mask[irq]) {
141 u32 oldipsflag = (ipsflag & ipsflag_irq_mask[
irq]) >> ipsflag_irq_shift[irq];
142 struct ssb_device *olddev = find_device(dev, oldipsflag);
146 irqflag <<= ipsflag_irq_shift[
irq];
147 irqflag |= (ipsflag & ~ipsflag_irq_mask[
irq]);
151 "set_irq: core 0x%04x, irq %d => %d\n",
152 dev->
id.coreid, oldirq+2, irq+2);
155 static void print_irq(
struct ssb_device *dev,
unsigned int irq)
158 static const char *irq_name[] = {
"2(S)",
"3",
"4",
"5",
"6",
"D",
"I"};
160 "core 0x%04x, irq :", dev->
id.coreid);
161 for (i = 0; i <= 6; i++) {
167 static void dump_irq(
struct ssb_bus *bus)
177 static void ssb_mips_serial_init(
struct ssb_mipscore *mcore)
179 struct ssb_bus *bus = mcore->dev->bus;
182 mcore->nr_serial_ports = ssb_extif_serial_init(&bus->
extif, mcore->serial_ports);
184 mcore->nr_serial_ports = ssb_chipco_serial_init(&bus->
chipco, mcore->serial_ports);
186 mcore->nr_serial_ports = 0;
189 static void ssb_mips_flash_detect(
struct ssb_mipscore *mcore)
191 struct ssb_bus *bus = mcore->dev->bus;
195 mcore->flash_buswidth = 2;
205 pr_err(
"Serial flash not supported\n");
213 mcore->flash_buswidth = 1;
215 mcore->flash_buswidth = 2;
222 struct ssb_bus *bus = mcore->dev->bus;
228 if (bus->
extif.dev) {
230 }
else if (bus->
chipco.dev) {
252 unsigned long hz,
ns;
260 bus = mcore->dev->bus;
264 ns = 1000000000 / hz;
272 for (irq = 2, i = 0; i < bus->
nr_devices; i++) {
279 dev->
irq = mips_irq + 2;
282 switch (dev->
id.coreid) {
286 if ((bus->
chip_id == 0x4710) && (irq <= 4)) {
309 ssb_mips_serial_init(mcore);
310 ssb_mips_flash_detect(mcore);