Skip to contentSkip to conversation

powerpc: DBox2 Board Support

PATCH Superseded Jochen Friedrich 2 participants 4 messages Dec 23, 2007 – Dec 26, 2007

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 powerpc: DBox2 Board Support

This patch adds device tree source, default config and setup code for DBox2 devices.

---

arch/powerpc/boot/dts/dbox2.dts          |  263 ++++++++
arch/powerpc/configs/dbox2_defconfig     | 1042 ++++++++++++++++++++++++++++++
arch/powerpc/platforms/8xx/Kconfig       |    7 +
arch/powerpc/platforms/8xx/Makefile      |    1 +
arch/powerpc/platforms/8xx/dbox2.h       |   30 +
arch/powerpc/platforms/8xx/dbox2_setup.c |  226 +++++++
include/asm-powerpc/mpc8xx.h             |    4 +
7 files changed, 1573 insertions(+), 0 deletions(-)

create mode 100644 arch/powerpc/boot/dts/dbox2.dts create mode 100644 arch/powerpc/configs/dbox2_defconfig create mode 100644 arch/powerpc/platforms/8xx/dbox2.h create mode 100644 arch/powerpc/platforms/8xx/dbox2_setup.c

arch/powerpc/boot/dts/dbox2.dts new file +263 -0
new file mode 100644
index 0000000..8d91510
@@ -0,0 +1,263 @@
+/*
+ * DBOX2 Device Tree Source
+ *
+ * Copyright 2007 Jochen Friedrich <[email protected]>
+ *
+ * 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.
+ */
+
+/ {
+	model = "Dbox2";
+	compatible = "betaresearch,dbox2";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		PowerPC,823@0 {
+			device_type = "cpu";
+			reg = <0>;
+			d-cache-line-size = <d#16>;
+			i-cache-line-size = <d#16>;
+			d-cache-size = <d#1024>;
+			i-cache-size = <d#2048>;
+			timebase-frequency = <0>;
+			bus-frequency = <0>;
+			clock-frequency = <0>;
+			interrupts = <f 2>;	// decrementer interrupt
+			interrupt-parent = <&PIC>;
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0 2000000>;
+	};
+
+	localbus@8000000 {
+		compatible = "betaresearch,dbox2-localbus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		reg = <8000000 18000000>;
+
+		ranges = <0 8000000 18000000>;
+
+		enx@0 {
+			compatible = "c-cube,enx";
+			reg = <0 3400 1000000 200000>;
+			interrupts = <2 2>;
+			interrupt-parent = <&PIC>;
+		};
+
+		gtx@0 {
+			compatible = "c-cube,gtx";
+			reg = <400000 3000 0 200000>;
+			interrupts = <2 2>;
+			interrupt-parent = <&PIC>;
+		};
+
+		fp@0 {
+			compatible = "betaresearch,dbox2-fp";
+			interrupts = <4 2>;
+			interrupt-parent = <&PIC>;
+			gpios = <0 e>;
+			gpio-parent = <&CPM1_PIO>;
+		};
+
+		fe@0 {
+			compatible = "betaresearch,dbox2-fe";
+			interrupts = <e 2>;
+			interrupt-parent = <&PIC>;
+		};
+
+		avia@2000000 {
+			compatible = "c-cube,avia";
+			reg = <2000000 200>;
+			interrupts = <8 2>;
+			interrupt-parent = <&PIC>;
+		};
+		cam@4000000 {
+			compatible = "betaresearch,dbox2-cam";
+			reg = <4000000 20000>;
+			interrupts = <6 2>;
+			interrupt-parent = <&PIC>;
+			gpios = <1 1c 1 1d 1 1e 1 1f>;
+			gpio-parent = <&CPM1_PIO>;
+		};
+
+		cam@4040000 {
+			compatible = "betaresearch,dbox2-cam";
+			reg = <4040000 20000>;
+			interrupts = <6 2>;
+			interrupt-parent = <&PIC>;
+			gpios = <1 1c 1 1d 1 1e 1 1f>;
+			gpio-parent = <&CPM1_PIO>;
+		};
+
+		flash@8000000 {
+			// Flash also has info about model needed by setup
+			compatible = "cfi-flash",
+				     "betaresearch,dbox2-config";
+			reg = <8000000 800000>;
+			bank-width = <4>;
+			device-width = <1>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			partition@0 {
+				label = "BR bootloader";
+				reg = <0 20000>;
+				read-only;
+			};
+			partition@20000 {
+				label = "FLFS (U-Boot)";
+				reg = <20000 20000>;
+			};
+			partition@40000 {
+				label = "rootfs";
+				reg = <40000 7c0000>;
+			};
+			ovpartition@20000 {
+				label = "Flash without bootloader";
+				reg = <20000 7e0000>;
+			};
+			ovpartition@0 {
+				label = "Complete Flash";
+				reg = <0 800000>;
+				read-only;
+			};
+		};
+	};
+
+	soc@ff000000 {
+		compatible = "fsl,mpc823",
+			     "fsl,pq1-soc";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		device_type = "soc";
+		ranges = <0 ff000000 00004000>;
+		reg = <ff000000 00004000>;
+		bus-frequency = <0>;
+
+		PIC: pic@0 {
+			interrupt-controller;
+			#address-cells = <0>;
+			#interrupt-cells = <2>;
+			reg = <0 24>;
+			compatible = "fsl,mpc823-pic",
+				     "fsl,pq1-pic";
+		};
+
+		wdt@0 {
+			device_type = "watchdog";
+			compatible = "fsl,mpc823-wdt",
+				     "fsl,pq1-wdt";
+			reg = <0 10>;
+		};
+
+		cpm@9c0 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges;
+			reg = <9c0 40>;
+			command-proc = <9c0>;
+			interrupts = <0 2>;	// cpm error interrupt
+			interrupt-parent = <&CPM_PIC>;
+			compatible = "fsl,mpc823-cpm",
+				     "fsl,cpm1";
+
+			muram@2000 {
+				#address-cells = <1>;
+				#size-cells = <1>;
+				ranges = <0 2000 2000>;
+
+				data@0 {
+					compatible = "fsl,cpm-muram-data";
+					reg = <0 1c00>;
+				};
+			};
+
+			// Port D is LCD exclusive. Don't export as GPIO
+			CPM1_PIO: pio@970 {
+				compatible = "fsl,cpm1-pario";
+				reg = <970 180>;
+				num-ports = <3>;
+				#gpio-cells = <2>;
+			};
+
+			lcd@970 {
+				reg = <970 10>;
+				compatible = "samsung,ks0713";
+			};
+
+			brg@9f0 {
+				compatible = "fsl,mpc823-brg",
+					     "fsl,cpm1-brg",
+					     "fsl,cpm-brg";
+				reg = <9f0 10>;
+			};
+
+			CPM_PIC: pic@930 {
+				interrupt-controller;
+				#address-cells = <0>;
+				#interrupt-cells = <2>;
+				interrupts = <5 2 0 2>;
+				interrupt-parent = <&PIC>;
+				reg = <930 20>;
+				compatible = "fsl,mpc823-cpm-pic",
+					     "fsl,cpm1-pic";
+			};
+
+			serial@a80 {
+				device_type = "serial";
+				compatible = "fsl,mpc823-smc-uart",
+					     "fsl,cpm1-smc-uart";
+				reg = <a80 10 3e80 40>;
+				interrupts = <4 3>;
+				interrupt-parent = <&CPM_PIC>;
+				fsl,cpm-brg = <1>;
+				fsl,cpm-command = <0090>;
+			};
+
+			serial@a90 {
+				device_type = "serial";
+				compatible = "fsl,mpc823-smc-uart",
+					     "fsl,cpm1-smc-uart";
+				reg = <a90 10 3f80 40>;
+				interrupts = <3 3>;
+				interrupt-parent = <&CPM_PIC>;
+				fsl,cpm-brg = <2>;
+				fsl,cpm-command = <00d0>;
+			};
+
+			ethernet@a00 {
+				device_type = "network";
+				compatible = "fsl,mpc823-scc-enet",
+					     "fsl,cpm1-scc-enet";
+				reg = <a20 20 3d00 80>;
+				interrupts = <1d 3>;
+				interrupt-parent = <&CPM_PIC>;
+				fixed-link = <1 0 d#10>;
+				fsl,cpm-command = <0040>;
+				linux,network-index = <0>;
+			};
+
+			i2c@860 {
+				compatible = "fsl,mpc823-i2c",
+					     "fsl,cpm1-i2c",
+					     "fsl,cpm-i2c";
+				reg = <860 20 3c80 30>;
+				interrupts = <10 3>;
+				interrupt-parent = <&CPM_PIC>;
+				fsl,cpm-command = <0010>;
+			};
+		};
+	};
+	chosen {
+		linux,stdout-path = "/soc/cpm/serial@a80";
+	};
+};
arch/powerpc/configs/dbox2_defconfig new file +1042 -0

1,042 lines not on this page · raw message

arch/powerpc/platforms/8xx/Kconfig +0 -0
index bd28655..bcd3c40 100644
@@ -43,6 +43,13 @@ config PPC_EP88XC

This board is also resold by Freescale as the QUICCStart MPC885 Evaluation System and/or the CWH-PPC-885XN-VE.

+config DBOX2
+ bool "DBOX2"
+ select CPM1
+ select PPC_CPM_NEW_BINDING
+ help
+ This enables support for the Betaresearch DBOX2.
+
endchoice

menu "Freescale Ethernet driver platform-specific options"

arch/powerpc/platforms/8xx/Makefile +0 -0
index 8b70980..306df8a 100644
@@ -5,3 +5,4 @@ obj-$(CONFIG_PPC_8xx)	  += m8xx_setup.o
obj-$(CONFIG_MPC885ADS)   += mpc885ads_setup.o
obj-$(CONFIG_MPC86XADS)   += mpc86xads_setup.o
obj-$(CONFIG_PPC_EP88XC)  += ep88xc.o

+obj-$(CONFIG_DBOX2) += dbox2_setup.o

arch/powerpc/platforms/8xx/dbox2.h new file +30 -0
new file mode 100644
index 0000000..de3f674
@@ -0,0 +1,30 @@
+/*
+ * A collection of structures, addresses, and values associated with
+ * the DBox2.
+ *
+ * Author: (c) 2007 Jochen Friedrich
+ *
+ * This file is licensed under the
+ * terms of the GNU General Public License version 2.  This program is licensed
+ * "as is" without any warranty of any kind, whether express or implied.
+ */
+
+#ifdef __KERNEL__
+#ifndef __ASM_DBOX2_H__
+#define __ASM_DBOX2_H__
+
+/* Vendor information in BR Bootloader
+ */
+
+#define DBOX2_VENDOR_OFFSET	(0x1ffe0)
+
+enum dbox2_mid {
+	DBOX2_MID_NOKIA       = 1,
+	DBOX2_MID_PHILIPS     = 2,
+	DBOX2_MID_SAGEM       = 3,
+};
+
+enum dbox2_mid dbox2_get_mid(void);
+
+#endif /* __ASM_DBOX2_H__ */
+#endif /* __KERNEL__ */
arch/powerpc/platforms/8xx/dbox2_setup.c new file +226 -0

226 lines not on this page · raw message

include/asm-powerpc/mpc8xx.h +0 -0
index 2be014b..b6fd7d6 100644
@@ -23,6 +23,10 @@

#include <platforms/8xx/mpc885ads.h>
#endif

+#if defined(CONFIG_DBOX2)
+#include <platforms/8xx/dbox2.h>
+#endif
+
#ifdef CONFIG_PCMCIA_M8XX
extern struct mpc8xx_pcmcia_ops m8xx_pcmcia_ops;
#endif

Signature · 1 line
1.5.3.7
#1 lore raw
Quoted 2 lines · Jochen Friedrich

This patch adds device tree source, default config and setup code for DBox2 devices.

Cool stuff. I used to have one of these boxes myself, maybe I should get one again when it's hitting mainline.

Is this already a complete port, or do you also need some device drivers or boot wrapper code to go along with it?

arch/powerpc/boot/dts/dbox2.dts line 40

Quoted 4 lines
arch/powerpc/boot/dts/dbox2.dts new file +4 -0
+	memory {
+		device_type = "memory";
+		reg = <0 2000000>;
+	};

I thought there are both models with 32MB and 16MB available. If that's true, shouldn't this be filled out by the boot loader?

arch/powerpc/configs/dbox2_defconfig line 771

Quoted 9 lines
arch/powerpc/configs/dbox2_defconfig new file +9 -0
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_OF is not set
+# CONFIG_FB_VGA16 is not set
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_IBM_GXT4500 is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set

No hardware framebuffer driver? Can't you use the FB_OF driver by default? I'd guess that a set-top box without output is rather pointless ;-)

arch/powerpc/configs/dbox2_defconfig line 862

Quoted 8 lines
arch/powerpc/configs/dbox2_defconfig new file +8 -0
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set

What media can you connect that use the FAT file system?

I'd guess that if you can get rid of these, you can also disable the entire block layer, which should free up some kernel memory.

Quoted 5 lines
arch/powerpc/platforms/8xx/dbox2.h new file +4 -0
@@ -0,0 +1,30 @@
+/*
+ * A collection of structures, addresses, and values associated with
+ * the DBox2.
+ *

arch/powerpc/platforms/8xx/dbox2.h line 14

Quoted 10 lines
arch/powerpc/platforms/8xx/dbox2.h new file +10 -0
+ * Author: (c) 2007 Jochen Friedrich
+ *
+ * This file is licensed under the
+ * terms of the GNU General Public License version 2.  This program is licensed
+ * "as is" without any warranty of any kind, whether express or implied.
+ */
+
+#ifdef __KERNEL__
+#ifndef __ASM_DBOX2_H__
+#define __ASM_DBOX2_H__

You don't need the #ifdef __KERNEL__ any more if you don't have any user-visible parts in the header. Just leave it out of the list of exported header files (as you already do).

arch/powerpc/platforms/8xx/dbox2.h line 27

Quoted 13 lines
arch/powerpc/platforms/8xx/dbox2.h new file +13 -0
+
+/* Vendor information in BR Bootloader
+ */
+
+#define DBOX2_VENDOR_OFFSET	(0x1ffe0)
+
+enum dbox2_mid {
+	DBOX2_MID_NOKIA       = 1,
+	DBOX2_MID_PHILIPS     = 2,
+	DBOX2_MID_SAGEM       = 3,
+};
+
+enum dbox2_mid dbox2_get_mid(void);

Can you move this functionality from the kernel to the boot wrapper? It looks like this is something that really belongs into the device tree.

arch/powerpc/platforms/8xx/dbox2_setup.c line 146

Quoted 10 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +10 -0
+static void __init dbox2_setup_arch(void)
+{
+	struct device_node *np;
+	static u8 __iomem *config;
+
+	cpm_reset();
+	init_ioports();
+
+	/* Enable external IRQs for AVIA chips */
+	clrbits32(&mpc8xx_immr->im_siu_conf.sc_siumcr, 0x00000c00);

This smells like a hack. What are AVIA chips, and shouldn't their driver enable the IRQs?

Quoted 10 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +10 -0
+	if (dbox2_manuf_id == DBOX2_MID_NOKIA)
+		np = of_find_node_by_path("/localbus@8000000/enx@0");
+	else
+		np = of_find_node_by_path("/localbus@8000000/gtx@0");
+
+	if (np) {
+		of_detach_node(np);
+		of_node_put(np);
+	}
+

arch/powerpc/platforms/8xx/dbox2_setup.c line 190

Quoted 10 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +10 -0
+	if (dbox2_manuf_id == DBOX2_MID_PHILIPS)
+		np = of_find_node_by_path("/localbus@8000000/cam@4000000");
+	else
+		np = of_find_node_by_path("/localbus@8000000/cam@4040000");
+
+	if (np) {
+		of_detach_node(np);
+		of_node_put(np);
+	}
+}

What is this code for? Why do you want to detach nodes from the device tree that have been put in there by the boot loader?

arch/powerpc/platforms/8xx/dbox2_setup.c line 203

Quoted 6 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +6 -0
+static struct of_device_id __initdata of_bus_ids[] = {
+	{ .name = "soc", },
+	{ .name = "cpm", },
+	{ .name = "localbus", },
+	{},
+};

Shouldn't this check for 'compatible' properties instead of 'name'?

arch/powerpc/platforms/8xx/dbox2_setup.c line 213

Quoted 9 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +9 -0
+static int __init declare_of_platform_devices(void)
+{
+	/* Publish the QE devices */
+	if (machine_is(dbox2))
+		of_platform_bus_probe(NULL, of_bus_ids, NULL);
+
+	return 0;
+}
+device_initcall(declare_of_platform_devices);

This is a candidate for the new platform_initcall stuff.

I also once did a patch that let you have a default 'of_bus_ids' member in the ppc_md. I never got around to submitting that, but if there is interest, I can dig it out again.

include/asm-powerpc/mpc8xx.h line 29

Quoted 10 lines
include/asm-powerpc/mpc8xx.h +4 -0
@@ -23,6 +23,10 @@
 #include <platforms/8xx/mpc885ads.h>
 #endif
 
+#if defined(CONFIG_DBOX2)
+#include <platforms/8xx/dbox2.h>
+#endif
+

Don't hide #includes or platform specific #defines in #ifdef.

	Arnd <><
#2 lore raw

Hi Arnd,

Quoted 3 lines
Quoted 2 lines

This patch adds device tree source, default config and setup code for DBox2 devices.

ia > Cool stuff. I used to have one of these boxes myself, maybe I should

Quoted 4 lines

get one again when it's hitting mainline.

Is this already a complete port, or do you also need some device drivers or boot wrapper code to go along with it?

Currently, it needs the u-boot patches from cvs.tuxbox.org and some external device drivers (however, they can all be loaded as modules). The port is complete enough to get a console on the serial port and a rootfs either on flash or on nfs.

Quoted 7 lines

arch/powerpc/boot/dts/dbox2.dts line 40

Quoted 4 lines
arch/powerpc/boot/dts/dbox2.dts new file +4 -0
+	memory {
+		device_type = "memory";
+		reg = <0 2000000>;
+	};

I thought there are both models with 32MB and 16MB available. If that's true, shouldn't this be filled out by the boot loader?

IIRC, the cuImage wrapper overwrites this with the boot loader parameters.

OTOH, the memory is part of the localbus (CS1). Should it be a child of localbus in this case?

Quoted 5 lines
Quoted 5 lines
arch/powerpc/configs/dbox2_defconfig new file +5 -0
+#
+# Frame buffer hardware drivers
+#
+# CONFIG_FB_OF is not set
+# CONFIG_FB_VGA16 is not set
Quoted 8 lines

arch/powerpc/configs/dbox2_defconfig line 771

Quoted 4 lines
arch/powerpc/configs/dbox2_defconfig new file +4 -0
+# CONFIG_FB_S1D13XXX is not set
+# CONFIG_FB_IBM_GXT4500 is not set
+# CONFIG_FB_VIRTUAL is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set

No hardware framebuffer driver? Can't you use the FB_OF driver by default? I'd guess that a set-top box without output is rather pointless ;-)

I didn't check FB_OF. On Dbox2, the avia driver creates a framebuffer device.

Quoted 11 lines

arch/powerpc/configs/dbox2_defconfig line 862

Quoted 8 lines
arch/powerpc/configs/dbox2_defconfig new file +8 -0
+# DOS/FAT/NT Filesystems
+#
+CONFIG_FAT_FS=y
+CONFIG_MSDOS_FS=y
+CONFIG_VFAT_FS=y
+CONFIG_FAT_DEFAULT_CODEPAGE=437
+CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
+# CONFIG_NTFS_FS is not set

What media can you connect that use the FAT file system?

Quoted 3 lines

I'd guess that if you can get rid of these, you can also disable the entire block layer, which should free up some kernel memory.

There are two mods available using the block layer, although currently i don't support any of them:

1. using the GPIO lines of the modem port, it's possible to connect a SD card. It might be possible to use it using the GPIO SPI driver (but it would need some glue code to create a platform device).

2. using the memory expansion port and CS2, there is an IDE interface available with a CPLD acting as localbus/IDE bridge. There is a device driver for ARCH=ppc.

Unfortunately, i don't own any of these modifications.

Quoted 9 lines
Quoted 9 lines
arch/powerpc/platforms/8xx/dbox2.h new file +9 -0
+
+/* Vendor information in BR Bootloader
+ */
+
+#define DBOX2_VENDOR_OFFSET	(0x1ffe0)
+
+enum dbox2_mid {
+	DBOX2_MID_NOKIA       = 1,
+	DBOX2_MID_PHILIPS     = 2,
Quoted 8 lines

arch/powerpc/platforms/8xx/dbox2.h line 27

Quoted 4 lines
arch/powerpc/platforms/8xx/dbox2.h new file +4 -0
+	DBOX2_MID_SAGEM       = 3,
+};
+
+enum dbox2_mid dbox2_get_mid(void);

Can you move this functionality from the kernel to the boot wrapper? It looks like this is something that really belongs into the device tree.

OK.

Quoted 15 lines
Quoted 15 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +15 -0
+	if (dbox2_manuf_id == DBOX2_MID_NOKIA)
+		np = of_find_node_by_path("/localbus@8000000/enx@0");
+	else
+		np = of_find_node_by_path("/localbus@8000000/gtx@0");
+
+	if (np) {
+		of_detach_node(np);
+		of_node_put(np);
+	}
+
+	if (dbox2_manuf_id == DBOX2_MID_PHILIPS)
+		np = of_find_node_by_path("/localbus@8000000/cam@4000000");
+	else
+		np = of_find_node_by_path("/localbus@8000000/cam@4040000");
+
Quoted 8 lines

arch/powerpc/platforms/8xx/dbox2_setup.c line 189

Quoted 5 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +5 -0
+	if (np) {
+		of_detach_node(np);
+		of_node_put(np);
+	}
+}

What is this code for? Why do you want to detach nodes from the device tree that have been put in there by the boot loader?

There are small differences between the 3 manufacturers. I guess this should go to the boot wrapper, as well.

This is even more important if the localbus uses #address-cells = <2>, as the differen manufacturers set up the address mapping for CS3, CS5 and CS7 differently.

Quoted 5 lines
Quoted 5 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +5 -0
+static void __init dbox2_setup_arch(void)
+{
+	struct device_node *np;
+	static u8 __iomem *config;
+
Quoted 8 lines

arch/powerpc/platforms/8xx/dbox2_setup.c line 146

Quoted 5 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +5 -0
+	cpm_reset();
+	init_ioports();
+
+	/* Enable external IRQs for AVIA chips */
+	clrbits32(&mpc8xx_immr->im_siu_conf.sc_siumcr, 0x00000c00);

This smells like a hack. What are AVIA chips, and shouldn't their driver enable the IRQs?

No. This just configures the Pin as IRQ input. Maybe, the new GPIO functions could be used for this, instead. Then it could be done in the driver (the driver should't directly mess with SIU internals).

Quoted 8 lines

arch/powerpc/platforms/8xx/dbox2_setup.c line 203

Quoted 6 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +6 -0
+static struct of_device_id __initdata of_bus_ids[] = {
+	{ .name = "soc", },
+	{ .name = "cpm", },
+	{ .name = "localbus", },
+	{},
+};

Shouldn't this check for 'compatible' properties instead of 'name'?

I copied this from mpc885ads_setup.c.

Quoted 12 lines

arch/powerpc/platforms/8xx/dbox2_setup.c line 213

Quoted 9 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +9 -0
+static int __init declare_of_platform_devices(void)
+{
+	/* Publish the QE devices */
+	if (machine_is(dbox2))
+		of_platform_bus_probe(NULL, of_bus_ids, NULL);
+
+	return 0;
+}
+device_initcall(declare_of_platform_devices);

This is a candidate for the new platform_initcall stuff.

Quoted 3 lines

I also once did a patch that let you have a default 'of_bus_ids' member in the ppc_md. I never got around to submitting that, but if there is interest, I can dig it out again.

That would be nice :)

Quoted 6 lines
Quoted 6 lines
include/asm-powerpc/mpc8xx.h +0 -0
@@ -23,6 +23,10 @@
 #include <platforms/8xx/mpc885ads.h>
 #endif
 
Quoted 6 lines

include/asm-powerpc/mpc8xx.h line 29

Quoted 4 lines
include/asm-powerpc/mpc8xx.h +4 -0
+#if defined(CONFIG_DBOX2)
+#include <platforms/8xx/dbox2.h>
+#endif
+

Don't hide #includes or platform specific #defines in #ifdef.

As soon as the manufacturer info is included in the device tree, dbox2.h is no longer needed.

Thanks,
Jochen

#3 lore raw
Quoted 10 lines · Jochen Friedrich
Quoted 7 lines

arch/powerpc/boot/dts/dbox2.dts line 40

Quoted 4 lines
arch/powerpc/boot/dts/dbox2.dts new file +4 -0
+	memory {
+		device_type = "memory";
+		reg = <0 2000000>;
+	};

I thought there are both models with 32MB and 16MB available. If that's true, shouldn't this be filled out by the boot loader?

IIRC, the cuImage wrapper overwrites this with the boot loader parameters.

Then maybe set it to zero size in the dts file, and add a comment.

Quoted 2 lines

OTOH, the memory is part of the localbus (CS1). Should it be a child of localbus in this case?

No, memory nodes are required to be at the root of the device tree for historic reasons.

Quoted 2 lines

I didn't check FB_OF. On Dbox2, the avia driver creates a framebuffer device.

fb_of needs some properties in the device tree set up correctly, but is very simple otherwise. If it does all you need, it's probably a good idea to use that and get rid of the avia framebuffer driver

Quoted 7 lines

There are two mods available using the block layer, although currently i don't support any of them:

1. using the GPIO lines of the modem port, it's possible to connect a SD card. It might be possible to use it using the GPIO SPI driver (but it would need some glue code to create a platform device).

Quoted 5 lines

2. using the memory expansion port and CS2, there is an IDE interface available with a CPLD acting as localbus/IDE bridge. There is a device driver for ARCH=ppc.

Unfortunately, i don't own any of these modifications.

If neither of these is in the mainline kernel, it doesn't make sense to have support for the block layer in defconfig, so just try how much memory you can free up with this.

Quoted 14 lines
Quoted 5 lines
Quoted 5 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +5 -0
+static void __init dbox2_setup_arch(void)
+{
+	struct device_node *np;
+	static u8 __iomem *config;
+
Quoted 8 lines

arch/powerpc/platforms/8xx/dbox2_setup.c line 146

Quoted 5 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +5 -0
+	cpm_reset();
+	init_ioports();
+
+	/* Enable external IRQs for AVIA chips */
+	clrbits32(&mpc8xx_immr->im_siu_conf.sc_siumcr, 0x00000c00);

This smells like a hack. What are AVIA chips, and shouldn't their driver enable the IRQs?

Quoted 3 lines

No. This just configures the Pin as IRQ input. Maybe, the new GPIO functions could be used for this, instead. Then it could be done in the driver (the driver should't directly mess with SIU internals).

Maybe it should then be done in the boot wrapper. If the device tree lists this line as an interrupt, I'd say that is what it should be.

Quoted 10 lines
Quoted 8 lines

arch/powerpc/platforms/8xx/dbox2_setup.c line 203

Quoted 6 lines
arch/powerpc/platforms/8xx/dbox2_setup.c new file +6 -0
+static struct of_device_id __initdata of_bus_ids[] = {
+	{ .name = "soc", },
+	{ .name = "cpm", },
+	{ .name = "localbus", },
+	{},
+};

Shouldn't this check for 'compatible' properties instead of 'name'?

I copied this from mpc885ads_setup.c.

Right, I noticed before that we're rather inconsistent with this. It would really be good to have more common standards on this.

Quoted 5 lines
Quoted 3 lines

I also once did a patch that let you have a default 'of_bus_ids' member in the ppc_md. I never got around to submitting that, but if there is interest, I can dig it out again.

That would be nice :)

The reason I haven't submitted it yet is that I'm not sure whether there are cases where we actually _need_ to test for 'name' instead of 'compatible' because of existing device trees in firmware.

I might just do a patch and see if someone complains about the idea.

	Arnd <><