Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit a081568d authored by Russell King's avatar Russell King Committed by Russell King
Browse files

[ARM] Fix decompressor serial IO to give CRLF not LFCR



As per the corresponding change to the serial drivers, arrange
for ARM decompressors to give CRLF.  Move the common putstr code
into misc.c such that machines only need to supply "putc" and
"flush" functions.

Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent 3747b36e
Loading
Loading
Loading
Loading
+18 −10
Original line number Diff line number Diff line
@@ -20,24 +20,32 @@ unsigned int __machine_arch_type;

#include <linux/string.h>

#include <asm/arch/uncompress.h>

#ifdef STANDALONE_DEBUG
#define putstr printf
#endif
#else

#ifdef CONFIG_DEBUG_ICEDCC
#define putstr icedcc_putstr
#define putc icedcc_putc
static void putstr(const char *ptr);

#include <linux/compiler.h>
#include <asm/arch/uncompress.h>

#ifdef CONFIG_DEBUG_ICEDCC
extern void icedcc_putc(int ch);
#define putc(ch)	icedcc_putc(ch)
#define flush()	do { } while (0)
#endif

static void
icedcc_putstr(const char *ptr)
static void putstr(const char *ptr)
{
	for (; *ptr != '\0'; ptr++) {
		icedcc_putc(*ptr);
	char c;

	while ((c = *ptr++) != '\0') {
		if (c == '\n')
			putc('\r');
		putc(c);
	}

	flush();
}

#endif
+11 −12
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@

#define UART(x)         (*(volatile unsigned long *)(serial_port + (x)))

static void putstr( const char *s )
static void putc(int c)
{
	unsigned long serial_port;
        do {
@@ -28,17 +28,16 @@ static void putstr( const char *s )
		return;
	} while (0);

	for (; *s; s++) {
	/* wait for space in the UART's transmitter */
		while ((UART(UART_SR) & UART_SR_TxFF));
	while ((UART(UART_SR) & UART_SR_TxFF))
		barrier();

	/* send the character out. */
		UART(UART_DR) = *s;
		/* if a LF, also do CR... */
		if (*s == 10) {
			while ((UART(UART_SR) & UART_SR_TxFF));
			UART(UART_DR) = 13;
		}
	UART(UART_DR) = c;
}

static inline void flush(void)
{
}

#define arch_decomp_setup()
+12 −11
Original line number Diff line number Diff line
@@ -31,21 +31,22 @@
 *
 * This does not append a newline
 */
static void putstr(const char *s)
static void putc(int c)
{
	void __iomem *sys = (void __iomem *) AT91_BASE_SYS;	/* physical address */

	while (*s) {
		while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) { barrier(); }
		__raw_writel(*s, sys + AT91_DBGU_THR);
		if (*s == '\n')	{
			while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY)) { barrier(); }
			__raw_writel('\r', sys + AT91_DBGU_THR);
		}
		s++;
	while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXRDY))
		barrier();
	__raw_writel(c, sys + AT91_DBGU_THR);
}

static inline void flush(void)
{
	void __iomem *sys = (void __iomem *) AT91_BASE_SYS;	/* physical address */

	/* wait for transmission to complete */
	while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY)) { barrier(); }
	while (!(__raw_readl(sys + AT91_DBGU_SR) & AT91_DBGU_TXEMPTY))
		barrier();
}

#define arch_decomp_setup()
+5 −13
Original line number Diff line number Diff line
@@ -3,27 +3,19 @@
 *
 * Copyright (C) 1999, 2000 Nexus Electronics Ltd.
 */

#define BASE 0x03010000
#define SERBASE (BASE + (0x2f8 << 2))

static __inline__ void putc(char c)
static inline void putc(char c)
{
	while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20));
	while (!(*((volatile unsigned int *)(SERBASE + 0x14)) & 0x20))
		barrier();

	*((volatile unsigned int *)(SERBASE)) = c;
}

/*
 * This does not append a newline
 */
static void putstr(const char *s)
static inline void flush(void)
{
	while (*s) {
		putc(*s);
		if (*s == '\n')
			putc('\r');
		s++;
	}
}

static __inline__ void arch_decomp_setup(void)
+7 −14
Original line number Diff line number Diff line
@@ -25,7 +25,6 @@
#undef CLPS7111_BASE
#define CLPS7111_BASE CLPS7111_PHYS_BASE

#define barrier()		__asm__ __volatile__("": : :"memory")
#define __raw_readl(p)		(*(unsigned long *)(p))
#define __raw_writel(v,p)	(*(unsigned long *)(p) = (v))

@@ -40,21 +39,15 @@
/*
 * This does not append a newline
 */
static void putstr(const char *s)
static inline void putc(int c)
{
	char c;

	while ((c = *s++) != '\0') {
	while (clps_readl(SYSFLGx) & SYSFLG_UTXFF)
		barrier();
	clps_writel(c, UARTDRx);

		if (c == '\n') {
			while (clps_readl(SYSFLGx) & SYSFLG_UTXFF)
				barrier();
			clps_writel('\r', UARTDRx);
		}
}

static inline void flush(void)
{
	while (clps_readl(SYSFLGx) & SYSFLG_UBUSY)
		barrier();
}
Loading