early_printk.c 685 B

12345678910111213141516171819202122232425262728293031
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. *
  4. * Copyright (C) 2010 John Crispin <[email protected]>
  5. */
  6. #include <linux/cpu.h>
  7. #include <lantiq_soc.h>
  8. #include <asm/setup.h>
  9. #define ASC_BUF 1024
  10. #define LTQ_ASC_FSTAT ((u32 *)(LTQ_EARLY_ASC + 0x0048))
  11. #ifdef __BIG_ENDIAN
  12. #define LTQ_ASC_TBUF ((u32 *)(LTQ_EARLY_ASC + 0x0020 + 3))
  13. #else
  14. #define LTQ_ASC_TBUF ((u32 *)(LTQ_EARLY_ASC + 0x0020))
  15. #endif
  16. #define TXMASK 0x3F00
  17. #define TXOFFSET 8
  18. void prom_putchar(char c)
  19. {
  20. unsigned long flags;
  21. local_irq_save(flags);
  22. do { } while ((ltq_r32(LTQ_ASC_FSTAT) & TXMASK) >> TXOFFSET);
  23. if (c == '\n')
  24. ltq_w8('\r', LTQ_ASC_TBUF);
  25. ltq_w8(c, LTQ_ASC_TBUF);
  26. local_irq_restore(flags);
  27. }