18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-sa1100/include/mach/uncompress.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * (C) 1999 Nicolas Pitre <nico@fluxnic.net>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Reorganised to be machine independent.
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#include "hardware.h"
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ci#define IOMEM(x)	(x)
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci/*
158c2ecf20Sopenharmony_ci * The following code assumes the serial port has already been
168c2ecf20Sopenharmony_ci * initialized by the bootloader.  We search for the first enabled
178c2ecf20Sopenharmony_ci * port in the most probable order.  If you didn't setup a port in
188c2ecf20Sopenharmony_ci * your bootloader then nothing will appear (which might be desired).
198c2ecf20Sopenharmony_ci */
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ci#define UART(x)		(*(volatile unsigned long *)(serial_port + (x)))
228c2ecf20Sopenharmony_ci
238c2ecf20Sopenharmony_cistatic inline void putc(int c)
248c2ecf20Sopenharmony_ci{
258c2ecf20Sopenharmony_ci	unsigned long serial_port;
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ci	do {
288c2ecf20Sopenharmony_ci		serial_port = _Ser3UTCR0;
298c2ecf20Sopenharmony_ci		if (UART(UTCR3) & UTCR3_TXE) break;
308c2ecf20Sopenharmony_ci		serial_port = _Ser1UTCR0;
318c2ecf20Sopenharmony_ci		if (UART(UTCR3) & UTCR3_TXE) break;
328c2ecf20Sopenharmony_ci		serial_port = _Ser2UTCR0;
338c2ecf20Sopenharmony_ci		if (UART(UTCR3) & UTCR3_TXE) break;
348c2ecf20Sopenharmony_ci		return;
358c2ecf20Sopenharmony_ci	} while (0);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci	/* wait for space in the UART's transmitter */
388c2ecf20Sopenharmony_ci	while (!(UART(UTSR1) & UTSR1_TNF))
398c2ecf20Sopenharmony_ci		barrier();
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_ci	/* send the character out. */
428c2ecf20Sopenharmony_ci	UART(UTDR) = c;
438c2ecf20Sopenharmony_ci}
448c2ecf20Sopenharmony_ci
458c2ecf20Sopenharmony_cistatic inline void flush(void)
468c2ecf20Sopenharmony_ci{
478c2ecf20Sopenharmony_ci}
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci/*
508c2ecf20Sopenharmony_ci * Nothing to do for these
518c2ecf20Sopenharmony_ci */
528c2ecf20Sopenharmony_ci#define arch_decomp_setup()
53