Skip to content

Commit

Permalink
ttyFDC: Fix to use native endian MMIO reads
Browse files Browse the repository at this point in the history
The MIPS Common Device Memory Map (CDMM) is internal to the core and has
native endianness. There is therefore no need to byte swap the accesses
on big endian targets, so convert the Fast Debug Channel (FDC) TTY
driver to use __raw_readl()/__raw_writel() rather than
ioread32()/iowrite32().

Fixes: 4cebec6 ("TTY: Add MIPS EJTAG Fast Debug Channel TTY driver")
Fixes: c2d7ef5 ("ttyFDC: Implement KGDB IO operations.")
Signed-off-by: James Hogan <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Jiri Slaby <[email protected]>
Cc: [email protected]
Patchwork: https://patchwork.linux-mips.org/patch/9905/
Acked-by: Greg Kroah-Hartman <[email protected]>
Signed-off-by: Ralf Baechle <[email protected]>
  • Loading branch information
James Hogan authored and ralfbaechle committed May 26, 2015
1 parent e21422d commit 70f041b
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions drivers/tty/mips_ejtag_fdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ struct mips_ejtag_fdc_tty {
static inline void mips_ejtag_fdc_write(struct mips_ejtag_fdc_tty *priv,
unsigned int offs, unsigned int data)
{
iowrite32(data, priv->reg + offs);
__raw_writel(data, priv->reg + offs);
}

static inline unsigned int mips_ejtag_fdc_read(struct mips_ejtag_fdc_tty *priv,
unsigned int offs)
{
return ioread32(priv->reg + offs);
return __raw_readl(priv->reg + offs);
}

/* Encoding of byte stream in FDC words */
Expand Down Expand Up @@ -347,9 +347,9 @@ static void mips_ejtag_fdc_console_write(struct console *c, const char *s,
s += inc[word.bytes - 1];

/* Busy wait until there's space in fifo */
while (ioread32(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
;
iowrite32(word.word, regs + REG_FDTX(c->index));
__raw_writel(word.word, regs + REG_FDTX(c->index));
}
out:
local_irq_restore(flags);
Expand Down Expand Up @@ -1227,7 +1227,7 @@ static int kgdbfdc_read_char(void)

/* Read next word from KGDB channel */
do {
stat = ioread32(regs + REG_FDSTAT);
stat = __raw_readl(regs + REG_FDSTAT);

/* No data waiting? */
if (stat & REG_FDSTAT_RXE)
Expand All @@ -1236,7 +1236,7 @@ static int kgdbfdc_read_char(void)
/* Read next word */
channel = (stat & REG_FDSTAT_RXCHAN) >>
REG_FDSTAT_RXCHAN_SHIFT;
data = ioread32(regs + REG_FDRX);
data = __raw_readl(regs + REG_FDRX);
} while (channel != CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN);

/* Decode into rbuf */
Expand Down Expand Up @@ -1266,9 +1266,10 @@ static void kgdbfdc_push_one(void)
return;

/* Busy wait until there's space in fifo */
while (ioread32(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
;
iowrite32(word.word, regs + REG_FDTX(CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN));
__raw_writel(word.word,
regs + REG_FDTX(CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN));
}

/* flush the whole write buffer to the TX FIFO */
Expand Down

0 comments on commit 70f041b

Please sign in to comment.