Skip to contentSkip to conversation

add STB810 support (Philips PNX8550-based)

PATCH In review Vitaly Wool 3 participants 4 messages Dec 7, 2006 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 add STB810 support (Philips PNX8550-based)

Hello Ralf,

please find the patch that adds support for STB810 below.

 arch/mips/Kconfig                              |    5 
 arch/mips/Makefile                             |    5 
 arch/mips/configs/pnx8550-stb810_defconfig     | 1117 +++++++++++++++++++++++++
 arch/mips/kernel/head.S                        |    2 
 arch/mips/philips/pnx8550/common/prom.c        |   20 
 arch/mips/philips/pnx8550/stb810/Makefile      |    4 
 arch/mips/philips/pnx8550/stb810/board_setup.c |   56 +
 arch/mips/philips/pnx8550/stb810/irqmap.c      |   23 
 arch/mips/philips/pnx8550/stb810/prom_init.c   |   49 +
 include/asm-mips/bootinfo.h                    |    1 
 10 files changed, 1267 insertions(+), 15 deletions(-)
arch/mips/philips/pnx8550/stb810/Makefile new file +4 -0
Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/Makefile
===================================================================
@@ -0,0 +1,4 @@
+
+# Makefile for the Philips STB810 Board.
+
+lib-y := prom_init.o board_setup.o irqmap.o
arch/mips/philips/pnx8550/stb810/board_setup.c new file +56 -0

56 lines not on this page · raw message

arch/mips/philips/pnx8550/stb810/irqmap.c new file +23 -0
Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/irqmap.c
===================================================================
@@ -0,0 +1,23 @@
+/*
+ *  Philips STB810 board irqmap.
+ *
+ *  Author: MontaVista Software, Inc.
+ *          [email protected]
+ *
+ *  Copyright 2005 MontaVista Software Inc.
+ *
+ *  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.
+ */
+
+#include <linux/init.h>
+#include <int.h>
+
+char irq_tab_jbs[][5] __initdata = {
+ [8] =  { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+ [9] =  { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+ [10] = { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+};
+
arch/mips/philips/pnx8550/stb810/prom_init.c new file +49 -0

49 lines not on this page · raw message

include/asm-mips/bootinfo.h +1 -0
Index: linux-mips.git/include/asm-mips/bootinfo.h
===================================================================
@@ -131,6 +131,7 @@
 #define  MACH_PHILIPS_NINO	0	/* Nino */
 #define  MACH_PHILIPS_VELO	1	/* Velo */
 #define  MACH_PHILIPS_JBS	2	/* JBS */
+#define  MACH_PHILIPS_STB810	3	/* STB810 */
 
 /*
  * Valid machtype for group SIBYTE
arch/mips/philips/pnx8550/common/prom.c +6 -14
Index: linux-mips.git/arch/mips/philips/pnx8550/common/prom.c
===================================================================
@@ -35,23 +35,15 @@
 	return &(arcs_cmdline[0]);
 }
 
-void  prom_init_cmdline(void)
+void __init prom_init_cmdline(void)
 {
-	char *cp;
-	int actr;
-
-	actr = 1; /* Always ignore argv[0] */
+	int i;
 
-	cp = &(arcs_cmdline[0]);
-	while(actr < prom_argc) {
-	        strcpy(cp, prom_argv[actr]);
-		cp += strlen(prom_argv[actr]);
-		*cp++ = ' ';
-		actr++;
+	arcs_cmdline[0] = '\0';
+	for (i = 0; i < prom_argc; i++) {
+		strcat(arcs_cmdline, prom_argv[i]);
+		strcat(arcs_cmdline, " ");
 	}
-	if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
-		--cp;
-	*cp = '\0';
 }
 
 char *prom_getenv(char *envname)
arch/mips/kernel/head.S +1 -1
Index: linux-mips.git/arch/mips/kernel/head.S
===================================================================
@@ -138,7 +138,7 @@
 EXPORT(stext)					# used for profiling
 EXPORT(_stext)
 
-#if defined(CONFIG_QEMU) || defined(CONFIG_MIPS_SIM)
+#if defined(CONFIG_QEMU) || defined(CONFIG_MIPS_SIM) || defined(CONFIG_PNX8550_STB810)
 	/*
 	 * Give us a fighting chance of running if execution beings at the
 	 * kernel load address.  This is needed because this platform does
arch/mips/configs/pnx8550-stb810_defconfig new file +1777 -0

1,777 lines not on this page · raw message

arch/mips/Kconfig +5 -0
Index: linux-mips.git/arch/mips/Kconfig
===================================================================
@@ -459,6 +459,11 @@
 	select PNX8550
 	select SYS_SUPPORTS_LITTLE_ENDIAN
 
+config PNX8550_STB810
+	bool "Support for Philips PNX8550 based STB810 board"
+	select PNX8550
+	select SYS_SUPPORTS_LITTLE_ENDIAN
+
 config DDB5477
 	bool "NEC DDB Vrc-5477"
 	select DDB5XXX_COMMON
arch/mips/Makefile +5 -0
Index: linux-mips.git/arch/mips/Makefile
===================================================================
@@ -463,6 +463,11 @@
 #cflags-$(CONFIG_PNX8550_JBS)	+= -Iinclude/asm-mips/mach-pnx8550
 load-$(CONFIG_PNX8550_JBS)	+= 0xffffffff80060000
 
+# Philips PNX8550 STB810 board
+#
+libs-$(CONFIG_PNX8550_STB810)	+= arch/mips/philips/pnx8550/stb810/
+load-$(CONFIG_PNX8550_STB810)	+= 0xffffffff80060000
+
 # NEC EMMA2RH boards
 #
 core-$(CONFIG_EMMA2RH)          += arch/mips/emma2rh/common/
#1 lore raw

Hello.

Quoted 1 line · Vitaly Wool

please find the patch that adds support for STB810 below.

[...]

Quoted 7 lines

Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/board_setup.c
===================================================================

arch/mips/philips/pnx8550/stb810/board_setup.c new file +0 -0
@@ -0,0 +1,56 @@

[...]

arch/mips/philips/pnx8550/stb810/board_setup.c line 38

Quoted 5 lines
arch/mips/philips/pnx8550/stb810/board_setup.c new file +5 -0
+/* CP0 hazard avoidance. */
+#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
+				     "nop; nop; nop; nop; nop; nop;\n\t" \
+				     ".set reorder\n\t")
+

Erm, barrier code have been reworked, IIRC. Is there really a need for the
6-nop custom barrier here?

Quoted 23 lines
arch/mips/philips/pnx8550/stb810/board_setup.c new file +18 -0
+void __init board_setup(void)
+{
+	unsigned long config0, configpr;
+
+	config0 = read_c0_config();
+
+	/* clear all three cache coherency fields */
+	config0 &= ~(0x7 | (7<<25) | (7<<28));
+	config0 |= (CONF_CM_DEFAULT | (CONF_CM_DEFAULT<<25) |
+			(CONF_CM_DEFAULT<<28));
+	write_c0_config(config0);
+	BARRIER;
+
+	configpr = read_c0_config7();
+	configpr |= (1<<19); /* enable tlb */
+	write_c0_config7(configpr);
+	BARRIER;
+}

Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/irqmap.c
===================================================================

arch/mips/philips/pnx8550/stb810/irqmap.c new file +0 -0
@@ -0,0 +1,23 @@

[...]

arch/mips/philips/pnx8550/stb810/irqmap.c line 22

Quoted 5 lines
arch/mips/philips/pnx8550/stb810/irqmap.c new file +5 -0
+char irq_tab_jbs[][5] __initdata = {
+ [8] =  { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+ [9] =  { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+ [10] = { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+};

This is somewhat unusual PCI interrupt rounting...

arch/mips/configs/pnx8550-stb810_defconfig line 6

Quoted 12 lines

Index: linux-mips.git/arch/mips/kernel/head.S
Index: linux-mips.git/arch/mips/configs/pnx8550-stb810_defconfig
===================================================================

arch/mips/configs/pnx8550-stb810_defconfig new file +6 -0
@@ -0,0 +1,1777 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.19-rc5
+# Wed Nov  8 13:46:57 2006
+#
+CONFIG_ARM=y

ARM?! Are you sure it's a correct defconfig? ;-)

WBR, Sergei

#2 lore raw
In reply to Vitaly Wool
Quoted 60 lines · Vitaly Wool

Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/Makefile
===================================================================

arch/mips/philips/pnx8550/stb810/Makefile new file +4 -0
@@ -0,0 +1,4 @@
+
+# Makefile for the Philips STB810 Board.
+
+lib-y := prom_init.o board_setup.o irqmap.o

Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/board_setup.c
===================================================================

arch/mips/philips/pnx8550/stb810/board_setup.c new file +46 -0
@@ -0,0 +1,56 @@
+/*
+ *  STB810 specific board startup routines.
+ *
+ *  Based on the arch/mips/philips/pnx8550/jbs/board_setup.c
+ *
+ *  Author: MontaVista Software, Inc.
+ *          [email protected]
+ *
+ *  Copyright 2005 MontaVista Software Inc.
+ *
+ *  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.
+ */
+
+#include <linux/init.h>
+#include <linux/sched.h>
+#include <linux/ioport.h>
+#include <linux/mm.h>
+#include <linux/console.h>
+#include <linux/mc146818rtc.h>
+#include <linux/delay.h>
+
+#include <asm/cpu.h>
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
+#include <asm/mipsregs.h>
+#include <asm/reboot.h>
+#include <asm/pgtable.h>
+
+#include <glb.h>
+
+/* CP0 hazard avoidance. */
+#define BARRIER __asm__ __volatile__(".set noreorder\n\t" \
+				     "nop; nop; nop; nop; nop; nop;\n\t" \
+				     ".set reorder\n\t")
+
+void __init board_setup(void)
+{
+	unsigned long config0, configpr;
+
+	config0 = read_c0_config();
+
+	/* clear all three cache coherency fields */
+	config0 &= ~(0x7 | (7<<25) | (7<<28));

arch/mips/philips/pnx8550/stb810/board_setup.c line 56

Quoted 10 lines
arch/mips/philips/pnx8550/stb810/board_setup.c new file +10 -0
+	config0 |= (CONF_CM_DEFAULT | (CONF_CM_DEFAULT<<25) |
+			(CONF_CM_DEFAULT<<28));
+	write_c0_config(config0);
+	BARRIER;
+
+	configpr = read_c0_config7();
+	configpr |= (1<<19); /* enable tlb */
+	write_c0_config7(configpr);
+	BARRIER;
+}

You really need that hazard barrier?

Chances are you can get away without a hazard barrier I guess.

arch/mips/philips/pnx8550/stb810/irqmap.c line 21

Quoted 9 lines

Index: linux-mips.git/arch/mips/philips/pnx8550/stb810/irqmap.c
===================================================================

arch/mips/philips/pnx8550/stb810/irqmap.c new file +4 -0
 
+char irq_tab_jbs[][5] __initdata = {
+ [8] =  { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+ [9] =  { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},
+ [10] = { -1, PNX8550_INT_PCI_INTA, 0xff, 0xff, 0xff},

Coding style, indent with tabs.

arch/mips/kernel/head.S line 141

Quoted 10 lines

Index: linux-mips.git/arch/mips/kernel/head.S
===================================================================

arch/mips/kernel/head.S +1 -1
@@ -138,7 +138,7 @@
 EXPORT(stext)					# used for profiling
 EXPORT(_stext)
 
-#if defined(CONFIG_QEMU) || defined(CONFIG_MIPS_SIM)
+#if defined(CONFIG_QEMU) || defined(CONFIG_MIPS_SIM) || defined(CONFIG_PNX8550_STB810)

Your firmware is really so broken it needs this?

arch/mips/configs/pnx8550-stb810_defconfig line 6

Quoted 11 lines

Index: linux-mips.git/arch/mips/configs/pnx8550-stb810_defconfig
===================================================================

arch/mips/configs/pnx8550-stb810_defconfig new file +6 -0
@@ -0,0 +1,1777 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.19-rc5
+# Wed Nov  8 13:46:57 2006
+#
+CONFIG_ARM=y

LOL.

Doesn't look quite right. Let's see if you find out why ;-)

Ralf

#3 lore raw
Quoted 5 lines · Ralf Baechle

LOL.

Doesn't look quite right. Let's see if you find out why ;-)

Shoot. Okay, that's really funny... copied the config from the other build... :(

Vitaly