All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support
@ 2009-11-22 22:01 Albert Herranz
  2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
                   ` (3 more replies)
  0 siblings, 4 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

The following patches add the base support for the Nintendo GameCube
and Wii video game consoles on the powerpc arch.

For each video game console, the following is included:
- a device tree source
- bootwrapper support
- udbg console option
- early udbg console option
- interrupt controller support
- platform support

The Nintendo Wii patches also include support for:
- recognition of the broadway processor
- ipc communication with the open source 'mini' firmware replacement

With these patches both video game consoles can fully boot up to the
root filesystem mount phase.

Albert Herranz (19):
  powerpc: gamecube/wii: usbgecko bootwrapper console support
  powerpc: gamecube: device tree
  powerpc: gamecube: bootwrapper bits
  powerpc: wii: device tree
  powerpc: wii: bootwrapper bits
  powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  powerpc: gamecube/wii: declare as non-coherent platforms
  powerpc: gamecube/wii: do not include PCI support
  powerpc: gamecube/wii: udbg support for usbgecko
  powerpc: gamecube/wii: early debugging using usbgecko
  powerpc: gamecube/wii: flipper interrupt controller support
  powerpc: gamecube: platform support
  powerpc: gamecube: default config
  powerpc: allow ioremap within reserved fake ram regions
  powerpc: broadway processor support
  powerpc: wii: hollywood interrupt controller support
  powerpc: wii: bootmii starlet 'mini' firmware support
  powerpc: wii: platform support
  powerpc: wii: default config

 arch/powerpc/Kconfig                               |    2 +-
 arch/powerpc/Kconfig.debug                         |    8 +
 arch/powerpc/boot/Makefile                         |    7 +-
 arch/powerpc/boot/dts/gamecube.dts                 |  135 ++
 arch/powerpc/boot/dts/wii.dts                      |  244 ++++
 arch/powerpc/boot/gamecube.c                       |   78 ++
 arch/powerpc/boot/ugecon.c                         |  128 ++
 arch/powerpc/boot/ugecon.h                         |   25 +
 arch/powerpc/boot/wii.c                            |  173 +++
 arch/powerpc/boot/wrapper                          |    3 +
 arch/powerpc/configs/gamecube_defconfig            | 1061 +++++++++++++++
 arch/powerpc/configs/wii_defconfig                 | 1406 ++++++++++++++++++++
 arch/powerpc/include/asm/starlet-mini.h            |  175 +++
 arch/powerpc/include/asm/starlet.h                 |   26 +
 arch/powerpc/include/asm/udbg.h                    |    1 +
 arch/powerpc/kernel/cputable.c                     |   28 +-
 arch/powerpc/kernel/head_32.S                      |   21 +
 arch/powerpc/kernel/udbg.c                         |    2 +
 arch/powerpc/mm/pgtable_32.c                       |   19 +-
 arch/powerpc/platforms/Kconfig.cputype             |    2 +-
 arch/powerpc/platforms/embedded6xx/Kconfig         |   57 +
 arch/powerpc/platforms/embedded6xx/Makefile        |    6 +
 arch/powerpc/platforms/embedded6xx/flipper-pic.c   |  247 ++++
 arch/powerpc/platforms/embedded6xx/flipper-pic.h   |   25 +
 arch/powerpc/platforms/embedded6xx/gamecube.c      |  112 ++
 arch/powerpc/platforms/embedded6xx/gamecube_dev.c  |   34 +
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c      |  238 ++++
 arch/powerpc/platforms/embedded6xx/hlwd-pic.h      |   22 +
 arch/powerpc/platforms/embedded6xx/starlet-mipc.c  | 1053 +++++++++++++++
 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c |  318 +++++
 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h |   36 +
 arch/powerpc/platforms/embedded6xx/wii.c           |  270 ++++
 arch/powerpc/platforms/embedded6xx/wii_dev.c       |   47 +
 33 files changed, 5988 insertions(+), 21 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/gamecube.dts
 create mode 100644 arch/powerpc/boot/dts/wii.dts
 create mode 100644 arch/powerpc/boot/gamecube.c
 create mode 100644 arch/powerpc/boot/ugecon.c
 create mode 100644 arch/powerpc/boot/ugecon.h
 create mode 100644 arch/powerpc/boot/wii.c
 create mode 100644 arch/powerpc/configs/gamecube_defconfig
 create mode 100644 arch/powerpc/configs/wii_defconfig
 create mode 100644 arch/powerpc/include/asm/starlet-mini.h
 create mode 100644 arch/powerpc/include/asm/starlet.h
 create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.h
 create mode 100644 arch/powerpc/platforms/embedded6xx/gamecube.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/gamecube_dev.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.h
 create mode 100644 arch/powerpc/platforms/embedded6xx/starlet-mipc.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
 create mode 100644 arch/powerpc/platforms/embedded6xx/wii.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/wii_dev.c

^ permalink raw reply	[flat|nested] 181+ messages in thread

* [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support
  2009-11-22 22:01 [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Albert Herranz
@ 2009-11-22 22:01 ` Albert Herranz
  2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
                     ` (2 more replies)
  2009-11-22 22:48 ` [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Grant Likely
                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for using the USB Gecko adapter as a bootwrapper console on
the Nintendo GameCube and Wii video game consoles.
The USB Gecko is a 3rd party memory card interface adapter that provides
a EXI (External Interface) to USB serial converter.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/boot/Makefile |    2 +-
 arch/powerpc/boot/ugecon.c |  128 ++++++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/ugecon.h |   25 +++++++++
 3 files changed, 154 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/ugecon.c
 create mode 100644 arch/powerpc/boot/ugecon.h

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 7bfc8ad..44bce21 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -66,7 +66,7 @@ src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \
 		gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
 		4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
 		cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
-		fsl-soc.c mpc8xx.c pq2.c
+		fsl-soc.c mpc8xx.c pq2.c ugecon.c
 src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \
 		cuboot-ebony.c cuboot-hotfoot.c treeboot-ebony.c prpmc2800.c \
 		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
diff --git a/arch/powerpc/boot/ugecon.c b/arch/powerpc/boot/ugecon.c
new file mode 100644
index 0000000..704f374
--- /dev/null
+++ b/arch/powerpc/boot/ugecon.c
@@ -0,0 +1,128 @@
+/*
+ * arch/powerpc/boot/ugecon.c
+ *
+ * USB Gecko bootwrapper console.
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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 <stddef.h>
+#include "stdio.h"
+#include "types.h"
+#include "io.h"
+#include "ops.h"
+
+
+#define EXI_CLK_32MHZ           5
+
+#define EXI_CSR                 0x00
+#define   EXI_CSR_CLKMASK       (0x7<<4)
+#define     EXI_CSR_CLK_32MHZ   (EXI_CLK_32MHZ<<4)
+#define   EXI_CSR_CSMASK        (0x7<<7)
+#define     EXI_CSR_CS_0        (0x1<<7)  /* Chip Select 001 */
+
+#define EXI_CR                  0x0c
+#define   EXI_CR_TSTART         (1<<0)
+#define   EXI_CR_WRITE		(1<<2)
+#define   EXI_CR_READ_WRITE     (2<<2)
+#define   EXI_CR_TLEN(len)      (((len)-1)<<4)
+
+#define EXI_DATA                0x10
+
+
+/* virtual address base for input/output, retrieved from device tree */
+static void *ug_io_base;
+
+
+static u32 ug_io_transaction(u32 in)
+{
+	u32 *csr_reg = ug_io_base + EXI_CSR;
+	u32 *data_reg = ug_io_base + EXI_DATA;
+	u32 *cr_reg = ug_io_base + EXI_CR;
+	u32 csr, data, cr;
+
+	/* select */
+	csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0;
+	out_be32(csr_reg, csr);
+
+	/* read/write */
+	data = in;
+	out_be32(data_reg, data);
+	cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART;
+	out_be32(cr_reg, cr);
+
+	while (in_be32(cr_reg) & EXI_CR_TSTART)
+		barrier();
+
+	/* deselect */
+	out_be32(csr_reg, 0);
+
+	data = in_be32(data_reg);
+	return data;
+}
+
+static int ug_is_txfifo_ready(void)
+{
+	return ug_io_transaction(0xc0000000) & 0x04000000;
+}
+
+static void ug_raw_putc(char ch)
+{
+	ug_io_transaction(0xb0000000 | (ch << 20));
+}
+
+static void ug_putc(char ch)
+{
+	int count = 16;
+
+	if (!ug_io_base)
+		return;
+
+	while (!ug_is_txfifo_ready() && count--)
+		barrier();
+	if (count)
+		ug_raw_putc(ch);
+}
+
+void ug_console_write(const char *buf, int len)
+{
+	char *b = (char *)buf;
+
+	while (len--) {
+		if (*b == '\n')
+			ug_putc('\r');
+		ug_putc(*b++);
+	}
+}
+
+int ug_is_adapter_present(void)
+{
+	if (!ug_io_base)
+		return 0;
+
+	return ug_io_transaction(0x90000000) == 0x04700000;
+}
+
+int ug_grab_io_base(void)
+{
+	u32 v;
+	void *devp;
+
+	devp = find_node_by_alias("ugecon");
+	if (devp == NULL)
+		goto err_out;
+	if (getprop(devp, "virtual-reg", &v, sizeof(v)) != sizeof(v))
+		goto err_out;
+
+	ug_io_base = (u8 *)v;
+	return 0;
+
+err_out:
+	return -1;
+}
diff --git a/arch/powerpc/boot/ugecon.h b/arch/powerpc/boot/ugecon.h
new file mode 100644
index 0000000..1fdb590
--- /dev/null
+++ b/arch/powerpc/boot/ugecon.h
@@ -0,0 +1,25 @@
+/*
+ * arch/powerpc/boot/ugecon.h
+ *
+ * USB Gecko early bootwrapper console.
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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 __UGECON_H
+#define __UGECON_H
+
+extern int ug_grab_io_base(void);
+extern int ug_is_adapter_present(void);
+
+extern void ug_putc(char ch);
+extern void ug_console_write(const char *buf, int len);
+
+#endif /* __UGECON_H */
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
@ 2009-11-22 22:01   ` Albert Herranz
  2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
                       ` (2 more replies)
  2009-11-22 22:50   ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Grant Likely
  2009-11-26  4:12   ` Benjamin Herrenschmidt
  2 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add a device tree source file for the Nintendo GameCube video game console.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/boot/dts/gamecube.dts |  135 ++++++++++++++++++++++++++++++++++++
 1 files changed, 135 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/gamecube.dts

diff --git a/arch/powerpc/boot/dts/gamecube.dts b/arch/powerpc/boot/dts/gamecube.dts
new file mode 100644
index 0000000..941a2c4
--- /dev/null
+++ b/arch/powerpc/boot/dts/gamecube.dts
@@ -0,0 +1,135 @@
+/*
+ * arch/powerpc/boot/dts/gamecube.dts
+ *
+ * Nintendo GameCube platform device tree source
+ * Copyright (C) 2007-2009 The GameCube Linux Team
+ * Copyright (C) 2007,2008,2009 Albert Herranz
+ *
+ * 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.
+ *
+ */
+
+/dts-v1/;
+
+/ {
+	model = "NintendoGameCube";
+	compatible = "nintendo,gamecube";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen {
+		bootargs = "root=/dev/gcnsda2 rootwait udbg-immortal";
+		linux,stdout-path = &USBGECKO0;
+	};
+
+	aliases {
+		ugecon = &USBGECKO0;
+	};
+
+	memory {
+		device_type = "memory";
+		/* 24M minus framebuffer memory area (640*576*2*2) */
+		reg = <0x00000000 0x01698000>;
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		PowerPC,gekko@0 {
+			device_type = "cpu";
+			reg = <0>;
+			clock-frequency = <486000000>; /* 486MHz */
+			bus-frequency = <162000000>; /* 162MHz core-to-bus 3x */
+			timebase-frequency = <40500000>; /* 162MHz / 4 */
+			i-cache-line-size = <32>;
+			d-cache-line-size = <32>;
+			i-cache-size = <32768>;
+			d-cache-size = <32768>;
+		};
+	};
+
+	/* devices contained int the flipper chipset */
+	soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		#interrupt-cells = <1>;
+		model = "flipper";
+		compatible = "nintendo,flipper";
+		clock-frequency = <162000000>; /* 162MHz */
+		ranges = <0x0c000000 0x0c000000 0x00010000>;
+
+		video@0c002000 {
+			compatible = "nintendo,flipper-video";
+			reg = <0x0c002000 0x100>;
+			interrupts = <8>;
+			interrupt-parent = <&pic>;
+			/* XFB is the eXternal FrameBuffer */
+			xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
+			xfb-size = <0x168000>;
+		};
+
+		pic: pic@0c003000 {
+			#interrupt-cells = <1>;
+			compatible = "nintendo,flipper-pic";
+			reg = <0x0c003000 0x8>;
+			interrupt-controller;
+		};
+
+		resetswitch@0c003000 {
+			compatible = "nintendo,flipper-resetswitch";
+			reg = <0x0c003000 0x4>;
+			interrupts = <1>;
+			interrupt-parent = <&pic>;
+		};
+
+		auxram@0c005000 {
+			compatible = "nintendo,flipper-auxram";
+			reg = <0x0c005000 0x200>;	/* DSP */
+			interrupts = <6>;
+			interrupt-parent = <&pic>;
+		};
+
+		audio@0c005000 {
+			compatible = "nintendo,flipper-audio";
+			reg = <0x0c005000 0x200		/* DSP */
+			       0x0c006c00 0x20>;	/* AI */
+			interrupts = <6>;
+			interrupt-parent = <&pic>;
+		};
+
+		disk@0c006000 {
+			compatible = "nintendo,flipper-disk";
+			reg = <0x0c006000 0x40>;
+			interrupts = <2>;
+			interrupt-parent = <&pic>;
+		};
+
+		serial@0c006400 {
+			compatible = "nintendo,flipper-serial";
+			reg = <0x0c006400 0x100>;
+			interrupts = <3>;
+			interrupt-parent = <&pic>;
+		};
+
+		/* External Interface bus */
+		exi@0c006800 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "nintendo,flipper-exi";
+			reg = <0x0c006800 0x40>;
+			interrupts = <4>;
+			interrupt-parent = <&pic>;
+
+			USBGECKO0: usbgecko@0c006814 {
+				compatible = "usbgecko,usbgecko";
+				reg = <0x0c006814 0x14>;
+				virtual-reg = <0xcc006814>;
+			};
+		};
+        };
+};
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
@ 2009-11-22 22:01     ` Albert Herranz
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
                         ` (2 more replies)
  2009-11-22 23:02     ` [RFC PATCH 02/19] powerpc: gamecube: device tree Grant Likely
  2009-11-25 18:00     ` Segher Boessenkool
  2 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for the Nintendo GameCube video game console to the powerpc
bootwrapper.

dtbImage.gamecube is a wrapped image that contains a flat device tree,
an entry point compatible with SDload, and an optional initrd.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/boot/Makefile   |    4 ++-
 arch/powerpc/boot/gamecube.c |   78 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 81 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/gamecube.c

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index 44bce21..b2f06b0 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -76,7 +76,8 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c
 		cuboot-katmai.c cuboot-rainier.c redboot-8xx.c ep8248e.c \
 		cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
 		virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
-		cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c
+		cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \
+		gamecube.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -254,6 +255,7 @@ image-$(CONFIG_KSI8560)			+= cuImage.ksi8560
 image-$(CONFIG_STORCENTER)		+= cuImage.storcenter
 image-$(CONFIG_MPC7448HPC2)		+= cuImage.mpc7448hpc2
 image-$(CONFIG_PPC_C2K)			+= cuImage.c2k
+image-$(CONFIG_GAMECUBE)		+= dtbImage.gamecube
 
 # Board port in arch/powerpc/platform/amigaone/Kconfig
 image-$(CONFIG_AMIGAONE)		+= cuImage.amigaone
diff --git a/arch/powerpc/boot/gamecube.c b/arch/powerpc/boot/gamecube.c
new file mode 100644
index 0000000..0d6c517
--- /dev/null
+++ b/arch/powerpc/boot/gamecube.c
@@ -0,0 +1,78 @@
+/*
+ * arch/powerpc/boot/gamecube.c
+ *
+ * Nintendo GameCube bootwrapper support
+ * Copyright (C) 2004-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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 <stddef.h>
+#include "stdio.h"
+#include "types.h"
+#include "io.h"
+#include "ops.h"
+
+#include "ugecon.h"
+
+BSS_STACK(8192);
+
+/*
+ * We enter with the cache enabled, the MMU enabled and some known legacy
+ * memory mappings active. xBAT3 is unused.
+ *
+ * We leave the MMU enabled, but we switch to an identity mapped memory
+ * scheme as expected by the start code.
+ *
+ */
+asm ("\n\
+.text\n\
+.globl _zimage_start\n\
+_zimage_start:\n\
+\n\
+	isync\n\
+	/* IBAT3,DBAT3 for first 16Mbytes */\n\
+	li	8, 0x01ff	/* 16MB */\n\
+	li      9, 0x0002	/* rw */\n\
+	mtspr   0x216, 8	/* IBAT3U */\n\
+	mtspr   0x217, 9	/* IBAT3L */\n\
+	mtspr   0x21e, 8	/* DBAT3U */\n\
+	mtspr   0x21f, 9	/* DBAT3L */\n\
+\n\
+	sync\n\
+	isync\n\
+\n\
+	li	3, 0\n\
+	li	4, 0\n\
+	li	5, 0\n\
+\n\
+	bcl-    20,4*cr7+so,1f\n\
+1:\n\
+	mflr    8\n\
+	clrlwi  8, 8, 3\n\
+	addi    8, 8, 2f - 1b\n\
+	mtlr    8\n\
+	blr\n\
+2:\n\
+	b _zimage_start_lib\n\
+");
+
+/*
+ *
+ */
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
+{
+	u32 heapsize = 16*1024*1024 - (u32)_end;
+
+	simple_alloc_init(_end, heapsize, 32, 64);
+	fdt_init(_dtb_start);
+
+	if (!ug_grab_io_base() && ug_is_adapter_present())
+		console_ops.write = ug_console_write;
+}
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
@ 2009-11-22 22:01       ` Albert Herranz
  2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
                           ` (3 more replies)
  2009-11-22 23:11       ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Grant Likely
  2009-11-24  0:08       ` Segher Boessenkool
  2 siblings, 4 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add a device tree source file for the Nintendo Wii video game console.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/boot/dts/wii.dts |  244 +++++++++++++++++++++++++++++++++++++++++
 1 files changed, 244 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/boot/dts/wii.dts

diff --git a/arch/powerpc/boot/dts/wii.dts b/arch/powerpc/boot/dts/wii.dts
new file mode 100644
index 0000000..a30a804
--- /dev/null
+++ b/arch/powerpc/boot/dts/wii.dts
@@ -0,0 +1,244 @@
+/*
+ * arch/powerpc/boot/dts/wii.dts
+ *
+ * Nintendo Wii platform device tree source
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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.
+ *
+ */
+
+/dts-v1/;
+
+/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */
+/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */
+
+/ {
+	model = "NintendoWii";
+	compatible = "nintendo,wii";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	chosen {
+		/* root filesystem on 2nd partition of SD card */
+		bootargs = "nobats root=/dev/mmcblk0p2 rootwait udbg-immortal";
+		linux,stdout-path = &USBGECKO0;
+	};
+
+	aliases {
+		ugecon = &USBGECKO0;
+		hw_gpio = &gpio1;
+	};
+
+	/*
+	 * The Nintendo Wii has two discontiguous RAM memory areas called
+	 * MEM1 and MEM2.
+	 * MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
+	 * MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
+	 * Between both memory address ranges there is an address space
+	 * where memory-mapped I/O registers are found.
+	 *
+	 * Currently, Linux 32-bit PowerPC does not support RAM in
+	 * discontiguous memory address spaces. Thus, in order to use
+	 * both RAM areas, we declare as RAM the range from the start of
+	 * MEM1 to the end of useable MEM2 and exclude the needed parts
+	 * with /memreserve/ statements, at the expense of wasting a bit
+	 * of memory.
+	 */
+	memory {
+		device_type = "memory";
+		/* MEM1 + memory hole + MEM2 - firmware/buffers area */
+		reg = <0x00000000 0x133e0000>;
+	};
+
+	cpus {
+		#cpus = <1>;
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		PowerPC,broadway@0 {
+			device_type = "cpu";
+			reg = <0>;
+			clock-frequency = <729000000>; /* 729MHz */
+			bus-frequency = <243000000>; /* 243MHz core-to-bus 3x */
+			timebase-frequency = <60750000>; /* 243MHz / 4 */
+			i-cache-line-size = <32>;
+			d-cache-line-size = <32>;
+			i-cache-size = <32768>;
+			d-cache-size = <32768>;
+		};
+	};
+
+	/* devices contained in the hollywood chipset */
+	soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		#interrupt-cells = <1>;
+		model = "hollywood";
+		compatible = "nintendo,hollywood";
+		clock-frequency = <243000000>; /* 243MHz */
+		ranges = <0x0c000000 0x0c000000 0x00010000
+			  0x0d000000 0x0d000000 0x00010000
+			  0x0d040000 0x0d040000 0x00050000
+			  0x0d800000 0x0d800000 0x00001000
+			  0x133e0000 0x133e0000 0x00c20000>;
+
+		video@0c002000 {
+			compatible = "nintendo,hollywood-video";
+			reg = <0x0c002000 0x100>;
+			interrupts = <8>;
+			interrupt-parent = <&PIC0>;
+		};
+
+		PIC0: pic0@0c003000 {
+			#interrupt-cells = <1>;
+			compatible = "nintendo,flipper-pic";
+			reg = <0x0c003000 0x8>;
+			interrupt-controller;
+		};
+
+		resetswitch@0c003000 {
+			compatible = "nintendo,hollywood-resetswitch";
+			reg = <0x0c003000 0x4>;
+			interrupts = <1>;
+			interrupt-parent = <&PIC0>;
+		};
+
+		audio@0c005000 {
+			compatible = "nintendo,hollywood-audio";
+			reg = <0x0c005000 0x200		/* DSP */
+			       0x0d006c00 0x20>;	/* AI */
+			interrupts = <6>;
+			interrupt-parent = <&PIC0>;
+		};
+
+		/* Team Twiizers' 'mini' firmware IPC */
+		mini@0d000000 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			#interrupt-cells = <1>;
+			compatible = "twiizers,starlet-mini-ipc";
+			reg = <0x0d000000 0x40	/* IPC */
+			       0x13fffffc 0x4>;	/* mini header pointer */
+		};
+
+		serial@0d006400 {
+			compatible = "nintendo,hollywood-serial";
+			reg = <0x0d006400 0x100>;
+			interrupts = <3>;
+			interrupt-parent = <&PIC0>;
+		};
+
+		/* External Interface bus */
+		exi@0d006800 {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "nintendo,hollywood-exi";
+			reg = <0x0d006800 0x40>;
+			interrupts = <4>;
+			interrupt-parent = <&PIC0>;
+
+			USBGECKO0: usbgecko@0d006814 {
+				compatible = "usbgecko,usbgecko";
+				reg = <0x0d006814 0x14>;
+				virtual-reg = <0xcd006814>;
+			};
+		};
+
+		ehci@0d040000 {
+			compatible = "nintendo,hollywood-ehci";
+			reg = <0x0d040000 0x100
+			       0x133e0000 0x80000>; /* 512 KB */
+			interrupts = <4>;
+			interrupt-parent = <&PIC1>;
+		};
+
+		ohci0@0d050000 {
+			compatible = "nintendo,hollywood-ohci";
+			reg = <0x0d050000 0x100
+			       0x13460000 0x80000>; /* 512 KB */
+			interrupts = <5>;
+			interrupt-parent = <&PIC1>;
+		};
+
+		ohci1@0d060000 {
+			compatible = "nintendo,hollywood-ohci";
+			reg = <0x0d060000 0x100
+			       0x134e0000 0x80000>; /* 512 KB */
+			interrupts = <6>;
+			interrupt-parent = <&PIC1>;
+		};
+
+		sdhc0@0d070000 {
+			compatible = "nintendo,hollywood-sdhci";
+			reg = <0x0d070000 0x200>;
+			interrupts = <7>;
+			interrupt-parent = <&PIC1>;
+		};
+
+		sdhc1@0d080000 {
+			compatible = "nintendo,hollywood-sdhci";
+			reg = <0x0d080000 0x200>;
+			interrupts = <8>;
+			interrupt-parent = <&PIC1>;
+		};
+
+		PIC1: pic1@0d800030 {
+			#interrupt-cells = <1>;
+			compatible = "nintendo,hollywood-pic";
+			reg = <0x0d800030 0x8>;
+			interrupt-controller;
+			interrupts = <14>;
+			interrupt-parent = <&PIC0>;
+		};
+
+		hollywood-ahbprot@0d800064 {
+			compatible = "nintendo,hollywood-ahbprot";
+			reg = <0x0d800064 0x4>;
+		};
+
+		gpio0: hollywood-gpio@0d8000c0 {
+			compatible = "nintendo,hollywood-gpio";
+			reg = <0x0d8000c0 0x20>;
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+
+		gpio1: hollywood-gpio@0d8000e0 {
+			compatible = "nintendo,hollywood-gpio";
+			reg = <0x0d8000e0 0x20>;
+			gpio-controller;
+			#gpio-cells = <2>;
+		};
+
+		hollywood-resets@0d800194 {
+			compatible = "nintendo,hollywood-resets";
+			reg = <0x0d800194 0x4>;
+		};
+
+		i2c-video {
+			#address-cells = <1>;
+			#size-cells = <0>;
+		        compatible = "virtual,i2c-gpio";
+
+		        gpios = <&gpio0  16 0 /* 31-15 */
+		                 &gpio0  17 0 /* 31-14 */
+				>;
+		        sda-is-open-drain = <1>;
+		        sda-enforce-dir = <1>;
+		        scl-is-open-drain = <1>;
+		        scl-is-output-only = <1>;
+		        udelay = <2>;
+
+		        audio-video-encoder {
+		                compatible = "nintendo,wii-ave-rvl";
+		                reg = <0x70>;
+		        };
+		};
+	};
+};
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 05/19] powerpc: wii: bootwrapper bits
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
@ 2009-11-22 22:01         ` Albert Herranz
  2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
                             ` (2 more replies)
  2009-11-22 23:18         ` [RFC PATCH 04/19] powerpc: wii: device tree Grant Likely
                           ` (2 subsequent siblings)
  3 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for the Nintendo Wii video game console to the powerpc
bootwrapper.

dtbImage.wii is a wrapped image that contains a flat device tree,
an entry point compatible with the Homebrew Channel and BootMii,
and an optional initrd.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/boot/Makefile |    3 +-
 arch/powerpc/boot/wii.c    |  173 ++++++++++++++++++++++++++++++++++++++++++++
 arch/powerpc/boot/wrapper  |    3 +
 3 files changed, 178 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/boot/wii.c

diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
index b2f06b0..fbaf101 100644
--- a/arch/powerpc/boot/Makefile
+++ b/arch/powerpc/boot/Makefile
@@ -77,7 +77,7 @@ src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c
 		cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yosemite.c simpleboot.c \
 		virtex405-head.S virtex.c redboot-83xx.c cuboot-sam440ep.c \
 		cuboot-acadia.c cuboot-amigaone.c cuboot-kilauea.c \
-		gamecube.c
+		gamecube.c wii.c
 src-boot := $(src-wlib) $(src-plat) empty.c
 
 src-boot := $(addprefix $(obj)/, $(src-boot))
@@ -256,6 +256,7 @@ image-$(CONFIG_STORCENTER)		+= cuImage.storcenter
 image-$(CONFIG_MPC7448HPC2)		+= cuImage.mpc7448hpc2
 image-$(CONFIG_PPC_C2K)			+= cuImage.c2k
 image-$(CONFIG_GAMECUBE)		+= dtbImage.gamecube
+image-$(CONFIG_WII)			+= dtbImage.wii
 
 # Board port in arch/powerpc/platform/amigaone/Kconfig
 image-$(CONFIG_AMIGAONE)		+= cuImage.amigaone
diff --git a/arch/powerpc/boot/wii.c b/arch/powerpc/boot/wii.c
new file mode 100644
index 0000000..65b73a1
--- /dev/null
+++ b/arch/powerpc/boot/wii.c
@@ -0,0 +1,173 @@
+/*
+ * arch/powerpc/boot/wii.c
+ *
+ * Nintendo Wii bootwrapper support
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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 <stddef.h>
+#include "stdio.h"
+#include "types.h"
+#include "io.h"
+#include "ops.h"
+
+#include "ugecon.h"
+
+
+BSS_STACK(8192);
+
+/*
+ * We enter with an unknown cache, high BATs and MMU status.
+ *
+ * We enable the MMU with an identity mapped memory scheme as expected
+ * by the start code.
+ *
+ */
+asm ("\n\
+.text\n\
+.globl _zimage_start\n\
+_zimage_start:\n\
+\n\
+	mfmsr	9\n\
+	andi.	0, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\
+	bcl	20, 31, 1f\n\
+1: \n\
+	mflr	8\n\
+	clrlwi	8, 8, 3		/* convert to a real address */\n\
+	addi	8, 8, _mmu_off - 1b\n\
+	andc	9, 9, 0\n\
+	mtspr	0x01a, 8	/* SRR0 */\n\
+	mtspr	0x01b, 9	/* SRR1 */\n\
+	sync\n\
+	rfi\n\
+_mmu_off: \n\
+	/* MMU disabled */\n\
+\n\
+	/* Setup BATs */\n\
+	isync\n\
+	li      8, 0\n\
+	mtspr	0x210, 8	/* IBAT0U */\n\
+	mtspr	0x211, 8	/* IBAT0L */\n\
+	mtspr	0x212, 8	/* IBAT1U */\n\
+	mtspr	0x213, 8	/* IBAT1L */\n\
+	mtspr	0x214, 8	/* IBAT2U */\n\
+	mtspr	0x215, 8	/* IBAT2L */\n\
+	mtspr	0x216, 8	/* IBAT3U */\n\
+	mtspr	0x217, 8	/* IBAT3L */\n\
+	mtspr	0x218, 8	/* DBAT0U */\n\
+	mtspr	0x219, 8	/* DBAT0L */\n\
+	mtspr	0x21a, 8	/* DBAT1U */\n\
+	mtspr	0x21b, 8	/* DBAT1L */\n\
+	mtspr	0x21c, 8	/* DBAT2U */\n\
+	mtspr	0x21d, 8	/* DBAT2L */\n\
+	mtspr	0x21e, 8	/* DBAT3U */\n\
+	mtspr	0x21f, 8	/* DBAT3L */\n\
+\n\
+	mtspr	0x230, 8	/* IBAT4U */\n\
+	mtspr	0x231, 8	/* IBAT4L */\n\
+	mtspr	0x232, 8	/* IBAT5U */\n\
+	mtspr	0x233, 8	/* IBAT5L */\n\
+	mtspr	0x234, 8	/* IBAT6U */\n\
+	mtspr	0x235, 8	/* IBAT6L */\n\
+	mtspr	0x236, 8	/* IBAT7U */\n\
+	mtspr	0x237, 8	/* IBAT7L */\n\
+	mtspr	0x238, 8	/* DBAT4U */\n\
+	mtspr	0x239, 8	/* DBAT4L */\n\
+	mtspr	0x23a, 8	/* DBAT5U */\n\
+	mtspr	0x23b, 8	/* DBAT5L */\n\
+	mtspr	0x23c, 8	/* DBAT6U */\n\
+	mtspr	0x23d, 8	/* DBAT6L */\n\
+	mtspr	0x23e, 8	/* DBAT7U */\n\
+	mtspr	0x23f, 8	/* DBAT7L */\n\
+\n\
+	isync\n\
+	li	8, 0x01ff	/* first 16MiB */\n\
+	li	9, 0x0002	/* rw */\n\
+	mtspr	0x210, 8	/* IBAT0U */\n\
+	mtspr	0x211, 9	/* IBAT0L */\n\
+	mtspr	0x218, 8	/* DBAT0U */\n\
+	mtspr	0x219, 9	/* DBAT0L */\n\
+\n\
+	lis	8, 0xcc00	/* I/O mem */\n\
+	ori	8, 8, 0x3ff	/* 32MiB */\n\
+	lis	9, 0x0c00\n\
+	ori	9, 9, 0x002a	/* uncached, guarded, rw */\n\
+	mtspr	0x21a, 8	/* DBAT1U */\n\
+	mtspr	0x21b, 9	/* DBAT1L */\n\
+\n\
+	lis	8, 0x0100	/* next 8MiB */\n\
+	ori	8, 8, 0x00ff	/* 8MiB */\n\
+	lis	9, 0x0100	/* next 8MiB */\n\
+	ori	9, 9, 0x0002	/* rw */\n\
+	mtspr	0x214, 8	/* IBAT2U */\n\
+	mtspr	0x215, 9	/* IBAT2L */\n\
+	mtspr	0x21c, 8	/* DBAT2U */\n\
+	mtspr	0x21d, 9	/* DBAT2L */\n\
+\n\
+	lis	8, 0x1000	/* MEM2 */\n\
+	ori	8, 8, 0x07ff	/* 64MiB */\n\
+	lis	9, 0x1000\n\
+	ori	9, 9, 0x0002	/* rw */\n\
+	mtspr	0x216, 8	/* IBAT3U */\n\
+	mtspr	0x217, 9	/* IBAT3L */\n\
+	mtspr	0x21e, 8	/* DBAT3U */\n\
+	mtspr	0x21f, 9	/* DBAT3L */\n\
+\n\
+	sync\n\
+	isync\n\
+\n\
+	/* enable high BATs */\n\
+	lis	8, 0x8200\n\
+	mtspr	0x3f3, 8	/* HID4 */\n\
+\n\
+	/* enable caches */\n\
+	mfspr	8, 0x3f0\n\
+	ori	8, 8, 0xc000\n\
+	mtspr	0x3f0, 8	/* HID0 */\n\
+	isync\n\
+\n\
+	li	3, 0\n\
+	li	4, 0\n\
+	li	5, 0\n\
+\n\
+	bcl	20, 31, 1f\n\
+1: \n\
+	mflr    8\n\
+	addi    8, 8, _mmu_on - 1b\n\
+	mfmsr	9\n\
+	ori	9, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\
+	mtspr	0x01a, 8	/* SRR0 */\n\
+	mtspr	0x01b, 9	/* SRR1 */\n\
+	sync\n\
+	rfi\n\
+_mmu_on: \n\
+	/* turn on the front blue led (aka: yay! we got here!) */\n\
+	lis	8, 0xcd00\n\
+	ori	8, 8, 0x00c0\n\
+	lwz	9, 0(8)\n\
+	ori	9, 9, 0x20\n\
+	stw	9, 0(8)\n\
+	b _zimage_start_lib\n\
+");
+
+/*
+ *
+ */
+void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
+{
+	u32 heapsize = 24*1024*1024 - (u32)_end;
+
+	simple_alloc_init(_end, heapsize, 32, 64);
+	fdt_init(_dtb_start);
+
+	if (!ug_grab_io_base() && ug_is_adapter_present())
+		console_ops.write = ug_console_write;
+}
+
diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
index ac9e9a5..0e9ce10 100755
--- a/arch/powerpc/boot/wrapper
+++ b/arch/powerpc/boot/wrapper
@@ -230,6 +230,9 @@ xpedite52*)
     link_address='0x1400000'
     platformo=$object/cuboot-85xx.o
     ;;
+wii|gamecube)
+    link_address='0x600000'
+    ;;
 esac
 
 vmz="$tmpdir/`basename \"$kernel\"`.$ext"
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
@ 2009-11-22 22:01           ` Albert Herranz
  2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
                               ` (2 more replies)
  2009-11-22 23:19           ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Grant Likely
  2009-11-24  0:33           ` Segher Boessenkool
  2 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add a config option GAMECUBE_COMMON to be used as a dependency for all
options common to the Nintendo GameCube and Wii video game consoles.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/Kconfig |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 291ac9d..97a2dbc 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -90,3 +90,7 @@ config MPC10X_OPENPIC
 config MPC10X_STORE_GATHERING
 	bool "Enable MPC10x store gathering"
 	depends on MPC10X_BRIDGE
+
+config GAMECUBE_COMMON
+	bool
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms
  2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
@ 2009-11-22 22:01             ` Albert Herranz
  2009-11-22 22:01               ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Albert Herranz
                                 ` (2 more replies)
  2009-11-22 23:20             ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Grant Likely
  2009-11-24  0:35             ` Segher Boessenkool
  2 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

The processors bundled in the Nintendo GameCube and Wii video game consoles
require explicit cache handling when DMA engines are used.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/Kconfig.cputype     |    2 +-
 arch/powerpc/platforms/embedded6xx/Kconfig |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
index e382cae..80d934b 100644
--- a/arch/powerpc/platforms/Kconfig.cputype
+++ b/arch/powerpc/platforms/Kconfig.cputype
@@ -312,7 +312,7 @@ config NR_CPUS
 
 config NOT_COHERENT_CACHE
 	bool
-	depends on 4xx || 8xx || E200 || PPC_MPC512x
+	depends on 4xx || 8xx || E200 || PPC_MPC512x || GAMECUBE_COMMON
 	default y
 
 config CHECK_CACHE_COHERENCY
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 97a2dbc..31487e4 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -93,4 +93,5 @@ config MPC10X_STORE_GATHERING
 
 config GAMECUBE_COMMON
 	bool
+	select NOT_COHERENT_CACHE
 
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support
  2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
@ 2009-11-22 22:01               ` Albert Herranz
  2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
  2009-11-22 23:21                 ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Grant Likely
  2009-11-22 22:20               ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Arnd Bergmann
  2009-11-26  5:09               ` Benjamin Herrenschmidt
  2 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

The Nintendo GameCube and Wii video game consoles do not have PCI hardware.
Avoid wasting their scarce memory by not including PCI support into the
kernel.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/Kconfig |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2ba14e7..84b2566 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -679,7 +679,7 @@ config PPC_PCI_CHOICE
 config PCI
 	bool "PCI support" if PPC_PCI_CHOICE
 	default y if !40x && !CPM2 && !8xx && !PPC_83xx \
-		&& !PPC_85xx && !PPC_86xx
+		&& !PPC_85xx && !PPC_86xx && !GAMECUBE_COMMON
 	default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
 	default PCI_QSPAN if !4xx && !CPM2 && 8xx
 	select ARCH_SUPPORTS_MSI
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-22 22:01               ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Albert Herranz
@ 2009-11-22 22:01                 ` Albert Herranz
  2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
                                     ` (3 more replies)
  2009-11-22 23:21                 ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Grant Likely
  1 sibling, 4 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for using the USB Gecko adapter via the udbg facility on
the Nintendo GameCube and Wii video game consoles.
The USB Gecko is a 3rd party memory card interface adapter that provides
a EXI (External Interface) to USB serial converter.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/Kconfig         |   13 +
 arch/powerpc/platforms/embedded6xx/Makefile        |    1 +
 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c |  285 ++++++++++++++++++++
 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h |   30 ++
 4 files changed, 329 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 31487e4..bfd88be 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -95,3 +95,16 @@ config GAMECUBE_COMMON
 	bool
 	select NOT_COHERENT_CACHE
 
+config USBGECKO_UDBG
+	bool "USB Gecko udbg console for the Nintendo GameCube/Wii"
+	depends on GAMECUBE_COMMON
+	help
+	  If you say yes to this option, support will be included for the
+	  USB Gecko adapter as an udbg console.
+	  The USB Gecko is a EXI to USB Serial converter that can be plugged
+	  into a memcard slot in the Nintendo GameCube/Wii.
+
+	  This driver bypasses the EXI layer completely.
+
+	  If in doubt, say N here.
+
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 0773c08..0ab7492 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_STORCENTER)	+= storcenter.o
 obj-$(CONFIG_PPC_HOLLY)		+= holly.o
 obj-$(CONFIG_PPC_PRPMC2800)	+= prpmc2800.o
 obj-$(CONFIG_PPC_C2K)		+= c2k.o
+obj-$(CONFIG_USBGECKO_UDBG)	+= usbgecko_udbg.o
diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
new file mode 100644
index 0000000..49f86e8
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
@@ -0,0 +1,285 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
+ *
+ * udbg serial input/output routines for the USB Gecko adapter.
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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 <asm/io.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+
+#include <mm/mmu_decl.h>
+
+#include "usbgecko_udbg.h"
+
+
+#define EXI_CLK_32MHZ           5
+
+#define EXI_CSR                 0x00
+#define   EXI_CSR_CLKMASK       (0x7<<4)
+#define     EXI_CSR_CLK_32MHZ   (EXI_CLK_32MHZ<<4)
+#define   EXI_CSR_CSMASK        (0x7<<7)
+#define     EXI_CSR_CS_0        (0x1<<7)  /* Chip Select 001 */
+
+#define EXI_CR                  0x0c
+#define   EXI_CR_TSTART         (1<<0)
+#define   EXI_CR_WRITE		(1<<2)
+#define   EXI_CR_READ_WRITE     (2<<2)
+#define   EXI_CR_TLEN(len)      (((len)-1)<<4)
+
+#define EXI_DATA                0x10
+
+#define UG_READ_ATTEMPTS	100
+#define UG_WRITE_ATTEMPTS	100
+
+
+static void __iomem *ug_io_base;
+
+/*
+ * Performs one input/output transaction between the exi host and the usbgecko.
+ */
+static u32 ug_io_transaction(u32 in)
+{
+	u32 __iomem *csr_reg = ug_io_base + EXI_CSR;
+	u32 __iomem *data_reg = ug_io_base + EXI_DATA;
+	u32 __iomem *cr_reg = ug_io_base + EXI_CR;
+	u32 csr, data, cr;
+
+	/* select */
+	csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0;
+	out_be32(csr_reg, csr);
+
+	/* read/write */
+	data = in;
+	out_be32(data_reg, data);
+	cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART;
+	out_be32(cr_reg, cr);
+
+	while (in_be32(cr_reg) & EXI_CR_TSTART)
+		barrier();
+
+	/* deselect */
+	out_be32(csr_reg, 0);
+
+	/* result */
+	data = in_be32(data_reg);
+
+	return data;
+}
+
+/*
+ * Returns true if an usbgecko adapter is found.
+ */
+static int ug_is_adapter_present(void)
+{
+	if (!ug_io_base)
+		return 0;
+
+	return ug_io_transaction(0x90000000) == 0x04700000;
+}
+
+/*
+ * Returns true if the TX fifo is ready for transmission.
+ */
+static int ug_is_txfifo_ready(void)
+{
+	return ug_io_transaction(0xc0000000) & 0x04000000;
+}
+
+/*
+ * Tries to transmit a character.
+ * If the TX fifo is not ready the result is undefined.
+ */
+static void ug_raw_putc(char ch)
+{
+	ug_io_transaction(0xb0000000 | (ch << 20));
+}
+
+/*
+ * Transmits a character.
+ * It silently fails if the TX fifo is not ready after a number of retries.
+ */
+static void ug_putc(char ch)
+{
+	int count = UG_WRITE_ATTEMPTS;
+
+	if (!ug_io_base)
+		return;
+
+	if (ch == '\n')
+		ug_putc('\r');
+
+	while (!ug_is_txfifo_ready() && count--)
+		barrier();
+	if (count)
+		ug_raw_putc(ch);
+}
+
+#if 0
+/*
+ * Trasmits a null terminated character string.
+ */
+static void ug_puts(char *s)
+{
+	while (*s)
+		ug_putc(*s++);
+}
+#endif
+
+/*
+ * Returns true if the RX fifo is ready for transmission.
+ */
+static int ug_is_rxfifo_ready(void)
+{
+	return ug_io_transaction(0xd0000000) & 0x04000000;
+}
+
+/*
+ * Tries to receive a character.
+ * If a character is unavailable the function returns -1.
+ */
+static int ug_raw_getc(void)
+{
+	u32 data = ug_io_transaction(0xa0000000);
+	if (data & 0x08000000)
+		return (data >> 16) & 0xff;
+	else
+		return -1;
+}
+
+/*
+ * Receives a character.
+ * It fails if the RX fifo is not ready after a number of retries.
+ */
+static int ug_getc(void)
+{
+	int count = UG_READ_ATTEMPTS;
+
+	if (!ug_io_base)
+		return -1;
+
+	while (!ug_is_rxfifo_ready() && count--)
+		barrier();
+	return ug_raw_getc();
+}
+
+/*
+ * udbg functions.
+ *
+ */
+
+/*
+ * Transmits a character.
+ */
+void ug_udbg_putc(char ch)
+{
+	ug_putc(ch);
+}
+
+/*
+ * Receives a character. Waits until a character is available.
+ */
+static int ug_udbg_getc(void)
+{
+	int ch;
+
+	while ((ch = ug_getc()) == -1)
+		barrier();
+	return ch;
+}
+
+/*
+ * Receives a character. If a character is not available, returns -1.
+ */
+static int ug_udbg_getc_poll(void)
+{
+	if (!ug_is_rxfifo_ready())
+		return -1;
+	return ug_getc();
+}
+
+/*
+ * Retrieves and prepares the virtual address needed to access the hardware.
+ */
+static void __iomem *ug_udbg_setup_io_base(struct device_node *np)
+{
+	phys_addr_t paddr;
+	const unsigned int *reg;
+
+	reg = of_get_property(np, "reg", NULL);
+	if (reg) {
+		paddr = of_translate_address(np, reg);
+		if (paddr) {
+			ug_io_base = ioremap(paddr, reg[1]);
+			return ug_io_base;
+		}
+	}
+	return NULL;
+}
+
+/*
+ * USB Gecko udbg support initialization.
+ */
+void __init ug_udbg_init(void)
+{
+	struct device_node *np = NULL;
+	struct device_node *stdout;
+	const char *path;
+
+	if (!of_chosen) {
+		udbg_printf("%s: missing of_chosen\n", __func__);
+		goto done;
+	}
+
+	path = of_get_property(of_chosen, "linux,stdout-path", NULL);
+	if (!path) {
+		udbg_printf("%s: missing %s property", __func__,
+			    "linux,stdout-path");
+		goto done;
+	}
+
+	stdout = of_find_node_by_path(path);
+	if (!stdout) {
+		udbg_printf("%s: missing path %s", __func__, path);
+		goto done;
+	}
+
+	for (np = NULL;
+	    (np = of_find_compatible_node(np, NULL, "usbgecko,usbgecko"));)
+		if (np == stdout)
+			break;
+
+	of_node_put(stdout);
+	if (!np) {
+		udbg_printf("%s: stdout is not an usbgecko", __func__);
+		goto done;
+	}
+
+	if (!ug_udbg_setup_io_base(np)) {
+		udbg_printf("%s: failed to setup io base", __func__);
+		goto done;
+	}
+
+	if (!ug_is_adapter_present()) {
+		udbg_printf("usbgecko_udbg: not found\n");
+		ug_io_base = NULL;
+	} else {
+		udbg_putc = ug_udbg_putc;
+		udbg_getc = ug_udbg_getc;
+		udbg_getc_poll = ug_udbg_getc_poll;
+		udbg_printf("usbgecko_udbg: ready\n");
+	}
+
+done:
+	if (np)
+		of_node_put(np);
+	return;
+}
diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
new file mode 100644
index 0000000..3929de3
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
@@ -0,0 +1,30 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
+ *
+ * udbg serial input/output routines for the USB Gecko adapter.
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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 __USBGECKO_UDBG_H
+#define __USBGECKO_UDBG_H
+
+#ifdef CONFIG_USBGECKO_UDBG
+
+extern void __init ug_udbg_init(void);
+
+#else
+
+static inline void __init ug_udbg_init(void)
+{
+}
+
+#endif /* CONFIG_USBGECKO_UDBG */
+
+#endif /* __USBGECKO_UDBG_H */
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
@ 2009-11-22 22:01                   ` Albert Herranz
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
                                       ` (2 more replies)
  2009-11-22 23:22                   ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Grant Likely
                                     ` (2 subsequent siblings)
  3 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for using the USB Gecko adapter as an early debugging
console on the Nintendo GameCube and Wii video game consoles.
The USB Gecko is a 3rd party memory card interface adapter that provides
a EXI (External Interface) to USB serial converter.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/Kconfig.debug                         |    8 +++++
 arch/powerpc/include/asm/udbg.h                    |    1 +
 arch/powerpc/kernel/head_32.S                      |   21 ++++++++++++
 arch/powerpc/kernel/udbg.c                         |    2 +
 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c |   33 ++++++++++++++++++++
 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h |    6 +++
 6 files changed, 71 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/Kconfig.debug b/arch/powerpc/Kconfig.debug
index 3b10051..11e385b 100644
--- a/arch/powerpc/Kconfig.debug
+++ b/arch/powerpc/Kconfig.debug
@@ -254,6 +254,14 @@ config PPC_EARLY_DEBUG_CPM
 	  using a CPM-based serial port.  This assumes that the bootwrapper
 	  has run, and set up the CPM in a particular way.
 
+config PPC_EARLY_DEBUG_USBGECKO
+	bool "Early debugging through the USB Gecko adapter"
+	depends on GAMECUBE_COMMON
+	select USBGECKO_UDBG
+	help
+	  Select this to enable early debugging for Nintendo GameCube/Wii
+	  consoles via an external USB Gecko adapter.
+
 endchoice
 
 config PPC_EARLY_DEBUG_44x_PHYSLOW
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index cd21e5e..11ae699 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -51,6 +51,7 @@ extern void __init udbg_init_btext(void);
 extern void __init udbg_init_44x_as1(void);
 extern void __init udbg_init_40x_realmode(void);
 extern void __init udbg_init_cpm(void);
+extern void __init udbg_init_usbgecko(void);
 
 #endif /* __KERNEL__ */
 #endif /* _ASM_POWERPC_UDBG_H */
diff --git a/arch/powerpc/kernel/head_32.S b/arch/powerpc/kernel/head_32.S
index 829c3fe..83a0b79 100644
--- a/arch/powerpc/kernel/head_32.S
+++ b/arch/powerpc/kernel/head_32.S
@@ -164,6 +164,9 @@ __after_mmu_off:
 #ifdef CONFIG_PPC_EARLY_DEBUG_CPM
 	bl	setup_cpm_bat
 #endif
+#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
+	bl	setup_usbgecko_bat
+#endif
 
 /*
  * Call setup_cpu for CPU 0 and initialize 6xx Idle
@@ -1203,6 +1206,24 @@ setup_cpm_bat:
 	blr
 #endif
 
+#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
+setup_usbgecko_bat:
+	/* prepare a BAT for early io */
+	lis	r8, 0x0c00
+	ori	r8, r8, 0x002a	/* uncached, guarded ,rw */
+	lis	r11, 0xcc00
+	ori	r11, r11, 0x3	/* 128K */
+#ifdef CONFIG_WII
+	oris	r8, r8, 0x0100
+	oris	r11, r11, 0x0100
+#endif
+	mtspr	SPRN_DBAT1L, r8
+	mtspr	SPRN_DBAT1U, r11
+	sync
+	isync
+	blr
+#endif
+
 #ifdef CONFIG_8260
 /* Jump into the system reset for the rom.
  * We first disable the MMU, and then jump to the ROM reset address.
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index fc9af47..e39cad8 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -60,6 +60,8 @@ void __init udbg_early_init(void)
 	udbg_init_40x_realmode();
 #elif defined(CONFIG_PPC_EARLY_DEBUG_CPM)
 	udbg_init_cpm();
+#elif defined(CONFIG_PPC_EARLY_DEBUG_USBGECKO)
+	udbg_init_usbgecko();
 #endif
 
 #ifdef CONFIG_PPC_EARLY_DEBUG
diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
index 49f86e8..9f5e7ed 100644
--- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
+++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
@@ -234,6 +234,9 @@ void __init ug_udbg_init(void)
 	struct device_node *stdout;
 	const char *path;
 
+	if (ug_io_base)
+		udbg_printf("%s: early -> final\n", __func__);
+
 	if (!of_chosen) {
 		udbg_printf("%s: missing of_chosen\n", __func__);
 		goto done;
@@ -283,3 +286,33 @@ done:
 		of_node_put(np);
 	return;
 }
+
+#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
+
+/*
+ * USB Gecko early debug support initialization for udbg.
+ *
+ */
+void __init udbg_init_usbgecko(void)
+{
+	unsigned long vaddr, paddr;
+
+#if defined(CONFIG_GAMECUBE)
+	paddr = 0x0c000000;
+#elif defined(CONFIG_WII)
+	paddr = 0x0d000000;
+#else
+#error Invalid platform for USB Gecko based early debugging.
+#endif
+
+	vaddr = 0xc0000000 | paddr;
+	setbat(1, vaddr, paddr, 128*1024, PAGE_KERNEL_NCG);
+
+	ug_io_base = (void __iomem *)(vaddr | 0x6814);
+
+	udbg_putc = ug_udbg_putc;
+	udbg_getc = ug_udbg_getc;
+	udbg_getc_poll = ug_udbg_getc_poll;
+}
+
+#endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */
diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
index 3929de3..98034ee 100644
--- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
+++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
@@ -27,4 +27,10 @@ static inline void __init ug_udbg_init(void)
 
 #endif /* CONFIG_USBGECKO_UDBG */
 
+#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
+
+void __init udbg_init_usbgecko(void);
+
+#endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */
+
 #endif /* __USBGECKO_UDBG_H */
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
@ 2009-11-22 22:01                     ` Albert Herranz
  2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
                                         ` (3 more replies)
  2009-11-22 22:27                     ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Arnd Bergmann
  2009-11-24  0:54                     ` Segher Boessenkool
  2 siblings, 4 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for the interrupt controller included in the "Flipper"
chipset of the Nintendo GameCube video game console.
The same interrupt controller is also present in the "Hollywood" chipset
of the Nintendo Wii.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/Kconfig       |    6 +
 arch/powerpc/platforms/embedded6xx/Makefile      |    1 +
 arch/powerpc/platforms/embedded6xx/flipper-pic.c |  247 ++++++++++++++++++++++
 arch/powerpc/platforms/embedded6xx/flipper-pic.h |   25 +++
 4 files changed, 279 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.h

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index bfd88be..29a98c6 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -94,6 +94,7 @@ config MPC10X_STORE_GATHERING
 config GAMECUBE_COMMON
 	bool
 	select NOT_COHERENT_CACHE
+	select FLIPPER_PIC
 
 config USBGECKO_UDBG
 	bool "USB Gecko udbg console for the Nintendo GameCube/Wii"
@@ -108,3 +109,8 @@ config USBGECKO_UDBG
 
 	  If in doubt, say N here.
 
+config FLIPPER_PIC
+	bool
+	depends on GAMECUBE_COMMON
+	default y
+
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 0ab7492..35258fd 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -8,3 +8,4 @@ obj-$(CONFIG_PPC_HOLLY)		+= holly.o
 obj-$(CONFIG_PPC_PRPMC2800)	+= prpmc2800.o
 obj-$(CONFIG_PPC_C2K)		+= c2k.o
 obj-$(CONFIG_USBGECKO_UDBG)	+= usbgecko_udbg.o
+obj-$(CONFIG_FLIPPER_PIC)	+= flipper-pic.o
diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.c b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
new file mode 100644
index 0000000..98c2e9f
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.c
@@ -0,0 +1,247 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/flipper-pic.c
+ *
+ * Nintendo GameCube/Wii "Flipper" interrupt controller support.
+ * Copyright (C) 2004-2009 The GameCube Linux Team
+ * Copyright (C) 2007,2008,2009 Albert Herranz
+ *
+ * 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.
+ *
+ */
+#define DRV_MODULE_NAME "flipper-pic"
+#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/of.h>
+#include <asm/io.h>
+
+#include "flipper-pic.h"
+
+#define FLIPPER_NR_IRQS		32
+
+/*
+ * Each interrupt has a corresponding bit in both
+ * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
+ *
+ * Enabling/disabling an interrupt line involves asserting/clearing
+ * the corresponding bit in IMR. ACK'ing a request simply involves
+ * asserting the corresponding bit in ICR.
+ */
+#define FLIPPER_ICR		0x00
+#define FLIPPER_ICR_RSS		(1<<16) /* reset switch state */
+
+#define FLIPPER_IMR		0x04
+
+#define FLIPPER_RESET		0x24
+
+
+/*
+ * IRQ chip hooks.
+ *
+ */
+
+static void flipper_pic_mask_and_ack(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	clear_bit(irq, io_base + FLIPPER_IMR);
+	set_bit(irq, io_base + FLIPPER_ICR);
+}
+
+static void flipper_pic_ack(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	set_bit(irq, io_base + FLIPPER_ICR);
+}
+
+static void flipper_pic_mask(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	clear_bit(irq, io_base + FLIPPER_IMR);
+}
+
+static void flipper_pic_unmask(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	set_bit(irq, io_base + FLIPPER_IMR);
+}
+
+
+static struct irq_chip flipper_pic = {
+	.typename	= "flipper-pic",
+	.ack		= flipper_pic_ack,
+	.mask_ack	= flipper_pic_mask_and_ack,
+	.mask		= flipper_pic_mask,
+	.unmask		= flipper_pic_unmask,
+};
+
+/*
+ * IRQ host hooks.
+ *
+ */
+
+static struct irq_host *flipper_irq_host;
+
+static int flipper_pic_map(struct irq_host *h, unsigned int virq,
+			   irq_hw_number_t hwirq)
+{
+	set_irq_chip_data(virq, h->host_data);
+	get_irq_desc(virq)->status |= IRQ_LEVEL;
+	set_irq_chip_and_handler(virq, &flipper_pic, handle_level_irq);
+	return 0;
+}
+
+static void flipper_pic_unmap(struct irq_host *h, unsigned int irq)
+{
+	set_irq_chip_data(irq, NULL);
+	set_irq_chip(irq, NULL);
+}
+
+static int flipper_pic_match(struct irq_host *h, struct device_node *np)
+{
+	return 1;
+}
+
+
+static struct irq_host_ops flipper_irq_host_ops = {
+	.map = flipper_pic_map,
+	.unmap = flipper_pic_unmap,
+	.match = flipper_pic_match,
+};
+
+/*
+ * Platform hooks.
+ *
+ */
+
+static void __flipper_quiesce(void __iomem *io_base)
+{
+	/* mask and ack all IRQs */
+	out_be32(io_base + FLIPPER_IMR, 0x00000000);
+	out_be32(io_base + FLIPPER_ICR, 0xffffffff);
+}
+
+struct irq_host * __init flipper_pic_init(struct device_node *np)
+{
+	struct irq_host *irq_host;
+	struct resource res;
+	void __iomem *io_base;
+	int retval;
+
+	retval = of_address_to_resource(np, 0, &res);
+	if (retval) {
+		pr_err("no io memory range found\n");
+		return NULL;
+	}
+	io_base = ioremap(res.start, res.end - res.start + 1);
+
+	pr_info("controller at 0x%08x mapped to 0x%p\n", res.start, io_base);
+
+	__flipper_quiesce(io_base);
+
+	irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, FLIPPER_NR_IRQS,
+				  &flipper_irq_host_ops, -1);
+	if (!irq_host) {
+		pr_err("failed to allocate irq_host\n");
+		return NULL;
+	}
+
+	irq_host->host_data = io_base;
+
+	return irq_host;
+}
+
+unsigned int flipper_pic_get_irq(void)
+{
+	void __iomem *io_base = flipper_irq_host->host_data;
+	int irq;
+	u32 irq_status;
+
+	irq_status = in_be32(io_base + FLIPPER_ICR) &
+		     in_be32(io_base + FLIPPER_IMR);
+	if (irq_status == 0)
+		return -1;	/* no more IRQs pending */
+
+	__asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
+	return irq_linear_revmap(flipper_irq_host, 31 - irq);
+}
+
+/*
+ * Probe function.
+ *
+ */
+
+void __init flipper_pic_probe(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "nintendo,flipper-pic");
+	BUG_ON(!np);
+
+	flipper_irq_host = flipper_pic_init(np);
+	BUG_ON(!flipper_irq_host);
+
+	irq_set_default_host(flipper_irq_host);
+
+	of_node_put(np);
+}
+
+/*
+ * Misc functions related to the flipper chipset.
+ *
+ */
+
+/**
+ * flipper_quiesce() - quiesce flipper irq controller
+ *
+ * Mask and ack all interrupt sources.
+ *
+ */
+void flipper_quiesce(void)
+{
+	void __iomem *io_base = flipper_irq_host->host_data;
+
+	__flipper_quiesce(io_base);
+}
+
+/*
+ * Resets the platform.
+ */
+void flipper_platform_reset(void)
+{
+	void __iomem *io_base;
+
+	if (flipper_irq_host && flipper_irq_host->host_data) {
+		io_base = flipper_irq_host->host_data;
+		out_8(io_base + FLIPPER_RESET, 0x00);
+	}
+}
+
+/*
+ * Returns non-zero if the reset button is pressed.
+ */
+int flipper_is_reset_button_pressed(void)
+{
+	void __iomem *io_base;
+	u32 icr;
+
+	if (flipper_irq_host && flipper_irq_host->host_data) {
+		io_base = flipper_irq_host->host_data;
+		icr = in_be32(io_base + FLIPPER_ICR);
+		return !(icr & FLIPPER_ICR_RSS);
+	}
+	return 0;
+}
+
diff --git a/arch/powerpc/platforms/embedded6xx/flipper-pic.h b/arch/powerpc/platforms/embedded6xx/flipper-pic.h
new file mode 100644
index 0000000..e339186
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/flipper-pic.h
@@ -0,0 +1,25 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/flipper-pic.h
+ *
+ * Nintendo GameCube/Wii "Flipper" interrupt controller support.
+ * Copyright (C) 2004-2009 The GameCube Linux Team
+ * Copyright (C) 2007,2008,2009 Albert Herranz
+ *
+ * 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 __FLIPPER_PIC_H
+#define __FLIPPER_PIC_H
+
+unsigned int flipper_pic_get_irq(void);
+void __init flipper_pic_probe(void);
+
+void flipper_quiesce(void);
+void flipper_platform_reset(void);
+int flipper_is_reset_button_pressed(void);
+
+#endif
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
@ 2009-11-22 22:01                       ` Albert Herranz
  2009-11-22 22:01                         ` [RFC PATCH 13/19] powerpc: gamecube: default config Albert Herranz
                                           ` (2 more replies)
  2009-11-22 23:28                       ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Grant Likely
                                         ` (2 subsequent siblings)
  3 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add platform support for the Nintendo GameCube video game console.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/Kconfig        |    8 ++
 arch/powerpc/platforms/embedded6xx/Makefile       |    1 +
 arch/powerpc/platforms/embedded6xx/gamecube.c     |  112 +++++++++++++++++++++
 arch/powerpc/platforms/embedded6xx/gamecube_dev.c |   34 ++++++
 4 files changed, 155 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/embedded6xx/gamecube.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/gamecube_dev.c

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 29a98c6..efb2ea1 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -114,3 +114,11 @@ config FLIPPER_PIC
 	depends on GAMECUBE_COMMON
 	default y
 
+config GAMECUBE
+	bool "Nintendo-GameCube"
+	depends on EMBEDDED6xx
+	select GAMECUBE_COMMON
+	help
+	  Select GAMECUBE if configuring for the Nintendo GameCube.
+	  More information at: <http://gc-linux.sourceforge.net/>
+
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 35258fd..b0324ed 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -9,3 +9,4 @@ obj-$(CONFIG_PPC_PRPMC2800)	+= prpmc2800.o
 obj-$(CONFIG_PPC_C2K)		+= c2k.o
 obj-$(CONFIG_USBGECKO_UDBG)	+= usbgecko_udbg.o
 obj-$(CONFIG_FLIPPER_PIC)	+= flipper-pic.o
+obj-$(CONFIG_GAMECUBE)		+= gamecube.o gamecube_dev.o
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube.c b/arch/powerpc/platforms/embedded6xx/gamecube.c
new file mode 100644
index 0000000..8045a23
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/gamecube.c
@@ -0,0 +1,112 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/gamecube.c
+ *
+ * Nintendo GameCube board-specific support
+ * Copyright (C) 2004-2009 The GameCube Linux Team
+ * Copyright (C) 2007,2008,2009 Albert Herranz
+ *
+ * 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/kernel.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/kexec.h>
+#include <linux/seq_file.h>
+
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/time.h>
+#include <asm/udbg.h>
+
+#include "flipper-pic.h"
+#include "usbgecko_udbg.h"
+
+
+static void gamecube_restart(char *cmd)
+{
+	local_irq_disable();
+	flipper_platform_reset();
+	/* spin until power button pressed */
+	for (;;)
+		cpu_relax();
+}
+
+static void gamecube_power_off(void)
+{
+	local_irq_disable();
+	/* spin until power button pressed */
+	for (;;)
+		cpu_relax();
+}
+
+static void gamecube_halt(void)
+{
+	gamecube_restart(NULL);
+}
+
+static void gamecube_show_cpuinfo(struct seq_file *m)
+{
+	seq_printf(m, "vendor\t\t: IBM\n");
+	seq_printf(m, "machine\t\t: Nintendo GameCube\n");
+}
+
+static void gamecube_setup_arch(void)
+{
+	/* currently not used */
+}
+
+static void __init gamecube_init_early(void)
+{
+	ug_udbg_init();
+}
+
+static int __init gamecube_probe(void)
+{
+	unsigned long dt_root;
+
+	dt_root = of_get_flat_dt_root();
+	if (!of_flat_dt_is_compatible(dt_root, "nintendo,gamecube"))
+		return 0;
+
+	return 1;
+}
+
+static void gamecube_shutdown(void)
+{
+	/* currently not used */
+}
+
+#ifdef CONFIG_KEXEC
+static int gamecube_kexec_prepare(struct kimage *image)
+{
+	return 0;
+}
+#endif /* CONFIG_KEXEC */
+
+
+define_machine(gamecube) {
+	.name			= "gamecube",
+	.probe			= gamecube_probe,
+	.setup_arch		= gamecube_setup_arch,
+	.init_early		= gamecube_init_early,
+	.show_cpuinfo		= gamecube_show_cpuinfo,
+	.restart		= gamecube_restart,
+	.power_off		= gamecube_power_off,
+	.halt			= gamecube_halt,
+	.init_IRQ		= flipper_pic_probe,
+	.get_irq		= flipper_pic_get_irq,
+	.calibrate_decr		= generic_calibrate_decr,
+	.progress		= udbg_progress,
+	.machine_shutdown	= gamecube_shutdown,
+#ifdef CONFIG_KEXEC
+	.machine_kexec_prepare	= gamecube_kexec_prepare,
+	.machine_kexec		= default_machine_kexec,
+#endif
+};
+
diff --git a/arch/powerpc/platforms/embedded6xx/gamecube_dev.c b/arch/powerpc/platforms/embedded6xx/gamecube_dev.c
new file mode 100644
index 0000000..13e1f73
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/gamecube_dev.c
@@ -0,0 +1,34 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/gamecube_dev.c
+ *
+ * Nintendo GameCube platform device setup.
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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/kernel.h>
+#include <linux/init.h>
+#include <linux/of_platform.h>
+
+#include <asm/machdep.h>
+
+static struct of_device_id gamecube_of_bus[] = {
+	{ .compatible = "nintendo,flipper", },
+	{ },
+};
+
+static int __init gamecube_device_probe(void)
+{
+	if (!machine_is(gamecube))
+		return 0;
+
+	of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
+	return 0;
+}
+device_initcall(gamecube_device_probe);
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 13/19] powerpc: gamecube: default config
  2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
@ 2009-11-22 22:01                         ` Albert Herranz
  2009-11-22 22:01                           ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Albert Herranz
  2009-11-22 23:34                         ` [RFC PATCH 12/19] powerpc: gamecube: platform support Grant Likely
  2009-11-24 21:39                         ` Segher Boessenkool
  2 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add a default configuration for the Nintendo GameCube video game console.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/configs/gamecube_defconfig | 1061 +++++++++++++++++++++++++++++++
 1 files changed, 1061 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/gamecube_defconfig

diff --git a/arch/powerpc/configs/gamecube_defconfig b/arch/powerpc/configs/gamecube_defconfig
new file mode 100644
index 0000000..942e119
--- /dev/null
+++ b/arch/powerpc/configs/gamecube_defconfig
@@ -0,0 +1,1061 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.32-rc8
+# Sun Nov 22 21:07:30 2009
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_PPC_BOOK3S_32=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_BOOK3S=y
+CONFIG_6xx=y
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC_HAVE_PMU_SUPPORT=y
+CONFIG_PPC_PERF_CTRS=y
+# CONFIG_SMP is not set
+CONFIG_NOT_COHERENT_CACHE=y
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
+CONFIG_IRQ_PER_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
+# CONFIG_DEFAULT_UIMAGE is not set
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-gcn"
+CONFIG_LOCALVERSION_AUTO=y
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_GROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
+CONFIG_USER_SCHED=y
+# CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+# CONFIG_RELAY is not set
+# CONFIG_NAMESPACES is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+# CONFIG_ELF_CORE is not set
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+CONFIG_EVENT_PROFILE=y
+CONFIG_PERF_COUNTERS=y
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+# CONFIG_VM_EVENT_COUNTERS is not set
+CONFIG_COMPAT_BRK=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_TRACEPOINTS=y
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_SLOW_WORK=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+# CONFIG_BLK_DEV_BSG is not set
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="anticipatory"
+# CONFIG_FREEZER is not set
+
+#
+# Platform support
+#
+# CONFIG_PPC_CHRP is not set
+# CONFIG_MPC5121_ADS is not set
+# CONFIG_MPC5121_GENERIC is not set
+# CONFIG_PPC_MPC52xx is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PPC_82xx is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+CONFIG_EMBEDDED6xx=y
+# CONFIG_LINKSTATION is not set
+# CONFIG_STORCENTER is not set
+# CONFIG_MPC7448HPC2 is not set
+# CONFIG_PPC_HOLLY is not set
+# CONFIG_PPC_PRPMC2800 is not set
+# CONFIG_PPC_C2K is not set
+CONFIG_GAMECUBE_COMMON=y
+CONFIG_USBGECKO_UDBG=y
+CONFIG_FLIPPER_PIC=y
+CONFIG_GAMECUBE=y
+# CONFIG_WII is not set
+# CONFIG_AMIGAONE is not set
+# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
+# CONFIG_IPIC is not set
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_FSL_ULI1575 is not set
+# CONFIG_SIMPLE_GPIO is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_BINFMT_ELF=y
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=m
+# CONFIG_IOMMU_HELPER is not set
+# CONFIG_SWIOTLB is not set
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_HAS_WALK_MEMORY=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_KEXEC=y
+# CONFIG_CRASH_DUMP is not set
+CONFIG_MAX_ACTIVE_REGIONS=32
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_MIGRATION is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_HAVE_MLOCK=y
+CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_PROC_DEVICETREE=y
+# CONFIG_CMDLINE_BOOL is not set
+CONFIG_EXTRA_TARGETS=""
+# CONFIG_PM is not set
+# CONFIG_SECCOMP is not set
+CONFIG_ISA_DMA_API=y
+
+#
+# Bus options
+#
+CONFIG_ZONE_DMA=y
+CONFIG_GENERIC_ISA_DMA=y
+# CONFIG_PCI is not set
+# CONFIG_PCI_DOMAINS is not set
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+# CONFIG_HAS_RAPIDIO is not set
+
+#
+# Advanced setup
+#
+CONFIG_ADVANCED_OPTIONS=y
+# CONFIG_LOWMEM_SIZE_BOOL is not set
+CONFIG_LOWMEM_SIZE=0x30000000
+# CONFIG_PAGE_OFFSET_BOOL is not set
+CONFIG_PAGE_OFFSET=0xc0000000
+# CONFIG_KERNEL_START_BOOL is not set
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_PHYSICAL_START=0x00000000
+# CONFIG_TASK_SIZE_BOOL is not set
+CONFIG_TASK_SIZE=0xc0000000
+# CONFIG_CONSISTENT_SIZE_BOOL is not set
+CONFIG_CONSISTENT_SIZE=0x00200000
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+CONFIG_IP_PNP_RARP=y
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+# CONFIG_WIRELESS is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+# CONFIG_STANDALONE is not set
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+CONFIG_OF_DEVICE=y
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+CONFIG_BLK_DEV_NBD=m
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=2
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_93CX6 is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SCSI_NETLINK is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+# CONFIG_MACINTOSH_DRIVERS is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_PHYLIB is not set
+CONFIG_NET_ETHERNET=y
+# CONFIG_MII is not set
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_XILINX_EMACLITE is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+# CONFIG_WLAN is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_FF_MEMLESS=m
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+# CONFIG_INPUT_MOUSEDEV is not set
+CONFIG_INPUT_JOYDEV=y
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+# CONFIG_INPUT_MOUSE is not set
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
+# CONFIG_JOYSTICK_JOYDUMP is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+# CONFIG_INPUT_MISC is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_DEVKMEM is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_UARTLITE is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=64
+# CONFIG_HVC_UDBG is not set
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+# CONFIG_NVRAM is not set
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+# CONFIG_I2C is not set
+# CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+# CONFIG_GPIOLIB is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+# CONFIG_SSB is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+# CONFIG_FB_CFB_FILLRECT is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# 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_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+CONFIG_LOGO=y
+# CONFIG_LOGO_LINUX_MONO is not set
+# CONFIG_LOGO_LINUX_VGA16 is not set
+# CONFIG_LOGO_LINUX_CLUT224 is not set
+CONFIG_SOUND=y
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_SEQUENCER=y
+# CONFIG_SND_SEQ_DUMMY is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+CONFIG_SND_SEQUENCER_OSS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+# CONFIG_SND_VERBOSE_PROCFS is not set
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_VIRMIDI is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+CONFIG_SND_PPC=y
+# CONFIG_SND_SOC is not set
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HIDRAW is not set
+# CONFIG_HID_PID is not set
+
+#
+# Special HID drivers
+#
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_MMC is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_EDAC is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# SPI RTC drivers
+#
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+CONFIG_RTC_DRV_GENERIC=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+# CONFIG_EXT3_FS_XATTR is not set
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+# CONFIG_FUSE_FS is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# 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
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+CONFIG_CIFS=y
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+# CONFIG_DLM is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+CONFIG_CRC_CCITT=y
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+# CONFIG_MAGIC_SYSRQ is not set
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+# CONFIG_DETECT_HUNG_TASK is not set
+CONFIG_SCHED_DEBUG=y
+CONFIG_SCHEDSTATS=y
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+CONFIG_DEBUG_SPINLOCK_SLEEP=y
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+CONFIG_LATENCYTOP=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACER_MAX_TRACE=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_TRACING=y
+CONFIG_GENERIC_TRACER=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+CONFIG_SCHED_TRACER=y
+CONFIG_BOOT_TRACER=y
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_FTRACE_STARTUP_TEST is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+CONFIG_DMA_API_DEBUG=y
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
+CONFIG_PRINT_STACK_DEPTH=64
+# CONFIG_DEBUG_STACKOVERFLOW is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_PPC_EMULATED_STATS is not set
+# CONFIG_CODE_PATCHING_SELFTEST is not set
+# CONFIG_FTR_FIXUP_SELFTEST is not set
+# CONFIG_MSI_BITMAP_SELFTEST is not set
+# CONFIG_XMON is not set
+# CONFIG_IRQSTACKS is not set
+# CONFIG_VIRQ_DEBUG is not set
+# CONFIG_BDI_SWITCH is not set
+# CONFIG_BOOTX_TEXT is not set
+CONFIG_PPC_EARLY_DEBUG=y
+# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
+# CONFIG_PPC_EARLY_DEBUG_G5 is not set
+# CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL is not set
+# CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE is not set
+# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
+# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
+# CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE is not set
+# CONFIG_PPC_EARLY_DEBUG_BEAT is not set
+# CONFIG_PPC_EARLY_DEBUG_44x is not set
+# CONFIG_PPC_EARLY_DEBUG_40x is not set
+# CONFIG_PPC_EARLY_DEBUG_CPM is not set
+CONFIG_PPC_EARLY_DEBUG_USBGECKO=y
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+# CONFIG_CRYPTO is not set
+# CONFIG_PPC_CLOCK is not set
+# CONFIG_VIRTUALIZATION is not set
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions
  2009-11-22 22:01                         ` [RFC PATCH 13/19] powerpc: gamecube: default config Albert Herranz
@ 2009-11-22 22:01                           ` Albert Herranz
  2009-11-22 22:01                             ` [RFC PATCH 15/19] powerpc: broadway processor support Albert Herranz
  2009-11-22 23:36                             ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Grant Likely
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

The Nintendo Wii has two discontiguous RAM memory areas called
MEM1 and MEM2.
MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
Between both memory address ranges there is an address space
where memory-mapped I/O registers are found.

Currently, Linux 32-bit PowerPC does not support RAM in
discontiguous memory address spaces. Thus, in order to use
both RAM areas, we declare as RAM the range from the start of
MEM1 to the end of useable MEM2 and exclude the needed parts
with /memreserve/ statements, at the expense of wasting a bit
of memory.

As a side effect, we need to allow ioremapping RAM areas
because the I/O address space sits within the memreserve'd part
of the declared RAM region.
Note that this is not safe if the region ioremapped is covered
by an existing BAT mapping used to map RAM, so this is
specifically banned here.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/mm/pgtable_32.c |   19 ++++++++++++++++---
 1 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
index cb96cb2..ba00cb1 100644
--- a/arch/powerpc/mm/pgtable_32.c
+++ b/arch/powerpc/mm/pgtable_32.c
@@ -191,9 +191,22 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
 	 * Don't allow anybody to remap normal RAM that we're using.
 	 * mem_init() sets high_memory so only do the check after that.
 	 */
-	if (mem_init_done && (p < virt_to_phys(high_memory))) {
-		printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
-		       (unsigned long long)p, __builtin_return_address(0));
+	if (mem_init_done && (p < virt_to_phys(high_memory))
+#ifdef CONFIG_WII
+		/*
+		 * On some systems, though, we may want to remap an area
+		 * declared as normal RAM that we have memreserve'd at the
+		 * device tree. See wii.dts.
+		 * But we can't do that safely if we are using BATs to map
+		 * part of that area.
+		 */
+	    && !__map_without_bats
+#endif
+	    ) {
+		printk(KERN_WARNING
+		       "__ioremap(): phys addr 0x%llx is RAM lr %p\n",
+		       (unsigned long long)p,
+			 __builtin_return_address(0));
 		return NULL;
 	}
 #endif
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 15/19] powerpc: broadway processor support
  2009-11-22 22:01                           ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Albert Herranz
@ 2009-11-22 22:01                             ` Albert Herranz
  2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
  2009-11-22 23:38                               ` [RFC PATCH 15/19] powerpc: broadway processor support Grant Likely
  2009-11-22 23:36                             ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Grant Likely
  1 sibling, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

This patch extends the cputable entry of the 750CL to also match
the 750CL-based "Broadway" cpu found on the Nintendo Wii.

As of this patch, the following "Broadway" design revision levels have
been seen in the wild:
- DD1.2 (87102)
- DD2.0 (87200)

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/kernel/cputable.c |   28 ++++++++++++++--------------
 1 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 03c862b..85841e8 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -697,13 +697,13 @@ static struct cpu_spec __initdata cpu_specs[] = {
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
 	},
-	{	/* 750CL */
-		.pvr_mask		= 0xfffff0f0,
-		.pvr_value		= 0x00087010,
-		.cpu_name		= "750CL",
-		.cpu_features		= CPU_FTRS_750CL,
+	{	/* 745/755 */
+		.pvr_mask		= 0xfffff000,
+		.pvr_value		= 0x00083000,
+		.cpu_name		= "745/755",
+		.cpu_features		= CPU_FTRS_750,
 		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,
-		.mmu_features		= MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
+		.mmu_features		= MMU_FTR_HPTE_TABLE,
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
@@ -711,16 +711,14 @@ static struct cpu_spec __initdata cpu_specs[] = {
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
-		.oprofile_cpu_type      = "ppc/750",
-		.oprofile_type		= PPC_OPROFILE_G4,
 	},
-	{	/* 745/755 */
-		.pvr_mask		= 0xfffff000,
-		.pvr_value		= 0x00083000,
-		.cpu_name		= "745/755",
-		.cpu_features		= CPU_FTRS_750,
+	{	/* 750CL (and "Broadway") */
+		.pvr_mask		= 0xfffff0e0,
+		.pvr_value		= 0x00087000,
+		.cpu_name		= "750CL",
+		.cpu_features		= CPU_FTRS_750CL,
 		.cpu_user_features	= COMMON_USER | PPC_FEATURE_PPC_LE,
-		.mmu_features		= MMU_FTR_HPTE_TABLE,
+		.mmu_features		= MMU_FTR_HPTE_TABLE | MMU_FTR_USE_HIGH_BATS,
 		.icache_bsize		= 32,
 		.dcache_bsize		= 32,
 		.num_pmcs		= 4,
@@ -728,6 +726,8 @@ static struct cpu_spec __initdata cpu_specs[] = {
 		.cpu_setup		= __setup_cpu_750,
 		.machine_check		= machine_check_generic,
 		.platform		= "ppc750",
+		.oprofile_cpu_type      = "ppc/750",
+		.oprofile_type		= PPC_OPROFILE_G4,
 	},
 	{	/* 750FX rev 1.x */
 		.pvr_mask		= 0xffffff00,
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-22 22:01                             ` [RFC PATCH 15/19] powerpc: broadway processor support Albert Herranz
@ 2009-11-22 22:01                               ` Albert Herranz
  2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
                                                   ` (3 more replies)
  2009-11-22 23:38                               ` [RFC PATCH 15/19] powerpc: broadway processor support Grant Likely
  1 sibling, 4 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for the dual interrupt controller included in the "Hollywood"
chipset of the Nintendo Wii video game console.
This interrupt controller serves both the Broadway processor (as a cascade)
and the Starlet processor, and is used to manage interrupts for the
non-classic hardware.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/Kconfig    |    5 +
 arch/powerpc/platforms/embedded6xx/Makefile   |    1 +
 arch/powerpc/platforms/embedded6xx/hlwd-pic.c |  238 +++++++++++++++++++++++++
 arch/powerpc/platforms/embedded6xx/hlwd-pic.h |   22 +++
 4 files changed, 266 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.h

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index efb2ea1..490f89e 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -122,3 +122,8 @@ config GAMECUBE
 	  Select GAMECUBE if configuring for the Nintendo GameCube.
 	  More information at: <http://gc-linux.sourceforge.net/>
 
+config HLWD_PIC
+	bool
+	depends on STARLET_MINI
+	default y
+
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index b0324ed..c1dcc54 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -10,3 +10,4 @@ obj-$(CONFIG_PPC_C2K)		+= c2k.o
 obj-$(CONFIG_USBGECKO_UDBG)	+= usbgecko_udbg.o
 obj-$(CONFIG_FLIPPER_PIC)	+= flipper-pic.o
 obj-$(CONFIG_GAMECUBE)		+= gamecube.o gamecube_dev.o
+obj-$(CONFIG_HLWD_PIC)		+= hlwd-pic.o
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
new file mode 100644
index 0000000..b024800
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
@@ -0,0 +1,238 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/hlwd-pic.c
+ *
+ * Nintendo Wii "Hollywood" interrupt controller support.
+ * Copyright (C) 2009 The GameCube Linux Team
+ * Copyright (C) 2009 Albert Herranz
+ *
+ * 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.
+ *
+ */
+#define DRV_MODULE_NAME "hlwd-pic"
+#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/of.h>
+#include <asm/io.h>
+
+#include "hlwd-pic.h"
+
+#define HLWD_NR_IRQS	32
+
+/*
+ * Each interrupt has a corresponding bit in both
+ * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
+ *
+ * Enabling/disabling an interrupt line involves asserting/clearing
+ * the corresponding bit in IMR. ACK'ing a request simply involves
+ * asserting the corresponding bit in ICR.
+ */
+#define HW_BROADWAY_ICR		0x00
+#define HW_BROADWAY_IMR		0x04
+
+
+/*
+ * IRQ chip hooks.
+ *
+ */
+
+static void hlwd_pic_mask_and_ack(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	clear_bit(irq, io_base + HW_BROADWAY_IMR);
+	set_bit(irq, io_base + HW_BROADWAY_ICR);
+}
+
+static void hlwd_pic_ack(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	set_bit(irq, io_base + HW_BROADWAY_ICR);
+}
+
+static void hlwd_pic_mask(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	clear_bit(irq, io_base + HW_BROADWAY_IMR);
+}
+
+static void hlwd_pic_unmask(unsigned int virq)
+{
+	int irq = virq_to_hw(virq);
+	void __iomem *io_base = get_irq_chip_data(virq);
+
+	set_bit(irq, io_base + HW_BROADWAY_IMR);
+}
+
+
+static struct irq_chip hlwd_pic = {
+	.typename	= "hlwd-pic",
+	.ack		= hlwd_pic_ack,
+	.mask_ack	= hlwd_pic_mask_and_ack,
+	.mask		= hlwd_pic_mask,
+	.unmask		= hlwd_pic_unmask,
+};
+
+/*
+ * IRQ host hooks.
+ *
+ */
+
+static struct irq_host *hlwd_irq_host;
+
+static int hlwd_pic_map(struct irq_host *h, unsigned int virq,
+			   irq_hw_number_t hwirq)
+{
+	set_irq_chip_data(virq, h->host_data);
+	get_irq_desc(virq)->status |= IRQ_LEVEL;
+	set_irq_chip_and_handler(virq, &hlwd_pic, handle_level_irq);
+	return 0;
+}
+
+static void hlwd_pic_unmap(struct irq_host *h, unsigned int irq)
+{
+	set_irq_chip_data(irq, NULL);
+	set_irq_chip(irq, NULL);
+}
+
+static struct irq_host_ops hlwd_irq_host_ops = {
+	.map = hlwd_pic_map,
+	.unmap = hlwd_pic_unmap,
+};
+
+static unsigned int __hlwd_pic_get_irq(struct irq_host *h)
+{
+	void __iomem *io_base = h->host_data;
+	int irq;
+	u32 irq_status;
+
+	irq_status = in_be32(io_base + HW_BROADWAY_ICR) &
+		     in_be32(io_base + HW_BROADWAY_IMR);
+	if (irq_status == 0)
+		return NO_IRQ_IGNORE;	/* no more IRQs pending */
+
+	__asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
+	return irq_linear_revmap(h, 31 - irq);
+}
+
+static void hlwd_pic_irq_cascade(unsigned int cascade_virq,
+				      struct irq_desc *desc)
+{
+	struct irq_host *irq_host = get_irq_data(cascade_virq);
+	unsigned int virq;
+
+	spin_lock(&desc->lock);
+	desc->chip->mask(cascade_virq); /* IRQ_LEVEL */
+	spin_unlock(&desc->lock);
+
+	virq = __hlwd_pic_get_irq(irq_host);
+	if (virq != NO_IRQ_IGNORE)
+		generic_handle_irq(virq);
+	else
+		pr_err("spurious interrupt!\n");
+
+	spin_lock(&desc->lock);
+	desc->chip->ack(cascade_virq); /* IRQ_LEVEL */
+	if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
+		desc->chip->unmask(cascade_virq);
+	spin_unlock(&desc->lock);
+}
+
+/*
+ * Platform hooks.
+ *
+ */
+
+static void __hlwd_quiesce(void __iomem *io_base)
+{
+	/* mask and ack all IRQs */
+	out_be32(io_base + HW_BROADWAY_IMR, 0);
+	out_be32(io_base + HW_BROADWAY_ICR, ~0);
+}
+
+struct irq_host *hlwd_pic_init(struct device_node *np)
+{
+	struct irq_host *irq_host;
+	struct resource res;
+	void __iomem *io_base;
+	int retval;
+
+	retval = of_address_to_resource(np, 0, &res);
+	if (retval) {
+		pr_err("no io memory range found\n");
+		return NULL;
+	}
+	io_base = ioremap(res.start, resource_size(&res));
+	if (!io_base) {
+		pr_err("ioremap failed\n");
+		return NULL;
+	}
+
+	pr_info("controller at 0x%08x mapped to 0x%p\n", res.start, io_base);
+
+	__hlwd_quiesce(io_base);
+
+	irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, HLWD_NR_IRQS,
+				  &hlwd_irq_host_ops, NO_IRQ_IGNORE);
+	if (!irq_host) {
+		pr_err("failed to allocate irq_host\n");
+		return NULL;
+	}
+	irq_host->host_data = io_base;
+
+	return irq_host;
+}
+
+unsigned int hlwd_pic_get_irq(void)
+{
+	return __hlwd_pic_get_irq(hlwd_irq_host);
+}
+
+/*
+ * Probe function.
+ *
+ */
+
+void hlwd_pic_probe(void)
+{
+	struct irq_host *host;
+	struct device_node *np;
+	const u32 *interrupts;
+	int cascade_virq;
+
+	for_each_compatible_node(np, NULL, "nintendo,hollywood-pic") {
+		interrupts = of_get_property(np, "interrupts", NULL);
+		if (interrupts) {
+			host = hlwd_pic_init(np);
+			BUG_ON(!host);
+			cascade_virq = irq_of_parse_and_map(np, 0);
+			set_irq_data(cascade_virq, host);
+			set_irq_chained_handler(cascade_virq,
+						hlwd_pic_irq_cascade);
+		}
+	}
+}
+
+/**
+ * hlwd_quiesce() - quiesce hollywood irq controller
+ *
+ * Mask and ack all interrupt sources.
+ *
+ */
+void hlwd_quiesce(void)
+{
+	void __iomem *io_base = hlwd_irq_host->host_data;
+
+	__hlwd_quiesce(io_base);
+}
+
diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.h b/arch/powerpc/platforms/embedded6xx/hlwd-pic.h
new file mode 100644
index 0000000..d2e5a09
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.h
@@ -0,0 +1,22 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/hlwd-pic.h
+ *
+ * Nintendo Wii "Hollywood" interrupt controller support.
+ * Copyright (C) 2009 The GameCube Linux Team
+ * Copyright (C) 2009 Albert Herranz
+ *
+ * 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 __HLWD_PIC_H
+#define __HLWD_PIC_H
+
+extern unsigned int hlwd_pic_get_irq(void);
+extern void hlwd_pic_probe(void);
+extern void hlwd_quiesce(void);
+
+#endif
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support
  2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
@ 2009-11-22 22:01                                 ` Albert Herranz
  2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
                                                     ` (2 more replies)
  2009-11-22 23:40                                 ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Grant Likely
                                                   ` (2 subsequent siblings)
  3 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add support for the BootMii 'mini' firmware replacement for the
Starlet processor.

'mini' is an open source IOS replacement written from scratch by
Team Twiizers. It grants full access to the hardware found on the
Nintendo Wii video game console via a custom IPC mechanism.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/include/asm/starlet-mini.h           |  175 ++++
 arch/powerpc/include/asm/starlet.h                |   26 +
 arch/powerpc/platforms/embedded6xx/Kconfig        |   14 +-
 arch/powerpc/platforms/embedded6xx/Makefile       |    1 +
 arch/powerpc/platforms/embedded6xx/starlet-mipc.c | 1053 +++++++++++++++++++++
 5 files changed, 1268 insertions(+), 1 deletions(-)
 create mode 100644 arch/powerpc/include/asm/starlet-mini.h
 create mode 100644 arch/powerpc/include/asm/starlet.h
 create mode 100644 arch/powerpc/platforms/embedded6xx/starlet-mipc.c

diff --git a/arch/powerpc/include/asm/starlet-mini.h b/arch/powerpc/include/asm/starlet-mini.h
new file mode 100644
index 0000000..bfa2a2c
--- /dev/null
+++ b/arch/powerpc/include/asm/starlet-mini.h
@@ -0,0 +1,175 @@
+/*
+ * arch/powerpc/include/asm/starlet-mini.h
+ *
+ * Definitions for the 'mini' firmware replacement for Starlet
+ * Copyright (C) 2009 The GameCube Linux Team
+ * Copyright (C) 2009 Albert Herranz
+ *
+ * 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 __STARLET_MINI_H
+#define __STARLET_MINI_H
+
+#ifdef CONFIG_STARLET_MINI
+
+/*
+ * mini ipc call numbering scheme
+ */
+
+#define _MIPC_FAST        0x01
+#define _MIPC_SLOW        0x00
+
+#define _MIPC_DEV_SYS     0x00
+#define _MIPC_DEV_NAND    0x01
+#define _MIPC_DEV_SDHC    0x02
+#define _MIPC_DEV_KEYS    0x03
+#define _MIPC_DEV_AES     0x04
+#define _MIPC_DEV_BOOT2   0x05
+#define _MIPC_DEV_PPC     0x06
+#define _MIPC_DEV_SDMMC   0x07
+
+#define _MIPC_SYS_PING    0x0000
+#define _MIPC_SYS_JUMP    0x0001
+#define _MIPC_SYS_GETVERS 0x0002
+#define _MIPC_SYS_GETGITS 0x0003
+#define _MIPC_SYS_WRITE32 0x0100
+#define _MIPC_SYS_WRITE16 0x0101
+#define _MIPC_SYS_WRITE8  0x0102
+#define _MIPC_SYS_READ32  0x0103
+#define _MIPC_SYS_READ16  0x0104
+#define _MIPC_SYS_READ8   0x0105
+#define _MIPC_SYS_SET32   0x0106
+#define _MIPC_SYS_SET16   0x0107
+#define _MIPC_SYS_SET8    0x0108
+#define _MIPC_SYS_CLEAR32 0x0109
+#define _MIPC_SYS_CLEAR16 0x010a
+#define _MIPC_SYS_CLEAR8  0x010b
+#define _MIPC_SYS_MASK32  0x010c
+#define _MIPC_SYS_MASK16  0x010d
+#define _MIPC_SYS_MASK8   0x010e
+
+#define _MIPC_NAND_RESET  0x0000
+#define _MIPC_NAND_GETID  0x0001
+#define _MIPC_NAND_READ   0x0002
+#define _MIPC_NAND_WRITE  0x0003
+#define _MIPC_NAND_ERASE  0x0004
+#define _MIPC_NAND_STATUS 0x0005
+
+#define _MIPC_SDHC_DISCOVER 0x0000
+#define _MIPC_SDHC_EXIT	    0x0001
+
+#define _MIPC_SDMMC_ACK   0x0000
+#define _MIPC_SDMMC_READ  0x0001
+#define _MIPC_SDMMC_WRITE 0x0002
+#define _MIPC_SDMMC_STATE 0x0003
+#define _MIPC_SDMMC_SIZE  0x0004
+
+#define _MIPC_KEYS_GETOTP 0x0000
+#define _MIPC_KEYS_GETEEP 0x0001
+
+#define _MIPC_AES_RESET   0x0000
+#define _MIPC_AES_SETIV   0x0001
+#define _MIPC_AES_SETKEY  0x0002
+#define _MIPC_AES_DECRYPT 0x0003
+
+#define _MIPC_BOOT2_RUN   0x0000
+#define _MIPC_BOOT2_TMD   0x0001
+
+#define _MIPC_PPC_BOOT    0x0000
+
+
+/*
+ *
+ */
+
+#define _MIPC_MODEBITS	8
+#define _MIPC_DEVBITS	8
+#define _MIPC_NRBITS	16
+
+#define _MIPC_MODEMASK	((1 << _MIPC_MODEBITS)-1)
+#define _MIPC_DEVMASK	((1 << _MIPC_DEVBITS)-1)
+#define _MIPC_NRMASK	((1 << _MIPC_NRBITS)-1)
+
+#define _MIPC_MODESHIFT	(_MIPC_DEVSHIFT + _MIPC_DEVBITS)
+#define _MIPC_DEVSHIFT	(_MIPC_NRSHIFT + _MIPC_NRBITS)
+#define _MIPC_NRSHIFT	0
+
+#define _MIPC(mode, dev, nr) \
+	(((mode) << _MIPC_MODESHIFT) | \
+	 ((dev) << _MIPC_DEVSHIFT) | \
+	 ((nr) << _MIPC_NRSHIFT))
+
+#define _MIPC_FAST_SYS(nr)	_MIPC(_MIPC_FAST, _MIPC_DEV_SYS, nr)
+
+#define MIPC_SYS_PING		_MIPC_FAST_SYS(_MIPC_SYS_PING)
+#define MIPC_SYS_WRITE32	_MIPC_FAST_SYS(_MIPC_SYS_WRITE32)
+#define MIPC_SYS_WRITE16	_MIPC_FAST_SYS(_MIPC_SYS_WRITE16)
+#define MIPC_SYS_WRITE8		_MIPC_FAST_SYS(_MIPC_SYS_WRITE8)
+#define MIPC_SYS_READ32		_MIPC_FAST_SYS(_MIPC_SYS_READ32)
+#define MIPC_SYS_READ16		_MIPC_FAST_SYS(_MIPC_SYS_READ16)
+#define MIPC_SYS_READ8		_MIPC_FAST_SYS(_MIPC_SYS_READ8)
+#define MIPC_SYS_SET32		_MIPC_FAST_SYS(_MIPC_SYS_SET32)
+#define MIPC_SYS_SET16		_MIPC_FAST_SYS(_MIPC_SYS_SET16)
+#define MIPC_SYS_SET8		_MIPC_FAST_SYS(_MIPC_SYS_SET8)
+#define MIPC_SYS_CLEAR32	_MIPC_FAST_SYS(_MIPC_SYS_CLEAR32)
+#define MIPC_SYS_CLEAR16	_MIPC_FAST_SYS(_MIPC_SYS_CLEAR16)
+#define MIPC_SYS_CLEAR8		_MIPC_FAST_SYS(_MIPC_SYS_CLEAR8)
+#define MIPC_SYS_MASK32		_MIPC_FAST_SYS(_MIPC_SYS_MASK32)
+#define MIPC_SYS_MASK16		_MIPC_FAST_SYS(_MIPC_SYS_MASK16)
+#define MIPC_SYS_MASK8		_MIPC_FAST_SYS(_MIPC_SYS_MASK8)
+
+#define MIPC_REQ_MAX_ARGS	6
+
+struct mipc_infohdr {
+	char magic[3];
+	u8 version;
+	phys_addr_t mem2_boundary;
+	phys_addr_t ipc_in;
+	size_t ipc_in_size;
+	phys_addr_t ipc_out;
+	size_t ipc_out_size;
+};
+
+struct mipc_device;
+struct mipc_req;
+
+extern int mipc_infohdr_get(struct mipc_infohdr **hdrp);
+extern void mipc_infohdr_put(struct mipc_infohdr *hdr);
+
+extern u32 mipc_in_be32(const volatile u32 __iomem *addr);
+extern u16 mipc_in_be16(const volatile u16 __iomem *addr);
+extern u8 mipc_in_8(const volatile u8 __iomem *addr);
+
+extern void mipc_out_be32(const volatile u32 __iomem *addr, u32 val);
+extern void mipc_out_be16(const volatile u16 __iomem *addr, u16 val);
+extern void mipc_out_8(const volatile u8 __iomem *addr, u8 val);
+
+extern void mipc_clear_bit(int nr, volatile unsigned long *addr);
+extern void mipc_set_bit(int nr, volatile unsigned long *addr);
+extern void mipc_clrsetbits_be32(const volatile u32 __iomem *addr,
+				 u32 clear, u32 set);
+
+extern void mipc_wmb(void);
+
+#else
+
+struct mipc_infohdr;
+
+static inline int mipc_infohdr_get(struct mipc_infohdr **hdrp)
+{
+	return -ENODEV;
+}
+
+static inline void mipc_infohdr_put(struct mipc_infohdr *hdr)
+{
+}
+
+#endif /* CONFIG_STARLET_MINI */
+
+#endif /* __STARLET_MINI_H */
+
diff --git a/arch/powerpc/include/asm/starlet.h b/arch/powerpc/include/asm/starlet.h
new file mode 100644
index 0000000..15e4ac3
--- /dev/null
+++ b/arch/powerpc/include/asm/starlet.h
@@ -0,0 +1,26 @@
+/*
+ * arch/powerpc/include/asm/starlet.h
+ *
+ * Definitions for the Starlet co-processor
+ * Copyright (C) 2009 The GameCube Linux Team
+ * Copyright (C) 2009 Albert Herranz
+ *
+ * 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 __STARLET_H
+#define __STARLET_H
+
+
+enum starlet_ipc_flavour {
+	STARLET_IPC_IOS,
+	STARLET_IPC_MINI,
+};
+
+enum starlet_ipc_flavour starlet_get_ipc_flavour(void);
+
+#endif /* __STARLET_H */
diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 490f89e..f207944 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -125,5 +125,17 @@ config GAMECUBE
 config HLWD_PIC
 	bool
 	depends on STARLET_MINI
-	default y
+
+config STARLET_MINI
+	bool "BootMii Starlet 'mini' firmware support"
+	depends on WII && EXPERIMENTAL
+	help
+	  If you say yes to this option, support will be included for the
+	  BootMii 'mini' firmware running on the Starlet processor of the Wii.
+	  The 'mini' firmware enables full access from Linux to all the
+	  hardware contained in the video game console.
+
+	  This option is harmless if the 'mini' firmware is not installed.
+
+	  If in doubt, say Y here.
 
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index c1dcc54..f41a144 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -11,3 +11,4 @@ obj-$(CONFIG_USBGECKO_UDBG)	+= usbgecko_udbg.o
 obj-$(CONFIG_FLIPPER_PIC)	+= flipper-pic.o
 obj-$(CONFIG_GAMECUBE)		+= gamecube.o gamecube_dev.o
 obj-$(CONFIG_HLWD_PIC)		+= hlwd-pic.o
+obj-$(CONFIG_STARLET_MINI)	+= starlet-mipc.o
diff --git a/arch/powerpc/platforms/embedded6xx/starlet-mipc.c b/arch/powerpc/platforms/embedded6xx/starlet-mipc.c
new file mode 100644
index 0000000..a6456a6
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/starlet-mipc.c
@@ -0,0 +1,1053 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/starlet-mipc.c
+ *
+ * IPC driver for the 'mini' firmware replacement for Starlet
+ * Copyright (C) 2009 The GameCube Linux Team
+ * Copyright (C) 2009 Albert Herranz
+ *
+ * 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.
+ *
+ */
+#define DRV_MODULE_NAME		"starlet-mipc"
+#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/of_platform.h>
+#include <linux/io.h>
+#include <linux/dma-mapping.h>
+#include <linux/delay.h>	/* for mdelay() */
+#include <asm/pgtable.h>	/* for _PAGE_KERNEL_NC */
+#include <asm/time.h>		/* for get_tbl() */
+#include <asm/starlet-mini.h>
+
+#include "hlwd-pic.h"
+
+
+#define DRV_DESCRIPTION		"IPC driver for 'mini'"
+#define DRV_AUTHOR		"Albert Herranz"
+
+static char mipc_driver_version[] = "0.5i";
+
+#define MIPC_OF_COMPATIBLE		"twiizers,starlet-mini-ipc"
+
+#define HW_AHBPROT_OF_COMPATIBLE	"nintendo,hollywood-ahbprot"
+#define HW_GPIO_OF_COMPATIBLE		"nintendo,hollywood-gpio"
+
+
+/*
+ * Hardware registers
+ */
+#define MIPC_TXBUF	0x00	/* data from cpu to starlet */
+
+#define MIPC_CSR		0x04
+#define   MIPC_CSR_TXSTART	(1<<0)	/* start transmit */
+#define   MIPC_CSR_TBEI		(1<<1)	/* tx buf empty int */
+#define   MIPC_CSR_RBFI		(1<<2)	/* rx buf full int */
+#define   MIPC_CSR_RXRDY	(1<<3)	/* receiver ready */
+#define   MIPC_CSR_RBFIMASK	(1<<4)	/* rx buf full int mask */
+#define   MIPC_CSR_TBEIMASK	(1<<5)	/* tx buf empty int mask */
+
+#define MIPC_RXBUF	0x08	/* data from starlet to cpu */
+
+
+#define MIPC_MIN_VER	1
+#define MIPC_MAX_VER	1
+
+#define MIPC_INITIAL_TAG	1
+
+#define MIPC_SYS_IO_TIMEOUT	(250*1000)	/* usecs */
+#define MIPC_DEV_TIMEOUT	(10*1000*1000)	/* usecs */
+
+
+/*
+ * Firmware request.
+ *
+ */
+struct mipc_req {
+	union {
+		struct {
+			u8 flags;
+			u8 device;
+			u16 req;
+		};
+		u32 code;
+	};
+	u32 tag;
+	u32 args[MIPC_REQ_MAX_ARGS];
+} __attribute__ ((packed));
+
+/*
+ *
+ */
+struct mipc_device {
+	void __iomem *io_base;
+	int irq;
+
+	struct device *dev;
+
+	spinlock_t call_lock;	/* serialize firmware calls */
+	spinlock_t io_lock;	/* serialize access to io registers */
+
+	struct mipc_infohdr *hdr;
+
+	struct mipc_req *in_ring;
+	size_t in_ring_size;
+	volatile u16 intail_idx;
+
+	struct mipc_req *out_ring;
+	size_t out_ring_size;
+	volatile u16 outhead_idx;
+
+	u32 tag;
+};
+
+#define __spin_event_timeout(condition, timeout_usecs, result, __end_tbl) \
+	for (__end_tbl = get_tbl() + tb_ticks_per_usec * timeout_usecs;	\
+	     !(result = (condition)) && (int)(__end_tbl - get_tbl()) > 0;)
+
+/*
+ * Update control and status register.
+ */
+static inline void mipc_update_csr(void __iomem *io_base, u32 val)
+{
+	u32 csr;
+
+	csr = in_be32(io_base + MIPC_CSR);
+	/* preserve interrupt masks */
+	csr &= MIPC_CSR_RBFIMASK | MIPC_CSR_TBEIMASK;
+	csr |= val;
+	out_be32(io_base + MIPC_CSR, csr);
+}
+
+static u16 mipc_peek_outtail(void __iomem *io_base)
+{
+	return in_be32(io_base + MIPC_RXBUF) & 0xffff;
+}
+
+static u16 mipc_peek_inhead(void __iomem *io_base)
+{
+	return in_be32(io_base + MIPC_RXBUF) >> 16;
+}
+
+static u16 mipc_peek_first_intail(void __iomem *io_base)
+{
+	return in_be32(io_base + MIPC_TXBUF) & 0xffff;
+}
+
+static u16 mipc_peek_first_outhead(void __iomem *io_base)
+{
+	return in_be32(io_base + MIPC_TXBUF) >> 16;
+}
+
+static void mipc_poke_intail(struct mipc_device *ipc_dev, u16 val)
+{
+	void __iomem *io_base = ipc_dev->io_base;
+	unsigned long flags;
+
+	spin_lock_irqsave(&ipc_dev->io_lock, flags);
+	out_be32(io_base + MIPC_TXBUF,
+		 (in_be32(io_base + MIPC_TXBUF) & 0xffff0000) | val);
+	spin_unlock_irqrestore(&ipc_dev->io_lock, flags);
+}
+
+static void mipc_poke_outhead(struct mipc_device *ipc_dev, u16 val)
+{
+	void __iomem *io_base = ipc_dev->io_base;
+	unsigned long flags;
+
+	spin_lock_irqsave(&ipc_dev->io_lock, flags);
+	out_be32(io_base + MIPC_TXBUF,
+		 (in_be32(io_base + MIPC_TXBUF) & 0x0000ffff) | val<<16);
+	spin_unlock_irqrestore(&ipc_dev->io_lock, flags);
+}
+
+
+
+static u16 mipc_get_next_intail(struct mipc_device *ipc_dev)
+{
+	return (ipc_dev->intail_idx + 1) & (ipc_dev->in_ring_size - 1);
+}
+
+static u16 mipc_get_next_outhead(struct mipc_device *ipc_dev)
+{
+	return (ipc_dev->outhead_idx + 1) & (ipc_dev->out_ring_size - 1);
+}
+
+static void mipc_print_req(struct mipc_req *req)
+{
+	int i;
+
+	pr_info("req %pP = {\n", req);
+	pr_cont("code = %08X, tag = %08X\n", req->code, req->tag);
+	for (i = 0; i < MIPC_REQ_MAX_ARGS; i++)
+		pr_cont("arg[%d] = %08X\n", i, req->args[i]);
+	pr_cont("}\n");
+}
+
+#ifdef DEBUG_RINGS
+static void mipc_dump_ring(struct mipc_req *req, size_t count)
+{
+	int i;
+
+	for (i = 0; i < count; i++)
+		pr_devel("%d: %X (%08X)\n", i, req[i].tag, req[i].code);
+}
+#endif
+
+static void mipc_print_status(struct mipc_device *ipc_dev)
+{
+	size_t in_size, out_size;
+
+	in_size = ipc_dev->in_ring_size * sizeof(*ipc_dev->in_ring);
+	out_size = ipc_dev->out_ring_size * sizeof(*ipc_dev->out_ring);
+
+	pr_info("ppc: intail_idx=%u, outhead_idx=%u\n",
+		ipc_dev->intail_idx, ipc_dev->outhead_idx);
+	pr_cont("arm: inhead_idx=%u, outtail_idx=%u\n",
+		mipc_peek_inhead(ipc_dev->io_base),
+		mipc_peek_outtail(ipc_dev->io_base));
+	pr_cont("in_ring=%uK@%p, out_ring=%uK@%p\n",
+		in_size / 1024, ipc_dev->in_ring,
+		out_size / 1024, ipc_dev->out_ring);
+}
+
+static int mipc_send_req(struct mipc_device *ipc_dev, unsigned long timeout,
+			 struct mipc_req *req)
+{
+	void __iomem *io_base = ipc_dev->io_base;
+	struct mipc_req *firm_req;
+	unsigned long ctx;
+	int result;
+	int error = 0;
+
+	if (mipc_peek_inhead(io_base) == mipc_get_next_intail(ipc_dev)) {
+		pr_err("%s queue full\n", "ppc->arm ipc");
+		__spin_event_timeout(mipc_peek_inhead(io_base) !=
+				     mipc_get_next_intail(ipc_dev),
+				     timeout, result, ctx) {
+			/* busy wait */
+			cpu_relax();
+		}
+		if (!result) {
+			pr_err("%s queue drain timed out\n", "ppc->arm ipc");
+			error = -EIO;
+			goto out;
+		}
+	}
+
+	firm_req = ipc_dev->in_ring + ipc_dev->intail_idx;
+	*firm_req = *req;
+	ipc_dev->intail_idx = mipc_get_next_intail(ipc_dev);
+	mipc_poke_intail(ipc_dev, ipc_dev->intail_idx);
+	mipc_update_csr(ipc_dev->io_base, MIPC_CSR_TXSTART);
+out:
+	if (error)
+		pr_devel("exit %d\n", error);
+	return error;
+}
+
+static int __mipc_recv_req(struct mipc_device *ipc_dev, unsigned long timeout,
+			   struct mipc_req *req)
+{
+	void __iomem *io_base = ipc_dev->io_base;
+	struct mipc_req *firm_req;
+	unsigned long ctx;
+	int result;
+	int error = 0;
+
+	__spin_event_timeout(mipc_peek_outtail(io_base) != ipc_dev->outhead_idx,
+			     timeout, result, ctx) {
+		/* busy wait */
+		cpu_relax();
+	}
+	if (mipc_peek_outtail(io_base) == ipc_dev->outhead_idx) {
+		error = -EIO;
+		goto out;
+	}
+	firm_req = ipc_dev->out_ring + ipc_dev->outhead_idx;
+	*req = *firm_req;
+	ipc_dev->outhead_idx = mipc_get_next_outhead(ipc_dev);
+	mipc_poke_outhead(ipc_dev, ipc_dev->outhead_idx);
+out:
+	return error;
+}
+
+static int mipc_recv_req(struct mipc_device *ipc_dev, unsigned long timeout,
+			 struct mipc_req *req)
+{
+	int error;
+
+	error = __mipc_recv_req(ipc_dev, timeout, req);
+	if (error)
+		pr_devel("arm->ppc ipc request timed out (%d)\n", error);
+	return error;
+}
+
+static int mipc_recv_tagged(struct mipc_device *ipc_dev,
+				unsigned long timeout,
+				u32 code, u32 tag,
+				struct mipc_req *req)
+{
+	unsigned long ctx;
+	int result;
+	int error;
+
+	error = mipc_recv_req(ipc_dev, timeout, req);
+	if (error)
+		goto out;
+
+	__spin_event_timeout(req->code == code && req->tag == tag,
+			     timeout, result, ctx) {
+		pr_devel("expected: code=%08X, tag=%08X\n", code, tag);
+		mipc_print_req(req);
+		pr_devel("+++ status\n");
+		mipc_print_status(ipc_dev);
+#ifdef DEBUG_RINGS
+		pr_devel("+++ in_ring\n");
+		mipc_dump_ring(ipc_dev->in_ring, ipc_dev->in_ring_size);
+		pr_devel("+++ out_ring\n");
+		mipc_dump_ring(ipc_dev->out_ring, ipc_dev->out_ring_size);
+#endif
+
+		error = mipc_recv_req(ipc_dev, timeout, req);
+		if (error)
+			goto out;
+	}
+	if (!result) {
+		pr_err("%s: recv timed out\n", __func__);
+		error = -EIO;
+		goto out;
+	} else
+		error = 0;
+
+out:
+	if (error)
+		pr_devel("exit %d\n", error);
+	return error;
+}
+
+static void __mipc_fill_req(struct mipc_req *req, u32 code)
+{
+	memset(req, 0, sizeof(*req));
+	req->code = code;
+}
+
+static int mipc_sendrecv_call(struct mipc_device *ipc_dev,
+			      unsigned long timeout,
+			      struct mipc_req *req, struct mipc_req *resp)
+{
+	unsigned long flags;
+	int error;
+
+	spin_lock_irqsave(&ipc_dev->call_lock, flags);
+	req->tag = ipc_dev->tag++;
+	error = mipc_send_req(ipc_dev, timeout, req);
+	if (error)
+		goto out;
+	error = mipc_recv_tagged(ipc_dev, timeout, req->code, req->tag, resp);
+out:
+	spin_unlock_irqrestore(&ipc_dev->call_lock, flags);
+
+	return error;
+}
+
+static int mipc_sendrecv1_call(struct mipc_device *ipc_dev,
+			       unsigned long timeout,
+			       struct mipc_req *resp, u32 code, u32 arg)
+{
+	struct mipc_req req;
+
+	__mipc_fill_req(&req, code);
+	req.args[0] = arg;
+	return mipc_sendrecv_call(ipc_dev, timeout, &req, resp);
+}
+
+
+static int mipc_send_call(struct mipc_device *ipc_dev, unsigned long timeout,
+			  struct mipc_req *req)
+{
+	unsigned long flags;
+	int error;
+
+	spin_lock_irqsave(&ipc_dev->call_lock, flags);
+	req->tag = ipc_dev->tag++;
+	error = mipc_send_req(ipc_dev, timeout, req);
+	spin_unlock_irqrestore(&ipc_dev->call_lock, flags);
+
+	return error;
+}
+
+static int mipc_send2_call(struct mipc_device *ipc_dev, unsigned long timeout,
+			   u32 code, u32 arg1, u32 arg2)
+{
+	struct mipc_req req;
+
+	__mipc_fill_req(&req, code);
+	req.args[0] = arg1;
+	req.args[1] = arg2;
+	return mipc_send_call(ipc_dev, timeout, &req);
+}
+
+static int mipc_send3_call(struct mipc_device *ipc_dev, unsigned long timeout,
+			   u32 code, u32 arg1, u32 arg2, u32 arg3)
+{
+	struct mipc_req req;
+
+	__mipc_fill_req(&req, code);
+	req.args[0] = arg1;
+	req.args[1] = arg2;
+	req.args[2] = arg3;
+	return mipc_send_call(ipc_dev, timeout, &req);
+}
+
+static int mipc_flush_send(struct mipc_device *ipc_dev, unsigned long timeout)
+{
+	void __iomem *io_base = ipc_dev->io_base;
+	unsigned long ctx;
+	int result;
+	int error = 0;
+
+	__spin_event_timeout(mipc_peek_inhead(io_base) == ipc_dev->intail_idx,
+			     timeout, result, ctx) {
+		/* busy wait */
+		cpu_relax();
+	}
+	if (!result) {
+		pr_err("%s: flush timed out\n", __func__);
+		error = -EIO;
+		goto out;
+	}
+out:
+	if (error)
+		pr_devel("exit %d\n", error);
+	return error;
+}
+
+static void mipc_flush_recv(struct mipc_device *ipc_dev,
+			    unsigned long timeout)
+{
+	struct mipc_req req;
+	int error;
+
+	do {
+		error = __mipc_recv_req(ipc_dev, timeout, &req);
+	} while (!error);
+}
+
+
+
+static struct mipc_device *mipc_device_instance;
+
+struct mipc_device *mipc_get_device(void)
+{
+	if (!mipc_device_instance)
+		pr_err("uninitialized device instance!\n");
+	return mipc_device_instance;
+}
+
+static int mipc_ping(struct mipc_device *ipc_dev, unsigned long timeout)
+{
+	struct mipc_req resp;
+	int error;
+
+	error = mipc_sendrecv1_call(ipc_dev, timeout, &resp, MIPC_SYS_PING, 0);
+	if (error)
+		pr_devel("exit %d\n", error);
+	return error;
+}
+
+#define __declare_ipc_send2_accessor(_name, _suffix, _size, _call) \
+void mipc_##_name##_suffix(_size a, void __iomem *addr) \
+{									\
+	struct mipc_device *ipc_dev = mipc_get_device();		\
+	int error;							\
+									\
+	error = mipc_send2_call(ipc_dev, MIPC_SYS_IO_TIMEOUT, _call,	\
+				(u32)addr, a);				\
+	if (!error)							\
+		return;							\
+									\
+	pr_devel(__stringify(_name, _suffix) "(%p,%x)\n", addr, a);	\
+	BUG();								\
+}
+
+#define __declare_ipc_send3_accessor(_name, _suffix, _size, _call) \
+void mipc_##_name##_suffix(_size a, _size b, void __iomem *addr) \
+{									\
+	struct mipc_device *ipc_dev = mipc_get_device();		\
+	int error;							\
+									\
+	error = mipc_send3_call(ipc_dev, MIPC_SYS_IO_TIMEOUT, _call,	\
+				(u32)addr, a, b);			\
+	if (!error)							\
+		return;							\
+									\
+	pr_devel(__stringify(_name, _suffix) "(%p,%x,%x)\n", addr, a, b);\
+	BUG();								\
+}
+
+#define __declare_ipc_sendrecv1_accessor(_name, _suffix, _size, _call) \
+_size mipc_##_name##_suffix(void __iomem *addr) \
+{									\
+	struct mipc_device *ipc_dev = mipc_get_device();		\
+	struct mipc_req resp;						\
+	int error;							\
+									\
+	error = mipc_sendrecv1_call(ipc_dev, MIPC_SYS_IO_TIMEOUT,	\
+				    &resp, _call, (u32)addr);		\
+	if (!error)							\
+		return resp.args[0];					\
+									\
+	pr_devel(__stringify(_name, _suffix) "(%p)\n", addr);		\
+	BUG();								\
+	return 0;							\
+}
+
+__declare_ipc_sendrecv1_accessor(read, l, unsigned int, MIPC_SYS_READ32)
+__declare_ipc_sendrecv1_accessor(read, w, unsigned short, MIPC_SYS_READ16)
+__declare_ipc_sendrecv1_accessor(read, b, unsigned char, MIPC_SYS_READ8)
+
+__declare_ipc_send2_accessor(write, l, unsigned int, MIPC_SYS_WRITE32)
+__declare_ipc_send2_accessor(write, w, unsigned short, MIPC_SYS_WRITE16)
+__declare_ipc_send2_accessor(write, b, unsigned char, MIPC_SYS_WRITE8)
+
+__declare_ipc_send2_accessor(setbit, l, unsigned int, MIPC_SYS_SET32)
+__declare_ipc_send2_accessor(clearbit, l, unsigned int, MIPC_SYS_CLEAR32)
+__declare_ipc_send3_accessor(clrsetbits, l, unsigned int, MIPC_SYS_MASK32)
+
+void mipc_wmb(void)
+{
+	struct mipc_device *ipc_dev = mipc_get_device();
+	int error;
+
+	error = mipc_ping(ipc_dev, MIPC_SYS_IO_TIMEOUT);
+	if (!error)
+		return;
+
+	pr_devel(__stringify(_name, _suffix) "()\n");
+	BUG();
+}
+
+
+#define BITOP_MASK(nr)          (1UL << ((nr) % BITS_PER_LONG))
+#define BITOP_WORD(nr)          ((nr) / BITS_PER_LONG)
+
+void mipc_clear_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	mipc_clearbitl(mask, p);
+}
+
+void mipc_set_bit(int nr, volatile unsigned long *addr)
+{
+	unsigned long mask = BITOP_MASK(nr);
+	unsigned long *p = ((unsigned long *)addr) + BITOP_WORD(nr);
+
+	mipc_setbitl(mask, p);
+}
+
+void mipc_clrsetbits_be32(const volatile u32 __iomem *addr, u32 clear, u32 set)
+{
+	mipc_clrsetbitsl(clear, set, (void __iomem *)addr);
+}
+
+u32 mipc_in_be32(const volatile u32 __iomem *addr)
+{
+	return mipc_readl((void __iomem *)addr);
+}
+
+void mipc_out_be32(const volatile u32 __iomem *addr, u32 val)
+{
+	mipc_writel(val, (void __iomem *)addr);
+}
+
+u16 mipc_in_be16(const volatile u16 __iomem *addr)
+{
+	return mipc_readw((void __iomem *)addr);
+}
+
+void mipc_out_be16(const volatile u16 __iomem *addr, u16 val)
+{
+	mipc_writew(val, (void __iomem *)addr);
+}
+
+u8 mipc_in_8(const volatile u8 __iomem *addr)
+{
+	return mipc_readb((void __iomem *)addr);
+}
+
+void mipc_out_8(const volatile u8 __iomem *addr, u8 val)
+{
+	mipc_writeb(val, (void __iomem *)addr);
+}
+
+
+static int mipc_check_address(phys_addr_t pa)
+{
+	if (pa < 0x10000000 || pa > 0x14000000)
+		return -EINVAL;
+	return 0;
+}
+
+int mipc_infohdr_get(struct mipc_infohdr **hdrp)
+{
+	struct device_node *np;
+	struct resource res;
+	struct mipc_infohdr *hdr;
+	char magic[4];
+	phys_addr_t __iomem *p;
+	int error = -ENODEV;
+
+	np = of_find_compatible_node(NULL, NULL, MIPC_OF_COMPATIBLE);
+	if (!np) {
+		pr_err("unable to find compatible node %s\n",
+		       MIPC_OF_COMPATIBLE);
+		goto out;
+	}
+
+	error = of_address_to_resource(np, 1, &res);
+	if (error) {
+		pr_err("mini ipc header ptr unavailable\n");
+		goto out_put;
+	}
+
+	/* grab mini information header location */
+	p = ioremap(res.start, res.end - res.start + 1);
+	if (!p) {
+		pr_err("unable to ioremap mini ipc header ptr\n");
+		error = -ENOMEM;
+		goto out_put;
+	}
+	/* check that the header pointer points to MEM2 */
+	if (mipc_check_address(*p)) {
+		pr_devel("wrong mini ipc header address %pP\n", (void *)*p);
+		goto out_unmap_p;
+	}
+
+	hdr = (struct mipc_infohdr *)ioremap_prot(*p, sizeof(*hdr),
+						      PAGE_KERNEL);
+	if (!hdr) {
+		pr_err("unable to ioremap mini ipc header\n");
+		error = -ENOMEM;
+		goto out_unmap_p;
+	}
+	__dma_sync(hdr, sizeof(*hdr), DMA_FROM_DEVICE);
+
+	memcpy(magic, hdr->magic, 3);
+	magic[3] = 0;
+	if (memcmp(magic, "IPC", 3)) {
+		pr_devel("wrong magic \"%s\"\n", magic);
+		goto out_unmap_hdr;
+	}
+	if (hdr->version < MIPC_MIN_VER && hdr->version > MIPC_MAX_VER) {
+		pr_err("unsupported mini ipc version %d"
+		       " (min %d, max %d)\n", hdr->version,
+		       MIPC_MIN_VER, MIPC_MAX_VER);
+		goto out_unmap_hdr;
+	}
+	if (mipc_check_address(hdr->mem2_boundary)) {
+		pr_err("invalid mem2_boundary %pP\n",
+		       (void *)hdr->mem2_boundary);
+		error = -EINVAL;
+		goto out_unmap_hdr;
+	}
+	if (mipc_check_address(hdr->ipc_in)) {
+		pr_err("invalid ipc_in %pP\n", (void *)hdr->ipc_in);
+		error = -EINVAL;
+		goto out_unmap_hdr;
+	}
+	if (mipc_check_address(hdr->ipc_out)) {
+		pr_err("invalid ipc_out %pP\n", (void *)hdr->ipc_out);
+		error = -EINVAL;
+		goto out_unmap_hdr;
+	}
+
+	*hdrp = hdr;
+	error = 0;
+	goto out_unmap_p;
+
+out_unmap_hdr:
+	iounmap(hdr);
+out_unmap_p:
+	iounmap(p);
+out_put:
+	of_node_put(np);
+out:
+	return error;
+}
+
+void mipc_infohdr_put(struct mipc_infohdr *hdr)
+{
+	iounmap(hdr);
+}
+
+static void mipc_print_infohdr(struct mipc_infohdr *hdr)
+{
+	pr_info("magic=%c%c%c, version=%d, mem2_boundary=%pP\n",
+		hdr->magic[0], hdr->magic[1], hdr->magic[2],
+		hdr->version,
+		(void *)hdr->mem2_boundary);
+	pr_cont("ipc_in[%u] @ %pP, ipc_out[%u] @ %pP\n",
+		hdr->ipc_in_size, (void *)hdr->ipc_in,
+		hdr->ipc_out_size, (void *)hdr->ipc_out);
+}
+
+static void __iomem *mipc_get_hw_reg(char *compatible)
+{
+	struct device_node *np;
+	struct resource res;
+	void __iomem *hw_reg = NULL;
+	int error;
+
+	np = of_find_compatible_node(NULL, NULL, compatible);
+	if (!np) {
+		pr_err("no compatible node found for %s\n", compatible);
+		goto out;
+	}
+	error = of_address_to_resource(np, 0, &res);
+	if (error) {
+		pr_err("no valid reg found for %s\n", np->name);
+		goto out_put;
+	}
+	hw_reg = (void __iomem *)res.start;
+
+out_put:
+	of_node_put(np);
+out:
+	return hw_reg;
+}
+
+static int mipc_do_simple_tests;
+
+#ifndef MODULE
+static int __init mipc_simple_tests_setup(char *str)
+{
+	if (*str)
+		return 0;
+	mipc_do_simple_tests = 1;
+	return 1;
+}
+__setup("mipc_simple_tests", mipc_simple_tests_setup);
+#endif
+
+static unsigned long tbl_to_ns(unsigned long tbl)
+{
+	return (tbl * 1000) / tb_ticks_per_usec;
+}
+
+static void mipc_simple_tests(struct mipc_device *ipc_dev)
+{
+	void __iomem *io_base = ipc_dev->io_base;
+	void *gpio;
+	unsigned long t0;
+	unsigned long t_read, t_write;
+	unsigned long t_mipc_read, t_mipc_write, t_mipc_ping;
+	u32 val;
+	int i;
+
+	gpio = mipc_get_hw_reg(HW_GPIO_OF_COMPATIBLE);
+	if (!gpio)
+		return;
+
+	for (i = 0; i < 64000; i++) {
+		t0 = get_tbl();
+		in_be32(io_base + MIPC_CSR);
+		t_read = get_tbl() - t0;
+
+		t0 = get_tbl();
+		out_be32(io_base + MIPC_CSR, 0);
+		t_write = get_tbl() - t0;
+
+		t0 = get_tbl();
+		val = mipc_readl(gpio);
+		t_mipc_read = get_tbl() - t0;
+
+		t0 = get_tbl();
+		/* turn off front LED */
+		mipc_writel(val & ~0x20, gpio);
+		t_mipc_write = get_tbl() - t0;
+
+		t0 = get_tbl();
+		mipc_ping(ipc_dev, MIPC_SYS_IO_TIMEOUT);
+		t_mipc_ping = get_tbl() - t0;
+	}
+
+	pr_info("io timings in timebase ticks"
+		" (1 usec = %lu ticks)\n", tb_ticks_per_usec);
+	pr_cont("mmio: read=%lu (%lu ns), write=%lu (%lu ns)\n",
+		t_read, tbl_to_ns(t_read), t_write, tbl_to_ns(t_write));
+	pr_cont("mipc: read=%lu (%lu ns), write=%lu (%lu ns)\n",
+		t_mipc_read, tbl_to_ns(t_mipc_read),
+		t_mipc_write, tbl_to_ns(t_mipc_write));
+	pr_cont("mipc: ping=%lu (%lu ns)\n",
+		t_mipc_ping, tbl_to_ns(t_mipc_ping));
+}
+
+static void mipc_shutdown_mini_devs(struct mipc_device *ipc_dev)
+{
+	struct mipc_req resp;
+	int error;
+
+	error = mipc_sendrecv1_call(ipc_dev, MIPC_DEV_TIMEOUT, &resp,
+				    _MIPC(_MIPC_SLOW, _MIPC_DEV_SDHC,
+					   _MIPC_SDHC_EXIT), 0);
+	if (error)
+		pr_err("unable to shutdown mini SDHC subsystem\n");
+}
+
+static void mipc_starlet_fixups(struct mipc_device *ipc_dev)
+{
+	void __iomem *gpio;
+
+	/*
+	 * Try to turn off the front led and sensor bar.
+	 * (not strictly starlet-only stuff but anyway...)
+	 */
+	gpio = mipc_get_hw_reg(HW_GPIO_OF_COMPATIBLE);
+	if (gpio)
+		mipc_clearbitl(0x120, gpio);
+
+	/* tell 'mini' to relinquish control of hardware */
+	mipc_shutdown_mini_devs(ipc_dev);
+}
+
+static void mipc_init_ahbprot(struct mipc_device *ipc_dev)
+{
+	void __iomem *hw_ahbprot;
+	u32 initial_ahbprot, ahbprot = 0;
+
+	hw_ahbprot = mipc_get_hw_reg(HW_AHBPROT_OF_COMPATIBLE);
+	if (!hw_ahbprot)
+		goto done;
+
+	initial_ahbprot = mipc_readl(hw_ahbprot);
+	if (initial_ahbprot != 0xffffffff) {
+		pr_debug("AHBPROT=%08X (before)\n", initial_ahbprot);
+		/* enable full access from the PowerPC side */
+		mipc_writel(0xffffffff, hw_ahbprot);
+	}
+
+	ahbprot = mipc_readl(hw_ahbprot);
+	if (initial_ahbprot != ahbprot)
+		pr_debug("AHBPROT=%08X (after)\n", ahbprot);
+done:
+	if (ahbprot != 0xffffffff)
+		pr_err("failed to set AHBPROT\n");
+}
+
+static int mipc_init(struct mipc_device *ipc_dev, struct resource *mem, int irq)
+{
+	struct mipc_infohdr *hdr;
+	void __iomem *io_base;
+	size_t io_size, in_size, out_size;
+	int error;
+
+	error = mipc_infohdr_get(&hdr);
+	if (error) {
+		pr_err("unable to find mini ipc instance\n");
+		goto out;
+	}
+
+	spin_lock_init(&ipc_dev->call_lock);
+	spin_lock_init(&ipc_dev->io_lock);
+
+	io_size = mem[0].end - mem[0].start + 1;
+	io_base = ipc_dev->io_base = ioremap(mem[0].start, io_size);
+	ipc_dev->irq = irq;
+
+	ipc_dev->hdr = hdr;
+
+	mipc_print_infohdr(hdr);
+
+	in_size = hdr->ipc_in_size * sizeof(*ipc_dev->in_ring);
+	ipc_dev->in_ring = ioremap(hdr->ipc_in, in_size);
+	ipc_dev->in_ring_size = hdr->ipc_in_size;
+	ipc_dev->intail_idx = mipc_peek_first_intail(io_base);
+
+	out_size = hdr->ipc_out_size * sizeof(*ipc_dev->out_ring);
+	ipc_dev->out_ring = ioremap(hdr->ipc_out, out_size);
+	ipc_dev->out_ring_size = hdr->ipc_out_size;
+	ipc_dev->outhead_idx = mipc_peek_first_outhead(io_base);
+
+	ipc_dev->tag = MIPC_INITIAL_TAG;
+	mipc_device_instance = ipc_dev;
+
+	mipc_print_status(ipc_dev);
+
+	mipc_flush_send(ipc_dev, 5*1000);
+	mipc_flush_recv(ipc_dev, 5*1000);
+	error = mipc_ping(ipc_dev, 1*1000*1000);
+	if (error)
+		goto out;
+
+	pr_info("ping OK\n");
+	if (mipc_do_simple_tests)
+		mipc_simple_tests(ipc_dev);
+
+	mipc_init_ahbprot(ipc_dev);
+	mipc_starlet_fixups(ipc_dev);
+
+out:
+	return error;
+}
+
+static void mipc_exit(struct mipc_device *ipc_dev)
+{
+	if (ipc_dev->in_ring)
+		iounmap(ipc_dev->in_ring);
+	if (ipc_dev->out_ring)
+		iounmap(ipc_dev->out_ring);
+	mipc_infohdr_put(ipc_dev->hdr);
+}
+
+
+/*
+ * Driver model helper routines.
+ *
+ */
+
+static int mipc_do_probe(struct device *dev, struct resource *mem, int irq)
+{
+	struct mipc_device *ipc_dev;
+	int error;
+
+	ipc_dev = kzalloc(sizeof(*ipc_dev), GFP_KERNEL);
+	if (!ipc_dev) {
+		pr_err("failed to allocate ipc_dev\n");
+		error = -ENOMEM;
+		goto out;
+	}
+	dev_set_drvdata(dev, ipc_dev);
+	ipc_dev->dev = dev;
+
+	error = mipc_init(ipc_dev, mem, irq);
+	if (error) {
+		dev_set_drvdata(dev, NULL);
+		kfree(ipc_dev);
+		goto out;
+	}
+
+	pr_info("ready\n");
+
+#ifdef CONFIG_HLWD_PIC
+	/*
+	 * Setup the Hollywood interrupt controller as soon as
+	 * we detect that we are running under the mini firmware.
+	 */
+	hlwd_pic_probe();
+#endif
+
+out:
+	return error;
+}
+
+static int mipc_do_remove(struct device *dev)
+{
+	struct mipc_device *ipc_dev = dev_get_drvdata(dev);
+	int error = 0;
+
+	if (!ipc_dev) {
+		error = -ENODEV;
+		goto out;
+	}
+
+	mipc_exit(ipc_dev);
+	dev_set_drvdata(dev, NULL);
+	kfree(ipc_dev);
+out:
+	return error;
+}
+
+static int mipc_do_shutdown(struct device *dev)
+{
+	struct mipc_device *ipc_dev = dev_get_drvdata(dev);
+	int error = 0;
+
+	if (!ipc_dev) {
+		error = -ENODEV;
+		goto out;
+	}
+out:
+	return error;
+}
+
+/*
+ * OF platform driver hooks.
+ *
+ */
+
+static int mipc_of_probe(struct of_device *odev,
+			 const struct of_device_id *dev_id)
+{
+	struct resource mem[2];
+	int error;
+
+	error = of_address_to_resource(odev->node, 0, &mem[0]);
+	if (error) {
+		pr_err("no io memory range found (%d)\n", error);
+		goto out;
+	}
+
+	error = mipc_do_probe(&odev->dev, mem,
+			      irq_of_parse_and_map(odev->node, 0));
+out:
+	return error;
+}
+
+static int mipc_of_remove(struct of_device *odev)
+{
+	return mipc_do_remove(&odev->dev);
+}
+
+static int mipc_of_shutdown(struct of_device *odev)
+{
+	return mipc_do_shutdown(&odev->dev);
+}
+
+static struct of_device_id mipc_of_match[] = {
+	{ .compatible = MIPC_OF_COMPATIBLE },
+	{ },
+};
+
+MODULE_DEVICE_TABLE(of, mipc_of_match);
+
+static struct of_platform_driver mipc_of_driver = {
+	.owner = THIS_MODULE,
+	.name = DRV_MODULE_NAME,
+	.match_table = mipc_of_match,
+	.probe = mipc_of_probe,
+	.remove = mipc_of_remove,
+	.shutdown = mipc_of_shutdown,
+};
+
+/*
+ * Kernel module interface hooks.
+ *
+ */
+
+static int __init mipc_init_module(void)
+{
+	pr_info("%s - version %s\n", DRV_DESCRIPTION, mipc_driver_version);
+
+	return of_register_platform_driver(&mipc_of_driver);
+}
+
+static void __exit mipc_exit_module(void)
+{
+	of_unregister_platform_driver(&mipc_of_driver);
+}
+
+module_init(mipc_init_module);
+module_exit(mipc_exit_module);
+
+MODULE_DESCRIPTION(DRV_DESCRIPTION);
+MODULE_AUTHOR(DRV_AUTHOR);
+MODULE_LICENSE("GPL");
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 18/19] powerpc: wii: platform support
  2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
@ 2009-11-22 22:01                                   ` Albert Herranz
  2009-11-22 22:01                                     ` [RFC PATCH 19/19] powerpc: wii: default config Albert Herranz
                                                       ` (2 more replies)
  2009-11-22 22:48                                   ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Arnd Bergmann
  2009-11-24 22:13                                   ` Segher Boessenkool
  2 siblings, 3 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add platform support for the Nintendo Wii video game console.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/platforms/embedded6xx/Kconfig   |    8 +
 arch/powerpc/platforms/embedded6xx/Makefile  |    1 +
 arch/powerpc/platforms/embedded6xx/wii.c     |  270 ++++++++++++++++++++++++++
 arch/powerpc/platforms/embedded6xx/wii_dev.c |   47 +++++
 4 files changed, 326 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/platforms/embedded6xx/wii.c
 create mode 100644 arch/powerpc/platforms/embedded6xx/wii_dev.c

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index f207944..6e9b579 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -139,3 +139,11 @@ config STARLET_MINI
 
 	  If in doubt, say Y here.
 
+config WII
+	bool "Nintendo-Wii"
+	depends on EMBEDDED6xx
+	select GAMECUBE_COMMON
+	help
+	  Select WII if configuring for the Nintendo Wii.
+	  More information at: <http://gc-linux.sourceforge.net/>
+
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index f41a144..313a922 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -12,3 +12,4 @@ obj-$(CONFIG_FLIPPER_PIC)	+= flipper-pic.o
 obj-$(CONFIG_GAMECUBE)		+= gamecube.o gamecube_dev.o
 obj-$(CONFIG_HLWD_PIC)		+= hlwd-pic.o
 obj-$(CONFIG_STARLET_MINI)	+= starlet-mipc.o
+obj-$(CONFIG_WII)		+= wii.o wii_dev.o
diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/powerpc/platforms/embedded6xx/wii.c
new file mode 100644
index 0000000..b0d7f52
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/wii.c
@@ -0,0 +1,270 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/wii.c
+ *
+ * Nintendo Wii board-specific support
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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.
+ *
+ */
+#define DRV_MODULE_NAME "rvl"
+#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/irq.h>
+#include <linux/seq_file.h>
+#include <linux/kexec.h>
+
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/time.h>
+#include <asm/starlet.h>
+#include <asm/starlet-mini.h>
+#include <asm/udbg.h>
+
+#include "flipper-pic.h"
+#include "usbgecko_udbg.h"
+
+
+static enum starlet_ipc_flavour starlet_ipc_flavour;
+
+enum starlet_ipc_flavour starlet_get_ipc_flavour(void)
+{
+	return starlet_ipc_flavour;
+}
+
+static void wii_spin(void)
+{
+	local_irq_disable();
+	for (;;)
+		cpu_relax();
+}
+
+#ifdef CONFIG_STARLET_MINI
+
+#define HW_RESETS_OF_COMPATIBLE	"nintendo,hollywood-resets"
+#define HW_GPIO_ALIAS		"hw_gpio"
+
+#define HW_GPIO_OUT		0
+#define HW_GPIO_DIR		4
+#define HW_GPIO_SHUTDOWN	(1<<1)
+
+static void __iomem *hw_resets;
+static void __iomem *hw_gpio;
+
+static int wii_setup_hw_resets(void)
+{
+	struct device_node *np;
+	struct resource res;
+	int error = -ENODEV;
+
+	np = of_find_compatible_node(NULL, NULL, HW_RESETS_OF_COMPATIBLE);
+	if (!np) {
+		pr_err("no compatible node found for %s\n",
+		       HW_RESETS_OF_COMPATIBLE);
+		goto out;
+	}
+	error = of_address_to_resource(np, 0, &res);
+	if (error) {
+		pr_err("no valid reg found for %s\n", np->name);
+		goto out_put;
+	}
+
+	hw_resets = ioremap(res.start, res.end - res.start + 1);
+	if (hw_resets) {
+		pr_info("hw_resets at 0x%08x mapped to 0x%p\n",
+			res.start, hw_resets);
+	}
+
+out_put:
+	of_node_put(np);
+out:
+	return error;
+}
+
+static int wii_setup_hw_gpio(void)
+{
+	struct device_node *np;
+	struct resource res;
+	const char *path;
+	int error = -ENODEV;
+
+	np = of_find_node_by_name(NULL, "aliases");
+	if (!np) {
+		pr_err("unable to find node %s\n", "aliases");
+		goto out;
+	}
+
+	path = of_get_property(np, HW_GPIO_ALIAS, NULL);
+	of_node_put(np);
+	if (!path) {
+		pr_err("alias %s unknown\n", HW_GPIO_ALIAS);
+		goto out;
+	}
+
+	np = of_find_node_by_path(path);
+	if (!np) {
+		pr_err("node for alias %s unknown\n", HW_GPIO_ALIAS);
+		goto out;
+	}
+	error = of_address_to_resource(np, 0, &res);
+	if (error) {
+		pr_err("no valid reg found for %s\n", np->name);
+		goto out_put;
+	}
+
+	hw_gpio = ioremap(res.start, res.end - res.start + 1);
+	if (hw_gpio) {
+		pr_info("hw_gpio at 0x%08x mapped to 0x%p\n",
+			res.start, hw_gpio);
+	}
+
+out_put:
+	of_node_put(np);
+out:
+	return error;
+}
+
+static void wii_setup(void)
+{
+	wii_setup_hw_resets();
+	wii_setup_hw_gpio();
+}
+
+static void wii_restart(char *cmd)
+{
+	local_irq_disable();
+
+	if (hw_resets) {
+		/* clear the system reset pin to cause a reset */
+		clear_bit(0, hw_resets);
+	}
+	wii_spin();
+}
+
+static void wii_power_off(void)
+{
+	local_irq_disable();
+
+	if (hw_gpio) {
+		/* make sure that the poweroff GPIO is configured as output */
+		out_be32(hw_gpio + HW_GPIO_DIR,
+			 in_be32(hw_gpio + HW_GPIO_DIR) | HW_GPIO_SHUTDOWN);
+
+		/* drive the poweroff GPIO high */
+		out_be32(hw_gpio + HW_GPIO_OUT,
+			 in_be32(hw_gpio + HW_GPIO_OUT) | HW_GPIO_SHUTDOWN);
+	}
+	wii_spin();
+}
+
+#else
+
+static void wii_setup(void)
+{
+}
+
+static void wii_restart(char *cmd)
+{
+	wii_spin();
+}
+
+static void wii_power_off(void)
+{
+	wii_spin();
+}
+
+#endif /* CONFIG_STARLET_MINI */
+
+static void wii_halt(void)
+{
+	if (ppc_md.restart)
+		ppc_md.restart(NULL);
+	wii_spin();
+}
+
+static void wii_show_cpuinfo(struct seq_file *m)
+{
+	seq_printf(m, "vendor\t\t: IBM\n");
+	seq_printf(m, "machine\t\t: Nintendo Wii\n");
+}
+
+static int wii_discover_ipc_flavour(void)
+{
+	struct mipc_infohdr *hdrp;
+	int error;
+
+	error = mipc_infohdr_get(&hdrp);
+	if (!error) {
+		mipc_infohdr_put(hdrp);
+		starlet_ipc_flavour = STARLET_IPC_MINI;
+		wii_setup();
+		ppc_md.restart = wii_restart;
+		ppc_md.power_off = wii_power_off;
+	}
+
+	return 0;
+}
+
+static void __init wii_setup_arch(void)
+{
+	ug_udbg_init();
+	wii_discover_ipc_flavour();
+}
+
+static void __init wii_init_early(void)
+{
+}
+
+static int __init wii_probe(void)
+{
+	unsigned long dt_root;
+
+	dt_root = of_get_flat_dt_root();
+	if (!of_flat_dt_is_compatible(dt_root, "nintendo,wii"))
+		return 0;
+
+	return 1;
+}
+
+static void wii_shutdown(void)
+{
+	flipper_quiesce();
+}
+
+#ifdef CONFIG_KEXEC
+static int wii_machine_kexec_prepare(struct kimage *image)
+{
+	return 0;
+}
+
+static void wii_machine_kexec(struct kimage *image)
+{
+	default_machine_kexec(image);
+}
+#endif /* CONFIG_KEXEC */
+
+define_machine(wii) {
+	.name			= "wii",
+	.probe			= wii_probe,
+	.setup_arch		= wii_setup_arch,
+	.init_early		= wii_init_early,
+	.show_cpuinfo		= wii_show_cpuinfo,
+	.halt			= wii_halt,
+	.init_IRQ		= flipper_pic_probe,
+	.get_irq		= flipper_pic_get_irq,
+	.calibrate_decr		= generic_calibrate_decr,
+	.progress		= udbg_progress,
+	.machine_shutdown	= wii_shutdown,
+#ifdef CONFIG_KEXEC
+	.machine_kexec_prepare	= wii_machine_kexec_prepare,
+	.machine_kexec		= wii_machine_kexec,
+#endif
+};
+
diff --git a/arch/powerpc/platforms/embedded6xx/wii_dev.c b/arch/powerpc/platforms/embedded6xx/wii_dev.c
new file mode 100644
index 0000000..903063e
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/wii_dev.c
@@ -0,0 +1,47 @@
+/*
+ * arch/powerpc/platforms/embedded6xx/wii_dev.c
+ *
+ * Nintendo Wii platform device setup.
+ * Copyright (C) 2008-2009 The GameCube Linux Team
+ * Copyright (C) 2008,2009 Albert Herranz
+ *
+ * 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/kernel.h>
+#include <linux/init.h>
+#include <linux/of_platform.h>
+
+#include <asm/machdep.h>
+
+static struct of_device_id wii_of_bus[] = {
+	{ .compatible = "nintendo,hollywood", },
+#ifdef CONFIG_STARLET_MINI
+	{ .compatible = "twiizers,starlet-mini-ipc", },
+#endif
+	{ },
+};
+
+static int __init wii_device_probe(void)
+{
+	struct device_node *np;
+
+	if (!machine_is(wii))
+		return 0;
+
+	of_platform_bus_probe(NULL, wii_of_bus, NULL);
+
+	np = of_find_compatible_node(NULL, NULL, "nintendo,hollywood-mem2");
+	if (np) {
+		of_platform_device_create(np, NULL, NULL);
+		of_node_put(np);
+	}
+
+	return 0;
+}
+device_initcall(wii_device_probe);
+
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* [RFC PATCH 19/19] powerpc: wii: default config
  2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
@ 2009-11-22 22:01                                     ` Albert Herranz
  2009-11-22 23:45                                     ` [RFC PATCH 18/19] powerpc: wii: platform support Grant Likely
  2009-11-24 22:24                                     ` Segher Boessenkool
  2 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-22 22:01 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

Add a default configuration for the Nintendo Wii video game console.

Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
---
 arch/powerpc/configs/wii_defconfig | 1406 ++++++++++++++++++++++++++++++++++++
 1 files changed, 1406 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/wii_defconfig

diff --git a/arch/powerpc/configs/wii_defconfig b/arch/powerpc/configs/wii_defconfig
new file mode 100644
index 0000000..c386828
--- /dev/null
+++ b/arch/powerpc/configs/wii_defconfig
@@ -0,0 +1,1406 @@
+#
+# Automatically generated make config: don't edit
+# Linux kernel version: 2.6.32-rc8
+# Sun Nov 22 20:37:21 2009
+#
+# CONFIG_PPC64 is not set
+
+#
+# Processor support
+#
+CONFIG_PPC_BOOK3S_32=y
+# CONFIG_PPC_85xx is not set
+# CONFIG_PPC_8xx is not set
+# CONFIG_40x is not set
+# CONFIG_44x is not set
+# CONFIG_E200 is not set
+CONFIG_PPC_BOOK3S=y
+CONFIG_6xx=y
+CONFIG_PPC_FPU=y
+# CONFIG_ALTIVEC is not set
+CONFIG_PPC_STD_MMU=y
+CONFIG_PPC_STD_MMU_32=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_PPC_HAVE_PMU_SUPPORT=y
+CONFIG_PPC_PERF_CTRS=y
+# CONFIG_SMP is not set
+CONFIG_NOT_COHERENT_CACHE=y
+CONFIG_PPC32=y
+CONFIG_WORD_SIZE=32
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
+CONFIG_MMU=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_TIME_VSYSCALL=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
+# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
+CONFIG_IRQ_PER_CPU=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_RWSEM_XCHGADD_ALGORITHM=y
+CONFIG_ARCH_HAS_ILOG2_U32=y
+CONFIG_GENERIC_HWEIGHT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_GPIO=y
+# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
+CONFIG_PPC=y
+CONFIG_EARLY_PRINTK=y
+CONFIG_GENERIC_NVRAM=y
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_PPC_OF=y
+CONFIG_OF=y
+# CONFIG_PPC_UDBG_16550 is not set
+# CONFIG_GENERIC_TBSYNC is not set
+CONFIG_AUDIT_ARCH=y
+CONFIG_GENERIC_BUG=y
+CONFIG_DTC=y
+# CONFIG_DEFAULT_UIMAGE is not set
+# CONFIG_PPC_DCR_NATIVE is not set
+# CONFIG_PPC_DCR_MMIO is not set
+CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
+CONFIG_CONSTRUCTORS=y
+
+#
+# General setup
+#
+CONFIG_EXPERIMENTAL=y
+CONFIG_BROKEN_ON_SMP=y
+CONFIG_LOCK_KERNEL=y
+CONFIG_INIT_ENV_ARG_LIMIT=32
+CONFIG_LOCALVERSION="-wii"
+# CONFIG_LOCALVERSION_AUTO is not set
+CONFIG_SWAP=y
+CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
+# CONFIG_POSIX_MQUEUE is not set
+# CONFIG_BSD_PROCESS_ACCT is not set
+# CONFIG_TASKSTATS is not set
+# CONFIG_AUDIT is not set
+
+#
+# RCU Subsystem
+#
+CONFIG_TREE_RCU=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+# CONFIG_RCU_TRACE is not set
+CONFIG_RCU_FANOUT=32
+# CONFIG_RCU_FANOUT_EXACT is not set
+# CONFIG_TREE_RCU_TRACE is not set
+CONFIG_IKCONFIG=y
+CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_GROUP_SCHED=y
+CONFIG_FAIR_GROUP_SCHED=y
+# CONFIG_RT_GROUP_SCHED is not set
+CONFIG_USER_SCHED=y
+# CONFIG_CGROUP_SCHED is not set
+# CONFIG_CGROUPS is not set
+CONFIG_SYSFS_DEPRECATED=y
+CONFIG_SYSFS_DEPRECATED_V2=y
+CONFIG_RELAY=y
+# CONFIG_NAMESPACES is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_RD_GZIP=y
+# CONFIG_RD_BZIP2 is not set
+# CONFIG_RD_LZMA is not set
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_SYSCTL=y
+CONFIG_ANON_INODES=y
+CONFIG_EMBEDDED=y
+CONFIG_SYSCTL_SYSCALL=y
+CONFIG_KALLSYMS=y
+CONFIG_KALLSYMS_ALL=y
+# CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_HOTPLUG=y
+CONFIG_PRINTK=y
+CONFIG_BUG=y
+# CONFIG_ELF_CORE is not set
+CONFIG_BASE_FULL=y
+CONFIG_FUTEX=y
+CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
+CONFIG_SHMEM=y
+CONFIG_AIO=y
+CONFIG_HAVE_PERF_EVENTS=y
+
+#
+# Kernel Performance Events And Counters
+#
+CONFIG_PERF_EVENTS=y
+CONFIG_EVENT_PROFILE=y
+CONFIG_PERF_COUNTERS=y
+# CONFIG_DEBUG_PERF_USE_VMALLOC is not set
+# CONFIG_VM_EVENT_COUNTERS is not set
+CONFIG_COMPAT_BRK=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+# CONFIG_PROFILING is not set
+CONFIG_TRACEPOINTS=y
+CONFIG_HAVE_OPROFILE=y
+# CONFIG_KPROBES is not set
+CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
+CONFIG_HAVE_IOREMAP_PROT=y
+CONFIG_HAVE_KPROBES=y
+CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_ARCH_TRACEHOOK=y
+CONFIG_HAVE_DMA_ATTRS=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+
+#
+# GCOV-based kernel profiling
+#
+# CONFIG_GCOV_KERNEL is not set
+CONFIG_SLOW_WORK=y
+# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
+CONFIG_SLABINFO=y
+CONFIG_RT_MUTEXES=y
+CONFIG_BASE_SMALL=0
+CONFIG_MODULES=y
+# CONFIG_MODULE_FORCE_LOAD is not set
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_MODULE_FORCE_UNLOAD is not set
+# CONFIG_MODVERSIONS is not set
+# CONFIG_MODULE_SRCVERSION_ALL is not set
+CONFIG_BLOCK=y
+CONFIG_LBDAF=y
+CONFIG_BLK_DEV_BSG=y
+# CONFIG_BLK_DEV_INTEGRITY is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+CONFIG_IOSCHED_DEADLINE=y
+CONFIG_IOSCHED_CFQ=y
+CONFIG_DEFAULT_AS=y
+# CONFIG_DEFAULT_DEADLINE is not set
+# CONFIG_DEFAULT_CFQ is not set
+# CONFIG_DEFAULT_NOOP is not set
+CONFIG_DEFAULT_IOSCHED="anticipatory"
+# CONFIG_FREEZER is not set
+
+#
+# Platform support
+#
+# CONFIG_PPC_CHRP is not set
+# CONFIG_MPC5121_ADS is not set
+# CONFIG_MPC5121_GENERIC is not set
+# CONFIG_PPC_MPC52xx is not set
+# CONFIG_PPC_PMAC is not set
+# CONFIG_PPC_CELL is not set
+# CONFIG_PPC_CELL_NATIVE is not set
+# CONFIG_PPC_82xx is not set
+# CONFIG_PQ2ADS is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
+CONFIG_EMBEDDED6xx=y
+# CONFIG_LINKSTATION is not set
+# CONFIG_STORCENTER is not set
+# CONFIG_MPC7448HPC2 is not set
+# CONFIG_PPC_HOLLY is not set
+# CONFIG_PPC_PRPMC2800 is not set
+# CONFIG_PPC_C2K is not set
+CONFIG_GAMECUBE_COMMON=y
+CONFIG_USBGECKO_UDBG=y
+CONFIG_FLIPPER_PIC=y
+# CONFIG_GAMECUBE is not set
+CONFIG_HLWD_PIC=y
+CONFIG_STARLET_MINI=y
+CONFIG_WII=y
+# CONFIG_AMIGAONE is not set
+# CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
+# CONFIG_IPIC is not set
+# CONFIG_MPIC is not set
+# CONFIG_MPIC_WEIRD is not set
+# CONFIG_PPC_I8259 is not set
+# CONFIG_PPC_RTAS is not set
+# CONFIG_MMIO_NVRAM is not set
+# CONFIG_PPC_MPC106 is not set
+# CONFIG_PPC_970_NAP is not set
+# CONFIG_PPC_INDIRECT_IO is not set
+# CONFIG_GENERIC_IOMAP is not set
+# CONFIG_CPU_FREQ is not set
+# CONFIG_TAU is not set
+# CONFIG_FSL_ULI1575 is not set
+# CONFIG_SIMPLE_GPIO is not set
+
+#
+# Kernel options
+#
+# CONFIG_HIGHMEM is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+# CONFIG_HZ_100 is not set
+CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
+# CONFIG_HZ_1000 is not set
+CONFIG_HZ=250
+# CONFIG_SCHED_HRTICK is not set
+# CONFIG_PREEMPT_NONE is not set
+# CONFIG_PREEMPT_VOLUNTARY is not set
+CONFIG_PREEMPT=y
+CONFIG_BINFMT_ELF=y
+# CONFIG_HAVE_AOUT is not set
+CONFIG_BINFMT_MISC=m
+# CONFIG_IOMMU_HELPER is not set
+# CONFIG_SWIOTLB is not set
+CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
+CONFIG_ARCH_HAS_WALK_MEMORY=y
+CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
+CONFIG_KEXEC=y
+# CONFIG_CRASH_DUMP is not set
+CONFIG_MAX_ACTIVE_REGIONS=32
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_SPLIT_PTLOCK_CPUS=4
+# CONFIG_MIGRATION is not set
+# CONFIG_PHYS_ADDR_T_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
+CONFIG_HAVE_MLOCK=y
+CONFIG_HAVE_MLOCKED_PAGE_BIT=y
+# CONFIG_KSM is not set
+CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
+CONFIG_PPC_4K_PAGES=y
+# CONFIG_PPC_16K_PAGES is not set
+# CONFIG_PPC_64K_PAGES is not set
+# CONFIG_PPC_256K_PAGES is not set
+CONFIG_FORCE_MAX_ZONEORDER=11
+CONFIG_PROC_DEVICETREE=y
+# CONFIG_CMDLINE_BOOL is not set
+CONFIG_EXTRA_TARGETS=""
+# CONFIG_PM is not set
+# CONFIG_SECCOMP is not set
+CONFIG_ISA_DMA_API=y
+
+#
+# Bus options
+#
+CONFIG_ZONE_DMA=y
+CONFIG_GENERIC_ISA_DMA=y
+# CONFIG_PCI is not set
+# CONFIG_PCI_DOMAINS is not set
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+# CONFIG_PCCARD is not set
+# CONFIG_HAS_RAPIDIO is not set
+
+#
+# Advanced setup
+#
+CONFIG_ADVANCED_OPTIONS=y
+# CONFIG_LOWMEM_SIZE_BOOL is not set
+CONFIG_LOWMEM_SIZE=0x30000000
+# CONFIG_PAGE_OFFSET_BOOL is not set
+CONFIG_PAGE_OFFSET=0xc0000000
+# CONFIG_KERNEL_START_BOOL is not set
+CONFIG_KERNEL_START=0xc0000000
+CONFIG_PHYSICAL_START=0x00000000
+# CONFIG_TASK_SIZE_BOOL is not set
+CONFIG_TASK_SIZE=0xc0000000
+# CONFIG_CONSISTENT_SIZE_BOOL is not set
+CONFIG_CONSISTENT_SIZE=0x00200000
+CONFIG_NET=y
+
+#
+# Networking options
+#
+CONFIG_PACKET=y
+# CONFIG_PACKET_MMAP is not set
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+# CONFIG_IP_MULTICAST is not set
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+# CONFIG_IP_PNP_BOOTP is not set
+CONFIG_IP_PNP_RARP=y
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+# CONFIG_INET_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_LRO is not set
+# CONFIG_INET_DIAG is not set
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+# CONFIG_IPV6 is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_RDS is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_NET_DSA is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
+# CONFIG_PHONET is not set
+# CONFIG_IEEE802154 is not set
+# CONFIG_NET_SCHED is not set
+# CONFIG_DCB is not set
+
+#
+# Network testing
+#
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_NET_DROP_MONITOR is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_CAN is not set
+# CONFIG_IRDA is not set
+CONFIG_BT=y
+CONFIG_BT_L2CAP=y
+# CONFIG_BT_SCO is not set
+CONFIG_BT_RFCOMM=y
+# CONFIG_BT_RFCOMM_TTY is not set
+CONFIG_BT_BNEP=y
+CONFIG_BT_BNEP_MC_FILTER=y
+# CONFIG_BT_BNEP_PROTO_FILTER is not set
+CONFIG_BT_HIDP=y
+
+#
+# Bluetooth device drivers
+#
+# CONFIG_BT_HCIBTSDIO is not set
+# CONFIG_BT_HCIUART is not set
+# CONFIG_BT_HCIVHCI is not set
+# CONFIG_BT_MRVL is not set
+# CONFIG_AF_RXRPC is not set
+CONFIG_WIRELESS=y
+CONFIG_CFG80211=y
+# CONFIG_NL80211_TESTMODE is not set
+# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
+# CONFIG_CFG80211_REG_DEBUG is not set
+CONFIG_CFG80211_DEFAULT_PS=y
+CONFIG_CFG80211_DEFAULT_PS_VALUE=1
+# CONFIG_CFG80211_DEBUGFS is not set
+CONFIG_WIRELESS_OLD_REGULATORY=y
+CONFIG_WIRELESS_EXT=y
+CONFIG_WIRELESS_EXT_SYSFS=y
+# CONFIG_LIB80211 is not set
+CONFIG_MAC80211=y
+# CONFIG_MAC80211_RC_PID is not set
+CONFIG_MAC80211_RC_MINSTREL=y
+# CONFIG_MAC80211_RC_DEFAULT_PID is not set
+CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
+CONFIG_MAC80211_RC_DEFAULT="minstrel"
+# CONFIG_MAC80211_MESH is not set
+# CONFIG_MAC80211_LEDS is not set
+# CONFIG_MAC80211_DEBUGFS is not set
+# CONFIG_MAC80211_DEBUG_MENU is not set
+# CONFIG_WIMAX is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_DEVTMPFS is not set
+# CONFIG_STANDALONE is not set
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+CONFIG_FW_LOADER=y
+# CONFIG_FIRMWARE_IN_KERNEL is not set
+CONFIG_EXTRA_FIRMWARE=""
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+CONFIG_OF_DEVICE=y
+CONFIG_OF_GPIO=y
+CONFIG_OF_I2C=y
+# CONFIG_PARPORT is not set
+CONFIG_BLK_DEV=y
+# CONFIG_BLK_DEV_FD is not set
+# CONFIG_BLK_DEV_COW_COMMON is not set
+CONFIG_BLK_DEV_LOOP=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=2
+CONFIG_BLK_DEV_RAM_SIZE=4096
+# CONFIG_BLK_DEV_XIP is not set
+# CONFIG_CDROM_PKTCDVD is not set
+# CONFIG_ATA_OVER_ETH is not set
+# CONFIG_BLK_DEV_HD is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_ICS932S401 is not set
+# CONFIG_ENCLOSURE_SERVICES is not set
+# CONFIG_ISL29003 is not set
+# CONFIG_C2PORT is not set
+
+#
+# EEPROM support
+#
+# CONFIG_EEPROM_AT24 is not set
+# CONFIG_EEPROM_LEGACY is not set
+# CONFIG_EEPROM_MAX6875 is not set
+# CONFIG_EEPROM_93CX6 is not set
+CONFIG_HAVE_IDE=y
+# CONFIG_IDE is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
+CONFIG_SCSI_PROC_FS=y
+
+#
+# SCSI support type (disk, tape, CD-ROM)
+#
+CONFIG_BLK_DEV_SD=y
+# CONFIG_CHR_DEV_ST is not set
+# CONFIG_CHR_DEV_OSST is not set
+# CONFIG_BLK_DEV_SR is not set
+# CONFIG_CHR_DEV_SG is not set
+# CONFIG_CHR_DEV_SCH is not set
+CONFIG_SCSI_MULTI_LUN=y
+# CONFIG_SCSI_CONSTANTS is not set
+# CONFIG_SCSI_LOGGING is not set
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
+
+#
+# SCSI Transports
+#
+# CONFIG_SCSI_SPI_ATTRS is not set
+# CONFIG_SCSI_FC_ATTRS is not set
+# CONFIG_SCSI_ISCSI_ATTRS is not set
+# CONFIG_SCSI_SAS_ATTRS is not set
+# CONFIG_SCSI_SAS_LIBSAS is not set
+# CONFIG_SCSI_SRP_ATTRS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_LIBFC is not set
+# CONFIG_LIBFCOE is not set
+# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_DH is not set
+# CONFIG_SCSI_OSD_INITIATOR is not set
+# CONFIG_ATA is not set
+# CONFIG_MD is not set
+# CONFIG_MACINTOSH_DRIVERS is not set
+CONFIG_NETDEVICES=y
+# CONFIG_DUMMY is not set
+# CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
+# CONFIG_EQUALIZER is not set
+# CONFIG_TUN is not set
+# CONFIG_VETH is not set
+# CONFIG_PHYLIB is not set
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+# CONFIG_ETHOC is not set
+# CONFIG_DNET is not set
+# CONFIG_IBM_NEW_EMAC_ZMII is not set
+# CONFIG_IBM_NEW_EMAC_RGMII is not set
+# CONFIG_IBM_NEW_EMAC_TAH is not set
+# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
+# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
+# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
+# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
+# CONFIG_B44 is not set
+# CONFIG_KS8842 is not set
+# CONFIG_KS8851_MLL is not set
+# CONFIG_XILINX_EMACLITE is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
+CONFIG_WLAN=y
+# CONFIG_WLAN_PRE80211 is not set
+CONFIG_WLAN_80211=y
+# CONFIG_LIBERTAS is not set
+# CONFIG_LIBERTAS_THINFIRM is not set
+# CONFIG_MAC80211_HWSIM is not set
+# CONFIG_P54_COMMON is not set
+# CONFIG_ATH_COMMON is not set
+# CONFIG_HOSTAP is not set
+CONFIG_B43=y
+CONFIG_B43_SDIO=y
+CONFIG_B43_PIO=y
+# CONFIG_B43_PHY_LP is not set
+CONFIG_B43_DEBUG=y
+# CONFIG_B43_FORCE_PIO is not set
+# CONFIG_B43LEGACY is not set
+# CONFIG_RT2X00 is not set
+# CONFIG_WL12XX is not set
+# CONFIG_IWM is not set
+
+#
+# Enable WiMAX (Networking options) to see the WiMAX drivers
+#
+# CONFIG_WAN is not set
+# CONFIG_PPP is not set
+# CONFIG_SLIP is not set
+# CONFIG_NETCONSOLE is not set
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
+# CONFIG_ISDN is not set
+# CONFIG_PHONE is not set
+
+#
+# Input device support
+#
+CONFIG_INPUT=y
+CONFIG_INPUT_FF_MEMLESS=m
+# CONFIG_INPUT_POLLDEV is not set
+
+#
+# Userland interfaces
+#
+CONFIG_INPUT_MOUSEDEV=y
+# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
+CONFIG_INPUT_MOUSEDEV_SCREEN_X=640
+CONFIG_INPUT_MOUSEDEV_SCREEN_Y=480
+CONFIG_INPUT_JOYDEV=y
+CONFIG_INPUT_EVDEV=y
+# CONFIG_INPUT_EVBUG is not set
+
+#
+# Input Device Drivers
+#
+CONFIG_INPUT_KEYBOARD=y
+# CONFIG_KEYBOARD_ADP5588 is not set
+# CONFIG_KEYBOARD_ATKBD is not set
+# CONFIG_QT2160 is not set
+# CONFIG_KEYBOARD_LKKBD is not set
+# CONFIG_KEYBOARD_GPIO is not set
+# CONFIG_KEYBOARD_MATRIX is not set
+# CONFIG_KEYBOARD_MAX7359 is not set
+# CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_OPENCORES is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
+# CONFIG_KEYBOARD_SUNKBD is not set
+# CONFIG_KEYBOARD_XTKBD is not set
+CONFIG_INPUT_MOUSE=y
+# CONFIG_MOUSE_PS2 is not set
+# CONFIG_MOUSE_SERIAL is not set
+# CONFIG_MOUSE_VSXXXAA is not set
+# CONFIG_MOUSE_GPIO is not set
+# CONFIG_MOUSE_SYNAPTICS_I2C is not set
+CONFIG_INPUT_JOYSTICK=y
+# CONFIG_JOYSTICK_ANALOG is not set
+# CONFIG_JOYSTICK_A3D is not set
+# CONFIG_JOYSTICK_ADI is not set
+# CONFIG_JOYSTICK_COBRA is not set
+# CONFIG_JOYSTICK_GF2K is not set
+# CONFIG_JOYSTICK_GRIP is not set
+# CONFIG_JOYSTICK_GRIP_MP is not set
+# CONFIG_JOYSTICK_GUILLEMOT is not set
+# CONFIG_JOYSTICK_INTERACT is not set
+# CONFIG_JOYSTICK_SIDEWINDER is not set
+# CONFIG_JOYSTICK_TMDC is not set
+# CONFIG_JOYSTICK_IFORCE is not set
+# CONFIG_JOYSTICK_WARRIOR is not set
+# CONFIG_JOYSTICK_MAGELLAN is not set
+# CONFIG_JOYSTICK_SPACEORB is not set
+# CONFIG_JOYSTICK_SPACEBALL is not set
+# CONFIG_JOYSTICK_STINGER is not set
+# CONFIG_JOYSTICK_TWIDJOY is not set
+# CONFIG_JOYSTICK_ZHENHUA is not set
+# CONFIG_JOYSTICK_JOYDUMP is not set
+# CONFIG_INPUT_TABLET is not set
+# CONFIG_INPUT_TOUCHSCREEN is not set
+CONFIG_INPUT_MISC=y
+CONFIG_INPUT_UINPUT=y
+# CONFIG_INPUT_GPIO_ROTARY_ENCODER is not set
+
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+# CONFIG_SERIO_I8042 is not set
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_LIBPS2 is not set
+# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO_XILINX_XPS_PS2 is not set
+# CONFIG_GAMEPORT is not set
+
+#
+# Character devices
+#
+CONFIG_VT=y
+CONFIG_CONSOLE_TRANSLATIONS=y
+CONFIG_VT_CONSOLE=y
+CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_DEVKMEM is not set
+# CONFIG_SERIAL_NONSTANDARD is not set
+
+#
+# Serial drivers
+#
+# CONFIG_SERIAL_8250 is not set
+
+#
+# Non-8250 serial port support
+#
+# CONFIG_SERIAL_UARTLITE is not set
+CONFIG_UNIX98_PTYS=y
+# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=64
+# CONFIG_HVC_UDBG is not set
+# CONFIG_IPMI_HANDLER is not set
+# CONFIG_HW_RANDOM is not set
+CONFIG_NVRAM=y
+# CONFIG_R3964 is not set
+# CONFIG_RAW_DRIVER is not set
+# CONFIG_TCG_TPM is not set
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_COMPAT=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_HELPER_AUTO=y
+CONFIG_I2C_ALGOBIT=y
+
+#
+# I2C Hardware Bus support
+#
+
+#
+# I2C system bus drivers (mostly embedded / system-on-chip)
+#
+CONFIG_I2C_GPIO=y
+# CONFIG_I2C_MPC is not set
+# CONFIG_I2C_OCORES is not set
+# CONFIG_I2C_SIMTEC is not set
+
+#
+# External I2C/SMBus adapter drivers
+#
+# CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_TAOS_EVM is not set
+
+#
+# Other I2C/SMBus bus drivers
+#
+# CONFIG_I2C_PCA_PLATFORM is not set
+# CONFIG_I2C_STUB is not set
+
+#
+# Miscellaneous I2C Chip support
+#
+# CONFIG_DS1682 is not set
+# CONFIG_SENSORS_TSL2550 is not set
+# CONFIG_I2C_DEBUG_CORE is not set
+# CONFIG_I2C_DEBUG_ALGO is not set
+# CONFIG_I2C_DEBUG_BUS is not set
+# CONFIG_I2C_DEBUG_CHIP is not set
+# CONFIG_SPI is not set
+
+#
+# PPS support
+#
+# CONFIG_PPS is not set
+CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
+CONFIG_GPIOLIB=y
+# CONFIG_DEBUG_GPIO is not set
+CONFIG_GPIO_SYSFS=y
+
+#
+# Memory mapped GPIO expanders:
+#
+# CONFIG_GPIO_XILINX is not set
+
+#
+# I2C GPIO expanders:
+#
+# CONFIG_GPIO_MAX732X is not set
+# CONFIG_GPIO_PCA953X is not set
+# CONFIG_GPIO_PCF857X is not set
+
+#
+# PCI GPIO expanders:
+#
+
+#
+# SPI GPIO expanders:
+#
+
+#
+# AC97 GPIO expanders:
+#
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
+# CONFIG_THERMAL is not set
+# CONFIG_WATCHDOG is not set
+CONFIG_SSB_POSSIBLE=y
+
+#
+# Sonics Silicon Backplane
+#
+CONFIG_SSB=y
+CONFIG_SSB_BLOCKIO=y
+CONFIG_SSB_SDIOHOST_POSSIBLE=y
+CONFIG_SSB_SDIOHOST=y
+# CONFIG_SSB_SILENT is not set
+CONFIG_SSB_DEBUG=y
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_CORE is not set
+# CONFIG_MFD_SM501 is not set
+# CONFIG_HTC_PASIC3 is not set
+# CONFIG_TPS65010 is not set
+# CONFIG_TWL4030_CORE is not set
+# CONFIG_MFD_TMIO is not set
+# CONFIG_PMIC_DA903X is not set
+# CONFIG_MFD_WM8400 is not set
+# CONFIG_MFD_WM831X is not set
+# CONFIG_MFD_WM8350_I2C is not set
+# CONFIG_MFD_PCF50633 is not set
+# CONFIG_AB3100_CORE is not set
+# CONFIG_REGULATOR is not set
+# CONFIG_MEDIA_SUPPORT is not set
+
+#
+# Graphics support
+#
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+# CONFIG_FB_BOOT_VESA_SUPPORT is not set
+# CONFIG_FB_CFB_FILLRECT is not set
+# CONFIG_FB_CFB_COPYAREA is not set
+# CONFIG_FB_CFB_IMAGEBLIT is not set
+# CONFIG_FB_CFB_REV_PIXELS_IN_BYTE is not set
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_FOREIGN_ENDIAN is not set
+# CONFIG_FB_SYS_FOPS is not set
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
+# CONFIG_FB_MODE_HELPERS is not set
+# CONFIG_FB_TILEBLITTING is not set
+
+#
+# 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_FB_METRONOME is not set
+# CONFIG_FB_MB862XX is not set
+# CONFIG_FB_BROADSHEET is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+
+#
+# Display device support
+#
+# CONFIG_DISPLAY_SUPPORT is not set
+
+#
+# Console display driver support
+#
+# CONFIG_VGA_CONSOLE is not set
+CONFIG_DUMMY_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
+# CONFIG_FONTS is not set
+CONFIG_FONT_8x8=y
+CONFIG_FONT_8x16=y
+# CONFIG_LOGO is not set
+CONFIG_SOUND=y
+CONFIG_SOUND_OSS_CORE=y
+CONFIG_SOUND_OSS_CORE_PRECLAIM=y
+CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
+CONFIG_SND_SEQUENCER=y
+# CONFIG_SND_SEQ_DUMMY is not set
+CONFIG_SND_OSSEMUL=y
+CONFIG_SND_MIXER_OSS=y
+CONFIG_SND_PCM_OSS=y
+CONFIG_SND_PCM_OSS_PLUGINS=y
+CONFIG_SND_SEQUENCER_OSS=y
+# CONFIG_SND_DYNAMIC_MINORS is not set
+CONFIG_SND_SUPPORT_OLD_API=y
+# CONFIG_SND_VERBOSE_PROCFS is not set
+# CONFIG_SND_VERBOSE_PRINTK is not set
+# CONFIG_SND_DEBUG is not set
+# CONFIG_SND_RAWMIDI_SEQ is not set
+# CONFIG_SND_OPL3_LIB_SEQ is not set
+# CONFIG_SND_OPL4_LIB_SEQ is not set
+# CONFIG_SND_SBAWE_SEQ is not set
+# CONFIG_SND_EMU10K1_SEQ is not set
+CONFIG_SND_DRIVERS=y
+# CONFIG_SND_DUMMY is not set
+# CONFIG_SND_VIRMIDI is not set
+# CONFIG_SND_MTPAV is not set
+# CONFIG_SND_SERIAL_U16550 is not set
+# CONFIG_SND_MPU401 is not set
+CONFIG_SND_PPC=y
+# CONFIG_SND_SOC is not set
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HIDRAW is not set
+# CONFIG_HID_PID is not set
+
+#
+# Special HID drivers
+#
+CONFIG_HID_APPLE=m
+CONFIG_HID_WACOM=m
+CONFIG_USB_SUPPORT=y
+# CONFIG_USB_ARCH_HAS_HCD is not set
+# CONFIG_USB_ARCH_HAS_OHCI is not set
+# CONFIG_USB_ARCH_HAS_EHCI is not set
+# CONFIG_USB_OTG_WHITELIST is not set
+# CONFIG_USB_OTG_BLACKLIST_HUB is not set
+
+#
+# Enable Host or Gadget support to see Inventra options
+#
+
+#
+# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
+#
+# CONFIG_USB_GADGET is not set
+
+#
+# OTG and related infrastructure
+#
+CONFIG_MMC=y
+# CONFIG_MMC_DEBUG is not set
+# CONFIG_MMC_UNSAFE_RESUME is not set
+
+#
+# MMC/SD/SDIO Card Drivers
+#
+CONFIG_MMC_BLOCK=y
+CONFIG_MMC_BLOCK_BOUNCE=y
+# CONFIG_SDIO_UART is not set
+# CONFIG_MMC_TEST is not set
+
+#
+# MMC/SD/SDIO Host Controller Drivers
+#
+CONFIG_MMC_SDHCI=y
+# CONFIG_MMC_SDHCI_OF is not set
+# CONFIG_MMC_SDHCI_PLTFM is not set
+# CONFIG_MMC_WBSD is not set
+# CONFIG_MMC_AT91 is not set
+# CONFIG_MMC_ATMELMCI is not set
+# CONFIG_MEMSTICK is not set
+# CONFIG_NEW_LEDS is not set
+# CONFIG_ACCESSIBILITY is not set
+# CONFIG_EDAC is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
+
+#
+# RTC interfaces
+#
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
+
+#
+# I2C RTC drivers
+#
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1374 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+# CONFIG_RTC_DRV_PCF8583 is not set
+# CONFIG_RTC_DRV_M41T80 is not set
+# CONFIG_RTC_DRV_S35390A is not set
+# CONFIG_RTC_DRV_FM3130 is not set
+# CONFIG_RTC_DRV_RX8581 is not set
+# CONFIG_RTC_DRV_RX8025 is not set
+
+#
+# SPI RTC drivers
+#
+
+#
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1286 is not set
+# CONFIG_RTC_DRV_DS1511 is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T35 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_BQ4802 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+CONFIG_RTC_DRV_GENERIC=y
+# CONFIG_DMADEVICES is not set
+# CONFIG_AUXDISPLAY is not set
+# CONFIG_UIO is not set
+
+#
+# TI VLYNQ
+#
+# CONFIG_STAGING is not set
+
+#
+# File systems
+#
+CONFIG_EXT2_FS=y
+# CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
+CONFIG_EXT3_FS=y
+# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
+# CONFIG_EXT3_FS_XATTR is not set
+# CONFIG_EXT4_FS is not set
+CONFIG_JBD=y
+# CONFIG_JBD_DEBUG is not set
+# CONFIG_REISERFS_FS is not set
+# CONFIG_JFS_FS is not set
+# CONFIG_FS_POSIX_ACL is not set
+# CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
+# CONFIG_OCFS2_FS is not set
+# CONFIG_BTRFS_FS is not set
+# CONFIG_NILFS2_FS is not set
+CONFIG_FILE_LOCKING=y
+CONFIG_FSNOTIFY=y
+CONFIG_DNOTIFY=y
+CONFIG_INOTIFY=y
+CONFIG_INOTIFY_USER=y
+# CONFIG_QUOTA is not set
+# CONFIG_AUTOFS_FS is not set
+# CONFIG_AUTOFS4_FS is not set
+CONFIG_FUSE_FS=m
+# CONFIG_CUSE is not set
+
+#
+# Caches
+#
+# CONFIG_FSCACHE is not set
+
+#
+# CD-ROM/DVD Filesystems
+#
+CONFIG_ISO9660_FS=y
+CONFIG_JOLIET=y
+# CONFIG_ZISOFS is not set
+# CONFIG_UDF_FS is not set
+
+#
+# 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
+
+#
+# Pseudo filesystems
+#
+CONFIG_PROC_FS=y
+CONFIG_PROC_KCORE=y
+CONFIG_PROC_SYSCTL=y
+# CONFIG_PROC_PAGE_MONITOR is not set
+CONFIG_SYSFS=y
+CONFIG_TMPFS=y
+# CONFIG_TMPFS_POSIX_ACL is not set
+# CONFIG_HUGETLB_PAGE is not set
+# CONFIG_CONFIGFS_FS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_CRAMFS is not set
+# CONFIG_SQUASHFS is not set
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+CONFIG_NETWORK_FILESYSTEMS=y
+CONFIG_NFS_FS=y
+CONFIG_NFS_V3=y
+# CONFIG_NFS_V3_ACL is not set
+# CONFIG_NFS_V4 is not set
+CONFIG_ROOT_NFS=y
+# CONFIG_NFSD is not set
+CONFIG_LOCKD=y
+CONFIG_LOCKD_V4=y
+CONFIG_NFS_COMMON=y
+CONFIG_SUNRPC=y
+# CONFIG_RPCSEC_GSS_KRB5 is not set
+# CONFIG_RPCSEC_GSS_SPKM3 is not set
+# CONFIG_SMB_FS is not set
+CONFIG_CIFS=m
+# CONFIG_CIFS_STATS is not set
+# CONFIG_CIFS_WEAK_PW_HASH is not set
+# CONFIG_CIFS_XATTR is not set
+# CONFIG_CIFS_DEBUG2 is not set
+# CONFIG_CIFS_EXPERIMENTAL is not set
+# CONFIG_NCP_FS is not set
+# CONFIG_CODA_FS is not set
+# CONFIG_AFS_FS is not set
+
+#
+# Partition Types
+#
+# CONFIG_PARTITION_ADVANCED is not set
+CONFIG_MSDOS_PARTITION=y
+CONFIG_NLS=y
+CONFIG_NLS_DEFAULT="iso8859-1"
+CONFIG_NLS_CODEPAGE_437=y
+# CONFIG_NLS_CODEPAGE_737 is not set
+# CONFIG_NLS_CODEPAGE_775 is not set
+# CONFIG_NLS_CODEPAGE_850 is not set
+# CONFIG_NLS_CODEPAGE_852 is not set
+# CONFIG_NLS_CODEPAGE_855 is not set
+# CONFIG_NLS_CODEPAGE_857 is not set
+# CONFIG_NLS_CODEPAGE_860 is not set
+# CONFIG_NLS_CODEPAGE_861 is not set
+# CONFIG_NLS_CODEPAGE_862 is not set
+# CONFIG_NLS_CODEPAGE_863 is not set
+# CONFIG_NLS_CODEPAGE_864 is not set
+# CONFIG_NLS_CODEPAGE_865 is not set
+# CONFIG_NLS_CODEPAGE_866 is not set
+# CONFIG_NLS_CODEPAGE_869 is not set
+# CONFIG_NLS_CODEPAGE_936 is not set
+# CONFIG_NLS_CODEPAGE_950 is not set
+# CONFIG_NLS_CODEPAGE_932 is not set
+# CONFIG_NLS_CODEPAGE_949 is not set
+# CONFIG_NLS_CODEPAGE_874 is not set
+# CONFIG_NLS_ISO8859_8 is not set
+# CONFIG_NLS_CODEPAGE_1250 is not set
+# CONFIG_NLS_CODEPAGE_1251 is not set
+# CONFIG_NLS_ASCII is not set
+CONFIG_NLS_ISO8859_1=y
+# CONFIG_NLS_ISO8859_2 is not set
+# CONFIG_NLS_ISO8859_3 is not set
+# CONFIG_NLS_ISO8859_4 is not set
+# CONFIG_NLS_ISO8859_5 is not set
+# CONFIG_NLS_ISO8859_6 is not set
+# CONFIG_NLS_ISO8859_7 is not set
+# CONFIG_NLS_ISO8859_9 is not set
+# CONFIG_NLS_ISO8859_13 is not set
+# CONFIG_NLS_ISO8859_14 is not set
+# CONFIG_NLS_ISO8859_15 is not set
+# CONFIG_NLS_KOI8_R is not set
+# CONFIG_NLS_KOI8_U is not set
+# CONFIG_NLS_UTF8 is not set
+# CONFIG_DLM is not set
+CONFIG_BINARY_PRINTF=y
+
+#
+# Library routines
+#
+CONFIG_BITREVERSE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+CONFIG_CRC_CCITT=y
+CONFIG_CRC16=y
+# CONFIG_CRC_T10DIF is not set
+# CONFIG_CRC_ITU_T is not set
+CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
+# CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
+CONFIG_DECOMPRESS_GZIP=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
+CONFIG_HAVE_LMB=y
+CONFIG_NLATTR=y
+CONFIG_GENERIC_ATOMIC64=y
+
+#
+# Kernel hacking
+#
+CONFIG_PRINTK_TIME=y
+CONFIG_ENABLE_WARN_DEPRECATED=y
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_FRAME_WARN=1024
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_STRIP_ASM_SYMS is not set
+# CONFIG_UNUSED_SYMBOLS is not set
+CONFIG_DEBUG_FS=y
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
+CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
+# CONFIG_DETECT_HUNG_TASK is not set
+CONFIG_SCHED_DEBUG=y
+CONFIG_SCHEDSTATS=y
+# CONFIG_TIMER_STATS is not set
+# CONFIG_DEBUG_OBJECTS is not set
+# CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_KMEMLEAK is not set
+CONFIG_DEBUG_PREEMPT=y
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
+CONFIG_DEBUG_SPINLOCK=y
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+CONFIG_DEBUG_SPINLOCK_SLEEP=y
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
+CONFIG_STACKTRACE=y
+# CONFIG_DEBUG_KOBJECT is not set
+CONFIG_DEBUG_BUGVERBOSE=y
+# CONFIG_DEBUG_INFO is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_WRITECOUNT is not set
+# CONFIG_DEBUG_MEMORY_INIT is not set
+# CONFIG_DEBUG_LIST is not set
+# CONFIG_DEBUG_SG is not set
+# CONFIG_DEBUG_NOTIFIERS is not set
+# CONFIG_DEBUG_CREDENTIALS is not set
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+# CONFIG_BACKTRACE_SELF_TEST is not set
+# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
+# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
+# CONFIG_FAULT_INJECTION is not set
+CONFIG_LATENCYTOP=y
+CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_DEBUG_PAGEALLOC is not set
+CONFIG_NOP_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_TRACER_MAX_TRACE=y
+CONFIG_RING_BUFFER=y
+CONFIG_EVENT_TRACING=y
+CONFIG_CONTEXT_SWITCH_TRACER=y
+CONFIG_TRACING=y
+CONFIG_GENERIC_TRACER=y
+CONFIG_TRACING_SUPPORT=y
+CONFIG_FTRACE=y
+# CONFIG_FUNCTION_TRACER is not set
+# CONFIG_IRQSOFF_TRACER is not set
+# CONFIG_PREEMPT_TRACER is not set
+CONFIG_SCHED_TRACER=y
+CONFIG_BOOT_TRACER=y
+CONFIG_BRANCH_PROFILE_NONE=y
+# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
+# CONFIG_PROFILE_ALL_BRANCHES is not set
+# CONFIG_STACK_TRACER is not set
+# CONFIG_KMEMTRACE is not set
+# CONFIG_WORKQUEUE_TRACER is not set
+CONFIG_BLK_DEV_IO_TRACE=y
+# CONFIG_FTRACE_STARTUP_TEST is not set
+# CONFIG_RING_BUFFER_BENCHMARK is not set
+# CONFIG_DYNAMIC_DEBUG is not set
+CONFIG_DMA_API_DEBUG=y
+# CONFIG_SAMPLES is not set
+CONFIG_HAVE_ARCH_KGDB=y
+# CONFIG_KGDB is not set
+# CONFIG_PPC_DISABLE_WERROR is not set
+CONFIG_PPC_WERROR=y
+CONFIG_PRINT_STACK_DEPTH=64
+# CONFIG_DEBUG_STACKOVERFLOW is not set
+# CONFIG_DEBUG_STACK_USAGE is not set
+# CONFIG_PPC_EMULATED_STATS is not set
+# CONFIG_CODE_PATCHING_SELFTEST is not set
+# CONFIG_FTR_FIXUP_SELFTEST is not set
+# CONFIG_MSI_BITMAP_SELFTEST is not set
+# CONFIG_XMON is not set
+# CONFIG_IRQSTACKS is not set
+# CONFIG_VIRQ_DEBUG is not set
+# CONFIG_BDI_SWITCH is not set
+# CONFIG_BOOTX_TEXT is not set
+CONFIG_PPC_EARLY_DEBUG=y
+# CONFIG_PPC_EARLY_DEBUG_LPAR is not set
+# CONFIG_PPC_EARLY_DEBUG_G5 is not set
+# CONFIG_PPC_EARLY_DEBUG_RTAS_PANEL is not set
+# CONFIG_PPC_EARLY_DEBUG_RTAS_CONSOLE is not set
+# CONFIG_PPC_EARLY_DEBUG_MAPLE is not set
+# CONFIG_PPC_EARLY_DEBUG_ISERIES is not set
+# CONFIG_PPC_EARLY_DEBUG_PAS_REALMODE is not set
+# CONFIG_PPC_EARLY_DEBUG_BEAT is not set
+# CONFIG_PPC_EARLY_DEBUG_44x is not set
+# CONFIG_PPC_EARLY_DEBUG_40x is not set
+# CONFIG_PPC_EARLY_DEBUG_CPM is not set
+CONFIG_PPC_EARLY_DEBUG_USBGECKO=y
+
+#
+# Security options
+#
+# CONFIG_KEYS is not set
+# CONFIG_SECURITY is not set
+# CONFIG_SECURITYFS is not set
+# CONFIG_SECURITY_FILE_CAPABILITIES is not set
+CONFIG_CRYPTO=y
+
+#
+# Crypto core or helper
+#
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_PCOMP=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+# CONFIG_CRYPTO_GF128MUL is not set
+# CONFIG_CRYPTO_NULL is not set
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_CRYPTO_CRYPTD is not set
+# CONFIG_CRYPTO_AUTHENC is not set
+# CONFIG_CRYPTO_TEST is not set
+
+#
+# Authenticated Encryption with Associated Data
+#
+# CONFIG_CRYPTO_CCM is not set
+# CONFIG_CRYPTO_GCM is not set
+# CONFIG_CRYPTO_SEQIV is not set
+
+#
+# Block modes
+#
+# CONFIG_CRYPTO_CBC is not set
+# CONFIG_CRYPTO_CTR is not set
+# CONFIG_CRYPTO_CTS is not set
+CONFIG_CRYPTO_ECB=y
+# CONFIG_CRYPTO_LRW is not set
+# CONFIG_CRYPTO_PCBC is not set
+# CONFIG_CRYPTO_XTS is not set
+
+#
+# Hash modes
+#
+# CONFIG_CRYPTO_HMAC is not set
+# CONFIG_CRYPTO_XCBC is not set
+# CONFIG_CRYPTO_VMAC is not set
+
+#
+# Digest
+#
+# CONFIG_CRYPTO_CRC32C is not set
+# CONFIG_CRYPTO_GHASH is not set
+# CONFIG_CRYPTO_MD4 is not set
+# CONFIG_CRYPTO_MD5 is not set
+# CONFIG_CRYPTO_MICHAEL_MIC is not set
+# CONFIG_CRYPTO_RMD128 is not set
+# CONFIG_CRYPTO_RMD160 is not set
+# CONFIG_CRYPTO_RMD256 is not set
+# CONFIG_CRYPTO_RMD320 is not set
+# CONFIG_CRYPTO_SHA1 is not set
+# CONFIG_CRYPTO_SHA256 is not set
+# CONFIG_CRYPTO_SHA512 is not set
+# CONFIG_CRYPTO_TGR192 is not set
+# CONFIG_CRYPTO_WP512 is not set
+
+#
+# Ciphers
+#
+CONFIG_CRYPTO_AES=y
+# CONFIG_CRYPTO_ANUBIS is not set
+CONFIG_CRYPTO_ARC4=y
+# CONFIG_CRYPTO_BLOWFISH is not set
+# CONFIG_CRYPTO_CAMELLIA is not set
+# CONFIG_CRYPTO_CAST5 is not set
+# CONFIG_CRYPTO_CAST6 is not set
+# CONFIG_CRYPTO_DES is not set
+# CONFIG_CRYPTO_FCRYPT is not set
+# CONFIG_CRYPTO_KHAZAD is not set
+# CONFIG_CRYPTO_SALSA20 is not set
+# CONFIG_CRYPTO_SEED is not set
+# CONFIG_CRYPTO_SERPENT is not set
+# CONFIG_CRYPTO_TEA is not set
+# CONFIG_CRYPTO_TWOFISH is not set
+
+#
+# Compression
+#
+# CONFIG_CRYPTO_DEFLATE is not set
+# CONFIG_CRYPTO_ZLIB is not set
+# CONFIG_CRYPTO_LZO is not set
+
+#
+# Random Number Generation
+#
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
+# CONFIG_CRYPTO_HW is not set
+# CONFIG_PPC_CLOCK is not set
+# CONFIG_VIRTUALIZATION is not set
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms
  2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
  2009-11-22 22:01               ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Albert Herranz
@ 2009-11-22 22:20               ` Arnd Bergmann
  2009-11-23 19:06                 ` Albert Herranz
  2009-11-26  5:09               ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 181+ messages in thread
From: Arnd Bergmann @ 2009-11-22 22:20 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

On Sunday 22 November 2009, Albert Herranz wrote:
>  config NOT_COHERENT_CACHE
>         bool
> -       depends on 4xx || 8xx || E200 || PPC_MPC512x
> +       depends on 4xx || 8xx || E200 || PPC_MPC512x || GAMECUBE_COMMON
>         default y
>  
>  config CHECK_CACHE_COHERENCY
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
> index 97a2dbc..31487e4 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -93,4 +93,5 @@ config MPC10X_STORE_GATHERING
>  
>  config GAMECUBE_COMMON
>         bool
> +       select NOT_COHERENT_CACHE

One of the two (depends and select) is enough. I'd just drop the 'select'
line here.

	Arnd <><

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
@ 2009-11-22 22:27                     ` Arnd Bergmann
  2009-11-23 19:10                       ` Albert Herranz
  2009-11-26  5:14                       ` Benjamin Herrenschmidt
  2009-11-24  0:54                     ` Segher Boessenkool
  2 siblings, 2 replies; 181+ messages in thread
From: Arnd Bergmann @ 2009-11-22 22:27 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

On Sunday 22 November 2009, Albert Herranz wrote:
> +#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
> +setup_usbgecko_bat:
> +	/* prepare a BAT for early io */
> +	lis	r8, 0x0c00
> +	ori	r8, r8, 0x002a	/* uncached, guarded ,rw */
> +	lis	r11, 0xcc00
> +	ori	r11, r11, 0x3	/* 128K */
> +#ifdef CONFIG_WII
> +	oris	r8, r8, 0x0100
> +	oris	r11, r11, 0x0100
> +#endif
> +	mtspr	SPRN_DBAT1L, r8
> +	mtspr	SPRN_DBAT1U, r11
> +	sync
> +	isync
> +	blr
> +#endif

This will probably break other platforms if CONFIG_PPC_EARLY_DEBUG_USBGECKO
is set. In general, we try hard to make it possible to build generic
kernels for multiple systems, so it would be better to also add a runtime
check here.

> --- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> @@ -27,4 +27,10 @@ static inline void __init ug_udbg_init(void)
>  
>  #endif /* CONFIG_USBGECKO_UDBG */
>  
> +#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
> +
> +void __init udbg_init_usbgecko(void);
> +
> +#endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */
> +

No need to enclose a declaration in #ifdef, better leave it there
unconditionally, unless you have an alternative version, like

#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
void __init udbg_init_usbgecko(void);
#else /* !CONFIG_PPC_EARLY_DEBUG_USBGECKO */
static inline void udbg_init_usbgecko(void)
{
}
#endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */

That style is now more common than having additional #ifdefs
in the code using the function.

	Arnd <><

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support
  2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
  2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
@ 2009-11-22 22:48                                   ` Arnd Bergmann
  2009-11-23 19:21                                     ` Albert Herranz
  2009-11-24 22:13                                   ` Segher Boessenkool
  2 siblings, 1 reply; 181+ messages in thread
From: Arnd Bergmann @ 2009-11-22 22:48 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

On Sunday 22 November 2009, Albert Herranz wrote:
> + *
> + */
> +struct mipc_device {
> +	void __iomem *io_base;
> +	int irq;
> +
> +	struct device *dev;
> +
> +	spinlock_t call_lock;	/* serialize firmware calls */
> +	spinlock_t io_lock;	/* serialize access to io registers */
> +
> +	struct mipc_infohdr *hdr;
> +
> +	struct mipc_req *in_ring;
> +	size_t in_ring_size;
> +	volatile u16 intail_idx;
> +
> +	struct mipc_req *out_ring;
> +	size_t out_ring_size;
> +	volatile u16 outhead_idx;
> +
> +	u32 tag;
> +};

The 'volatile' here seems out of place. What are you trying to protect
against?

The rest of the patch seems to be made up of layers of wrappers. They
are all well coded, but I got a feeling that the same could be achieved
with less of it.

	Arnd <>< 

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support
  2009-11-22 22:01 [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Albert Herranz
  2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
@ 2009-11-22 22:48 ` Grant Likely
  2009-11-22 22:49 ` Arnd Bergmann
  2009-11-23  5:13 ` Wolfram Sang
  3 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 22:48 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> The following patches add the base support for the Nintendo GameCube
> and Wii video game consoles on the powerpc arch.

w00t!

Per-patch review to follow, but this is great.  Thanks!

g.

>
> For each video game console, the following is included:
> - a device tree source
> - bootwrapper support
> - udbg console option
> - early udbg console option
> - interrupt controller support
> - platform support
>
> The Nintendo Wii patches also include support for:
> - recognition of the broadway processor
> - ipc communication with the open source 'mini' firmware replacement
>
> With these patches both video game consoles can fully boot up to the
> root filesystem mount phase.
>
> Albert Herranz (19):
> =A0powerpc: gamecube/wii: usbgecko bootwrapper console support
> =A0powerpc: gamecube: device tree
> =A0powerpc: gamecube: bootwrapper bits
> =A0powerpc: wii: device tree
> =A0powerpc: wii: bootwrapper bits
> =A0powerpc: gamecube/wii: introduce GAMECUBE_COMMON
> =A0powerpc: gamecube/wii: declare as non-coherent platforms
> =A0powerpc: gamecube/wii: do not include PCI support
> =A0powerpc: gamecube/wii: udbg support for usbgecko
> =A0powerpc: gamecube/wii: early debugging using usbgecko
> =A0powerpc: gamecube/wii: flipper interrupt controller support
> =A0powerpc: gamecube: platform support
> =A0powerpc: gamecube: default config
> =A0powerpc: allow ioremap within reserved fake ram regions
> =A0powerpc: broadway processor support
> =A0powerpc: wii: hollywood interrupt controller support
> =A0powerpc: wii: bootmii starlet 'mini' firmware support
> =A0powerpc: wii: platform support
> =A0powerpc: wii: default config
>
> =A0arch/powerpc/Kconfig =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 | =A0 =A02 +-
> =A0arch/powerpc/Kconfig.debug =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 | =A0 =A08 +
> =A0arch/powerpc/boot/Makefile =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 | =A0 =A07 +-
> =A0arch/powerpc/boot/dts/gamecube.dts =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =
=A0135 ++
> =A0arch/powerpc/boot/dts/wii.dts =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0| =A0244 ++++
> =A0arch/powerpc/boot/gamecube.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 | =A0 78 ++
> =A0arch/powerpc/boot/ugecon.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 | =A0128 ++
> =A0arch/powerpc/boot/ugecon.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 | =A0 25 +
> =A0arch/powerpc/boot/wii.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0| =A0173 +++
> =A0arch/powerpc/boot/wrapper =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0| =A0 =A03 +
> =A0arch/powerpc/configs/gamecube_defconfig =A0 =A0 =A0 =A0 =A0 =A0| 1061 =
+++++++++++++++
> =A0arch/powerpc/configs/wii_defconfig =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | 1=
406 ++++++++++++++++++++
> =A0arch/powerpc/include/asm/starlet-mini.h =A0 =A0 =A0 =A0 =A0 =A0| =A017=
5 +++
> =A0arch/powerpc/include/asm/starlet.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 | =
=A0 26 +
> =A0arch/powerpc/include/asm/udbg.h =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0| =A0 =A01 +
> =A0arch/powerpc/kernel/cputable.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 | =A0 28 +-
> =A0arch/powerpc/kernel/head_32.S =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0| =A0 21 +
> =A0arch/powerpc/kernel/udbg.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 | =A0 =A02 +
> =A0arch/powerpc/mm/pgtable_32.c =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 | =A0 19 +-
> =A0arch/powerpc/platforms/Kconfig.cputype =A0 =A0 =A0 =A0 =A0 =A0 | =A0 =
=A02 +-
> =A0arch/powerpc/platforms/embedded6xx/Kconfig =A0 =A0 =A0 =A0 | =A0 57 +
> =A0arch/powerpc/platforms/embedded6xx/Makefile =A0 =A0 =A0 =A0| =A0 =A06 =
+
> =A0arch/powerpc/platforms/embedded6xx/flipper-pic.c =A0 | =A0247 ++++
> =A0arch/powerpc/platforms/embedded6xx/flipper-pic.h =A0 | =A0 25 +
> =A0arch/powerpc/platforms/embedded6xx/gamecube.c =A0 =A0 =A0| =A0112 ++
> =A0arch/powerpc/platforms/embedded6xx/gamecube_dev.c =A0| =A0 34 +
> =A0arch/powerpc/platforms/embedded6xx/hlwd-pic.c =A0 =A0 =A0| =A0238 ++++
> =A0arch/powerpc/platforms/embedded6xx/hlwd-pic.h =A0 =A0 =A0| =A0 22 +
> =A0arch/powerpc/platforms/embedded6xx/starlet-mipc.c =A0| 1053 ++++++++++=
+++++
> =A0arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c | =A0318 +++++
> =A0arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h | =A0 36 +
> =A0arch/powerpc/platforms/embedded6xx/wii.c =A0 =A0 =A0 =A0 =A0 | =A0270 =
++++
> =A0arch/powerpc/platforms/embedded6xx/wii_dev.c =A0 =A0 =A0 | =A0 47 +
> =A033 files changed, 5988 insertions(+), 21 deletions(-)
> =A0create mode 100644 arch/powerpc/boot/dts/gamecube.dts
> =A0create mode 100644 arch/powerpc/boot/dts/wii.dts
> =A0create mode 100644 arch/powerpc/boot/gamecube.c
> =A0create mode 100644 arch/powerpc/boot/ugecon.c
> =A0create mode 100644 arch/powerpc/boot/ugecon.h
> =A0create mode 100644 arch/powerpc/boot/wii.c
> =A0create mode 100644 arch/powerpc/configs/gamecube_defconfig
> =A0create mode 100644 arch/powerpc/configs/wii_defconfig
> =A0create mode 100644 arch/powerpc/include/asm/starlet-mini.h
> =A0create mode 100644 arch/powerpc/include/asm/starlet.h
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.h
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/gamecube.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/gamecube_dev.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.h
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/starlet-mipc.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/wii.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/wii_dev.c
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support
  2009-11-22 22:01 [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Albert Herranz
  2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
  2009-11-22 22:48 ` [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Grant Likely
@ 2009-11-22 22:49 ` Arnd Bergmann
  2009-11-23 19:22   ` Albert Herranz
  2009-11-23  5:13 ` Wolfram Sang
  3 siblings, 1 reply; 181+ messages in thread
From: Arnd Bergmann @ 2009-11-22 22:49 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

On Sunday 22 November 2009, Albert Herranz wrote:
> The following patches add the base support for the Nintendo GameCube
> and Wii video game consoles on the powerpc arch.
> 
> For each video game console, the following is included:
> - a device tree source
> - bootwrapper support
> - udbg console option
> - early udbg console option
> - interrupt controller support
> - platform support
> 
> The Nintendo Wii patches also include support for:
> - recognition of the broadway processor
> - ipc communication with the open source 'mini' firmware replacement
> 
> With these patches both video game consoles can fully boot up to the
> root filesystem mount phase.

Very nice series, well done!

Time for me to invest in some new hardware ;-)

	Arnd <><

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support
  2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
  2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
@ 2009-11-22 22:50   ` Grant Likely
  2009-11-26  4:12   ` Benjamin Herrenschmidt
  2 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 22:50 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add support for using the USB Gecko adapter as a bootwrapper console on
> the Nintendo GameCube and Wii video game consoles.
> The USB Gecko is a 3rd party memory card interface adapter that provides
> a EXI (External Interface) to USB serial converter.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/boot/Makefile | =A0 =A02 +-
> =A0arch/powerpc/boot/ugecon.c | =A0128 ++++++++++++++++++++++++++++++++++=
++++++++++
> =A0arch/powerpc/boot/ugecon.h | =A0 25 +++++++++
> =A03 files changed, 154 insertions(+), 1 deletions(-)
> =A0create mode 100644 arch/powerpc/boot/ugecon.c
> =A0create mode 100644 arch/powerpc/boot/ugecon.h
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 7bfc8ad..44bce21 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -66,7 +66,7 @@ src-wlib :=3D string.S crt0.S crtsavres.S stdio.c main.=
c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0gunzip_util.c elf_util.c $(zlib) devtree.c=
 oflib.c ofconsole.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A04xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c=
.c cuboot.c bamboo.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cpm-serial.c stdlib.c mpc52xx-psc.c planet=
core.c uartlite.c \
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 fsl-soc.c mpc8xx.c pq2.c
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 fsl-soc.c mpc8xx.c pq2.c ugecon.c
> =A0src-plat :=3D of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85=
xx.c holly.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cuboot-ebony.c cuboot-hotfoot.c treeboot-e=
bony.c prpmc2800.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0ps3-head.S ps3-hvcall.S ps3.c treeboot-bam=
boo.c cuboot-8xx.c \
> diff --git a/arch/powerpc/boot/ugecon.c b/arch/powerpc/boot/ugecon.c
> new file mode 100644
> index 0000000..704f374
> --- /dev/null
> +++ b/arch/powerpc/boot/ugecon.c
> @@ -0,0 +1,128 @@
> +/*
> + * arch/powerpc/boot/ugecon.c
> + *
> + * USB Gecko bootwrapper console.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 <stddef.h>
> +#include "stdio.h"
> +#include "types.h"
> +#include "io.h"
> +#include "ops.h"
> +
> +
> +#define EXI_CLK_32MHZ =A0 =A0 =A0 =A0 =A0 5
> +
> +#define EXI_CSR =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0x00
> +#define =A0 EXI_CSR_CLKMASK =A0 =A0 =A0 (0x7<<4)
> +#define =A0 =A0 EXI_CSR_CLK_32MHZ =A0 (EXI_CLK_32MHZ<<4)
> +#define =A0 EXI_CSR_CSMASK =A0 =A0 =A0 =A0(0x7<<7)
> +#define =A0 =A0 EXI_CSR_CS_0 =A0 =A0 =A0 =A0(0x1<<7) =A0/* Chip Select 0=
01 */
> +
> +#define EXI_CR =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x0c
> +#define =A0 EXI_CR_TSTART =A0 =A0 =A0 =A0 (1<<0)
> +#define =A0 EXI_CR_WRITE =A0 =A0 =A0 =A0 (1<<2)
> +#define =A0 EXI_CR_READ_WRITE =A0 =A0 (2<<2)
> +#define =A0 EXI_CR_TLEN(len) =A0 =A0 =A0(((len)-1)<<4)
> +
> +#define EXI_DATA =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x10
> +
> +
> +/* virtual address base for input/output, retrieved from device tree */
> +static void *ug_io_base;
> +
> +
> +static u32 ug_io_transaction(u32 in)
> +{
> + =A0 =A0 =A0 u32 *csr_reg =3D ug_io_base + EXI_CSR;
> + =A0 =A0 =A0 u32 *data_reg =3D ug_io_base + EXI_DATA;
> + =A0 =A0 =A0 u32 *cr_reg =3D ug_io_base + EXI_CR;
> + =A0 =A0 =A0 u32 csr, data, cr;
> +
> + =A0 =A0 =A0 /* select */
> + =A0 =A0 =A0 csr =3D EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0;
> + =A0 =A0 =A0 out_be32(csr_reg, csr);
> +
> + =A0 =A0 =A0 /* read/write */
> + =A0 =A0 =A0 data =3D in;
> + =A0 =A0 =A0 out_be32(data_reg, data);
> + =A0 =A0 =A0 cr =3D EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART;
> + =A0 =A0 =A0 out_be32(cr_reg, cr);
> +
> + =A0 =A0 =A0 while (in_be32(cr_reg) & EXI_CR_TSTART)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 barrier();
> +
> + =A0 =A0 =A0 /* deselect */
> + =A0 =A0 =A0 out_be32(csr_reg, 0);
> +
> + =A0 =A0 =A0 data =3D in_be32(data_reg);
> + =A0 =A0 =A0 return data;
> +}
> +
> +static int ug_is_txfifo_ready(void)
> +{
> + =A0 =A0 =A0 return ug_io_transaction(0xc0000000) & 0x04000000;
> +}
> +
> +static void ug_raw_putc(char ch)
> +{
> + =A0 =A0 =A0 ug_io_transaction(0xb0000000 | (ch << 20));
> +}
> +
> +static void ug_putc(char ch)
> +{
> + =A0 =A0 =A0 int count =3D 16;
> +
> + =A0 =A0 =A0 if (!ug_io_base)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> +
> + =A0 =A0 =A0 while (!ug_is_txfifo_ready() && count--)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 barrier();
> + =A0 =A0 =A0 if (count)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_raw_putc(ch);
> +}
> +
> +void ug_console_write(const char *buf, int len)
> +{
> + =A0 =A0 =A0 char *b =3D (char *)buf;
> +
> + =A0 =A0 =A0 while (len--) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (*b =3D=3D '\n')
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_putc('\r');
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_putc(*b++);
> + =A0 =A0 =A0 }
> +}
> +
> +int ug_is_adapter_present(void)
> +{
> + =A0 =A0 =A0 if (!ug_io_base)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +
> + =A0 =A0 =A0 return ug_io_transaction(0x90000000) =3D=3D 0x04700000;
> +}
> +
> +int ug_grab_io_base(void)
> +{
> + =A0 =A0 =A0 u32 v;
> + =A0 =A0 =A0 void *devp;
> +
> + =A0 =A0 =A0 devp =3D find_node_by_alias("ugecon");
> + =A0 =A0 =A0 if (devp =3D=3D NULL)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto err_out;
> + =A0 =A0 =A0 if (getprop(devp, "virtual-reg", &v, sizeof(v)) !=3D sizeof=
(v))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto err_out;
> +
> + =A0 =A0 =A0 ug_io_base =3D (u8 *)v;
> + =A0 =A0 =A0 return 0;
> +
> +err_out:
> + =A0 =A0 =A0 return -1;
> +}
> diff --git a/arch/powerpc/boot/ugecon.h b/arch/powerpc/boot/ugecon.h
> new file mode 100644
> index 0000000..1fdb590
> --- /dev/null
> +++ b/arch/powerpc/boot/ugecon.h
> @@ -0,0 +1,25 @@
> +/*
> + * arch/powerpc/boot/ugecon.h
> + *
> + * USB Gecko early bootwrapper console.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 __UGECON_H
> +#define __UGECON_H
> +
> +extern int ug_grab_io_base(void);
> +extern int ug_is_adapter_present(void);
> +
> +extern void ug_putc(char ch);
> +extern void ug_console_write(const char *buf, int len);
> +
> +#endif /* __UGECON_H */
> +
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
  2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
@ 2009-11-22 23:02     ` Grant Likely
  2009-11-23 19:44       ` Albert Herranz
                         ` (2 more replies)
  2009-11-25 18:00     ` Segher Boessenkool
  2 siblings, 3 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:02 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add a device tree source file for the Nintendo GameCube video game consol=
e.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

Mostly looks good.  A few comments below.  Biggest comment is you need
to add a brief blurb for every new "compatible" property value that
you've added to Documentation/powerpc/dts-bindings.  General agreement
is that we don't merge drivers with new OF tree bindings unless the
binding is also documented.  It doesn't need to be long, it just needs
to state what the device is, and what properties are expected.  If you
define new properties, then you need to state what they are used for.

Once the comments below are addressed...

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/boot/dts/gamecube.dts | =A0135 ++++++++++++++++++++++++++=
++++++++++
> =A01 files changed, 135 insertions(+), 0 deletions(-)
> =A0create mode 100644 arch/powerpc/boot/dts/gamecube.dts
>
> diff --git a/arch/powerpc/boot/dts/gamecube.dts b/arch/powerpc/boot/dts/g=
amecube.dts
> new file mode 100644
> index 0000000..941a2c4
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/gamecube.dts
> @@ -0,0 +1,135 @@
> +/*
> + * arch/powerpc/boot/dts/gamecube.dts
> + *
> + * Nintendo GameCube platform device tree source
> + * Copyright (C) 2007-2009 The GameCube Linux Team
> + * Copyright (C) 2007,2008,2009 Albert Herranz
> + *
> + * 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.
> + *
> + */
> +
> +/dts-v1/;
> +
> +/ {
> + =A0 =A0 =A0 model =3D "NintendoGameCube";
> + =A0 =A0 =A0 compatible =3D "nintendo,gamecube";

To date, we've been using the same form for both the model and
compatible properties.  Specifically the <vendor>,<model> form to
maintain the namespace.

> + =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 #size-cells =3D <1>;
> +
> + =A0 =A0 =A0 chosen {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bootargs =3D "root=3D/dev/gcnsda2 rootwait =
udbg-immortal";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 linux,stdout-path =3D &USBGECKO0;
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 aliases {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ugecon =3D &USBGECKO0;
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 memory {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_type =3D "memory";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* 24M minus framebuffer memory area (640*5=
76*2*2) */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x00000000 0x01698000>;
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 cpus {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <0>;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 PowerPC,gekko@0 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 device_type =3D "cpu";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 clock-frequency =3D <486000=
000>; /* 486MHz */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 bus-frequency =3D <16200000=
0>; /* 162MHz core-to-bus 3x */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 timebase-frequency =3D <405=
00000>; /* 162MHz / 4 */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 i-cache-line-size =3D <32>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 d-cache-line-size =3D <32>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 i-cache-size =3D <32768>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 d-cache-size =3D <32768>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 /* devices contained int the flipper chipset */
> + =A0 =A0 =A0 soc {

It would be better to rename this as IMMR or the bus type.  This node
doesn't actually describe the entire chip, but describes the internal
memory mapped registers.

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 #interrupt-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 model =3D "flipper";

Drop the model property

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,flipper";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 clock-frequency =3D <162000000>; /* 162MHz =
*/
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ranges =3D <0x0c000000 0x0c000000 0x0001000=
0>;

Since you're only doing 1:1 mappings; you could replace this with an
empty "ranges;" property instead.

> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 video@0c002000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-video";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c002000 0x100>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <8>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;

Hint:  If you move the interrupt-parent property up to the root node,
then you don't need to specify it in every single device node; it will
just inherit from the parent.

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* XFB is the eXternal Fram=
eBuffer */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xfb-start =3D <0x01698000>;=
 /* end-of-ram - xfb-size */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 xfb-size =3D <0x168000>;

Can 'xfb' be made a second tuple to the 'reg' property so that all the
address mapping code works on it?  ie:

reg =3D <0x0c002000 0x100
       0x01698000 0x168000>;

At the very least, it is wise to adopt the same form as the reg
property when describing address ranges instead of splitting it into
multiple properties.

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pic: pic@0c003000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #interrupt-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-pic";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c003000 0x8>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-controller;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 resetswitch@0c003000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-resetswitch";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c003000 0x4>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 auxram@0c005000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-auxram";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c005000 0x200>;=
 =A0 =A0 =A0 /* DSP */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <6>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 audio@0c005000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-audio";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c005000 0x200 =
=A0 =A0 =A0 =A0 /* DSP */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x0c006c00 0=
x20>; =A0 =A0 =A0 =A0/* AI */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <6>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 disk@0c006000 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-disk";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c006000 0x40>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <2>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 serial@0c006400 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-serial";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c006400 0x100>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <3>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* External Interface bus */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 exi@0c006800 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo,fl=
ipper-exi";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c006800 0x40>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <4>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&pic>=
;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 USBGECKO0: usbgecko@0c00681=
4 {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =
=3D "usbgecko,usbgecko";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x=
0c006814 0x14>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 virtual-reg=
 =3D <0xcc006814>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 =A0};
> +};
> +
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
@ 2009-11-22 23:11       ` Grant Likely
  2009-11-24  0:08       ` Segher Boessenkool
  2 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:11 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add support for the Nintendo GameCube video game console to the powerpc
> bootwrapper.
>
> dtbImage.gamecube is a wrapped image that contains a flat device tree,
> an entry point compatible with SDload, and an optional initrd.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/boot/Makefile =A0 | =A0 =A04 ++-
> =A0arch/powerpc/boot/gamecube.c | =A0 78 ++++++++++++++++++++++++++++++++=
++++++++++
> =A02 files changed, 81 insertions(+), 1 deletions(-)
> =A0create mode 100644 arch/powerpc/boot/gamecube.c
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 44bce21..b2f06b0 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -76,7 +76,8 @@ src-plat :=3D of.c cuboot-52xx.c cuboot-824x.c cuboot-8=
3xx.c cuboot-85xx.c holly.c
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cuboot-katmai.c cuboot-rainier.c redboot-8=
xx.c ep8248e.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yo=
semite.c simpleboot.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0virtex405-head.S virtex.c redboot-83xx.c c=
uboot-sam440ep.c \
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 cuboot-acadia.c cuboot-amigaone.c cuboot-ki=
lauea.c
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 cuboot-acadia.c cuboot-amigaone.c cuboot-ki=
lauea.c \
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 gamecube.c
> =A0src-boot :=3D $(src-wlib) $(src-plat) empty.c
>
> =A0src-boot :=3D $(addprefix $(obj)/, $(src-boot))
> @@ -254,6 +255,7 @@ image-$(CONFIG_KSI8560) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0 =A0 =A0 +=3D cuImage.ksi8560
> =A0image-$(CONFIG_STORCENTER) =A0 =A0 =A0 =A0 =A0 =A0 +=3D cuImage.storce=
nter
> =A0image-$(CONFIG_MPC7448HPC2) =A0 =A0 =A0 =A0 =A0 =A0+=3D cuImage.mpc744=
8hpc2
> =A0image-$(CONFIG_PPC_C2K) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0+=3D cuImage.c2k
> +image-$(CONFIG_GAMECUBE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 +=3D dtbImage.gamec=
ube
>
> =A0# Board port in arch/powerpc/platform/amigaone/Kconfig
> =A0image-$(CONFIG_AMIGAONE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 +=3D cuImage.amig=
aone
> diff --git a/arch/powerpc/boot/gamecube.c b/arch/powerpc/boot/gamecube.c
> new file mode 100644
> index 0000000..0d6c517
> --- /dev/null
> +++ b/arch/powerpc/boot/gamecube.c
> @@ -0,0 +1,78 @@
> +/*
> + * arch/powerpc/boot/gamecube.c
> + *
> + * Nintendo GameCube bootwrapper support
> + * Copyright (C) 2004-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 <stddef.h>
> +#include "stdio.h"
> +#include "types.h"
> +#include "io.h"
> +#include "ops.h"
> +
> +#include "ugecon.h"
> +
> +BSS_STACK(8192);
> +
> +/*
> + * We enter with the cache enabled, the MMU enabled and some known legac=
y
> + * memory mappings active. xBAT3 is unused.
> + *
> + * We leave the MMU enabled, but we switch to an identity mapped memory
> + * scheme as expected by the start code.
> + *
> + */
> +asm ("\n\
> +.text\n\
> +.globl _zimage_start\n\
> +_zimage_start:\n\
> +\n\
> + =A0 =A0 =A0 isync\n\
> + =A0 =A0 =A0 /* IBAT3,DBAT3 for first 16Mbytes */\n\
> + =A0 =A0 =A0 li =A0 =A0 =A08, 0x01ff =A0 =A0 =A0 /* 16MB */\n\
> + =A0 =A0 =A0 li =A0 =A0 =A09, 0x0002 =A0 =A0 =A0 /* rw */\n\
> + =A0 =A0 =A0 mtspr =A0 0x216, 8 =A0 =A0 =A0 =A0/* IBAT3U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x217, 9 =A0 =A0 =A0 =A0/* IBAT3L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21e, 8 =A0 =A0 =A0 =A0/* DBAT3U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21f, 9 =A0 =A0 =A0 =A0/* DBAT3L */\n\
> +\n\
> + =A0 =A0 =A0 sync\n\
> + =A0 =A0 =A0 isync\n\
> +\n\
> + =A0 =A0 =A0 li =A0 =A0 =A03, 0\n\
> + =A0 =A0 =A0 li =A0 =A0 =A04, 0\n\
> + =A0 =A0 =A0 li =A0 =A0 =A05, 0\n\
> +\n\
> + =A0 =A0 =A0 bcl- =A0 =A020,4*cr7+so,1f\n\
> +1:\n\
> + =A0 =A0 =A0 mflr =A0 =A08\n\
> + =A0 =A0 =A0 clrlwi =A08, 8, 3\n\
> + =A0 =A0 =A0 addi =A0 =A08, 8, 2f - 1b\n\
> + =A0 =A0 =A0 mtlr =A0 =A08\n\
> + =A0 =A0 =A0 blr\n\
> +2:\n\
> + =A0 =A0 =A0 b _zimage_start_lib\n\
> +");
> +
> +/*
> + *
> + */
> +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
> +{
> + =A0 =A0 =A0 u32 heapsize =3D 16*1024*1024 - (u32)_end;
> +
> + =A0 =A0 =A0 simple_alloc_init(_end, heapsize, 32, 64);
> + =A0 =A0 =A0 fdt_init(_dtb_start);
> +
> + =A0 =A0 =A0 if (!ug_grab_io_base() && ug_is_adapter_present())
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 console_ops.write =3D ug_console_write;
> +}
> +
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
  2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
@ 2009-11-22 23:18         ` Grant Likely
  2009-11-23 19:54           ` Albert Herranz
  2009-11-25 17:49         ` Segher Boessenkool
  2009-11-26  4:45         ` Benjamin Herrenschmidt
  3 siblings, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:18 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add a device tree source file for the Nintendo Wii video game console.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

Same comments apply here as for the gamecube.dts file, plus a few more belo=
w.

Cheers,
g.

> ---
> =A0arch/powerpc/boot/dts/wii.dts | =A0244 +++++++++++++++++++++++++++++++=
++++++++++
> =A01 files changed, 244 insertions(+), 0 deletions(-)
> =A0create mode 100644 arch/powerpc/boot/dts/wii.dts
>
> diff --git a/arch/powerpc/boot/dts/wii.dts b/arch/powerpc/boot/dts/wii.dt=
s
> new file mode 100644
> index 0000000..a30a804
> --- /dev/null
> +++ b/arch/powerpc/boot/dts/wii.dts
> @@ -0,0 +1,244 @@
> +/*
> + * arch/powerpc/boot/dts/wii.dts
> + *
> + * Nintendo Wii platform device tree source
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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.
> + *
> + */
> +
> +/dts-v1/;
> +
> +/memreserve/ 0x01800000 0xe800000; =A0 =A0 /* memory hole (includes I/O =
area) */
> +/memreserve/ 0x10000000 0x0004000; =A0 =A0 /* DSP RAM */

This bothers me... see below.

> +
> +/ {
> + =A0 =A0 =A0 model =3D "NintendoWii";
> + =A0 =A0 =A0 compatible =3D "nintendo,wii";
> + =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 #size-cells =3D <1>;
> +
> + =A0 =A0 =A0 chosen {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* root filesystem on 2nd partition of SD c=
ard */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 bootargs =3D "nobats root=3D/dev/mmcblk0p2 =
rootwait udbg-immortal";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 linux,stdout-path =3D &USBGECKO0;
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 aliases {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ugecon =3D &USBGECKO0;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 hw_gpio =3D &gpio1;
> + =A0 =A0 =A0 };
> +
> + =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0* The Nintendo Wii has two discontiguous RAM memory area=
s called
> + =A0 =A0 =A0 =A0* MEM1 and MEM2.
> + =A0 =A0 =A0 =A0* MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM=
.
> + =A0 =A0 =A0 =A0* MEM2 starts at 0x10000000 and contains 64MB of DDR2 RA=
M.
> + =A0 =A0 =A0 =A0* Between both memory address ranges there is an address=
 space
> + =A0 =A0 =A0 =A0* where memory-mapped I/O registers are found.
> + =A0 =A0 =A0 =A0*
> + =A0 =A0 =A0 =A0* Currently, Linux 32-bit PowerPC does not support RAM i=
n
> + =A0 =A0 =A0 =A0* discontiguous memory address spaces. Thus, in order to=
 use
> + =A0 =A0 =A0 =A0* both RAM areas, we declare as RAM the range from the s=
tart of
> + =A0 =A0 =A0 =A0* MEM1 to the end of useable MEM2 and exclude the needed=
 parts
> + =A0 =A0 =A0 =A0* with /memreserve/ statements, at the expense of wastin=
g a bit
> + =A0 =A0 =A0 =A0* of memory.

Hmmm.  It's not great practice to lie about hardware in the device
tree.  Better to describe the memory correctly here, and if you have
to work around Linux deficiencies, then do so in the platform support
code (arch/platforms/*).  I won't NAK the patch over it (feel free to
add my Acked-by line) because it doesn't impact other platforms, but
it should be fixed.

> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 i2c-video {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <0>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "virtual,i2c=
-gpio";

There isn't a documented binding for this.  Is there a driver for it?

> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 gpios =3D <&gpio0 =A016 0 /=
* 31-15 */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0&gpio0 =
=A017 0 /* 31-14 */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 >;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sda-is-open-drain =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 sda-enforce-dir =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 scl-is-open-drain =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 scl-is-output-only =3D <1>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 udelay =3D <2>;
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 audio-video-encoder {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =
=3D "nintendo,wii-ave-rvl";
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x=
70>;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 };
> + =A0 =A0 =A0 };
> +};
> +
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 05/19] powerpc: wii: bootwrapper bits
  2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
  2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
@ 2009-11-22 23:19           ` Grant Likely
  2009-11-24  0:33           ` Segher Boessenkool
  2 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:19 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add support for the Nintendo Wii video game console to the powerpc
> bootwrapper.
>
> dtbImage.wii is a wrapped image that contains a flat device tree,
> an entry point compatible with the Homebrew Channel and BootMii,
> and an optional initrd.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/boot/Makefile | =A0 =A03 +-
> =A0arch/powerpc/boot/wii.c =A0 =A0| =A0173 ++++++++++++++++++++++++++++++=
++++++++++++++
> =A0arch/powerpc/boot/wrapper =A0| =A0 =A03 +
> =A03 files changed, 178 insertions(+), 1 deletions(-)
> =A0create mode 100644 arch/powerpc/boot/wii.c
>
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index b2f06b0..fbaf101 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -77,7 +77,7 @@ src-plat :=3D of.c cuboot-52xx.c cuboot-824x.c cuboot-8=
3xx.c cuboot-85xx.c holly.c
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cuboot-warp.c cuboot-85xx-cpm2.c cuboot-yo=
semite.c simpleboot.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0virtex405-head.S virtex.c redboot-83xx.c c=
uboot-sam440ep.c \
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0cuboot-acadia.c cuboot-amigaone.c cuboot-k=
ilauea.c \
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 gamecube.c
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 gamecube.c wii.c
> =A0src-boot :=3D $(src-wlib) $(src-plat) empty.c
>
> =A0src-boot :=3D $(addprefix $(obj)/, $(src-boot))
> @@ -256,6 +256,7 @@ image-$(CONFIG_STORCENTER) =A0 =A0 =A0 =A0 =A0+=3D cu=
Image.storcenter
> =A0image-$(CONFIG_MPC7448HPC2) =A0 =A0 =A0 =A0 =A0 =A0+=3D cuImage.mpc744=
8hpc2
> =A0image-$(CONFIG_PPC_C2K) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =
=A0+=3D cuImage.c2k
> =A0image-$(CONFIG_GAMECUBE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 +=3D dtbImage.gam=
ecube
> +image-$(CONFIG_WII) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D dtbImage=
.wii
>
> =A0# Board port in arch/powerpc/platform/amigaone/Kconfig
> =A0image-$(CONFIG_AMIGAONE) =A0 =A0 =A0 =A0 =A0 =A0 =A0 +=3D cuImage.amig=
aone
> diff --git a/arch/powerpc/boot/wii.c b/arch/powerpc/boot/wii.c
> new file mode 100644
> index 0000000..65b73a1
> --- /dev/null
> +++ b/arch/powerpc/boot/wii.c
> @@ -0,0 +1,173 @@
> +/*
> + * arch/powerpc/boot/wii.c
> + *
> + * Nintendo Wii bootwrapper support
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 <stddef.h>
> +#include "stdio.h"
> +#include "types.h"
> +#include "io.h"
> +#include "ops.h"
> +
> +#include "ugecon.h"
> +
> +
> +BSS_STACK(8192);
> +
> +/*
> + * We enter with an unknown cache, high BATs and MMU status.
> + *
> + * We enable the MMU with an identity mapped memory scheme as expected
> + * by the start code.
> + *
> + */
> +asm ("\n\
> +.text\n\
> +.globl _zimage_start\n\
> +_zimage_start:\n\
> +\n\
> + =A0 =A0 =A0 mfmsr =A0 9\n\
> + =A0 =A0 =A0 andi. =A0 0, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\
> + =A0 =A0 =A0 bcl =A0 =A0 20, 31, 1f\n\
> +1: \n\
> + =A0 =A0 =A0 mflr =A0 =A08\n\
> + =A0 =A0 =A0 clrlwi =A08, 8, 3 =A0 =A0 =A0 =A0 /* convert to a real addr=
ess */\n\
> + =A0 =A0 =A0 addi =A0 =A08, 8, _mmu_off - 1b\n\
> + =A0 =A0 =A0 andc =A0 =A09, 9, 0\n\
> + =A0 =A0 =A0 mtspr =A0 0x01a, 8 =A0 =A0 =A0 =A0/* SRR0 */\n\
> + =A0 =A0 =A0 mtspr =A0 0x01b, 9 =A0 =A0 =A0 =A0/* SRR1 */\n\
> + =A0 =A0 =A0 sync\n\
> + =A0 =A0 =A0 rfi\n\
> +_mmu_off: \n\
> + =A0 =A0 =A0 /* MMU disabled */\n\
> +\n\
> + =A0 =A0 =A0 /* Setup BATs */\n\
> + =A0 =A0 =A0 isync\n\
> + =A0 =A0 =A0 li =A0 =A0 =A08, 0\n\
> + =A0 =A0 =A0 mtspr =A0 0x210, 8 =A0 =A0 =A0 =A0/* IBAT0U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x211, 8 =A0 =A0 =A0 =A0/* IBAT0L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x212, 8 =A0 =A0 =A0 =A0/* IBAT1U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x213, 8 =A0 =A0 =A0 =A0/* IBAT1L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x214, 8 =A0 =A0 =A0 =A0/* IBAT2U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x215, 8 =A0 =A0 =A0 =A0/* IBAT2L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x216, 8 =A0 =A0 =A0 =A0/* IBAT3U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x217, 8 =A0 =A0 =A0 =A0/* IBAT3L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x218, 8 =A0 =A0 =A0 =A0/* DBAT0U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x219, 8 =A0 =A0 =A0 =A0/* DBAT0L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21a, 8 =A0 =A0 =A0 =A0/* DBAT1U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21b, 8 =A0 =A0 =A0 =A0/* DBAT1L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21c, 8 =A0 =A0 =A0 =A0/* DBAT2U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21d, 8 =A0 =A0 =A0 =A0/* DBAT2L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21e, 8 =A0 =A0 =A0 =A0/* DBAT3U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21f, 8 =A0 =A0 =A0 =A0/* DBAT3L */\n\
> +\n\
> + =A0 =A0 =A0 mtspr =A0 0x230, 8 =A0 =A0 =A0 =A0/* IBAT4U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x231, 8 =A0 =A0 =A0 =A0/* IBAT4L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x232, 8 =A0 =A0 =A0 =A0/* IBAT5U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x233, 8 =A0 =A0 =A0 =A0/* IBAT5L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x234, 8 =A0 =A0 =A0 =A0/* IBAT6U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x235, 8 =A0 =A0 =A0 =A0/* IBAT6L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x236, 8 =A0 =A0 =A0 =A0/* IBAT7U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x237, 8 =A0 =A0 =A0 =A0/* IBAT7L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x238, 8 =A0 =A0 =A0 =A0/* DBAT4U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x239, 8 =A0 =A0 =A0 =A0/* DBAT4L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x23a, 8 =A0 =A0 =A0 =A0/* DBAT5U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x23b, 8 =A0 =A0 =A0 =A0/* DBAT5L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x23c, 8 =A0 =A0 =A0 =A0/* DBAT6U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x23d, 8 =A0 =A0 =A0 =A0/* DBAT6L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x23e, 8 =A0 =A0 =A0 =A0/* DBAT7U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x23f, 8 =A0 =A0 =A0 =A0/* DBAT7L */\n\
> +\n\
> + =A0 =A0 =A0 isync\n\
> + =A0 =A0 =A0 li =A0 =A0 =A08, 0x01ff =A0 =A0 =A0 /* first 16MiB */\n\
> + =A0 =A0 =A0 li =A0 =A0 =A09, 0x0002 =A0 =A0 =A0 /* rw */\n\
> + =A0 =A0 =A0 mtspr =A0 0x210, 8 =A0 =A0 =A0 =A0/* IBAT0U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x211, 9 =A0 =A0 =A0 =A0/* IBAT0L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x218, 8 =A0 =A0 =A0 =A0/* DBAT0U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x219, 9 =A0 =A0 =A0 =A0/* DBAT0L */\n\
> +\n\
> + =A0 =A0 =A0 lis =A0 =A0 8, 0xcc00 =A0 =A0 =A0 /* I/O mem */\n\
> + =A0 =A0 =A0 ori =A0 =A0 8, 8, 0x3ff =A0 =A0 /* 32MiB */\n\
> + =A0 =A0 =A0 lis =A0 =A0 9, 0x0c00\n\
> + =A0 =A0 =A0 ori =A0 =A0 9, 9, 0x002a =A0 =A0/* uncached, guarded, rw */=
\n\
> + =A0 =A0 =A0 mtspr =A0 0x21a, 8 =A0 =A0 =A0 =A0/* DBAT1U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21b, 9 =A0 =A0 =A0 =A0/* DBAT1L */\n\
> +\n\
> + =A0 =A0 =A0 lis =A0 =A0 8, 0x0100 =A0 =A0 =A0 /* next 8MiB */\n\
> + =A0 =A0 =A0 ori =A0 =A0 8, 8, 0x00ff =A0 =A0/* 8MiB */\n\
> + =A0 =A0 =A0 lis =A0 =A0 9, 0x0100 =A0 =A0 =A0 /* next 8MiB */\n\
> + =A0 =A0 =A0 ori =A0 =A0 9, 9, 0x0002 =A0 =A0/* rw */\n\
> + =A0 =A0 =A0 mtspr =A0 0x214, 8 =A0 =A0 =A0 =A0/* IBAT2U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x215, 9 =A0 =A0 =A0 =A0/* IBAT2L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21c, 8 =A0 =A0 =A0 =A0/* DBAT2U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21d, 9 =A0 =A0 =A0 =A0/* DBAT2L */\n\
> +\n\
> + =A0 =A0 =A0 lis =A0 =A0 8, 0x1000 =A0 =A0 =A0 /* MEM2 */\n\
> + =A0 =A0 =A0 ori =A0 =A0 8, 8, 0x07ff =A0 =A0/* 64MiB */\n\
> + =A0 =A0 =A0 lis =A0 =A0 9, 0x1000\n\
> + =A0 =A0 =A0 ori =A0 =A0 9, 9, 0x0002 =A0 =A0/* rw */\n\
> + =A0 =A0 =A0 mtspr =A0 0x216, 8 =A0 =A0 =A0 =A0/* IBAT3U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x217, 9 =A0 =A0 =A0 =A0/* IBAT3L */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21e, 8 =A0 =A0 =A0 =A0/* DBAT3U */\n\
> + =A0 =A0 =A0 mtspr =A0 0x21f, 9 =A0 =A0 =A0 =A0/* DBAT3L */\n\
> +\n\
> + =A0 =A0 =A0 sync\n\
> + =A0 =A0 =A0 isync\n\
> +\n\
> + =A0 =A0 =A0 /* enable high BATs */\n\
> + =A0 =A0 =A0 lis =A0 =A0 8, 0x8200\n\
> + =A0 =A0 =A0 mtspr =A0 0x3f3, 8 =A0 =A0 =A0 =A0/* HID4 */\n\
> +\n\
> + =A0 =A0 =A0 /* enable caches */\n\
> + =A0 =A0 =A0 mfspr =A0 8, 0x3f0\n\
> + =A0 =A0 =A0 ori =A0 =A0 8, 8, 0xc000\n\
> + =A0 =A0 =A0 mtspr =A0 0x3f0, 8 =A0 =A0 =A0 =A0/* HID0 */\n\
> + =A0 =A0 =A0 isync\n\
> +\n\
> + =A0 =A0 =A0 li =A0 =A0 =A03, 0\n\
> + =A0 =A0 =A0 li =A0 =A0 =A04, 0\n\
> + =A0 =A0 =A0 li =A0 =A0 =A05, 0\n\
> +\n\
> + =A0 =A0 =A0 bcl =A0 =A0 20, 31, 1f\n\
> +1: \n\
> + =A0 =A0 =A0 mflr =A0 =A08\n\
> + =A0 =A0 =A0 addi =A0 =A08, 8, _mmu_on - 1b\n\
> + =A0 =A0 =A0 mfmsr =A0 9\n\
> + =A0 =A0 =A0 ori =A0 =A0 9, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\
> + =A0 =A0 =A0 mtspr =A0 0x01a, 8 =A0 =A0 =A0 =A0/* SRR0 */\n\
> + =A0 =A0 =A0 mtspr =A0 0x01b, 9 =A0 =A0 =A0 =A0/* SRR1 */\n\
> + =A0 =A0 =A0 sync\n\
> + =A0 =A0 =A0 rfi\n\
> +_mmu_on: \n\
> + =A0 =A0 =A0 /* turn on the front blue led (aka: yay! we got here!) */\n=
\
> + =A0 =A0 =A0 lis =A0 =A0 8, 0xcd00\n\
> + =A0 =A0 =A0 ori =A0 =A0 8, 8, 0x00c0\n\
> + =A0 =A0 =A0 lwz =A0 =A0 9, 0(8)\n\
> + =A0 =A0 =A0 ori =A0 =A0 9, 9, 0x20\n\
> + =A0 =A0 =A0 stw =A0 =A0 9, 0(8)\n\
> + =A0 =A0 =A0 b _zimage_start_lib\n\
> +");
> +
> +/*
> + *
> + */
> +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
> +{
> + =A0 =A0 =A0 u32 heapsize =3D 24*1024*1024 - (u32)_end;
> +
> + =A0 =A0 =A0 simple_alloc_init(_end, heapsize, 32, 64);
> + =A0 =A0 =A0 fdt_init(_dtb_start);
> +
> + =A0 =A0 =A0 if (!ug_grab_io_base() && ug_is_adapter_present())
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 console_ops.write =3D ug_console_write;
> +}
> +
> diff --git a/arch/powerpc/boot/wrapper b/arch/powerpc/boot/wrapper
> index ac9e9a5..0e9ce10 100755
> --- a/arch/powerpc/boot/wrapper
> +++ b/arch/powerpc/boot/wrapper
> @@ -230,6 +230,9 @@ xpedite52*)
> =A0 =A0 link_address=3D'0x1400000'
> =A0 =A0 platformo=3D$object/cuboot-85xx.o
> =A0 =A0 ;;
> +wii|gamecube)
> + =A0 =A0link_address=3D'0x600000'
> + =A0 =A0;;
> =A0esac
>
> =A0vmz=3D"$tmpdir/`basename \"$kernel\"`.$ext"
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
  2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
@ 2009-11-22 23:20             ` Grant Likely
  2009-11-23 19:56               ` Albert Herranz
  2009-11-24  0:35             ` Segher Boessenkool
  2 siblings, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:20 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add a config option GAMECUBE_COMMON to be used as a dependency for all
> options common to the Nintendo GameCube and Wii video game consoles.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

This could just be rolled into the first patch that uses it.  But
otherwise; ACK.

g.

> ---
> =A0arch/powerpc/platforms/embedded6xx/Kconfig | =A0 =A04 ++++
> =A01 files changed, 4 insertions(+), 0 deletions(-)
>
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/pl=
atforms/embedded6xx/Kconfig
> index 291ac9d..97a2dbc 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -90,3 +90,7 @@ config MPC10X_OPENPIC
> =A0config MPC10X_STORE_GATHERING
> =A0 =A0 =A0 =A0bool "Enable MPC10x store gathering"
> =A0 =A0 =A0 =A0depends on MPC10X_BRIDGE
> +
> +config GAMECUBE_COMMON
> + =A0 =A0 =A0 bool
> +
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support
  2009-11-22 22:01               ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Albert Herranz
  2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
@ 2009-11-22 23:21                 ` Grant Likely
  2009-11-26  5:10                   ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:21 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> The Nintendo GameCube and Wii video game consoles do not have PCI hardwar=
e.
> Avoid wasting their scarce memory by not including PCI support into the
> kernel.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
> =A0arch/powerpc/Kconfig | =A0 =A02 +-
> =A01 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 2ba14e7..84b2566 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -679,7 +679,7 @@ config PPC_PCI_CHOICE
> =A0config PCI
> =A0 =A0 =A0 =A0bool "PCI support" if PPC_PCI_CHOICE
> =A0 =A0 =A0 =A0default y if !40x && !CPM2 && !8xx && !PPC_83xx \
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 && !PPC_85xx && !PPC_86xx
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 && !PPC_85xx && !PPC_86xx && !GAMECUBE_COMM=
ON

phew, this is getting ugly.  But I won't ask you to clean it up.  Ack

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
  2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
@ 2009-11-22 23:22                   ` Grant Likely
  2009-11-24  0:49                   ` Segher Boessenkool
  2009-11-26  5:12                   ` Benjamin Herrenschmidt
  3 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:22 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add support for using the USB Gecko adapter via the udbg facility on
> the Nintendo GameCube and Wii video game consoles.
> The USB Gecko is a 3rd party memory card interface adapter that provides
> a EXI (External Interface) to USB serial converter.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/platforms/embedded6xx/Kconfig =A0 =A0 =A0 =A0 | =A0 13 +
> =A0arch/powerpc/platforms/embedded6xx/Makefile =A0 =A0 =A0 =A0| =A0 =A01 =
+
> =A0arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c | =A0285 ++++++++++=
++++++++++
> =A0arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h | =A0 30 ++
> =A04 files changed, 329 insertions(+), 0 deletions(-)
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
>
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/pl=
atforms/embedded6xx/Kconfig
> index 31487e4..bfd88be 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -95,3 +95,16 @@ config GAMECUBE_COMMON
> =A0 =A0 =A0 =A0bool
> =A0 =A0 =A0 =A0select NOT_COHERENT_CACHE
>
> +config USBGECKO_UDBG
> + =A0 =A0 =A0 bool "USB Gecko udbg console for the Nintendo GameCube/Wii"
> + =A0 =A0 =A0 depends on GAMECUBE_COMMON
> + =A0 =A0 =A0 help
> + =A0 =A0 =A0 =A0 If you say yes to this option, support will be included=
 for the
> + =A0 =A0 =A0 =A0 USB Gecko adapter as an udbg console.
> + =A0 =A0 =A0 =A0 The USB Gecko is a EXI to USB Serial converter that can=
 be plugged
> + =A0 =A0 =A0 =A0 into a memcard slot in the Nintendo GameCube/Wii.
> +
> + =A0 =A0 =A0 =A0 This driver bypasses the EXI layer completely.
> +
> + =A0 =A0 =A0 =A0 If in doubt, say N here.
> +
> diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/p=
latforms/embedded6xx/Makefile
> index 0773c08..0ab7492 100644
> --- a/arch/powerpc/platforms/embedded6xx/Makefile
> +++ b/arch/powerpc/platforms/embedded6xx/Makefile
> @@ -7,3 +7,4 @@ obj-$(CONFIG_STORCENTER) =A0 =A0 =A0 =A0+=3D storcenter.o
> =A0obj-$(CONFIG_PPC_HOLLY) =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0+=3D holly.o
> =A0obj-$(CONFIG_PPC_PRPMC2800) =A0 =A0+=3D prpmc2800.o
> =A0obj-$(CONFIG_PPC_C2K) =A0 =A0 =A0 =A0 =A0+=3D c2k.o
> +obj-$(CONFIG_USBGECKO_UDBG) =A0 =A0+=3D usbgecko_udbg.o
> diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/po=
werpc/platforms/embedded6xx/usbgecko_udbg.c
> new file mode 100644
> index 0000000..49f86e8
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> @@ -0,0 +1,285 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> + *
> + * udbg serial input/output routines for the USB Gecko adapter.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 <asm/io.h>
> +#include <asm/prom.h>
> +#include <asm/udbg.h>
> +
> +#include <mm/mmu_decl.h>
> +
> +#include "usbgecko_udbg.h"
> +
> +
> +#define EXI_CLK_32MHZ =A0 =A0 =A0 =A0 =A0 5
> +
> +#define EXI_CSR =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 0x00
> +#define =A0 EXI_CSR_CLKMASK =A0 =A0 =A0 (0x7<<4)
> +#define =A0 =A0 EXI_CSR_CLK_32MHZ =A0 (EXI_CLK_32MHZ<<4)
> +#define =A0 EXI_CSR_CSMASK =A0 =A0 =A0 =A0(0x7<<7)
> +#define =A0 =A0 EXI_CSR_CS_0 =A0 =A0 =A0 =A0(0x1<<7) =A0/* Chip Select 0=
01 */
> +
> +#define EXI_CR =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x0c
> +#define =A0 EXI_CR_TSTART =A0 =A0 =A0 =A0 (1<<0)
> +#define =A0 EXI_CR_WRITE =A0 =A0 =A0 =A0 (1<<2)
> +#define =A0 EXI_CR_READ_WRITE =A0 =A0 (2<<2)
> +#define =A0 EXI_CR_TLEN(len) =A0 =A0 =A0(((len)-1)<<4)
> +
> +#define EXI_DATA =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x10
> +
> +#define UG_READ_ATTEMPTS =A0 =A0 =A0 100
> +#define UG_WRITE_ATTEMPTS =A0 =A0 =A0100
> +
> +
> +static void __iomem *ug_io_base;
> +
> +/*
> + * Performs one input/output transaction between the exi host and the us=
bgecko.
> + */
> +static u32 ug_io_transaction(u32 in)
> +{
> + =A0 =A0 =A0 u32 __iomem *csr_reg =3D ug_io_base + EXI_CSR;
> + =A0 =A0 =A0 u32 __iomem *data_reg =3D ug_io_base + EXI_DATA;
> + =A0 =A0 =A0 u32 __iomem *cr_reg =3D ug_io_base + EXI_CR;
> + =A0 =A0 =A0 u32 csr, data, cr;
> +
> + =A0 =A0 =A0 /* select */
> + =A0 =A0 =A0 csr =3D EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0;
> + =A0 =A0 =A0 out_be32(csr_reg, csr);
> +
> + =A0 =A0 =A0 /* read/write */
> + =A0 =A0 =A0 data =3D in;
> + =A0 =A0 =A0 out_be32(data_reg, data);
> + =A0 =A0 =A0 cr =3D EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART;
> + =A0 =A0 =A0 out_be32(cr_reg, cr);
> +
> + =A0 =A0 =A0 while (in_be32(cr_reg) & EXI_CR_TSTART)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 barrier();
> +
> + =A0 =A0 =A0 /* deselect */
> + =A0 =A0 =A0 out_be32(csr_reg, 0);
> +
> + =A0 =A0 =A0 /* result */
> + =A0 =A0 =A0 data =3D in_be32(data_reg);
> +
> + =A0 =A0 =A0 return data;
> +}
> +
> +/*
> + * Returns true if an usbgecko adapter is found.
> + */
> +static int ug_is_adapter_present(void)
> +{
> + =A0 =A0 =A0 if (!ug_io_base)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +
> + =A0 =A0 =A0 return ug_io_transaction(0x90000000) =3D=3D 0x04700000;
> +}
> +
> +/*
> + * Returns true if the TX fifo is ready for transmission.
> + */
> +static int ug_is_txfifo_ready(void)
> +{
> + =A0 =A0 =A0 return ug_io_transaction(0xc0000000) & 0x04000000;
> +}
> +
> +/*
> + * Tries to transmit a character.
> + * If the TX fifo is not ready the result is undefined.
> + */
> +static void ug_raw_putc(char ch)
> +{
> + =A0 =A0 =A0 ug_io_transaction(0xb0000000 | (ch << 20));
> +}
> +
> +/*
> + * Transmits a character.
> + * It silently fails if the TX fifo is not ready after a number of retri=
es.
> + */
> +static void ug_putc(char ch)
> +{
> + =A0 =A0 =A0 int count =3D UG_WRITE_ATTEMPTS;
> +
> + =A0 =A0 =A0 if (!ug_io_base)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return;
> +
> + =A0 =A0 =A0 if (ch =3D=3D '\n')
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_putc('\r');
> +
> + =A0 =A0 =A0 while (!ug_is_txfifo_ready() && count--)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 barrier();
> + =A0 =A0 =A0 if (count)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_raw_putc(ch);
> +}
> +
> +#if 0
> +/*
> + * Trasmits a null terminated character string.
> + */
> +static void ug_puts(char *s)
> +{
> + =A0 =A0 =A0 while (*s)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_putc(*s++);
> +}
> +#endif
> +
> +/*
> + * Returns true if the RX fifo is ready for transmission.
> + */
> +static int ug_is_rxfifo_ready(void)
> +{
> + =A0 =A0 =A0 return ug_io_transaction(0xd0000000) & 0x04000000;
> +}
> +
> +/*
> + * Tries to receive a character.
> + * If a character is unavailable the function returns -1.
> + */
> +static int ug_raw_getc(void)
> +{
> + =A0 =A0 =A0 u32 data =3D ug_io_transaction(0xa0000000);
> + =A0 =A0 =A0 if (data & 0x08000000)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return (data >> 16) & 0xff;
> + =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1;
> +}
> +
> +/*
> + * Receives a character.
> + * It fails if the RX fifo is not ready after a number of retries.
> + */
> +static int ug_getc(void)
> +{
> + =A0 =A0 =A0 int count =3D UG_READ_ATTEMPTS;
> +
> + =A0 =A0 =A0 if (!ug_io_base)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1;
> +
> + =A0 =A0 =A0 while (!ug_is_rxfifo_ready() && count--)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 barrier();
> + =A0 =A0 =A0 return ug_raw_getc();
> +}
> +
> +/*
> + * udbg functions.
> + *
> + */
> +
> +/*
> + * Transmits a character.
> + */
> +void ug_udbg_putc(char ch)
> +{
> + =A0 =A0 =A0 ug_putc(ch);
> +}
> +
> +/*
> + * Receives a character. Waits until a character is available.
> + */
> +static int ug_udbg_getc(void)
> +{
> + =A0 =A0 =A0 int ch;
> +
> + =A0 =A0 =A0 while ((ch =3D ug_getc()) =3D=3D -1)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 barrier();
> + =A0 =A0 =A0 return ch;
> +}
> +
> +/*
> + * Receives a character. If a character is not available, returns -1.
> + */
> +static int ug_udbg_getc_poll(void)
> +{
> + =A0 =A0 =A0 if (!ug_is_rxfifo_ready())
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1;
> + =A0 =A0 =A0 return ug_getc();
> +}
> +
> +/*
> + * Retrieves and prepares the virtual address needed to access the hardw=
are.
> + */
> +static void __iomem *ug_udbg_setup_io_base(struct device_node *np)
> +{
> + =A0 =A0 =A0 phys_addr_t paddr;
> + =A0 =A0 =A0 const unsigned int *reg;
> +
> + =A0 =A0 =A0 reg =3D of_get_property(np, "reg", NULL);
> + =A0 =A0 =A0 if (reg) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 paddr =3D of_translate_address(np, reg);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (paddr) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_io_base =3D ioremap(padd=
r, reg[1]);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 return ug_io_base;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 return NULL;
> +}
> +
> +/*
> + * USB Gecko udbg support initialization.
> + */
> +void __init ug_udbg_init(void)
> +{
> + =A0 =A0 =A0 struct device_node *np =3D NULL;
> + =A0 =A0 =A0 struct device_node *stdout;
> + =A0 =A0 =A0 const char *path;
> +
> + =A0 =A0 =A0 if (!of_chosen) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("%s: missing of_chosen\n", __fu=
nc__);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto done;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 path =3D of_get_property(of_chosen, "linux,stdout-path", NU=
LL);
> + =A0 =A0 =A0 if (!path) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("%s: missing %s property", __fu=
nc__,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 "linux,stdout-path"=
);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto done;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 stdout =3D of_find_node_by_path(path);
> + =A0 =A0 =A0 if (!stdout) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("%s: missing path %s", __func__=
, path);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto done;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 for (np =3D NULL;
> + =A0 =A0 =A0 =A0 =A0 (np =3D of_find_compatible_node(np, NULL, "usbgecko=
,usbgecko"));)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (np =3D=3D stdout)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 break;
> +
> + =A0 =A0 =A0 of_node_put(stdout);
> + =A0 =A0 =A0 if (!np) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("%s: stdout is not an usbgecko"=
, __func__);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto done;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 if (!ug_udbg_setup_io_base(np)) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("%s: failed to setup io base", =
__func__);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto done;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 if (!ug_is_adapter_present()) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("usbgecko_udbg: not found\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ug_io_base =3D NULL;
> + =A0 =A0 =A0 } else {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_putc =3D ug_udbg_putc;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_getc =3D ug_udbg_getc;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_getc_poll =3D ug_udbg_getc_poll;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 udbg_printf("usbgecko_udbg: ready\n");
> + =A0 =A0 =A0 }
> +
> +done:
> + =A0 =A0 =A0 if (np)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(np);
> + =A0 =A0 =A0 return;
> +}
> diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h b/arch/po=
werpc/platforms/embedded6xx/usbgecko_udbg.h
> new file mode 100644
> index 0000000..3929de3
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> @@ -0,0 +1,30 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> + *
> + * udbg serial input/output routines for the USB Gecko adapter.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 __USBGECKO_UDBG_H
> +#define __USBGECKO_UDBG_H
> +
> +#ifdef CONFIG_USBGECKO_UDBG
> +
> +extern void __init ug_udbg_init(void);
> +
> +#else
> +
> +static inline void __init ug_udbg_init(void)
> +{
> +}
> +
> +#endif /* CONFIG_USBGECKO_UDBG */
> +
> +#endif /* __USBGECKO_UDBG_H */
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
  2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
@ 2009-11-22 23:28                       ` Grant Likely
  2009-11-23 19:59                         ` Albert Herranz
  2009-11-26  5:18                         ` Benjamin Herrenschmidt
  2009-11-24 21:30                       ` Segher Boessenkool
  2009-11-26  5:18                       ` Benjamin Herrenschmidt
  3 siblings, 2 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:28 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add support for the interrupt controller included in the "Flipper"
> chipset of the Nintendo GameCube video game console.
> The same interrupt controller is also present in the "Hollywood" chipset
> of the Nintendo Wii.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
> =A0arch/powerpc/platforms/embedded6xx/Kconfig =A0 =A0 =A0 | =A0 =A06 +
> =A0arch/powerpc/platforms/embedded6xx/Makefile =A0 =A0 =A0| =A0 =A01 +
> =A0arch/powerpc/platforms/embedded6xx/flipper-pic.c | =A0247 ++++++++++++=
++++++++++
> =A0arch/powerpc/platforms/embedded6xx/flipper-pic.h | =A0 25 +++
> =A04 files changed, 279 insertions(+), 0 deletions(-)
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.h
>
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/pl=
atforms/embedded6xx/Kconfig
> index bfd88be..29a98c6 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -94,6 +94,7 @@ config MPC10X_STORE_GATHERING
> =A0config GAMECUBE_COMMON
> =A0 =A0 =A0 =A0bool
> =A0 =A0 =A0 =A0select NOT_COHERENT_CACHE
> + =A0 =A0 =A0 select FLIPPER_PIC
>
> =A0config USBGECKO_UDBG
> =A0 =A0 =A0 =A0bool "USB Gecko udbg console for the Nintendo GameCube/Wii=
"
> @@ -108,3 +109,8 @@ config USBGECKO_UDBG
>
> =A0 =A0 =A0 =A0 =A0If in doubt, say N here.
>
> +config FLIPPER_PIC
> + =A0 =A0 =A0 bool
> + =A0 =A0 =A0 depends on GAMECUBE_COMMON
> + =A0 =A0 =A0 default y

You'll always want this driver when GAMECUBE common is set.  Don't add
another Kconfig entry.

> +
> diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/p=
latforms/embedded6xx/Makefile
> index 0ab7492..35258fd 100644
> --- a/arch/powerpc/platforms/embedded6xx/Makefile
> +++ b/arch/powerpc/platforms/embedded6xx/Makefile
> @@ -8,3 +8,4 @@ obj-$(CONFIG_PPC_HOLLY) =A0 =A0 =A0 =A0 +=3D holly.o
> =A0obj-$(CONFIG_PPC_PRPMC2800) =A0 =A0+=3D prpmc2800.o
> =A0obj-$(CONFIG_PPC_C2K) =A0 =A0 =A0 =A0 =A0+=3D c2k.o
> =A0obj-$(CONFIG_USBGECKO_UDBG) =A0 =A0+=3D usbgecko_udbg.o
> +obj-$(CONFIG_FLIPPER_PIC) =A0 =A0 =A0+=3D flipper-pic.o

> +unsigned int flipper_pic_get_irq(void)
> +{
> + =A0 =A0 =A0 void __iomem *io_base =3D flipper_irq_host->host_data;
> + =A0 =A0 =A0 int irq;
> + =A0 =A0 =A0 u32 irq_status;
> +
> + =A0 =A0 =A0 irq_status =3D in_be32(io_base + FLIPPER_ICR) &
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0in_be32(io_base + FLIPPER_IMR);
> + =A0 =A0 =A0 if (irq_status =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return -1; =A0 =A0 =A0/* no more IRQs pendi=
ng */

NO_IRQ_IGNORE

> +
> + =A0 =A0 =A0 __asm__ __volatile__("cntlzw %0,%1" : "=3Dr"(irq) : "r"(irq=
_status));
> + =A0 =A0 =A0 return irq_linear_revmap(flipper_irq_host, 31 - irq);
> +}
> +

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
  2009-11-22 22:01                         ` [RFC PATCH 13/19] powerpc: gamecube: default config Albert Herranz
@ 2009-11-22 23:34                         ` Grant Likely
  2009-11-23 20:02                           ` Albert Herranz
  2009-11-24 21:39                         ` Segher Boessenkool
  2 siblings, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:34 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add platform support for the Nintendo GameCube video game console.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
> +static void gamecube_show_cpuinfo(struct seq_file *m)
> +{
> + =A0 =A0 =A0 seq_printf(m, "vendor\t\t: IBM\n");
> + =A0 =A0 =A0 seq_printf(m, "machine\t\t: Nintendo GameCube\n");
> +}

show_cpuinfo hooks have been dropped on most platforms now.

> +static void gamecube_shutdown(void)
> +{
> + =A0 =A0 =A0 /* currently not used */
> +}

Then don't add the hook.  Just drop it.  Same for other empty
functions in this file.  If it is safe to drop them, then please do.

Otherwise: Acked-by: Grant Likely <grant.likely@secretlab.ca>

> +define_machine(gamecube) {
> + =A0 =A0 =A0 .name =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D "gamecube",
> + =A0 =A0 =A0 .probe =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D gamecube_prob=
e,
> + =A0 =A0 =A0 .setup_arch =A0 =A0 =A0 =A0 =A0 =A0 =3D gamecube_setup_arch=
,
> + =A0 =A0 =A0 .init_early =A0 =A0 =A0 =A0 =A0 =A0 =3D gamecube_init_early=
,
> + =A0 =A0 =A0 .show_cpuinfo =A0 =A0 =A0 =A0 =A0 =3D gamecube_show_cpuinfo=
,
> + =A0 =A0 =A0 .restart =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D gamecube_restar=
t,
> + =A0 =A0 =A0 .power_off =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D gamecube_power_of=
f,
> + =A0 =A0 =A0 .halt =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D gamecube_halt=
,
> + =A0 =A0 =A0 .init_IRQ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D flipper_pic_probe=
,
> + =A0 =A0 =A0 .get_irq =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D flipper_pic_get=
_irq,
> + =A0 =A0 =A0 .calibrate_decr =A0 =A0 =A0 =A0 =3D generic_calibrate_decr,
> + =A0 =A0 =A0 .progress =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D udbg_progress,
> + =A0 =A0 =A0 .machine_shutdown =A0 =A0 =A0 =3D gamecube_shutdown,
> +#ifdef CONFIG_KEXEC
> + =A0 =A0 =A0 .machine_kexec_prepare =A0=3D gamecube_kexec_prepare,
> + =A0 =A0 =A0 .machine_kexec =A0 =A0 =A0 =A0 =A0=3D default_machine_kexec=
,
> +#endif
> +};
> +
> diff --git a/arch/powerpc/platforms/embedded6xx/gamecube_dev.c b/arch/pow=
erpc/platforms/embedded6xx/gamecube_dev.c
> new file mode 100644
> index 0000000..13e1f73
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/gamecube_dev.c
> @@ -0,0 +1,34 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/gamecube_dev.c
> + *
> + * Nintendo GameCube platform device setup.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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/kernel.h>
> +#include <linux/init.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/machdep.h>
> +
> +static struct of_device_id gamecube_of_bus[] =3D {
> + =A0 =A0 =A0 { .compatible =3D "nintendo,flipper", },
> + =A0 =A0 =A0 { },
> +};
> +
> +static int __init gamecube_device_probe(void)
> +{
> + =A0 =A0 =A0 if (!machine_is(gamecube))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +
> + =A0 =A0 =A0 of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
> + =A0 =A0 =A0 return 0;
> +}
> +device_initcall(gamecube_device_probe);
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions
  2009-11-22 22:01                           ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Albert Herranz
  2009-11-22 22:01                             ` [RFC PATCH 15/19] powerpc: broadway processor support Albert Herranz
@ 2009-11-22 23:36                             ` Grant Likely
  2009-11-23 20:16                               ` Albert Herranz
  1 sibling, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:36 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> The Nintendo Wii has two discontiguous RAM memory areas called
> MEM1 and MEM2.
> MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
> MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
> Between both memory address ranges there is an address space
> where memory-mapped I/O registers are found.
>
> Currently, Linux 32-bit PowerPC does not support RAM in
> discontiguous memory address spaces. Thus, in order to use
> both RAM areas, we declare as RAM the range from the start of
> MEM1 to the end of useable MEM2 and exclude the needed parts
> with /memreserve/ statements, at the expense of wasting a bit
> of memory.
>
> As a side effect, we need to allow ioremapping RAM areas
> because the I/O address space sits within the memreserve'd part
> of the declared RAM region.
> Note that this is not safe if the region ioremapped is covered
> by an existing BAT mapping used to map RAM, so this is
> specifically banned here.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
> =A0arch/powerpc/mm/pgtable_32.c | =A0 19 ++++++++++++++++---
> =A01 files changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
> index cb96cb2..ba00cb1 100644
> --- a/arch/powerpc/mm/pgtable_32.c
> +++ b/arch/powerpc/mm/pgtable_32.c
> @@ -191,9 +191,22 @@ __ioremap_caller(phys_addr_t addr, unsigned long siz=
e, unsigned long flags,
> =A0 =A0 =A0 =A0 * Don't allow anybody to remap normal RAM that we're usin=
g.
> =A0 =A0 =A0 =A0 * mem_init() sets high_memory so only do the check after =
that.
> =A0 =A0 =A0 =A0 */
> - =A0 =A0 =A0 if (mem_init_done && (p < virt_to_phys(high_memory))) {
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk("__ioremap(): phys addr 0x%llx is RA=
M lr %p\n",
> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long long)p, __bui=
ltin_return_address(0));
> + =A0 =A0 =A0 if (mem_init_done && (p < virt_to_phys(high_memory))
> +#ifdef CONFIG_WII
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* On some systems, though, we may want t=
o remap an area
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* declared as normal RAM that we have me=
mreserve'd at the
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* device tree. See wii.dts.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* But we can't do that safely if we are =
using BATs to map
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* part of that area.
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
> + =A0 =A0 =A0 =A0 =A0 && !__map_without_bats
> +#endif
> + =A0 =A0 =A0 =A0 =A0 ) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_WARNING
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"__ioremap(): phys addr 0x%l=
lx is RAM lr %p\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long long)p,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__builtin_return_address=
(0));

This could adversely affect multiplatform kernels.  I'd rather get the
RAM problem fixed and not hack up common code to work around the hack.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 15/19] powerpc: broadway processor support
  2009-11-22 22:01                             ` [RFC PATCH 15/19] powerpc: broadway processor support Albert Herranz
  2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
@ 2009-11-22 23:38                               ` Grant Likely
  2009-11-23 20:16                                 ` Albert Herranz
  1 sibling, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:38 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
> This patch extends the cputable entry of the 750CL to also match
> the 750CL-based "Broadway" cpu found on the Nintendo Wii.
>
> As of this patch, the following "Broadway" design revision levels have
> been seen in the wild:
> - DD1.2 (87102)
> - DD2.0 (87200)

Please respin without the reordering of CPU table entries.  If you
want to reorder, then do it in a separate patch.

g.

-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
  2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
@ 2009-11-22 23:40                                 ` Grant Likely
  2009-11-23 20:18                                   ` Albert Herranz
  2009-11-24 21:54                                 ` Segher Boessenkool
  2009-11-26  5:23                                 ` Benjamin Herrenschmidt
  3 siblings, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:40 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add support for the dual interrupt controller included in the "Hollywood"
> chipset of the Nintendo Wii video game console.
> This interrupt controller serves both the Broadway processor (as a cascad=
e)
> and the Starlet processor, and is used to manage interrupts for the
> non-classic hardware.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>

On brief glance...

Acked-by: Grant Likely <grant.likely@secretlab.ca>

> ---
> =A0arch/powerpc/platforms/embedded6xx/Kconfig =A0 =A0| =A0 =A05 +
> =A0arch/powerpc/platforms/embedded6xx/Makefile =A0 | =A0 =A01 +
> =A0arch/powerpc/platforms/embedded6xx/hlwd-pic.c | =A0238 +++++++++++++++=
++++++++++
> =A0arch/powerpc/platforms/embedded6xx/hlwd-pic.h | =A0 22 +++
> =A04 files changed, 266 insertions(+), 0 deletions(-)
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.c
> =A0create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.h
>
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/pl=
atforms/embedded6xx/Kconfig
> index efb2ea1..490f89e 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -122,3 +122,8 @@ config GAMECUBE
> =A0 =A0 =A0 =A0 =A0Select GAMECUBE if configuring for the Nintendo GameCu=
be.
> =A0 =A0 =A0 =A0 =A0More information at: <http://gc-linux.sourceforge.net/=
>
>
> +config HLWD_PIC
> + =A0 =A0 =A0 bool
> + =A0 =A0 =A0 depends on STARLET_MINI
> + =A0 =A0 =A0 default y
> +
> diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/p=
latforms/embedded6xx/Makefile
> index b0324ed..c1dcc54 100644
> --- a/arch/powerpc/platforms/embedded6xx/Makefile
> +++ b/arch/powerpc/platforms/embedded6xx/Makefile
> @@ -10,3 +10,4 @@ obj-$(CONFIG_PPC_C2K) =A0 =A0 =A0 =A0 +=3D c2k.o
> =A0obj-$(CONFIG_USBGECKO_UDBG) =A0 =A0+=3D usbgecko_udbg.o
> =A0obj-$(CONFIG_FLIPPER_PIC) =A0 =A0 =A0+=3D flipper-pic.o
> =A0obj-$(CONFIG_GAMECUBE) =A0 =A0 =A0 =A0 +=3D gamecube.o gamecube_dev.o
> +obj-$(CONFIG_HLWD_PIC) =A0 =A0 =A0 =A0 +=3D hlwd-pic.o
> diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc=
/platforms/embedded6xx/hlwd-pic.c
> new file mode 100644
> index 0000000..b024800
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
> @@ -0,0 +1,238 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/hlwd-pic.c
> + *
> + * Nintendo Wii "Hollywood" interrupt controller support.
> + * Copyright (C) 2009 The GameCube Linux Team
> + * Copyright (C) 2009 Albert Herranz
> + *
> + * 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.
> + *
> + */
> +#define DRV_MODULE_NAME "hlwd-pic"
> +#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
> +
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/irq.h>
> +#include <linux/of.h>
> +#include <asm/io.h>
> +
> +#include "hlwd-pic.h"
> +
> +#define HLWD_NR_IRQS =A0 32
> +
> +/*
> + * Each interrupt has a corresponding bit in both
> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
> + *
> + * Enabling/disabling an interrupt line involves asserting/clearing
> + * the corresponding bit in IMR. ACK'ing a request simply involves
> + * asserting the corresponding bit in ICR.
> + */
> +#define HW_BROADWAY_ICR =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x00
> +#define HW_BROADWAY_IMR =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00x04
> +
> +
> +/*
> + * IRQ chip hooks.
> + *
> + */
> +
> +static void hlwd_pic_mask_and_ack(unsigned int virq)
> +{
> + =A0 =A0 =A0 int irq =3D virq_to_hw(virq);
> + =A0 =A0 =A0 void __iomem *io_base =3D get_irq_chip_data(virq);
> +
> + =A0 =A0 =A0 clear_bit(irq, io_base + HW_BROADWAY_IMR);
> + =A0 =A0 =A0 set_bit(irq, io_base + HW_BROADWAY_ICR);
> +}
> +
> +static void hlwd_pic_ack(unsigned int virq)
> +{
> + =A0 =A0 =A0 int irq =3D virq_to_hw(virq);
> + =A0 =A0 =A0 void __iomem *io_base =3D get_irq_chip_data(virq);
> +
> + =A0 =A0 =A0 set_bit(irq, io_base + HW_BROADWAY_ICR);
> +}
> +
> +static void hlwd_pic_mask(unsigned int virq)
> +{
> + =A0 =A0 =A0 int irq =3D virq_to_hw(virq);
> + =A0 =A0 =A0 void __iomem *io_base =3D get_irq_chip_data(virq);
> +
> + =A0 =A0 =A0 clear_bit(irq, io_base + HW_BROADWAY_IMR);
> +}
> +
> +static void hlwd_pic_unmask(unsigned int virq)
> +{
> + =A0 =A0 =A0 int irq =3D virq_to_hw(virq);
> + =A0 =A0 =A0 void __iomem *io_base =3D get_irq_chip_data(virq);
> +
> + =A0 =A0 =A0 set_bit(irq, io_base + HW_BROADWAY_IMR);
> +}
> +
> +
> +static struct irq_chip hlwd_pic =3D {
> + =A0 =A0 =A0 .typename =A0 =A0 =A0 =3D "hlwd-pic",
> + =A0 =A0 =A0 .ack =A0 =A0 =A0 =A0 =A0 =A0=3D hlwd_pic_ack,
> + =A0 =A0 =A0 .mask_ack =A0 =A0 =A0 =3D hlwd_pic_mask_and_ack,
> + =A0 =A0 =A0 .mask =A0 =A0 =A0 =A0 =A0 =3D hlwd_pic_mask,
> + =A0 =A0 =A0 .unmask =A0 =A0 =A0 =A0 =3D hlwd_pic_unmask,
> +};
> +
> +/*
> + * IRQ host hooks.
> + *
> + */
> +
> +static struct irq_host *hlwd_irq_host;
> +
> +static int hlwd_pic_map(struct irq_host *h, unsigned int virq,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0irq_hw_number_t hwir=
q)
> +{
> + =A0 =A0 =A0 set_irq_chip_data(virq, h->host_data);
> + =A0 =A0 =A0 get_irq_desc(virq)->status |=3D IRQ_LEVEL;
> + =A0 =A0 =A0 set_irq_chip_and_handler(virq, &hlwd_pic, handle_level_irq)=
;
> + =A0 =A0 =A0 return 0;
> +}
> +
> +static void hlwd_pic_unmap(struct irq_host *h, unsigned int irq)
> +{
> + =A0 =A0 =A0 set_irq_chip_data(irq, NULL);
> + =A0 =A0 =A0 set_irq_chip(irq, NULL);
> +}
> +
> +static struct irq_host_ops hlwd_irq_host_ops =3D {
> + =A0 =A0 =A0 .map =3D hlwd_pic_map,
> + =A0 =A0 =A0 .unmap =3D hlwd_pic_unmap,
> +};
> +
> +static unsigned int __hlwd_pic_get_irq(struct irq_host *h)
> +{
> + =A0 =A0 =A0 void __iomem *io_base =3D h->host_data;
> + =A0 =A0 =A0 int irq;
> + =A0 =A0 =A0 u32 irq_status;
> +
> + =A0 =A0 =A0 irq_status =3D in_be32(io_base + HW_BROADWAY_ICR) &
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0in_be32(io_base + HW_BROADWAY_IM=
R);
> + =A0 =A0 =A0 if (irq_status =3D=3D 0)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return NO_IRQ_IGNORE; =A0 /* no more IRQs p=
ending */
> +
> + =A0 =A0 =A0 __asm__ __volatile__("cntlzw %0,%1" : "=3Dr"(irq) : "r"(irq=
_status));
> + =A0 =A0 =A0 return irq_linear_revmap(h, 31 - irq);
> +}
> +
> +static void hlwd_pic_irq_cascade(unsigned int cascade_virq,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 struct irq_desc *desc)
> +{
> + =A0 =A0 =A0 struct irq_host *irq_host =3D get_irq_data(cascade_virq);
> + =A0 =A0 =A0 unsigned int virq;
> +
> + =A0 =A0 =A0 spin_lock(&desc->lock);
> + =A0 =A0 =A0 desc->chip->mask(cascade_virq); /* IRQ_LEVEL */
> + =A0 =A0 =A0 spin_unlock(&desc->lock);
> +
> + =A0 =A0 =A0 virq =3D __hlwd_pic_get_irq(irq_host);
> + =A0 =A0 =A0 if (virq !=3D NO_IRQ_IGNORE)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 generic_handle_irq(virq);
> + =A0 =A0 =A0 else
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("spurious interrupt!\n");
> +
> + =A0 =A0 =A0 spin_lock(&desc->lock);
> + =A0 =A0 =A0 desc->chip->ack(cascade_virq); /* IRQ_LEVEL */
> + =A0 =A0 =A0 if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 desc->chip->unmask(cascade_virq);
> + =A0 =A0 =A0 spin_unlock(&desc->lock);
> +}
> +
> +/*
> + * Platform hooks.
> + *
> + */
> +
> +static void __hlwd_quiesce(void __iomem *io_base)
> +{
> + =A0 =A0 =A0 /* mask and ack all IRQs */
> + =A0 =A0 =A0 out_be32(io_base + HW_BROADWAY_IMR, 0);
> + =A0 =A0 =A0 out_be32(io_base + HW_BROADWAY_ICR, ~0);
> +}
> +
> +struct irq_host *hlwd_pic_init(struct device_node *np)
> +{
> + =A0 =A0 =A0 struct irq_host *irq_host;
> + =A0 =A0 =A0 struct resource res;
> + =A0 =A0 =A0 void __iomem *io_base;
> + =A0 =A0 =A0 int retval;
> +
> + =A0 =A0 =A0 retval =3D of_address_to_resource(np, 0, &res);
> + =A0 =A0 =A0 if (retval) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("no io memory range found\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return NULL;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 io_base =3D ioremap(res.start, resource_size(&res));
> + =A0 =A0 =A0 if (!io_base) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("ioremap failed\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return NULL;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 pr_info("controller at 0x%08x mapped to 0x%p\n", res.start,=
 io_base);
> +
> + =A0 =A0 =A0 __hlwd_quiesce(io_base);
> +
> + =A0 =A0 =A0 irq_host =3D irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, HLWD_N=
R_IRQS,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 &hlwd_i=
rq_host_ops, NO_IRQ_IGNORE);
> + =A0 =A0 =A0 if (!irq_host) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("failed to allocate irq_host\n");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return NULL;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 irq_host->host_data =3D io_base;
> +
> + =A0 =A0 =A0 return irq_host;
> +}
> +
> +unsigned int hlwd_pic_get_irq(void)
> +{
> + =A0 =A0 =A0 return __hlwd_pic_get_irq(hlwd_irq_host);
> +}
> +
> +/*
> + * Probe function.
> + *
> + */
> +
> +void hlwd_pic_probe(void)
> +{
> + =A0 =A0 =A0 struct irq_host *host;
> + =A0 =A0 =A0 struct device_node *np;
> + =A0 =A0 =A0 const u32 *interrupts;
> + =A0 =A0 =A0 int cascade_virq;
> +
> + =A0 =A0 =A0 for_each_compatible_node(np, NULL, "nintendo,hollywood-pic"=
) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D of_get_property(np, "interru=
pts", NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (interrupts) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 host =3D hlwd_pic_init(np);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 BUG_ON(!host);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cascade_virq =3D irq_of_par=
se_and_map(np, 0);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_irq_data(cascade_virq, =
host);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 set_irq_chained_handler(cas=
cade_virq,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=
 =A0 =A0 =A0 =A0 =A0 hlwd_pic_irq_cascade);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> + =A0 =A0 =A0 }
> +}
> +
> +/**
> + * hlwd_quiesce() - quiesce hollywood irq controller
> + *
> + * Mask and ack all interrupt sources.
> + *
> + */
> +void hlwd_quiesce(void)
> +{
> + =A0 =A0 =A0 void __iomem *io_base =3D hlwd_irq_host->host_data;
> +
> + =A0 =A0 =A0 __hlwd_quiesce(io_base);
> +}
> +
> diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.h b/arch/powerpc=
/platforms/embedded6xx/hlwd-pic.h
> new file mode 100644
> index 0000000..d2e5a09
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.h
> @@ -0,0 +1,22 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/hlwd-pic.h
> + *
> + * Nintendo Wii "Hollywood" interrupt controller support.
> + * Copyright (C) 2009 The GameCube Linux Team
> + * Copyright (C) 2009 Albert Herranz
> + *
> + * 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 __HLWD_PIC_H
> +#define __HLWD_PIC_H
> +
> +extern unsigned int hlwd_pic_get_irq(void);
> +extern void hlwd_pic_probe(void);
> +extern void hlwd_quiesce(void);
> +
> +#endif
> --
> 1.6.3.3
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>



--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 18/19] powerpc: wii: platform support
  2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
  2009-11-22 22:01                                     ` [RFC PATCH 19/19] powerpc: wii: default config Albert Herranz
@ 2009-11-22 23:45                                     ` Grant Likely
  2009-11-23 20:21                                       ` Albert Herranz
  2009-11-24 22:24                                     ` Segher Boessenkool
  2 siblings, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-22 23:45 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Add platform support for the Nintendo Wii video game console.
>
> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
> +static int wii_setup_hw_resets(void)
> +{
> + =A0 =A0 =A0 struct device_node *np;
> + =A0 =A0 =A0 struct resource res;
> + =A0 =A0 =A0 int error =3D -ENODEV;
> +
> + =A0 =A0 =A0 np =3D of_find_compatible_node(NULL, NULL, HW_RESETS_OF_COM=
PATIBLE);
> + =A0 =A0 =A0 if (!np) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("no compatible node found for %s\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0HW_RESETS_OF_COMPATIBLE);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 error =3D of_address_to_resource(np, 0, &res);
> + =A0 =A0 =A0 if (error) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("no valid reg found for %s\n", np->n=
ame);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_put;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 hw_resets =3D ioremap(res.start, res.end - res.start + 1);

Or you could use of_iomap() to cut out some code.

> + =A0 =A0 =A0 if (hw_resets) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_info("hw_resets at 0x%08x mapped to 0x%p=
\n",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 res.start, hw_resets);
> + =A0 =A0 =A0 }
> +
> +out_put:
> + =A0 =A0 =A0 of_node_put(np);
> +out:
> + =A0 =A0 =A0 return error;
> +}
> +
> +static int wii_setup_hw_gpio(void)
> +{
> + =A0 =A0 =A0 struct device_node *np;
> + =A0 =A0 =A0 struct resource res;
> + =A0 =A0 =A0 const char *path;
> + =A0 =A0 =A0 int error =3D -ENODEV;
> +
> + =A0 =A0 =A0 np =3D of_find_node_by_name(NULL, "aliases");
> + =A0 =A0 =A0 if (!np) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("unable to find node %s\n", "aliases=
");
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 path =3D of_get_property(np, HW_GPIO_ALIAS, NULL);
> + =A0 =A0 =A0 of_node_put(np);
> + =A0 =A0 =A0 if (!path) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("alias %s unknown\n", HW_GPIO_ALIAS)=
;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 np =3D of_find_node_by_path(path);
> + =A0 =A0 =A0 if (!np) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("node for alias %s unknown\n", HW_GP=
IO_ALIAS);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out;
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 error =3D of_address_to_resource(np, 0, &res);
> + =A0 =A0 =A0 if (error) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_err("no valid reg found for %s\n", np->n=
ame);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 goto out_put;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 hw_gpio =3D ioremap(res.start, res.end - res.start + 1);
> + =A0 =A0 =A0 if (hw_gpio) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 pr_info("hw_gpio at 0x%08x mapped to 0x%p\n=
",
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 res.start, hw_gpio);
> + =A0 =A0 =A0 }
> +
> +out_put:
> + =A0 =A0 =A0 of_node_put(np);
> +out:
> + =A0 =A0 =A0 return error;
> +}
> +
> +static void wii_setup(void)
> +{
> + =A0 =A0 =A0 wii_setup_hw_resets();
> + =A0 =A0 =A0 wii_setup_hw_gpio();
> +}
> +
> +static void wii_restart(char *cmd)
> +{
> + =A0 =A0 =A0 local_irq_disable();
> +
> + =A0 =A0 =A0 if (hw_resets) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* clear the system reset pin to cause a re=
set */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 clear_bit(0, hw_resets);
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 wii_spin();
> +}
> +
> +static void wii_power_off(void)
> +{
> + =A0 =A0 =A0 local_irq_disable();
> +
> + =A0 =A0 =A0 if (hw_gpio) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* make sure that the poweroff GPIO is conf=
igured as output */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 out_be32(hw_gpio + HW_GPIO_DIR,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0in_be32(hw_gpio + HW_GPI=
O_DIR) | HW_GPIO_SHUTDOWN);
> +
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /* drive the poweroff GPIO high */
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 out_be32(hw_gpio + HW_GPIO_OUT,
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0in_be32(hw_gpio + HW_GPI=
O_OUT) | HW_GPIO_SHUTDOWN);
> + =A0 =A0 =A0 }
> + =A0 =A0 =A0 wii_spin();
> +}
> +
> +#else
> +
> +static void wii_setup(void)
> +{
> +}
> +
> +static void wii_restart(char *cmd)
> +{
> + =A0 =A0 =A0 wii_spin();
> +}
> +
> +static void wii_power_off(void)
> +{
> + =A0 =A0 =A0 wii_spin();
> +}
> +
> +#endif /* CONFIG_STARLET_MINI */
> +
> +static void wii_halt(void)
> +{
> + =A0 =A0 =A0 if (ppc_md.restart)
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ppc_md.restart(NULL);
> + =A0 =A0 =A0 wii_spin();
> +}
> +
> +static void wii_show_cpuinfo(struct seq_file *m)
> +{
> + =A0 =A0 =A0 seq_printf(m, "vendor\t\t: IBM\n");
> + =A0 =A0 =A0 seq_printf(m, "machine\t\t: Nintendo Wii\n");
> +}

Drop show_cpuinfo() hook.

> +static int wii_discover_ipc_flavour(void)
> +{
> + =A0 =A0 =A0 struct mipc_infohdr *hdrp;
> + =A0 =A0 =A0 int error;
> +
> + =A0 =A0 =A0 error =3D mipc_infohdr_get(&hdrp);
> + =A0 =A0 =A0 if (!error) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 mipc_infohdr_put(hdrp);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 starlet_ipc_flavour =3D STARLET_IPC_MINI;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 wii_setup();
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ppc_md.restart =3D wii_restart;
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 ppc_md.power_off =3D wii_power_off;
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 return 0;
> +}
> +
> +static void __init wii_setup_arch(void)
> +{
> + =A0 =A0 =A0 ug_udbg_init();
> + =A0 =A0 =A0 wii_discover_ipc_flavour();
> +}
> +
> +static void __init wii_init_early(void)
> +{
> +}
> +
> +static int __init wii_probe(void)
> +{
> + =A0 =A0 =A0 unsigned long dt_root;
> +
> + =A0 =A0 =A0 dt_root =3D of_get_flat_dt_root();
> + =A0 =A0 =A0 if (!of_flat_dt_is_compatible(dt_root, "nintendo,wii"))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +
> + =A0 =A0 =A0 return 1;
> +}
> +
> +static void wii_shutdown(void)
> +{
> + =A0 =A0 =A0 flipper_quiesce();
> +}
> +
> +#ifdef CONFIG_KEXEC
> +static int wii_machine_kexec_prepare(struct kimage *image)
> +{
> + =A0 =A0 =A0 return 0;
> +}
> +
> +static void wii_machine_kexec(struct kimage *image)
> +{
> + =A0 =A0 =A0 default_machine_kexec(image);
> +}

Drop unnecessary hooks.  If no kexec hook it offered, then
default_machine_kexec() gets called anyway.

> +#endif /* CONFIG_KEXEC */

> +
> +define_machine(wii) {
> + =A0 =A0 =A0 .name =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D "wii",
> + =A0 =A0 =A0 .probe =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D wii_probe,
> + =A0 =A0 =A0 .setup_arch =A0 =A0 =A0 =A0 =A0 =A0 =3D wii_setup_arch,
> + =A0 =A0 =A0 .init_early =A0 =A0 =A0 =A0 =A0 =A0 =3D wii_init_early,
> + =A0 =A0 =A0 .show_cpuinfo =A0 =A0 =A0 =A0 =A0 =3D wii_show_cpuinfo,
> + =A0 =A0 =A0 .halt =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D wii_halt,
> + =A0 =A0 =A0 .init_IRQ =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D flipper_pic_probe=
,
> + =A0 =A0 =A0 .get_irq =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0=3D flipper_pic_get=
_irq,
> + =A0 =A0 =A0 .calibrate_decr =A0 =A0 =A0 =A0 =3D generic_calibrate_decr,
> + =A0 =A0 =A0 .progress =A0 =A0 =A0 =A0 =A0 =A0 =A0 =3D udbg_progress,
> + =A0 =A0 =A0 .machine_shutdown =A0 =A0 =A0 =3D wii_shutdown,
> +#ifdef CONFIG_KEXEC
> + =A0 =A0 =A0 .machine_kexec_prepare =A0=3D wii_machine_kexec_prepare,
> + =A0 =A0 =A0 .machine_kexec =A0 =A0 =A0 =A0 =A0=3D wii_machine_kexec,
> +#endif
> +};
> +
> diff --git a/arch/powerpc/platforms/embedded6xx/wii_dev.c b/arch/powerpc/=
platforms/embedded6xx/wii_dev.c
> new file mode 100644
> index 0000000..903063e
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/wii_dev.c
> @@ -0,0 +1,47 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/wii_dev.c
> + *
> + * Nintendo Wii platform device setup.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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/kernel.h>
> +#include <linux/init.h>
> +#include <linux/of_platform.h>
> +
> +#include <asm/machdep.h>
> +
> +static struct of_device_id wii_of_bus[] =3D {
> + =A0 =A0 =A0 { .compatible =3D "nintendo,hollywood", },
> +#ifdef CONFIG_STARLET_MINI
> + =A0 =A0 =A0 { .compatible =3D "twiizers,starlet-mini-ipc", },
> +#endif
> + =A0 =A0 =A0 { },
> +};
> +
> +static int __init wii_device_probe(void)
> +{
> + =A0 =A0 =A0 struct device_node *np;
> +
> + =A0 =A0 =A0 if (!machine_is(wii))
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 return 0;
> +
> + =A0 =A0 =A0 of_platform_bus_probe(NULL, wii_of_bus, NULL);
> +
> + =A0 =A0 =A0 np =3D of_find_compatible_node(NULL, NULL, "nintendo,hollyw=
ood-mem2");
> + =A0 =A0 =A0 if (np) {
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_platform_device_create(np, NULL, NULL);
> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 of_node_put(np);
> + =A0 =A0 =A0 }
> +
> + =A0 =A0 =A0 return 0;
> +}
> +device_initcall(wii_device_probe);

Why is this split into a separate file?  (Same comment goes for the
Gamecube version).  Just roll all the platform support into a single
file since there is no shared code.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support
  2009-11-22 22:01 [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Albert Herranz
                   ` (2 preceding siblings ...)
  2009-11-22 22:49 ` Arnd Bergmann
@ 2009-11-23  5:13 ` Wolfram Sang
  3 siblings, 0 replies; 181+ messages in thread
From: Wolfram Sang @ 2009-11-23  5:13 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

On Sun, Nov 22, 2009 at 11:01:31PM +0100, Albert Herranz wrote:
> The following patches add the base support for the Nintendo GameCube
> and Wii video game consoles on the powerpc arch.

Cool stuff! \o/

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms
  2009-11-22 22:20               ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Arnd Bergmann
@ 2009-11-23 19:06                 ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:06 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev

Arnd Bergmann wrote:
> On Sunday 22 November 2009, Albert Herranz wrote:
>>  config NOT_COHERENT_CACHE
>>         bool
>> -       depends on 4xx || 8xx || E200 || PPC_MPC512x
>> +       depends on 4xx || 8xx || E200 || PPC_MPC512x || GAMECUBE_COMMON
>>         default y
>>  
>>  config CHECK_CACHE_COHERENCY
>> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
>> index 97a2dbc..31487e4 100644
>> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
>> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
>> @@ -93,4 +93,5 @@ config MPC10X_STORE_GATHERING
>>  
>>  config GAMECUBE_COMMON
>>         bool
>> +       select NOT_COHERENT_CACHE
> 
> One of the two (depends and select) is enough. I'd just drop the 'select'
> line here.
> 
> 	Arnd <><
> 

Thanks, I'll fix that.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-22 22:27                     ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Arnd Bergmann
@ 2009-11-23 19:10                       ` Albert Herranz
  2009-11-23 22:13                         ` Arnd Bergmann
  2009-11-26  5:14                       ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:10 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev

Arnd Bergmann wrote:
> On Sunday 22 November 2009, Albert Herranz wrote:
>> +#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
>> +setup_usbgecko_bat:
>> +	/* prepare a BAT for early io */
>> +	lis	r8, 0x0c00
>> +	ori	r8, r8, 0x002a	/* uncached, guarded ,rw */
>> +	lis	r11, 0xcc00
>> +	ori	r11, r11, 0x3	/* 128K */
>> +#ifdef CONFIG_WII
>> +	oris	r8, r8, 0x0100
>> +	oris	r11, r11, 0x0100
>> +#endif
>> +	mtspr	SPRN_DBAT1L, r8
>> +	mtspr	SPRN_DBAT1U, r11
>> +	sync
>> +	isync
>> +	blr
>> +#endif
> 
> This will probably break other platforms if CONFIG_PPC_EARLY_DEBUG_USBGECKO
> is set. In general, we try hard to make it possible to build generic
> kernels for multiple systems, so it would be better to also add a runtime
> check here.
> 

Ok, I see the point.
But, what makes CONFIG_PPC_EARLY_DEBUG_USBGECKO case different from CONFIG_PPC_EARLY_DEBUG_CPM case here?

>> --- a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
>> +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
>> @@ -27,4 +27,10 @@ static inline void __init ug_udbg_init(void)
>>  
>>  #endif /* CONFIG_USBGECKO_UDBG */
>>  
>> +#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
>> +
>> +void __init udbg_init_usbgecko(void);
>> +
>> +#endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */
>> +
> 
> No need to enclose a declaration in #ifdef, better leave it there
> unconditionally, unless you have an alternative version, like
> 
> #ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
> void __init udbg_init_usbgecko(void);
> #else /* !CONFIG_PPC_EARLY_DEBUG_USBGECKO */
> static inline void udbg_init_usbgecko(void)
> {
> }
> #endif /* CONFIG_PPC_EARLY_DEBUG_USBGECKO */
> 
> That style is now more common than having additional #ifdefs
> in the code using the function.

I'll fix that too. Thanks.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support
  2009-11-22 22:48                                   ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Arnd Bergmann
@ 2009-11-23 19:21                                     ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:21 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev

Arnd Bergmann wrote:
> On Sunday 22 November 2009, Albert Herranz wrote:
>> + *
>> + */
>> +struct mipc_device {
>> +	void __iomem *io_base;
>> +	int irq;
>> +
>> +	struct device *dev;
>> +
>> +	spinlock_t call_lock;	/* serialize firmware calls */
>> +	spinlock_t io_lock;	/* serialize access to io registers */
>> +
>> +	struct mipc_infohdr *hdr;
>> +
>> +	struct mipc_req *in_ring;
>> +	size_t in_ring_size;
>> +	volatile u16 intail_idx;
>> +
>> +	struct mipc_req *out_ring;
>> +	size_t out_ring_size;
>> +	volatile u16 outhead_idx;
>> +
>> +	u32 tag;
>> +};
> 
> The 'volatile' here seems out of place. What are you trying to protect
> against?

Nothing. I'll get rid of it.
It slipped through from ancient versions of the patch.

> The rest of the patch seems to be made up of layers of wrappers. They
> are all well coded, but I got a feeling that the same could be achieved
> with less of it.

The code provides a complete emulation layer of hardware accessors via ipc calls to the firmware.
This was a requirement to access part of the hardware until a "magic" register was found allowing direct hardware access from the PowerPC side.

I can get rid of the currently unused infrastructure and leave the strictly needed code (i.e. code to make sure that the firmware SDHC driver is shutdown and that the ahbprot register is properly setup).

I'll look into that. Thanks.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support
  2009-11-22 22:49 ` Arnd Bergmann
@ 2009-11-23 19:22   ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:22 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: linuxppc-dev

Arnd Bergmann wrote:
> 
> Very nice series, well done!
> 
> Time for me to invest in some new hardware ;-)
> 
> 	Arnd <><
> 

Thanks for review :)

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-22 23:02     ` [RFC PATCH 02/19] powerpc: gamecube: device tree Grant Likely
@ 2009-11-23 19:44       ` Albert Herranz
  2009-11-23 20:19         ` Grant Likely
  2009-11-24 22:36       ` Segher Boessenkool
  2009-11-26  4:21       ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:44 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add a device tree source file for the Nintendo GameCube video game console.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> 
> Mostly looks good.  A few comments below.  Biggest comment is you need
> to add a brief blurb for every new "compatible" property value that
> you've added to Documentation/powerpc/dts-bindings.  General agreement
> is that we don't merge drivers with new OF tree bindings unless the
> binding is also documented.  It doesn't need to be long, it just needs
> to state what the device is, and what properties are expected.  If you
> define new properties, then you need to state what they are used for.
> 
> Once the comments below are addressed...
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> 

Thanks. I'll add the documentation for the new compatible properties.

>> ---
>>  arch/powerpc/boot/dts/gamecube.dts |  135 ++++++++++++++++++++++++++++++++++++
>>  1 files changed, 135 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/powerpc/boot/dts/gamecube.dts
>>
>> diff --git a/arch/powerpc/boot/dts/gamecube.dts b/arch/powerpc/boot/dts/gamecube.dts
>> new file mode 100644
>> index 0000000..941a2c4
>> --- /dev/null
>> +++ b/arch/powerpc/boot/dts/gamecube.dts
>> @@ -0,0 +1,135 @@
>> +/*
>> + * arch/powerpc/boot/dts/gamecube.dts
>> + *
>> + * Nintendo GameCube platform device tree source
>> + * Copyright (C) 2007-2009 The GameCube Linux Team
>> + * Copyright (C) 2007,2008,2009 Albert Herranz
>> + *
>> + * 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.
>> + *
>> + */
>> +
>> +/dts-v1/;
>> +
>> +/ {
>> +       model = "NintendoGameCube";
>> +       compatible = "nintendo,gamecube";
> 
> To date, we've been using the same form for both the model and
> compatible properties.  Specifically the <vendor>,<model> form to
> maintain the namespace.
> 

Ok, I'll change model to "nintendo,gamecube".

>> +       #address-cells = <1>;
>> +       #size-cells = <1>;
>> +
>> +       chosen {
>> +               bootargs = "root=/dev/gcnsda2 rootwait udbg-immortal";
>> +               linux,stdout-path = &USBGECKO0;
>> +       };
>> +
>> +       aliases {
>> +               ugecon = &USBGECKO0;
>> +       };
>> +
>> +       memory {
>> +               device_type = "memory";
>> +               /* 24M minus framebuffer memory area (640*576*2*2) */
>> +               reg = <0x00000000 0x01698000>;
>> +       };
>> +
>> +       cpus {
>> +               #address-cells = <1>;
>> +               #size-cells = <0>;
>> +
>> +               PowerPC,gekko@0 {
>> +                       device_type = "cpu";
>> +                       reg = <0>;
>> +                       clock-frequency = <486000000>; /* 486MHz */
>> +                       bus-frequency = <162000000>; /* 162MHz core-to-bus 3x */
>> +                       timebase-frequency = <40500000>; /* 162MHz / 4 */
>> +                       i-cache-line-size = <32>;
>> +                       d-cache-line-size = <32>;
>> +                       i-cache-size = <32768>;
>> +                       d-cache-size = <32768>;
>> +               };
>> +       };
>> +
>> +       /* devices contained int the flipper chipset */
>> +       soc {
> 
> It would be better to rename this as IMMR or the bus type.  This node
> doesn't actually describe the entire chip, but describes the internal
> memory mapped registers.
> 

Can you please elaborate more on this or point me to documentation?
The soc node here tries to represent the big multi-function chip that integrates most of the devices of the video game consoles ("Flipper" on the Nintendo GameCube and "Hollywood" on the Wii).

>> +               #address-cells = <1>;
>> +               #size-cells = <1>;
>> +               #interrupt-cells = <1>;
>> +               model = "flipper";
> 
> Drop the model property
> 

Ok, I'll fix that.

>> +               compatible = "nintendo,flipper";
>> +               clock-frequency = <162000000>; /* 162MHz */
>> +               ranges = <0x0c000000 0x0c000000 0x00010000>;
> 
> Since you're only doing 1:1 mappings; you could replace this with an
> empty "ranges;" property instead.
> 

Nice, didn't know about this. I'll do that.

>> +
>> +               video@0c002000 {
>> +                       compatible = "nintendo,flipper-video";
>> +                       reg = <0x0c002000 0x100>;
>> +                       interrupts = <8>;
>> +                       interrupt-parent = <&pic>;
> 
> Hint:  If you move the interrupt-parent property up to the root node,
> then you don't need to specify it in every single device node; it will
> just inherit from the parent.
> 

Got it. This makes a lot of sense here with a single interrupt controller.

>> +                       /* XFB is the eXternal FrameBuffer */
>> +                       xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
>> +                       xfb-size = <0x168000>;
> 
> Can 'xfb' be made a second tuple to the 'reg' property so that all the
> address mapping code works on it?  ie:
> 
> reg = <0x0c002000 0x100
>        0x01698000 0x168000>;
> 
> At the very least, it is wise to adopt the same form as the reg
> property when describing address ranges instead of splitting it into
> multiple properties.
> 

I'll look into moving xfb-* into the reg property.

>> +               };
>> +
>> +               pic: pic@0c003000 {
>> +                       #interrupt-cells = <1>;
>> +                       compatible = "nintendo,flipper-pic";
>> +                       reg = <0x0c003000 0x8>;
>> +                       interrupt-controller;
>> +               };
>> +
>> +               resetswitch@0c003000 {
>> +                       compatible = "nintendo,flipper-resetswitch";
>> +                       reg = <0x0c003000 0x4>;
>> +                       interrupts = <1>;
>> +                       interrupt-parent = <&pic>;
>> +               };
>> +
>> +               auxram@0c005000 {
>> +                       compatible = "nintendo,flipper-auxram";
>> +                       reg = <0x0c005000 0x200>;       /* DSP */
>> +                       interrupts = <6>;
>> +                       interrupt-parent = <&pic>;
>> +               };
>> +
>> +               audio@0c005000 {
>> +                       compatible = "nintendo,flipper-audio";
>> +                       reg = <0x0c005000 0x200         /* DSP */
>> +                              0x0c006c00 0x20>;        /* AI */
>> +                       interrupts = <6>;
>> +                       interrupt-parent = <&pic>;
>> +               };
>> +
>> +               disk@0c006000 {
>> +                       compatible = "nintendo,flipper-disk";
>> +                       reg = <0x0c006000 0x40>;
>> +                       interrupts = <2>;
>> +                       interrupt-parent = <&pic>;
>> +               };
>> +
>> +               serial@0c006400 {
>> +                       compatible = "nintendo,flipper-serial";
>> +                       reg = <0x0c006400 0x100>;
>> +                       interrupts = <3>;
>> +                       interrupt-parent = <&pic>;
>> +               };
>> +
>> +               /* External Interface bus */
>> +               exi@0c006800 {
>> +                       #address-cells = <1>;
>> +                       #size-cells = <1>;
>> +                       compatible = "nintendo,flipper-exi";
>> +                       reg = <0x0c006800 0x40>;
>> +                       interrupts = <4>;
>> +                       interrupt-parent = <&pic>;
>> +
>> +                       USBGECKO0: usbgecko@0c006814 {
>> +                               compatible = "usbgecko,usbgecko";
>> +                               reg = <0x0c006814 0x14>;
>> +                               virtual-reg = <0xcc006814>;
>> +                       };
>> +               };
>> +        };
>> +};
>> +

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-22 23:18         ` [RFC PATCH 04/19] powerpc: wii: device tree Grant Likely
@ 2009-11-23 19:54           ` Albert Herranz
  2009-11-23 20:36             ` Grant Likely
  2009-11-25 16:57             ` Segher Boessenkool
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:54 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add a device tree source file for the Nintendo Wii video game console.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> 
> Same comments apply here as for the gamecube.dts file, plus a few more below.
> 

Ok, I'll try to address them too here.

>> ---
>>  arch/powerpc/boot/dts/wii.dts |  244 +++++++++++++++++++++++++++++++++++++++++
>>  1 files changed, 244 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/powerpc/boot/dts/wii.dts
>>
>> diff --git a/arch/powerpc/boot/dts/wii.dts b/arch/powerpc/boot/dts/wii.dts
>> new file mode 100644
>> index 0000000..a30a804
>> --- /dev/null
>> +++ b/arch/powerpc/boot/dts/wii.dts
>> @@ -0,0 +1,244 @@
>> +/*
>> + * arch/powerpc/boot/dts/wii.dts
>> + *
>> + * Nintendo Wii platform device tree source
>> + * Copyright (C) 2008-2009 The GameCube Linux Team
>> + * Copyright (C) 2008,2009 Albert Herranz
>> + *
>> + * 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.
>> + *
>> + */
>> +
>> +/dts-v1/;
>> +
>> +/memreserve/ 0x01800000 0xe800000;     /* memory hole (includes I/O area) */
>> +/memreserve/ 0x10000000 0x0004000;     /* DSP RAM */
> 
> This bothers me... see below.
> 
>> +
>> +/ {
>> +       model = "NintendoWii";
>> +       compatible = "nintendo,wii";
>> +       #address-cells = <1>;
>> +       #size-cells = <1>;
>> +
>> +       chosen {
>> +               /* root filesystem on 2nd partition of SD card */
>> +               bootargs = "nobats root=/dev/mmcblk0p2 rootwait udbg-immortal";
>> +               linux,stdout-path = &USBGECKO0;
>> +       };
>> +
>> +       aliases {
>> +               ugecon = &USBGECKO0;
>> +               hw_gpio = &gpio1;
>> +       };
>> +
>> +       /*
>> +        * The Nintendo Wii has two discontiguous RAM memory areas called
>> +        * MEM1 and MEM2.
>> +        * MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
>> +        * MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
>> +        * Between both memory address ranges there is an address space
>> +        * where memory-mapped I/O registers are found.
>> +        *
>> +        * Currently, Linux 32-bit PowerPC does not support RAM in
>> +        * discontiguous memory address spaces. Thus, in order to use
>> +        * both RAM areas, we declare as RAM the range from the start of
>> +        * MEM1 to the end of useable MEM2 and exclude the needed parts
>> +        * with /memreserve/ statements, at the expense of wasting a bit
>> +        * of memory.
> 
> Hmmm.  It's not great practice to lie about hardware in the device
> tree.  Better to describe the memory correctly here, and if you have
> to work around Linux deficiencies, then do so in the platform support
> code (arch/platforms/*).  I won't NAK the patch over it (feel free to
> add my Acked-by line) because it doesn't impact other platforms, but
> it should be fixed.
> 

I'll try to workaround the limitation via a fixups function in the bootwrapper instead.

>> +               i2c-video {
>> +                       #address-cells = <1>;
>> +                       #size-cells = <0>;
>> +                       compatible = "virtual,i2c-gpio";
> 
> There isn't a documented binding for this.  Is there a driver for it?
> 

I have a driver for it. But it isn't yet published.

This is the documentation I wrote so far for the bindings.
Is there a standard for this?

Documentation/powerpc/dts-bindings/gpio/i2c.txt

GPIO-based I2C

Required properties:
- compatible : should be "virtual,i2c-gpio".
- gpios : should specify GPIOs used for SDA and SCL lines, in that order.
- sda-is-open-drain : should be non-zero if SDA gpio is open-drain.
- sda-enforce-dir : should be non-zero if SDA gpio must be configured for
                    input before reading and for output before writing.
- scl-is-open-drain : should be non-zero if SCL gpio is open-drain.
- scl-is-output-only : should be non-zero if SCL is an output gpio only.
- udelay : signal toggle delay. SCL frequency is (500 / udelay) kHz
- timeout : clock stretching timeout in milliseconds.

Example:

gpio0: hollywood-gpio@0d8000c0 {
        compatible = "nintendo,hollywood-gpio";
        reg = <0x0d8000c0 0x20>;
        gpio-controller;
        #gpio-cells = <2>;
 };

i2c-video {
        #address-cells = <1>;
        #size-cells = <0>;
        compatible = "virtual,i2c-gpio";

        gpios = <&gpio0 16 0    /* SDA line */
                 &gpio0 17 0    /* SCL line */
                >;
        sda-is-open-drain = <1>;
        sda-enforce-dir = <1>;
        scl-is-open-drain = <1>;
        scl-is-output-only = <1>;
        udelay = <2>;

        audio-video-encoder {
                compatible = "nintendo,wii-ave-rvl";
                reg = <0x70>;
        };
};

>> +
>> +                       gpios = <&gpio0  16 0 /* 31-15 */
>> +                                &gpio0  17 0 /* 31-14 */
>> +                               >;
>> +                       sda-is-open-drain = <1>;
>> +                       sda-enforce-dir = <1>;
>> +                       scl-is-open-drain = <1>;
>> +                       scl-is-output-only = <1>;
>> +                       udelay = <2>;
>> +
>> +                       audio-video-encoder {
>> +                               compatible = "nintendo,wii-ave-rvl";
>> +                               reg = <0x70>;
>> +                       };
>> +               };
>> +       };
>> +};
>> +

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-22 23:20             ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Grant Likely
@ 2009-11-23 19:56               ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:56 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add a config option GAMECUBE_COMMON to be used as a dependency for all
>> options common to the Nintendo GameCube and Wii video game consoles.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> 
> This could just be rolled into the first patch that uses it.  But
> otherwise; ACK.
> 
> g.
> 

Thanks. This one I prefer in a separate patch as a logical step, if that's not a problem.

>> ---
>>  arch/powerpc/platforms/embedded6xx/Kconfig |    4 ++++
>>  1 files changed, 4 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
>> index 291ac9d..97a2dbc 100644
>> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
>> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
>> @@ -90,3 +90,7 @@ config MPC10X_OPENPIC
>>  config MPC10X_STORE_GATHERING
>>        bool "Enable MPC10x store gathering"
>>        depends on MPC10X_BRIDGE
>> +
>> +config GAMECUBE_COMMON
>> +       bool
>> +

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-22 23:28                       ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Grant Likely
@ 2009-11-23 19:59                         ` Albert Herranz
  2009-11-26  5:18                         ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 19:59 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add support for the interrupt controller included in the "Flipper"
>> chipset of the Nintendo GameCube video game console.
>> The same interrupt controller is also present in the "Hollywood" chipset
>> of the Nintendo Wii.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
>> ---
>>  arch/powerpc/platforms/embedded6xx/Kconfig       |    6 +
>>  arch/powerpc/platforms/embedded6xx/Makefile      |    1 +
>>  arch/powerpc/platforms/embedded6xx/flipper-pic.c |  247 ++++++++++++++++++++++
>>  arch/powerpc/platforms/embedded6xx/flipper-pic.h |   25 +++
>>  4 files changed, 279 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.c
>>  create mode 100644 arch/powerpc/platforms/embedded6xx/flipper-pic.h
>>
>> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
>> index bfd88be..29a98c6 100644
>> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
>> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
>> @@ -94,6 +94,7 @@ config MPC10X_STORE_GATHERING
>>  config GAMECUBE_COMMON
>>        bool
>>        select NOT_COHERENT_CACHE
>> +       select FLIPPER_PIC
>>
>>  config USBGECKO_UDBG
>>        bool "USB Gecko udbg console for the Nintendo GameCube/Wii"
>> @@ -108,3 +109,8 @@ config USBGECKO_UDBG
>>
>>          If in doubt, say N here.
>>
>> +config FLIPPER_PIC
>> +       bool
>> +       depends on GAMECUBE_COMMON
>> +       default y
> 
> You'll always want this driver when GAMECUBE common is set.  Don't add
> another Kconfig entry.
> 

Ok.

>> +
>> diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
>> index 0ab7492..35258fd 100644
>> --- a/arch/powerpc/platforms/embedded6xx/Makefile
>> +++ b/arch/powerpc/platforms/embedded6xx/Makefile
>> @@ -8,3 +8,4 @@ obj-$(CONFIG_PPC_HOLLY)         += holly.o
>>  obj-$(CONFIG_PPC_PRPMC2800)    += prpmc2800.o
>>  obj-$(CONFIG_PPC_C2K)          += c2k.o
>>  obj-$(CONFIG_USBGECKO_UDBG)    += usbgecko_udbg.o
>> +obj-$(CONFIG_FLIPPER_PIC)      += flipper-pic.o
> 
>> +unsigned int flipper_pic_get_irq(void)
>> +{
>> +       void __iomem *io_base = flipper_irq_host->host_data;
>> +       int irq;
>> +       u32 irq_status;
>> +
>> +       irq_status = in_be32(io_base + FLIPPER_ICR) &
>> +                    in_be32(io_base + FLIPPER_IMR);
>> +       if (irq_status == 0)
>> +               return -1;      /* no more IRQs pending */
> 
> NO_IRQ_IGNORE
> 

I'll fix that. Thanks.
I did it in the other interrupt controller but forgot about this.

>> +
>> +       __asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
>> +       return irq_linear_revmap(flipper_irq_host, 31 - irq);
>> +}
>> +
> 

Thanks.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-22 23:34                         ` [RFC PATCH 12/19] powerpc: gamecube: platform support Grant Likely
@ 2009-11-23 20:02                           ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 20:02 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add platform support for the Nintendo GameCube video game console.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
>> ---
>> +static void gamecube_show_cpuinfo(struct seq_file *m)
>> +{
>> +       seq_printf(m, "vendor\t\t: IBM\n");
>> +       seq_printf(m, "machine\t\t: Nintendo GameCube\n");
>> +}
> 
> show_cpuinfo hooks have been dropped on most platforms now.
> 

I'll drop'em all. Thanks.

>> +static void gamecube_shutdown(void)
>> +{
>> +       /* currently not used */
>> +}
> 
> Then don't add the hook.  Just drop it.  Same for other empty
> functions in this file.  If it is safe to drop them, then please do.
> 
> Otherwise: Acked-by: Grant Likely <grant.likely@secretlab.ca>
> 

I actually forgot to add a flipper_quiesce() call there.
That one will be used.

But I'll review the other cases. Thanks.

>> +define_machine(gamecube) {
>> +       .name                   = "gamecube",
>> +       .probe                  = gamecube_probe,
>> +       .setup_arch             = gamecube_setup_arch,
>> +       .init_early             = gamecube_init_early,
>> +       .show_cpuinfo           = gamecube_show_cpuinfo,
>> +       .restart                = gamecube_restart,
>> +       .power_off              = gamecube_power_off,
>> +       .halt                   = gamecube_halt,
>> +       .init_IRQ               = flipper_pic_probe,
>> +       .get_irq                = flipper_pic_get_irq,
>> +       .calibrate_decr         = generic_calibrate_decr,
>> +       .progress               = udbg_progress,
>> +       .machine_shutdown       = gamecube_shutdown,
>> +#ifdef CONFIG_KEXEC
>> +       .machine_kexec_prepare  = gamecube_kexec_prepare,
>> +       .machine_kexec          = default_machine_kexec,
>> +#endif
>> +};
>> +
>> diff --git a/arch/powerpc/platforms/embedded6xx/gamecube_dev.c b/arch/powerpc/platforms/embedded6xx/gamecube_dev.c
>> new file mode 100644
>> index 0000000..13e1f73
>> --- /dev/null
>> +++ b/arch/powerpc/platforms/embedded6xx/gamecube_dev.c
>> @@ -0,0 +1,34 @@
>> +/*
>> + * arch/powerpc/platforms/embedded6xx/gamecube_dev.c
>> + *
>> + * Nintendo GameCube platform device setup.
>> + * Copyright (C) 2008-2009 The GameCube Linux Team
>> + * Copyright (C) 2008,2009 Albert Herranz
>> + *
>> + * 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/kernel.h>
>> +#include <linux/init.h>
>> +#include <linux/of_platform.h>
>> +
>> +#include <asm/machdep.h>
>> +
>> +static struct of_device_id gamecube_of_bus[] = {
>> +       { .compatible = "nintendo,flipper", },
>> +       { },
>> +};
>> +
>> +static int __init gamecube_device_probe(void)
>> +{
>> +       if (!machine_is(gamecube))
>> +               return 0;
>> +
>> +       of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
>> +       return 0;
>> +}
>> +device_initcall(gamecube_device_probe);

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-22 23:36                             ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Grant Likely
@ 2009-11-23 20:16                               ` Albert Herranz
  2009-11-23 20:41                                 ` Grant Likely
  2009-11-23 23:45                                 ` Michael Ellerman
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 20:16 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> The Nintendo Wii has two discontiguous RAM memory areas called
>> MEM1 and MEM2.
>> MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
>> MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
>> Between both memory address ranges there is an address space
>> where memory-mapped I/O registers are found.
>>
>> Currently, Linux 32-bit PowerPC does not support RAM in
>> discontiguous memory address spaces. Thus, in order to use
>> both RAM areas, we declare as RAM the range from the start of
>> MEM1 to the end of useable MEM2 and exclude the needed parts
>> with /memreserve/ statements, at the expense of wasting a bit
>> of memory.
>>
>> As a side effect, we need to allow ioremapping RAM areas
>> because the I/O address space sits within the memreserve'd part
>> of the declared RAM region.
>> Note that this is not safe if the region ioremapped is covered
>> by an existing BAT mapping used to map RAM, so this is
>> specifically banned here.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
>> ---
>>  arch/powerpc/mm/pgtable_32.c |   19 ++++++++++++++++---
>>  1 files changed, 16 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
>> index cb96cb2..ba00cb1 100644
>> --- a/arch/powerpc/mm/pgtable_32.c
>> +++ b/arch/powerpc/mm/pgtable_32.c
>> @@ -191,9 +191,22 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
>>         * Don't allow anybody to remap normal RAM that we're using.
>>         * mem_init() sets high_memory so only do the check after that.
>>         */
>> -       if (mem_init_done && (p < virt_to_phys(high_memory))) {
>> -               printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
>> -                      (unsigned long long)p, __builtin_return_address(0));
>> +       if (mem_init_done && (p < virt_to_phys(high_memory))
>> +#ifdef CONFIG_WII
>> +               /*
>> +                * On some systems, though, we may want to remap an area
>> +                * declared as normal RAM that we have memreserve'd at the
>> +                * device tree. See wii.dts.
>> +                * But we can't do that safely if we are using BATs to map
>> +                * part of that area.
>> +                */
>> +           && !__map_without_bats
>> +#endif
>> +           ) {
>> +               printk(KERN_WARNING
>> +                      "__ioremap(): phys addr 0x%llx is RAM lr %p\n",
>> +                      (unsigned long long)p,
>> +                        __builtin_return_address(0));
> 
> This could adversely affect multiplatform kernels.  I'd rather get the
> RAM problem fixed and not hack up common code to work around the hack.
> 
> g.
> 

Would it be acceptable to create a global var __allow_ioremap_normal_ram that by default would have a value of 0 and would be set _only_ for those platforms needing it?

The other solutions I see is:
- add support for discontiguous memory to powerpc 32-bits (which is not something that I can look into now)
- don't use the precious second 64MB area (which is a waste)

Do you have any other suggestions?

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 15/19] powerpc: broadway processor support
  2009-11-22 23:38                               ` [RFC PATCH 15/19] powerpc: broadway processor support Grant Likely
@ 2009-11-23 20:16                                 ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 20:16 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> This patch extends the cputable entry of the 750CL to also match
>> the 750CL-based "Broadway" cpu found on the Nintendo Wii.
>>
>> As of this patch, the following "Broadway" design revision levels have
>> been seen in the wild:
>> - DD1.2 (87102)
>> - DD2.0 (87200)
> 
> Please respin without the reordering of CPU table entries.  If you
> want to reorder, then do it in a separate patch.
> 
> g.
> 

Ok. I'll look into that too. Thanks.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-22 23:40                                 ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Grant Likely
@ 2009-11-23 20:18                                   ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 20:18 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add support for the dual interrupt controller included in the "Hollywood"
>> chipset of the Nintendo Wii video game console.
>> This interrupt controller serves both the Broadway processor (as a cascade)
>> and the Starlet processor, and is used to manage interrupts for the
>> non-classic hardware.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> 
> On brief glance...
> 
> Acked-by: Grant Likely <grant.likely@secretlab.ca>
> 

Uhmmm... I think I should use .name instead of .typename in struct irq_chip, no?

>> ---
>>  arch/powerpc/platforms/embedded6xx/Kconfig    |    5 +
>>  arch/powerpc/platforms/embedded6xx/Makefile   |    1 +
>>  arch/powerpc/platforms/embedded6xx/hlwd-pic.c |  238 +++++++++++++++++++++++++
>>  arch/powerpc/platforms/embedded6xx/hlwd-pic.h |   22 +++
>>  4 files changed, 266 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.c
>>  create mode 100644 arch/powerpc/platforms/embedded6xx/hlwd-pic.h
>>
>> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
>> index efb2ea1..490f89e 100644
>> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
>> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
>> @@ -122,3 +122,8 @@ config GAMECUBE
>>          Select GAMECUBE if configuring for the Nintendo GameCube.
>>          More information at: <http://gc-linux.sourceforge.net/>
>>
>> +config HLWD_PIC
>> +       bool
>> +       depends on STARLET_MINI
>> +       default y
>> +
>> diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
>> index b0324ed..c1dcc54 100644
>> --- a/arch/powerpc/platforms/embedded6xx/Makefile
>> +++ b/arch/powerpc/platforms/embedded6xx/Makefile
>> @@ -10,3 +10,4 @@ obj-$(CONFIG_PPC_C2K)         += c2k.o
>>  obj-$(CONFIG_USBGECKO_UDBG)    += usbgecko_udbg.o
>>  obj-$(CONFIG_FLIPPER_PIC)      += flipper-pic.o
>>  obj-$(CONFIG_GAMECUBE)         += gamecube.o gamecube_dev.o
>> +obj-$(CONFIG_HLWD_PIC)         += hlwd-pic.o
>> diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.c b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
>> new file mode 100644
>> index 0000000..b024800
>> --- /dev/null
>> +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.c
>> @@ -0,0 +1,238 @@
>> +/*
>> + * arch/powerpc/platforms/embedded6xx/hlwd-pic.c
>> + *
>> + * Nintendo Wii "Hollywood" interrupt controller support.
>> + * Copyright (C) 2009 The GameCube Linux Team
>> + * Copyright (C) 2009 Albert Herranz
>> + *
>> + * 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.
>> + *
>> + */
>> +#define DRV_MODULE_NAME "hlwd-pic"
>> +#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
>> +
>> +#include <linux/kernel.h>
>> +#include <linux/init.h>
>> +#include <linux/irq.h>
>> +#include <linux/of.h>
>> +#include <asm/io.h>
>> +
>> +#include "hlwd-pic.h"
>> +
>> +#define HLWD_NR_IRQS   32
>> +
>> +/*
>> + * Each interrupt has a corresponding bit in both
>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>> + *
>> + * Enabling/disabling an interrupt line involves asserting/clearing
>> + * the corresponding bit in IMR. ACK'ing a request simply involves
>> + * asserting the corresponding bit in ICR.
>> + */
>> +#define HW_BROADWAY_ICR                0x00
>> +#define HW_BROADWAY_IMR                0x04
>> +
>> +
>> +/*
>> + * IRQ chip hooks.
>> + *
>> + */
>> +
>> +static void hlwd_pic_mask_and_ack(unsigned int virq)
>> +{
>> +       int irq = virq_to_hw(virq);
>> +       void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +       clear_bit(irq, io_base + HW_BROADWAY_IMR);
>> +       set_bit(irq, io_base + HW_BROADWAY_ICR);
>> +}
>> +
>> +static void hlwd_pic_ack(unsigned int virq)
>> +{
>> +       int irq = virq_to_hw(virq);
>> +       void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +       set_bit(irq, io_base + HW_BROADWAY_ICR);
>> +}
>> +
>> +static void hlwd_pic_mask(unsigned int virq)
>> +{
>> +       int irq = virq_to_hw(virq);
>> +       void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +       clear_bit(irq, io_base + HW_BROADWAY_IMR);
>> +}
>> +
>> +static void hlwd_pic_unmask(unsigned int virq)
>> +{
>> +       int irq = virq_to_hw(virq);
>> +       void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +       set_bit(irq, io_base + HW_BROADWAY_IMR);
>> +}
>> +
>> +
>> +static struct irq_chip hlwd_pic = {
>> +       .typename       = "hlwd-pic",
>> +       .ack            = hlwd_pic_ack,
>> +       .mask_ack       = hlwd_pic_mask_and_ack,
>> +       .mask           = hlwd_pic_mask,
>> +       .unmask         = hlwd_pic_unmask,
>> +};
>> +
>> +/*
>> + * IRQ host hooks.
>> + *
>> + */
>> +
>> +static struct irq_host *hlwd_irq_host;
>> +
>> +static int hlwd_pic_map(struct irq_host *h, unsigned int virq,
>> +                          irq_hw_number_t hwirq)
>> +{
>> +       set_irq_chip_data(virq, h->host_data);
>> +       get_irq_desc(virq)->status |= IRQ_LEVEL;
>> +       set_irq_chip_and_handler(virq, &hlwd_pic, handle_level_irq);
>> +       return 0;
>> +}
>> +
>> +static void hlwd_pic_unmap(struct irq_host *h, unsigned int irq)
>> +{
>> +       set_irq_chip_data(irq, NULL);
>> +       set_irq_chip(irq, NULL);
>> +}
>> +
>> +static struct irq_host_ops hlwd_irq_host_ops = {
>> +       .map = hlwd_pic_map,
>> +       .unmap = hlwd_pic_unmap,
>> +};
>> +
>> +static unsigned int __hlwd_pic_get_irq(struct irq_host *h)
>> +{
>> +       void __iomem *io_base = h->host_data;
>> +       int irq;
>> +       u32 irq_status;
>> +
>> +       irq_status = in_be32(io_base + HW_BROADWAY_ICR) &
>> +                    in_be32(io_base + HW_BROADWAY_IMR);
>> +       if (irq_status == 0)
>> +               return NO_IRQ_IGNORE;   /* no more IRQs pending */
>> +
>> +       __asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
>> +       return irq_linear_revmap(h, 31 - irq);
>> +}
>> +
>> +static void hlwd_pic_irq_cascade(unsigned int cascade_virq,
>> +                                     struct irq_desc *desc)
>> +{
>> +       struct irq_host *irq_host = get_irq_data(cascade_virq);
>> +       unsigned int virq;
>> +
>> +       spin_lock(&desc->lock);
>> +       desc->chip->mask(cascade_virq); /* IRQ_LEVEL */
>> +       spin_unlock(&desc->lock);
>> +
>> +       virq = __hlwd_pic_get_irq(irq_host);
>> +       if (virq != NO_IRQ_IGNORE)
>> +               generic_handle_irq(virq);
>> +       else
>> +               pr_err("spurious interrupt!\n");
>> +
>> +       spin_lock(&desc->lock);
>> +       desc->chip->ack(cascade_virq); /* IRQ_LEVEL */
>> +       if (!(desc->status & IRQ_DISABLED) && desc->chip->unmask)
>> +               desc->chip->unmask(cascade_virq);
>> +       spin_unlock(&desc->lock);
>> +}
>> +
>> +/*
>> + * Platform hooks.
>> + *
>> + */
>> +
>> +static void __hlwd_quiesce(void __iomem *io_base)
>> +{
>> +       /* mask and ack all IRQs */
>> +       out_be32(io_base + HW_BROADWAY_IMR, 0);
>> +       out_be32(io_base + HW_BROADWAY_ICR, ~0);
>> +}
>> +
>> +struct irq_host *hlwd_pic_init(struct device_node *np)
>> +{
>> +       struct irq_host *irq_host;
>> +       struct resource res;
>> +       void __iomem *io_base;
>> +       int retval;
>> +
>> +       retval = of_address_to_resource(np, 0, &res);
>> +       if (retval) {
>> +               pr_err("no io memory range found\n");
>> +               return NULL;
>> +       }
>> +       io_base = ioremap(res.start, resource_size(&res));
>> +       if (!io_base) {
>> +               pr_err("ioremap failed\n");
>> +               return NULL;
>> +       }
>> +
>> +       pr_info("controller at 0x%08x mapped to 0x%p\n", res.start, io_base);
>> +
>> +       __hlwd_quiesce(io_base);
>> +
>> +       irq_host = irq_alloc_host(np, IRQ_HOST_MAP_LINEAR, HLWD_NR_IRQS,
>> +                                 &hlwd_irq_host_ops, NO_IRQ_IGNORE);
>> +       if (!irq_host) {
>> +               pr_err("failed to allocate irq_host\n");
>> +               return NULL;
>> +       }
>> +       irq_host->host_data = io_base;
>> +
>> +       return irq_host;
>> +}
>> +
>> +unsigned int hlwd_pic_get_irq(void)
>> +{
>> +       return __hlwd_pic_get_irq(hlwd_irq_host);
>> +}
>> +
>> +/*
>> + * Probe function.
>> + *
>> + */
>> +
>> +void hlwd_pic_probe(void)
>> +{
>> +       struct irq_host *host;
>> +       struct device_node *np;
>> +       const u32 *interrupts;
>> +       int cascade_virq;
>> +
>> +       for_each_compatible_node(np, NULL, "nintendo,hollywood-pic") {
>> +               interrupts = of_get_property(np, "interrupts", NULL);
>> +               if (interrupts) {
>> +                       host = hlwd_pic_init(np);
>> +                       BUG_ON(!host);
>> +                       cascade_virq = irq_of_parse_and_map(np, 0);
>> +                       set_irq_data(cascade_virq, host);
>> +                       set_irq_chained_handler(cascade_virq,
>> +                                               hlwd_pic_irq_cascade);
>> +               }
>> +       }
>> +}
>> +
>> +/**
>> + * hlwd_quiesce() - quiesce hollywood irq controller
>> + *
>> + * Mask and ack all interrupt sources.
>> + *
>> + */
>> +void hlwd_quiesce(void)
>> +{
>> +       void __iomem *io_base = hlwd_irq_host->host_data;
>> +
>> +       __hlwd_quiesce(io_base);
>> +}
>> +
>> diff --git a/arch/powerpc/platforms/embedded6xx/hlwd-pic.h b/arch/powerpc/platforms/embedded6xx/hlwd-pic.h
>> new file mode 100644
>> index 0000000..d2e5a09
>> --- /dev/null
>> +++ b/arch/powerpc/platforms/embedded6xx/hlwd-pic.h
>> @@ -0,0 +1,22 @@
>> +/*
>> + * arch/powerpc/platforms/embedded6xx/hlwd-pic.h
>> + *
>> + * Nintendo Wii "Hollywood" interrupt controller support.
>> + * Copyright (C) 2009 The GameCube Linux Team
>> + * Copyright (C) 2009 Albert Herranz
>> + *
>> + * 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 __HLWD_PIC_H
>> +#define __HLWD_PIC_H
>> +
>> +extern unsigned int hlwd_pic_get_irq(void);
>> +extern void hlwd_pic_probe(void);
>> +extern void hlwd_quiesce(void);
>> +
>> +#endif
>> --
>> 1.6.3.3
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>>
> 
> 
> 

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-23 19:44       ` Albert Herranz
@ 2009-11-23 20:19         ` Grant Likely
  2009-11-23 20:25           ` Albert Herranz
                             ` (2 more replies)
  0 siblings, 3 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-23 20:19 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Mon, Nov 23, 2009 at 12:44 PM, Albert Herranz
<albert_herranz@yahoo.es> wrote:
> Grant Likely wrote:
>> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es=
> wrote:
>>> + =A0 =A0 =A0 /* devices contained int the flipper chipset */
>>> + =A0 =A0 =A0 soc {
>>
>> It would be better to rename this as IMMR or the bus type. =A0This node
>> doesn't actually describe the entire chip, but describes the internal
>> memory mapped registers.
>>
>
> Can you please elaborate more on this or point me to documentation?
> The soc node here tries to represent the big multi-function chip that int=
egrates most of the devices of the video game consoles ("Flipper" on the Ni=
ntendo GameCube and "Hollywood" on the Wii).

Right.  Much like many other SoCs.  However, the SoC has all these
devices + the cpu core + the memory controller, and probably some
other stuff.  Whereas this particular node only encapsulates the
integrated peripherals on an internal bus, so the node really is
describing the internal bus, not the entire SoC.  On some chips it is
documented as the "internally memory mapped registers", or IMMR.  So,
it is better to name this node in a way that reflects what it is (an
internal bus) instead of as the whole chip.

Similarly, it is better to use a compatible value of something like:
compatible =3D "nintendo,flipper-immr"; (instead of "nintendo,flipper")
because your describing just the internal bus, not the entire chip.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 18/19] powerpc: wii: platform support
  2009-11-22 23:45                                     ` [RFC PATCH 18/19] powerpc: wii: platform support Grant Likely
@ 2009-11-23 20:21                                       ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 20:21 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
>> Add platform support for the Nintendo Wii video game console.
>>
>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
>> ---
>> +static int wii_setup_hw_resets(void)
>> +{
>> +       struct device_node *np;
>> +       struct resource res;
>> +       int error = -ENODEV;
>> +
>> +       np = of_find_compatible_node(NULL, NULL, HW_RESETS_OF_COMPATIBLE);
>> +       if (!np) {
>> +               pr_err("no compatible node found for %s\n",
>> +                      HW_RESETS_OF_COMPATIBLE);
>> +               goto out;
>> +       }
>> +       error = of_address_to_resource(np, 0, &res);
>> +       if (error) {
>> +               pr_err("no valid reg found for %s\n", np->name);
>> +               goto out_put;
>> +       }
>> +
>> +       hw_resets = ioremap(res.start, res.end - res.start + 1);
> 
> Or you could use of_iomap() to cut out some code.
> 

Thanks. I'll have a look at it.

>> +       if (hw_resets) {
>> +               pr_info("hw_resets at 0x%08x mapped to 0x%p\n",
>> +                       res.start, hw_resets);
>> +       }
>> +
>> +out_put:
>> +       of_node_put(np);
>> +out:
>> +       return error;
>> +}
>> +
>> +static int wii_setup_hw_gpio(void)
>> +{
>> +       struct device_node *np;
>> +       struct resource res;
>> +       const char *path;
>> +       int error = -ENODEV;
>> +
>> +       np = of_find_node_by_name(NULL, "aliases");
>> +       if (!np) {
>> +               pr_err("unable to find node %s\n", "aliases");
>> +               goto out;
>> +       }
>> +
>> +       path = of_get_property(np, HW_GPIO_ALIAS, NULL);
>> +       of_node_put(np);
>> +       if (!path) {
>> +               pr_err("alias %s unknown\n", HW_GPIO_ALIAS);
>> +               goto out;
>> +       }
>> +
>> +       np = of_find_node_by_path(path);
>> +       if (!np) {
>> +               pr_err("node for alias %s unknown\n", HW_GPIO_ALIAS);
>> +               goto out;
>> +       }
>> +       error = of_address_to_resource(np, 0, &res);
>> +       if (error) {
>> +               pr_err("no valid reg found for %s\n", np->name);
>> +               goto out_put;
>> +       }
>> +
>> +       hw_gpio = ioremap(res.start, res.end - res.start + 1);
>> +       if (hw_gpio) {
>> +               pr_info("hw_gpio at 0x%08x mapped to 0x%p\n",
>> +                       res.start, hw_gpio);
>> +       }
>> +
>> +out_put:
>> +       of_node_put(np);
>> +out:
>> +       return error;
>> +}
>> +
>> +static void wii_setup(void)
>> +{
>> +       wii_setup_hw_resets();
>> +       wii_setup_hw_gpio();
>> +}
>> +
>> +static void wii_restart(char *cmd)
>> +{
>> +       local_irq_disable();
>> +
>> +       if (hw_resets) {
>> +               /* clear the system reset pin to cause a reset */
>> +               clear_bit(0, hw_resets);
>> +       }
>> +       wii_spin();
>> +}
>> +
>> +static void wii_power_off(void)
>> +{
>> +       local_irq_disable();
>> +
>> +       if (hw_gpio) {
>> +               /* make sure that the poweroff GPIO is configured as output */
>> +               out_be32(hw_gpio + HW_GPIO_DIR,
>> +                        in_be32(hw_gpio + HW_GPIO_DIR) | HW_GPIO_SHUTDOWN);
>> +
>> +               /* drive the poweroff GPIO high */
>> +               out_be32(hw_gpio + HW_GPIO_OUT,
>> +                        in_be32(hw_gpio + HW_GPIO_OUT) | HW_GPIO_SHUTDOWN);
>> +       }
>> +       wii_spin();
>> +}
>> +
>> +#else
>> +
>> +static void wii_setup(void)
>> +{
>> +}
>> +
>> +static void wii_restart(char *cmd)
>> +{
>> +       wii_spin();
>> +}
>> +
>> +static void wii_power_off(void)
>> +{
>> +       wii_spin();
>> +}
>> +
>> +#endif /* CONFIG_STARLET_MINI */
>> +
>> +static void wii_halt(void)
>> +{
>> +       if (ppc_md.restart)
>> +               ppc_md.restart(NULL);
>> +       wii_spin();
>> +}
>> +
>> +static void wii_show_cpuinfo(struct seq_file *m)
>> +{
>> +       seq_printf(m, "vendor\t\t: IBM\n");
>> +       seq_printf(m, "machine\t\t: Nintendo Wii\n");
>> +}
> 
> Drop show_cpuinfo() hook.
> 

Yup.

>> +static int wii_discover_ipc_flavour(void)
>> +{
>> +       struct mipc_infohdr *hdrp;
>> +       int error;
>> +
>> +       error = mipc_infohdr_get(&hdrp);
>> +       if (!error) {
>> +               mipc_infohdr_put(hdrp);
>> +               starlet_ipc_flavour = STARLET_IPC_MINI;
>> +               wii_setup();
>> +               ppc_md.restart = wii_restart;
>> +               ppc_md.power_off = wii_power_off;
>> +       }
>> +
>> +       return 0;
>> +}
>> +
>> +static void __init wii_setup_arch(void)
>> +{
>> +       ug_udbg_init();
>> +       wii_discover_ipc_flavour();
>> +}
>> +
>> +static void __init wii_init_early(void)
>> +{
>> +}
>> +
>> +static int __init wii_probe(void)
>> +{
>> +       unsigned long dt_root;
>> +
>> +       dt_root = of_get_flat_dt_root();
>> +       if (!of_flat_dt_is_compatible(dt_root, "nintendo,wii"))
>> +               return 0;
>> +
>> +       return 1;
>> +}
>> +
>> +static void wii_shutdown(void)
>> +{
>> +       flipper_quiesce();
>> +}
>> +
>> +#ifdef CONFIG_KEXEC
>> +static int wii_machine_kexec_prepare(struct kimage *image)
>> +{
>> +       return 0;
>> +}
>> +
>> +static void wii_machine_kexec(struct kimage *image)
>> +{
>> +       default_machine_kexec(image);
>> +}
> 
> Drop unnecessary hooks.  If no kexec hook it offered, then
> default_machine_kexec() gets called anyway.
> 

Yes, at this stage I can get rid of those functions and add them later when they get actual code.
Thanks.

>> +#endif /* CONFIG_KEXEC */
> 
>> +
>> +define_machine(wii) {
>> +       .name                   = "wii",
>> +       .probe                  = wii_probe,
>> +       .setup_arch             = wii_setup_arch,
>> +       .init_early             = wii_init_early,
>> +       .show_cpuinfo           = wii_show_cpuinfo,
>> +       .halt                   = wii_halt,
>> +       .init_IRQ               = flipper_pic_probe,
>> +       .get_irq                = flipper_pic_get_irq,
>> +       .calibrate_decr         = generic_calibrate_decr,
>> +       .progress               = udbg_progress,
>> +       .machine_shutdown       = wii_shutdown,
>> +#ifdef CONFIG_KEXEC
>> +       .machine_kexec_prepare  = wii_machine_kexec_prepare,
>> +       .machine_kexec          = wii_machine_kexec,
>> +#endif
>> +};
>> +
>> diff --git a/arch/powerpc/platforms/embedded6xx/wii_dev.c b/arch/powerpc/platforms/embedded6xx/wii_dev.c
>> new file mode 100644
>> index 0000000..903063e
>> --- /dev/null
>> +++ b/arch/powerpc/platforms/embedded6xx/wii_dev.c
>> @@ -0,0 +1,47 @@
>> +/*
>> + * arch/powerpc/platforms/embedded6xx/wii_dev.c
>> + *
>> + * Nintendo Wii platform device setup.
>> + * Copyright (C) 2008-2009 The GameCube Linux Team
>> + * Copyright (C) 2008,2009 Albert Herranz
>> + *
>> + * 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/kernel.h>
>> +#include <linux/init.h>
>> +#include <linux/of_platform.h>
>> +
>> +#include <asm/machdep.h>
>> +
>> +static struct of_device_id wii_of_bus[] = {
>> +       { .compatible = "nintendo,hollywood", },
>> +#ifdef CONFIG_STARLET_MINI
>> +       { .compatible = "twiizers,starlet-mini-ipc", },
>> +#endif
>> +       { },
>> +};
>> +
>> +static int __init wii_device_probe(void)
>> +{
>> +       struct device_node *np;
>> +
>> +       if (!machine_is(wii))
>> +               return 0;
>> +
>> +       of_platform_bus_probe(NULL, wii_of_bus, NULL);
>> +
>> +       np = of_find_compatible_node(NULL, NULL, "nintendo,hollywood-mem2");
>> +       if (np) {
>> +               of_platform_device_create(np, NULL, NULL);
>> +               of_node_put(np);
>> +       }
>> +
>> +       return 0;
>> +}
>> +device_initcall(wii_device_probe);
> 
> Why is this split into a separate file?  (Same comment goes for the
> Gamecube version).  Just roll all the platform support into a single
> file since there is no shared code.
> 

I'll do that too. Thanks.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-23 20:19         ` Grant Likely
@ 2009-11-23 20:25           ` Albert Herranz
  2009-11-24 22:53           ` Segher Boessenkool
  2009-11-26  4:23           ` Benjamin Herrenschmidt
  2 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 20:25 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> On Mon, Nov 23, 2009 at 12:44 PM, Albert Herranz
>> Can you please elaborate more on this or point me to documentation?
>> The soc node here tries to represent the big multi-function chip that integrates most of the devices of the video game consoles ("Flipper" on the Nintendo GameCube and "Hollywood" on the Wii).
> 
> Right.  Much like many other SoCs.  However, the SoC has all these
> devices + the cpu core + the memory controller, and probably some
> other stuff.  Whereas this particular node only encapsulates the
> integrated peripherals on an internal bus, so the node really is
> describing the internal bus, not the entire SoC.  On some chips it is
> documented as the "internally memory mapped registers", or IMMR.  So,
> it is better to name this node in a way that reflects what it is (an
> internal bus) instead of as the whole chip.
> 
> Similarly, it is better to use a compatible value of something like:
> compatible = "nintendo,flipper-immr"; (instead of "nintendo,flipper")
> because your describing just the internal bus, not the entire chip.
> 
> g.
> 

Thanks for the clarification.
I'll see what I can do :)

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-23 19:54           ` Albert Herranz
@ 2009-11-23 20:36             ` Grant Likely
  2009-11-23 21:55               ` Albert Herranz
  2009-11-25 16:57             ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-23 20:36 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Mon, Nov 23, 2009 at 12:54 PM, Albert Herranz
<albert_herranz@yahoo.es> wrote:
> Grant Likely wrote:
>> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es=
> wrote:
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 i2c-video {
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #address-cells =3D <1>;
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 #size-cells =3D <0>;
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "virtual,i=
2c-gpio";
>>
>> There isn't a documented binding for this. =A0Is there a driver for it?
>>
>
> I have a driver for it. But it isn't yet published.
>
> This is the documentation I wrote so far for the bindings.
> Is there a standard for this?

This looks pretty good to me.  The documentation format isn't strict,
just follow the pattern seen in other bindings.  Make sure you post
new bindings to devicetree-discuss@lists.ozlabs.org for review.  A
couple of comments below.

> Documentation/powerpc/dts-bindings/gpio/i2c.txt
>
> GPIO-based I2C
>
> Required properties:
> - compatible : should be "virtual,i2c-gpio".
> - gpios : should specify GPIOs used for SDA and SCL lines, in that order.
> - sda-is-open-drain : should be non-zero if SDA gpio is open-drain.
> - sda-enforce-dir : should be non-zero if SDA gpio must be configured for
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0input before reading and for outpu=
t before writing.
> - scl-is-open-drain : should be non-zero if SCL gpio is open-drain.
> - scl-is-output-only : should be non-zero if SCL is an output gpio only.

Instead of looking for a value in these properties, just make them
empty properties and change behaviour based on whether or not the
property is present.

Why is the scl-is-output-only property needed?

> - udelay : signal toggle delay. SCL frequency is (500 / udelay) kHz

You should follow the lead of
Documentation/powerpc/dts-bindings/fsl/i2c.txt here and specify a
clock-frequency property.

> - timeout : clock stretching timeout in milliseconds.

I don't understand what this property means.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions
  2009-11-23 20:16                               ` Albert Herranz
@ 2009-11-23 20:41                                 ` Grant Likely
  2009-11-23 23:45                                 ` Michael Ellerman
  1 sibling, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-23 20:41 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev, Becky Bruce

On Mon, Nov 23, 2009 at 1:16 PM, Albert Herranz <albert_herranz@yahoo.es> w=
rote:
> Grant Likely wrote:
>> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es=
> wrote:
>>> The Nintendo Wii has two discontiguous RAM memory areas called
>>> MEM1 and MEM2.
>>> MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
>>> MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
>>> Between both memory address ranges there is an address space
>>> where memory-mapped I/O registers are found.
>>>
>>> Currently, Linux 32-bit PowerPC does not support RAM in
>>> discontiguous memory address spaces. Thus, in order to use
>>> both RAM areas, we declare as RAM the range from the start of
>>> MEM1 to the end of useable MEM2 and exclude the needed parts
>>> with /memreserve/ statements, at the expense of wasting a bit
>>> of memory.
>>>
>>> As a side effect, we need to allow ioremapping RAM areas
>>> because the I/O address space sits within the memreserve'd part
>>> of the declared RAM region.
>>> Note that this is not safe if the region ioremapped is covered
>>> by an existing BAT mapping used to map RAM, so this is
>>> specifically banned here.
>>>
>>> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
>>> ---
>>> =A0arch/powerpc/mm/pgtable_32.c | =A0 19 ++++++++++++++++---
>>> =A01 files changed, 16 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.=
c
>>> index cb96cb2..ba00cb1 100644
>>> --- a/arch/powerpc/mm/pgtable_32.c
>>> +++ b/arch/powerpc/mm/pgtable_32.c
>>> @@ -191,9 +191,22 @@ __ioremap_caller(phys_addr_t addr, unsigned long s=
ize, unsigned long flags,
>>> =A0 =A0 =A0 =A0 * Don't allow anybody to remap normal RAM that we're us=
ing.
>>> =A0 =A0 =A0 =A0 * mem_init() sets high_memory so only do the check afte=
r that.
>>> =A0 =A0 =A0 =A0 */
>>> - =A0 =A0 =A0 if (mem_init_done && (p < virt_to_phys(high_memory))) {
>>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk("__ioremap(): phys addr 0x%llx is =
RAM lr %p\n",
>>> - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long long)p, __b=
uiltin_return_address(0));
>>> + =A0 =A0 =A0 if (mem_init_done && (p < virt_to_phys(high_memory))
>>> +#ifdef CONFIG_WII
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 /*
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* On some systems, though, we may want=
 to remap an area
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* declared as normal RAM that we have =
memreserve'd at the
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* device tree. See wii.dts.
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* But we can't do that safely if we ar=
e using BATs to map
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0* part of that area.
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0*/
>>> + =A0 =A0 =A0 =A0 =A0 && !__map_without_bats
>>> +#endif
>>> + =A0 =A0 =A0 =A0 =A0 ) {
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 printk(KERN_WARNING
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0"__ioremap(): phys addr 0x=
%llx is RAM lr %p\n",
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0(unsigned long long)p,
>>> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0__builtin_return_addre=
ss(0));
>>
>> This could adversely affect multiplatform kernels. =A0I'd rather get the
>> RAM problem fixed and not hack up common code to work around the hack.
>>
>> g.
>>
>
> Would it be acceptable to create a global var __allow_ioremap_normal_ram =
that by default would have a value of 0 and would be set _only_ for those p=
latforms needing it?

I'm not the best one to answer this since I don't dig into the mm code
very often.  Ben?  Kumar?  Becky?  Thoughts?

> The other solutions I see is:
> - add support for discontiguous memory to powerpc 32-bits (which is not s=
omething that I can look into now)

I of course like this option.  :-)

> - don't use the precious second 64MB area (which is a waste)

Not exactly nice, but it might be wise to do this now so that
discussion about how to fix it best won't block getting the bulk of
support into mainline.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-23 20:36             ` Grant Likely
@ 2009-11-23 21:55               ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-23 21:55 UTC (permalink / raw)
  To: Grant Likely; +Cc: linuxppc-dev

Grant Likely wrote:
> This looks pretty good to me.  The documentation format isn't strict,
> just follow the pattern seen in other bindings.  Make sure you post
> new bindings to devicetree-discuss@lists.ozlabs.org for review.  A
> couple of comments below.
> 

Ok. I know it now for the next time :)

>> Documentation/powerpc/dts-bindings/gpio/i2c.txt
>>
>> GPIO-based I2C
>>
>> Required properties:
>> - compatible : should be "virtual,i2c-gpio".
>> - gpios : should specify GPIOs used for SDA and SCL lines, in that order.
>> - sda-is-open-drain : should be non-zero if SDA gpio is open-drain.
>> - sda-enforce-dir : should be non-zero if SDA gpio must be configured for
>>                    input before reading and for output before writing.
>> - scl-is-open-drain : should be non-zero if SCL gpio is open-drain.
>> - scl-is-output-only : should be non-zero if SCL is an output gpio only.
> 
> Instead of looking for a value in these properties, just make them
> empty properties and change behaviour based on whether or not the
> property is present.
> 

It seems reasonable. Thanks.

> Why is the scl-is-output-only property needed?
> 

It is needed to specify that the I2C master can't honour clock stretching done by I2C slave devices, as it cannot read back SCL.

>> - udelay : signal toggle delay. SCL frequency is (500 / udelay) kHz
> 
> You should follow the lead of
> Documentation/powerpc/dts-bindings/fsl/i2c.txt here and specify a
> clock-frequency property.
> 

Ok.

>> - timeout : clock stretching timeout in milliseconds.
> 
> I don't understand what this property means.
> 

It is the maximum time that the I2C master should wait for SCL to go high when a I2C slave is "clock-stretching".

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-23 19:10                       ` Albert Herranz
@ 2009-11-23 22:13                         ` Arnd Bergmann
  0 siblings, 0 replies; 181+ messages in thread
From: Arnd Bergmann @ 2009-11-23 22:13 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

On Monday 23 November 2009 19:10:55 Albert Herranz wrote:
> 
> Arnd Bergmann wrote:
> > On Sunday 22 November 2009, Albert Herranz wrote:
> >> +#ifdef CONFIG_PPC_EARLY_DEBUG_USBGECKO
> >> +setup_usbgecko_bat:
> >> +    /* prepare a BAT for early io */
> >> +    lis     r8, 0x0c00
> >> +    ori     r8, r8, 0x002a  /* uncached, guarded ,rw */
> >> +    lis     r11, 0xcc00
> >> +    ori     r11, r11, 0x3   /* 128K */
> >> +#ifdef CONFIG_WII
> >> +    oris    r8, r8, 0x0100
> >> +    oris    r11, r11, 0x0100
> >> +#endif
> >> +    mtspr   SPRN_DBAT1L, r8
> >> +    mtspr   SPRN_DBAT1U, r11
> >> +    sync
> >> +    isync
> >> +    blr
> >> +#endif
> > 
> > This will probably break other platforms if CONFIG_PPC_EARLY_DEBUG_USBGECKO
> > is set. In general, we try hard to make it possible to build generic
> > kernels for multiple systems, so it would be better to also add a runtime
> > check here.
> > 
> 
> Ok, I see the point.
> But, what makes CONFIG_PPC_EARLY_DEBUG_USBGECKO case different from CONFIG_PPC_EARLY_DEBUG_CPM case here?
> 

I looked again, and the help text for PPC_EARLY_DEBUG makes it very clear that
are never usable on a production kernel. Just leave your code the way it is here,
but if there are other places that prevent portable kernels, those should be fixed.
I'm not aware of any of those right now.

	Arnd <><

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-23 20:16                               ` Albert Herranz
  2009-11-23 20:41                                 ` Grant Likely
@ 2009-11-23 23:45                                 ` Michael Ellerman
  2009-11-24 17:09                                   ` Albert Herranz
  1 sibling, 1 reply; 181+ messages in thread
From: Michael Ellerman @ 2009-11-23 23:45 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 2556 bytes --]

On Mon, 2009-11-23 at 21:16 +0100, Albert Herranz wrote:
> >>  arch/powerpc/mm/pgtable_32.c |   19 ++++++++++++++++---
> >>  1 files changed, 16 insertions(+), 3 deletions(-)
> >>
> >> diff --git a/arch/powerpc/mm/pgtable_32.c b/arch/powerpc/mm/pgtable_32.c
> >> index cb96cb2..ba00cb1 100644
> >> --- a/arch/powerpc/mm/pgtable_32.c
> >> +++ b/arch/powerpc/mm/pgtable_32.c
> >> @@ -191,9 +191,22 @@ __ioremap_caller(phys_addr_t addr, unsigned long size, unsigned long flags,
> >>         * Don't allow anybody to remap normal RAM that we're using.
> >>         * mem_init() sets high_memory so only do the check after that.
> >>         */
> >> -       if (mem_init_done && (p < virt_to_phys(high_memory))) {
> >> -               printk("__ioremap(): phys addr 0x%llx is RAM lr %p\n",
> >> -                      (unsigned long long)p, __builtin_return_address(0));
> >> +       if (mem_init_done && (p < virt_to_phys(high_memory))
> >> +#ifdef CONFIG_WII
> >> +               /*
> >> +                * On some systems, though, we may want to remap an area
> >> +                * declared as normal RAM that we have memreserve'd at the
> >> +                * device tree. See wii.dts.
> >> +                * But we can't do that safely if we are using BATs to map
> >> +                * part of that area.
> >> +                */
> >> +           && !__map_without_bats
> >> +#endif
> >> +           ) {
> >> +               printk(KERN_WARNING
> >> +                      "__ioremap(): phys addr 0x%llx is RAM lr %p\n",
> >> +                      (unsigned long long)p,
> >> +                        __builtin_return_address(0));
> > 
> > This could adversely affect multiplatform kernels.  I'd rather get the
> > RAM problem fixed and not hack up common code to work around the hack.
> > 
> > g.
> > 
> 
> Would it be acceptable to create a global var __allow_ioremap_normal_ram that by default would have a value of 0 and would be set _only_ for those platforms needing it?
> 
> The other solutions I see is:
> - add support for discontiguous memory to powerpc 32-bits (which is not something that I can look into now)
> - don't use the precious second 64MB area (which is a waste)

- Implement your own ppc_md.ioremap(), see iseries & cell for example.

Currently that's only called on 64-bit, but you could change that.

If I'm reading your patch right, you should be able to do that check in
your platform's ioremap() and then call the generic implementation to do
the actual work.

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
  2009-11-22 23:11       ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Grant Likely
@ 2009-11-24  0:08       ` Segher Boessenkool
  2009-11-24 17:38         ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24  0:08 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

Hi Albert,

> +asm ("\n\


A file scope asm?!  Please don't.

> + * We enter with the cache enabled, the MMU enabled and some known  
> legacy
> + * memory mappings active. xBAT3 is unused

It would be good if you could depend as little as possible on these  
things;
that makes writing another bootloader a lot easier.

> +	/* IBAT3,DBAT3 for first 16Mbytes */\n\
> +	li	8, 0x01ff	/* 16MB */\n\
> +	li      9, 0x0002	/* rw */\n\
> +	mtspr   0x216, 8	/* IBAT3U */\n\
> +	mtspr   0x217, 9	/* IBAT3L */\n\
> +	mtspr   0x21e, 8	/* DBAT3U */\n\
> +	mtspr   0x21f, 9	/* DBAT3L */\n\

WIMG=0000, are you sure?  Not M=1?

> +	bcl-    20,4*cr7+so,1f\n\

Just write  bcl 20,31,1f .


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 05/19] powerpc: wii: bootwrapper bits
  2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
  2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
  2009-11-22 23:19           ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Grant Likely
@ 2009-11-24  0:33           ` Segher Boessenkool
  2009-11-24 17:56             ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24  0:33 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> + * We enter with an unknown cache, high BATs and MMU status.

What does this mean?  You know the low four BATs on entry and
nothing else?

> +asm ("\n\

Global asm() is evil.

> +	mfmsr	9\n\
> +	andi.	0, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\

> +	andc	9, 9, 0\n\

mfmsr 9 ; rlwinm 9,9,0,~0x30 ?

> +	mtspr	0x01a, 8	/* SRR0 */\n\
> +	mtspr	0x01b, 9	/* SRR1 */\n\

mtsrr0 and mtsrr1

> +	sync\n\
> +	rfi\n\

No need for sync before rfi

> +	mtspr	0x210, 8	/* IBAT0U */\n\
> +	mtspr	0x211, 8	/* IBAT0L */\n\

You only need to set the upper BAT to zero, saves some code.

> +	isync\n\

isync here is cargo cult

> +	li	8, 0x01ff	/* first 16MiB */\n\
> +	li	9, 0x0002	/* rw */\n\
> +	mtspr	0x210, 8	/* IBAT0U */\n\
> +	mtspr	0x211, 9	/* IBAT0L */\n\
> +	mtspr	0x218, 8	/* DBAT0U */\n\
> +	mtspr	0x219, 9	/* DBAT0L */\n\

M=0 for RAM?

>

Also, you should normally write the lower BAT first.  Doesn't matter
here because IR=DR=0 of course.

> +	lis	8, 0xcc00	/* I/O mem */\n\
> +	ori	8, 8, 0x3ff	/* 32MiB */\n\
> +	lis	9, 0x0c00\n\
> +	ori	9, 9, 0x002a	/* uncached, guarded, rw */\n\
> +	mtspr	0x21a, 8	/* DBAT1U */\n\
> +	mtspr	0x21b, 9	/* DBAT1L */\n\

Is there any real reason you don't identity map this?

> +	sync\n\
> +	isync\n\
> +\n\

Don't need these

> +	/* enable high BATs */\n\
> +	lis	8, 0x8200\n\
> +	mtspr	0x3f3, 8	/* HID4 */\n\

You need to use read-modify-write here.  Also, shouldn't you
enable the extra BATs before setting them?

And you _do_ need isync here as far as I can see.

> +	/* enable caches */\n\
> +	mfspr	8, 0x3f0\n\
> +	ori	8, 8, 0xc000\n\
> +	mtspr	0x3f0, 8	/* HID0 */\n\
> +	isync\n\

You need to invalidate the L1 caches at the same time as you enable
them.

> +void platform_init(unsigned long r3, unsigned long r4, unsigned  
> long r5)
> +{
> +	u32 heapsize = 24*1024*1024 - (u32)_end;
> +
> +	simple_alloc_init(_end, heapsize, 32, 64);
> +	fdt_init(_dtb_start);
> +
> +	if (!ug_grab_io_base() && ug_is_adapter_present())

The "!" reads weird.  Can you not make ug_is_adapter_present()
call ug_grab_io_base(), anyway?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
  2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
  2009-11-22 23:20             ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Grant Likely
@ 2009-11-24  0:35             ` Segher Boessenkool
  2009-11-24 18:03               ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24  0:35 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> Add a config option GAMECUBE_COMMON to be used as a dependency for all
> options common to the Nintendo GameCube and Wii video game consoles.

Maybe something like GAMECUBE_OR_WII instead?  "COMMON" is so
common it's meaningless.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
  2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
  2009-11-22 23:22                   ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Grant Likely
@ 2009-11-24  0:49                   ` Segher Boessenkool
  2009-11-24 18:08                     ` Albert Herranz
  2009-11-26  5:12                   ` Benjamin Herrenschmidt
  3 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24  0:49 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> +	  If you say yes to this option, support will be included for the
> +	  USB Gecko adapter as an udbg console.
> +	  The USB Gecko is a EXI to USB Serial converter that can be plugged
> +	  into a memcard slot in the Nintendo GameCube/Wii.

Not "a" memcard slot, only the first one, you have it hardcoded.

> +#if 0
> +/*
> + * Trasmits a null terminated character string.
> + */
> +static void ug_puts(char *s)
> +{
> +	while (*s)
> +		ug_putc(*s++);
> +}
> +#endif

Remove?

> +	stdout = of_find_node_by_path(path);
> +	if (!stdout) {
> +		udbg_printf("%s: missing path %s", __func__, path);
> +		goto done;
> +	}
> +
> +	for (np = NULL;
> +	    (np = of_find_compatible_node(np, NULL, "usbgecko,usbgecko"));)
> +		if (np == stdout)
> +			break;
> +
> +	of_node_put(stdout);
> +	if (!np) {
> +		udbg_printf("%s: stdout is not an usbgecko", __func__);
> +		goto done;
> +	}

Surely there is something called something like of_node_is_compatible()
you can use here?  You already have the node pointer, there is no need
to look at all other nodes.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
  2009-11-22 22:27                     ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Arnd Bergmann
@ 2009-11-24  0:54                     ` Segher Boessenkool
  2009-11-24 18:19                       ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24  0:54 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

You set up DBAT1 here...

> +setup_usbgecko_bat:
> +	/* prepare a BAT for early io */
> +	lis	r8, 0x0c00
> +	ori	r8, r8, 0x002a	/* uncached, guarded ,rw */
> +	lis	r11, 0xcc00
> +	ori	r11, r11, 0x3	/* 128K */
> +#ifdef CONFIG_WII
> +	oris	r8, r8, 0x0100
> +	oris	r11, r11, 0x0100
> +#endif
> +	mtspr	SPRN_DBAT1L, r8
> +	mtspr	SPRN_DBAT1U, r11
> +	sync
> +	isync
> +	blr

... and again here:

> +void __init udbg_init_usbgecko(void)
> +{
> +	unsigned long vaddr, paddr;
> +
> +#if defined(CONFIG_GAMECUBE)
> +	paddr = 0x0c000000;
> +#elif defined(CONFIG_WII)
> +	paddr = 0x0d000000;
> +#else
> +#error Invalid platform for USB Gecko based early debugging.
> +#endif
> +
> +	vaddr = 0xc0000000 | paddr;
> +	setbat(1, vaddr, paddr, 128*1024, PAGE_KERNEL_NCG);

Do you need to do it twice?

> +	ug_io_base = (void __iomem *)(vaddr | 0x6814);

Oh, hardcoded slot2, now i'm confused which one should be it :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-23 23:45                                 ` Michael Ellerman
@ 2009-11-24 17:09                                   ` Albert Herranz
  2009-11-25  0:38                                     ` Michael Ellerman
  2009-11-26  5:22                                     ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 17:09 UTC (permalink / raw)
  To: michael; +Cc: linuxppc-dev

Michael Ellerman wrote:
>> Would it be acceptable to create a global var __allow_ioremap_normal_ram that by default would have a value of 0 and would be set _only_ for those platforms needing it?
>>
>> The other solutions I see is:
>> - add support for discontiguous memory to powerpc 32-bits (which is not something that I can look into now)
>> - don't use the precious second 64MB area (which is a waste)
> 
> - Implement your own ppc_md.ioremap(), see iseries & cell for example.
> 
> Currently that's only called on 64-bit, but you could change that.
> 
> If I'm reading your patch right, you should be able to do that check in
> your platform's ioremap() and then call the generic implementation to do
> the actual work.
> 
> cheers

I could use ppc_md.ioremap to duplicate ioremap except for the ioremap ram check.
But calling the stock ioremap without modifying it is not possible because it checks and bails out when ioremapping a region marked as ram (even if it's not real ram and it's memreserved).

Is the list of memreserved areas preserved once the kernel is running?
If it is preserved another option would be to unban ioremapping ram if memreserved.

Thanks for your input,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-24  0:08       ` Segher Boessenkool
@ 2009-11-24 17:38         ` Albert Herranz
  2009-11-24 21:00           ` Segher Boessenkool
  2009-11-26  4:35           ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 17:38 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
> Hi Albert,
> 
>> +asm ("\n\
> 
> 
> A file scope asm?!  Please don't.
> 

So what's your proposal then? Placing it within a fake func?
That asm snippet is the entry point. I took as an example how prpmc2800.c deals with that, providing an own version of the (weak) _zImage_start.

>> + * We enter with the cache enabled, the MMU enabled and some known
>> legacy
>> + * memory mappings active. xBAT3 is unused
> 
> It would be good if you could depend as little as possible on these things;
> that makes writing another bootloader a lot easier.
> 

Ok. I'll do a similar approach as done on the wii bootwrapper.

>> +    /* IBAT3,DBAT3 for first 16Mbytes */\n\
>> +    li    8, 0x01ff    /* 16MB */\n\
>> +    li      9, 0x0002    /* rw */\n\
>> +    mtspr   0x216, 8    /* IBAT3U */\n\
>> +    mtspr   0x217, 9    /* IBAT3L */\n\
>> +    mtspr   0x21e, 8    /* DBAT3U */\n\
>> +    mtspr   0x21f, 9    /* DBAT3L */\n\
> 
> WIMG=0000, are you sure?  Not M=1?
> 

To be honest, I don't recall the details now.
But it was tested in the very early days, the result was not the expected one and, in the end, manual cache coherency management was still needed.

So everything is designed and working assuming M=0.
This can be re-checked again later if needed.

>> +    bcl-    20,4*cr7+so,1f\n\
> 
> Just write  bcl 20,31,1f .

Ok, I used two variants for this and I know which one you like now ;).

> 
> 
> Segher
> 
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 05/19] powerpc: wii: bootwrapper bits
  2009-11-24  0:33           ` Segher Boessenkool
@ 2009-11-24 17:56             ` Albert Herranz
  2009-11-24 21:13               ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 17:56 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> + * We enter with an unknown cache, high BATs and MMU status.
> 
> What does this mean?  You know the low four BATs on entry and
> nothing else?
> 

That means that we do not make assumptions regarding:
- the state of the cache (enabled vs disabled)
- if the high BATs are enabled or not
- if the MMU is enabled or not

Is this clearer? I'm not a native english speaker as you may have noticed already :-P

>> +asm ("\n\
> 
> Global asm() is evil.
> 

Yes, you said. Still, I'd like a proper argument :)

>> +    mfmsr    9\n\
>> +    andi.    0, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\
> 
>> +    andc    9, 9, 0\n\
> 
> mfmsr 9 ; rlwinm 9,9,0,~0x30 ?
> 

Yes. Maybe

mfmsr 9 ; rlwinm 9,9,0,~((1<<4)|(1<<5)) /* MSR_DR|MSR_IR */

>> +    mtspr    0x01a, 8    /* SRR0 */\n\
>> +    mtspr    0x01b, 9    /* SRR1 */\n\
> 
> mtsrr0 and mtsrr1
> 

Easier :)

>> +    sync\n\
>> +    rfi\n\
> 
> No need for sync before rfi
> 

Ok.

>> +    mtspr    0x210, 8    /* IBAT0U */\n\
>> +    mtspr    0x211, 8    /* IBAT0L */\n\
> 
> You only need to set the upper BAT to zero, saves some code.
> 

Great. Is this documented somewhere?

>> +    isync\n\
> 
> isync here is cargo cult
> 

I'll offer a dead chicken to compensate for this.

>> +    li    8, 0x01ff    /* first 16MiB */\n\
>> +    li    9, 0x0002    /* rw */\n\
>> +    mtspr    0x210, 8    /* IBAT0U */\n\
>> +    mtspr    0x211, 9    /* IBAT0L */\n\
>> +    mtspr    0x218, 8    /* DBAT0U */\n\
>> +    mtspr    0x219, 9    /* DBAT0L */\n\
> 
> M=0 for RAM?
> 

See analog question for gamecube bootwrapper bits.

>>
> 
> Also, you should normally write the lower BAT first.  Doesn't matter
> here because IR=DR=0 of course.
> 

I can change that too if it's the general way to go.

>> +    lis    8, 0xcc00    /* I/O mem */\n\
>> +    ori    8, 8, 0x3ff    /* 32MiB */\n\
>> +    lis    9, 0x0c00\n\
>> +    ori    9, 9, 0x002a    /* uncached, guarded, rw */\n\
>> +    mtspr    0x21a, 8    /* DBAT1U */\n\
>> +    mtspr    0x21b, 9    /* DBAT1L */\n\
> 
> Is there any real reason you don't identity map this?
> 

No. There's a bit of nostalgia there.
(On the other hand there's no real reason to identity map it).

>> +    sync\n\
>> +    isync\n\
>> +\n\
> 
> Don't need these
> 

I'll get rid of them, then.

>> +    /* enable high BATs */\n\
>> +    lis    8, 0x8200\n\
>> +    mtspr    0x3f3, 8    /* HID4 */\n\
> 
> You need to use read-modify-write here.  Also, shouldn't you
> enable the extra BATs before setting them?
> 

No. You should first set them up and then enable them.
The content of the HIGH BATs is undefined on boot, AFAIK.

> And you _do_ need isync here as far as I can see.
> 
>> +    /* enable caches */\n\
>> +    mfspr    8, 0x3f0\n\
>> +    ori    8, 8, 0xc000\n\
>> +    mtspr    0x3f0, 8    /* HID0 */\n\
>> +    isync\n\
> 
> You need to invalidate the L1 caches at the same time as you enable
> them.
> 

Ok. I'll check if the caches are enabled. If they aren't I'll invalidate and enable them.

>> +void platform_init(unsigned long r3, unsigned long r4, unsigned long r5)
>> +{
>> +    u32 heapsize = 24*1024*1024 - (u32)_end;
>> +
>> +    simple_alloc_init(_end, heapsize, 32, 64);
>> +    fdt_init(_dtb_start);
>> +
>> +    if (!ug_grab_io_base() && ug_is_adapter_present())
> 
> The "!" reads weird.  Can you not make ug_is_adapter_present()
> call ug_grab_io_base(), anyway?
> 

Calling ug_grab_io_base() from ug_is_adapter_present() can be misleading too (you are supposed to just check if the adapter is present in that function, according to the name).
If the "!" is ugly I can use the following idiom, introducing an error variable.

  error = ug_grab_io_base();
  if (!error && ug_is_adapter_present())
     /* blah */

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-24  0:35             ` Segher Boessenkool
@ 2009-11-24 18:03               ` Albert Herranz
  2009-11-24 21:15                 ` Segher Boessenkool
  2009-11-26  5:08                 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 18:03 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> Add a config option GAMECUBE_COMMON to be used as a dependency for all
>> options common to the Nintendo GameCube and Wii video game consoles.
> 
> Maybe something like GAMECUBE_OR_WII instead?  "COMMON" is so
> common it's meaningless.
> 

I don't like either GAMECUBE_OR_WII.
It looks as if it can be used to match options for the GAMECUBE _or_ WII. But that's not the meaning of it.

This option should be used only for options applicable to both the GAMECUBE and WII, i.e. basically those options in the WII which where "inherited" from the GAMECUBE to make it retro-compatible.

If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or GAMECUBE_COMPAT?

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-24  0:49                   ` Segher Boessenkool
@ 2009-11-24 18:08                     ` Albert Herranz
  2009-11-24 21:19                       ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 18:08 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> +      If you say yes to this option, support will be included for the
>> +      USB Gecko adapter as an udbg console.
>> +      The USB Gecko is a EXI to USB Serial converter that can be plugged
>> +      into a memcard slot in the Nintendo GameCube/Wii.
> 
> Not "a" memcard slot, only the first one, you have it hardcoded.
> 

No. It's not hardcoded in the code. It's specified in the device tree source.
The hardcoded one is just the early udbg, not the "normal" udbg.

>> +#if 0
>> +/*
>> + * Trasmits a null terminated character string.
>> + */
>> +static void ug_puts(char *s)
>> +{
>> +    while (*s)
>> +        ug_putc(*s++);
>> +}
>> +#endif
> 
> Remove?
> 

Ok :)

>> +    stdout = of_find_node_by_path(path);
>> +    if (!stdout) {
>> +        udbg_printf("%s: missing path %s", __func__, path);
>> +        goto done;
>> +    }
>> +
>> +    for (np = NULL;
>> +        (np = of_find_compatible_node(np, NULL, "usbgecko,usbgecko"));)
>> +        if (np == stdout)
>> +            break;
>> +
>> +    of_node_put(stdout);
>> +    if (!np) {
>> +        udbg_printf("%s: stdout is not an usbgecko", __func__);
>> +        goto done;
>> +    }
> 
> Surely there is something called something like of_node_is_compatible()
> you can use here?  You already have the node pointer, there is no need
> to look at all other nodes.
> 

I see the point.
I didn't find of_node_is_compatible() but I'll look what's available here.

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-24  0:54                     ` Segher Boessenkool
@ 2009-11-24 18:19                       ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 18:19 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
> You set up DBAT1 here...
> 
>> +setup_usbgecko_bat:
>> +    /* prepare a BAT for early io */
>> +    lis    r8, 0x0c00
>> +    ori    r8, r8, 0x002a    /* uncached, guarded ,rw */
>> +    lis    r11, 0xcc00
>> +    ori    r11, r11, 0x3    /* 128K */
>> +#ifdef CONFIG_WII
>> +    oris    r8, r8, 0x0100
>> +    oris    r11, r11, 0x0100
>> +#endif
>> +    mtspr    SPRN_DBAT1L, r8
>> +    mtspr    SPRN_DBAT1U, r11
>> +    sync
>> +    isync
>> +    blr
> 
> ... and again here:
> 
>> +void __init udbg_init_usbgecko(void)
>> +{
>> +    unsigned long vaddr, paddr;
>> +
>> +#if defined(CONFIG_GAMECUBE)
>> +    paddr = 0x0c000000;
>> +#elif defined(CONFIG_WII)
>> +    paddr = 0x0d000000;
>> +#else
>> +#error Invalid platform for USB Gecko based early debugging.
>> +#endif
>> +
>> +    vaddr = 0xc0000000 | paddr;
>> +    setbat(1, vaddr, paddr, 128*1024, PAGE_KERNEL_NCG);
> 
> Do you need to do it twice?
> 

Uhmm... I need to re-check it.
IIRC the BATs were re-initialized in between. But I'm not sure now :)

>> +    ug_io_base = (void __iomem *)(vaddr | 0x6814);
> 
> Oh, hardcoded slot2, now i'm confused which one should be it :-)
> 

early udbg  : hardcoded to mem2 slot
normal udbg : as specified in device tree

Clearer now ? ;)

Thanks for the review!
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-24 17:38         ` Albert Herranz
@ 2009-11-24 21:00           ` Segher Boessenkool
  2009-11-24 23:45             ` Albert Herranz
  2009-11-26  4:36             ` Benjamin Herrenschmidt
  2009-11-26  4:35           ` Benjamin Herrenschmidt
  1 sibling, 2 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:00 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> +asm ("\n\
>>
>>
>> A file scope asm?!  Please don't.
>>
> So what's your proposal then? Placing it within a fake func?
> That asm snippet is the entry point. I took as an example how  
> prpmc2800.c deals with that, providing an own version of the (weak)  
> _zImage_start.

Use an assembler source file.  You'll get much nicer syntax as well
(none of that \n stuff).

>>> +    /* IBAT3,DBAT3 for first 16Mbytes */\n\
>>> +    li    8, 0x01ff    /* 16MB */\n\
>>> +    li      9, 0x0002    /* rw */\n\
>>> +    mtspr   0x216, 8    /* IBAT3U */\n\
>>> +    mtspr   0x217, 9    /* IBAT3L */\n\
>>> +    mtspr   0x21e, 8    /* DBAT3U */\n\
>>> +    mtspr   0x21f, 9    /* DBAT3L */\n\
>>
>> WIMG=0000, are you sure?  Not M=1?
>
> To be honest, I don't recall the details now.
> But it was tested in the very early days, the result was not the  
> expected one and, in the end, manual cache coherency management was  
> still needed.

Sure, the memory controllers don't do coherency.  I'm slightly worried
about two things:
1) Will the generic code use M=0 as well?  Is it a problem if it  
doesn't?
2) Do lwarx. etc. work in M=0?

And a question: does M=0 actually give better performance (lower bus
utilisation, and maybe saves a few cycles)?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 05/19] powerpc: wii: bootwrapper bits
  2009-11-24 17:56             ` Albert Herranz
@ 2009-11-24 21:13               ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:13 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> + * We enter with an unknown cache, high BATs and MMU status.
>>
>> What does this mean?  You know the low four BATs on entry and
>> nothing else?
>>
>
> That means that we do not make assumptions regarding:
> - the state of the cache (enabled vs disabled)
> - if the high BATs are enabled or not
> - if the MMU is enabled or not
>
> Is this clearer?

Yeah it is.

>>> +    mfmsr    9\n\
>>> +    andi.    0, 9, (1<<4)|(1<<5) /* MSR_DR|MSR_IR */\n\
>>
>>> +    andc    9, 9, 0\n\
>>
>> mfmsr 9 ; rlwinm 9,9,0,~0x30 ?
>>
>
> Yes. Maybe
>
> mfmsr 9 ; rlwinm 9,9,0,~((1<<4)|(1<<5)) /* MSR_DR|MSR_IR */

Sure, or ~0x30 with that comment.  You can save an insn and make
the code clearer at the same time, how exactly you write it, I don't
care :-)

>>> +    mtspr    0x210, 8    /* IBAT0U */\n\
>>> +    mtspr    0x211, 8    /* IBAT0L */\n\
>>
>> You only need to set the upper BAT to zero, saves some code.
>
> Great. Is this documented somewhere?

Sure, it's all in the PEM.

>>> +    isync\n\
>>
>> isync here is cargo cult
>
> I'll offer a dead chicken to compensate for this.

Thanks, I needed some more of those :-)

>> Also, you should normally write the lower BAT first.  Doesn't matter
>> here because IR=DR=0 of course.
>
> I can change that too if it's the general way to go.

Please do.

>>> +    lis    8, 0xcc00    /* I/O mem */\n\
>>> +    ori    8, 8, 0x3ff    /* 32MiB */\n\
>>> +    lis    9, 0x0c00\n\
>>> +    ori    9, 9, 0x002a    /* uncached, guarded, rw */\n\
>>> +    mtspr    0x21a, 8    /* DBAT1U */\n\
>>> +    mtspr    0x21b, 9    /* DBAT1L */\n\
>>
>> Is there any real reason you don't identity map this?

> No. There's a bit of nostalgia there.
> (On the other hand there's no real reason to identity map it).

It's a tiny bit cleaner and stops people from wondering why :-)

>>> +    /* enable high BATs */\n\
>>> +    lis    8, 0x8200\n\
>>> +    mtspr    0x3f3, 8    /* HID4 */\n\
>>
>> You need to use read-modify-write here.  Also, shouldn't you
>> enable the extra BATs before setting them?
>>
>
> No. You should first set them up and then enable them.
> The content of the HIGH BATs is undefined on boot, AFAIK.

All BATs are undefined at boot; you need to clear them / set them
before enabling them (DR=1 or IR=1), so there is nothing special
about the high BATs.

What I am getting at is if the mfspr/mtspr to the high BATs does
work when the HID bit for them is off.

Please address the RMW thing (don't clear bits in HID4).

>>> +    /* enable caches */\n\
>>> +    mfspr    8, 0x3f0\n\
>>> +    ori    8, 8, 0xc000\n\
>>> +    mtspr    0x3f0, 8    /* HID0 */\n\
>>> +    isync\n\
>>
>> You need to invalidate the L1 caches at the same time as you enable
>> them.
>>
>
> Ok. I'll check if the caches are enabled. If they aren't I'll  
> invalidate and enable them.

Yeah, good point.

> If the "!" is ugly I can use the following idiom, introducing an  
> error variable.
>
>   error = ug_grab_io_base();
>   if (!error && ug_is_adapter_present())
>      /* blah */

Much clearer, thanks.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-24 18:03               ` Albert Herranz
@ 2009-11-24 21:15                 ` Segher Boessenkool
  2009-11-24 22:33                   ` Arnd Bergmann
  2009-11-25 17:06                   ` Albert Herranz
  2009-11-26  5:08                 ` Benjamin Herrenschmidt
  1 sibling, 2 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:15 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> Add a config option GAMECUBE_COMMON to be used as a dependency  
>>> for all
>>> options common to the Nintendo GameCube and Wii video game consoles.
>>
>> Maybe something like GAMECUBE_OR_WII instead?  "COMMON" is so
>> common it's meaningless.
>>
>
> I don't like either GAMECUBE_OR_WII.
> It looks as if it can be used to match options for the GAMECUBE  
> _or_ WII. But that's not the meaning of it.
>
> This option should be used only for options applicable to both the  
> GAMECUBE and WII, i.e. basically those options in the WII which  
> where "inherited" from the GAMECUBE to make it retro-compatible.
>
> If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or  
> GAMECUBE_COMPAT?

Maybe it's best to write GAMECUBE || WII in the places that use it,  
then?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-24 18:08                     ` Albert Herranz
@ 2009-11-24 21:19                       ` Segher Boessenkool
  2009-11-25 17:07                         ` Albert Herranz
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:19 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> +      If you say yes to this option, support will be included  
>>> for the
>>> +      USB Gecko adapter as an udbg console.
>>> +      The USB Gecko is a EXI to USB Serial converter that can be  
>>> plugged
>>> +      into a memcard slot in the Nintendo GameCube/Wii.
>>
>> Not "a" memcard slot, only the first one, you have it hardcoded.
>>
>
> No. It's not hardcoded in the code. It's specified in the device  
> tree source.
> The hardcoded one is just the early udbg, not the "normal" udbg.

Ah I misread the code then.

>> Surely there is something called something like  
>> of_node_is_compatible()
>> you can use here?  You already have the node pointer, there is no  
>> need
>> to look at all other nodes.
>>
>
> I see the point.
> I didn't find of_node_is_compatible() but I'll look what's  
> available here.

int of_device_is_compatible(const struct device_node *device,
                 const char *compat)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
  2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
  2009-11-22 23:28                       ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Grant Likely
@ 2009-11-24 21:30                       ` Segher Boessenkool
  2009-11-25 17:13                         ` Albert Herranz
  2009-11-26  5:18                       ` Benjamin Herrenschmidt
  3 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:30 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>  config GAMECUBE_COMMON
>  	bool
>  	select NOT_COHERENT_CACHE
> +	select FLIPPER_PIC

Maybe using FLIPPER (or GAMECUBE_FLIPPER) instead of GAMECUBE_COMMON
is a good name?

> +#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt

Unused

> +/*
> + * Each interrupt has a corresponding bit in both
> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
> + *
> + * Enabling/disabling an interrupt line involves asserting/clearing
> + * the corresponding bit in IMR. ACK'ing a request simply involves
> + * asserting the corresponding bit in ICR.
> + */

> +static void flipper_pic_ack(unsigned int virq)
> +{
> +	int irq = virq_to_hw(virq);
> +	void __iomem *io_base = get_irq_chip_data(virq);
> +
> +	set_bit(irq, io_base + FLIPPER_ICR);
> +}

So it should be a simple write instead of an RMW here, right?
As it is you are ACKing _all_ IRQs as far as I can see.

> +unsigned int flipper_pic_get_irq(void)
> +{
> +	void __iomem *io_base = flipper_irq_host->host_data;
> +	int irq;
> +	u32 irq_status;
> +
> +	irq_status = in_be32(io_base + FLIPPER_ICR) &
> +		     in_be32(io_base + FLIPPER_IMR);
> +	if (irq_status == 0)
> +		return -1;	/* no more IRQs pending */
> +
> +	__asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
> +	return irq_linear_revmap(flipper_irq_host, 31 - irq);
> +}

There are generic macros for this kind of thing, no need for asm.  ffs()
or something.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
  2009-11-22 22:01                         ` [RFC PATCH 13/19] powerpc: gamecube: default config Albert Herranz
  2009-11-22 23:34                         ` [RFC PATCH 12/19] powerpc: gamecube: platform support Grant Likely
@ 2009-11-24 21:39                         ` Segher Boessenkool
  2009-11-25 17:24                           ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:39 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> +static struct of_device_id gamecube_of_bus[] = {
> +	{ .compatible = "nintendo,flipper", },
> +	{ },
> +};
> +
> +static int __init gamecube_device_probe(void)
> +{
> +	if (!machine_is(gamecube))
> +		return 0;
> +
> +	of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
> +	return 0;
> +}

You really do not need a platform bus as far as I can see?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
  2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
  2009-11-22 23:40                                 ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Grant Likely
@ 2009-11-24 21:54                                 ` Segher Boessenkool
  2009-11-25 17:27                                   ` Albert Herranz
  2009-11-26  5:23                                 ` Benjamin Herrenschmidt
  3 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 21:54 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> +config HLWD_PIC

Are vowels too expensive?  :-)

> +static void hlwd_pic_ack(unsigned int virq)
> +{
> +	int irq = virq_to_hw(virq);
> +	void __iomem *io_base = get_irq_chip_data(virq);
> +
> +	set_bit(irq, io_base + HW_BROADWAY_ICR);
> +}

Same issue as with Flipper here.

> +	__asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
> +	return irq_linear_revmap(h, 31 - irq);

And here.

> +static void __hlwd_quiesce(void __iomem *io_base)
> +{
> +	/* mask and ack all IRQs */
> +	out_be32(io_base + HW_BROADWAY_IMR, 0);
> +	out_be32(io_base + HW_BROADWAY_ICR, ~0);
> +}

I would write 0xffffffff instead, it's clearer and slightly
more robust.

> +void hlwd_pic_probe(void)
> +{
> +	struct irq_host *host;
> +	struct device_node *np;
> +	const u32 *interrupts;
> +	int cascade_virq;
> +
> +	for_each_compatible_node(np, NULL, "nintendo,hollywood-pic") {
> +		interrupts = of_get_property(np, "interrupts", NULL);
> +		if (interrupts) {
> +			host = hlwd_pic_init(np);
> +			BUG_ON(!host);
> +			cascade_virq = irq_of_parse_and_map(np, 0);
> +			set_irq_data(cascade_virq, host);
> +			set_irq_chained_handler(cascade_virq,
> +						hlwd_pic_irq_cascade);

break;  here?  You do not handle more than one hollywood-pic elsewhere
(which of course is fine).


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support
  2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
  2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
  2009-11-22 22:48                                   ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Arnd Bergmann
@ 2009-11-24 22:13                                   ` Segher Boessenkool
  2009-11-25 17:47                                     ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 22:13 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> Add support for the BootMii 'mini' firmware replacement for the
> Starlet processor.
>
> 'mini' is an open source IOS replacement written from scratch by
> Team Twiizers.

It's not a replacement, it doesn't have any of the same functionality.

> It grants full access to the hardware found on the
> Nintendo Wii video game console via a custom IPC mechanism.

This is out of date, you get full register-level hardware access now.

Do you want to mainline any of the drivers that work via mini proxy?
If not, you can remove quite some bit of code here I think.

> +enum starlet_ipc_flavour {
> +	STARLET_IPC_IOS,
> +	STARLET_IPC_MINI,
> +};

I thought you don't support IOS at all anymore?

> +config STARLET_MINI
> +	bool "BootMii Starlet 'mini' firmware support"
> +	depends on WII && EXPERIMENTAL

Given that this is the only supported starlet firmware interface,
does it make sense to expose the option to the user?

<big snip, see my "remove stuff" comment above>

> +static void mipc_init_ahbprot(struct mipc_device *ipc_dev)
> +{
> +	void __iomem *hw_ahbprot;
> +	u32 initial_ahbprot, ahbprot = 0;
> +
> +	hw_ahbprot = mipc_get_hw_reg(HW_AHBPROT_OF_COMPATIBLE);
> +	if (!hw_ahbprot)
> +		goto done;
> +
> +	initial_ahbprot = mipc_readl(hw_ahbprot);
> +	if (initial_ahbprot != 0xffffffff) {
> +		pr_debug("AHBPROT=%08X (before)\n", initial_ahbprot);
> +		/* enable full access from the PowerPC side */
> +		mipc_writel(0xffffffff, hw_ahbprot);
> +	}
> +
> +	ahbprot = mipc_readl(hw_ahbprot);
> +	if (initial_ahbprot != ahbprot)
> +		pr_debug("AHBPROT=%08X (after)\n", ahbprot);
> +done:
> +	if (ahbprot != 0xffffffff)
> +		pr_err("failed to set AHBPROT\n");
> +}

Modern mini will always have AHBPROT set up to give you full access,
so this isn't needed either.

> +#ifdef CONFIG_HLWD_PIC
> +	/*
> +	 * Setup the Hollywood interrupt controller as soon as
> +	 * we detect that we are running under the mini firmware.
> +	 */
> +	hlwd_pic_probe();
> +#endif

Why?  The comment doesn't say.


Do you need this driver to boot?  If not, it might be best to leave it
out for now.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 18/19] powerpc: wii: platform support
  2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
  2009-11-22 22:01                                     ` [RFC PATCH 19/19] powerpc: wii: default config Albert Herranz
  2009-11-22 23:45                                     ` [RFC PATCH 18/19] powerpc: wii: platform support Grant Likely
@ 2009-11-24 22:24                                     ` Segher Boessenkool
  2009-11-25 17:58                                       ` Albert Herranz
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 22:24 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> diff --git a/arch/powerpc/platforms/embedded6xx/wii.c b/arch/ 
> powerpc/platforms/embedded6xx/wii.c

> +#define DRV_MODULE_NAME "rvl"

Should this be "wii"?

> +static enum starlet_ipc_flavour starlet_ipc_flavour;
> +
> +enum starlet_ipc_flavour starlet_get_ipc_flavour(void)
> +{
> +	return starlet_ipc_flavour;
> +}

This can go I think, unless you plan on supporting something else  
than mini?

> +#ifdef CONFIG_STARLET_MINI
> +
> +#define HW_RESETS_OF_COMPATIBLE	"nintendo,hollywood-resets"
> +#define HW_GPIO_ALIAS		"hw_gpio

This should be unconditional now I think?  You access the hardware  
directly.

> +	np = of_find_node_by_name(NULL, "aliases");
> +	if (!np) {
> +		pr_err("unable to find node %s\n", "aliases");
> +		goto out;
> +	}
> +
> +	path = of_get_property(np, HW_GPIO_ALIAS, NULL);
> +	of_node_put(np);
> +	if (!path) {
> +		pr_err("alias %s unknown\n", HW_GPIO_ALIAS);
> +		goto out;
> +	}

Don't use an alias here, search for e.g. a matching "compatible"  
instead.

> +static struct of_device_id wii_of_bus[] = {
> +	{ .compatible = "nintendo,hollywood", },

Like with Flipper, why a platform bus?

> +#ifdef CONFIG_STARLET_MINI
> +	{ .compatible = "twiizers,starlet-mini-ipc", },
> +#endif

This one should go completely, I will have more to say about it when  
I get
to review the device trees (saving those for last :-) ).


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-24 21:15                 ` Segher Boessenkool
@ 2009-11-24 22:33                   ` Arnd Bergmann
  2009-11-25 17:06                   ` Albert Herranz
  1 sibling, 0 replies; 181+ messages in thread
From: Arnd Bergmann @ 2009-11-24 22:33 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: Albert Herranz

On Tuesday 24 November 2009, Segher Boessenkool wrote:
> > This option should be used only for options applicable to both the  
> > GAMECUBE and WII, i.e. basically those options in the WII which  
> > where "inherited" from the GAMECUBE to make it retro-compatible.
> >
> > If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or  
> > GAMECUBE_COMPAT?
> 
> Maybe it's best to write GAMECUBE || WII in the places that use it,  
> then?

Or just use CONFIG_NINTENDO? If we ever want to port to a future
Nintendo system that is not compatible, we can still change it.

	Arnd <><

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-22 23:02     ` [RFC PATCH 02/19] powerpc: gamecube: device tree Grant Likely
  2009-11-23 19:44       ` Albert Herranz
@ 2009-11-24 22:36       ` Segher Boessenkool
  2009-11-26  4:23         ` Benjamin Herrenschmidt
  2009-11-26  4:21       ` Benjamin Herrenschmidt
  2 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 22:36 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

>> +       model = "NintendoGameCube";
>> +       compatible = "nintendo,gamecube";
>
> To date, we've been using the same form for both the model and
> compatible properties.  Specifically the <vendor>,<model> form to
> maintain the namespace.

That, however, is a) useless; and b) not totally correct.
The "model" property should show an exact model number if available.
You should use the "vendor," thing indeed.

If you don't have any better model # to use, using the same thing
as "compatible" is okay I suppose.  But it's not the _best_ thing
to put here if you have the choice.  Maybe you should say  
"nintendo,RVL-001"
(well, that's Wii, you want the similar thing for NGC, but you get
the point I hope).

>> +               compatible = "nintendo,flipper";
>> +               clock-frequency = <162000000>; /* 162MHz */
>> +               ranges = <0x0c000000 0x0c000000 0x00010000>;
>
> Since you're only doing 1:1 mappings; you could replace this with an
> empty "ranges;" property instead.

You could, but being explicit about the supported ranges isn't
bad either.

> Hint:  If you move the interrupt-parent property up to the root node,
> then you don't need to specify it in every single device node; it will
> just inherit from the parent.

If you have only one interrupt controller, like here, you don't
need to refer to it _at all_ :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-23 20:19         ` Grant Likely
  2009-11-23 20:25           ` Albert Herranz
@ 2009-11-24 22:53           ` Segher Boessenkool
  2009-11-26  4:23           ` Benjamin Herrenschmidt
  2 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-24 22:53 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

>> The soc node here tries to represent the big multi-function chip  
>> that integrates most of the devices of the video game consoles  
>> ("Flipper" on the Nintendo GameCube and "Hollywood" on the Wii).
>
> Right.  Much like many other SoCs.

It isn't a SoC, it's really just a memory bridge / I/O bridge
like e.g. MPC10x.

All the device addresses are fixed on the chip, there is no IMMR
or similar.

You can either group all devices under a "flipper" node, or just
put the devices directly in the root node, and have a separate
node for the generic control regs.  Both are a good description
of both the physical and logical structure, so it just comes down
to taste.

Good drivers can handle either structure btw, they should normally
only look at "compatible" to find their devices, so it doesn't
matter much anyway.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-24 21:00           ` Segher Boessenkool
@ 2009-11-24 23:45             ` Albert Herranz
  2009-11-25 16:53               ` Segher Boessenkool
  2009-11-26  4:36             ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-24 23:45 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> So what's your proposal then? Placing it within a fake func?
>> That asm snippet is the entry point. I took as an example how
>> prpmc2800.c deals with that, providing an own version of the (weak)
>> _zImage_start.
> 
> Use an assembler source file.  You'll get much nicer syntax as well
> (none of that \n stuff).
> 

I found it cleaner to embed the entry point code in the .c file and avoid touching the wrapper script.
But I'm fine with that if it is the way to go (and I already finally touched the wrapper to increase the link address...).

>>> WIMG=0000, are you sure?  Not M=1?
>>
>> To be honest, I don't recall the details now.
>> But it was tested in the very early days, the result was not the
>> expected one and, in the end, manual cache coherency management was
>> still needed.
> 
> Sure, the memory controllers don't do coherency.  I'm slightly worried
> about two things:
> 1) Will the generic code use M=0 as well?  Is it a problem if it doesn't?
> 2) Do lwarx. etc. work in M=0?
> 
> And a question: does M=0 actually give better performance (lower bus
> utilisation, and maybe saves a few cycles)?
> 

I think that the generic code uses M=0 _except_ for SMP and some platforms (see comment in cputable.h).
And yes, the generic code works with these processors :)

M=0 should have a lower bus utilization, yes.
Also M=0 is a requirement if you use some Gekko/Broadway features like the locked (half-)cache.

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-24 17:09                                   ` Albert Herranz
@ 2009-11-25  0:38                                     ` Michael Ellerman
  2009-11-26  5:22                                     ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 181+ messages in thread
From: Michael Ellerman @ 2009-11-25  0:38 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1578 bytes --]

On Tue, 2009-11-24 at 18:09 +0100, Albert Herranz wrote:
> Michael Ellerman wrote:
> >> Would it be acceptable to create a global var __allow_ioremap_normal_ram that by default would have a value of 0 and would be set _only_ for those platforms needing it?
> >>
> >> The other solutions I see is:
> >> - add support for discontiguous memory to powerpc 32-bits (which is not something that I can look into now)
> >> - don't use the precious second 64MB area (which is a waste)
> > 
> > - Implement your own ppc_md.ioremap(), see iseries & cell for example.
> > 
> > Currently that's only called on 64-bit, but you could change that.
> > 
> > If I'm reading your patch right, you should be able to do that check in
> > your platform's ioremap() and then call the generic implementation to do
> > the actual work.
> > 
> > cheers
> 
> I could use ppc_md.ioremap to duplicate ioremap except for the ioremap ram check.
> But calling the stock ioremap without modifying it is not possible
> because it checks and bails out when ioremapping a region marked as
> ram (even if it's not real ram and it's memreserved).

OK, that wasn't clear in your patch. It looks like you're adding a check
(!__map_without_bats) - but whatever.

> Is the list of memreserved areas preserved once the kernel is running?
> If it is preserved another option would be to unban ioremapping ram if memreserved.

Yeah it is, so that might work, though it's still a bit of a hack :)
But if that's just a stop-gap until sparse mem gets going on 32-bit
maybe that's OK.

cheers

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-24 23:45             ` Albert Herranz
@ 2009-11-25 16:53               ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-25 16:53 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>>> WIMG=0000, are you sure?  Not M=1?
>>>
>>> To be honest, I don't recall the details now.
>>> But it was tested in the very early days, the result was not the
>>> expected one and, in the end, manual cache coherency management was
>>> still needed.
>>
>> Sure, the memory controllers don't do coherency.  I'm slightly worried
>> about two things:
>> 1) Will the generic code use M=0 as well?  Is it a problem if it
>> doesn't?
>> 2) Do lwarx. etc. work in M=0?
>>
>> And a question: does M=0 actually give better performance (lower bus
>> utilisation, and maybe saves a few cycles)?
>
> I think that the generic code uses M=0 _except_ for SMP and some platforms
> (see comment in cputable.h).
> And yes, the generic code works with these processors :)

I meant, if it doesn't, does it give conflicts.  But I did some
reading up and M=0 is indeed the way to go, so all is fine :-)

> M=0 should have a lower bus utilization, yes.
> Also M=0 is a requirement if you use some Gekko/Broadway features like the
> locked (half-)cache.

Well we don't use that, but point taken.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-23 19:54           ` Albert Herranz
  2009-11-23 20:36             ` Grant Likely
@ 2009-11-25 16:57             ` Segher Boessenkool
  2009-11-25 18:09               ` Albert Herranz
  1 sibling, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-25 16:57 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> +               i2c-video {
>>> +                       #address-cells = <1>;
>>> +                       #size-cells = <0>;
>>> +                       compatible = "virtual,i2c-gpio";
>>
>> There isn't a documented binding for this.  Is there a driver for it?
>>
>
> I have a driver for it. But it isn't yet published.

I bet there already is a generic IIC-via-GPIOs driver that
you could use.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-24 21:15                 ` Segher Boessenkool
  2009-11-24 22:33                   ` Arnd Bergmann
@ 2009-11-25 17:06                   ` Albert Herranz
  1 sibling, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:06 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or
>> GAMECUBE_COMPAT?
> 
> Maybe it's best to write GAMECUBE || WII in the places that use it, then?
> 

That gets messy in conditionals, like for example:

 config PCI
 	bool "PCI support" if PPC_PCI_CHOICE
 	default y if !40x && !CPM2 && !8xx && !PPC_83xx \
-		&& !PPC_85xx && !PPC_86xx
+		&& !PPC_85xx && !PPC_86xx && !(GAMECUBE || WII)
 	default PCI_PERMEDIA if !4xx && !CPM2 && !8xx
 	default PCI_QSPAN if !4xx && !CPM2 && 8xx
 	select ARCH_SUPPORTS_MSI

I'd prefer to have a Kconfig option for that, if we can come up with an agreed name :)

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-24 21:19                       ` Segher Boessenkool
@ 2009-11-25 17:07                         ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:07 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>>> Surely there is something called something like of_node_is_compatible()
>>> you can use here?  You already have the node pointer, there is no need
>>> to look at all other nodes.
>>>
>>
>> I see the point.
>> I didn't find of_node_is_compatible() but I'll look what's available
>> here.
> 
> int of_device_is_compatible(const struct device_node *device,
>                 const char *compat)
> 

Thanks. I'll pick that.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-24 21:30                       ` Segher Boessenkool
@ 2009-11-25 17:13                         ` Albert Herranz
  2009-11-26 21:52                           ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:13 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>>  config GAMECUBE_COMMON
>>      bool
>>      select NOT_COHERENT_CACHE
>> +    select FLIPPER_PIC
> 
> Maybe using FLIPPER (or GAMECUBE_FLIPPER) instead of GAMECUBE_COMMON
> is a good name?
> 

I'd prefer to not use a name that implies a specific hardware to describe two (mostly) similar but different hardwares.

>> +#define pr_fmt(fmt) DRV_MODULE_NAME ": " fmt
> 
> Unused
> 

Nope. It is used via the pr_{err,info,...} macros.

>> +/*
>> + * Each interrupt has a corresponding bit in both
>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>> + *
>> + * Enabling/disabling an interrupt line involves asserting/clearing
>> + * the corresponding bit in IMR. ACK'ing a request simply involves
>> + * asserting the corresponding bit in ICR.
>> + */
> 
>> +static void flipper_pic_ack(unsigned int virq)
>> +{
>> +    int irq = virq_to_hw(virq);
>> +    void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +    set_bit(irq, io_base + FLIPPER_ICR);
>> +}
> 
> So it should be a simple write instead of an RMW here, right?
> As it is you are ACKing _all_ IRQs as far as I can see.
> 

No, it acks just a single IRQ.
But the simple write idea may work. I need to check if writing 0s causes no harm (which IIRC is true).

>> +unsigned int flipper_pic_get_irq(void)
>> +{
>> +    void __iomem *io_base = flipper_irq_host->host_data;
>> +    int irq;
>> +    u32 irq_status;
>> +
>> +    irq_status = in_be32(io_base + FLIPPER_ICR) &
>> +             in_be32(io_base + FLIPPER_IMR);
>> +    if (irq_status == 0)
>> +        return -1;    /* no more IRQs pending */
>> +
>> +    __asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
>> +    return irq_linear_revmap(flipper_irq_host, 31 - irq);
>> +}
> 
> There are generic macros for this kind of thing, no need for asm.  ffs()
> or something.
> 

__ffs() matches exactly that. Thanks.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-24 21:39                         ` Segher Boessenkool
@ 2009-11-25 17:24                           ` Albert Herranz
  2009-11-26 21:53                             ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:24 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> +static struct of_device_id gamecube_of_bus[] = {
>> +    { .compatible = "nintendo,flipper", },
>> +    { },
>> +};
>> +
>> +static int __init gamecube_device_probe(void)
>> +{
>> +    if (!machine_is(gamecube))
>> +        return 0;
>> +
>> +    of_platform_bus_probe(NULL, gamecube_of_bus, NULL);
>> +    return 0;
>> +}
> 
> You really do not need a platform bus as far as I can see?
> 

We need it as it currently doesn't match with the default bus ids.

const struct of_device_id of_default_bus_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "plb5", },
        { .type = "plb4", },
        { .type = "opb", },
        { .type = "simple", },
        {},
};

Should I introduce a .type property matching any of those above in the soc node, and get rid of the explicit bus probe?

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-24 21:54                                 ` Segher Boessenkool
@ 2009-11-25 17:27                                   ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:27 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> +config HLWD_PIC
> 
> Are vowels too expensive?  :-)
> 

Heh, you work/worked for IBM. Look at what they did with the CLI in the AS/400...

I thought here that hollywood is a rather large prefix and there is also a board called holly. So I came up with hlwd :)

>> +static void hlwd_pic_ack(unsigned int virq)
>> +{
>> +    int irq = virq_to_hw(virq);
>> +    void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +    set_bit(irq, io_base + HW_BROADWAY_ICR);
>> +}
> 
> Same issue as with Flipper here.
> 

See my comments on the previous message.

>> +    __asm__ __volatile__("cntlzw %0,%1" : "=r"(irq) : "r"(irq_status));
>> +    return irq_linear_revmap(h, 31 - irq);
> 
> And here.
> 

Ditto.

>> +static void __hlwd_quiesce(void __iomem *io_base)
>> +{
>> +    /* mask and ack all IRQs */
>> +    out_be32(io_base + HW_BROADWAY_IMR, 0);
>> +    out_be32(io_base + HW_BROADWAY_ICR, ~0);
>> +}
> 
> I would write 0xffffffff instead, it's clearer and slightly
> more robust.
> 

Ok.

>> +void hlwd_pic_probe(void)
>> +{
>> +    struct irq_host *host;
>> +    struct device_node *np;
>> +    const u32 *interrupts;
>> +    int cascade_virq;
>> +
>> +    for_each_compatible_node(np, NULL, "nintendo,hollywood-pic") {
>> +        interrupts = of_get_property(np, "interrupts", NULL);
>> +        if (interrupts) {
>> +            host = hlwd_pic_init(np);
>> +            BUG_ON(!host);
>> +            cascade_virq = irq_of_parse_and_map(np, 0);
>> +            set_irq_data(cascade_virq, host);
>> +            set_irq_chained_handler(cascade_virq,
>> +                        hlwd_pic_irq_cascade);
> 
> break;  here?  You do not handle more than one hollywood-pic elsewhere
> (which of course is fine).

Yup, thanks. I'll stop after the first pic.

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support
  2009-11-24 22:13                                   ` Segher Boessenkool
@ 2009-11-25 17:47                                     ` Albert Herranz
  2009-11-26 22:00                                       ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:47 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> Add support for the BootMii 'mini' firmware replacement for the
>> Starlet processor.
>>
>> 'mini' is an open source IOS replacement written from scratch by
>> Team Twiizers.
> 
> It's not a replacement, it doesn't have any of the same functionality.
> 

I didn't know 'replacement' had that semantics. My intention was to say that 'mini' firmware is an alternative to the stock IOS firmware, not trying to imply that it behaves like it or it is compatible with it.
Point taken.

I'll use 'mini' alternate firmware if that's ok.

>> It grants full access to the hardware found on the
>> Nintendo Wii video game console via a custom IPC mechanism.
> 
> This is out of date, you get full register-level hardware access now.
> 

Yes, as I already said in one of my messages.
That description doesn't try to imply that you cannot access the hardware via other means. It describes what the IPC mechanism is about.

If the comment is misleading I can change the comment or enhance it.

> Do you want to mainline any of the drivers that work via mini proxy?
> If not, you can remove quite some bit of code here I think.
> 

Yes, that I already said too :)

>> +enum starlet_ipc_flavour {
>> +    STARLET_IPC_IOS,
>> +    STARLET_IPC_MINI,
>> +};
> 
> I thought you don't support IOS at all anymore?
> 

I don't plan to mainline IOS support.
But to make runtime decisions I need to know if we are running along the 'mini' firmware or the default IOS firmware.
That's the intention of that enum.

>> +config STARLET_MINI
>> +    bool "BootMii Starlet 'mini' firmware support"
>> +    depends on WII && EXPERIMENTAL
> 
> Given that this is the only supported starlet firmware interface,
> does it make sense to expose the option to the user?
> 

You're right. We can just select it until we have another alternate firmware and its support available.

> <big snip, see my "remove stuff" comment above>
> 
>> +static void mipc_init_ahbprot(struct mipc_device *ipc_dev)
>> +{
>> +    void __iomem *hw_ahbprot;
>> +    u32 initial_ahbprot, ahbprot = 0;
>> +
>> +    hw_ahbprot = mipc_get_hw_reg(HW_AHBPROT_OF_COMPATIBLE);
>> +    if (!hw_ahbprot)
>> +        goto done;
>> +
>> +    initial_ahbprot = mipc_readl(hw_ahbprot);
>> +    if (initial_ahbprot != 0xffffffff) {
>> +        pr_debug("AHBPROT=%08X (before)\n", initial_ahbprot);
>> +        /* enable full access from the PowerPC side */
>> +        mipc_writel(0xffffffff, hw_ahbprot);
>> +    }
>> +
>> +    ahbprot = mipc_readl(hw_ahbprot);
>> +    if (initial_ahbprot != ahbprot)
>> +        pr_debug("AHBPROT=%08X (after)\n", ahbprot);
>> +done:
>> +    if (ahbprot != 0xffffffff)
>> +        pr_err("failed to set AHBPROT\n");
>> +}
> 
> Modern mini will always have AHBPROT set up to give you full access,
> so this isn't needed either.
> 

So we have two options here:
- assume that whatever firmware is running properly sets AHBPROT and hope it works
- or try to use the existing firmware interfaces to check and make sure that AHBPROT is indeed properly set

I chose the second option here.

>> +#ifdef CONFIG_HLWD_PIC
>> +    /*
>> +     * Setup the Hollywood interrupt controller as soon as
>> +     * we detect that we are running under the mini firmware.
>> +     */
>> +    hlwd_pic_probe();
>> +#endif
> 
> Why?  The comment doesn't say.
> 

Same as before, we don't try to setup the Hollywood interrupt controller until we have verified that we can directly access the hardware.

> 
> Do you need this driver to boot?  If not, it might be best to leave it
> out for now.
> 

Strictly speaking, we don't need the driver to boot if we asume that AHBPROT is properly set.
But we'll need it later to shutdown 'mini' drivers, unless 'mini' is changed to boot PowerPC code with all hardware already relinquished.

That is not true for the last available version of 'mini' firmware. That version still boots PowerPC code with at least the SDHCI controller driven by 'mini'.
We need to issue a IPC_SDHC_EXIT to the firmware to force it to stop using the SDHCI controller.

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
  2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
  2009-11-22 23:18         ` [RFC PATCH 04/19] powerpc: wii: device tree Grant Likely
@ 2009-11-25 17:49         ` Segher Boessenkool
  2009-11-25 18:34           ` Albert Herranz
  2009-11-26  4:51           ` Benjamin Herrenschmidt
  2009-11-26  4:45         ` Benjamin Herrenschmidt
  3 siblings, 2 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-25 17:49 UTC (permalink / raw)
  To: Albert Herranz; +Cc: Albert Herranz, linuxppc-dev

> +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */

Like others have said already, don't do this.  If you need
a workaround, put it in the platform code.

> +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */

This address is fixed in the DSP hardware, right?  If not,
you shouldn't do a reserve here.

> +	chosen {
> +		/* root filesystem on 2nd partition of SD card */
> +		bootargs = "nobats root=/dev/mmcblk0p2 rootwait udbg-immortal";

Question: why do you need/want nobats?

> +	memory {
> +		device_type = "memory";
> +		/* MEM1 + memory hole + MEM2 - firmware/buffers area */
> +		reg = <0x00000000 0x133e0000>;

This should be  <0 0x01800000  0x10000000 0x04000000>

I'm not sure what at the end of MEM2 you're trying to hide,
but if you need to hide anything, do it in the platform code
isntead.

> +	cpus {
> +		#cpus = <1>;

Don't use #cpus

> +	/* devices contained in the hollywood chipset */
> +	soc {

It's not a SoC, more like a bridge chip.  More to the point,
all the devices you put under this node actually sit in the
root domain logically/physically, so why not put them there
instead.  You'll want a node for the generic control registers,
if you do.

> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		#interrupt-cells = <1>;
> +		model = "hollywood";

"model" isn't required here, if you don't have anything
good to put in it, just don't use the property.

> +		compatible = "nintendo,hollywood";
> +		clock-frequency = <243000000>; /* 243MHz */

What does this clock freq mean?  Hollywood has lots of
clocks, many of them configurable.  Bus frequency is in
the cpu node already.  The binding doesn't say what this
is either, since you didn't write a binding :-)

Just remove it?

> +		ranges = <0x0c000000 0x0c000000 0x00010000
> +			  0x0d000000 0x0d000000 0x00010000
> +			  0x0d040000 0x0d040000 0x00050000
> +			  0x0d800000 0x0d800000 0x00001000

All of 0cXXXXXX and 0dXXXXXX actually.

> +			  0x133e0000 0x133e0000 0x00c20000>;

This is just part of MEM2, don't treat it special here.

> +		video@0c002000 {
> +			compatible = "nintendo,hollywood-video";
> +			reg = <0x0c002000 0x100>;
> +			interrupts = <8>;
> +			interrupt-parent = <&PIC0>;

If you say interrupt-parent = <..> in the root node, you can
leave it out in most of the rest of the tree.  Using the Flipper
PIC for this sounds like a good plan.

> +		PIC0: pic0@0c003000 {
> +			#interrupt-cells = <1>;
> +			compatible = "nintendo,flipper-pic";
> +			reg = <0x0c003000 0x8>;

This register block is bigger actually.  It's not only PIC,
but some other bus stuff as well, dunno what to do here.

> +			interrupt-controller;
> +		};
> +
> +		resetswitch@0c003000 {
> +			compatible = "nintendo,hollywood-resetswitch";
> +			reg = <0x0c003000 0x4>;

That's the same address.  Don't do that.

Create a flipper-processor-interface node for the whole 3000
block (size 100)?  You can hang the PIC as a subnode under it,
without a "reg".

> +		/* Team Twiizers' 'mini' firmware IPC */
> +		mini@0d000000 {

Although mini is awesome, it isn't hardware, and doesn't
belong in the device tree.

> +			#address-cells = <1>;
> +			#size-cells = <1>;

There are no child nodes, these are meaningless.

> +			#interrupt-cells = <1>;

This isn't an interrupt controller.

> +			compatible = "twiizers,starlet-mini-ipc";
> +			reg = <0x0d000000 0x40	/* IPC */

You can get the IPC controller's address from the "main"
hollywood device node.

> +			       0x13fffffc 0x4>;	/* mini header pointer */

Put this in the platform code, it's not a hardware property.
It's not going to change either.

> +		serial@0d006400 {
> +			compatible = "nintendo,hollywood-serial";

You might want to pick a more descriptive name for this,
"serial" is usually understaood to mean "RS232".  Which
this isn't.

> +		/* External Interface bus */
> +		exi@0d006800 {
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			compatible = "nintendo,hollywood-exi";
> +			reg = <0x0d006800 0x40>;
> +			interrupts = <4>;
> +			interrupt-parent = <&PIC0>;
> +
> +			USBGECKO0: usbgecko@0d006814 {
> +				compatible = "usbgecko,usbgecko";
> +				reg = <0x0d006814 0x14>;
> +				virtual-reg = <0xcd006814>;
> +			};

I don't think you should put the usbgecko in the device tree,
it's a removable device, not everyone booting with this device
tree blob will have a usbgecko in this EXI port.  It's easy
to probe for as well.

> +		ehci@0d040000 {
> +			compatible = "nintendo,hollywood-ehci";

You might want to put the generic usb-ohci in here as well.
Although you need bug workarounds IIRC.

> +			reg = <0x0d040000 0x100
> +			       0x133e0000 0x80000>; /* 512 KB */

What's this MEM2 range?  A remnant from the old mini scheme?

> +		ohci0@0d050000 {

> +		ohci1@0d060000 {

> +		sdhc0@0d070000 {

> +		sdhc1@0d080000 {

Similar.

> +		hollywood-ahbprot@0d800064 {
> +			compatible = "nintendo,hollywood-ahbprot";
> +			reg = <0x0d800064 0x4>;
> +		};

There is no reason to single out this one register.  The kernel
shouldn't care for it anyway, the firmware sets it already.

> +		gpio0: hollywood-gpio@0d8000c0 {
> +			compatible = "nintendo,hollywood-gpio";
> +			reg = <0x0d8000c0 0x20>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +		};
> +
> +		gpio1: hollywood-gpio@0d8000e0 {
> +			compatible = "nintendo,hollywood-gpio";
> +			reg = <0x0d8000e0 0x20>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +		};

Yuck, you have to make this two nodes for the GPIO binding?

> +		hollywood-resets@0d800194 {
> +			compatible = "nintendo,hollywood-resets";
> +			reg = <0x0d800194 0x4>;
> +		};

Don't do a separate node.

> +		i2c-video {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +		        compatible = "virtual,i2c-gpio";

This is not a device from a company named "virtual".  Just
"i2c-gpio" will do.

As I said elsewhere, there should be a driver for this already,
and a device tree binding.  Add to that if at all possible, don't
make up something new.  Or if you do, give it a better name :-)

> +		        audio-video-encoder {
> +		                compatible = "nintendo,wii-ave-rvl";
> +		                reg = <0x70>;

audio-video-encoder@70 -- the unit address has to match the first
entry in "reg", always.

And "wii-ave-rvl", seriously?  Just call it "wii-audio-video-encoder",
a few extra chars don't hurt :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 18/19] powerpc: wii: platform support
  2009-11-24 22:24                                     ` Segher Boessenkool
@ 2009-11-25 17:58                                       ` Albert Herranz
  2009-11-26 22:05                                         ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 17:58 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> diff --git a/arch/powerpc/platforms/embedded6xx/wii.c
>> b/arch/powerpc/platforms/embedded6xx/wii.c
> 
>> +#define DRV_MODULE_NAME "rvl"
> 
> Should this be "wii"?
> 

Ok. I'm fine with both.

>> +static enum starlet_ipc_flavour starlet_ipc_flavour;
>> +
>> +enum starlet_ipc_flavour starlet_get_ipc_flavour(void)
>> +{
>> +    return starlet_ipc_flavour;
>> +}
> 
> This can go I think, unless you plan on supporting something else than
> mini?
> 

See comment in previous message.
Irrespective of supporting other firmwares, we need to know the one we are running under.

>> +#ifdef CONFIG_STARLET_MINI
>> +
>> +#define HW_RESETS_OF_COMPATIBLE    "nintendo,hollywood-resets"
>> +#define HW_GPIO_ALIAS        "hw_gpio
> 
> This should be unconditional now I think?  You access the hardware
> directly.
> 

Yes, at this stage direct hardware should be possible, but only if 'mini' support is compiled-in (which will be the default option at this stage).
We can either leave the conditionals as is now, or remove them and add them later if we support more than one firmware flavour.

I'm fine with both options.

>> +    np = of_find_node_by_name(NULL, "aliases");
>> +    if (!np) {
>> +        pr_err("unable to find node %s\n", "aliases");
>> +        goto out;
>> +    }
>> +
>> +    path = of_get_property(np, HW_GPIO_ALIAS, NULL);
>> +    of_node_put(np);
>> +    if (!path) {
>> +        pr_err("alias %s unknown\n", HW_GPIO_ALIAS);
>> +        goto out;
>> +    }
> 
> Don't use an alias here, search for e.g. a matching "compatible" instead.
> 

I used an alias because I wanted explicitly the second GPIO word.

Is there another way to select a specific instance of repeated identical hardware?
We have two instances of gpios here, matching the same "compatible".

>> +static struct of_device_id wii_of_bus[] = {
>> +    { .compatible = "nintendo,hollywood", },
> 
> Like with Flipper, why a platform bus?
> 

See previous message.

>> +#ifdef CONFIG_STARLET_MINI
>> +    { .compatible = "twiizers,starlet-mini-ipc", },
>> +#endif
> 
> This one should go completely, I will have more to say about it when I get
> to review the device trees (saving those for last :-) ).
> 

Yes, this is not needed. I'll get rid of it.

Thanks a lot!
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
  2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
  2009-11-22 23:02     ` [RFC PATCH 02/19] powerpc: gamecube: device tree Grant Likely
@ 2009-11-25 18:00     ` Segher Boessenkool
  2009-11-25 18:43       ` Albert Herranz
  2009-11-26  4:27       ` Benjamin Herrenschmidt
  2 siblings, 2 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-25 18:00 UTC (permalink / raw)
  To: Albert Herranz; +Cc: Albert Herranz, linuxppc-dev

> +	memory {
> +		device_type = "memory";
> +		/* 24M minus framebuffer memory area (640*576*2*2) */
> +		reg = <0x00000000 0x01698000>;

Put the whole 24MB here, probe the framebuffer address and size
in the platform code?

> +	soc {
> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		#interrupt-cells = <1>;

This isn't an interrupt controller, don't put #interrupt-cells
here.

> +		video@0c002000 {
> +			compatible = "nintendo,flipper-video";
> +			reg = <0x0c002000 0x100>;
> +			interrupts = <8>;
> +			interrupt-parent = <&pic>;
> +			/* XFB is the eXternal FrameBuffer */
> +			xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
> +			xfb-size = <0x168000>;

XFB address isn't fixed on the hardware, and the kernel might
want to move it, and you can easily probe for it anyway.  Remove
these last two properties please.


> +		auxram@0c005000 {
> +			compatible = "nintendo,flipper-auxram";
> +			reg = <0x0c005000 0x200>;	/* DSP */
> +			interrupts = <6>;
> +			interrupt-parent = <&pic>;
> +		};
> +
> +		audio@0c005000 {
> +			compatible = "nintendo,flipper-audio";
> +			reg = <0x0c005000 0x200		/* DSP */
> +			       0x0c006c00 0x20>;	/* AI */
> +			interrupts = <6>;
> +			interrupt-parent = <&pic>;
> +		};

These two have the same address, not good.  Just remove the
auxram node?

> +		disk@0c006000 {
> +			compatible = "nintendo,flipper-disk";

I always thought optical discs are spelled with a "c", but
people disagree a lot on this :-)

...and all the applicable things I mentioned in my Wii dev tree
reply, of course.

Wow, it wasn't as bad as I expected actually.  But you cheated,
you omitted most devices from the device trees :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-25 16:57             ` Segher Boessenkool
@ 2009-11-25 18:09               ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 18:09 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>>>> +               i2c-video {
>>>> +                       #address-cells = <1>;
>>>> +                       #size-cells = <0>;
>>>> +                       compatible = "virtual,i2c-gpio";
>>> There isn't a documented binding for this.  Is there a driver for it?
>>>
>> I have a driver for it. But it isn't yet published.
> 
> I bet there already is a generic IIC-via-GPIOs driver that
> you could use.
> 

Yes, there is a platform driver for that.
I picked that, extracted the common code into a common file, converted the existing driver to use the common code, then created a new one for platform bindings using the common code again.

(Then added gpio_direction_is_output() to gpiolib and sda_enforce_dir() to i2c-gpio).

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-25 17:49         ` Segher Boessenkool
@ 2009-11-25 18:34           ` Albert Herranz
  2009-11-26  4:58             ` Benjamin Herrenschmidt
  2009-11-26  4:51           ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 18:34 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */
> 
> Like others have said already, don't do this.  If you need
> a workaround, put it in the platform code.
> 

I'll do. Thanks.

>> +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */
> 
> This address is fixed in the DSP hardware, right?  If not,
> you shouldn't do a reserve here.
> 

AFAIK, it is hardcoded in hardware.

>> +	chosen {
>> +		/* root filesystem on 2nd partition of SD card */
>> +		bootargs = "nobats root=/dev/mmcblk0p2 rootwait udbg-immortal";
> 
> Question: why do you need/want nobats?
> 

We need nobats (or a hack in the mmu_mapin_ram() code) because of the discontiguous ram problem.

>> +	memory {
>> +		device_type = "memory";
>> +		/* MEM1 + memory hole + MEM2 - firmware/buffers area */
>> +		reg = <0x00000000 0x133e0000>;
> 
> This should be  <0 0x01800000  0x10000000 0x04000000>
> 

Ok.

> I'm not sure what at the end of MEM2 you're trying to hide,
> but if you need to hide anything, do it in the platform code
> isntead.
> 
>> +	cpus {
>> +		#cpus = <1>;
> 
> Don't use #cpus
> 

I'll remove it if it's not needed. Thanks.

>> +	/* devices contained in the hollywood chipset */
>> +	soc {
> 
> It's not a SoC, more like a bridge chip.  More to the point,
> all the devices you put under this node actually sit in the
> root domain logically/physically, so why not put them there
> instead.  You'll want a node for the generic control registers,
> if you do.
> 

So, if i use a node here, what should be the proper name for it?

>> +		#address-cells = <1>;
>> +		#size-cells = <1>;
>> +		#interrupt-cells = <1>;
>> +		model = "hollywood";
> 
> "model" isn't required here, if you don't have anything
> good to put in it, just don't use the property.
> 

I'll get rid of it.

>> +		compatible = "nintendo,hollywood";
>> +		clock-frequency = <243000000>; /* 243MHz */
> 
> What does this clock freq mean?  Hollywood has lots of
> clocks, many of them configurable.  Bus frequency is in
> the cpu node already.  The binding doesn't say what this
> is either, since you didn't write a binding :-)
> 
> Just remove it?

That's the bus frequency. If it's not needed there, I vote for dropping it.

> 
>> +		ranges = <0x0c000000 0x0c000000 0x00010000
>> +			  0x0d000000 0x0d000000 0x00010000
>> +			  0x0d040000 0x0d040000 0x00050000
>> +			  0x0d800000 0x0d800000 0x00001000
> 
> All of 0cXXXXXX and 0dXXXXXX actually.
> 
>> +			  0x133e0000 0x133e0000 0x00c20000>;
> 
> This is just part of MEM2, don't treat it special here.
> 

Ok.

>> +		video@0c002000 {
>> +			compatible = "nintendo,hollywood-video";
>> +			reg = <0x0c002000 0x100>;
>> +			interrupts = <8>;
>> +			interrupt-parent = <&PIC0>;
> 
> If you say interrupt-parent = <..> in the root node, you can
> leave it out in most of the rest of the tree.  Using the Flipper
> PIC for this sounds like a good plan.
> 

Yeah, agreed.

>> +		PIC0: pic0@0c003000 {
>> +			#interrupt-cells = <1>;
>> +			compatible = "nintendo,flipper-pic";
>> +			reg = <0x0c003000 0x8>;
> 
> This register block is bigger actually.  It's not only PIC,
> but some other bus stuff as well, dunno what to do here.
> 

Heh, you're the expert here :)

>> +			interrupt-controller;
>> +		};
>> +
>> +		resetswitch@0c003000 {
>> +			compatible = "nintendo,hollywood-resetswitch";
>> +			reg = <0x0c003000 0x4>;
> 
> That's the same address.  Don't do that.
> 
> Create a flipper-processor-interface node for the whole 3000
> block (size 100)?  You can hang the PIC as a subnode under it,
> without a "reg".
> 

Ok.

>> +		/* Team Twiizers' 'mini' firmware IPC */
>> +		mini@0d000000 {
> 
> Although mini is awesome, it isn't hardware, and doesn't
> belong in the device tree.
> 

True, now that I'm starting to understand what's supposed to be and what's supposed not to be in the device tree.

>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
> 
> There are no child nodes, these are meaningless.
> 

Yeah.
In previous versions of the tree, before AHBPROT was discovered, all hardware accessed via the firmware ipc interface hanged here, though.

>> +			#interrupt-cells = <1>;
> 
> This isn't an interrupt controller.
> 

Yup, not applicable anymore.

>> +			compatible = "twiizers,starlet-mini-ipc";
>> +			reg = <0x0d000000 0x40	/* IPC */
> 
> You can get the IPC controller's address from the "main"
> hollywood device node.
> 

What about the interrupt associated to the IPC hardware?

>> +			       0x13fffffc 0x4>;	/* mini header pointer */
> 
> Put this in the platform code, it's not a hardware property.
> It's not going to change either.
> 

Ok.

>> +		serial@0d006400 {
>> +			compatible = "nintendo,hollywood-serial";
> 
> You might want to pick a more descriptive name for this,
> "serial" is usually understaood to mean "RS232".  Which
> this isn't.
> 

Nintendo calls it "Serial Interface" (SI).
Would "nintendo,hollywood-serial-interface" work here?

>> +		/* External Interface bus */
>> +		exi@0d006800 {
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +			compatible = "nintendo,hollywood-exi";
>> +			reg = <0x0d006800 0x40>;
>> +			interrupts = <4>;
>> +			interrupt-parent = <&PIC0>;
>> +
>> +			USBGECKO0: usbgecko@0d006814 {
>> +				compatible = "usbgecko,usbgecko";
>> +				reg = <0x0d006814 0x14>;
>> +				virtual-reg = <0xcd006814>;
>> +			};
> 
> I don't think you should put the usbgecko in the device tree,
> it's a removable device, not everyone booting with this device
> tree blob will have a usbgecko in this EXI port.  It's easy
> to probe for as well.
> 

Ok.

>> +		ehci@0d040000 {
>> +			compatible = "nintendo,hollywood-ehci";
> 
> You might want to put the generic usb-ohci in here as well.
> Although you need bug workarounds IIRC.
> 

Yes.

>> +			reg = <0x0d040000 0x100
>> +			       0x133e0000 0x80000>; /* 512 KB */
> 
> What's this MEM2 range?  A remnant from the old mini scheme?
> 
>> +		ohci0@0d050000 {
> 
>> +		ohci1@0d060000 {
> 
>> +		sdhc0@0d070000 {
> 
>> +		sdhc1@0d080000 {
> 
> Similar.
> 

Yes. This can be removed now.

>> +		hollywood-ahbprot@0d800064 {
>> +			compatible = "nintendo,hollywood-ahbprot";
>> +			reg = <0x0d800064 0x4>;
>> +		};
> 
> There is no reason to single out this one register.  The kernel
> shouldn't care for it anyway, the firmware sets it already.
> 

As long as a recent firmware version is used, yes.

How should all these register be declared in the device tree?
Using a block of registers and declaring the block as "nintendo,hollywood-control" or something?

>> +		gpio0: hollywood-gpio@0d8000c0 {
>> +			compatible = "nintendo,hollywood-gpio";
>> +			reg = <0x0d8000c0 0x20>;
>> +			gpio-controller;
>> +			#gpio-cells = <2>;
>> +		};
>> +
>> +		gpio1: hollywood-gpio@0d8000e0 {
>> +			compatible = "nintendo,hollywood-gpio";
>> +			reg = <0x0d8000e0 0x20>;
>> +			gpio-controller;
>> +			#gpio-cells = <2>;
>> +		};
> 
> Yuck, you have to make this two nodes for the GPIO binding?
> 

Yup. Two gpio nodes for two 32 gpio words.

>> +		hollywood-resets@0d800194 {
>> +			compatible = "nintendo,hollywood-resets";
>> +			reg = <0x0d800194 0x4>;
>> +		};
> 
> Don't do a separate node.
> 

So this should be part of the "control" block?

>> +		i2c-video {
>> +			#address-cells = <1>;
>> +			#size-cells = <0>;
>> +		        compatible = "virtual,i2c-gpio";
> 
> This is not a device from a company named "virtual".  Just
> "i2c-gpio" will do.
> 
> As I said elsewhere, there should be a driver for this already,
> and a device tree binding.  Add to that if at all possible, don't
> make up something new.  Or if you do, give it a better name :-)
> 

Plese, see my previous comment on this.

>> +		        audio-video-encoder {
>> +		                compatible = "nintendo,wii-ave-rvl";
>> +		                reg = <0x70>;
> 
> audio-video-encoder@70 -- the unit address has to match the first
> entry in "reg", always.
> 
> And "wii-ave-rvl", seriously?  Just call it "wii-audio-video-encoder",
> a few extra chars don't hurt :-)
> 

Agreed too. :)

Thanks!
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-25 18:00     ` Segher Boessenkool
@ 2009-11-25 18:43       ` Albert Herranz
  2009-11-27 12:07         ` Segher Boessenkool
  2009-11-26  4:27       ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-25 18:43 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> +	memory {
>> +		device_type = "memory";
>> +		/* 24M minus framebuffer memory area (640*576*2*2) */
>> +		reg = <0x00000000 0x01698000>;
> 
> Put the whole 24MB here, probe the framebuffer address and size
> in the platform code?
> 

Yes, I'll do that.

>> +	soc {
>> +		#address-cells = <1>;
>> +		#size-cells = <1>;
>> +		#interrupt-cells = <1>;
> 
> This isn't an interrupt controller, don't put #interrupt-cells
> here.
> 

Isn't this needed to define what is to be expected in the "interrupts" properties of the child nodes?

>> +		video@0c002000 {
>> +			compatible = "nintendo,flipper-video";
>> +			reg = <0x0c002000 0x100>;
>> +			interrupts = <8>;
>> +			interrupt-parent = <&pic>;
>> +			/* XFB is the eXternal FrameBuffer */
>> +			xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
>> +			xfb-size = <0x168000>;
> 
> XFB address isn't fixed on the hardware, and the kernel might
> want to move it, and you can easily probe for it anyway.  Remove
> these last two properties please.
> 

I'll clean that too. The location of the framebuffer will be a platform code decission, instead of a device tree "setting".

> 
>> +		auxram@0c005000 {
>> +			compatible = "nintendo,flipper-auxram";
>> +			reg = <0x0c005000 0x200>;	/* DSP */
>> +			interrupts = <6>;
>> +			interrupt-parent = <&pic>;
>> +		};
>> +
>> +		audio@0c005000 {
>> +			compatible = "nintendo,flipper-audio";
>> +			reg = <0x0c005000 0x200		/* DSP */
>> +			       0x0c006c00 0x20>;	/* AI */
>> +			interrupts = <6>;
>> +			interrupt-parent = <&pic>;
>> +		};
> 
> These two have the same address, not good.  Just remove the
> auxram node?
> 

The DSP and the ARAM control/status bits share some registers in the same block.

How should I match the aram block driver if I remove the auxram node?

>> +		disk@0c006000 {
>> +			compatible = "nintendo,flipper-disk";
> 
> I always thought optical discs are spelled with a "c", but
> people disagree a lot on this :-)
> 

The "disk" here comes from "Disk Interface" (DI) as described by Nintendo patents about the GameCube.
So I chose "k" here :)

> ...and all the applicable things I mentioned in my Wii dev tree
> reply, of course.
> 
> Wow, it wasn't as bad as I expected actually.  But you cheated,
> you omitted most devices from the device trees :-)
> 

You're welcome to add them too if you have information about them :)

Thanks again,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support
  2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
  2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
  2009-11-22 22:50   ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Grant Likely
@ 2009-11-26  4:12   ` Benjamin Herrenschmidt
  2 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:12 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> Add support for using the USB Gecko adapter as a bootwrapper console on
> the Nintendo GameCube and Wii video game consoles.
> The USB Gecko is a 3rd party memory card interface adapter that provides
> a EXI (External Interface) to USB serial converter.

Looks good. Not sure yet when I'll merge these, I might wait a bit for
the dust to settle but I may also just stick some of the simple/obvious
patches in early like this one to make things easier.

Cheers,
Ben.

> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
>  arch/powerpc/boot/Makefile |    2 +-
>  arch/powerpc/boot/ugecon.c |  128 ++++++++++++++++++++++++++++++++++++++++++++
>  arch/powerpc/boot/ugecon.h |   25 +++++++++
>  3 files changed, 154 insertions(+), 1 deletions(-)
>  create mode 100644 arch/powerpc/boot/ugecon.c
>  create mode 100644 arch/powerpc/boot/ugecon.h
> 
> diff --git a/arch/powerpc/boot/Makefile b/arch/powerpc/boot/Makefile
> index 7bfc8ad..44bce21 100644
> --- a/arch/powerpc/boot/Makefile
> +++ b/arch/powerpc/boot/Makefile
> @@ -66,7 +66,7 @@ src-wlib := string.S crt0.S crtsavres.S stdio.c main.c \
>  		gunzip_util.c elf_util.c $(zlib) devtree.c oflib.c ofconsole.c \
>  		4xx.c ebony.c mv64x60.c mpsc.c mv64x60_i2c.c cuboot.c bamboo.c \
>  		cpm-serial.c stdlib.c mpc52xx-psc.c planetcore.c uartlite.c \
> -		fsl-soc.c mpc8xx.c pq2.c
> +		fsl-soc.c mpc8xx.c pq2.c ugecon.c
>  src-plat := of.c cuboot-52xx.c cuboot-824x.c cuboot-83xx.c cuboot-85xx.c holly.c \
>  		cuboot-ebony.c cuboot-hotfoot.c treeboot-ebony.c prpmc2800.c \
>  		ps3-head.S ps3-hvcall.S ps3.c treeboot-bamboo.c cuboot-8xx.c \
> diff --git a/arch/powerpc/boot/ugecon.c b/arch/powerpc/boot/ugecon.c
> new file mode 100644
> index 0000000..704f374
> --- /dev/null
> +++ b/arch/powerpc/boot/ugecon.c
> @@ -0,0 +1,128 @@
> +/*
> + * arch/powerpc/boot/ugecon.c
> + *
> + * USB Gecko bootwrapper console.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 <stddef.h>
> +#include "stdio.h"
> +#include "types.h"
> +#include "io.h"
> +#include "ops.h"
> +
> +
> +#define EXI_CLK_32MHZ           5
> +
> +#define EXI_CSR                 0x00
> +#define   EXI_CSR_CLKMASK       (0x7<<4)
> +#define     EXI_CSR_CLK_32MHZ   (EXI_CLK_32MHZ<<4)
> +#define   EXI_CSR_CSMASK        (0x7<<7)
> +#define     EXI_CSR_CS_0        (0x1<<7)  /* Chip Select 001 */
> +
> +#define EXI_CR                  0x0c
> +#define   EXI_CR_TSTART         (1<<0)
> +#define   EXI_CR_WRITE		(1<<2)
> +#define   EXI_CR_READ_WRITE     (2<<2)
> +#define   EXI_CR_TLEN(len)      (((len)-1)<<4)
> +
> +#define EXI_DATA                0x10
> +
> +
> +/* virtual address base for input/output, retrieved from device tree */
> +static void *ug_io_base;
> +
> +
> +static u32 ug_io_transaction(u32 in)
> +{
> +	u32 *csr_reg = ug_io_base + EXI_CSR;
> +	u32 *data_reg = ug_io_base + EXI_DATA;
> +	u32 *cr_reg = ug_io_base + EXI_CR;
> +	u32 csr, data, cr;
> +
> +	/* select */
> +	csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0;
> +	out_be32(csr_reg, csr);
> +
> +	/* read/write */
> +	data = in;
> +	out_be32(data_reg, data);
> +	cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART;
> +	out_be32(cr_reg, cr);
> +
> +	while (in_be32(cr_reg) & EXI_CR_TSTART)
> +		barrier();
> +
> +	/* deselect */
> +	out_be32(csr_reg, 0);
> +
> +	data = in_be32(data_reg);
> +	return data;
> +}
> +
> +static int ug_is_txfifo_ready(void)
> +{
> +	return ug_io_transaction(0xc0000000) & 0x04000000;
> +}
> +
> +static void ug_raw_putc(char ch)
> +{
> +	ug_io_transaction(0xb0000000 | (ch << 20));
> +}
> +
> +static void ug_putc(char ch)
> +{
> +	int count = 16;
> +
> +	if (!ug_io_base)
> +		return;
> +
> +	while (!ug_is_txfifo_ready() && count--)
> +		barrier();
> +	if (count)
> +		ug_raw_putc(ch);
> +}
> +
> +void ug_console_write(const char *buf, int len)
> +{
> +	char *b = (char *)buf;
> +
> +	while (len--) {
> +		if (*b == '\n')
> +			ug_putc('\r');
> +		ug_putc(*b++);
> +	}
> +}
> +
> +int ug_is_adapter_present(void)
> +{
> +	if (!ug_io_base)
> +		return 0;
> +
> +	return ug_io_transaction(0x90000000) == 0x04700000;
> +}
> +
> +int ug_grab_io_base(void)
> +{
> +	u32 v;
> +	void *devp;
> +
> +	devp = find_node_by_alias("ugecon");
> +	if (devp == NULL)
> +		goto err_out;
> +	if (getprop(devp, "virtual-reg", &v, sizeof(v)) != sizeof(v))
> +		goto err_out;
> +
> +	ug_io_base = (u8 *)v;
> +	return 0;
> +
> +err_out:
> +	return -1;
> +}
> diff --git a/arch/powerpc/boot/ugecon.h b/arch/powerpc/boot/ugecon.h
> new file mode 100644
> index 0000000..1fdb590
> --- /dev/null
> +++ b/arch/powerpc/boot/ugecon.h
> @@ -0,0 +1,25 @@
> +/*
> + * arch/powerpc/boot/ugecon.h
> + *
> + * USB Gecko early bootwrapper console.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 __UGECON_H
> +#define __UGECON_H
> +
> +extern int ug_grab_io_base(void);
> +extern int ug_is_adapter_present(void);
> +
> +extern void ug_putc(char ch);
> +extern void ug_console_write(const char *buf, int len);
> +
> +#endif /* __UGECON_H */
> +

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-22 23:02     ` [RFC PATCH 02/19] powerpc: gamecube: device tree Grant Likely
  2009-11-23 19:44       ` Albert Herranz
  2009-11-24 22:36       ` Segher Boessenkool
@ 2009-11-26  4:21       ` Benjamin Herrenschmidt
  2009-11-26  4:38         ` Grant Likely
  2009-11-26 22:30         ` Segher Boessenkool
  2 siblings, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:21 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

On Sun, 2009-11-22 at 16:02 -0700, Grant Likely wrote:

> > +       /* devices contained int the flipper chipset */
> > +       soc {
> 
> It would be better to rename this as IMMR or the bus type.  This node
> doesn't actually describe the entire chip, but describes the internal
> memory mapped registers.

I would really just call it "flipper" :-)

> > +               #address-cells = <1>;
> > +               #size-cells = <1>;
> > +               #interrupt-cells = <1>;
> > +               model = "flipper";
> 
> Drop the model property
> 
> > +               compatible = "nintendo,flipper";
> > +               clock-frequency = <162000000>; /* 162MHz */
> > +               ranges = <0x0c000000 0x0c000000 0x00010000>;
> 
> Since you're only doing 1:1 mappings; you could replace this with an
> empty "ranges;" property instead.

On the other hand it is a useful "documentation" to specify the exact
range decoded when you know it :-) For non documented HW I prefer when
the DT contains as precise information as possible. It also allows, if
so wished, to create proper hierarchical struct resource in the kernel
that represent the bus hierarchy in a nicer way. So I vote for keeping
that in.

> > +
> > +               video@0c002000 {
> > +                       compatible = "nintendo,flipper-video";
> > +                       reg = <0x0c002000 0x100>;
> > +                       interrupts = <8>;
> > +                       interrupt-parent = <&pic>;
> 
> Hint:  If you move the interrupt-parent property up to the root node,
> then you don't need to specify it in every single device node; it will
> just inherit from the parent.

Note that this is a linux-ism no ? (aka ePAPRism). If they aim toward
having a real OF which I think they do they may wish to pass on this
trick.

> > +                       /* XFB is the eXternal FrameBuffer */
> > +                       xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
> > +                       xfb-size = <0x168000>;
> 
> Can 'xfb' be made a second tuple to the 'reg' property so that all the
> address mapping code works on it?  ie:
> 
> reg = <0x0c002000 0x100
>        0x01698000 0x168000>;
>
> At the very least, it is wise to adopt the same form as the reg
> property when describing address ranges instead of splitting it into
> multiple properties.

I agree with using the same form as reg. I'm not sure about using "reg",
it depends. Albert, is that xfb location something that is configurable
or is it fixed ? If it's configurable, it could remain a separate
property I suppose, since it overlaps main memory, it's a bit fishy to
have it in "reg"... you do seem to strip off the fb from the memory
"reg" property though... Maybe the right thing to do is to leave the
memory "reg" property to be the whole RAM and just reserve the area
covered by the fb ?

> > +               /* External Interface bus */
> > +               exi@0c006800 {
> > +                       #address-cells = <1>;
> > +                       #size-cells = <1>;
> > +                       compatible = "nintendo,flipper-exi";
> > +                       reg = <0x0c006800 0x40>;
> > +                       interrupts = <4>;
> > +                       interrupt-parent = <&pic>;
> > +
> > +                       USBGECKO0: usbgecko@0c006814 {
> > +                               compatible = "usbgecko,usbgecko";
> > +                               reg = <0x0c006814 0x14>;
> > +                               virtual-reg = <0xcc006814>;
> > +                       };
> > +               };
> > +        };
> > +};
> > +

Shouldn't the above be dynamically detected ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-23 20:19         ` Grant Likely
  2009-11-23 20:25           ` Albert Herranz
  2009-11-24 22:53           ` Segher Boessenkool
@ 2009-11-26  4:23           ` Benjamin Herrenschmidt
  2009-11-27 12:09             ` Segher Boessenkool
  2 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:23 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

On Mon, 2009-11-23 at 13:19 -0700, Grant Likely wrote:
> so the node really is
> describing the internal bus, not the entire SoC.  On some chips it is
> documented as the "internally memory mapped registers", or IMMR.  So,
> it is better to name this node in a way that reflects what it is (an
> internal bus) instead of as the whole chip.

It's not even the internal bus. Flipper and Hollywood are separate chips
from the PPC afaik. They are integrated northbridge + gfx + IOs
basically.

> Similarly, it is better to use a compatible value of something like:
> compatible = "nintendo,flipper-immr"; (instead of "nintendo,flipper")
> because your describing just the internal bus, not the entire chip. 

I would just call the nodes "flipper" and "hollywood".

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-24 22:36       ` Segher Boessenkool
@ 2009-11-26  4:23         ` Benjamin Herrenschmidt
  2009-11-26 22:15           ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:23 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Tue, 2009-11-24 at 23:36 +0100, Segher Boessenkool wrote:
> If you have only one interrupt controller, like here, you don't
> need to refer to it _at all_ :-)

I think Linux requires that you do though. It might be a mistake on our
part but heh ...

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-25 18:00     ` Segher Boessenkool
  2009-11-25 18:43       ` Albert Herranz
@ 2009-11-26  4:27       ` Benjamin Herrenschmidt
  2009-11-26 22:19         ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:27 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Wed, 2009-11-25 at 19:00 +0100, Segher Boessenkool wrote:
> > +	memory {
> > +		device_type = "memory";
> > +		/* 24M minus framebuffer memory area (640*576*2*2) */
> > +		reg = <0x00000000 0x01698000>;
> 
> Put the whole 24MB here, probe the framebuffer address and size
> in the platform code?

Agreed. That's what I was proposing. Though you need to be careful about
early boot code that will try to allocate the hash table etc... or even
the DT itself. So you need to probe and reserve the fb really early,
for example in the platform probe() routine itself. Or you can stick it
in the reserve map too I suppose.

> > +		video@0c002000 {
> > +			compatible = "nintendo,flipper-video";
> > +			reg = <0x0c002000 0x100>;
> > +			interrupts = <8>;
> > +			interrupt-parent = <&pic>;
> > +			/* XFB is the eXternal FrameBuffer */
> > +			xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
> > +			xfb-size = <0x168000>;
> 
> XFB address isn't fixed on the hardware, and the kernel might
> want to move it, and you can easily probe for it anyway.  Remove
> these last two properties please.

Ok but you need to know what it was setup to by the FW no ? To avoid
having a temporary display "glitch" while booting... Also on a 24M
config,it might get tough for the driver to allocate 2M contiguous like
that if it's done late in the boot process.
> 
> > +		auxram@0c005000 {
> > +			compatible = "nintendo,flipper-auxram";
> > +			reg = <0x0c005000 0x200>;	/* DSP */
> > +			interrupts = <6>;
> > +			interrupt-parent = <&pic>;
> > +		};
> > +
> > +		audio@0c005000 {
> > +			compatible = "nintendo,flipper-audio";
> > +			reg = <0x0c005000 0x200		/* DSP */
> > +			       0x0c006c00 0x20>;	/* AI */
> > +			interrupts = <6>;
> > +			interrupt-parent = <&pic>;
> > +		};
> 
> These two have the same address, not good.  Just remove the
> auxram node?

Or make it a child of audio ? :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-24 17:38         ` Albert Herranz
  2009-11-24 21:00           ` Segher Boessenkool
@ 2009-11-26  4:35           ` Benjamin Herrenschmidt
  2009-11-26 22:23             ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:35 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Tue, 2009-11-24 at 18:38 +0100, Albert Herranz wrote:
> Segher Boessenkool wrote:
> > Hi Albert,
> > 
> >> +asm ("\n\
> > 
> > 
> > A file scope asm?!  Please don't.
> > 
> 
> So what's your proposal then? Placing it within a fake func?

Just do a .S file :-)

> That asm snippet is the entry point. I took as an example how prpmc2800.c
> deals with that, providing an own version of the (weak) _zImage_start.

Right but I agree with Segher here, it would be nicer as a .S file.

> >> + * We enter with the cache enabled, the MMU enabled and some known
> >> legacy
> >> + * memory mappings active. xBAT3 is unused
> > 
> > It would be good if you could depend as little as possible on these things;
> > that makes writing another bootloader a lot easier.
> > 
> 
> Ok. I'll do a similar approach as done on the wii bootwrapper.
> 
> >> +    /* IBAT3,DBAT3 for first 16Mbytes */\n\
> >> +    li    8, 0x01ff    /* 16MB */\n\
> >> +    li      9, 0x0002    /* rw */\n\
> >> +    mtspr   0x216, 8    /* IBAT3U */\n\
> >> +    mtspr   0x217, 9    /* IBAT3L */\n\
> >> +    mtspr   0x21e, 8    /* DBAT3U */\n\
> >> +    mtspr   0x21f, 9    /* DBAT3L */\n\
> > 
> > WIMG=0000, are you sure?  Not M=1?
> > 
> 
> To be honest, I don't recall the details now.
> But it was tested in the very early days, the result was not the expected one and,
> in the end, manual cache coherency management was still needed.

Ouch. I wouldn't be surprised if those guys don't do cache coherency
in the bridge anyways.

> So everything is designed and working assuming M=0.
> This can be re-checked again later if needed.

Agreed.

> >> +    bcl-    20,4*cr7+so,1f\n\
> > 
> > Just write  bcl 20,31,1f .
> 
> Ok, I used two variants for this and I know which one you like now ;).

Cheers,
Ben.

> > 
> > 
> > Segher
> > 
> > 
> 
> Thanks,
> Albert
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-24 21:00           ` Segher Boessenkool
  2009-11-24 23:45             ` Albert Herranz
@ 2009-11-26  4:36             ` Benjamin Herrenschmidt
  2009-11-26  8:17               ` Gabriel Paubert
  1 sibling, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:36 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Tue, 2009-11-24 at 22:00 +0100, Segher Boessenkool wrote:
> 
> Sure, the memory controllers don't do coherency.  I'm slightly worried
> about two things:
> 1) Will the generic code use M=0 as well?  Is it a problem if it  
> doesn't?

We can make it not do it.

> 2) Do lwarx. etc. work in M=0? 

They should hopefully... as long as you don't rely on the reservation
blowing as a result of a DMA write.

Cheers,
Ben

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  4:21       ` Benjamin Herrenschmidt
@ 2009-11-26  4:38         ` Grant Likely
  2009-11-26  5:29           ` Benjamin Herrenschmidt
  2009-11-26 22:30         ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-26  4:38 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

On Wed, Nov 25, 2009 at 9:21 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Sun, 2009-11-22 at 16:02 -0700, Grant Likely wrote:
>> > +
>> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 video@0c002000 {
>> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 compatible =3D "nintendo=
,flipper-video";
>> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 reg =3D <0x0c002000 0x10=
0>;
>> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupts =3D <8>;
>> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 interrupt-parent =3D <&p=
ic>;
>>
>> Hint: =A0If you move the interrupt-parent property up to the root node,
>> then you don't need to specify it in every single device node; it will
>> just inherit from the parent.
>
> Note that this is a linux-ism no ? (aka ePAPRism). If they aim toward
> having a real OF which I think they do they may wish to pass on this
> trick.

But this isn't real OF.  Real OF can generate its own valid tree.
This is a flat tree, and it is valid according to all users of the
flat tree.  Besides, the last time we talked about this, you told me
that moving it to the root was a good idea, and I happily changed all
the 5200 .dts files.  :-)

http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-January/067046.html

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
                           ` (2 preceding siblings ...)
  2009-11-25 17:49         ` Segher Boessenkool
@ 2009-11-26  4:45         ` Benjamin Herrenschmidt
  2009-11-26 15:09           ` Albert Herranz
  2009-11-26 22:45           ` Segher Boessenkool
  3 siblings, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:45 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:

> +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */
> +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */

Weird layout... nothing you can do about I suppose.

Out of curiosity, what is that DSP RAM ? Some actual DSP core somewhere
in the IO chip setup to use memory from up there ?

I'll skip on some things that I'm sure others will have commented
about :-)

> +	/*
> +	 * The Nintendo Wii has two discontiguous RAM memory areas called
> +	 * MEM1 and MEM2.
> +	 * MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
> +	 * MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
> +	 * Between both memory address ranges there is an address space
> +	 * where memory-mapped I/O registers are found.
> +	 *
> +	 * Currently, Linux 32-bit PowerPC does not support RAM in
> +	 * discontiguous memory address spaces. Thus, in order to use
> +	 * both RAM areas, we declare as RAM the range from the start of
> +	 * MEM1 to the end of useable MEM2 and exclude the needed parts
> +	 * with /memreserve/ statements, at the expense of wasting a bit
> +	 * of memory.
> +	 */
> +	memory {
> +		device_type = "memory";
> +		/* MEM1 + memory hole + MEM2 - firmware/buffers area */
> +		reg = <0x00000000 0x133e0000>;
> +	};

So we do have a nasty hole here in the middle. How bad it is if you try
to just have two ranges in there (ie as if it was discontiguous) ? We
shouldn't be far from being able to do discontig mem actually, should be
easy enough to fix. Tho I don't have (yet) the HW :-) (I'm tempted...)

Same comment as other discussions about the framebuffer here.

> +	cpus {
> +		#cpus = <1>;
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		PowerPC,broadway@0 {
> +			device_type = "cpu";
> +			reg = <0>;
> +			clock-frequency = <729000000>; /* 729MHz */
> +			bus-frequency = <243000000>; /* 243MHz core-to-bus 3x */
> +			timebase-frequency = <60750000>; /* 243MHz / 4 */
> +			i-cache-line-size = <32>;
> +			d-cache-line-size = <32>;
> +			i-cache-size = <32768>;
> +			d-cache-size = <32768>;
> +		};
> +	};
> +
> +	/* devices contained in the hollywood chipset */
> +	soc {

Call it "hollywood"

> +		#address-cells = <1>;
> +		#size-cells = <1>;
> +		#interrupt-cells = <1>;
> +		model = "hollywood";
> +		compatible = "nintendo,hollywood";
> +		clock-frequency = <243000000>; /* 243MHz */
> +		ranges = <0x0c000000 0x0c000000 0x00010000
> +			  0x0d000000 0x0d000000 0x00010000
> +			  0x0d040000 0x0d040000 0x00050000
> +			  0x0d800000 0x0d800000 0x00001000
> +			  0x133e0000 0x133e0000 0x00c20000>;
> +
> +		video@0c002000 {
> +			compatible = "nintendo,hollywood-video";
> +			reg = <0x0c002000 0x100>;
> +			interrupts = <8>;
> +			interrupt-parent = <&PIC0>;
> +		};
> +
> +		PIC0: pic0@0c003000 {
> +			#interrupt-cells = <1>;
> +			compatible = "nintendo,flipper-pic";
> +			reg = <0x0c003000 0x8>;
> +			interrupt-controller;
> +		};
> +
> +		resetswitch@0c003000 {
> +			compatible = "nintendo,hollywood-resetswitch";
> +			reg = <0x0c003000 0x4>;
> +			interrupts = <1>;
> +			interrupt-parent = <&PIC0>;
> +		};
> +
> +		audio@0c005000 {
> +			compatible = "nintendo,hollywood-audio";
> +			reg = <0x0c005000 0x200		/* DSP */
> +			       0x0d006c00 0x20>;	/* AI */
> +			interrupts = <6>;
> +			interrupt-parent = <&PIC0>;
> +		};
> +
> +		/* Team Twiizers' 'mini' firmware IPC */

Out of curiosity, what are these ? :-)

> +		mini@0d000000 {
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			#interrupt-cells = <1>;
> +			compatible = "twiizers,starlet-mini-ipc";
> +			reg = <0x0d000000 0x40	/* IPC */
> +			       0x13fffffc 0x4>;	/* mini header pointer */
> +		};
> +
> +		serial@0d006400 {
> +			compatible = "nintendo,hollywood-serial";
> +			reg = <0x0d006400 0x100>;
> +			interrupts = <3>;
> +			interrupt-parent = <&PIC0>;
> +		};
> +
> +		/* External Interface bus */
> +		exi@0d006800 {
> +			#address-cells = <1>;
> +			#size-cells = <1>;
> +			compatible = "nintendo,hollywood-exi";
> +			reg = <0x0d006800 0x40>;
> +			interrupts = <4>;
> +			interrupt-parent = <&PIC0>;
> +
> +			USBGECKO0: usbgecko@0d006814 {
> +				compatible = "usbgecko,usbgecko";
> +				reg = <0x0d006814 0x14>;
> +				virtual-reg = <0xcd006814>;
> +			};
> +		};

Similar comment as before, could the above be dynamically probed ? If
you are not a hacker you may not need that at all to use some linux
based piece of SW on the wii right ?

> +		ehci@0d040000 {
> +			compatible = "nintendo,hollywood-ehci";
> +			reg = <0x0d040000 0x100
> +			       0x133e0000 0x80000>; /* 512 KB */
> +			interrupts = <4>;
> +			interrupt-parent = <&PIC1>;
> +		};
> +
> +		ohci0@0d050000 {
> +			compatible = "nintendo,hollywood-ohci";
> +			reg = <0x0d050000 0x100
> +			       0x13460000 0x80000>; /* 512 KB */
> +			interrupts = <5>;
> +			interrupt-parent = <&PIC1>;
> +		};
> +
> +		ohci1@0d060000 {

Why the "1" ?

> +			compatible = "nintendo,hollywood-ohci";
> +			reg = <0x0d060000 0x100
> +			       0x134e0000 0x80000>; /* 512 KB */
> +			interrupts = <6>;
> +			interrupt-parent = <&PIC1>;
> +		};

Are the above OHCI and EHCI "special" ? If not, there's an existing
binding for that sort of thing, which btw requires properties to
indicate the endianness of the registers and in-memory data structures
etc...

> +		sdhc0@0d070000 {
> +			compatible = "nintendo,hollywood-sdhci";
> +			reg = <0x0d070000 0x200>;
> +			interrupts = <7>;
> +			interrupt-parent = <&PIC1>;
> +		};
> +
> +		sdhc1@0d080000 {
> +			compatible = "nintendo,hollywood-sdhci";
> +			reg = <0x0d080000 0x200>;
> +			interrupts = <8>;
> +			interrupt-parent = <&PIC1>;
> +		};

Again, no need for a "1" in there. Names don't have to be unique if the
unit address is different.

> +		PIC1: pic1@0d800030 {
> +			#interrupt-cells = <1>;
> +			compatible = "nintendo,hollywood-pic";
> +			reg = <0x0d800030 0x8>;
> +			interrupt-controller;
> +			interrupts = <14>;
> +			interrupt-parent = <&PIC0>;
> +		};

Ah, a cascaded PIC, fun fun fun

> +		hollywood-ahbprot@0d800064 {
> +			compatible = "nintendo,hollywood-ahbprot";
> +			reg = <0x0d800064 0x4>;
> +		};

What is this ?

> +		gpio0: hollywood-gpio@0d8000c0 {
> +			compatible = "nintendo,hollywood-gpio";
> +			reg = <0x0d8000c0 0x20>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +		};
> +
> +		gpio1: hollywood-gpio@0d8000e0 {
> +			compatible = "nintendo,hollywood-gpio";
> +			reg = <0x0d8000e0 0x20>;
> +			gpio-controller;
> +			#gpio-cells = <2>;
> +		};

Same comment about the "1"

> +		hollywood-resets@0d800194 {
> +			compatible = "nintendo,hollywood-resets";
> +			reg = <0x0d800194 0x4>;
> +		};
> +
> +		i2c-video {
> +			#address-cells = <1>;
> +			#size-cells = <0>;
> +		        compatible = "virtual,i2c-gpio";
> +
> +		        gpios = <&gpio0  16 0 /* 31-15 */
> +		                 &gpio0  17 0 /* 31-14 */
> +				>;
> +		        sda-is-open-drain = <1>;
> +		        sda-enforce-dir = <1>;
> +		        scl-is-open-drain = <1>;
> +		        scl-is-output-only = <1>;
> +		        udelay = <2>;
> +
> +		        audio-video-encoder {
> +		                compatible = "nintendo,wii-ave-rvl";
> +		                reg = <0x70>;
> +		        };
> +		};
> +	};
> +};
> +

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-25 17:49         ` Segher Boessenkool
  2009-11-25 18:34           ` Albert Herranz
@ 2009-11-26  4:51           ` Benjamin Herrenschmidt
  2009-11-26 15:18             ` Albert Herranz
  2009-11-26 22:50             ` Segher Boessenkool
  1 sibling, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:51 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Wed, 2009-11-25 at 18:49 +0100, Segher Boessenkool wrote:
> > +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */
> 
> Like others have said already, don't do this.  If you need
> a workaround, put it in the platform code.
> 
> > +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */
> 
> This address is fixed in the DSP hardware, right?  If not,
> you shouldn't do a reserve here.
> 
> > +	chosen {
> > +		/* root filesystem on 2nd partition of SD card */
> > +		bootargs = "nobats root=/dev/mmcblk0p2 rootwait udbg-immortal";
> 
> Question: why do you need/want nobats?

Good point. I can't even guarantee that the kernel will work reliably
with nobats :-) At least you really want the kernel .text to be fully
covered by an IBAT.

> What does this clock freq mean?  Hollywood has lots of
> clocks, many of them configurable.  Bus frequency is in
> the cpu node already.  The binding doesn't say what this
> is either, since you didn't write a binding :-)
> 
> Just remove it?

BTW. If we want to play with clocks, maybe you should look at
my proposed binding for clocks and implementing the clk API :-)

> > +		ranges = <0x0c000000 0x0c000000 0x00010000
> > +			  0x0d000000 0x0d000000 0x00010000
> > +			  0x0d040000 0x0d040000 0x00050000
> > +			  0x0d800000 0x0d800000 0x00001000
> 
> All of 0cXXXXXX and 0dXXXXXX actually.
> 
> > +			  0x133e0000 0x133e0000 0x00c20000>;
> 
> This is just part of MEM2, don't treat it special here.
> 
> > +		video@0c002000 {
> > +			compatible = "nintendo,hollywood-video";
> > +			reg = <0x0c002000 0x100>;
> > +			interrupts = <8>;
> > +			interrupt-parent = <&PIC0>;
> 
> If you say interrupt-parent = <..> in the root node, you can
> leave it out in most of the rest of the tree.  Using the Flipper
> PIC for this sounds like a good plan.

Well, for the rest of the tree except stuff whose interrupt parent
is PIC1. With two PICs I prefer being explicit.

> > +		PIC0: pic0@0c003000 {
> > +			#interrupt-cells = <1>;
> > +			compatible = "nintendo,flipper-pic";
> > +			reg = <0x0c003000 0x8>;
> 
> This register block is bigger actually.  It's not only PIC,
> but some other bus stuff as well, dunno what to do here.

Add nodes for the other things ?

> > +			interrupt-controller;
> > +		};
> > +
> > +		resetswitch@0c003000 {
> > +			compatible = "nintendo,hollywood-resetswitch";
> > +			reg = <0x0c003000 0x4>;
> 
> That's the same address.  Don't do that.
> 
> Create a flipper-processor-interface node for the whole 3000
> block (size 100)?  You can hang the PIC as a subnode under it,
> without a "reg".

Yeah.

> > +		/* Team Twiizers' 'mini' firmware IPC */
> > +		mini@0d000000 {
> 
> Although mini is awesome, it isn't hardware, and doesn't
> belong in the device tree.

So what is at d0000000 ?

> > +		serial@0d006400 {
> > +			compatible = "nintendo,hollywood-serial";
> 
> You might want to pick a more descriptive name for this,
> "serial" is usually understaood to mean "RS232".  Which
> this isn't.

What is it then ? You definitely want some other name if it's not
classic rs232 style serial.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-25 18:34           ` Albert Herranz
@ 2009-11-26  4:58             ` Benjamin Herrenschmidt
  2009-11-26 15:19               ` Albert Herranz
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  4:58 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Wed, 2009-11-25 at 19:34 +0100, Albert Herranz wrote:
> 
> We need nobats (or a hack in the mmu_mapin_ram() code) because of the
> discontiguous ram problem.

I would vote for a hack in mmu_mapin_ram() for now.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-24 18:03               ` Albert Herranz
  2009-11-24 21:15                 ` Segher Boessenkool
@ 2009-11-26  5:08                 ` Benjamin Herrenschmidt
  2009-11-26 15:22                   ` Albert Herranz
  2009-11-27 12:12                   ` Segher Boessenkool
  1 sibling, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:08 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Tue, 2009-11-24 at 19:03 +0100, Albert Herranz wrote:
> Segher Boessenkool wrote:
> >> Add a config option GAMECUBE_COMMON to be used as a dependency for all
> >> options common to the Nintendo GameCube and Wii video game consoles.
> > 
> > Maybe something like GAMECUBE_OR_WII instead?  "COMMON" is so
> > common it's meaningless.
> > 
> 
> I don't like either GAMECUBE_OR_WII.
> It looks as if it can be used to match options for the GAMECUBE _or_ WII. But that's not the meaning of it.
> 
> This option should be used only for options applicable to both the GAMECUBE and WII, i.e. basically those options in the WII which where "inherited" from the GAMECUBE to make it retro-compatible.
> 
> If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or GAMECUBE_COMPAT?

I don't have any strong opinion. Maybe NINTENDO_COMMON ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms
  2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
  2009-11-22 22:01               ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Albert Herranz
  2009-11-22 22:20               ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Arnd Bergmann
@ 2009-11-26  5:09               ` Benjamin Herrenschmidt
  2 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:09 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> The processors bundled in the Nintendo GameCube and Wii video game consoles
> require explicit cache handling when DMA engines are used.

That reminds me we really need to make that a runtime option some day...

Cheers,
Ben.

> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
>  arch/powerpc/platforms/Kconfig.cputype     |    2 +-
>  arch/powerpc/platforms/embedded6xx/Kconfig |    1 +
>  2 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/powerpc/platforms/Kconfig.cputype b/arch/powerpc/platforms/Kconfig.cputype
> index e382cae..80d934b 100644
> --- a/arch/powerpc/platforms/Kconfig.cputype
> +++ b/arch/powerpc/platforms/Kconfig.cputype
> @@ -312,7 +312,7 @@ config NR_CPUS
>  
>  config NOT_COHERENT_CACHE
>  	bool
> -	depends on 4xx || 8xx || E200 || PPC_MPC512x
> +	depends on 4xx || 8xx || E200 || PPC_MPC512x || GAMECUBE_COMMON
>  	default y
>  
>  config CHECK_CACHE_COHERENCY
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
> index 97a2dbc..31487e4 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -93,4 +93,5 @@ config MPC10X_STORE_GATHERING
>  
>  config GAMECUBE_COMMON
>  	bool
> +	select NOT_COHERENT_CACHE
>  

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support
  2009-11-22 23:21                 ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Grant Likely
@ 2009-11-26  5:10                   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:10 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

On Sun, 2009-11-22 at 16:21 -0700, Grant Likely wrote:
> On Sun, Nov 22, 2009 at 3:01 PM, Albert Herranz <albert_herranz@yahoo.es> wrote:
> > The Nintendo GameCube and Wii video game consoles do not have PCI hardware.
> > Avoid wasting their scarce memory by not including PCI support into the
> > kernel.
> >
> > Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> > ---
> >  arch/powerpc/Kconfig |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> > index 2ba14e7..84b2566 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -679,7 +679,7 @@ config PPC_PCI_CHOICE
> >  config PCI
> >        bool "PCI support" if PPC_PCI_CHOICE
> >        default y if !40x && !CPM2 && !8xx && !PPC_83xx \
> > -               && !PPC_85xx && !PPC_86xx
> > +               && !PPC_85xx && !PPC_86xx && !GAMECUBE_COMMON
> 
> phew, this is getting ugly.  But I won't ask you to clean it up.  Ack

Right. We should have the platforms that want PCI do a select
instead :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
                                     ` (2 preceding siblings ...)
  2009-11-24  0:49                   ` Segher Boessenkool
@ 2009-11-26  5:12                   ` Benjamin Herrenschmidt
  2009-11-26 15:28                     ` Albert Herranz
  3 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:12 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> Add support for using the USB Gecko adapter via the udbg facility on
> the Nintendo GameCube and Wii video game consoles.
> The USB Gecko is a 3rd party memory card interface adapter that provides
> a EXI (External Interface) to USB serial converter.

The main issue here is that the gecko is supposed to be something you
can plug or unplug no ? Is it hotswap or only at boot ? In the later
case, maybe the node should be created by the boot wrapper when
detecting the presence of the device. If it's hotplug, then we need
something smarter...

Cheers,
Ben.

> Signed-off-by: Albert Herranz <albert_herranz@yahoo.es>
> ---
>  arch/powerpc/platforms/embedded6xx/Kconfig         |   13 +
>  arch/powerpc/platforms/embedded6xx/Makefile        |    1 +
>  arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c |  285 ++++++++++++++++++++
>  arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h |   30 ++
>  4 files changed, 329 insertions(+), 0 deletions(-)
>  create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
>  create mode 100644 arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> 
> diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
> index 31487e4..bfd88be 100644
> --- a/arch/powerpc/platforms/embedded6xx/Kconfig
> +++ b/arch/powerpc/platforms/embedded6xx/Kconfig
> @@ -95,3 +95,16 @@ config GAMECUBE_COMMON
>  	bool
>  	select NOT_COHERENT_CACHE
>  
> +config USBGECKO_UDBG
> +	bool "USB Gecko udbg console for the Nintendo GameCube/Wii"
> +	depends on GAMECUBE_COMMON
> +	help
> +	  If you say yes to this option, support will be included for the
> +	  USB Gecko adapter as an udbg console.
> +	  The USB Gecko is a EXI to USB Serial converter that can be plugged
> +	  into a memcard slot in the Nintendo GameCube/Wii.
> +
> +	  This driver bypasses the EXI layer completely.
> +
> +	  If in doubt, say N here.
> +
> diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
> index 0773c08..0ab7492 100644
> --- a/arch/powerpc/platforms/embedded6xx/Makefile
> +++ b/arch/powerpc/platforms/embedded6xx/Makefile
> @@ -7,3 +7,4 @@ obj-$(CONFIG_STORCENTER)	+= storcenter.o
>  obj-$(CONFIG_PPC_HOLLY)		+= holly.o
>  obj-$(CONFIG_PPC_PRPMC2800)	+= prpmc2800.o
>  obj-$(CONFIG_PPC_C2K)		+= c2k.o
> +obj-$(CONFIG_USBGECKO_UDBG)	+= usbgecko_udbg.o
> diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> new file mode 100644
> index 0000000..49f86e8
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> @@ -0,0 +1,285 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/usbgecko_udbg.c
> + *
> + * udbg serial input/output routines for the USB Gecko adapter.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 <asm/io.h>
> +#include <asm/prom.h>
> +#include <asm/udbg.h>
> +
> +#include <mm/mmu_decl.h>
> +
> +#include "usbgecko_udbg.h"
> +
> +
> +#define EXI_CLK_32MHZ           5
> +
> +#define EXI_CSR                 0x00
> +#define   EXI_CSR_CLKMASK       (0x7<<4)
> +#define     EXI_CSR_CLK_32MHZ   (EXI_CLK_32MHZ<<4)
> +#define   EXI_CSR_CSMASK        (0x7<<7)
> +#define     EXI_CSR_CS_0        (0x1<<7)  /* Chip Select 001 */
> +
> +#define EXI_CR                  0x0c
> +#define   EXI_CR_TSTART         (1<<0)
> +#define   EXI_CR_WRITE		(1<<2)
> +#define   EXI_CR_READ_WRITE     (2<<2)
> +#define   EXI_CR_TLEN(len)      (((len)-1)<<4)
> +
> +#define EXI_DATA                0x10
> +
> +#define UG_READ_ATTEMPTS	100
> +#define UG_WRITE_ATTEMPTS	100
> +
> +
> +static void __iomem *ug_io_base;
> +
> +/*
> + * Performs one input/output transaction between the exi host and the usbgecko.
> + */
> +static u32 ug_io_transaction(u32 in)
> +{
> +	u32 __iomem *csr_reg = ug_io_base + EXI_CSR;
> +	u32 __iomem *data_reg = ug_io_base + EXI_DATA;
> +	u32 __iomem *cr_reg = ug_io_base + EXI_CR;
> +	u32 csr, data, cr;
> +
> +	/* select */
> +	csr = EXI_CSR_CLK_32MHZ | EXI_CSR_CS_0;
> +	out_be32(csr_reg, csr);
> +
> +	/* read/write */
> +	data = in;
> +	out_be32(data_reg, data);
> +	cr = EXI_CR_TLEN(2) | EXI_CR_READ_WRITE | EXI_CR_TSTART;
> +	out_be32(cr_reg, cr);
> +
> +	while (in_be32(cr_reg) & EXI_CR_TSTART)
> +		barrier();
> +
> +	/* deselect */
> +	out_be32(csr_reg, 0);
> +
> +	/* result */
> +	data = in_be32(data_reg);
> +
> +	return data;
> +}
> +
> +/*
> + * Returns true if an usbgecko adapter is found.
> + */
> +static int ug_is_adapter_present(void)
> +{
> +	if (!ug_io_base)
> +		return 0;
> +
> +	return ug_io_transaction(0x90000000) == 0x04700000;
> +}
> +
> +/*
> + * Returns true if the TX fifo is ready for transmission.
> + */
> +static int ug_is_txfifo_ready(void)
> +{
> +	return ug_io_transaction(0xc0000000) & 0x04000000;
> +}
> +
> +/*
> + * Tries to transmit a character.
> + * If the TX fifo is not ready the result is undefined.
> + */
> +static void ug_raw_putc(char ch)
> +{
> +	ug_io_transaction(0xb0000000 | (ch << 20));
> +}
> +
> +/*
> + * Transmits a character.
> + * It silently fails if the TX fifo is not ready after a number of retries.
> + */
> +static void ug_putc(char ch)
> +{
> +	int count = UG_WRITE_ATTEMPTS;
> +
> +	if (!ug_io_base)
> +		return;
> +
> +	if (ch == '\n')
> +		ug_putc('\r');
> +
> +	while (!ug_is_txfifo_ready() && count--)
> +		barrier();
> +	if (count)
> +		ug_raw_putc(ch);
> +}
> +
> +#if 0
> +/*
> + * Trasmits a null terminated character string.
> + */
> +static void ug_puts(char *s)
> +{
> +	while (*s)
> +		ug_putc(*s++);
> +}
> +#endif
> +
> +/*
> + * Returns true if the RX fifo is ready for transmission.
> + */
> +static int ug_is_rxfifo_ready(void)
> +{
> +	return ug_io_transaction(0xd0000000) & 0x04000000;
> +}
> +
> +/*
> + * Tries to receive a character.
> + * If a character is unavailable the function returns -1.
> + */
> +static int ug_raw_getc(void)
> +{
> +	u32 data = ug_io_transaction(0xa0000000);
> +	if (data & 0x08000000)
> +		return (data >> 16) & 0xff;
> +	else
> +		return -1;
> +}
> +
> +/*
> + * Receives a character.
> + * It fails if the RX fifo is not ready after a number of retries.
> + */
> +static int ug_getc(void)
> +{
> +	int count = UG_READ_ATTEMPTS;
> +
> +	if (!ug_io_base)
> +		return -1;
> +
> +	while (!ug_is_rxfifo_ready() && count--)
> +		barrier();
> +	return ug_raw_getc();
> +}
> +
> +/*
> + * udbg functions.
> + *
> + */
> +
> +/*
> + * Transmits a character.
> + */
> +void ug_udbg_putc(char ch)
> +{
> +	ug_putc(ch);
> +}
> +
> +/*
> + * Receives a character. Waits until a character is available.
> + */
> +static int ug_udbg_getc(void)
> +{
> +	int ch;
> +
> +	while ((ch = ug_getc()) == -1)
> +		barrier();
> +	return ch;
> +}
> +
> +/*
> + * Receives a character. If a character is not available, returns -1.
> + */
> +static int ug_udbg_getc_poll(void)
> +{
> +	if (!ug_is_rxfifo_ready())
> +		return -1;
> +	return ug_getc();
> +}
> +
> +/*
> + * Retrieves and prepares the virtual address needed to access the hardware.
> + */
> +static void __iomem *ug_udbg_setup_io_base(struct device_node *np)
> +{
> +	phys_addr_t paddr;
> +	const unsigned int *reg;
> +
> +	reg = of_get_property(np, "reg", NULL);
> +	if (reg) {
> +		paddr = of_translate_address(np, reg);
> +		if (paddr) {
> +			ug_io_base = ioremap(paddr, reg[1]);
> +			return ug_io_base;
> +		}
> +	}
> +	return NULL;
> +}
> +
> +/*
> + * USB Gecko udbg support initialization.
> + */
> +void __init ug_udbg_init(void)
> +{
> +	struct device_node *np = NULL;
> +	struct device_node *stdout;
> +	const char *path;
> +
> +	if (!of_chosen) {
> +		udbg_printf("%s: missing of_chosen\n", __func__);
> +		goto done;
> +	}
> +
> +	path = of_get_property(of_chosen, "linux,stdout-path", NULL);
> +	if (!path) {
> +		udbg_printf("%s: missing %s property", __func__,
> +			    "linux,stdout-path");
> +		goto done;
> +	}
> +
> +	stdout = of_find_node_by_path(path);
> +	if (!stdout) {
> +		udbg_printf("%s: missing path %s", __func__, path);
> +		goto done;
> +	}
> +
> +	for (np = NULL;
> +	    (np = of_find_compatible_node(np, NULL, "usbgecko,usbgecko"));)
> +		if (np == stdout)
> +			break;
> +
> +	of_node_put(stdout);
> +	if (!np) {
> +		udbg_printf("%s: stdout is not an usbgecko", __func__);
> +		goto done;
> +	}
> +
> +	if (!ug_udbg_setup_io_base(np)) {
> +		udbg_printf("%s: failed to setup io base", __func__);
> +		goto done;
> +	}
> +
> +	if (!ug_is_adapter_present()) {
> +		udbg_printf("usbgecko_udbg: not found\n");
> +		ug_io_base = NULL;
> +	} else {
> +		udbg_putc = ug_udbg_putc;
> +		udbg_getc = ug_udbg_getc;
> +		udbg_getc_poll = ug_udbg_getc_poll;
> +		udbg_printf("usbgecko_udbg: ready\n");
> +	}
> +
> +done:
> +	if (np)
> +		of_node_put(np);
> +	return;
> +}
> diff --git a/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> new file mode 100644
> index 0000000..3929de3
> --- /dev/null
> +++ b/arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> @@ -0,0 +1,30 @@
> +/*
> + * arch/powerpc/platforms/embedded6xx/usbgecko_udbg.h
> + *
> + * udbg serial input/output routines for the USB Gecko adapter.
> + * Copyright (C) 2008-2009 The GameCube Linux Team
> + * Copyright (C) 2008,2009 Albert Herranz
> + *
> + * 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 __USBGECKO_UDBG_H
> +#define __USBGECKO_UDBG_H
> +
> +#ifdef CONFIG_USBGECKO_UDBG
> +
> +extern void __init ug_udbg_init(void);
> +
> +#else
> +
> +static inline void __init ug_udbg_init(void)
> +{
> +}
> +
> +#endif /* CONFIG_USBGECKO_UDBG */
> +
> +#endif /* __USBGECKO_UDBG_H */

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-22 22:27                     ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Arnd Bergmann
  2009-11-23 19:10                       ` Albert Herranz
@ 2009-11-26  5:14                       ` Benjamin Herrenschmidt
  2009-11-26 22:54                         ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:14 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Albert Herranz, linuxppc-dev

On Sun, 2009-11-22 at 23:27 +0100, Arnd Bergmann wrote:
> 
> This will probably break other platforms if
> CONFIG_PPC_EARLY_DEBUG_USBGECKO
> is set. In general, we try hard to make it possible to build generic
> kernels for multiple systems, so it would be better to also add a
> runtime check here.

No Arnd. The whole point of EARLY_DEBUG is that it is -known- to break
other platforms :-) So that we can use it before we even get to probe
anything.

I am still tempted, one day, to change the kernel early init to setup a
stack in .bss and go straight to C to do that sort of stuff by parsing
the flat DT, this could be done using pretty much completely generic
code :-) But not right now.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
                                         ` (2 preceding siblings ...)
  2009-11-24 21:30                       ` Segher Boessenkool
@ 2009-11-26  5:18                       ` Benjamin Herrenschmidt
  2009-11-26 15:30                         ` Albert Herranz
  3 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:18 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:

> +static void flipper_pic_mask_and_ack(unsigned int virq)
> +{
> +	int irq = virq_to_hw(virq);
> +	void __iomem *io_base = get_irq_chip_data(virq);
> +
> +	clear_bit(irq, io_base + FLIPPER_IMR);
> +	set_bit(irq, io_base + FLIPPER_ICR);
> +}

Do not use clear_bit and set_bit on IOs. They will do lwarx/stwcx. which
is really not what you want. You can use __clear_bit and __set_bit but
it's still fishy. Those operate on unsigned long, so the size vary
between 32 and 64 bit etc... not something you care that much about, but
it's still the wrong tool for the job.

Do those guys have more than 32 interrupts ? If not, just hand
code the msak & shifts. If they do, then maybe stick with __clear_bit()
and __set_bit() which are the non atomic variants.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-22 23:28                       ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Grant Likely
  2009-11-23 19:59                         ` Albert Herranz
@ 2009-11-26  5:18                         ` Benjamin Herrenschmidt
  2009-11-26 15:33                           ` Albert Herranz
  2009-11-26 23:00                           ` Segher Boessenkool
  1 sibling, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:18 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

On Sun, 2009-11-22 at 16:28 -0700, Grant Likely wrote:
> > +unsigned int flipper_pic_get_irq(void)
> > +{
> > +       void __iomem *io_base = flipper_irq_host->host_data;
> > +       int irq;
> > +       u32 irq_status;
> > +
> > +       irq_status = in_be32(io_base + FLIPPER_ICR) &
> > +                    in_be32(io_base + FLIPPER_IMR);
> > +       if (irq_status == 0)
> > +               return -1;      /* no more IRQs pending */
> 
> NO_IRQ_IGNORE 

Why no just 0 ? (aka NO_IRQ)

Or do you know you are getting lots of spurrious that you don't want to
account ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-24 17:09                                   ` Albert Herranz
  2009-11-25  0:38                                     ` Michael Ellerman
@ 2009-11-26  5:22                                     ` Benjamin Herrenschmidt
  2009-11-26 15:35                                       ` Albert Herranz
  1 sibling, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:22 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Tue, 2009-11-24 at 18:09 +0100, Albert Herranz wrote:
> I could use ppc_md.ioremap to duplicate ioremap except for the ioremap
> ram check.
> But calling the stock ioremap without modifying it is not possible
> because it checks and bails out when ioremapping a region marked as
> ram (even if it's not real ram and it's memreserved).
> 
> Is the list of memreserved areas preserved once the kernel is running?
> If it is preserved another option would be to unban ioremapping ram if
> memreserved.

Yes, check lmb's they should still be around.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
                                                   ` (2 preceding siblings ...)
  2009-11-24 21:54                                 ` Segher Boessenkool
@ 2009-11-26  5:23                                 ` Benjamin Herrenschmidt
  2009-11-26 15:42                                   ` Albert Herranz
  2009-11-26 23:03                                   ` Segher Boessenkool
  3 siblings, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:23 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:

> +static void hlwd_pic_mask_and_ack(unsigned int virq)
> +{
> +	int irq = virq_to_hw(virq);
> +	void __iomem *io_base = get_irq_chip_data(virq);
> +
> +	clear_bit(irq, io_base + HW_BROADWAY_IMR);
> +	set_bit(irq, io_base + HW_BROADWAY_ICR);
> +}

Same comment as with flipper. BTW. It looks really similar, can't you
use the same driver ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  4:38         ` Grant Likely
@ 2009-11-26  5:29           ` Benjamin Herrenschmidt
  2009-11-26  5:51             ` Grant Likely
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  5:29 UTC (permalink / raw)
  To: Grant Likely; +Cc: Albert Herranz, linuxppc-dev

On Wed, 2009-11-25 at 21:38 -0700, Grant Likely wrote:
> 
> But this isn't real OF.  Real OF can generate its own valid tree.
> This is a flat tree, and it is valid according to all users of the
> flat tree.  Besides, the last time we talked about this, you told me
> that moving it to the root was a good idea, and I happily changed all
> the 5200 .dts files.  :-)
> 
> http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-January/067046.html

Oh sure. I wasn't sure what the situation vs. real OF was. I just know
Segher is doing one and it would be nice to have the closest tree :-)

But no big deal, I'm happy with it at the root. I prefer not ommiting it
completely tho.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  5:29           ` Benjamin Herrenschmidt
@ 2009-11-26  5:51             ` Grant Likely
  0 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-26  5:51 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

On Wed, Nov 25, 2009 at 10:29 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Wed, 2009-11-25 at 21:38 -0700, Grant Likely wrote:
>>
>> But this isn't real OF. =A0Real OF can generate its own valid tree.
>> This is a flat tree, and it is valid according to all users of the
>> flat tree. =A0Besides, the last time we talked about this, you told me
>> that moving it to the root was a good idea, and I happily changed all
>> the 5200 .dts files. =A0:-)
>>
>> http://lists.ozlabs.org/pipermail/linuxppc-dev/2009-January/067046.html
>
> Oh sure. I wasn't sure what the situation vs. real OF was. I just know
> Segher is doing one and it would be nice to have the closest tree :-)
>
> But no big deal, I'm happy with it at the root. I prefer not ommiting it
> completely tho.

agreed.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-26  4:36             ` Benjamin Herrenschmidt
@ 2009-11-26  8:17               ` Gabriel Paubert
  2009-11-26  8:46                 ` Benjamin Herrenschmidt
  2009-11-26 23:06                 ` Segher Boessenkool
  0 siblings, 2 replies; 181+ messages in thread
From: Gabriel Paubert @ 2009-11-26  8:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

On Thu, Nov 26, 2009 at 03:36:56PM +1100, Benjamin Herrenschmidt wrote:
> On Tue, 2009-11-24 at 22:00 +0100, Segher Boessenkool wrote:
> > 
> > Sure, the memory controllers don't do coherency.  I'm slightly worried
> > about two things:
> > 1) Will the generic code use M=0 as well?  Is it a problem if it  
> > doesn't?
> 
> We can make it not do it.
> 
> > 2) Do lwarx. etc. work in M=0? 
> 
> They should hopefully... as long as you don't rely on the reservation
> blowing as a result of a DMA write.

Hmm, this really depends on whether the DMA transfers generate bus cycles
that require coherency or not. Not the other way around. M=1 only forces
bus cycles to be snooped by other processors (asserting the GBL signal
on 603/604/750 busses).

The host bridge is free to systematically snoop processor accesses (to make 
sure that data queued in the bridge and not yet written to memory is seen
in the coherent memory domain even if, for example, interrupts propagate 
so fast that DMA target addresses are accessed before it is written to RAM).

On memory coherent systems, the host bridge has to assert the GBL signal,
to force data to be written to memory (for most DMA accesses), or to  
invalidate caches (for full line writes from devices).

	Gabriel

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-26  8:17               ` Gabriel Paubert
@ 2009-11-26  8:46                 ` Benjamin Herrenschmidt
  2009-11-26 23:06                 ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26  8:46 UTC (permalink / raw)
  To: Gabriel Paubert; +Cc: Albert Herranz, linuxppc-dev

On Thu, 2009-11-26 at 09:17 +0100, Gabriel Paubert wrote:
> 
> > They should hopefully... as long as you don't rely on the reservation
> > blowing as a result of a DMA write.
> 
> Hmm, this really depends on whether the DMA transfers generate bus cycles
> that require coherency or not. Not the other way around. M=1 only forces
> bus cycles to be snooped by other processors (asserting the GBL signal
> on 603/604/750 busses).

You are absolutely right. Which makes it even more likely that
lwarx/stwcx. won't care unless the L2 cache plays tricks.

> The host bridge is free to systematically snoop processor accesses (to make 
> sure that data queued in the bridge and not yet written to memory is seen
> in the coherent memory domain even if, for example, interrupts propagate 
> so fast that DMA target addresses are accessed before it is written to RAM).
> 
> On memory coherent systems, the host bridge has to assert the GBL signal,
> to force data to be written to memory (for most DMA accesses), or to  
> invalidate caches (for full line writes from devices). 

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26  4:45         ` Benjamin Herrenschmidt
@ 2009-11-26 15:09           ` Albert Herranz
  2009-11-26 20:48             ` Benjamin Herrenschmidt
  2009-11-26 22:45           ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> 
>> +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */
>> +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */
> 
> Weird layout... nothing you can do about I suppose.
> 
> Out of curiosity, what is that DSP RAM ? Some actual DSP core somewhere
> in the IO chip setup to use memory from up there ?
> 

Yes, there's a DSP used normally for audio purposes.

> I'll skip on some things that I'm sure others will have commented
> about :-)
> 

Ok :)

>> +	/*
>> +	 * The Nintendo Wii has two discontiguous RAM memory areas called
>> +	 * MEM1 and MEM2.
>> +	 * MEM1 starts at 0x00000000 and contains 24MB of 1T-SRAM.
>> +	 * MEM2 starts at 0x10000000 and contains 64MB of DDR2 RAM.
>> +	 * Between both memory address ranges there is an address space
>> +	 * where memory-mapped I/O registers are found.
>> +	 *
>> +	 * Currently, Linux 32-bit PowerPC does not support RAM in
>> +	 * discontiguous memory address spaces. Thus, in order to use
>> +	 * both RAM areas, we declare as RAM the range from the start of
>> +	 * MEM1 to the end of useable MEM2 and exclude the needed parts
>> +	 * with /memreserve/ statements, at the expense of wasting a bit
>> +	 * of memory.
>> +	 */
>> +	memory {
>> +		device_type = "memory";
>> +		/* MEM1 + memory hole + MEM2 - firmware/buffers area */
>> +		reg = <0x00000000 0x133e0000>;
>> +	};
> 
> So we do have a nasty hole here in the middle. How bad it is if you try
> to just have two ranges in there (ie as if it was discontiguous) ? We
> shouldn't be far from being able to do discontig mem actually, should be
> easy enough to fix. Tho I don't have (yet) the HW :-) (I'm tempted...)
> 

My plan is to just put the two ranges on the device tree (to reflect the actual hardware) and coalesce them in the fixup function of the bootwrapper.
Then add the needed reservations and hacks to make that work (mmu_mapin_ram / ioremap).

> Same comment as other discussions about the framebuffer here.
> 

Ok.

>> +	cpus {
>> +		#cpus = <1>;
>> +		#address-cells = <1>;
>> +		#size-cells = <0>;
>> +
>> +		PowerPC,broadway@0 {
>> +			device_type = "cpu";
>> +			reg = <0>;
>> +			clock-frequency = <729000000>; /* 729MHz */
>> +			bus-frequency = <243000000>; /* 243MHz core-to-bus 3x */
>> +			timebase-frequency = <60750000>; /* 243MHz / 4 */
>> +			i-cache-line-size = <32>;
>> +			d-cache-line-size = <32>;
>> +			i-cache-size = <32768>;
>> +			d-cache-size = <32768>;
>> +		};
>> +	};
>> +
>> +	/* devices contained in the hollywood chipset */
>> +	soc {
> 
> Call it "hollywood"
> 

I like that too. Simple and effective.

>> +		#address-cells = <1>;
>> +		#size-cells = <1>;
>> +		#interrupt-cells = <1>;
>> +		model = "hollywood";
>> +		compatible = "nintendo,hollywood";
>> +		clock-frequency = <243000000>; /* 243MHz */
>> +		ranges = <0x0c000000 0x0c000000 0x00010000
>> +			  0x0d000000 0x0d000000 0x00010000
>> +			  0x0d040000 0x0d040000 0x00050000
>> +			  0x0d800000 0x0d800000 0x00001000
>> +			  0x133e0000 0x133e0000 0x00c20000>;
>> +
>> +		video@0c002000 {
>> +			compatible = "nintendo,hollywood-video";
>> +			reg = <0x0c002000 0x100>;
>> +			interrupts = <8>;
>> +			interrupt-parent = <&PIC0>;
>> +		};
>> +
>> +		PIC0: pic0@0c003000 {
>> +			#interrupt-cells = <1>;
>> +			compatible = "nintendo,flipper-pic";
>> +			reg = <0x0c003000 0x8>;
>> +			interrupt-controller;
>> +		};
>> +
>> +		resetswitch@0c003000 {
>> +			compatible = "nintendo,hollywood-resetswitch";
>> +			reg = <0x0c003000 0x4>;
>> +			interrupts = <1>;
>> +			interrupt-parent = <&PIC0>;
>> +		};
>> +
>> +		audio@0c005000 {
>> +			compatible = "nintendo,hollywood-audio";
>> +			reg = <0x0c005000 0x200		/* DSP */
>> +			       0x0d006c00 0x20>;	/* AI */
>> +			interrupts = <6>;
>> +			interrupt-parent = <&PIC0>;
>> +		};
>> +
>> +		/* Team Twiizers' 'mini' firmware IPC */
> 
> Out of curiosity, what are these ? :-)
> 

Those are the guys behind most Wii hacking efforts.

>> +		mini@0d000000 {
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +			#interrupt-cells = <1>;
>> +			compatible = "twiizers,starlet-mini-ipc";
>> +			reg = <0x0d000000 0x40	/* IPC */
>> +			       0x13fffffc 0x4>;	/* mini header pointer */
>> +		};
>> +
>> +		serial@0d006400 {
>> +			compatible = "nintendo,hollywood-serial";
>> +			reg = <0x0d006400 0x100>;
>> +			interrupts = <3>;
>> +			interrupt-parent = <&PIC0>;
>> +		};
>> +
>> +		/* External Interface bus */
>> +		exi@0d006800 {
>> +			#address-cells = <1>;
>> +			#size-cells = <1>;
>> +			compatible = "nintendo,hollywood-exi";
>> +			reg = <0x0d006800 0x40>;
>> +			interrupts = <4>;
>> +			interrupt-parent = <&PIC0>;
>> +
>> +			USBGECKO0: usbgecko@0d006814 {
>> +				compatible = "usbgecko,usbgecko";
>> +				reg = <0x0d006814 0x14>;
>> +				virtual-reg = <0xcd006814>;
>> +			};
>> +		};
> 
> Similar comment as before, could the above be dynamically probed ? If
> you are not a hacker you may not need that at all to use some linux
> based piece of SW on the wii right ?
> 

Yes, the usbgecko is more of a developer gadget.

>> +		ehci@0d040000 {
>> +			compatible = "nintendo,hollywood-ehci";
>> +			reg = <0x0d040000 0x100
>> +			       0x133e0000 0x80000>; /* 512 KB */
>> +			interrupts = <4>;
>> +			interrupt-parent = <&PIC1>;
>> +		};
>> +
>> +		ohci0@0d050000 {
>> +			compatible = "nintendo,hollywood-ohci";
>> +			reg = <0x0d050000 0x100
>> +			       0x13460000 0x80000>; /* 512 KB */
>> +			interrupts = <5>;
>> +			interrupt-parent = <&PIC1>;
>> +		};
>> +
>> +		ohci1@0d060000 {
> 
> Why the "1" ?
> 

I thought that names should be unique, but I see they don't need to.
I'll use just "ohci".

>> +			compatible = "nintendo,hollywood-ohci";
>> +			reg = <0x0d060000 0x100
>> +			       0x134e0000 0x80000>; /* 512 KB */
>> +			interrupts = <6>;
>> +			interrupt-parent = <&PIC1>;
>> +		};
> 
> Are the above OHCI and EHCI "special" ? If not, there's an existing
> binding for that sort of thing, which btw requires properties to
> indicate the endianness of the registers and in-memory data structures
> etc...
> 

They are a bit special because registers are in reverse little endian format, must be written in 32-bit chunks, and (all things point to) they have hardware bugs.

>> +		sdhc0@0d070000 {
>> +			compatible = "nintendo,hollywood-sdhci";
>> +			reg = <0x0d070000 0x200>;
>> +			interrupts = <7>;
>> +			interrupt-parent = <&PIC1>;
>> +		};
>> +
>> +		sdhc1@0d080000 {
>> +			compatible = "nintendo,hollywood-sdhci";
>> +			reg = <0x0d080000 0x200>;
>> +			interrupts = <8>;
>> +			interrupt-parent = <&PIC1>;
>> +		};
> 
> Again, no need for a "1" in there. Names don't have to be unique if the
> unit address is different.
> 

I'll fix this too.

>> +		PIC1: pic1@0d800030 {
>> +			#interrupt-cells = <1>;
>> +			compatible = "nintendo,hollywood-pic";
>> +			reg = <0x0d800030 0x8>;
>> +			interrupt-controller;
>> +			interrupts = <14>;
>> +			interrupt-parent = <&PIC0>;
>> +		};
> 
> Ah, a cascaded PIC, fun fun fun
> 

It works fine :)

>> +		hollywood-ahbprot@0d800064 {
>> +			compatible = "nintendo,hollywood-ahbprot";
>> +			reg = <0x0d800064 0x4>;
>> +		};
> 
> What is this ?
> 

A register that controls if the PowerPC side can directly access part of the hardware or not.

>> +		gpio0: hollywood-gpio@0d8000c0 {
>> +			compatible = "nintendo,hollywood-gpio";
>> +			reg = <0x0d8000c0 0x20>;
>> +			gpio-controller;
>> +			#gpio-cells = <2>;
>> +		};
>> +
>> +		gpio1: hollywood-gpio@0d8000e0 {
>> +			compatible = "nintendo,hollywood-gpio";
>> +			reg = <0x0d8000e0 0x20>;
>> +			gpio-controller;
>> +			#gpio-cells = <2>;
>> +		};
> 
> Same comment about the "1"
> 

Yup.

>> +		hollywood-resets@0d800194 {
>> +			compatible = "nintendo,hollywood-resets";
>> +			reg = <0x0d800194 0x4>;
>> +		};
>> +
>> +		i2c-video {
>> +			#address-cells = <1>;
>> +			#size-cells = <0>;
>> +		        compatible = "virtual,i2c-gpio";
>> +
>> +		        gpios = <&gpio0  16 0 /* 31-15 */
>> +		                 &gpio0  17 0 /* 31-14 */
>> +				>;
>> +		        sda-is-open-drain = <1>;
>> +		        sda-enforce-dir = <1>;
>> +		        scl-is-open-drain = <1>;
>> +		        scl-is-output-only = <1>;
>> +		        udelay = <2>;
>> +
>> +		        audio-video-encoder {
>> +		                compatible = "nintendo,wii-ave-rvl";
>> +		                reg = <0x70>;
>> +		        };
>> +		};
>> +	};
>> +};
>> +
> 
> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26  4:51           ` Benjamin Herrenschmidt
@ 2009-11-26 15:18             ` Albert Herranz
  2009-11-26 21:01               ` Benjamin Herrenschmidt
  2009-11-26 22:50             ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Wed, 2009-11-25 at 18:49 +0100, Segher Boessenkool wrote:
>>> +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O area) */
>> Like others have said already, don't do this.  If you need
>> a workaround, put it in the platform code.
>>
>>> +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */
>> This address is fixed in the DSP hardware, right?  If not,
>> you shouldn't do a reserve here.
>>
>>> +	chosen {
>>> +		/* root filesystem on 2nd partition of SD card */
>>> +		bootargs = "nobats root=/dev/mmcblk0p2 rootwait udbg-immortal";
>> Question: why do you need/want nobats?
> 
> Good point. I can't even guarantee that the kernel will work reliably
> with nobats :-) At least you really want the kernel .text to be fully
> covered by an IBAT.
> 

It works with nobats.
I must say that all the patches posted (and the device drivers, which haven't been posted yet) are tested and working code.

>> What does this clock freq mean?  Hollywood has lots of
>> clocks, many of them configurable.  Bus frequency is in
>> the cpu node already.  The binding doesn't say what this
>> is either, since you didn't write a binding :-)
>>
>> Just remove it?
> 
> BTW. If we want to play with clocks, maybe you should look at
> my proposed binding for clocks and implementing the clk API :-)
> 
>>> +		ranges = <0x0c000000 0x0c000000 0x00010000
>>> +			  0x0d000000 0x0d000000 0x00010000
>>> +			  0x0d040000 0x0d040000 0x00050000
>>> +			  0x0d800000 0x0d800000 0x00001000
>> All of 0cXXXXXX and 0dXXXXXX actually.
>>
>>> +			  0x133e0000 0x133e0000 0x00c20000>;
>> This is just part of MEM2, don't treat it special here.
>>
>>> +		video@0c002000 {
>>> +			compatible = "nintendo,hollywood-video";
>>> +			reg = <0x0c002000 0x100>;
>>> +			interrupts = <8>;
>>> +			interrupt-parent = <&PIC0>;
>> If you say interrupt-parent = <..> in the root node, you can
>> leave it out in most of the rest of the tree.  Using the Flipper
>> PIC for this sounds like a good plan.
> 
> Well, for the rest of the tree except stuff whose interrupt parent
> is PIC1. With two PICs I prefer being explicit.
> 

Let it be specific then :)

>>> +		PIC0: pic0@0c003000 {
>>> +			#interrupt-cells = <1>;
>>> +			compatible = "nintendo,flipper-pic";
>>> +			reg = <0x0c003000 0x8>;
>> This register block is bigger actually.  It's not only PIC,
>> but some other bus stuff as well, dunno what to do here.
> 
> Add nodes for the other things ?
> 
>>> +			interrupt-controller;
>>> +		};
>>> +
>>> +		resetswitch@0c003000 {
>>> +			compatible = "nintendo,hollywood-resetswitch";
>>> +			reg = <0x0c003000 0x4>;
>> That's the same address.  Don't do that.
>>
>> Create a flipper-processor-interface node for the whole 3000
>> block (size 100)?  You can hang the PIC as a subnode under it,
>> without a "reg".
> 
> Yeah.
> 

Agreed.

>>> +		/* Team Twiizers' 'mini' firmware IPC */
>>> +		mini@0d000000 {
>> Although mini is awesome, it isn't hardware, and doesn't
>> belong in the device tree.
> 
> So what is at d0000000 ?
> 

There you can find the hardware interface that supports the IPC mechanism.
It is made up of a pair of registers to pass data between the processors and a pair of control/flags registers.
The hardware can interrupt the PowerPC side when there is data available for it.

>>> +		serial@0d006400 {
>>> +			compatible = "nintendo,hollywood-serial";
>> You might want to pick a more descriptive name for this,
>> "serial" is usually understaood to mean "RS232".  Which
>> this isn't.
> 
> What is it then ? You definitely want some other name if it's not
> classic rs232 style serial.
> 

It is what Nintendo calls the "Serial Interface" (SI) which is a proprietary serial hardware to drive the gamepads (and a custom keyboard too, once available for an RPG game).

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26  4:58             ` Benjamin Herrenschmidt
@ 2009-11-26 15:19               ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Wed, 2009-11-25 at 19:34 +0100, Albert Herranz wrote:
>> We need nobats (or a hack in the mmu_mapin_ram() code) because of the
>> discontiguous ram problem.
> 
> I would vote for a hack in mmu_mapin_ram() for now.
> 

I'll cook that.

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-26  5:08                 ` Benjamin Herrenschmidt
@ 2009-11-26 15:22                   ` Albert Herranz
  2009-11-27 12:12                   ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:22 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Tue, 2009-11-24 at 19:03 +0100, Albert Herranz wrote:
>> Segher Boessenkool wrote:
>>>> Add a config option GAMECUBE_COMMON to be used as a dependency for all
>>>> options common to the Nintendo GameCube and Wii video game consoles.
>>> Maybe something like GAMECUBE_OR_WII instead?  "COMMON" is so
>>> common it's meaningless.
>>>
>> I don't like either GAMECUBE_OR_WII.
>> It looks as if it can be used to match options for the GAMECUBE _or_ WII. But that's not the meaning of it.
>>
>> This option should be used only for options applicable to both the GAMECUBE and WII, i.e. basically those options in the WII which where "inherited" from the GAMECUBE to make it retro-compatible.
>>
>> If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or GAMECUBE_COMPAT?
> 
> I don't have any strong opinion. Maybe NINTENDO_COMMON ?
> 

We should avoid using NINTENDO just to refer to the Nintendo GameCube or Wii. They have other consoles too :)
There's even a port of Linux to the Nintendo DS...

I'd stick to GAMECUBE_COMMON or GAMECUBE_COMPAT.

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-26  5:12                   ` Benjamin Herrenschmidt
@ 2009-11-26 15:28                     ` Albert Herranz
  2009-11-26 21:02                       ` Benjamin Herrenschmidt
  2009-11-26 23:12                       ` Segher Boessenkool
  0 siblings, 2 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:28 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
>> Add support for using the USB Gecko adapter via the udbg facility on
>> the Nintendo GameCube and Wii video game consoles.
>> The USB Gecko is a 3rd party memory card interface adapter that provides
>> a EXI (External Interface) to USB serial converter.
> 
> The main issue here is that the gecko is supposed to be something you
> can plug or unplug no ? Is it hotswap or only at boot ? In the later
> case, maybe the node should be created by the boot wrapper when
> detecting the presence of the device. If it's hotplug, then we need
> something smarter...
> 

The usbgecko is hotplugable and hotswappable.
But as this is mostly a developer feature, not normaly used by end users, I think that we can just let it be as it is: autodetect it on boot (now probing for it instead of using information from the device tree).
If you unplug it later it causes no errors, you just miss whatever data is sent to it.

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26  5:18                       ` Benjamin Herrenschmidt
@ 2009-11-26 15:30                         ` Albert Herranz
  2009-11-26 21:10                           ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:30 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> 
>> +static void flipper_pic_mask_and_ack(unsigned int virq)
>> +{
>> +	int irq = virq_to_hw(virq);
>> +	void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +	clear_bit(irq, io_base + FLIPPER_IMR);
>> +	set_bit(irq, io_base + FLIPPER_ICR);
>> +}
> 
> Do not use clear_bit and set_bit on IOs. They will do lwarx/stwcx. which
> is really not what you want. You can use __clear_bit and __set_bit but
> it's still fishy. Those operate on unsigned long, so the size vary
> between 32 and 64 bit etc... not something you care that much about, but
> it's still the wrong tool for the job.
> 
> Do those guys have more than 32 interrupts ? If not, just hand
> code the msak & shifts. If they do, then maybe stick with __clear_bit()
> and __set_bit() which are the non atomic variants.
> 

There can be only 32 interrupt sources per pic.
I'll build a mask and check if just a simple write works too (it should IMHO), instead of a RWM.

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26  5:18                         ` Benjamin Herrenschmidt
@ 2009-11-26 15:33                           ` Albert Herranz
  2009-11-26 21:12                             ` Benjamin Herrenschmidt
  2009-11-26 23:00                           ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:33 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Sun, 2009-11-22 at 16:28 -0700, Grant Likely wrote:
>>> +unsigned int flipper_pic_get_irq(void)
>>> +{
>>> +       void __iomem *io_base = flipper_irq_host->host_data;
>>> +       int irq;
>>> +       u32 irq_status;
>>> +
>>> +       irq_status = in_be32(io_base + FLIPPER_ICR) &
>>> +                    in_be32(io_base + FLIPPER_IMR);
>>> +       if (irq_status == 0)
>>> +               return -1;      /* no more IRQs pending */
>> NO_IRQ_IGNORE 
> 
> Why no just 0 ? (aka NO_IRQ)
> 

I didn't know about 0 (I thought that was another valid interrupt).
I was used to -1 to tell that no IRQs were pending (at least from the ARCH=ppc days) :)

> Or do you know you are getting lots of spurrious that you don't want to
> account ?
> 

No, this is not the case here.

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-26  5:22                                     ` Benjamin Herrenschmidt
@ 2009-11-26 15:35                                       ` Albert Herranz
  2009-11-26 21:13                                         ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:35 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Tue, 2009-11-24 at 18:09 +0100, Albert Herranz wrote:
>> I could use ppc_md.ioremap to duplicate ioremap except for the ioremap
>> ram check.
>> But calling the stock ioremap without modifying it is not possible
>> because it checks and bails out when ioremapping a region marked as
>> ram (even if it's not real ram and it's memreserved).
>>
>> Is the list of memreserved areas preserved once the kernel is running?
>> If it is preserved another option would be to unban ioremapping ram if
>> memreserved.
> 
> Yes, check lmb's they should still be around.
> 

Good.
So adding a kconfig option to allow ioremapping memreserved memory marked as ram and adding a proper check (under that kconfig) to unban this case in ioremap would be an acceptable solution?

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-26  5:23                                 ` Benjamin Herrenschmidt
@ 2009-11-26 15:42                                   ` Albert Herranz
  2009-11-26 21:13                                     ` Benjamin Herrenschmidt
  2009-11-26 23:03                                   ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 15:42 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> 
>> +static void hlwd_pic_mask_and_ack(unsigned int virq)
>> +{
>> +	int irq = virq_to_hw(virq);
>> +	void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +	clear_bit(irq, io_base + HW_BROADWAY_IMR);
>> +	set_bit(irq, io_base + HW_BROADWAY_ICR);
>> +}
> 
> Same comment as with flipper. BTW. It looks really similar, can't you
> use the same driver ?
> 

I'll look at it. Surely, parts of it would be mergeable.

> Cheers,
> Ben.
> 

Thanks,
Albert

> 
> 

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 15:09           ` Albert Herranz
@ 2009-11-26 20:48             ` Benjamin Herrenschmidt
  2009-11-26 21:20               ` Albert Herranz
  2009-11-26 23:17               ` Segher Boessenkool
  0 siblings, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 20:48 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 16:09 +0100, Albert Herranz wrote:

> > Are the above OHCI and EHCI "special" ? If not, there's an existing
> > binding for that sort of thing, which btw requires properties to
> > indicate the endianness of the registers and in-memory data structures
> > etc...
> > 
> 
> They are a bit special because registers are in reverse little endian format,
> must be written in 32-bit chunks, and (all things point to) they have hardware bugs.

Well.. first what is "reverse little endian" ? :-) Big endian ?

The OHCI driver today has separate flags to control register endianness
and memory based data structures endianness.

I think we also only use 32-bit reads and writes no ? So that should be
covered :-)

As for HW bugs, well, as long as we know them we can define a quirk bit
and add the necessary workarounds to the driver :-)

Do you have a patch somewhere that adds the OCHI and EHCI support btw ?
 
Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 15:18             ` Albert Herranz
@ 2009-11-26 21:01               ` Benjamin Herrenschmidt
  2009-11-26 21:38                 ` Albert Herranz
  2009-11-26 23:25                 ` Segher Boessenkool
  0 siblings, 2 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:01 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev


> > Good point. I can't even guarantee that the kernel will work reliably
> > with nobats :-) At least you really want the kernel .text to be fully
> > covered by an IBAT.
> > 
> 
> It works with nobats.

But does it work -reliably- ? :-)

I haven't looked at that for years, but we used to have a subtle issue
if you happen to take a hash miss on the kernel text or data in the
wrong time, such as when SRR0/SRR1 are modified and before a subsequent
rfi. This is very very hard to trigger and maybe impossible without SMP
but to keep in mind.

Paulus added some code ages ago to close most of these by using the
MSR:RI bit so that the hash code could detect the situation and branch
to some "recovery" code, but from memory, while that dealt with missing
D-BATs, we still had a potential window of problem if the kernel text
itself wasn't entirely covered.

Any ways, not a big deal right now, as I said, we really want the BATs
for performances anyways, so we should probably just add some kind of
hack in mmu_mapin_ram() for the time being.

> I must say that all the patches posted (and the device drivers, which haven't
> been posted yet) are tested and working code.

That was my impression too, but in this case, I'm talking about a
potential very hard to hit problem that you may well have never managed
to actually trigger.

> There you can find the hardware interface that supports the IPC mechanism.
> It is made up of a pair of registers to pass data between the processors and a
> pair of control/flags registers.
> The hardware can interrupt the PowerPC side when there is data available for it.

Ok. So the right way to do that would be to have a node purely
representing the HW IPC, unrelated to whatever is running on the
secondary processor.

However, it's ok to have -below- that node, a set of device nodes or a
node with properties or whatever representing the FW in there and the
function it exposes.

That can be discussed later tho. I'm not that keen on having those info
be in the .dts coming with the kernel since those functions essentially
depend on what FW is loaded on the aux. processor.

What might do however is to have a way for that FW itself to provide you
with the nodes and properties for the functions it provides :-) Then you
can have the boot wrapper or the kernel platform init code use some well
defined (and as stable as possible) IPC API to identify the FW there and
expose all that stuff.

Of course that wouldn't work with FW we don't have control on. Can Linux
run on the wii with the original N. FW on the aux. processor ? Can we
detect what is running there ? Do we care ?

> It is what Nintendo calls the "Serial Interface" (SI) which is a proprietary
> serial hardware to drive the gamepads (and a custom keyboard too, once available
> for an RPG game).

So I would give it a different name than "serial" then. Make it gpsi
maybe ? (game pad serial interface ?) :-) Or invent something else...

Cheers,
Ben.

> > Cheers,
> > Ben.
> > 
> 
> Thanks,
> Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-26 15:28                     ` Albert Herranz
@ 2009-11-26 21:02                       ` Benjamin Herrenschmidt
  2009-11-26 23:12                       ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:02 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 16:28 +0100, Albert Herranz wrote:
> Benjamin Herrenschmidt wrote:
> > On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> >> Add support for using the USB Gecko adapter via the udbg facility on
> >> the Nintendo GameCube and Wii video game consoles.
> >> The USB Gecko is a 3rd party memory card interface adapter that provides
> >> a EXI (External Interface) to USB serial converter.
> > 
> > The main issue here is that the gecko is supposed to be something you
> > can plug or unplug no ? Is it hotswap or only at boot ? In the later
> > case, maybe the node should be created by the boot wrapper when
> > detecting the presence of the device. If it's hotplug, then we need
> > something smarter...
> > 
> 
> The usbgecko is hotplugable and hotswappable.
> But as this is mostly a developer feature, not normaly used by end users,
> I think that we can just let it be as it is: autodetect it on boot (now probing
> for it instead of using information from the device tree).
> If you unplug it later it causes no errors, you just miss whatever data is sent to it.

Ack. We may still went ultimately to have some kind of nice hotplug
driver for that connector and we may even have a usbgecko driver for
that things "after boot" that creates areal tty etc... but for now, just
a hard probe will do just fine.

Of course a real OF implemention is welcome to create a device node for
it if it was indeed present at boot time.

Cheers,
Ben.

> > Cheers,
> > Ben.
> > 
> 
> Thanks,
> Albert
> 

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26 15:30                         ` Albert Herranz
@ 2009-11-26 21:10                           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:10 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 16:30 +0100, Albert Herranz wrote:
> Benjamin Herrenschmidt wrote:
> > On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> > 
> >> +static void flipper_pic_mask_and_ack(unsigned int virq)
> >> +{
> >> +	int irq = virq_to_hw(virq);
> >> +	void __iomem *io_base = get_irq_chip_data(virq);
> >> +
> >> +	clear_bit(irq, io_base + FLIPPER_IMR);
> >> +	set_bit(irq, io_base + FLIPPER_ICR);
> >> +}
> > 
> > Do not use clear_bit and set_bit on IOs. They will do lwarx/stwcx. which
> > is really not what you want. You can use __clear_bit and __set_bit but
> > it's still fishy. Those operate on unsigned long, so the size vary
> > between 32 and 64 bit etc... not something you care that much about, but
> > it's still the wrong tool for the job.
> > 
> > Do those guys have more than 32 interrupts ? If not, just hand
> > code the msak & shifts. If they do, then maybe stick with __clear_bit()
> > and __set_bit() which are the non atomic variants.
> > 
> 
> There can be only 32 interrupt sources per pic.
> I'll build a mask and check if just a simple write works too (it should IMHO), instead of a RWM.

For the ICR just writes should be ok. For the IMR, I wouldn't be
surprised if you need to RMW. In which case you have two options:

 - One is you just do RMW :-) As long as you don't do SMP, you don't
have a problem since these callbacks are generally called with local
IRQs off.

 - Or you could explicitely add a spinlock_irqsave just out of paranoia
or if you envision SMP type access to these things (from the aux
processor ? But then the spinlock would have to be shared with the aux
ptiocrocessor FW... fun)

 - In any case, clear_bit and set_bit are the wrong accessors since
lwarx and stwcx. are definitely the wrong instructions to use for non
cachable accesses. On other processor you probably would have blown up
here in fact. Also those accessors don't provide any memory barriers
which mean you may even have some ordering issues. Use readl_be() and
writel_be() (or the ppc specific in_be32/out_be32) or the _le variants
if you want to count bits backward :-)

- You could also keep in memory cache of what the mask is supposed to
be. You RMW the cache and do a simple store to the register. It won't
fix the concurrency problem (that you probably don't have anyways) but
it will make things faster by avoiding an MMIO load....

 - However you probably need that MMIO load anyways :-) Trick is, the
store you do to ack and mask an interrupt may take some time to hit the
PIC before the said PIC actually lowers the CPU EE line. Enough time for
your code to go back, re-enable MSR:EE and start calling into the
handlers. Enough time thus to catch a "spurrious" interrupt. Old pmacs
have a similar PIC and have the same problem. I would recommend that
after a mask or a mask & ack, you also read back the register. The MMIO
accessors (readl, etc...) will use a twi;isync construct to ensure that
the load has been fully completed before execution continues which will
help.

 - The construct and flow handler you use assume all interrupts are
level sensitive, this is the case right ?

Cheers,
Ben.

> > Cheers,
> > Ben.
> > 
> 
> Thanks,
> Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26 15:33                           ` Albert Herranz
@ 2009-11-26 21:12                             ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:12 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 16:33 +0100, Albert Herranz wrote:
> Benjamin Herrenschmidt wrote:
> > On Sun, 2009-11-22 at 16:28 -0700, Grant Likely wrote:
> >>> +unsigned int flipper_pic_get_irq(void)
> >>> +{
> >>> +       void __iomem *io_base = flipper_irq_host->host_data;
> >>> +       int irq;
> >>> +       u32 irq_status;
> >>> +
> >>> +       irq_status = in_be32(io_base + FLIPPER_ICR) &
> >>> +                    in_be32(io_base + FLIPPER_IMR);
> >>> +       if (irq_status == 0)
> >>> +               return -1;      /* no more IRQs pending */
> >> NO_IRQ_IGNORE 
> > 
> > Why no just 0 ? (aka NO_IRQ)
> > 
> 
> I didn't know about 0 (I thought that was another valid interrupt).

0 is a valid hw number. It's not a valid linux "virq" number. In fact,
that's part of the reason why we generalized the whole virq thingy :-)
Because back then, Linus made the statement that 0 should never be a
valid IRQ number in linux. That also allowed us to make sure that 1..15
are never allocated to anything but a legacy 8259 to avoid all sorts of
problems with crackpot legacy x86 originated drivers who hard coded some
of these interrupts.

> I was used to -1 to tell that no IRQs were pending (at least from the
> ARCH=ppc days) :)

Yup, we changed that :-)

> > Or do you know you are getting lots of spurrious that you don't want to
> > account ?
> > 
> 
> No, this is not the case here.

Cheers,
Ben.

> > Cheers,
> > Ben.
> > 
> 
> Thanks,
> Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram  regions
  2009-11-26 15:35                                       ` Albert Herranz
@ 2009-11-26 21:13                                         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:13 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 16:35 +0100, Albert Herranz wrote:
> Benjamin Herrenschmidt wrote:
> > On Tue, 2009-11-24 at 18:09 +0100, Albert Herranz wrote:
> >> I could use ppc_md.ioremap to duplicate ioremap except for the ioremap
> >> ram check.
> >> But calling the stock ioremap without modifying it is not possible
> >> because it checks and bails out when ioremapping a region marked as
> >> ram (even if it's not real ram and it's memreserved).
> >>
> >> Is the list of memreserved areas preserved once the kernel is running?
> >> If it is preserved another option would be to unban ioremapping ram if
> >> memreserved.
> > 
> > Yes, check lmb's they should still be around.
> > 
> 
> Good.
> So adding a kconfig option to allow ioremapping memreserved memory marked
> as ram and adding a proper check (under that kconfig) to unban this case
> in ioremap would be an acceptable solution?

Don't even make it Kconfig. Stick it under you GAMECUBE_COMMON for now
or CONFIG_WII or whatever. This is temporary until we sort out the whole
disctontig mem issue.

Cheers,
Ben.

> > Cheers,
> > Ben.
> > 
> 
> Thanks,
> Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-26 15:42                                   ` Albert Herranz
@ 2009-11-26 21:13                                     ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 21:13 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 16:42 +0100, Albert Herranz wrote:
> Benjamin Herrenschmidt wrote:
> > On Sun, 2009-11-22 at 23:01 +0100, Albert Herranz wrote:
> > 
> >> +static void hlwd_pic_mask_and_ack(unsigned int virq)
> >> +{
> >> +	int irq = virq_to_hw(virq);
> >> +	void __iomem *io_base = get_irq_chip_data(virq);
> >> +
> >> +	clear_bit(irq, io_base + HW_BROADWAY_IMR);
> >> +	set_bit(irq, io_base + HW_BROADWAY_ICR);
> >> +}
> > 
> > Same comment as with flipper. BTW. It looks really similar, can't you
> > use the same driver ?
> > 
> 
> I'll look at it. Surely, parts of it would be mergeable.

If it's too much work, we can do that later. No big deal.

Cheers,
Ben.

> > Cheers,
> > Ben.
> > 
> 
> Thanks,
> Albert
> 
> > 
> > 

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 20:48             ` Benjamin Herrenschmidt
@ 2009-11-26 21:20               ` Albert Herranz
  2009-11-26 23:17               ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 21:20 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
> On Thu, 2009-11-26 at 16:09 +0100, Albert Herranz wrote:
> 
>>> Are the above OHCI and EHCI "special" ? If not, there's an existing
>>> binding for that sort of thing, which btw requires properties to
>>> indicate the endianness of the registers and in-memory data structures
>>> etc...
>>>
>> They are a bit special because registers are in reverse little endian format,
>> must be written in 32-bit chunks, and (all things point to) they have hardware bugs.
> 
> Well.. first what is "reverse little endian" ? :-) Big endian ?
> 

It's the same case as the register access for the Freescale eSDHC controller, which is already in the existing sdhci-of driver.

> The OHCI driver today has separate flags to control register endianness
> and memory based data structures endianness.
> 
> I think we also only use 32-bit reads and writes no ? So that should be
> covered :-)
> 

There are 8, 16 and 32 bit accesses. We need the same workarounds as present for the Freescale eSDHC controller.

> As for HW bugs, well, as long as we know them we can define a quirk bit
> and add the necessary workarounds to the driver :-)
> 

Yes, that's how it was done.
Although it it currently not integrated into sdhci-of. I think that the specific eSDHC code should be moved to another file, and leave the sdhci-of with the generic code and the sdhci_of_match table. Then adding a similar driver would simply consist in adding another file with the sdhci_data (containing ops and quirks) and adding an entry to the sdhci_of_match table in sdhci-of. 

> Do you have a patch somewhere that adds the OCHI and EHCI support btw ?
>  

Yes, too. Although it needs review and cleanup too.

I have a git tree with all the stuff, but it contains only the existing code previous to the effort of mainlining it:
 http://git.infradead.org/users/herraa1/gc-linux-2.6.git/shortlog/refs/heads/mini/gc-linux-2.6.31

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 21:01               ` Benjamin Herrenschmidt
@ 2009-11-26 21:38                 ` Albert Herranz
  2009-11-26 22:37                   ` Benjamin Herrenschmidt
  2009-11-26 23:25                 ` Segher Boessenkool
  1 sibling, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 21:38 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: linuxppc-dev

Benjamin Herrenschmidt wrote:
>>> Good point. I can't even guarantee that the kernel will work reliably
>>> with nobats :-) At least you really want the kernel .text to be fully
>>> covered by an IBAT.
>>>
>> It works with nobats.
> 
> But does it work -reliably- ? :-)
> 

It does AFAICT. My Wii is a 24x7 linux box although it is not stressed in any way usually.

> Any ways, not a big deal right now, as I said, we really want the BATs
> for performances anyways, so we should probably just add some kind of
> hack in mmu_mapin_ram() for the time being.
> 

Yup. The idea is to map the first 16MB of MEM1 with a BAT.
Mapping the whole 24MB with BATs may not be possible because we want the framebuffer in MEM1 for performance reasons.

>> I must say that all the patches posted (and the device drivers, which haven't
>> been posted yet) are tested and working code.
> 
> That was my impression too, but in this case, I'm talking about a
> potential very hard to hit problem that you may well have never managed
> to actually trigger.
> 

I haven't actually, if that applies :)

>> There you can find the hardware interface that supports the IPC mechanism.
>> It is made up of a pair of registers to pass data between the processors and a
>> pair of control/flags registers.
>> The hardware can interrupt the PowerPC side when there is data available for it.
> 
> Ok. So the right way to do that would be to have a node purely
> representing the HW IPC, unrelated to whatever is running on the
> secondary processor.
> 

Totally agreed.

> However, it's ok to have -below- that node, a set of device nodes or a
> node with properties or whatever representing the FW in there and the
> function it exposes.
> 
> That can be discussed later tho. I'm not that keen on having those info
> be in the .dts coming with the kernel since those functions essentially
> depend on what FW is loaded on the aux. processor.
> 

I think we can leave this for later as you said.

> What might do however is to have a way for that FW itself to provide you
> with the nodes and properties for the functions it provides :-) Then you
> can have the boot wrapper or the kernel platform init code use some well
> defined (and as stable as possible) IPC API to identify the FW there and
> expose all that stuff.
> 

Segher was playing with an OF implementation...

> Of course that wouldn't work with FW we don't have control on. Can Linux
> run on the wii with the original N. FW on the aux. processor ? Can we
> detect what is running there ? Do we care ?
> 

Yes, it can. And it is done. But I think we don't care/need that in mainline.

>> It is what Nintendo calls the "Serial Interface" (SI) which is a proprietary
>> serial hardware to drive the gamepads (and a custom keyboard too, once available
>> for an RPG game).
> 
> So I would give it a different name than "serial" then. Make it gpsi
> maybe ? (game pad serial interface ?) :-) Or invent something else...
> 

I'd choose "gcnsi" with a compatible like "nintendo,gamecube-si" :)

(gcn is the official short abbreviation for the Nintendo GameCube)

> Cheers,
> Ben.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-25 17:13                         ` Albert Herranz
@ 2009-11-26 21:52                           ` Segher Boessenkool
  2009-11-26 22:05                             ` Albert Herranz
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 21:52 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>> Maybe using FLIPPER (or GAMECUBE_FLIPPER) instead of GAMECUBE_COMMON
>> is a good name?
>
> I'd prefer to not use a name that implies a specific hardware to  
> describe two (mostly) similar but different hardwares.

Hollywood is 100% compatible to Flipper though.

>>> +/*
>>> + * Each interrupt has a corresponding bit in both
>>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>>> + *
>>> + * Enabling/disabling an interrupt line involves asserting/clearing
>>> + * the corresponding bit in IMR. ACK'ing a request simply involves
>>> + * asserting the corresponding bit in ICR.
>>> + */

I looked it up in YAGCD; it says that _reading_ the ICR reg already
acks all interrupts (and clears the bits), you never write this reg!

>>> +static void flipper_pic_ack(unsigned int virq)
>>> +{
>>> +    int irq = virq_to_hw(virq);
>>> +    void __iomem *io_base = get_irq_chip_data(virq);
>>> +
>>> +    set_bit(irq, io_base + FLIPPER_ICR);
>>> +}
>>
>> So it should be a simple write instead of an RMW here, right?
>> As it is you are ACKing _all_ IRQs as far as I can see.
>>
>
> No, it acks just a single IRQ.

No it doesn't.  Say IRQs 1 and 3 are asserted, so the reg contains 0x0a.
Now you want to ack IRQ1; set_bit() will write 0x0a | 0x02, not just  
0x02.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-25 17:24                           ` Albert Herranz
@ 2009-11-26 21:53                             ` Segher Boessenkool
  2009-11-26 22:07                               ` Albert Herranz
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 21:53 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> We need it as it currently doesn't match with the default bus ids.

> Should I introduce a .type property matching any of those above in  
> the soc node, and get rid of the explicit bus probe?

You don't need any fake bus as far as I can see, just probe the devices
you want.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support
  2009-11-25 17:47                                     ` Albert Herranz
@ 2009-11-26 22:00                                       ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:00 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> Add support for the BootMii 'mini' firmware replacement for the
>>> Starlet processor.
>>>
>>> 'mini' is an open source IOS replacement written from scratch by
>>> Team Twiizers.
>>
>> It's not a replacement, it doesn't have any of the same  
>> functionality.
>
> I didn't know 'replacement' had that semantics.

It's ambiguous.

> My intention was to say that 'mini' firmware is an alternative to  
> the stock IOS firmware, not trying to imply that it behaves like it  
> or it is compatible with it.
> Point taken.
>
> I'll use 'mini' alternate firmware if that's ok.

"Alternative firmware" is fine.

>>> +enum starlet_ipc_flavour {
>>> +    STARLET_IPC_IOS,
>>> +    STARLET_IPC_MINI,
>>> +};
>>
>> I thought you don't support IOS at all anymore?
>>
>
> I don't plan to mainline IOS support.
> But to make runtime decisions I need to know if we are running  
> along the 'mini' firmware or the default IOS firmware.
> That's the intention of that enum.

>> Modern mini will always have AHBPROT set up to give you full access,
>> so this isn't needed either.
>>
>
> So we have two options here:
> - assume that whatever firmware is running properly sets AHBPROT  
> and hope it works
> - or try to use the existing firmware interfaces to check and make  
> sure that AHBPROT is indeed properly set
>
> I chose the second option here.

It is much much simpler to simply require a new enough mini :-)

>> Do you need this driver to boot?  If not, it might be best to  
>> leave it
>> out for now.
>
> Strictly speaking, we don't need the driver to boot if we asume  
> that AHBPROT is properly set.
> But we'll need it later to shutdown 'mini' drivers, unless 'mini'  
> is changed to boot PowerPC code with all hardware already  
> relinquished.
>
> That is not true for the last available version of 'mini' firmware.  
> That version still boots PowerPC code with at least the SDHCI  
> controller driven by 'mini'.

I'll fix this.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 18/19] powerpc: wii: platform support
  2009-11-25 17:58                                       ` Albert Herranz
@ 2009-11-26 22:05                                         ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:05 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> +#ifdef CONFIG_STARLET_MINI
>>> +
>>> +#define HW_RESETS_OF_COMPATIBLE    "nintendo,hollywood-resets"
>>> +#define HW_GPIO_ALIAS        "hw_gpio
>>
>> This should be unconditional now I think?  You access the hardware
>> directly.
>
> Yes, at this stage direct hardware should be possible, but only if  
> 'mini' support is compiled-in (which will be the default option at  
> this stage).
> We can either leave the conditionals as is now, or remove them and  
> add them later if we support more than one firmware flavour.
>
> I'm fine with both options.

Removing all superfluous code is best in my opinion.

>>> +    np = of_find_node_by_name(NULL, "aliases");
>>> +    if (!np) {
>>> +        pr_err("unable to find node %s\n", "aliases");
>>> +        goto out;
>>> +    }
>>> +
>>> +    path = of_get_property(np, HW_GPIO_ALIAS, NULL);
>>> +    of_node_put(np);
>>> +    if (!path) {
>>> +        pr_err("alias %s unknown\n", HW_GPIO_ALIAS);
>>> +        goto out;
>>> +    }
>>
>> Don't use an alias here, search for e.g. a matching "compatible"  
>> instead.
>
> I used an alias because I wanted explicitly the second GPIO word.
>
> Is there another way to select a specific instance of repeated  
> identical hardware?

Yes, probe for it with its address.  There is no guarantee in which  
order
you will get them.

> We have two instances of gpios here, matching the same "compatible".

It's a pain in the behind that the GPIO binding will not allow you to
show the two GPIO regs as one controller, which it is.  Or can it
actually do that?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26 21:52                           ` Segher Boessenkool
@ 2009-11-26 22:05                             ` Albert Herranz
  2009-11-27  0:06                               ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 22:05 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>>> Maybe using FLIPPER (or GAMECUBE_FLIPPER) instead of GAMECUBE_COMMON
>>> is a good name?
>>
>> I'd prefer to not use a name that implies a specific hardware to
>> describe two (mostly) similar but different hardwares.
> 
> Hollywood is 100% compatible to Flipper though.
> 

No. There's no ARAM for example :)

>>>> +/*
>>>> + * Each interrupt has a corresponding bit in both
>>>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>>>> + *
>>>> + * Enabling/disabling an interrupt line involves asserting/clearing
>>>> + * the corresponding bit in IMR. ACK'ing a request simply involves
>>>> + * asserting the corresponding bit in ICR.
>>>> + */
> 
> I looked it up in YAGCD; it says that _reading_ the ICR reg already
> acks all interrupts (and clears the bits), you never write this reg!
> 

YAGCD is not always right. You should not take it as _the truth_.
I'm not telling this is the case. But I don't recall such behavior. It's been a long time since this is done this way.

>>>> +static void flipper_pic_ack(unsigned int virq)
>>>> +{
>>>> +    int irq = virq_to_hw(virq);
>>>> +    void __iomem *io_base = get_irq_chip_data(virq);
>>>> +
>>>> +    set_bit(irq, io_base + FLIPPER_ICR);
>>>> +}
>>>
>>> So it should be a simple write instead of an RMW here, right?
>>> As it is you are ACKing _all_ IRQs as far as I can see.
>>>
>>
>> No, it acks just a single IRQ.
> 
> No it doesn't.  Say IRQs 1 and 3 are asserted, so the reg contains 0x0a.
> Now you want to ack IRQ1; set_bit() will write 0x0a | 0x02, not just 0x02.
> 

Let me rephrase it. No it should just ack a single IRQ :)

So then this is working by accident.
If that's the case, I guess it works because the interrupt is not cleared at the source and the ICR is set again immediately for any pending interrupt?

> 
> Segher
> 
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-26 21:53                             ` Segher Boessenkool
@ 2009-11-26 22:07                               ` Albert Herranz
  2009-11-27  0:09                                 ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 22:07 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> We need it as it currently doesn't match with the default bus ids.
> 
>> Should I introduce a .type property matching any of those above in the
>> soc node, and get rid of the explicit bus probe?
> 
> You don't need any fake bus as far as I can see, just probe the devices
> you want.
> 

But it's way easier to let the bus probe do it for us. I don't see the win here.

> 
> Segher
> 
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  4:23         ` Benjamin Herrenschmidt
@ 2009-11-26 22:15           ` Segher Boessenkool
  2009-11-26 22:38             ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:15 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> If you have only one interrupt controller, like here, you don't
>> need to refer to it _at all_ :-)
>
> I think Linux requires that you do though. It might be a mistake on  
> our
> part but heh ...

Linux doesn't require it; (old) Macs are like this, for example,
and that works fine.  Oh and all Maple firmwares are like that as
well I think.  Etc.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  4:27       ` Benjamin Herrenschmidt
@ 2009-11-26 22:19         ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:19 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>>> +			xfb-start = <0x01698000>; /* end-of-ram - xfb-size */
>>> +			xfb-size = <0x168000>;
>>
>> XFB address isn't fixed on the hardware, and the kernel might
>> want to move it, and you can easily probe for it anyway.  Remove
>> these last two properties please.
>
> Ok but you need to know what it was setup to by the FW no ? To avoid
> having a temporary display "glitch" while booting... Also on a 24M
> config,it might get tough for the driver to allocate 2M contiguous  
> like
> that if it's done late in the boot process.

Sure, the platform code will have to probe this very early.  Can always
do the /memreserve/ if really needed.

>>> +		auxram@0c005000 {
>>> +			compatible = "nintendo,flipper-auxram";
>>> +			reg = <0x0c005000 0x200>;	/* DSP */
>>> +			interrupts = <6>;
>>> +			interrupt-parent = <&pic>;
>>> +		};
>>> +
>>> +		audio@0c005000 {
>>> +			compatible = "nintendo,flipper-audio";
>>> +			reg = <0x0c005000 0x200		/* DSP */
>>> +			       0x0c006c00 0x20>;	/* AI */
>>> +			interrupts = <6>;
>>> +			interrupt-parent = <&pic>;
>>> +		};
>>
>> These two have the same address, not good.  Just remove the
>> auxram node?
>
> Or make it a child of audio ? :-)

Hrm, actually, DSP and AI should be separate nodes, and ARAM a child
of DSP (on its own bus, so it can show that it is 16MB etc.)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-26  4:35           ` Benjamin Herrenschmidt
@ 2009-11-26 22:23             ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:23 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> So what's your proposal then? Placing it within a fake func?
>
> Just do a .S file :-)

Yeah.  You might be able to do one that handles both GC and Wii,
maybe it's easier/clearer to keep them separate though.

> Ouch. I wouldn't be surprised if those guys don't do cache coherency
> in the bridge anyways.

That is correct; we haven't found any way to enable it, at least.
To be fair, it's actually better for performance to _not_ do RAM
coherency when used as a game system.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  4:21       ` Benjamin Herrenschmidt
  2009-11-26  4:38         ` Grant Likely
@ 2009-11-26 22:30         ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:30 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>>> +       soc {
>>
>> It would be better to rename this as IMMR or the bus type.  This node
>> doesn't actually describe the entire chip, but describes the internal
>> memory mapped registers.
>
> I would really just call it "flipper" :-)

Yeah, I came to the same conclusion.

>> Since you're only doing 1:1 mappings; you could replace this with an
>> empty "ranges;" property instead.
>
> On the other hand it is a useful "documentation" to specify the exact
> range decoded when you know it :-)

Not the "decoded" range in this case, that is 0..4G :-)  The "canonical"
ranges is nice doc, yes.

>> Hint:  If you move the interrupt-parent property up to the root node,
>> then you don't need to specify it in every single device node; it  
>> will
>> just inherit from the parent.
>
> Note that this is a linux-ism no ? (aka ePAPRism).

Nope, it is from the standard interrupt mapping recommended practice.
It is fine.

> If they aim toward having a real OF which I think they do

We do.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 21:38                 ` Albert Herranz
@ 2009-11-26 22:37                   ` Benjamin Herrenschmidt
  2009-11-27  0:16                     ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 22:37 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Thu, 2009-11-26 at 22:38 +0100, Albert Herranz wrote:

> Yup. The idea is to map the first 16MB of MEM1 with a BAT.
> Mapping the whole 24MB with BATs may not be possible because we want the framebuffer
> in MEM1 for performance reasons.

How big is the fb ? We have plenty of BATs on these things... so one 16M
for the low mem and one 64M for the "high" mem, that leaves something
like 6 to manage as much as possible up to the fb :-)

Let's keep 1 or 2 for debug and maybe even BAT map the fb itself, we
still are quite comfortable :-)

That reminds me we still need to re-introduce a clean version of
io_block_mapping (or ioremap flag that does the same) so the platform
code can establish a BAT mapping for a whole bunch of IOs and ioremap
transparenty picks addresses in there. We used to do it, dropped it
mostly because it was done badly (virtual address was hard coded which
caused all sorts of issues) but it shouldn't be hard to do it right and
it would improve perfs a little bit more.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26 22:15           ` Segher Boessenkool
@ 2009-11-26 22:38             ` Benjamin Herrenschmidt
  2009-11-27  0:18               ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 22:38 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Thu, 2009-11-26 at 23:15 +0100, Segher Boessenkool wrote:
> >> If you have only one interrupt controller, like here, you don't
> >> need to refer to it _at all_ :-)
> >
> > I think Linux requires that you do though. It might be a mistake on  
> > our
> > part but heh ...
> 
> Linux doesn't require it; (old) Macs are like this, for example,
> and that works fine.  Oh and all Maple firmwares are like that as
> well I think.  Etc.

It works fine on old macs thanks to a quirk we enable in the mac code
iirc and old maple works thanks to mere luck with the fallback code we
have which reads things of PCI config space :-)

Don't rely on that.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26  4:45         ` Benjamin Herrenschmidt
  2009-11-26 15:09           ` Albert Herranz
@ 2009-11-26 22:45           ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:45 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> +/memreserve/ 0x01800000 0xe800000;	/* memory hole (includes I/O  
>> area) */
>> +/memreserve/ 0x10000000 0x0004000;	/* DSP RAM */
>
> Weird layout... nothing you can do about I suppose.
>
> Out of curiosity, what is that DSP RAM ? Some actual DSP core  
> somewhere
> in the IO chip setup to use memory from up there ?

It's an actual DSP yes, and it seems it uses that fixed address range
(at the start of the 64MB GDDR3 memory) always.  So we have to stay
away from that memory range.

>> +	memory {
>> +		device_type = "memory";
>> +		/* MEM1 + memory hole + MEM2 - firmware/buffers area */
>> +		reg = <0x00000000 0x133e0000>;
>> +	};
>
> So we do have a nasty hole here in the middle. How bad it is if you  
> try
> to just have two ranges in there (ie as if it was discontiguous) ?

Not bad at all.  There is no "as if" -- it _is_ discontiguous memory,
they are totally different memory technology even.

>> +		/* Team Twiizers' 'mini' firmware IPC */
>
> Out of curiosity, what are these ? :-)

There is an embedded ARM9 in the Hollywood.  It is "the boss" of the
system, not the PowerPC.  "mini" is the name of the code we run on it.

There is a hardware IPC interface between the ARM and the PowerPC (just
a bunch of doorbells and general purpose regs).

> Similar comment as before, could the above be dynamically probed ? If
> you are not a hacker you may not need that at all to use some linux
> based piece of SW on the wii right ?

Yeah.  Well, after any other drivers have been merged, anyway, heh :-)

>> +		ohci1@0d060000 {
>
> Why the "1" ?

Right, call them both just "ohci" please.  Or "usb" even.

>> +		PIC1: pic1@0d800030 {
>> +			#interrupt-cells = <1>;
>> +			compatible = "nintendo,hollywood-pic";
>> +			reg = <0x0d800030 0x8>;
>> +			interrupt-controller;
>> +			interrupts = <14>;
>> +			interrupt-parent = <&PIC0>;
>> +		};
>
> Ah, a cascaded PIC, fun fun fun

Well at least this cascaded PIC is sane, the root PIC is less so :-P

>> +		hollywood-ahbprot@0d800064 {
>> +			compatible = "nintendo,hollywood-ahbprot";
>> +			reg = <0x0d800064 0x4>;
>> +		};
>
> What is this ?

Most of the devices new in Hollywood (AES engine, NAND engine, USB,
SD, etc.) sit on an AHB bus.  The AHBPROT register is used to configure
which of these can be accessed from the PowerPC.

Modern "mini" always gives us full control.  Also, there is no reason
to single out the AHBPROT reg in the device tree like this, anyway.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26  4:51           ` Benjamin Herrenschmidt
  2009-11-26 15:18             ` Albert Herranz
@ 2009-11-26 22:50             ` Segher Boessenkool
  2009-11-26 23:02               ` Albert Herranz
  1 sibling, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:50 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

> BTW. If we want to play with clocks, maybe you should look at
> my proposed binding for clocks and implementing the clk API :-)

There are no clocks that are configurable from the PowerPC side
(well, maybe things like the USB clocks, but we do not know how).

>>> +		/* Team Twiizers' 'mini' firmware IPC */
>>> +		mini@0d000000 {
>>
>> Although mini is awesome, it isn't hardware, and doesn't
>> belong in the device tree.
>
> So what is at d0000000 ?

0c000000 is the flipper-compatible stuff
0d000000 is the hollywood new devices
0d800000 is the same as part of 0d000000, but with some extra bits
sometimes.

>>> +		serial@0d006400 {
>>> +			compatible = "nintendo,hollywood-serial";
>>
>> You might want to pick a more descriptive name for this,
>> "serial" is usually understaood to mean "RS232".  Which
>> this isn't.
>
> What is it then ? You definitely want some other name if it's not
> classic rs232 style serial.

It's SPI I think, with some extra signals.  It's the gamepads mostly.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-26  5:14                       ` Benjamin Herrenschmidt
@ 2009-11-26 22:54                         ` Segher Boessenkool
  2009-11-26 23:27                           ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 22:54 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev, Arnd Bergmann

>> This will probably break other platforms if
>> CONFIG_PPC_EARLY_DEBUG_USBGECKO
>> is set. In general, we try hard to make it possible to build generic
>> kernels for multiple systems, so it would be better to also add a
>> runtime check here.
>
> No Arnd. The whole point of EARLY_DEBUG is that it is -known- to break
> other platforms :-) So that we can use it before we even get to probe
> anything.
>
> I am still tempted, one day, to change the kernel early init to  
> setup a
> stack in .bss and go straight to C to do that sort of stuff by parsing
> the flat DT, this could be done using pretty much completely generic
> code :-) But not right now.

No Ben.  The whole point of EARLY_DEBUG is that it _always works_,  
because
it is such trivial code.  Don't break that please, or we'll be forced to
add a "REALLY_EARLY_DEBUG" instead :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26  5:18                         ` Benjamin Herrenschmidt
  2009-11-26 15:33                           ` Albert Herranz
@ 2009-11-26 23:00                           ` Segher Boessenkool
  2009-11-26 23:38                             ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 23:00 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>>> +unsigned int flipper_pic_get_irq(void)
>>> +{
>>> +       void __iomem *io_base = flipper_irq_host->host_data;
>>> +       int irq;
>>> +       u32 irq_status;
>>> +
>>> +       irq_status = in_be32(io_base + FLIPPER_ICR) &
>>> +                    in_be32(io_base + FLIPPER_IMR);
>>> +       if (irq_status == 0)
>>> +               return -1;      /* no more IRQs pending */
>>
>> NO_IRQ_IGNORE
>
> Why no just 0 ? (aka NO_IRQ)
>
> Or do you know you are getting lots of spurrious that you don't  
> want to
> account ?

IRQ #0 is a valid IRQ here (graphics error IIRC), it should be
remapped I suppose?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 22:50             ` Segher Boessenkool
@ 2009-11-26 23:02               ` Albert Herranz
  0 siblings, 0 replies; 181+ messages in thread
From: Albert Herranz @ 2009-11-26 23:02 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>> So what is at d0000000 ?
> 
> 0c000000 is the flipper-compatible stuff
> 0d000000 is the hollywood new devices
> 0d800000 is the same as part of 0d000000, but with some extra bits
> sometimes.
> 

Also, when in Wii native mode, stuff like EXI, SI and AI (which is flipper-compatible stuff too) is available at 0d000000 only.

>>>> +        serial@0d006400 {
>>>> +            compatible = "nintendo,hollywood-serial";
>>>
>>> You might want to pick a more descriptive name for this,
>>> "serial" is usually understaood to mean "RS232".  Which
>>> this isn't.
>>
>> What is it then ? You definitely want some other name if it's not
>> classic rs232 style serial.
> 
> It's SPI I think, with some extra signals.  It's the gamepads mostly.
> 

EXI is SPI.
But SI is a different thingy.

See http://www.int03.co.uk/crema/hardware/gamecube/gc-control.htm .

> 
> Segher
> 
> 

Cheers,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support
  2009-11-26  5:23                                 ` Benjamin Herrenschmidt
  2009-11-26 15:42                                   ` Albert Herranz
@ 2009-11-26 23:03                                   ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 23:03 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> +static void hlwd_pic_mask_and_ack(unsigned int virq)
>> +{
>> +	int irq = virq_to_hw(virq);
>> +	void __iomem *io_base = get_irq_chip_data(virq);
>> +
>> +	clear_bit(irq, io_base + HW_BROADWAY_IMR);
>> +	set_bit(irq, io_base + HW_BROADWAY_ICR);
>> +}
>
> Same comment as with flipper. BTW. It looks really similar, can't you
> use the same driver ?

No, they aren't actually similar; the old PIC acks when the status reg
is read, the new PIC acks when you write a 1.  Also, the new PIC has
more registers, it is an interrupt controller for the ARM as well.  Not
that we use it, but still.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits
  2009-11-26  8:17               ` Gabriel Paubert
  2009-11-26  8:46                 ` Benjamin Herrenschmidt
@ 2009-11-26 23:06                 ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 23:06 UTC (permalink / raw)
  To: Gabriel Paubert; +Cc: Albert Herranz, linuxppc-dev

>>> Sure, the memory controllers don't do coherency.  I'm slightly  
>>> worried
>>> about two things:
>>> 1) Will the generic code use M=0 as well?  Is it a problem if it
>>> doesn't?
>>
>> We can make it not do it.
>>
>>> 2) Do lwarx. etc. work in M=0?
>>
>> They should hopefully... as long as you don't rely on the reservation
>> blowing as a result of a DMA write.
>
> Hmm, this really depends on whether the DMA transfers generate bus  
> cycles
> that require coherency or not.

They do not; device DMA never goes to the 6xx bus with this bridge.

> Not the other way around. M=1 only forces
> bus cycles to be snooped by other processors (asserting the GBL signal
> on 603/604/750 busses).

Right, it enables sending probes, not receiving them.  On this CPU  
anyway.
The architecture specification is quite silent on this all.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko
  2009-11-26 15:28                     ` Albert Herranz
  2009-11-26 21:02                       ` Benjamin Herrenschmidt
@ 2009-11-26 23:12                       ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 23:12 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

> The usbgecko is hotplugable and hotswappable.
> But as this is mostly a developer feature, not normaly used by end  
> users, I think that we can just let it be as it is: autodetect it  
> on boot (now probing for it instead of using information from the  
> device tree).
> If you unplug it later it causes no errors, you just miss whatever  
> data is sent to it.

You can get interrupts when an EXI device is plugged or unplugged; the
"normal" driver should use that.  But you haven't posted that yet.

The "early debug" driver can just assume the user doesn't like to hurt
himself, and provide pain when the user does, there's no problem with
that :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 20:48             ` Benjamin Herrenschmidt
  2009-11-26 21:20               ` Albert Herranz
@ 2009-11-26 23:17               ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 23:17 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> They are a bit special because registers are in reverse little  
>> endian format,
>> must be written in 32-bit chunks, and (all things point to) they  
>> have hardware bugs.
>
> Well.. first what is "reverse little endian" ? :-) Big endian ?

Nah.  Little-endian, with a 32-bit bus swizzle.  This is not the
same thing as big-endian when not all your registers are 32 bits.

Also, you can only write 32 bits, they don't use byte enables.

> As for HW bugs, well, as long as we know them we can define a quirk  
> bit
> and add the necessary workarounds to the driver :-)

The question is if the device is close enough to OHCI to declare it
as that in the device tree.  I would say "yes".


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 21:01               ` Benjamin Herrenschmidt
  2009-11-26 21:38                 ` Albert Herranz
@ 2009-11-26 23:25                 ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-26 23:25 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> There you can find the hardware interface that supports the IPC  
>> mechanism.
>> It is made up of a pair of registers to pass data between the  
>> processors and a
>> pair of control/flags registers.
>> The hardware can interrupt the PowerPC side when there is data  
>> available for it.
>
> Ok. So the right way to do that would be to have a node purely
> representing the HW IPC, unrelated to whatever is running on the
> secondary processor.

Or you can keep it implicit in the Hollywood control registers.
It is one 512-byte block with lots of things thrown together (and
then mixed up real good).

> However, it's ok to have -below- that node, a set of device nodes or a
> node with properties or whatever representing the FW in there and the
> function it exposes.

That's not really useful though, it's easy to probe for.

> What might do however is to have a way for that FW itself to  
> provide you
> with the nodes and properties for the functions it provides :-)

You get a pointer at the very last word of memory.  It point to an
info header that has everything you need to know (most importantly,
a version identifier).

> Of course that wouldn't work with FW we don't have control on. Can  
> Linux
> run on the wii with the original N. FW on the aux. processor ?

It _can_, but there are no advantages to doing that, and lots and  
lots of
disadvantages, so the plan is to not add support for that in mainline.

> Can we
> detect what is running there ? Do we care ?

You can detect this for anything that uses a mini-compatible interface.
You shouldn't care for anything else ;-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko
  2009-11-26 22:54                         ` Segher Boessenkool
@ 2009-11-26 23:27                           ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 23:27 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev, Arnd Bergmann

On Thu, 2009-11-26 at 23:54 +0100, Segher Boessenkool wrote:
> No Ben.  The whole point of EARLY_DEBUG is that it _always works_,  
> because
> it is such trivial code.  Don't break that please, or we'll be forced to
> add a "REALLY_EARLY_DEBUG" instead :-) 

I do tend to agree but heh... temptation to do more cute hacks ... :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26 23:00                           ` Segher Boessenkool
@ 2009-11-26 23:38                             ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-26 23:38 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Fri, 2009-11-27 at 00:00 +0100, Segher Boessenkool wrote:
> >>> +unsigned int flipper_pic_get_irq(void)
> >>> +{
> >>> +       void __iomem *io_base = flipper_irq_host->host_data;
> >>> +       int irq;
> >>> +       u32 irq_status;
> >>> +
> >>> +       irq_status = in_be32(io_base + FLIPPER_ICR) &
> >>> +                    in_be32(io_base + FLIPPER_IMR);
> >>> +       if (irq_status == 0)
> >>> +               return -1;      /* no more IRQs pending */
> >>
> >> NO_IRQ_IGNORE
> >
> > Why no just 0 ? (aka NO_IRQ)
> >
> > Or do you know you are getting lots of spurrious that you don't  
> > want to
> > account ?
> 
> IRQ #0 is a valid IRQ here (graphics error IIRC), it should be
> remapped I suppose?

All interrupts are remapped. _get_irq() should call the appropriate
revmap function to remap the HW number into a linux number. 0 is never a
valid linux number and means "no interrupt".

In the above case, it would seem to me that what he gets is a bitfield
so 0 means no interrupt. Hence the code should be:

	if (irq_status == 0)
		return 0;
	
Then, find first bit and return the linear revmap... Just look at what
the old pmac_pic does, same stuff basically.

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-26 22:05                             ` Albert Herranz
@ 2009-11-27  0:06                               ` Segher Boessenkool
  2009-11-27 12:17                                 ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27  0:06 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>>> Maybe using FLIPPER (or GAMECUBE_FLIPPER) instead of  
>>>> GAMECUBE_COMMON
>>>> is a good name?
>>>
>>> I'd prefer to not use a name that implies a specific hardware to
>>> describe two (mostly) similar but different hardwares.
>>
>> Hollywood is 100% compatible to Flipper though.
>
> No. There's no ARAM for example :)

ARAM is an external device.

>>>>> +/*
>>>>> + * Each interrupt has a corresponding bit in both
>>>>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>>>>> + *
>>>>> + * Enabling/disabling an interrupt line involves asserting/ 
>>>>> clearing
>>>>> + * the corresponding bit in IMR. ACK'ing a request simply  
>>>>> involves
>>>>> + * asserting the corresponding bit in ICR.
>>>>> + */
>>
>> I looked it up in YAGCD; it says that _reading_ the ICR reg already
>> acks all interrupts (and clears the bits), you never write this reg!
>
> YAGCD is not always right. You should not take it as _the truth_.

Oh I know.  But I have no better source of information.  Well I could
actually test it, that's very easy using OF :-)  Let's do that.

>>> No, it acks just a single IRQ.
>>
>> No it doesn't.  Say IRQs 1 and 3 are asserted, so the reg contains  
>> 0x0a.
>> Now you want to ack IRQ1; set_bit() will write 0x0a | 0x02, not  
>> just 0x02.
>
> Let me rephrase it. No it should just ack a single IRQ :)
>
> So then this is working by accident.
> If that's the case, I guess it works because the interrupt is not  
> cleared at the source and the ICR is set again immediately for any  
> pending interrupt?

Probably, yes.  Also, you will not often have more than one interrupt
pending anyway (on the legacy PIC).


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-26 22:07                               ` Albert Herranz
@ 2009-11-27  0:09                                 ` Segher Boessenkool
  2009-11-27 21:35                                   ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27  0:09 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> We need it as it currently doesn't match with the default bus ids.
>>
>>> Should I introduce a .type property matching any of those above  
>>> in the
>>> soc node, and get rid of the explicit bus probe?
>>
>> You don't need any fake bus as far as I can see, just probe the  
>> devices
>> you want.
>
> But it's way easier to let the bus probe do it for us. I don't see  
> the win here.

As long as this doesn't leak into the device tree in any way, I don't
care.  How's that? :-)


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-27  0:16                     ` Segher Boessenkool
@ 2009-11-27  0:15                       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-27  0:15 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Fri, 2009-11-27 at 01:16 +0100, Segher Boessenkool wrote:
> 
> In all code I have done for the XFB, I map it like any other RAM and
> dcbst it after writing to it.  Maybe that is slower though, WIMG=0100
> might be better.  Dunno. 

Well, it depends also what you want to do with it. If you want to expose
it as a standard linux fbdev, it might break apps to expect them to use
dcbst... but it will make rmw cycles a lot faster and avoid wasting
memory with shadowfb.

It's going to mostly depend on what kind of HW accel we can get out of
it, if we get good enough accel we can probably got for I=1 like a
standard fb

Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 04/19] powerpc: wii: device tree
  2009-11-26 22:37                   ` Benjamin Herrenschmidt
@ 2009-11-27  0:16                     ` Segher Boessenkool
  2009-11-27  0:15                       ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27  0:16 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> Yup. The idea is to map the first 16MB of MEM1 with a BAT.
>> Mapping the whole 24MB with BATs may not be possible because we  
>> want the framebuffer
>> in MEM1 for performance reasons.
>
> How big is the fb ?

A bit more than a megabyte, something like that.

> We have plenty of BATs on these things... so one 16M
> for the low mem and one 64M for the "high" mem, that leaves something
> like 6 to manage as much as possible up to the fb :-)

The CXe in the gamecube has only four BATs though.

In all code I have done for the XFB, I map it like any other RAM and
dcbst it after writing to it.  Maybe that is slower though, WIMG=0100
might be better.  Dunno.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26 22:38             ` Benjamin Herrenschmidt
@ 2009-11-27  0:18               ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27  0:18 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>>>> If you have only one interrupt controller, like here, you don't
>>>> need to refer to it _at all_ :-)
>>>
>>> I think Linux requires that you do though. It might be a mistake on
>>> our
>>> part but heh ...
>>
>> Linux doesn't require it; (old) Macs are like this, for example,
>> and that works fine.  Oh and all Maple firmwares are like that as
>> well I think.  Etc.
>
> It works fine on old macs thanks to a quirk we enable in the mac code
> iirc and old maple works thanks to mere luck with the fallback code we
> have which reads things of PCI config space :-)
>
> Don't rely on that.

It is standard OF.  Let's fix the Linux code if that is needed (and I  
don't
think it is, anyway).

OTOH, it's nice to use the interrupt mapping stuff in all new device  
trees.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-25 18:43       ` Albert Herranz
@ 2009-11-27 12:07         ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27 12:07 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

>>> +	soc {
>>> +		#address-cells = <1>;
>>> +		#size-cells = <1>;
>>> +		#interrupt-cells = <1>;
>>
>> This isn't an interrupt controller, don't put #interrupt-cells
>> here.
>
> Isn't this needed to define what is to be expected in the  
> "interrupts" properties of the child nodes?

Nope.  Only interrupt controllers have a #interrupt-cells.  When
interpreting the "interrupts" property of some node, you walk the
interrupt tree (which can be the same as the device tree, or fully
separate, or share some things; and doesn't have to be a tree either)
up to the next interrupt controller, and use the #interrupt-cells
from that.  (This is simplified a little bit).

>>> +		auxram@0c005000 {
>>> +			compatible = "nintendo,flipper-auxram";
>>> +			reg = <0x0c005000 0x200>;	/* DSP */
>>> +			interrupts = <6>;
>>> +			interrupt-parent = <&pic>;
>>> +		};
>>> +
>>> +		audio@0c005000 {
>>> +			compatible = "nintendo,flipper-audio";
>>> +			reg = <0x0c005000 0x200		/* DSP */
>>> +			       0x0c006c00 0x20>;	/* AI */
>>> +			interrupts = <6>;
>>> +			interrupt-parent = <&pic>;
>>> +		};
>>
>> These two have the same address, not good.  Just remove the
>> auxram node?
>
> The DSP and the ARAM control/status bits share some registers in  
> the same block.
>
> How should I match the aram block driver if I remove the auxram node?

You can make aram a child node of dsp, which allows you to show
its size as well.  I.e. you do #a-cells=1 #s-cells=1 in the dsp
node, and reg=<0 01000000> in the aram node.

Or you can do a simple property in the dsp node saying how big
the aram is, and assume the driver(s) that match know(s) how to
drive it.  You have to assume this anyway, you're not putting
e.g. bytecode drivers in the device tree ;-)

>> ...and all the applicable things I mentioned in my Wii dev tree
>> reply, of course.
>>
>> Wow, it wasn't as bad as I expected actually.  But you cheated,
>> you omitted most devices from the device trees :-)
>
> You're welcome to add them too if you have information about them :)

I'll do that later, yes.  It's not so big a problem if the device
tree doesn't describe devices you do not support at all.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 02/19] powerpc: gamecube: device tree
  2009-11-26  4:23           ` Benjamin Herrenschmidt
@ 2009-11-27 12:09             ` Segher Boessenkool
  0 siblings, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27 12:09 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> Similarly, it is better to use a compatible value of something like:
>> compatible = "nintendo,flipper-immr"; (instead of "nintendo,flipper")
>> because your describing just the internal bus, not the entire chip.
>
> I would just call the nodes "flipper" and "hollywood".

Either that, or not have these omnibus nodes at all, they are useless
and do not describe the hardware very well either.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON
  2009-11-26  5:08                 ` Benjamin Herrenschmidt
  2009-11-26 15:22                   ` Albert Herranz
@ 2009-11-27 12:12                   ` Segher Boessenkool
  1 sibling, 0 replies; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27 12:12 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>>>> Add a config option GAMECUBE_COMMON to be used as a dependency  
>>>> for all
>>>> options common to the Nintendo GameCube and Wii video game  
>>>> consoles.
>>>
>>> Maybe something like GAMECUBE_OR_WII instead?  "COMMON" is so
>>> common it's meaningless.
>>
>> I don't like either GAMECUBE_OR_WII.
>> It looks as if it can be used to match options for the GAMECUBE  
>> _or_ WII. But that's not the meaning of it.
>>
>> This option should be used only for options applicable to both the  
>> GAMECUBE and WII, i.e. basically those options in the WII which  
>> where "inherited" from the GAMECUBE to make it retro-compatible.
>>
>> If GAMECUBE_COMMON is unacceptable, maybe GAMECUBE_LEGACY or  
>> GAMECUBE_COMPAT?
>
> I don't have any strong opinion. Maybe NINTENDO_COMMON ?

That is much worse than GAMECUBE_COMMON.

Can you call the "common" option GAMECUBE, and have WII be for support
for whatever is new on the Wii?  Or is there some significant code that
is only needed on the old gamecube?


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-27  0:06                               ` Segher Boessenkool
@ 2009-11-27 12:17                                 ` Segher Boessenkool
  2009-11-27 17:27                                   ` Albert Herranz
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-27 12:17 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

>>>>>> +/*
>>>>>> + * Each interrupt has a corresponding bit in both
>>>>>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>>>>>> + *
>>>>>> + * Enabling/disabling an interrupt line involves asserting/ 
>>>>>> clearing
>>>>>> + * the corresponding bit in IMR. ACK'ing a request simply  
>>>>>> involves
>>>>>> + * asserting the corresponding bit in ICR.
>>>>>> + */
>>>
>>> I looked it up in YAGCD; it says that _reading_ the ICR reg already
>>> acks all interrupts (and clears the bits), you never write this reg!
>>
>> YAGCD is not always right. You should not take it as _the truth_.
>
> Oh I know.  But I have no better source of information.  Well I could
> actually test it, that's very easy using OF :-)  Let's do that.

I tested it.  It turns out that neither reading or writing this register
does anything; the bits are automatically cleared when the source  
deasserts.

I didn't test all interrupts, some are harder to generate "on demand"  
than
others.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-27 12:17                                 ` Segher Boessenkool
@ 2009-11-27 17:27                                   ` Albert Herranz
  2009-11-27 21:34                                     ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Albert Herranz @ 2009-11-27 17:27 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: linuxppc-dev

Segher Boessenkool wrote:
>>>>>>> +/*
>>>>>>> + * Each interrupt has a corresponding bit in both
>>>>>>> + * the Interrupt Cause (ICR) and Interrupt Mask (IMR) registers.
>>>>>>> + *
>>>>>>> + * Enabling/disabling an interrupt line involves asserting/clearing
>>>>>>> + * the corresponding bit in IMR. ACK'ing a request simply involves
>>>>>>> + * asserting the corresponding bit in ICR.
>>>>>>> + */
>>>>
>>>> I looked it up in YAGCD; it says that _reading_ the ICR reg already
>>>> acks all interrupts (and clears the bits), you never write this reg!
>>>
>>> YAGCD is not always right. You should not take it as _the truth_.
>>
>> Oh I know.  But I have no better source of information.  Well I could
>> actually test it, that's very easy using OF :-)  Let's do that.
> 
> I tested it.  It turns out that neither reading or writing this register
> does anything; the bits are automatically cleared when the source
> deasserts.
> 

I checked it too on the Nintendo GameCube making the ack a no-op.

It turns out that we _need_ to ack the RSW (Reset Switch) interrupt.
The other interrupt sources checked (EXI, VI, DI, AI, DSP/ARAM) need no explicit ack.

> I didn't test all interrupts, some are harder to generate "on demand" than
> others.
> 

Thanks,
Albert

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-27 17:27                                   ` Albert Herranz
@ 2009-11-27 21:34                                     ` Benjamin Herrenschmidt
  2009-11-28  2:04                                       ` Segher Boessenkool
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-27 21:34 UTC (permalink / raw)
  To: Albert Herranz; +Cc: linuxppc-dev

On Fri, 2009-11-27 at 18:27 +0100, Albert Herranz wrote:
> 
> I checked it too on the Nintendo GameCube making the ack a no-op.
> 
> It turns out that we _need_ to ack the RSW (Reset Switch) interrupt.
> The other interrupt sources checked (EXI, VI, DI, AI, DSP/ARAM) need
> no explicit ack.

That would probably mean that the reset switch interrupt is an edge
interrupt. Which means that you also use the wrong flow handler btw :-)
No biggie here tho, if it's acked before the handler is called, which
should be the case, and if masking it doesn't prevent the edge detector
from latching, then it should be allright.

But you may want to make sure you don't have another edge irq somewhere
in there...

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-27  0:09                                 ` Segher Boessenkool
@ 2009-11-27 21:35                                   ` Benjamin Herrenschmidt
  2009-11-28  3:56                                     ` Grant Likely
  0 siblings, 1 reply; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-27 21:35 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Fri, 2009-11-27 at 01:09 +0100, Segher Boessenkool wrote:
> >>> We need it as it currently doesn't match with the default bus ids.
> >>
> >>> Should I introduce a .type property matching any of those above  
> >>> in the
> >>> soc node, and get rid of the explicit bus probe?
> >>
> >> You don't need any fake bus as far as I can see, just probe the  
> >> devices
> >> you want.
> >
> > But it's way easier to let the bus probe do it for us. I don't see  
> > the win here.
> 
> As long as this doesn't leak into the device tree in any way, I don't
> care.  How's that? :-)

I still like having the node that encloses all the devices. Not sure
why, but I like it :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-27 21:34                                     ` Benjamin Herrenschmidt
@ 2009-11-28  2:04                                       ` Segher Boessenkool
  2009-11-28  2:26                                         ` Benjamin Herrenschmidt
  0 siblings, 1 reply; 181+ messages in thread
From: Segher Boessenkool @ 2009-11-28  2:04 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

>> It turns out that we _need_ to ack the RSW (Reset Switch) interrupt.
>> The other interrupt sources checked (EXI, VI, DI, AI, DSP/ARAM) need
>> no explicit ack.
>
> That would probably mean that the reset switch interrupt is an edge
> interrupt.

Nah, it means that the RSW is a flip-flop.


Segher

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support
  2009-11-28  2:04                                       ` Segher Boessenkool
@ 2009-11-28  2:26                                         ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 181+ messages in thread
From: Benjamin Herrenschmidt @ 2009-11-28  2:26 UTC (permalink / raw)
  To: Segher Boessenkool; +Cc: Albert Herranz, linuxppc-dev

On Sat, 2009-11-28 at 03:04 +0100, Segher Boessenkool wrote:
> >> It turns out that we _need_ to ack the RSW (Reset Switch)
> interrupt.
> >> The other interrupt sources checked (EXI, VI, DI, AI, DSP/ARAM)
> need
> >> no explicit ack.
> >
> > That would probably mean that the reset switch interrupt is an edge
> > interrupt.
> 
> Nah, it means that the RSW is a flip-flop.

Controlled by the PIC's ISR ? That would be weird. But heh, it's custom
(aka crap) HW so ... :-)

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-27 21:35                                   ` Benjamin Herrenschmidt
@ 2009-11-28  3:56                                     ` Grant Likely
  2009-11-28  3:56                                       ` Grant Likely
  0 siblings, 1 reply; 181+ messages in thread
From: Grant Likely @ 2009-11-28  3:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

On Fri, Nov 27, 2009 at 2:35 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Fri, 2009-11-27 at 01:09 +0100, Segher Boessenkool wrote:
>> >>> We need it as it currently doesn't match with the default bus ids.
>> >>
>> >>> Should I introduce a .type property matching any of those above
>> >>> in the
>> >>> soc node, and get rid of the explicit bus probe?
>> >>
>> >> You don't need any fake bus as far as I can see, just probe the
>> >> devices
>> >> you want.
>> >
>> > But it's way easier to let the bus probe do it for us. I don't see
>> > the win here.
>>
>> As long as this doesn't leak into the device tree in any way, I don't
>> care. =A0How's that? :-)
>
> I still like having the node that encloses all the devices. Not sure
> why, but I like it :-)

I do to.  It documents that all these things are enclosed in a single
package and provides grouping device nodes with nodes describing
shared registers and the like.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

* Re: [RFC PATCH 12/19] powerpc: gamecube: platform support
  2009-11-28  3:56                                     ` Grant Likely
@ 2009-11-28  3:56                                       ` Grant Likely
  0 siblings, 0 replies; 181+ messages in thread
From: Grant Likely @ 2009-11-28  3:56 UTC (permalink / raw)
  To: Benjamin Herrenschmidt; +Cc: Albert Herranz, linuxppc-dev

On Fri, Nov 27, 2009 at 8:56 PM, Grant Likely <grant.likely@secretlab.ca> w=
rote:
> On Fri, Nov 27, 2009 at 2:35 PM, Benjamin Herrenschmidt
> <benh@kernel.crashing.org> wrote:
>> On Fri, 2009-11-27 at 01:09 +0100, Segher Boessenkool wrote:
>>> >>> We need it as it currently doesn't match with the default bus ids.
>>> >>
>>> >>> Should I introduce a .type property matching any of those above
>>> >>> in the
>>> >>> soc node, and get rid of the explicit bus probe?
>>> >>
>>> >> You don't need any fake bus as far as I can see, just probe the
>>> >> devices
>>> >> you want.
>>> >
>>> > But it's way easier to let the bus probe do it for us. I don't see
>>> > the win here.
>>>
>>> As long as this doesn't leak into the device tree in any way, I don't
>>> care. =A0How's that? :-)
>>
>> I still like having the node that encloses all the devices. Not sure
>> why, but I like it :-)
>
> I do to. =A0It documents that all these things are enclosed in a single
> package and provides grouping device nodes with nodes describing
> shared registers and the like.

And for the same reason I keep all my socks in the same drawer.  :-)

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply	[flat|nested] 181+ messages in thread

end of thread, other threads:[~2009-11-28  3:57 UTC | newest]

Thread overview: 181+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-22 22:01 [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Albert Herranz
2009-11-22 22:01 ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Albert Herranz
2009-11-22 22:01   ` [RFC PATCH 02/19] powerpc: gamecube: device tree Albert Herranz
2009-11-22 22:01     ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Albert Herranz
2009-11-22 22:01       ` [RFC PATCH 04/19] powerpc: wii: device tree Albert Herranz
2009-11-22 22:01         ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Albert Herranz
2009-11-22 22:01           ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Albert Herranz
2009-11-22 22:01             ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Albert Herranz
2009-11-22 22:01               ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Albert Herranz
2009-11-22 22:01                 ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Albert Herranz
2009-11-22 22:01                   ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Albert Herranz
2009-11-22 22:01                     ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Albert Herranz
2009-11-22 22:01                       ` [RFC PATCH 12/19] powerpc: gamecube: platform support Albert Herranz
2009-11-22 22:01                         ` [RFC PATCH 13/19] powerpc: gamecube: default config Albert Herranz
2009-11-22 22:01                           ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Albert Herranz
2009-11-22 22:01                             ` [RFC PATCH 15/19] powerpc: broadway processor support Albert Herranz
2009-11-22 22:01                               ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Albert Herranz
2009-11-22 22:01                                 ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Albert Herranz
2009-11-22 22:01                                   ` [RFC PATCH 18/19] powerpc: wii: platform support Albert Herranz
2009-11-22 22:01                                     ` [RFC PATCH 19/19] powerpc: wii: default config Albert Herranz
2009-11-22 23:45                                     ` [RFC PATCH 18/19] powerpc: wii: platform support Grant Likely
2009-11-23 20:21                                       ` Albert Herranz
2009-11-24 22:24                                     ` Segher Boessenkool
2009-11-25 17:58                                       ` Albert Herranz
2009-11-26 22:05                                         ` Segher Boessenkool
2009-11-22 22:48                                   ` [RFC PATCH 17/19] powerpc: wii: bootmii starlet 'mini' firmware support Arnd Bergmann
2009-11-23 19:21                                     ` Albert Herranz
2009-11-24 22:13                                   ` Segher Boessenkool
2009-11-25 17:47                                     ` Albert Herranz
2009-11-26 22:00                                       ` Segher Boessenkool
2009-11-22 23:40                                 ` [RFC PATCH 16/19] powerpc: wii: hollywood interrupt controller support Grant Likely
2009-11-23 20:18                                   ` Albert Herranz
2009-11-24 21:54                                 ` Segher Boessenkool
2009-11-25 17:27                                   ` Albert Herranz
2009-11-26  5:23                                 ` Benjamin Herrenschmidt
2009-11-26 15:42                                   ` Albert Herranz
2009-11-26 21:13                                     ` Benjamin Herrenschmidt
2009-11-26 23:03                                   ` Segher Boessenkool
2009-11-22 23:38                               ` [RFC PATCH 15/19] powerpc: broadway processor support Grant Likely
2009-11-23 20:16                                 ` Albert Herranz
2009-11-22 23:36                             ` [RFC PATCH 14/19] powerpc: allow ioremap within reserved fake ram regions Grant Likely
2009-11-23 20:16                               ` Albert Herranz
2009-11-23 20:41                                 ` Grant Likely
2009-11-23 23:45                                 ` Michael Ellerman
2009-11-24 17:09                                   ` Albert Herranz
2009-11-25  0:38                                     ` Michael Ellerman
2009-11-26  5:22                                     ` Benjamin Herrenschmidt
2009-11-26 15:35                                       ` Albert Herranz
2009-11-26 21:13                                         ` Benjamin Herrenschmidt
2009-11-22 23:34                         ` [RFC PATCH 12/19] powerpc: gamecube: platform support Grant Likely
2009-11-23 20:02                           ` Albert Herranz
2009-11-24 21:39                         ` Segher Boessenkool
2009-11-25 17:24                           ` Albert Herranz
2009-11-26 21:53                             ` Segher Boessenkool
2009-11-26 22:07                               ` Albert Herranz
2009-11-27  0:09                                 ` Segher Boessenkool
2009-11-27 21:35                                   ` Benjamin Herrenschmidt
2009-11-28  3:56                                     ` Grant Likely
2009-11-28  3:56                                       ` Grant Likely
2009-11-22 23:28                       ` [RFC PATCH 11/19] powerpc: gamecube/wii: flipper interrupt controller support Grant Likely
2009-11-23 19:59                         ` Albert Herranz
2009-11-26  5:18                         ` Benjamin Herrenschmidt
2009-11-26 15:33                           ` Albert Herranz
2009-11-26 21:12                             ` Benjamin Herrenschmidt
2009-11-26 23:00                           ` Segher Boessenkool
2009-11-26 23:38                             ` Benjamin Herrenschmidt
2009-11-24 21:30                       ` Segher Boessenkool
2009-11-25 17:13                         ` Albert Herranz
2009-11-26 21:52                           ` Segher Boessenkool
2009-11-26 22:05                             ` Albert Herranz
2009-11-27  0:06                               ` Segher Boessenkool
2009-11-27 12:17                                 ` Segher Boessenkool
2009-11-27 17:27                                   ` Albert Herranz
2009-11-27 21:34                                     ` Benjamin Herrenschmidt
2009-11-28  2:04                                       ` Segher Boessenkool
2009-11-28  2:26                                         ` Benjamin Herrenschmidt
2009-11-26  5:18                       ` Benjamin Herrenschmidt
2009-11-26 15:30                         ` Albert Herranz
2009-11-26 21:10                           ` Benjamin Herrenschmidt
2009-11-22 22:27                     ` [RFC PATCH 10/19] powerpc: gamecube/wii: early debugging using usbgecko Arnd Bergmann
2009-11-23 19:10                       ` Albert Herranz
2009-11-23 22:13                         ` Arnd Bergmann
2009-11-26  5:14                       ` Benjamin Herrenschmidt
2009-11-26 22:54                         ` Segher Boessenkool
2009-11-26 23:27                           ` Benjamin Herrenschmidt
2009-11-24  0:54                     ` Segher Boessenkool
2009-11-24 18:19                       ` Albert Herranz
2009-11-22 23:22                   ` [RFC PATCH 09/19] powerpc: gamecube/wii: udbg support for usbgecko Grant Likely
2009-11-24  0:49                   ` Segher Boessenkool
2009-11-24 18:08                     ` Albert Herranz
2009-11-24 21:19                       ` Segher Boessenkool
2009-11-25 17:07                         ` Albert Herranz
2009-11-26  5:12                   ` Benjamin Herrenschmidt
2009-11-26 15:28                     ` Albert Herranz
2009-11-26 21:02                       ` Benjamin Herrenschmidt
2009-11-26 23:12                       ` Segher Boessenkool
2009-11-22 23:21                 ` [RFC PATCH 08/19] powerpc: gamecube/wii: do not include PCI support Grant Likely
2009-11-26  5:10                   ` Benjamin Herrenschmidt
2009-11-22 22:20               ` [RFC PATCH 07/19] powerpc: gamecube/wii: declare as non-coherent platforms Arnd Bergmann
2009-11-23 19:06                 ` Albert Herranz
2009-11-26  5:09               ` Benjamin Herrenschmidt
2009-11-22 23:20             ` [RFC PATCH 06/19] powerpc: gamecube/wii: introduce GAMECUBE_COMMON Grant Likely
2009-11-23 19:56               ` Albert Herranz
2009-11-24  0:35             ` Segher Boessenkool
2009-11-24 18:03               ` Albert Herranz
2009-11-24 21:15                 ` Segher Boessenkool
2009-11-24 22:33                   ` Arnd Bergmann
2009-11-25 17:06                   ` Albert Herranz
2009-11-26  5:08                 ` Benjamin Herrenschmidt
2009-11-26 15:22                   ` Albert Herranz
2009-11-27 12:12                   ` Segher Boessenkool
2009-11-22 23:19           ` [RFC PATCH 05/19] powerpc: wii: bootwrapper bits Grant Likely
2009-11-24  0:33           ` Segher Boessenkool
2009-11-24 17:56             ` Albert Herranz
2009-11-24 21:13               ` Segher Boessenkool
2009-11-22 23:18         ` [RFC PATCH 04/19] powerpc: wii: device tree Grant Likely
2009-11-23 19:54           ` Albert Herranz
2009-11-23 20:36             ` Grant Likely
2009-11-23 21:55               ` Albert Herranz
2009-11-25 16:57             ` Segher Boessenkool
2009-11-25 18:09               ` Albert Herranz
2009-11-25 17:49         ` Segher Boessenkool
2009-11-25 18:34           ` Albert Herranz
2009-11-26  4:58             ` Benjamin Herrenschmidt
2009-11-26 15:19               ` Albert Herranz
2009-11-26  4:51           ` Benjamin Herrenschmidt
2009-11-26 15:18             ` Albert Herranz
2009-11-26 21:01               ` Benjamin Herrenschmidt
2009-11-26 21:38                 ` Albert Herranz
2009-11-26 22:37                   ` Benjamin Herrenschmidt
2009-11-27  0:16                     ` Segher Boessenkool
2009-11-27  0:15                       ` Benjamin Herrenschmidt
2009-11-26 23:25                 ` Segher Boessenkool
2009-11-26 22:50             ` Segher Boessenkool
2009-11-26 23:02               ` Albert Herranz
2009-11-26  4:45         ` Benjamin Herrenschmidt
2009-11-26 15:09           ` Albert Herranz
2009-11-26 20:48             ` Benjamin Herrenschmidt
2009-11-26 21:20               ` Albert Herranz
2009-11-26 23:17               ` Segher Boessenkool
2009-11-26 22:45           ` Segher Boessenkool
2009-11-22 23:11       ` [RFC PATCH 03/19] powerpc: gamecube: bootwrapper bits Grant Likely
2009-11-24  0:08       ` Segher Boessenkool
2009-11-24 17:38         ` Albert Herranz
2009-11-24 21:00           ` Segher Boessenkool
2009-11-24 23:45             ` Albert Herranz
2009-11-25 16:53               ` Segher Boessenkool
2009-11-26  4:36             ` Benjamin Herrenschmidt
2009-11-26  8:17               ` Gabriel Paubert
2009-11-26  8:46                 ` Benjamin Herrenschmidt
2009-11-26 23:06                 ` Segher Boessenkool
2009-11-26  4:35           ` Benjamin Herrenschmidt
2009-11-26 22:23             ` Segher Boessenkool
2009-11-22 23:02     ` [RFC PATCH 02/19] powerpc: gamecube: device tree Grant Likely
2009-11-23 19:44       ` Albert Herranz
2009-11-23 20:19         ` Grant Likely
2009-11-23 20:25           ` Albert Herranz
2009-11-24 22:53           ` Segher Boessenkool
2009-11-26  4:23           ` Benjamin Herrenschmidt
2009-11-27 12:09             ` Segher Boessenkool
2009-11-24 22:36       ` Segher Boessenkool
2009-11-26  4:23         ` Benjamin Herrenschmidt
2009-11-26 22:15           ` Segher Boessenkool
2009-11-26 22:38             ` Benjamin Herrenschmidt
2009-11-27  0:18               ` Segher Boessenkool
2009-11-26  4:21       ` Benjamin Herrenschmidt
2009-11-26  4:38         ` Grant Likely
2009-11-26  5:29           ` Benjamin Herrenschmidt
2009-11-26  5:51             ` Grant Likely
2009-11-26 22:30         ` Segher Boessenkool
2009-11-25 18:00     ` Segher Boessenkool
2009-11-25 18:43       ` Albert Herranz
2009-11-27 12:07         ` Segher Boessenkool
2009-11-26  4:27       ` Benjamin Herrenschmidt
2009-11-26 22:19         ` Segher Boessenkool
2009-11-22 22:50   ` [RFC PATCH 01/19] powerpc: gamecube/wii: usbgecko bootwrapper console support Grant Likely
2009-11-26  4:12   ` Benjamin Herrenschmidt
2009-11-22 22:48 ` [RFC PATCH 00/19] powerpc: nintendo gamecube and wii support Grant Likely
2009-11-22 22:49 ` Arnd Bergmann
2009-11-23 19:22   ` Albert Herranz
2009-11-23  5:13 ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.