[kernel] backport SPI master with no RXTX support (from 2.6.36)
[openwrt.git] / target / linux / xburst / patches-2.6.35 / 013-prom.patch
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
5
6 Add support for initializing arcs_cmdline on JZ4740 based machines and
7 provides a prom_putchar implementation.
8
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>
14 ---
15 arch/mips/jz4740/prom.c | 68 +++++++++++++++++++++++++++++++++++++++++++++++
16 1 files changed, 68 insertions(+), 0 deletions(-)
17 create mode 100644 arch/mips/jz4740/prom.c
18
19 --- /dev/null
20 +++ b/arch/mips/jz4740/prom.c
21 @@ -0,0 +1,68 @@
22 +/*
23 + * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
24 + * JZ4740 SoC prom code
25 + *
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.
30 + *
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.
34 + *
35 + */
36 +
37 +#include <linux/module.h>
38 +#include <linux/kernel.h>
39 +#include <linux/init.h>
40 +#include <linux/string.h>
41 +
42 +#include <linux/serial_reg.h>
43 +
44 +#include <asm/bootinfo.h>
45 +#include <asm/mach-jz4740/base.h>
46 +
47 +void jz4740_init_cmdline(int argc, char *argv[])
48 +{
49 + unsigned int count = COMMAND_LINE_SIZE - 1;
50 + int i;
51 + char *dst = &(arcs_cmdline[0]);
52 + char *src;
53 +
54 + for (i = 1; i < argc && count; ++i) {
55 + src = argv[i];
56 + while (*src && count) {
57 + *dst++ = *src++;
58 + --count;
59 + }
60 + *dst++ = ' ';
61 + }
62 + if (i > 1)
63 + --dst;
64 +
65 + *dst = 0;
66 +}
67 +
68 +void __init prom_init(void)
69 +{
70 + jz4740_init_cmdline((int)fw_arg0, (char **)fw_arg1);
71 + mips_machtype = MACH_INGENIC_JZ4740;
72 +}
73 +
74 +void __init prom_free_prom_memory(void)
75 +{
76 +}
77 +
78 +#define UART_REG(_reg) ((void __iomem *)CKSEG1ADDR(JZ4740_UART0_BASE_ADDR + (_reg << 2)))
79 +
80 +void prom_putchar(char c)
81 +{
82 + uint8_t lsr;
83 +
84 + do {
85 + lsr = readb(UART_REG(UART_LSR));
86 + } while ((lsr & UART_LSR_TEMT) == 0);
87 +
88 + writeb(c, UART_REG(UART_TX));
89 +}
This page took 0.044236 seconds and 5 git commands to generate.