public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: Andrei Dolnikov <adolnikov@ru•mvista.com>
To: linuxppc-dev@ozlabs•org
Subject: [PATCH 4/5] PowerPC 74xx: Katana Qp base support
Date: Thu, 29 Nov 2007 18:42:00 +0300	[thread overview]
Message-ID: <20071129154200.GE13751@ru.mvista.com> (raw)
In-Reply-To: <20071129150726.GA13751@ru.mvista.com>

Emerson Katana Qp platform specific code

Signed-off-by: Andrei Dolnikov <adolnikov@ru•mvista.com>

---
 Kconfig    |    9 +++
 Makefile   |    1
 katanaqp.c |  168 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 178 insertions(+)

diff --git a/arch/powerpc/platforms/embedded6xx/Kconfig b/arch/powerpc/platforms/embedded6xx/Kconfig
index 8924095..33190bd 100644
--- a/arch/powerpc/platforms/embedded6xx/Kconfig
+++ b/arch/powerpc/platforms/embedded6xx/Kconfig
@@ -46,6 +46,15 @@ config PPC_PRPMC2800
 	help
 	  This option enables support for the Motorola PrPMC2800 board
 
+config PPC_KATANAQP
+	bool "Emerson-Katana Qp"
+	depends on EMBEDDED6xx
+	select MV64X60
+	select NOT_COHERENT_CACHE
+	select WANT_DEVICE_TREE
+	help
+	  This option enables support for the Emerson Katana Qp board
+
 config TSI108_BRIDGE
 	bool
 	depends on MPC7448HPC2 || PPC_HOLLY
diff --git a/arch/powerpc/platforms/embedded6xx/Makefile b/arch/powerpc/platforms/embedded6xx/Makefile
index 844947c..c83558f 100644
--- a/arch/powerpc/platforms/embedded6xx/Makefile
+++ b/arch/powerpc/platforms/embedded6xx/Makefile
@@ -5,3 +5,4 @@ obj-$(CONFIG_MPC7448HPC2)	+= mpc7448_hpc2.o
 obj-$(CONFIG_LINKSTATION)	+= linkstation.o ls_uart.o
 obj-$(CONFIG_PPC_HOLLY)		+= holly.o
 obj-$(CONFIG_PPC_PRPMC2800)	+= prpmc2800.o
+obj-$(CONFIG_PPC_KATANAQP)	+= katanaqp.o
diff --git a/arch/powerpc/platforms/embedded6xx/katanaqp.c b/arch/powerpc/platforms/embedded6xx/katanaqp.c
new file mode 100644
index 0000000..64fb608
--- /dev/null
+++ b/arch/powerpc/platforms/embedded6xx/katanaqp.c
@@ -0,0 +1,168 @@
+/*
+ * Board setup routines for the Emerson Katana Qp
+ *
+ * Authors: Vladislav Buzov <vbuzov@ru•mvista.com>
+ *	    Andrei Dolnikov <adolnikov@ru•mvista.com>
+ *
+ * Based on prpmc2800.c by Dale Farnsworth <dale@farnsworth•org>
+ *
+ * 2007 (c) MontaVista, Software, Inc.  This file is licensed under
+ * the terms of the GNU General Public License version 2.  This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/stddef.h>
+#include <linux/kernel.h>
+#include <linux/delay.h>
+#include <linux/interrupt.h>
+#include <linux/seq_file.h>
+#include <linux/of_platform.h>
+#include <linux/pci.h>
+
+#include <asm/machdep.h>
+#include <asm/prom.h>
+#include <asm/system.h>
+#include <asm/time.h>
+#include <asm/kexec.h>
+
+#include <mm/mmu_decl.h>
+
+#include <sysdev/mv64x60.h>
+
+#define PLATFORM_NAME_MAX	64
+
+/* CPLD registers definitions */
+#define KATANAQP_CPLD_RCR	0x0004	/* Reset command */
+#define KATANAQP_CPLD_RCR_CPUHR	(1 << 7)
+
+#define KATANAQP_CPLD_HVR	0x0020
+
+#define KATANAQP_CPLD_PSR	0x0030	/* PCI status */
+#define KATANAQP_CPLD_PSR_PMCM	(1 << 1)
+
+#define KATANAQP_CPLD_HCR	0x0044
+
+static char katanaqp_platform_name[PLATFORM_NAME_MAX];
+
+static void __iomem *cpld_base;
+
+static int katanaqp_exclude_device(struct pci_controller *hose, u_char bus,
+			    u_char devfn)
+{
+	if (bus == 0 && PCI_SLOT(devfn) == 0)
+		return PCIBIOS_DEVICE_NOT_FOUND;
+	else
+		return PCIBIOS_SUCCESSFUL;
+}
+
+static int __init katanaqp_is_monarch(void)
+{
+	return !(in_8(cpld_base + KATANAQP_CPLD_PSR) &
+		 KATANAQP_CPLD_PSR_PMCM);
+}
+
+static void __init katanaqp_setup_arch(void)
+{
+	struct device_node *cpld;
+
+	/*
+	 * ioremap cpld registers in case they are later
+	 * needed by katanaqp_reset_board().
+	 */
+	cpld = of_find_compatible_node(NULL, NULL, "altera,maxii");
+	cpld_base = of_iomap(cpld, 0);
+
+#ifdef CONFIG_PCI
+	if (katanaqp_is_monarch()) {
+		mv64x60_pci_init();
+		ppc_md.pci_exclude_device = katanaqp_exclude_device;
+	}
+#endif
+
+	printk("Emerson Network Power %s\n", katanaqp_platform_name);
+}
+
+static void katanaqp_reset_board(void)
+{
+	local_irq_disable();
+
+	/* issue hard reset to the reset command register */
+	out_8(cpld_base + KATANAQP_CPLD_RCR, KATANAQP_CPLD_RCR_CPUHR);
+	for (;;) ;
+}
+
+static void katanaqp_restart(char *cmd)
+{
+	katanaqp_reset_board();
+}
+
+static void katanaqp_show_cpuinfo(struct seq_file *m)
+{
+	uint memsize = total_memory;
+
+	seq_printf(m, "vendor\t\t: Emerson Network Power\n");
+
+	seq_printf(m, "hardware rev\t: %d\n",
+		   in_8(cpld_base + KATANAQP_CPLD_HVR));
+
+	seq_printf(m, "hardware config\t: %d\n",
+		   in_8(cpld_base + KATANAQP_CPLD_HCR));
+
+	seq_printf(m, "memory size\t: %d MB\n", memsize / (1024 * 1024));
+
+	seq_printf(m, "PCI\t\t: %sMonarch\n",
+		   katanaqp_is_monarch() ? "" : "Non-");
+}
+
+static int __init katanaqp_of_init(void)
+{
+	struct device_node *np;
+
+	np = of_find_compatible_node(NULL, NULL, "cfi-flash");
+	if (np)
+		of_platform_device_create(np, "of-flash", NULL);
+
+	return 0;
+}
+
+device_initcall(katanaqp_of_init);
+
+/*
+ * Called very early, device-tree isn't unflattened
+ */
+static int __init katanaqp_probe(void)
+{
+	unsigned long root = of_get_flat_dt_root();
+	unsigned long len;
+	void *m;
+
+	if (!of_flat_dt_is_compatible(root, "emerson,Katana-Qp"))
+		return 0;
+
+	/* Update ppc_md.name with name from dt */
+	m = of_get_flat_dt_prop(root, "model", &len);
+	if (m)
+		strncpy(katanaqp_platform_name, m,
+			min((int)len, PLATFORM_NAME_MAX - 1));
+
+	return 1;
+}
+
+define_machine(katanaqp)
+{
+	.name			= katanaqp_platform_name,
+	.probe			= katanaqp_probe,
+	.setup_arch		= katanaqp_setup_arch,
+	.init_early		= mv64x60_init_early,
+	.show_cpuinfo		= katanaqp_show_cpuinfo,
+	.init_IRQ		= mv64x60_init_irq,
+	.get_irq		= mv64x60_get_irq,
+	.restart		= katanaqp_restart,
+	.calibrate_decr		= generic_calibrate_decr,
+#ifdef CONFIG_KEXEC
+	.machine_kexec		= default_machine_kexec,
+	.machine_kexec_prepare	= default_machine_kexec_prepare,
+	.machine_crash_shutdown	= default_machine_crash_shutdown,
+#endif
+};

  parent reply	other threads:[~2007-11-29 15:41 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-29 15:07 [PATCH 0/5] PowerPC 74xx: Add Emerson Katana Qp support Andrei Dolnikov
2007-11-29 15:28 ` [PATCH 1/5] PowerPC 74xx: Katana Qp device tree Andrei Dolnikov
2007-12-03  1:50   ` David Gibson
2007-12-03 19:26     ` Jon Loeliger
2007-12-04  0:33       ` David Gibson
2007-12-04 13:14         ` Jon Loeliger
2007-12-04  2:10     ` Mark A. Greer
2007-12-04  2:50       ` David Gibson
2007-12-04  5:30         ` Mark A. Greer
2007-12-06 23:27         ` Mark A. Greer
2007-12-08  1:33           ` David Gibson
2007-12-10 17:17             ` Mark A. Greer
2007-12-10 21:18     ` Dale Farnsworth
2007-12-16  6:40       ` David Gibson
2007-12-18 16:38         ` Dale Farnsworth
2007-12-03 20:52   ` Benjamin Herrenschmidt
2007-12-04  1:23     ` Mark A. Greer
2007-12-04  2:14       ` Benjamin Herrenschmidt
2007-12-04  5:34         ` Mark A. Greer
2007-12-04 17:28       ` Andrei Dolnikov
2007-12-04 17:35         ` Mark A. Greer
2007-11-29 15:35 ` [PATCH 2/5] PowerPC 74xx: Minor updates to MV64x60 boot code Andrei Dolnikov
2007-12-11 23:50   ` Mark A. Greer
2007-11-29 15:39 ` [PATCH 3/5] PowerPC 74xx: Katana Qp bootwrapper Andrei Dolnikov
2007-12-12  0:13   ` Mark A. Greer
2007-11-29 15:42 ` Andrei Dolnikov [this message]
2007-12-03 20:54   ` [PATCH 4/5] PowerPC 74xx: Katana Qp base support Benjamin Herrenschmidt
2007-12-04  2:12     ` Mark A. Greer
2007-12-12  0:48   ` Mark A. Greer
2007-11-29 15:45 ` [PATCH 5/5] PowerPC 74xx: Katana Qp default config Andrei Dolnikov
  -- strict thread matches above, loose matches on Subject: below --
2007-11-16 15:43 [PATCH 0/1] PowerPC 74xx: Add Emerson Katana Qp support Andrei Dolnikov
2007-11-16 16:31 ` [PATCH 4/5] PowerPC 74xx: Katana Qp base support Andrei Dolnikov
2007-11-21 16:30   ` Vitaly Bordug
2007-11-24 18:51   ` Arnd Bergmann
2007-11-24 22:28     ` Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20071129154200.GE13751@ru.mvista.com \
    --to=adolnikov@ru$(echo .)mvista.com \
    --cc=linuxppc-dev@ozlabs$(echo .)org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox