1 From c615e4c64389ef138c6a13afa744e09134db2c82 Mon Sep 17 00:00:00 2001
2 From: Lars-Peter Clausen <lars@metafoo.de>
3 Date: Sat, 19 Jun 2010 04:08:17 +0000
4 Subject: [PATCH] MIPS: JZ4740: Add prom support
6 Add support for initializing arcs_cmdline on JZ4740 based machines and
7 provides a prom_putchar implementation.
9 Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
10 Cc: linux-mips@linux-mips.org
11 Cc: linux-kernel@vger.kernel.org
12 Patchwork: https://patchwork.linux-mips.org/patch/1404/
13 Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
15 arch/mips/jz4740/prom.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++
16 1 files changed, 68 insertions(+), 0 deletions(-)
17 create mode 100644 arch/mips/jz4740/prom.c
20 +++ b/arch/mips/jz4740/prom.c
23 + * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
24 + * JZ4740 SoC prom code
26 + * This program is free software; you can redistribute it and/or modify it
27 + * under the terms of the GNU General Public License as published by the
28 + * Free Software Foundation; either version 2 of the License, or (at your
29 + * option) any later version.
31 + * You should have received a copy of the GNU General Public License along
32 + * with this program; if not, write to the Free Software Foundation, Inc.,
33 + * 675 Mass Ave, Cambridge, MA 02139, USA.
37 +#include <linux/module.h>
38 +#include <linux/kernel.h>
39 +#include <linux/init.h>
40 +#include <linux/string.h>
42 +#include <linux/serial_reg.h>
44 +#include <asm/bootinfo.h>
45 +#include <asm/mach-jz4740/base.h>
47 +void jz4740_init_cmdline(int argc, char *argv[])
49 + unsigned int count = COMMAND_LINE_SIZE - 1;
51 + char *dst = &(arcs_cmdline[0]);
54 + for (i = 1; i < argc && count; ++i) {
56 + while (*src && count) {
68 +void __init prom_init(void)
70 + jz4740_init_cmdline((int)fw_arg0, (char **)fw_arg1);
71 + mips_machtype = MACH_INGENIC_JZ4740;
74 +void __init prom_free_prom_memory(void)
78 +#define UART_REG(_reg) ((void __iomem *)CKSEG1ADDR(JZ4740_UART0_BASE_ADDR + (_reg << 2)))
80 +void prom_putchar(char c)
85 + lsr = readb(UART_REG(UART_LSR));
86 + } while ((lsr & UART_LSR_TEMT) == 0);
88 + writeb(c, UART_REG(UART_TX));