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

Commit 96f0e6fc authored by Rob Herring's avatar Rob Herring Committed by Michal Simek
Browse files

microblaze: remove redundant early_printk support



With earlycon support now enabled, the arch specific early_printk support
can be removed.

Signed-off-by: default avatarRob Herring <robh@kernel.org>
Cc: Michal Simek <monstr@monstr.eu>
Signed-off-by: default avatarMichal Simek <michal.simek@xilinx.com>
parent f71044c9
Loading
Loading
Loading
Loading
+0 −8
Original line number Diff line number Diff line
@@ -8,14 +8,6 @@ config TRACE_IRQFLAGS_SUPPORT

source "lib/Kconfig.debug"

config EARLY_PRINTK
	bool "Early printk function for kernel"
	depends on SERIAL_UARTLITE_CONSOLE || SERIAL_8250_CONSOLE
	default n
	help
	  This option turns on/off early printk messages to console.
	  First Uartlite node is taken.

config HEART_BEAT
	bool "Heart beat function for kernel"
	default n
+0 −27
Original line number Diff line number Diff line
/*
 * Definitions for talking to the Open Firmware PROM on
 * Power Macintosh computers.
 *
 * Copyright (C) 1996-2005 Paul Mackerras.
 *
 * Updates for PPC64 by Peter Bergner & David Engebretsen, IBM Corp.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */
#ifndef _ASM_MICROBLAZE_PROM_H
#define _ASM_MICROBLAZE_PROM_H

#include <linux/of.h>

/* Other Prototypes */
enum early_consoles {
	UARTLITE = 1,
	UART16550 = 2,
};

extern int of_early_console(void *version);

#endif /* _ASM_MICROBLAZE_PROM_H */
+0 −5
Original line number Diff line number Diff line
@@ -19,16 +19,11 @@ extern char cmd_line[COMMAND_LINE_SIZE];

extern char *klimit;

int setup_early_printk(char *opt);
void remap_early_printk(void);
void disable_early_printk(void);

void microblaze_heartbeat(void);
void microblaze_setup_heartbeat(void);

#   ifdef CONFIG_MMU
extern void mmu_reset(void);
extern void early_console_reg_tlb_alloc(unsigned int addr);
#   endif /* CONFIG_MMU */

extern void of_platform_reset_gpio_probe(void);
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ obj-y += dma.o exceptions.o \

obj-y += cpu/

obj-$(CONFIG_EARLY_PRINTK)	+= early_printk.o
obj-$(CONFIG_HEART_BEAT)	+= heartbeat.o
obj-$(CONFIG_MODULES)		+= microblaze_ksyms.o module.o
obj-$(CONFIG_MMU)		+= misc.o
+0 −184
Original line number Diff line number Diff line
/*
 * Early printk support for Microblaze.
 *
 * Copyright (C) 2007-2009 Michal Simek <monstr@monstr.eu>
 * Copyright (C) 2007-2009 PetaLogix
 * Copyright (C) 2003-2006 Yasushi SHOJI <yashi@atmark-techno.com>
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License. See the file "COPYING" in the main directory of this archive
 * for more details.
 */

#include <linux/console.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/string.h>
#include <linux/tty.h>
#include <linux/io.h>
#include <asm/processor.h>
#include <linux/fcntl.h>
#include <asm/setup.h>
#include <asm/prom.h>

static u32 base_addr;

#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
static void early_printk_uartlite_putc(char c)
{
	/*
	 * Limit how many times we'll spin waiting for TX FIFO status.
	 * This will prevent lockups if the base address is incorrectly
	 * set, or any other issue on the UARTLITE.
	 * This limit is pretty arbitrary, unless we are at about 10 baud
	 * we'll never timeout on a working UART.
	 */

	unsigned retries = 1000000;
	/* read status bit - 0x8 offset */
	while (--retries && (in_be32(base_addr + 8) & (1 << 3)))
		;

	/* Only attempt the iowrite if we didn't timeout */
	/* write to TX_FIFO - 0x4 offset */
	if (retries)
		out_be32(base_addr + 4, c & 0xff);
}

static void early_printk_uartlite_write(struct console *unused,
					const char *s, unsigned n)
{
	while (*s && n-- > 0) {
		if (*s == '\n')
			early_printk_uartlite_putc('\r');
		early_printk_uartlite_putc(*s);
		s++;
	}
}

static struct console early_serial_uartlite_console = {
	.name = "earlyser",
	.write = early_printk_uartlite_write,
	.flags = CON_PRINTBUFFER | CON_BOOT,
	.index = -1,
};
#endif /* CONFIG_SERIAL_UARTLITE_CONSOLE */

#ifdef CONFIG_SERIAL_8250_CONSOLE
static void early_printk_uart16550_putc(char c)
{
	/*
	 * Limit how many times we'll spin waiting for TX FIFO status.
	 * This will prevent lockups if the base address is incorrectly
	 * set, or any other issue on the UARTLITE.
	 * This limit is pretty arbitrary, unless we are at about 10 baud
	 * we'll never timeout on a working UART.
	 */

	#define UART_LSR_TEMT	0x40 /* Transmitter empty */
	#define UART_LSR_THRE	0x20 /* Transmit-hold-register empty */
	#define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)

	unsigned retries = 10000;

	while (--retries &&
		!((in_be32(base_addr + 0x14) & BOTH_EMPTY) == BOTH_EMPTY))
		;

	if (retries)
		out_be32(base_addr, c & 0xff);
}

static void early_printk_uart16550_write(struct console *unused,
					const char *s, unsigned n)
{
	while (*s && n-- > 0) {
		if (*s == '\n')
			early_printk_uart16550_putc('\r');
		early_printk_uart16550_putc(*s);
		s++;
	}
}

static struct console early_serial_uart16550_console = {
	.name = "earlyser",
	.write = early_printk_uart16550_write,
	.flags = CON_PRINTBUFFER | CON_BOOT,
	.index = -1,
};
#endif /* CONFIG_SERIAL_8250_CONSOLE */

int __init setup_early_printk(char *opt)
{
	int version = 0;

	if (early_console)
		return 1;

	base_addr = of_early_console(&version);
	if (base_addr) {
#ifdef CONFIG_MMU
		early_console_reg_tlb_alloc(base_addr);
#endif
		switch (version) {
#ifdef CONFIG_SERIAL_UARTLITE_CONSOLE
		case UARTLITE:
			pr_info("Early console on uartlite at 0x%08x\n",
								base_addr);
			early_console = &early_serial_uartlite_console;
			break;
#endif
#ifdef CONFIG_SERIAL_8250_CONSOLE
		case UART16550:
			pr_info("Early console on uart16650 at 0x%08x\n",
								base_addr);
			early_console = &early_serial_uart16550_console;
			break;
#endif
		default:
			pr_info("Unsupported early console %d\n",
								version);
			return 1;
		}

		register_console(early_console);
		return 0;
	}
	return 1;
}

/* Remap early console to virtual address and do not allocate one TLB
 * only for early console because of performance degression */
void __init remap_early_printk(void)
{
	if (!early_console)
		return;
	pr_info("early_printk_console remapping from 0x%x to ", base_addr);
	base_addr = (u32) ioremap(base_addr, PAGE_SIZE);
	pr_cont("0x%x\n", base_addr);

#ifdef CONFIG_MMU
	/*
	 * Early console is on the top of skipped TLB entries
	 * decrease tlb_skip size ensure that hardcoded TLB entry will be
	 * used by generic algorithm
	 * FIXME check if early console mapping is on the top by rereading
	 * TLB entry and compare baseaddr
	 *  mts  rtlbx, (tlb_skip - 1)
	 *  nop
	 *  mfs  rX, rtlblo
	 *  nop
	 *  cmp rX, orig_base_addr
	 */
	tlb_skip -= 1;
#endif
}

void __init disable_early_printk(void)
{
	if (!early_console)
		return;
	pr_warn("disabling early console\n");
	unregister_console(early_console);
	early_console = NULL;
}
Loading