Patchwork powerpc: add support for multiple 85xx RapidIO development boards

login
register
mail settings
Submitter Alex Dubov
Date Jan. 7, 2011, 8:27 a.m.
Message ID <126175.85639.qm@web37601.mail.mud.yahoo.com>
Download mbox | patch
Permalink /patch/77858/
State Deferred
Delegated to: Kumar Gala
Headers show

Comments

Alex Dubov - Jan. 7, 2011, 8:27 a.m.
Many RapidIO development boards do not require any board/vendor specific
tweaking at kernel start, and can rely on the flattened device tree for
all their hardware configuration needs.

This patch adds support for "generic,mpc85xx-riodev" compatible boards
with PCI disabled by default and RapidIO enabled. It will also try to
read a "vendor" property from the root of device tree to provide a possibly
useful bit of information in the /proc/cpuinfo.

Signed-off-by: Alex Dubov <oakad@yahoo.com>
---
 arch/powerpc/configs/85xx/mpc85xx_riodev_defconfig |   82 ++++++++++++++
 arch/powerpc/platforms/85xx/Kconfig                |    9 ++
 arch/powerpc/platforms/85xx/Makefile               |    1 +
 arch/powerpc/platforms/85xx/mpc85xx_riodev.c       |  116 ++++++++++++++++++++
 4 files changed, 208 insertions(+), 0 deletions(-)
 create mode 100644 arch/powerpc/configs/85xx/mpc85xx_riodev_defconfig
 create mode 100644 arch/powerpc/platforms/85xx/mpc85xx_riodev.c

Patch

diff --git a/arch/powerpc/configs/85xx/mpc85xx_riodev_defconfig b/arch/powerpc/configs/85xx/mpc85xx_riodev_defconfig
new file mode 100644
index 0000000..5d0596e
--- /dev/null
+++ b/arch/powerpc/configs/85xx/mpc85xx_riodev_defconfig
@@ -0,0 +1,82 @@ 
+CONFIG_PPC_85xx=y
+CONFIG_EXPERIMENTAL=y
+CONFIG_SYSVIPC=y
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_BLK_DEV_INITRD=y
+# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
+CONFIG_EMBEDDED=y
+CONFIG_MODULES=y
+CONFIG_MODULE_UNLOAD=y
+# CONFIG_BLK_DEV_BSG is not set
+CONFIG_MPC85xx_RIODEV=y
+CONFIG_HIGHMEM=y
+CONFIG_NO_HZ=y
+CONFIG_HIGH_RES_TIMERS=y
+CONFIG_BINFMT_MISC=y
+CONFIG_MATH_EMULATION=y
+CONFIG_SPARSE_IRQ=y
+# CONFIG_SECCOMP is not set
+CONFIG_PCI=n
+CONFIG_PCIEPORTBUS=n
+# CONFIG_PCIEASPM is not set
+CONFIG_NET=y
+CONFIG_PACKET=y
+CONFIG_UNIX=y
+CONFIG_XFRM_USER=y
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+CONFIG_IP_PNP=y
+CONFIG_IP_PNP_DHCP=y
+CONFIG_IP_PNP_BOOTP=y
+CONFIG_SYN_COOKIES=y
+# CONFIG_INET_LRO is not set
+# CONFIG_IPV6 is not set
+CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
+# CONFIG_FW_LOADER is not set
+CONFIG_MTD=y
+CONFIG_MTD_PARTITIONS=y
+CONFIG_MTD_OF_PARTS=y
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+CONFIG_MTD_CFI=y
+CONFIG_MTD_CFI_AMDSTD=y
+CONFIG_MTD_PHYSMAP_OF=y
+CONFIG_MTD_NAND_ECC_SMC=y
+CONFIG_MTD_NAND=y
+CONFIG_MTD_NAND_FSL_UPM=y
+CONFIG_PROC_DEVICETREE=y
+CONFIG_BLK_DEV_LOOP=y
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_SIZE=32768
+CONFIG_NETDEVICES=y
+CONFIG_NET_ETHERNET=y
+CONFIG_MII=y
+CONFIG_GIANFAR=y
+# CONFIG_INPUT_MOUSEDEV is not set
+# CONFIG_INPUT_KEYBOARD is not set
+# CONFIG_INPUT_MOUSE is not set
+# CONFIG_SERIO is not set
+# CONFIG_VT is not set
+CONFIG_SERIAL_8250=y
+CONFIG_SERIAL_8250_CONSOLE=y
+# CONFIG_HW_RANDOM is not set
+CONFIG_I2C=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_MPC=y
+CONFIG_VIDEO_OUTPUT_CONTROL=y
+# CONFIG_USB_SUPPORT is not set
+CONFIG_INOTIFY=y
+CONFIG_PROC_KCORE=y
+CONFIG_TMPFS=y
+CONFIG_JFFS2_FS=y
+CONFIG_NFS_FS=y
+CONFIG_ROOT_NFS=y
+CONFIG_PARTITION_ADVANCED=y
+# CONFIG_MSDOS_PARTITION is not set
+CONFIG_DEBUG_KERNEL=y
+CONFIG_DETECT_HUNG_TASK=y
+CONFIG_DEBUG_MUTEXES=y
+# CONFIG_DEBUG_BUGVERBOSE is not set
+# CONFIG_RCU_CPU_STALL_DETECTOR is not set
+CONFIG_SYSCTL_SYSCALL_CHECK=y
+# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index b6976e1..be48db0 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -97,6 +97,15 @@  config XES_MPC85xx
 	  Manufacturer: Extreme Engineering Solutions, Inc.
 	  URL: <http://www.xes-inc.com/>
 
+config MPC85xx_RIODEV
+	bool "Generic MPC85xx board with serial RapidIO"
+	select DEFAULT_UIMAGE
+	select HAS_RAPIDIO
+	help
+	  This option enables support for one of many RapidIO development
+	  boards, which do not need any vendor specific kernel tweaks and
+	  fully rely on flattened device tree for the hardware configuration.
+
 config STX_GP3
 	bool "Silicon Turnkey Express GP3"
 	help
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index dd70db7..228f0f9 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -14,6 +14,7 @@  obj-$(CONFIG_P1022_DS)    += p1022_ds.o
 obj-$(CONFIG_P3041_DS)    += p3041_ds.o corenet_ds.o
 obj-$(CONFIG_P4080_DS)    += p4080_ds.o corenet_ds.o
 obj-$(CONFIG_P5020_DS)    += p5020_ds.o corenet_ds.o
+obj-$(CONFIG_MPC85xx_RIODEV) += mpc85xx_riodev.o
 obj-$(CONFIG_STX_GP3)	  += stx_gp3.o
 obj-$(CONFIG_TQM85xx)	  += tqm85xx.o
 obj-$(CONFIG_SBC8560)     += sbc8560.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_riodev.c b/arch/powerpc/platforms/85xx/mpc85xx_riodev.c
new file mode 100644
index 0000000..415f22b
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/mpc85xx_riodev.c
@@ -0,0 +1,116 @@ 
+/*
+ * Based on tqm85xx.c and other similar files.
+ *
+ * Copyright (c) 2011 Alex Dubov <oakad@yahoo.com>
+ *
+ * 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/seq_file.h>
+#include <linux/of_platform.h>
+
+#include <asm/machdep.h>
+#include <asm/mpic.h>
+#include <asm/udbg.h>
+
+#include <sysdev/fsl_soc.h>
+
+static void __init mpc85xx_riodev_pic_init(void)
+{
+	struct mpic *mpic;
+	struct resource r;
+	struct device_node *np;
+
+	np = of_find_node_by_type(NULL, "open-pic");
+	if (!np) {
+		printk(KERN_ERR "Could not find open-pic node\n");
+		return;
+	}
+
+	if (of_address_to_resource(np, 0, &r)) {
+		printk(KERN_ERR "Could not map mpic register space\n");
+		of_node_put(np);
+		return;
+	}
+
+	mpic = mpic_alloc(np, r.start,
+			MPIC_PRIMARY | MPIC_WANTS_RESET | MPIC_BIG_ENDIAN,
+			0, 256, " OpenPIC  ");
+	BUG_ON(mpic == NULL);
+	of_node_put(np);
+
+	mpic_init(mpic);
+}
+
+/*
+ * Setup the architecture
+ */
+static void __init mpc85xx_riodev_setup_arch(void)
+{
+}
+
+static void mpc85xx_riodev_show_cpuinfo(struct seq_file *m)
+{
+	struct device_node *root = NULL;
+	const char *vendor_str = NULL;
+	uint pvid, svid, phid1;
+
+	pvid = mfspr(SPRN_PVR);
+	svid = mfspr(SPRN_SVR);
+
+	root = of_find_node_by_path("/");
+	if (root) {
+		vendor_str = of_get_property(root, "vendor", NULL);
+		of_node_put(root);
+	}
+
+	if (!vendor_str)
+		vendor_str = "generic";
+
+	seq_printf(m, "vendor\t\t: %s\n", vendor_str);
+	seq_printf(m, "PVR\t\t: 0x%x\n", pvid);
+	seq_printf(m, "SVR\t\t: 0x%x\n", svid);
+
+	/* Display cpu Pll setting */
+	phid1 = mfspr(SPRN_HID1);
+	seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
+}
+
+static struct of_device_id __initdata of_bus_ids[] = {
+	{ .compatible = "simple-bus", },
+	{ .compatible = "gianfar", },
+	{},
+};
+
+static int __init declare_of_platform_devices(void)
+{
+	of_platform_bus_probe(NULL, of_bus_ids, NULL);
+
+	return 0;
+}
+machine_device_initcall(mpc85xx_riodev, declare_of_platform_devices);
+
+/*
+ * Called very early, device-tree isn't unflattened
+ */
+static int __init mpc85xx_riodev_probe(void)
+{
+	unsigned long root = of_get_flat_dt_root();
+
+	return of_flat_dt_is_compatible(root, "generic,mpc85xx-riodev");
+}
+
+define_machine(mpc85xx_riodev) {
+	.name			= "MPC85xx w/ SRIO",
+	.probe			= mpc85xx_riodev_probe,
+	.setup_arch		= mpc85xx_riodev_setup_arch,
+	.init_IRQ		= mpc85xx_riodev_pic_init,
+	.show_cpuinfo		= mpc85xx_riodev_show_cpuinfo,
+	.get_irq		= mpic_get_irq,
+	.restart		= fsl_rstcr_restart,
+	.calibrate_decr		= generic_calibrate_decr,
+	.progress		= udbg_progress,
+};