aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Hogan <james.hogan@imgtec.com>2015-04-28 05:57:30 -0400
committerRalf Baechle <ralf@linux-mips.org>2015-05-26 10:46:52 -0400
commit70f041b6e1ff508750988ffd034ac6117d34d4d7 (patch)
treeffe6cadc3ad654cfed547b6adecfd926d8761766
parente21422de817ab0b67ed1902fe1383bcdeece855e (diff)
ttyFDC: Fix to use native endian MMIO reads
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: 4cebec609aea ("TTY: Add MIPS EJTAG Fast Debug Channel TTY driver") Fixes: c2d7ef51d731 ("ttyFDC: Implement KGDB IO operations.") Signed-off-by: James Hogan <james.hogan@imgtec.com> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/9905/ Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--drivers/tty/mips_ejtag_fdc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/tty/mips_ejtag_fdc.c b/drivers/tty/mips_ejtag_fdc.c
index 04d9e23d1ee1..358323c83b4f 100644
--- a/drivers/tty/mips_ejtag_fdc.c
+++ b/drivers/tty/mips_ejtag_fdc.c
@@ -174,13 +174,13 @@ struct mips_ejtag_fdc_tty {
174static inline void mips_ejtag_fdc_write(struct mips_ejtag_fdc_tty *priv, 174static inline void mips_ejtag_fdc_write(struct mips_ejtag_fdc_tty *priv,
175 unsigned int offs, unsigned int data) 175 unsigned int offs, unsigned int data)
176{ 176{
177 iowrite32(data, priv->reg + offs); 177 __raw_writel(data, priv->reg + offs);
178} 178}
179 179
180static inline unsigned int mips_ejtag_fdc_read(struct mips_ejtag_fdc_tty *priv, 180static inline unsigned int mips_ejtag_fdc_read(struct mips_ejtag_fdc_tty *priv,
181 unsigned int offs) 181 unsigned int offs)
182{ 182{
183 return ioread32(priv->reg + offs); 183 return __raw_readl(priv->reg + offs);
184} 184}
185 185
186/* Encoding of byte stream in FDC words */ 186/* Encoding of byte stream in FDC words */
@@ -347,9 +347,9 @@ static void mips_ejtag_fdc_console_write(struct console *c, const char *s,
347 s += inc[word.bytes - 1]; 347 s += inc[word.bytes - 1];
348 348
349 /* Busy wait until there's space in fifo */ 349 /* Busy wait until there's space in fifo */
350 while (ioread32(regs + REG_FDSTAT) & REG_FDSTAT_TXF) 350 while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
351 ; 351 ;
352 iowrite32(word.word, regs + REG_FDTX(c->index)); 352 __raw_writel(word.word, regs + REG_FDTX(c->index));
353 } 353 }
354out: 354out:
355 local_irq_restore(flags); 355 local_irq_restore(flags);
@@ -1227,7 +1227,7 @@ static int kgdbfdc_read_char(void)
1227 1227
1228 /* Read next word from KGDB channel */ 1228 /* Read next word from KGDB channel */
1229 do { 1229 do {
1230 stat = ioread32(regs + REG_FDSTAT); 1230 stat = __raw_readl(regs + REG_FDSTAT);
1231 1231
1232 /* No data waiting? */ 1232 /* No data waiting? */
1233 if (stat & REG_FDSTAT_RXE) 1233 if (stat & REG_FDSTAT_RXE)
@@ -1236,7 +1236,7 @@ static int kgdbfdc_read_char(void)
1236 /* Read next word */ 1236 /* Read next word */
1237 channel = (stat & REG_FDSTAT_RXCHAN) >> 1237 channel = (stat & REG_FDSTAT_RXCHAN) >>
1238 REG_FDSTAT_RXCHAN_SHIFT; 1238 REG_FDSTAT_RXCHAN_SHIFT;
1239 data = ioread32(regs + REG_FDRX); 1239 data = __raw_readl(regs + REG_FDRX);
1240 } while (channel != CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN); 1240 } while (channel != CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN);
1241 1241
1242 /* Decode into rbuf */ 1242 /* Decode into rbuf */
@@ -1266,9 +1266,10 @@ static void kgdbfdc_push_one(void)
1266 return; 1266 return;
1267 1267
1268 /* Busy wait until there's space in fifo */ 1268 /* Busy wait until there's space in fifo */
1269 while (ioread32(regs + REG_FDSTAT) & REG_FDSTAT_TXF) 1269 while (__raw_readl(regs + REG_FDSTAT) & REG_FDSTAT_TXF)
1270 ; 1270 ;
1271 iowrite32(word.word, regs + REG_FDTX(CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN)); 1271 __raw_writel(word.word,
1272 regs + REG_FDTX(CONFIG_MIPS_EJTAG_FDC_KGDB_CHAN));
1272} 1273}
1273 1274
1274/* flush the whole write buffer to the TX FIFO */ 1275/* flush the whole write buffer to the TX FIFO */