#include <linux/serial.h>
#include <linux/serial_core.h>
#include <linux/serial_reg.h>
static inline u32 extif_read32(struct ssb_extif *extif, u16 offset)
return ssb_read32(extif->dev, offset);
static inline void extif_write32(struct ssb_extif *extif, u16 offset, u32 value)
ssb_write32(extif->dev, offset, value);
static inline u32 extif_write32_masked(struct ssb_extif *extif, u16 offset,
value |= extif_read32(extif, offset) & ~mask;
extif_write32(extif, offset, value);
static bool serial_exists(u8 *regs)
save_mcr = regs[UART_MCR];
regs[UART_MCR] = (UART_MCR_LOOP | UART_MCR_OUT2 | UART_MCR_RTS);
msr = regs[UART_MSR] & (UART_MSR_DCD | UART_MSR_RI
| UART_MSR_CTS | UART_MSR_DSR);
regs[UART_MCR] = save_mcr;
return (msr == (UART_MSR_DCD | UART_MSR_CTS));
int ssb_extif_serial_init(struct ssb_extif *extif, struct ssb_serial_port *ports)
extif_write32(extif, SSB_EXTIF_GPIO_INTPOL, 0);
extif_write32(extif, SSB_EXTIF_GPIO_INTMASK, 0);
for (i = 0; i < 2; i++) {