early_printk.c 638 B

123456789101112131415161718192021222324252627282930
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
  7. */
  8. #include <bcm63xx_io.h>
  9. #include <linux/serial_bcm63xx.h>
  10. #include <asm/setup.h>
  11. static void wait_xfered(void)
  12. {
  13. unsigned int val;
  14. /* wait for any previous char to be transmitted */
  15. do {
  16. val = bcm_uart0_readl(UART_IR_REG);
  17. if (val & UART_IR_STAT(UART_IR_TXEMPTY))
  18. break;
  19. } while (1);
  20. }
  21. void prom_putchar(char c)
  22. {
  23. wait_xfered();
  24. bcm_uart0_writel(c, UART_FIFO_REG);
  25. wait_xfered();
  26. }