early_printk.c 615 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. static void wait_xfered(void)
  11. {
  12. unsigned int val;
  13. /* wait for any previous char to be transmitted */
  14. do {
  15. val = bcm_uart0_readl(UART_IR_REG);
  16. if (val & UART_IR_STAT(UART_IR_TXEMPTY))
  17. break;
  18. } while (1);
  19. }
  20. void prom_putchar(char c)
  21. {
  22. wait_xfered();
  23. bcm_uart0_writel(c, UART_FIFO_REG);
  24. wait_xfered();
  25. }