~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to arch/powerpc/kernel/udbg_16550.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * udbg for NS16550 compatable serial ports
 
2
 * udbg for NS16550 compatible serial ports
3
3
 *
4
4
 * Copyright (C) 2001-2005 PPC 64 Team, IBM Corp
5
5
 *
11
11
#include <linux/types.h>
12
12
#include <asm/udbg.h>
13
13
#include <asm/io.h>
 
14
#include <asm/reg_a2.h>
14
15
 
15
16
extern u8 real_readb(volatile u8 __iomem  *addr);
16
17
extern void real_writeb(u8 data, volatile u8 __iomem *addr);
298
299
        udbg_getc_poll = NULL;
299
300
}
300
301
#endif /* CONFIG_PPC_EARLY_DEBUG_40x */
 
302
 
 
303
#ifdef CONFIG_PPC_EARLY_DEBUG_WSP
 
304
static void udbg_wsp_flush(void)
 
305
{
 
306
        if (udbg_comport) {
 
307
                while ((readb(&udbg_comport->lsr) & LSR_THRE) == 0)
 
308
                        /* wait for idle */;
 
309
        }
 
310
}
 
311
 
 
312
static void udbg_wsp_putc(char c)
 
313
{
 
314
        if (udbg_comport) {
 
315
                if (c == '\n')
 
316
                        udbg_wsp_putc('\r');
 
317
                udbg_wsp_flush();
 
318
                writeb(c, &udbg_comport->thr); eieio();
 
319
        }
 
320
}
 
321
 
 
322
static int udbg_wsp_getc(void)
 
323
{
 
324
        if (udbg_comport) {
 
325
                while ((readb(&udbg_comport->lsr) & LSR_DR) == 0)
 
326
                        ; /* wait for char */
 
327
                return readb(&udbg_comport->rbr);
 
328
        }
 
329
        return -1;
 
330
}
 
331
 
 
332
static int udbg_wsp_getc_poll(void)
 
333
{
 
334
        if (udbg_comport)
 
335
                if (readb(&udbg_comport->lsr) & LSR_DR)
 
336
                        return readb(&udbg_comport->rbr);
 
337
        return -1;
 
338
}
 
339
 
 
340
void __init udbg_init_wsp(void)
 
341
{
 
342
        udbg_comport = (struct NS16550 __iomem *)WSP_UART_VIRT;
 
343
 
 
344
        udbg_init_uart(udbg_comport, 57600, 50000000);
 
345
 
 
346
        udbg_putc = udbg_wsp_putc;
 
347
        udbg_flush = udbg_wsp_flush;
 
348
        udbg_getc = udbg_wsp_getc;
 
349
        udbg_getc_poll = udbg_wsp_getc_poll;
 
350
}
 
351
#endif /* CONFIG_PPC_EARLY_DEBUG_WSP */