* [PATCH] powerpc: consolidate mpc83xx platform files
@ 2006-12-09 1:07 Kim Phillips
2006-12-09 7:14 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-09 1:07 UTC (permalink / raw)
To: linuxppc-dev
Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files merged
into a single setup.c. machine_probe, instead of using the model property,
checks the compatible property for "MPC83xx" (dts files updated appropriately).
This patch also utilizes of_platform_bus_probe() in lieu of manually
calling of_platform_device_create for each ucc_geth device.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
arch/powerpc/boot/dts/mpc8349emds.dts | 2 +-
arch/powerpc/boot/dts/mpc8349emitx.dts | 2 +-
arch/powerpc/kernel/of_platform.c | 1 +
arch/powerpc/platforms/83xx/Makefile | 6 +-
arch/powerpc/platforms/83xx/mpc832x_mds.c | 232 ----------------------------
arch/powerpc/platforms/83xx/mpc832x_mds.h | 19 ---
arch/powerpc/platforms/83xx/mpc834x_itx.c | 121 ---------------
arch/powerpc/platforms/83xx/mpc834x_itx.h | 23 ---
arch/powerpc/platforms/83xx/mpc834x_sys.c | 140 -----------------
arch/powerpc/platforms/83xx/mpc834x_sys.h | 23 ---
arch/powerpc/platforms/83xx/mpc8360e_pb.c | 236 -----------------------------
arch/powerpc/platforms/83xx/setup.c | 215 ++++++++++++++++++++++++++
12 files changed, 219 insertions(+), 801 deletions(-)
diff --git a/arch/powerpc/boot/dts/mpc8349emds.dts b/arch/powerpc/boot/dts/mpc8349emds.dts
index efceb34..5ad91a2 100644
--- a/arch/powerpc/boot/dts/mpc8349emds.dts
+++ b/arch/powerpc/boot/dts/mpc8349emds.dts
@@ -11,7 +11,7 @@
/ {
model = "MPC8349EMDS";
- compatible = "MPC834xMDS";
+ compatible = "MPC83xx\0MPC834xMDS";
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/boot/dts/mpc8349emitx.dts b/arch/powerpc/boot/dts/mpc8349emitx.dts
index 27807fc..f2ba63e 100644
--- a/arch/powerpc/boot/dts/mpc8349emitx.dts
+++ b/arch/powerpc/boot/dts/mpc8349emitx.dts
@@ -10,7 +10,7 @@
*/
/ {
model = "MPC8349EMITX";
- compatible = "MPC834xMITX";
+ compatible = "MPC83xx\0MPC834xMITX";
#address-cells = <1>;
#size-cells = <1>;
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index b3189d0..2ad0386 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
{ .type = "plb5", },
{ .type = "plb4", },
{ .type = "opb", },
+ { .type = "qe", },
{},
};
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index f1aa7e2..478c2a9 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -1,9 +1,5 @@
#
# Makefile for the PowerPC 83xx linux kernel.
#
-obj-y := misc.o
+obj-y := setup.o misc.o
obj-$(CONFIG_PCI) += pci.o
-obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
-obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
-obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o
-obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
deleted file mode 100644
index f58c978..0000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Description:
- * MPC832xE MDS board specific routines.
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-
-#include <asm/of_device.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
-
-#include "mpc83xx.h"
-#include "mpc832x_mds.h"
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc832x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc832x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- unsigned int *fp =
- (int *)get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc832x_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc832x_declare_of_platform_devices);
-
-void __init mpc832x_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc832x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc832x_rtc_hookup);
-#endif
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc832x_sys_probe(void)
-{
- char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
- "model", NULL);
-
- if (model == NULL)
- return 0;
- if (strcmp(model, "MPC8323EMDS"))
- return 0;
-
- DBG("%s found\n", model);
-
- return 1;
-}
-
-define_machine(mpc832x_mds) {
- .name = "MPC832x MDS",
- .probe = mpc832x_sys_probe,
- .setup_arch = mpc832x_sys_setup_arch,
- .init_IRQ = mpc832x_sys_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.h b/arch/powerpc/platforms/83xx/mpc832x_mds.h
deleted file mode 100644
index a495889..0000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Description:
- * MPC832x MDS board specific header.
- *
- * 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 __MACH_MPC832x_MDS_H__
-#define __MACH_MPC832x_MDS_H__
-
-extern u8 *get_bcsr(void);
-
-#endif /* __MACH_MPC832x_MDS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
deleted file mode 100644
index 314c42a..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_itx.c
- *
- * MPC834x ITX board specific routines
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-
-#include "mpc83xx.h"
-
-#include <platforms/83xx/mpc834x_sys.h>
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_itx_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_itx_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-void __init mpc834x_itx_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc834x_itx_probe(void)
-{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
- return 1;
-}
-
-define_machine(mpc834x_itx) {
- .name = "MPC834x ITX",
- .probe = mpc834x_itx_probe,
- .setup_arch = mpc834x_itx_setup_arch,
- .init_IRQ = mpc834x_itx_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.h b/arch/powerpc/platforms/83xx/mpc834x_itx.h
deleted file mode 100644
index 174ca4e..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_itx.h
- *
- * MPC834X ITX common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_ITX_H__
-#define __MACH_MPC83XX_ITX_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_ITX_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
deleted file mode 100644
index 80b735a..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_sys.c
- *
- * MPC834x SYS board specific routines
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-
-#include "mpc83xx.h"
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-void __init mpc834x_sys_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc834x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc834x_rtc_hookup);
-#endif
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc834x_sys_probe(void)
-{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
- return 1;
-}
-
-define_machine(mpc834x_sys) {
- .name = "MPC834x SYS",
- .probe = mpc834x_sys_probe,
- .setup_arch = mpc834x_sys_setup_arch,
- .init_IRQ = mpc834x_sys_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
deleted file mode 100644
index 7d5bbef..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_sys.h
- *
- * MPC834X SYS common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_SYS_H__
-#define __MACH_MPC83XX_SYS_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
deleted file mode 100644
index 7bfd47a..0000000
--- a/arch/powerpc/platforms/83xx/mpc8360e_pb.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Author: Li Yang <LeoLi@freescale.com>
- * Yin Olivia <Hong-hua.Yin@freescale.com>
- *
- * Description:
- * MPC8360E MDS PB board specific routines.
- *
- * Changelog:
- * Jun 21, 2006 Initial version
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-
-#include <asm/of_device.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
-
-#include "mpc83xx.h"
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc8360_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc8360_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc8360_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc8360_declare_of_platform_devices);
-
-void __init mpc8360_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc8360_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc8360_rtc_hookup);
-#endif
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc8360_sys_probe(void)
-{
- char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
- "model", NULL);
- if (model == NULL)
- return 0;
- if (strcmp(model, "MPC8360EPB"))
- return 0;
-
- DBG("MPC8360EMDS-PB found\n");
-
- return 1;
-}
-
-define_machine(mpc8360_sys) {
- .name = "MPC8360E PB",
- .probe = mpc8360_sys_probe,
- .setup_arch = mpc8360_sys_setup_arch,
- .init_IRQ = mpc8360_sys_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/setup.c b/arch/powerpc/platforms/83xx/setup.c
new file mode 100644
index 0000000..614bab2
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/setup.c
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ *
+ * Author: Li Yang <LeoLi@freescale.com>
+ * Yin Olivia <Hong-hua.Yin@freescale.com>
+ *
+ * Description:
+ * MPC83xx board routines.
+ *
+ * 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/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/initrd.h>
+
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/time.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/ipic.h>
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <sysdev/fsl_soc.h>
+#include <asm/qe.h>
+#include <asm/qe_ic.h>
+
+#include "mpc83xx.h"
+
+#define DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+#ifndef CONFIG_PCI
+unsigned long isa_io_base = 0;
+unsigned long isa_mem_base = 0;
+#endif
+
+static u8 __iomem *bcsr_regs = NULL;
+
+u8 *get_bcsr(void)
+{
+ return bcsr_regs;
+}
+
+/* ************************************************************************
+ *
+ * Setup the architecture
+ *
+ */
+static void __init mpc83xx_setup_arch(void)
+{
+ struct device_node *np;
+
+ if (ppc_md.progress)
+ ppc_md.progress("mpc83xx_setup_arch()", 0);
+
+ np = of_find_node_by_type(NULL, "cpu");
+ if (np != 0) {
+ const unsigned int *fp =
+ get_property(np, "clock-frequency", NULL);
+ if (fp != 0)
+ loops_per_jiffy = *fp / HZ;
+ else
+ loops_per_jiffy = 50000000 / HZ;
+ of_node_put(np);
+ }
+
+ /* Map BCSR area */
+ np = of_find_node_by_name(NULL, "bcsr");
+ if (np != 0) {
+ struct resource res;
+
+ of_address_to_resource(np, 0, &res);
+ bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+ of_node_put(np);
+ }
+
+#ifdef CONFIG_PCI
+ for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
+ add_bridge(np);
+ ppc_md.pci_exclude_device = mpc83xx_exclude_device;
+#endif
+
+#ifdef CONFIG_QUICC_ENGINE
+ if ((np = of_find_node_by_type(NULL, "qe")) != NULL) {
+ qe_reset();
+ of_node_put(np);
+ }
+
+ if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
+ par_io_init(np);
+ of_node_put(np);
+
+ for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
+ par_io_of_config(np);
+ }
+
+ if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
+ != NULL){
+ /* Reset the Ethernet PHY */
+ bcsr_regs[9] &= ~0x20;
+ udelay(1000);
+ bcsr_regs[9] |= 0x20;
+ iounmap(bcsr_regs);
+ of_node_put(np);
+ }
+
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+static int __init mpc83xx_publish_devices(void)
+{
+ if (machine_is(mpc83xx))
+ of_platform_bus_probe(NULL, NULL, NULL);
+
+ return 0;
+}
+device_initcall(mpc83xx_publish_devices);
+
+void __init mpc83xx_init_IRQ(void)
+{
+
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "ipic");
+ if (!np)
+ return;
+
+ ipic_init(np, 0);
+
+ /* Initialize the default interrupt mapping priorities,
+ * in case the boot rom changed something on us.
+ */
+ ipic_set_default_priority();
+ of_node_put(np);
+
+#ifdef CONFIG_QUICC_ENGINE
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+
+ qe_ic_init(np, 0);
+ of_node_put(np);
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
+extern ulong ds1374_get_rtc_time(void);
+extern int ds1374_set_rtc_time(ulong);
+
+static int __init mpc83xx_rtc_hookup(void)
+{
+ struct timespec tv;
+
+ ppc_md.get_rtc_time = ds1374_get_rtc_time;
+ ppc_md.set_rtc_time = ds1374_set_rtc_time;
+
+ tv.tv_nsec = 0;
+ tv.tv_sec = (ppc_md.get_rtc_time) ();
+ do_settimeofday(&tv);
+
+ return 0;
+}
+
+late_initcall(mpc83xx_rtc_hookup);
+#endif
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+static int __init mpc83xx_probe(void)
+{
+ unsigned long root = of_get_flat_dt_root();
+
+ if (!of_flat_dt_is_compatible(root, "MPC83xx"))
+ return 0;
+
+ DBG("MPC83xx compatible found\n");
+
+ return 1;
+}
+
+define_machine(mpc83xx) {
+ .name = "MPC83xx",
+ .probe = mpc83xx_probe,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
+ .get_irq = ipic_get_irq,
+ .restart = mpc83xx_restart,
+ .time_init = mpc83xx_time_init,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
--
1.4.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-09 1:07 Kim Phillips
@ 2006-12-09 7:14 ` Benjamin Herrenschmidt
2006-12-11 3:41 ` Kumar Gala
0 siblings, 1 reply; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-09 7:14 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
On Fri, 2006-12-08 at 19:07 -0600, Kim Phillips wrote:
> Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files merged
> into a single setup.c. machine_probe, instead of using the model property,
> checks the compatible property for "MPC83xx" (dts files updated appropriately).
> This patch also utilizes of_platform_bus_probe() in lieu of manually
> calling of_platform_device_create for each ucc_geth device.
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
I am not completely certain this is the right approach.
While factoring code is good, I think that every single board should
have it's own ppc_md, though you can definitely provide "common"
functions for mpc83xx that can optinally be used by those different
boards.
Maybe put all the freescale ones in one file if you want...
The rationale here is that while your approach is fine for your eval
boards, I don't think it's good for embedded customers. They may want
more complex platforms, with their own directory even if they have a lot
of custom stuff on the board while still possibly picking some of your
"common" code (and their board shouldn't match your overly generic
probe() implementation).
Cheers,
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-09 7:14 ` Benjamin Herrenschmidt
@ 2006-12-11 3:41 ` Kumar Gala
2006-12-11 21:51 ` Kim Phillips
0 siblings, 1 reply; 43+ messages in thread
From: Kumar Gala @ 2006-12-11 3:41 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Dec 9, 2006, at 1:14 AM, Benjamin Herrenschmidt wrote:
> On Fri, 2006-12-08 at 19:07 -0600, Kim Phillips wrote:
>> Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files merged
>> into a single setup.c. machine_probe, instead of using the model
>> property,
>> checks the compatible property for "MPC83xx" (dts files updated
>> appropriately).
>> This patch also utilizes of_platform_bus_probe() in lieu of manually
>> calling of_platform_device_create for each ucc_geth device.
>>
>> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Nack on the patch.
> I am not completely certain this is the right approach.
>
> While factoring code is good, I think that every single board should
> have it's own ppc_md, though you can definitely provide "common"
> functions for mpc83xx that can optinally be used by those different
> boards.
>
> Maybe put all the freescale ones in one file if you want...
>
> The rationale here is that while your approach is fine for your eval
> boards, I don't think it's good for embedded customers. They may want
> more complex platforms, with their own directory even if they have
> a lot
> of custom stuff on the board while still possibly picking some of your
> "common" code (and their board shouldn't match your overly generic
> probe() implementation).
>
> Cheers,
> Ben.
I'm with Ben on this. I think consolidating the code that is common
is fine, but we should have a define_machine() per board. You can
put them all in one mpc83xx/fsl.c
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-11 3:41 ` Kumar Gala
@ 2006-12-11 21:51 ` Kim Phillips
2006-12-11 22:08 ` Kumar Gala
2006-12-18 5:17 ` Paul Mackerras
0 siblings, 2 replies; 43+ messages in thread
From: Kim Phillips @ 2006-12-11 21:51 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Sun, 10 Dec 2006 21:41:24 -0600
Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Dec 9, 2006, at 1:14 AM, Benjamin Herrenschmidt wrote:
>
> > On Fri, 2006-12-08 at 19:07 -0600, Kim Phillips wrote:
> >> Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files merged
> >> into a single setup.c. machine_probe, instead of using the model
> >> property,
> >> checks the compatible property for "MPC83xx" (dts files updated
> >> appropriately).
> >> This patch also utilizes of_platform_bus_probe() in lieu of manually
> >> calling of_platform_device_create for each ucc_geth device.
> >>
> >> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
>
> Nack on the patch.
>
> > I am not completely certain this is the right approach.
> >
> > While factoring code is good, I think that every single board should
> > have it's own ppc_md, though you can definitely provide "common"
> > functions for mpc83xx that can optinally be used by those different
> > boards.
> >
> > Maybe put all the freescale ones in one file if you want...
> >
> > The rationale here is that while your approach is fine for your eval
> > boards, I don't think it's good for embedded customers. They may want
> > more complex platforms, with their own directory even if they have
> > a lot
> > of custom stuff on the board while still possibly picking some of your
> > "common" code (and their board shouldn't match your overly generic
> > probe() implementation).
> >
> > Cheers,
> > Ben.
>
> I'm with Ben on this. I think consolidating the code that is common
> is fine, but we should have a define_machine() per board. You can
> put them all in one mpc83xx/fsl.c
>
so the contents of 83xx/fsl.c would look like:
#ifdef CONFIG_MPC834x_SYS
define_machine(mpc834x_sys) {
.name = "MPC834x SYS",
.probe = mpc83xx_probe,
.setup_arch = mpc83xx_setup_arch,
.init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
.calibrate_decr = generic_calibrate_decr,
.progress = udbg_progress,
};
#else
#ifdef CONFIG_MPC834x_ITX
define_machine(mpc83xx) {
.name = "MPC834x ITX",
<rest is the same>
#else
..and so on and so forth for CONFIG_MPC8360E_PB, CONFIG_MPC832x_MDS, and now CONFIG_MPC831x_RDB. So the only thing that changes is the name? And perhaps the _probe function? That's still pretty redundant, esp. considering the source of the name to match in the dt is easily modifiable. And it's not as if other platforms (52xx, 86xx, pasemi etc.) don't use of_flat_dt_is_compatible.
All 83xx platform code, define_machine included, is exactly the same on all boards, modulo the QE stuff which is ifdef protected and easily configured. All board differences can be specified in the device tree and/or handled with proper kernel configuration. If an embedded customer wants, they can configure their kernel based on the various 83xx defconfigs, customize their _probe() to match their device tree, all at will, just as before. I'm concerned because 83xx has the capability of being a single kernel image basically for free (we just need to clean some things up in the ucc_geth driver first).
That said, I'm not an embedded customer, and the motivation for this patch was to prep 83xx platform filespace so that we don't have to:
sed s/834/831/ < mpc834x_itx.c > mpc831x_rdb.c
sed s/834/831/ < mpc834x_itx.h > mpc831x_rdb.h
and copy and paste the Makefile and Kconfig lines, which just feels like a terrible thing to do (and keep on doing).
Kim
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-11 21:51 ` Kim Phillips
@ 2006-12-11 22:08 ` Kumar Gala
2006-12-12 2:10 ` Kim Phillips
2006-12-18 5:17 ` Paul Mackerras
1 sibling, 1 reply; 43+ messages in thread
From: Kumar Gala @ 2006-12-11 22:08 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
On Dec 11, 2006, at 3:51 PM, Kim Phillips wrote:
> On Sun, 10 Dec 2006 21:41:24 -0600
> Kumar Gala <galak@kernel.crashing.org> wrote:
>
>>
>> On Dec 9, 2006, at 1:14 AM, Benjamin Herrenschmidt wrote:
>>
>>> On Fri, 2006-12-08 at 19:07 -0600, Kim Phillips wrote:
>>>> Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files
>>>> merged
>>>> into a single setup.c. machine_probe, instead of using the model
>>>> property,
>>>> checks the compatible property for "MPC83xx" (dts files updated
>>>> appropriately).
>>>> This patch also utilizes of_platform_bus_probe() in lieu of
>>>> manually
>>>> calling of_platform_device_create for each ucc_geth device.
>>>>
>>>> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
>>
>> Nack on the patch.
>>
>>> I am not completely certain this is the right approach.
>>>
>>> While factoring code is good, I think that every single board should
>>> have it's own ppc_md, though you can definitely provide "common"
>>> functions for mpc83xx that can optinally be used by those different
>>> boards.
>>>
>>> Maybe put all the freescale ones in one file if you want...
>>>
>>> The rationale here is that while your approach is fine for your eval
>>> boards, I don't think it's good for embedded customers. They may
>>> want
>>> more complex platforms, with their own directory even if they have
>>> a lot
>>> of custom stuff on the board while still possibly picking some of
>>> your
>>> "common" code (and their board shouldn't match your overly generic
>>> probe() implementation).
>>>
>>> Cheers,
>>> Ben.
>>
>> I'm with Ben on this. I think consolidating the code that is common
>> is fine, but we should have a define_machine() per board. You can
>> put them all in one mpc83xx/fsl.c
>>
> so the contents of 83xx/fsl.c would look like:
> #ifdef CONFIG_MPC834x_SYS
> define_machine(mpc834x_sys) {
> .name = "MPC834x SYS",
> .probe = mpc83xx_probe,
> .setup_arch = mpc83xx_setup_arch,
> .init_IRQ = mpc83xx_init_IRQ,
> .get_irq = ipic_get_irq,
> .restart = mpc83xx_restart,
> .time_init = mpc83xx_time_init,
> .calibrate_decr = generic_calibrate_decr,
> .progress = udbg_progress,
> };
> #else
> #ifdef CONFIG_MPC834x_ITX
> define_machine(mpc83xx) {
> .name = "MPC834x ITX",
> <rest is the same>
> #else
> ..and so on and so forth for CONFIG_MPC8360E_PB,
> CONFIG_MPC832x_MDS, and now CONFIG_MPC831x_RDB. So the only thing
> that changes is the name? And perhaps the _probe function? That's
> still pretty redundant, esp. considering the source of the name to
> match in the dt is easily modifiable. And it's not as if other
> platforms (52xx, 86xx, pasemi etc.) don't use
> of_flat_dt_is_compatible.
Why would you need the ifdef's around the define_machine()?
> All 83xx platform code, define_machine included, is exactly the
> same on all boards, modulo the QE stuff which is ifdef protected
> and easily configured. All board differences can be specified in
> the device tree and/or handled with proper kernel configuration.
> If an embedded customer wants, they can configure their kernel
> based on the various 83xx defconfigs, customize their _probe() to
> match their device tree, all at will, just as before. I'm
> concerned because 83xx has the capability of being a single kernel
> image basically for free (we just need to clean some things up in
> the ucc_geth driver first).
You say this, but miss the point that its only true for ALL FREESCALE
boards, which are the only boards currently in the tree. We aren't
precluding the ability to have a single kernel image for 83xx.
> That said, I'm not an embedded customer, and the motivation for
> this patch was to prep 83xx platform filespace so that we don't
> have to:
>
> sed s/834/831/ < mpc834x_itx.c > mpc831x_rdb.c
> sed s/834/831/ < mpc834x_itx.h > mpc831x_rdb.h
>
> and copy and paste the Makefile and Kconfig lines, which just feels
> like a terrible thing to do (and keep on doing).
And I'm suggesting that for 831x_rdb, All you'd add is a new
define_machine() struct.
- kumar
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-11 22:08 ` Kumar Gala
@ 2006-12-12 2:10 ` Kim Phillips
2006-12-12 2:29 ` Benjamin Herrenschmidt
0 siblings, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-12 2:10 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Mon, 11 Dec 2006 16:08:20 -0600
Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Dec 11, 2006, at 3:51 PM, Kim Phillips wrote:
>
> > On Sun, 10 Dec 2006 21:41:24 -0600
> > Kumar Gala <galak@kernel.crashing.org> wrote:
> >
> >>
> >> On Dec 9, 2006, at 1:14 AM, Benjamin Herrenschmidt wrote:
> >>
> >>> On Fri, 2006-12-08 at 19:07 -0600, Kim Phillips wrote:
> >>>> Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files
> >>>> merged
> >>>> into a single setup.c. machine_probe, instead of using the model
> >>>> property,
> >>>> checks the compatible property for "MPC83xx" (dts files updated
> >>>> appropriately).
> >>>> This patch also utilizes of_platform_bus_probe() in lieu of
> >>>> manually
> >>>> calling of_platform_device_create for each ucc_geth device.
> >>>>
> >>>> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> >>
> >> Nack on the patch.
> >>
> >>> I am not completely certain this is the right approach.
> >>>
> >>> While factoring code is good, I think that every single board should
> >>> have it's own ppc_md, though you can definitely provide "common"
> >>> functions for mpc83xx that can optinally be used by those different
> >>> boards.
> >>>
> >>> Maybe put all the freescale ones in one file if you want...
> >>>
> >>> The rationale here is that while your approach is fine for your eval
> >>> boards, I don't think it's good for embedded customers. They may
> >>> want
> >>> more complex platforms, with their own directory even if they have
> >>> a lot
> >>> of custom stuff on the board while still possibly picking some of
> >>> your
> >>> "common" code (and their board shouldn't match your overly generic
> >>> probe() implementation).
> >>>
> >>> Cheers,
> >>> Ben.
> >>
> >> I'm with Ben on this. I think consolidating the code that is common
> >> is fine, but we should have a define_machine() per board. You can
> >> put them all in one mpc83xx/fsl.c
> >>
> > so the contents of 83xx/fsl.c would look like:
> > #ifdef CONFIG_MPC834x_SYS
> > define_machine(mpc834x_sys) {
> > .name = "MPC834x SYS",
> > .probe = mpc83xx_probe,
> > .setup_arch = mpc83xx_setup_arch,
> > .init_IRQ = mpc83xx_init_IRQ,
> > .get_irq = ipic_get_irq,
> > .restart = mpc83xx_restart,
> > .time_init = mpc83xx_time_init,
> > .calibrate_decr = generic_calibrate_decr,
> > .progress = udbg_progress,
> > };
> > #else
> > #ifdef CONFIG_MPC834x_ITX
> > define_machine(mpc83xx) {
> > .name = "MPC834x ITX",
> > <rest is the same>
> > #else
> > ..and so on and so forth for CONFIG_MPC8360E_PB,
> > CONFIG_MPC832x_MDS, and now CONFIG_MPC831x_RDB. So the only thing
> > that changes is the name? And perhaps the _probe function? That's
> > still pretty redundant, esp. considering the source of the name to
> > match in the dt is easily modifiable. And it's not as if other
> > platforms (52xx, 86xx, pasemi etc.) don't use
> > of_flat_dt_is_compatible.
>
> Why would you need the ifdef's around the define_machine()?
how else is platform_probe going to find the right match? it's either that, or adding _probe()s for each platform.
> > All 83xx platform code, define_machine included, is exactly the
> > same on all boards, modulo the QE stuff which is ifdef protected
> > and easily configured. All board differences can be specified in
> > the device tree and/or handled with proper kernel configuration.
> > If an embedded customer wants, they can configure their kernel
> > based on the various 83xx defconfigs, customize their _probe() to
> > match their device tree, all at will, just as before. I'm
> > concerned because 83xx has the capability of being a single kernel
> > image basically for free (we just need to clean some things up in
> > the ucc_geth driver first).
>
> You say this, but miss the point that its only true for ALL FREESCALE
> boards, which are the only boards currently in the tree. We aren't
it's not my fault that only fsl boards are the only ones in the tree. And why is it so impossible that other boards are the same way?
> precluding the ability to have a single kernel image for 83xx.
>
good to know.
> And I'm suggesting that for 831x_rdb, All you'd add is a new
> define_machine() struct.
>
how about making a single _probe() try and match the ppc_md.name with the model in the device tree?
Kim
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 2:10 ` Kim Phillips
@ 2006-12-12 2:29 ` Benjamin Herrenschmidt
2006-12-12 2:31 ` Kumar Gala
2006-12-12 21:30 ` Scott Wood
0 siblings, 2 replies; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-12 2:29 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
> how else is platform_probe going to find the right match?
> it's either that, or adding _probe()s for each platform.
Well, either you want all freescale boards have one platform.
in which case you write one ppc_md() structure, call it
mpc83xx_fslboards or something like that, and have a probe routine that
test for all matches, or create as many ppc_md structures as you have
boards each with it's own probe().
The point here is that other developpers making their own mpc83xx based
boards will not want to use your ppc_md. They will have differences and
those differences will be handled in their board support code via
different hooks in ppc_md.
It's goot if you provide them "generic" things they can use in mpc83xx.c
for areas where they don't differ from the freescale reference
implementations, but don't make the fsl board support code try to match
on everything that has a mpc83xx in it !
Thus, make sure that your DTs for the fsl boards have clear
identification (via the model or compatible property at the root of the
tree is the usual way of doing so) and have a ppc_md or several, as you
like, match specifically those boards. Also, make that ppc_md live in a
different file that doesn't have to be compiled along with the generic
mpc83xx code.
That way, embedded developpers have the choice of either building a
multiplatform kernel that supports their board -and- fsl ones, or a
tailored kernel for their board that doesn't include the fsl specific
stuff, all depending on config options.
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 2:29 ` Benjamin Herrenschmidt
@ 2006-12-12 2:31 ` Kumar Gala
2006-12-12 21:30 ` Scott Wood
1 sibling, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-12 2:31 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Dec 11, 2006, at 8:29 PM, Benjamin Herrenschmidt wrote:
>
>> how else is platform_probe going to find the right match?
>> it's either that, or adding _probe()s for each platform.
>
> Well, either you want all freescale boards have one platform.
> in which case you write one ppc_md() structure, call it
> mpc83xx_fslboards or something like that, and have a probe routine
> that
> test for all matches, or create as many ppc_md structures as you have
> boards each with it's own probe().
>
> The point here is that other developpers making their own mpc83xx
> based
> boards will not want to use your ppc_md. They will have differences
> and
> those differences will be handled in their board support code via
> different hooks in ppc_md.
>
> It's goot if you provide them "generic" things they can use in
> mpc83xx.c
> for areas where they don't differ from the freescale reference
> implementations, but don't make the fsl board support code try to
> match
> on everything that has a mpc83xx in it !
>
> Thus, make sure that your DTs for the fsl boards have clear
> identification (via the model or compatible property at the root of
> the
> tree is the usual way of doing so) and have a ppc_md or several, as
> you
> like, match specifically those boards. Also, make that ppc_md live
> in a
> different file that doesn't have to be compiled along with the generic
> mpc83xx code.
>
> That way, embedded developpers have the choice of either building a
> multiplatform kernel that supports their board -and- fsl ones, or a
> tailored kernel for their board that doesn't include the fsl specific
> stuff, all depending on config options.
Thank you Ben, you described this far better than I was.
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH] powerpc: consolidate mpc83xx platform files
@ 2006-12-12 17:36 Kim Phillips
2006-12-12 18:03 ` Kumar Gala
0 siblings, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-12 17:36 UTC (permalink / raw)
To: linuxppc-dev
Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files merged
into a single setup.c. machine definitions moved to machdefs.c with
corresponding probe fns. This patch also utilizes of_platform_bus_probe()
in lieu of manually calling of_platform_device_create for each ucc_geth device.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
arch/powerpc/kernel/of_platform.c | 1 +
arch/powerpc/platforms/83xx/Makefile | 6 +-
arch/powerpc/platforms/83xx/machdefs.c | 126 +++++++++++++++
arch/powerpc/platforms/83xx/mpc832x_mds.c | 232 ----------------------------
arch/powerpc/platforms/83xx/mpc832x_mds.h | 19 ---
arch/powerpc/platforms/83xx/mpc834x_itx.c | 121 ---------------
arch/powerpc/platforms/83xx/mpc834x_itx.h | 23 ---
arch/powerpc/platforms/83xx/mpc834x_sys.c | 140 -----------------
arch/powerpc/platforms/83xx/mpc834x_sys.h | 23 ---
arch/powerpc/platforms/83xx/mpc8360e_pb.c | 236 -----------------------------
arch/powerpc/platforms/83xx/mpc83xx.h | 2 +
arch/powerpc/platforms/83xx/setup.c | 188 +++++++++++++++++++++++
12 files changed, 318 insertions(+), 799 deletions(-)
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 3002ea3..72da78b 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
{ .type = "plb5", },
{ .type = "plb4", },
{ .type = "opb", },
+ { .type = "qe", },
{},
};
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index f1aa7e2..8f09661 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -1,9 +1,5 @@
#
# Makefile for the PowerPC 83xx linux kernel.
#
-obj-y := misc.o
+obj-y := machdefs.o setup.o misc.o
obj-$(CONFIG_PCI) += pci.o
-obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
-obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
-obj-$(CONFIG_MPC8360E_PB) += mpc8360e_pb.o
-obj-$(CONFIG_MPC832x_MDS) += mpc832x_mds.o
diff --git a/arch/powerpc/platforms/83xx/machdefs.c b/arch/powerpc/platforms/83xx/machdefs.c
new file mode 100644
index 0000000..2e72844
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/machdefs.c
@@ -0,0 +1,126 @@
+#include <asm/machdep.h>
+#include <asm/of_platform.h>
+#include <asm/ipic.h>
+#include <asm/udbg.h>
+#include <asm/time.h>
+
+#include "mpc83xx.h"
+
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+/*
+ * Called very early, MMU is off, device-tree isn't unflattened
+ */
+
+static int __init mpc832x_sys_probe(void)
+{
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8323EMDS"))
+ return 0;
+
+ DBG("%s found\n", model);
+
+ return 1;
+}
+
+static int __init mpc834x_itx_probe(void)
+{
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8349EMITX"))
+ return 0;
+
+ DBG("%s found\n", model);
+
+ return 1;
+}
+
+static int __init mpc834x_sys_probe(void)
+{
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8349EMDS"))
+ return 0;
+
+ DBG("%s found\n", model);
+
+ return 1;
+}
+
+static int __init mpc8360_sys_probe(void)
+{
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8360EPB"))
+ return 0;
+
+ DBG("MPC8360EMDS-PB found\n");
+
+ return 1;
+}
+
+
+define_machine(mpc832x_mds) {
+ .name = "MPC832x MDS",
+ .probe = mpc832x_sys_probe,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
+ .get_irq = ipic_get_irq,
+ .restart = mpc83xx_restart,
+ .time_init = mpc83xx_time_init,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
+
+define_machine(mpc834x_itx) {
+ .name = "MPC834x ITX",
+ .probe = mpc834x_itx_probe,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
+ .get_irq = ipic_get_irq,
+ .restart = mpc83xx_restart,
+ .time_init = mpc83xx_time_init,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
+
+define_machine(mpc834x_sys) {
+ .name = "MPC834x SYS",
+ .probe = mpc834x_sys_probe,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
+ .get_irq = ipic_get_irq,
+ .restart = mpc83xx_restart,
+ .time_init = mpc83xx_time_init,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
+
+define_machine(mpc8360_sys) {
+ .name = "MPC8360E PB",
+ .probe = mpc8360_sys_probe,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
+ .get_irq = ipic_get_irq,
+ .restart = mpc83xx_restart,
+ .time_init = mpc83xx_time_init,
+ .calibrate_decr = generic_calibrate_decr,
+ .progress = udbg_progress,
+};
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
deleted file mode 100644
index f58c978..0000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Description:
- * MPC832xE MDS board specific routines.
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-
-#include <asm/of_device.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
-
-#include "mpc83xx.h"
-#include "mpc832x_mds.h"
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc832x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc832x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- unsigned int *fp =
- (int *)get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc832x_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc832x_declare_of_platform_devices);
-
-void __init mpc832x_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc832x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc832x_rtc_hookup);
-#endif
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc832x_sys_probe(void)
-{
- char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
- "model", NULL);
-
- if (model == NULL)
- return 0;
- if (strcmp(model, "MPC8323EMDS"))
- return 0;
-
- DBG("%s found\n", model);
-
- return 1;
-}
-
-define_machine(mpc832x_mds) {
- .name = "MPC832x MDS",
- .probe = mpc832x_sys_probe,
- .setup_arch = mpc832x_sys_setup_arch,
- .init_IRQ = mpc832x_sys_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.h b/arch/powerpc/platforms/83xx/mpc832x_mds.h
deleted file mode 100644
index a495889..0000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Description:
- * MPC832x MDS board specific header.
- *
- * 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 __MACH_MPC832x_MDS_H__
-#define __MACH_MPC832x_MDS_H__
-
-extern u8 *get_bcsr(void);
-
-#endif /* __MACH_MPC832x_MDS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
deleted file mode 100644
index 314c42a..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_itx.c
- *
- * MPC834x ITX board specific routines
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-
-#include "mpc83xx.h"
-
-#include <platforms/83xx/mpc834x_sys.h>
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_itx_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_itx_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-void __init mpc834x_itx_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc834x_itx_probe(void)
-{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
- return 1;
-}
-
-define_machine(mpc834x_itx) {
- .name = "MPC834x ITX",
- .probe = mpc834x_itx_probe,
- .setup_arch = mpc834x_itx_setup_arch,
- .init_IRQ = mpc834x_itx_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.h b/arch/powerpc/platforms/83xx/mpc834x_itx.h
deleted file mode 100644
index 174ca4e..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_itx.h
- *
- * MPC834X ITX common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_ITX_H__
-#define __MACH_MPC83XX_ITX_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_ITX_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
deleted file mode 100644
index 80b735a..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_sys.c
- *
- * MPC834x SYS board specific routines
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-
-#include "mpc83xx.h"
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-void __init mpc834x_sys_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc834x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc834x_rtc_hookup);
-#endif
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc834x_sys_probe(void)
-{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
- return 1;
-}
-
-define_machine(mpc834x_sys) {
- .name = "MPC834x SYS",
- .probe = mpc834x_sys_probe,
- .setup_arch = mpc834x_sys_setup_arch,
- .init_IRQ = mpc834x_sys_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
deleted file mode 100644
index 7d5bbef..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_sys.h
- *
- * MPC834X SYS common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_SYS_H__
-#define __MACH_MPC83XX_SYS_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
deleted file mode 100644
index 7bfd47a..0000000
--- a/arch/powerpc/platforms/83xx/mpc8360e_pb.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Author: Li Yang <LeoLi@freescale.com>
- * Yin Olivia <Hong-hua.Yin@freescale.com>
- *
- * Description:
- * MPC8360E MDS PB board specific routines.
- *
- * Changelog:
- * Jun 21, 2006 Initial version
- *
- * 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/stddef.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-
-#include <asm/of_device.h>
-#include <asm/system.h>
-#include <asm/atomic.h>
-#include <asm/time.h>
-#include <asm/io.h>
-#include <asm/machdep.h>
-#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
-#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
-
-#include "mpc83xx.h"
-
-#undef DEBUG
-#ifdef DEBUG
-#define DBG(fmt...) udbg_printf(fmt)
-#else
-#define DBG(fmt...)
-#endif
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc8360_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc8360_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc8360_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc8360_declare_of_platform_devices);
-
-void __init mpc8360_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc8360_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc8360_rtc_hookup);
-#endif
-
-/*
- * Called very early, MMU is off, device-tree isn't unflattened
- */
-static int __init mpc8360_sys_probe(void)
-{
- char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
- "model", NULL);
- if (model == NULL)
- return 0;
- if (strcmp(model, "MPC8360EPB"))
- return 0;
-
- DBG("MPC8360EMDS-PB found\n");
-
- return 1;
-}
-
-define_machine(mpc8360_sys) {
- .name = "MPC8360E PB",
- .probe = mpc8360_sys_probe,
- .setup_arch = mpc8360_sys_setup_arch,
- .init_IRQ = mpc8360_sys_init_IRQ,
- .get_irq = ipic_get_irq,
- .restart = mpc83xx_restart,
- .time_init = mpc83xx_time_init,
- .calibrate_decr = generic_calibrate_decr,
- .progress = udbg_progress,
-};
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 01cae10..7419db4 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -13,5 +13,7 @@ extern int add_bridge(struct device_node
extern int mpc83xx_exclude_device(u_char bus, u_char devfn);
extern void mpc83xx_restart(char *cmd);
extern long mpc83xx_time_init(void);
+extern void __init mpc83xx_setup_arch(void);
+extern void __init mpc83xx_init_IRQ(void);
#endif /* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/setup.c b/arch/powerpc/platforms/83xx/setup.c
new file mode 100644
index 0000000..8f28e56
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/setup.c
@@ -0,0 +1,188 @@
+/*
+ * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ *
+ * Author: Li Yang <LeoLi@freescale.com>
+ * Yin Olivia <Hong-hua.Yin@freescale.com>
+ *
+ * Description:
+ * MPC83xx board routines.
+ *
+ * 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/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/initrd.h>
+
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/time.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/ipic.h>
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <sysdev/fsl_soc.h>
+#include <asm/qe.h>
+#include <asm/qe_ic.h>
+
+#include "mpc83xx.h"
+
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+#ifndef CONFIG_PCI
+unsigned long isa_io_base = 0;
+unsigned long isa_mem_base = 0;
+#endif
+
+static u8 __iomem *bcsr_regs = NULL;
+
+u8 *get_bcsr(void)
+{
+ return bcsr_regs;
+}
+
+/* ************************************************************************
+ *
+ * Setup the architecture
+ *
+ */
+void __init mpc83xx_setup_arch(void)
+{
+ struct device_node *np;
+
+ if (ppc_md.progress)
+ ppc_md.progress("mpc83xx_setup_arch()", 0);
+
+ np = of_find_node_by_type(NULL, "cpu");
+ if (np != 0) {
+ const unsigned int *fp =
+ get_property(np, "clock-frequency", NULL);
+ if (fp != 0)
+ loops_per_jiffy = *fp / HZ;
+ else
+ loops_per_jiffy = 50000000 / HZ;
+ of_node_put(np);
+ }
+
+ /* Map BCSR area */
+ np = of_find_node_by_name(NULL, "bcsr");
+ if (np != 0) {
+ struct resource res;
+
+ of_address_to_resource(np, 0, &res);
+ bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+ of_node_put(np);
+ }
+
+#ifdef CONFIG_PCI
+ for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
+ add_bridge(np);
+ ppc_md.pci_exclude_device = mpc83xx_exclude_device;
+#endif
+
+#ifdef CONFIG_QUICC_ENGINE
+ if ((np = of_find_node_by_type(NULL, "qe")) != NULL) {
+ qe_reset();
+ of_node_put(np);
+ }
+
+ if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
+ par_io_init(np);
+ of_node_put(np);
+
+ for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
+ par_io_of_config(np);
+ }
+
+ if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
+ != NULL){
+ /* Reset the Ethernet PHY */
+ bcsr_regs[9] &= ~0x20;
+ udelay(1000);
+ bcsr_regs[9] |= 0x20;
+ iounmap(bcsr_regs);
+ of_node_put(np);
+ }
+
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+static int __init mpc83xx_publish_devices(void)
+{
+ if (machine_is(mpc83xx))
+ of_platform_bus_probe(NULL, NULL, NULL);
+
+ return 0;
+}
+device_initcall(mpc83xx_publish_devices);
+
+void __init mpc83xx_init_IRQ(void)
+{
+
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "ipic");
+ if (!np)
+ return;
+
+ ipic_init(np, 0);
+
+ /* Initialize the default interrupt mapping priorities,
+ * in case the boot rom changed something on us.
+ */
+ ipic_set_default_priority();
+ of_node_put(np);
+
+#ifdef CONFIG_QUICC_ENGINE
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+
+ qe_ic_init(np, 0);
+ of_node_put(np);
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
+extern ulong ds1374_get_rtc_time(void);
+extern int ds1374_set_rtc_time(ulong);
+
+static int __init mpc83xx_rtc_hookup(void)
+{
+ struct timespec tv;
+
+ ppc_md.get_rtc_time = ds1374_get_rtc_time;
+ ppc_md.set_rtc_time = ds1374_set_rtc_time;
+
+ tv.tv_nsec = 0;
+ tv.tv_sec = (ppc_md.get_rtc_time) ();
+ do_settimeofday(&tv);
+
+ return 0;
+}
+
+late_initcall(mpc83xx_rtc_hookup);
+#endif
--
1.4.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 17:36 Kim Phillips
@ 2006-12-12 18:03 ` Kumar Gala
0 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-12 18:03 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
On Dec 12, 2006, at 11:36 AM, Kim Phillips wrote:
> Eliminate code redundancy. mpc83[246]x_{mds,itx,sys,pb} files merged
> into a single setup.c. machine definitions moved to machdefs.c with
> corresponding probe fns. This patch also utilizes
> of_platform_bus_probe()
> in lieu of manually calling of_platform_device_create for each
> ucc_geth device.
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
>
> arch/powerpc/kernel/of_platform.c | 1 +
> arch/powerpc/platforms/83xx/Makefile | 6 +-
> arch/powerpc/platforms/83xx/machdefs.c | 126 +++++++++++++++
> arch/powerpc/platforms/83xx/mpc832x_mds.c | 232
> ----------------------------
> arch/powerpc/platforms/83xx/mpc832x_mds.h | 19 ---
> arch/powerpc/platforms/83xx/mpc834x_itx.c | 121 ---------------
> arch/powerpc/platforms/83xx/mpc834x_itx.h | 23 ---
> arch/powerpc/platforms/83xx/mpc834x_sys.c | 140 -----------------
> arch/powerpc/platforms/83xx/mpc834x_sys.h | 23 ---
> arch/powerpc/platforms/83xx/mpc8360e_pb.c | 236
> -----------------------------
> arch/powerpc/platforms/83xx/mpc83xx.h | 2 +
> arch/powerpc/platforms/83xx/setup.c | 188 ++++++++++++++++++
> +++++
> 12 files changed, 318 insertions(+), 799 deletions(-)
We should split machdefs into <BOARD>.c and then fixup the Kconfig to
you can build all of them together? I think this would be more clear
and makes for good examples on how a custom board port should go.
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 2:29 ` Benjamin Herrenschmidt
2006-12-12 2:31 ` Kumar Gala
@ 2006-12-12 21:30 ` Scott Wood
2006-12-12 21:47 ` Benjamin Herrenschmidt
2006-12-12 22:03 ` Kumar Gala
1 sibling, 2 replies; 43+ messages in thread
From: Scott Wood @ 2006-12-12 21:30 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
Benjamin Herrenschmidt wrote:
> Well, either you want all freescale boards have one platform.
> in which case you write one ppc_md() structure, call it
> mpc83xx_fslboards or something like that, and have a probe routine that
> test for all matches, or create as many ppc_md structures as you have
> boards each with it's own probe().
>
> The point here is that other developpers making their own mpc83xx based
> boards will not want to use your ppc_md.
They *may* not want to (and they certainly shouldn't be forced to), but
some may not want to define a new ppc_md (or modify a probe function)
for every new board if all of the differences are encapsulated in the
device tree. I thought one of the main goals of having a device tree is
that if it's done right, the kernel need not know about every single
model of board, just the different components that a device tree can
specify.
If a board has truly board-specific logic that needs custom code in the
kernel itself (rather than the bootloader), then it can go in as a
driver with a device tree node (this should be done with the BCSR stuff
where needed).
What about something like the original patch, but with "mpc83xx-generic"
(or similar) as the compatible match? This would address the "matches
everything with mpc83xx in it" concern, without requiring kernel changes
when a new device tree is all that's really needed, and without
requiring non-freescale boards to have something like "fslboards" in the
compatible property just in order to use generic platform
initialization code *if they want to*. Once the BCSR and RTC stuff is
(re)moved, there's really not much of anything fslboard-specific in there.
More generally (and longer-term), what about a completely generic
platform init file that implements the "booting-without-of.txt"
platform? That is, a string that can be placed in the compatible
property, regardless of board or CPU, in order to assert that nothing
board-specific has to be done other than as specified by the device
tree. The model property could still hold the actual board ID if needed
to present to the user, or for matching a more specialized machine
description if problems arise and the device tree cannot be easily
changed (the generic probe could be arranged to run last).
Alternately, just allow the kernel to boot without finding a matching
probe, if generic code is able to extract enough information from the
device tree for generic versions of any non-optional ppc_md functions to
work. If a probe does match, then it can fill in any ppc_md fields it
wants to override (and/or do special initialization, etc). ppc_md
fields can also be filled in by CPU-specific code, or by drivers the
device tree instantiates.
-Scott
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 21:30 ` Scott Wood
@ 2006-12-12 21:47 ` Benjamin Herrenschmidt
2006-12-12 22:06 ` Kumar Gala
2006-12-12 22:03 ` Kumar Gala
1 sibling, 1 reply; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-12 21:47 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
> >
> > The point here is that other developpers making their own mpc83xx based
> > boards will not want to use your ppc_md.
>
> They *may* not want to (and they certainly shouldn't be forced to), but
> some may not want to define a new ppc_md (or modify a probe function)
> for every new board if all of the differences are encapsulated in the
> device tree. I thought one of the main goals of having a device tree is
> that if it's done right, the kernel need not know about every single
> model of board, just the different components that a device tree can
> specify.
That's the ideal situation yes. However, from a more realistic point of
view, I do expect embedded vendors to have their own ppc_md (though it
may cover multiple boards from that vendor). For things like board
specific initialisations, magic GPIOs, reset lines, etc...
The problem with Kim initial patch is that it matches on anything that
says "mpc83xx", thus you completely lose the ability to match somethign
else unless you remove that property, which I find a bit gross.
I do prefer the middle ground approach he (and you) proposed to have an
"mpc83xx_generic" in the compatible property and match on that, but I'm
not 100% certain we are really there yet and I would have been a bit
more comfortable limiting that to known fsl boards. But you are the guys
to maintain those things, so do as you like there.
> More generally (and longer-term), what about a completely generic
> platform init file that implements the "booting-without-of.txt"
> platform? That is, a string that can be placed in the compatible
> property, regardless of board or CPU, in order to assert that nothing
> board-specific has to be done other than as specified by the device
> tree. The model property could still hold the actual board ID if needed
> to present to the user, or for matching a more specialized machine
> description if problems arise and the device tree cannot be easily
> changed (the generic probe could be arranged to run last).
>
> Alternately, just allow the kernel to boot without finding a matching
> probe, if generic code is able to extract enough information from the
> device tree for generic versions of any non-optional ppc_md functions to
> work. If a probe does match, then it can fill in any ppc_md fields it
> wants to override (and/or do special initialization, etc). ppc_md
> fields can also be filled in by CPU-specific code, or by drivers the
> device tree instantiates.
That's sort of a very long term ideal, yes, but again, we aren't quite
there and I'd rather not try to go too fast in that direction. We still
have plenty of stuff to port over from arch/ppc, cleanups to do (like
merging the PCI code, the kernel init code) etc... before we should
spend too much time on that I think.
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 21:30 ` Scott Wood
2006-12-12 21:47 ` Benjamin Herrenschmidt
@ 2006-12-12 22:03 ` Kumar Gala
2006-12-12 22:41 ` Scott Wood
1 sibling, 1 reply; 43+ messages in thread
From: Kumar Gala @ 2006-12-12 22:03 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Dec 12, 2006, at 3:30 PM, Scott Wood wrote:
> Benjamin Herrenschmidt wrote:
>> Well, either you want all freescale boards have one platform.
>> in which case you write one ppc_md() structure, call it
>> mpc83xx_fslboards or something like that, and have a probe routine
>> that
>> test for all matches, or create as many ppc_md structures as you have
>> boards each with it's own probe().
>>
>> The point here is that other developpers making their own mpc83xx
>> based
>> boards will not want to use your ppc_md.
>
> They *may* not want to (and they certainly shouldn't be forced to),
> but
> some may not want to define a new ppc_md (or modify a probe function)
> for every new board if all of the differences are encapsulated in the
> device tree. I thought one of the main goals of having a device
> tree is
> that if it's done right, the kernel need not know about every single
> model of board, just the different components that a device tree can
> specify.
That's true, and if that's the case you'd just set your "model" to
match an existing supported ppc_md.
> If a board has truly board-specific logic that needs custom code in
> the
> kernel itself (rather than the bootloader), then it can go in as a
> driver with a device tree node (this should be done with the BCSR
> stuff
> where needed).
This is not always the case, there are times when you have board
specific modifications you make in the early kernel code. There are
a number of different reasons you would want to do this. The BCSR
stuff you reference is a Freescale board specific feature.
> What about something like the original patch, but with "mpc83xx-
> generic"
> (or similar) as the compatible match? This would address the "matches
> everything with mpc83xx in it" concern, without requiring kernel
> changes
> when a new device tree is all that's really needed, and without
> requiring non-freescale boards to have something like "fslboards"
> in the
> compatible property just in order to use generic platform
> initialization code *if they want to*. Once the BCSR and RTC stuff is
> (re)moved, there's really not much of anything fslboard-specific in
> there.
True, but I dont see what the desire is to create a 'generic' 83xx
support. Who gets to define what is considered 'generic'? What
issue are you guys trying to solve?
Once upon a time I thought the concept of a generic board and such
was a good thing. After many a discussion with DanM, I've been
convinced there isn't that much utility to it in the embedded space :).
If there is some real issue you guys are thinking about, lets talk
about it. But the concept of 'generic' 83xx board support is as
useless waste of time. I'm all for refactoring code so my board code
is simpler, but at the end of the day I know there are people that
are going to need board specific code for their environments.
- kumar
> More generally (and longer-term), what about a completely generic
> platform init file that implements the "booting-without-of.txt"
> platform? That is, a string that can be placed in the compatible
> property, regardless of board or CPU, in order to assert that nothing
> board-specific has to be done other than as specified by the device
> tree. The model property could still hold the actual board ID if
> needed
> to present to the user, or for matching a more specialized machine
> description if problems arise and the device tree cannot be easily
> changed (the generic probe could be arranged to run last).
>
> Alternately, just allow the kernel to boot without finding a matching
> probe, if generic code is able to extract enough information from the
> device tree for generic versions of any non-optional ppc_md
> functions to
> work. If a probe does match, then it can fill in any ppc_md fields it
> wants to override (and/or do special initialization, etc). ppc_md
> fields can also be filled in by CPU-specific code, or by drivers the
> device tree instantiates.
>
> -Scott
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 21:47 ` Benjamin Herrenschmidt
@ 2006-12-12 22:06 ` Kumar Gala
2006-12-12 22:24 ` Kim Phillips
0 siblings, 1 reply; 43+ messages in thread
From: Kumar Gala @ 2006-12-12 22:06 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Dec 12, 2006, at 3:47 PM, Benjamin Herrenschmidt wrote:
>>>
>>> The point here is that other developpers making their own mpc83xx
>>> based
>>> boards will not want to use your ppc_md.
>>
>> They *may* not want to (and they certainly shouldn't be forced
>> to), but
>> some may not want to define a new ppc_md (or modify a probe function)
>> for every new board if all of the differences are encapsulated in the
>> device tree. I thought one of the main goals of having a device
>> tree is
>> that if it's done right, the kernel need not know about every single
>> model of board, just the different components that a device tree can
>> specify.
>
> That's the ideal situation yes. However, from a more realistic
> point of
> view, I do expect embedded vendors to have their own ppc_md (though it
> may cover multiple boards from that vendor). For things like board
> specific initialisations, magic GPIOs, reset lines, etc...
>
> The problem with Kim initial patch is that it matches on anything that
> says "mpc83xx", thus you completely lose the ability to match
> somethign
> else unless you remove that property, which I find a bit gross.
>
> I do prefer the middle ground approach he (and you) proposed to
> have an
> "mpc83xx_generic" in the compatible property and match on that, but
> I'm
> not 100% certain we are really there yet and I would have been a bit
> more comfortable limiting that to known fsl boards. But you are the
> guys
> to maintain those things, so do as you like there.
I'm against the idea of "mpc83xx_generic" if they want to introduce a
"mpc83xx_freescale" or "mpc83xx_fsl_generic" I'm fine with that, but
there is not such thing as a "mpc83xx_generic".
- kumar
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:06 ` Kumar Gala
@ 2006-12-12 22:24 ` Kim Phillips
2006-12-12 22:28 ` Kumar Gala
0 siblings, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-12 22:24 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Tue, 12 Dec 2006 16:06:41 -0600
Kumar Gala <galak@kernel.crashing.org> wrote:
>
> > I do prefer the middle ground approach he (and you) proposed to
> > have an
> > "mpc83xx_generic" in the compatible property and match on that, but
> > I'm
> > not 100% certain we are really there yet and I would have been a bit
> > more comfortable limiting that to known fsl boards. But you are the
> > guys
> > to maintain those things, so do as you like there.
>
> I'm against the idea of "mpc83xx_generic" if they want to introduce a
> "mpc83xx_freescale" or "mpc83xx_fsl_generic" I'm fine with that, but
> there is not such thing as a "mpc83xx_generic".
I took a look at the TQM8349 code, and it looks like it will be identical in the platform code space. That would subtract the 'fsl' part from the equation. How about 'mpc83xx_eval'? btw, this would be taking us back to the original patch, which I like since I personally don't want to see one file per eval board (I could ifdef protect platforms in machdefs.c if that works for you).
Kim
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:24 ` Kim Phillips
@ 2006-12-12 22:28 ` Kumar Gala
2006-12-12 22:38 ` Kim Phillips
2006-12-12 22:40 ` Scott Wood
0 siblings, 2 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-12 22:28 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
On Dec 12, 2006, at 4:24 PM, Kim Phillips wrote:
> On Tue, 12 Dec 2006 16:06:41 -0600
> Kumar Gala <galak@kernel.crashing.org> wrote:
>
>>
>>> I do prefer the middle ground approach he (and you) proposed to
>>> have an
>>> "mpc83xx_generic" in the compatible property and match on that, but
>>> I'm
>>> not 100% certain we are really there yet and I would have been a bit
>>> more comfortable limiting that to known fsl boards. But you are the
>>> guys
>>> to maintain those things, so do as you like there.
>>
>> I'm against the idea of "mpc83xx_generic" if they want to introduce a
>> "mpc83xx_freescale" or "mpc83xx_fsl_generic" I'm fine with that, but
>> there is not such thing as a "mpc83xx_generic".
>
> I took a look at the TQM8349 code, and it looks like it will be
> identical in the platform code space. That would subtract the
> 'fsl' part from the equation. How about 'mpc83xx_eval'? btw, this
> would be taking us back to the original patch, which I like since I
> personally don't want to see one file per eval board (I could ifdef
> protect platforms in machdefs.c if that works for you).
What's the issue with a file per board if all it has is the ppc_md/
define_machine() in it. Someone explain to me why this is a bad thing?
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:28 ` Kumar Gala
@ 2006-12-12 22:38 ` Kim Phillips
2006-12-12 22:44 ` Benjamin Herrenschmidt
2006-12-12 22:40 ` Scott Wood
1 sibling, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-12 22:38 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Tue, 12 Dec 2006 16:28:38 -0600
Kumar Gala <galak@kernel.crashing.org> wrote:
>
> On Dec 12, 2006, at 4:24 PM, Kim Phillips wrote:
>
> > On Tue, 12 Dec 2006 16:06:41 -0600
> > Kumar Gala <galak@kernel.crashing.org> wrote:
> >
> >>
> >>> I do prefer the middle ground approach he (and you) proposed to
> >>> have an
> >>> "mpc83xx_generic" in the compatible property and match on that, but
> >>> I'm
> >>> not 100% certain we are really there yet and I would have been a bit
> >>> more comfortable limiting that to known fsl boards. But you are the
> >>> guys
> >>> to maintain those things, so do as you like there.
> >>
> >> I'm against the idea of "mpc83xx_generic" if they want to introduce a
> >> "mpc83xx_freescale" or "mpc83xx_fsl_generic" I'm fine with that, but
> >> there is not such thing as a "mpc83xx_generic".
> >
> > I took a look at the TQM8349 code, and it looks like it will be
> > identical in the platform code space. That would subtract the
> > 'fsl' part from the equation. How about 'mpc83xx_eval'? btw, this
> > would be taking us back to the original patch, which I like since I
> > personally don't want to see one file per eval board (I could ifdef
> > protect platforms in machdefs.c if that works for you).
>
> What's the issue with a file per board if all it has is the ppc_md/
> define_machine() in it. Someone explain to me why this is a bad thing?
>
well it depends on what you do with the _probe()s. If you have multiple define_machine definitions built in, the generic probe will always succeed to match on the first machine probe_machine() tests, which may or may not be the machine it's currently running on.
Kim
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:28 ` Kumar Gala
2006-12-12 22:38 ` Kim Phillips
@ 2006-12-12 22:40 ` Scott Wood
2006-12-13 0:23 ` Kumar Gala
1 sibling, 1 reply; 43+ messages in thread
From: Scott Wood @ 2006-12-12 22:40 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Kumar Gala wrote:
> What's the issue with a file per board if all it has is the ppc_md/
> define_machine() in it. Someone explain to me why this is a bad thing?
It requires that the kernel be changed even when a new board doesn't
require that the kernel actually *do* anything differently. It's
gratuitous duplication, even if the bit being duplicated is small.
Why is a single ppc_md, which no board is forced to use, but can be used
by any board without special requirements, a bad thing?
-Scott
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:03 ` Kumar Gala
@ 2006-12-12 22:41 ` Scott Wood
2006-12-12 22:46 ` Benjamin Herrenschmidt
2006-12-13 0:20 ` Kumar Gala
0 siblings, 2 replies; 43+ messages in thread
From: Scott Wood @ 2006-12-12 22:41 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Kumar Gala wrote:
> On Dec 12, 2006, at 3:30 PM, Scott Wood wrote:
>> They *may* not want to (and they certainly shouldn't be forced to), but
>> some may not want to define a new ppc_md (or modify a probe function)
>> for every new board if all of the differences are encapsulated in the
>> device tree. I thought one of the main goals of having a device tree is
>> that if it's done right, the kernel need not know about every single
>> model of board, just the different components that a device tree can
>> specify.
>
> That's true, and if that's the case you'd just set your "model" to
> match an existing supported ppc_md.
Having an 831x explicitly claim to be an 834x is just a tad icky...
>> If a board has truly board-specific logic that needs custom code in the
>> kernel itself (rather than the bootloader), then it can go in as a
>> driver with a device tree node (this should be done with the BCSR stuff
>> where needed).
>
> This is not always the case, there are times when you have board
> specific modifications you make in the early kernel code.
Sure -- I'm not proposing doing away with board-specific machine
descriptions entirely, just reducing the circumstances where they're
required.
> True, but I dont see what the desire is to create a 'generic' 83xx
> support. Who gets to define what is considered 'generic'?
"Generic" is any board that has needs that aren't expressed in the
device tree.
> I'm all for refactoring code so my board code
> is simpler, but at the end of the day I know there are people that are
> going to need board specific code for their environments.
And an 83xx-generic machine description does not stop them from doing
so. "Generic" does not mean "universal". It means "there's nothing
special about this board". If you need board-specific code in the
kernel, then don't label it generic.
-Scott
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:38 ` Kim Phillips
@ 2006-12-12 22:44 ` Benjamin Herrenschmidt
2006-12-12 22:51 ` Kim Phillips
0 siblings, 1 reply; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-12 22:44 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
> well it depends on what you do with the _probe()s. If you have multiple define_machine definitions built in, the generic probe will always succeed to match on the first machine probe_machine() tests, which may or may not be the machine it's currently running on.
Which is an argument for _NOT_ doing a generic probe !
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:41 ` Scott Wood
@ 2006-12-12 22:46 ` Benjamin Herrenschmidt
2006-12-13 0:20 ` Kumar Gala
1 sibling, 0 replies; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-12 22:46 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Tue, 2006-12-12 at 16:41 -0600, Scott Wood wrote:
> Kumar Gala wrote:
> > On Dec 12, 2006, at 3:30 PM, Scott Wood wrote:
> >> They *may* not want to (and they certainly shouldn't be forced to), but
> >> some may not want to define a new ppc_md (or modify a probe function)
> >> for every new board if all of the differences are encapsulated in the
> >> device tree. I thought one of the main goals of having a device tree is
> >> that if it's done right, the kernel need not know about every single
> >> model of board, just the different components that a device tree can
> >> specify.
> >
> > That's true, and if that's the case you'd just set your "model" to
> > match an existing supported ppc_md.
>
> Having an 831x explicitly claim to be an 834x is just a tad icky...
Indeed, but "compatible" doesn't mean exact match and can be a list. In
fact, it should probably be the other way around, that is 834x claim to
be compatible with 831x... something like:
"834x\0831x\083xx" (with appropriate board name appended of course).
> And an 83xx-generic machine description does not stop them from doing
> so. "Generic" does not mean "universal". It means "there's nothing
> special about this board". If you need board-specific code in the
> kernel, then don't label it generic.
As long as you are careful enough so that your "generic" ppc_md. doesn't
try to match everything with a 83xx in it :-0
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:44 ` Benjamin Herrenschmidt
@ 2006-12-12 22:51 ` Kim Phillips
0 siblings, 0 replies; 43+ messages in thread
From: Kim Phillips @ 2006-12-12 22:51 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev
On Wed, 13 Dec 2006 09:44:38 +1100
Benjamin Herrenschmidt <benh@kernel.crashing.org> wrote:
>
> > well it depends on what you do with the _probe()s. If you have multiple define_machine definitions built in, the generic probe will always succeed to match on the first machine probe_machine() tests, which may or may not be the machine it's currently running on.
>
> Which is an argument for _NOT_ doing a generic probe !
>
> Ben.
>
>
correct, not doing a generic probe with a file per board (if all it has is the ppc_md/ define_machine() in it), is bad. It needs to be accompanied with its _probe(). Isn't that what the question was?
Kim
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:41 ` Scott Wood
2006-12-12 22:46 ` Benjamin Herrenschmidt
@ 2006-12-13 0:20 ` Kumar Gala
1 sibling, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-13 0:20 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Dec 12, 2006, at 4:41 PM, Scott Wood wrote:
> Kumar Gala wrote:
>> On Dec 12, 2006, at 3:30 PM, Scott Wood wrote:
>>> They *may* not want to (and they certainly shouldn't be forced
>>> to), but
>>> some may not want to define a new ppc_md (or modify a probe
>>> function)
>>> for every new board if all of the differences are encapsulated in
>>> the
>>> device tree. I thought one of the main goals of having a device
>>> tree is
>>> that if it's done right, the kernel need not know about every single
>>> model of board, just the different components that a device tree can
>>> specify.
>> That's true, and if that's the case you'd just set your "model"
>> to match an existing supported ppc_md.
>
> Having an 831x explicitly claim to be an 834x is just a tad icky...
>
>>> If a board has truly board-specific logic that needs custom code
>>> in the
>>> kernel itself (rather than the bootloader), then it can go in as a
>>> driver with a device tree node (this should be done with the
>>> BCSR stuff
>>> where needed).
>> This is not always the case, there are times when you have board
>> specific modifications you make in the early kernel code.
>
> Sure -- I'm not proposing doing away with board-specific machine
> descriptions entirely, just reducing the circumstances where
> they're required.
And I'm asking why we are arguing over 10-15 lines of code per board.
>> True, but I dont see what the desire is to create a 'generic'
>> 83xx support. Who gets to define what is considered 'generic'?
>
> "Generic" is any board that has needs that aren't expressed in the
> device tree.
Which device tree specification? The one today, the one six months
ago, the one six months from now? The concept is ever changing and
doesn't provide much value.
>> I'm all for refactoring code so my board code is simpler, but at
>> the end of the day I know there are people that are going to need
>> board specific code for their environments.
>
> And an 83xx-generic machine description does not stop them from
> doing so. "Generic" does not mean "universal". It means "there's
> nothing special about this board". If you need board-specific code
> in the kernel, then don't label it generic.
But what value does this have? 83xx, and the majority of freescale's
devices are not put into something as standard as a desktop computer.
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-12 22:40 ` Scott Wood
@ 2006-12-13 0:23 ` Kumar Gala
2006-12-13 5:25 ` Geoff Thorpe
0 siblings, 1 reply; 43+ messages in thread
From: Kumar Gala @ 2006-12-13 0:23 UTC (permalink / raw)
To: Scott Wood; +Cc: linuxppc-dev
On Dec 12, 2006, at 4:40 PM, Scott Wood wrote:
> Kumar Gala wrote:
>> What's the issue with a file per board if all it has is the
>> ppc_md/ define_machine() in it. Someone explain to me why this is
>> a bad thing?
>
> It requires that the kernel be changed even when a new board
> doesn't require that the kernel actually *do* anything
> differently. It's gratuitous duplication, even if the bit being
> duplicated is small.
But at least someone had to think about the duplication and it
provides remove for customization if its needed in the future.
> Why is a single ppc_md, which no board is forced to use, but can be
> used by any board without special requirements, a bad thing?
It adds code to all those people that don't need it just so we don't
duplicate a few lines of source code.
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-13 0:23 ` Kumar Gala
@ 2006-12-13 5:25 ` Geoff Thorpe
2006-12-13 6:07 ` Kumar Gala
0 siblings, 1 reply; 43+ messages in thread
From: Geoff Thorpe @ 2006-12-13 5:25 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
Kumar Gala wrote:
>It adds code to all those people that don't need it just so we don't
>duplicate a few lines of source code.
>
>
Sounds like you're describing the raison d'être for device-trees though?
After all, if you want to build a kernel that supports these minor h/w
variations depending on the device-tree it's booted with, then the "few
lines of duplicated source code" you're talking about would also "add
code to all those people that don't need it".
Kumar Gala also wrote:
>On Dec 12, 2006, at 4:41 PM, Scott Wood wrote:
>
>
>>And an 83xx-generic machine description does not stop them from
>>doing so. "Generic" does not mean "universal". It means "there's
>>nothing special about this board". If you need board-specific code
>>in the kernel, then don't label it generic.
>>
>>
>
>But what value does this have? 83xx, and the majority of freescale's
>devices are not put into something as standard as a desktop computer.
>
>
Then what value do device-trees have at all? Why require new code for
new h/w if it's technically unnecessary? If I've understood correctly (I
confess to not having followed all of the discussion nor the finer
technical points), this would require new code to find its way
"upstream" (to whoever/wherever/whatever that means) from freescale and
then downstream to it's user before the h/w is supported, when this
situation is precisely what device-trees apparently ought to resolve.
Maybe I'm missing something (quite possible). Ben's objection seemed to
be one of naming, but yours seems to be that new h/w should require new
code because it's not wintel fodder for desktop grannies? So why bother
separating h/w description from the compiled kernel in the first place?
Cheers,
Geoff
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-13 5:25 ` Geoff Thorpe
@ 2006-12-13 6:07 ` Kumar Gala
2006-12-13 17:48 ` Geoff Thorpe
` (2 more replies)
0 siblings, 3 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-13 6:07 UTC (permalink / raw)
To: Geoff Thorpe; +Cc: linuxppc-dev
On Dec 12, 2006, at 11:25 PM, Geoff Thorpe wrote:
> Kumar Gala wrote:
>
>> It adds code to all those people that don't need it just so we =20
>> don't duplicate a few lines of source code.
>>
>
> Sounds like you're describing the raison d'=EAtre for device-trees =20
> though? After all, if you want to build a kernel that supports =20
> these minor h/w variations depending on the device-tree it's booted =20=
> with, then the "few lines of duplicated source code" you're talking =20=
> about would also "add code to all those people that don't need it".
No, because those people (myself included) wouldn't build in support =20
for the freescale referend boards into the kernel I'm building for my =20=
custom board.
My question has been what's the value in trying to save a few lines =20
of code for the reference boards. The idea of a generic board =20
doesn't make sense in the embedded space. Just because the reference =20=
boards for mpc83xx look similar doesn't mean anything else using it =20
will. I know both of the boards I've worked would and still do =20
require custom code.
The reason for the custom code is the device tree doesn't describe =20
all variants of all hardware. Its just not spec'd that far. How do =20
you describe the FPGA and local bus interface to it on my board? How =20
do you describe the compact flash drive on localbus? How do you =20
describe the microcontroller connect over SPI? You dont because =20
there isn't any spec. The majority of developers dont have the time =20
to spend trying to come up with one to solve their specific problem =20
so they hard code some solution that works for them.
Over time will we improve the spec, it will cover more cases and =20
that's great, but trying to come up with some generic board port =20
right now is a waste of time. There are a ton of better things to be =20=
spending your guys time on.
I've yet to see anything that describes any real value to a customer.
> Kumar Gala also wrote:
>
>> On Dec 12, 2006, at 4:41 PM, Scott Wood wrote:
>>
>>> And an 83xx-generic machine description does not stop them from =20
>>> doing so. "Generic" does not mean "universal". It means =20
>>> "there's nothing special about this board". If you need board-=20
>>> specific code in the kernel, then don't label it generic.
>>>
>>
>> But what value does this have? 83xx, and the majority of =20
>> freescale's devices are not put into something as standard as a =20
>> desktop computer.
>
> Then what value do device-trees have at all? Why require new code =20
> for new h/w if it's technically unnecessary? If I've understood =20
> correctly (I confess to not having followed all of the discussion =20
> nor the finer technical points), this would require new code to =20
> find its way "upstream" (to whoever/wherever/whatever that means) =20
> from freescale and then downstream to it's user before the h/w is =20
> supported, when this situation is precisely what device-trees =20
> apparently ought to resolve.
This is partial true, but if freescale puts out a new processor/board =20=
there is some expectation that its going to require some new code. =20
If nothing else it's going to require a device-tree be provided. If =20
the concern is about how long it takes to support new HW for existing =20=
functionality I think that's BS.
> Maybe I'm missing something (quite possible). Ben's objection =20
> seemed to be one of naming, but yours seems to be that new h/w =20
> should require new code because it's not wintel fodder for desktop =20
> grannies? So why bother separating h/w description from the =20
> compiled kernel in the first place?
My argument is that trying to describe all HW variants for embedded =20
systems in the device tree is never going to happen. Describing the =20
generality of devices on SoC is useful because everyone has to deal =20
with that. Once you start going past that you get into trouble =20
because of all the various ways people hook things up to busses.
There are a number of subtle reasons I think a generic port is =20
pointless and the only arguments I've heard are some concern about =20
duplication of code and the ability to boot a kernel w/o modification =20=
on new HW.
The duplication code I believe is a style issue and we can reduce the =20=
duplication to a minimum. The ability to boot a kernel w/o =20
modification on new HW is a nice to have, but I dont see this as =20
providing any "real value".
I'd rather see people spending time on problems which need solutions =20
and this isn't one of them.
- k=
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-13 6:07 ` Kumar Gala
@ 2006-12-13 17:48 ` Geoff Thorpe
2006-12-13 18:21 ` Kim Phillips
2006-12-13 21:13 ` Dan Malek
2 siblings, 0 replies; 43+ messages in thread
From: Geoff Thorpe @ 2006-12-13 17:48 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
'day,
I'm inclined to defer to the maintainer's prerogative of judging the
acceptability of code. :-) Thanks for responding.
However I have a couple of little responses regarding other matters;
Kumar Gala wrote:
> There are a number of subtle reasons I think a generic port is
> pointless and the only arguments I've heard are some concern about
> duplication of code and the ability to boot a kernel w/o modification
> on new HW.
To each their own "concern" I guess. "Duplication of code and the
ability to boot a kernel w/o modification on new HW" both seem like
pretty legitimate concerns to me. That this may or may not be acceptable
on a technical level should be the focus, but it seems irrational to
presume to stipulate what interests/concerns other hackers should and
should not have? This is linux, not windows.
> The duplication code I believe is a style issue and we can reduce the
> duplication to a minimum. The ability to boot a kernel w/o
> modification on new HW is a nice to have, but I dont see this as
> providing any "real value".
Same comment.
> I'd rather see people spending time on problems which need solutions
> and this isn't one of them.
Um, with all due respect. You are invoking what could only be described
as "employer's privilege". I doubt the concern here came purely from
someone having nothing better to do and being totally lost for ideas. No
doubt they'll correct me if I'm wrong :-)
I have no comment on your technical objections, only the(se)
non-technical one(s).
(Seasonal) cheers,
Geoff
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-13 6:07 ` Kumar Gala
2006-12-13 17:48 ` Geoff Thorpe
@ 2006-12-13 18:21 ` Kim Phillips
2006-12-13 21:13 ` Dan Malek
2 siblings, 0 replies; 43+ messages in thread
From: Kim Phillips @ 2006-12-13 18:21 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Wed, 13 Dec 2006 00:07:43 -0600
Kumar Gala <galak@kernel.crashing.org> wrote:
>=20
> On Dec 12, 2006, at 11:25 PM, Geoff Thorpe wrote:
>=20
> > Kumar Gala wrote:
> >
> >> It adds code to all those people that don't need it just so we =20
> >> don't duplicate a few lines of source code.
> >>
> >
> > Sounds like you're describing the raison d'=EAtre for device-trees =20
> > though? After all, if you want to build a kernel that supports =20
> > these minor h/w variations depending on the device-tree it's booted =20
> > with, then the "few lines of duplicated source code" you're talking =20
> > about would also "add code to all those people that don't need it".
>=20
> No, because those people (myself included) wouldn't build in support =20
> for the freescale referend boards into the kernel I'm building for my =20
> custom board.
my understanding is that embedded developers would *add* code to the generi=
c platform code base that this exercise proves exists.
>=20
> My question has been what's the value in trying to save a few lines =20
> of code for the reference boards. The idea of a generic board =20
> doesn't make sense in the embedded space. Just because the reference =20
> boards for mpc83xx look similar doesn't mean anything else using it =20
> will. I know both of the boards I've worked would and still do =20
> require custom code.
the boards aren't that similar, it's just that all board specific code has =
actually migrated to the right place for it; it now goes where it belongs, =
e.g. RTCs go to the RTC subsystem, PHYs go the PHY layer, etc.
>=20
> The reason for the custom code is the device tree doesn't describe =20
> all variants of all hardware. Its just not spec'd that far. How do =20
> you describe the FPGA and local bus interface to it on my board? How =20
> do you describe the compact flash drive on localbus? How do you =20
> describe the microcontroller connect over SPI? You dont because =20
> there isn't any spec. The majority of developers dont have the time =20
> to spend trying to come up with one to solve their specific problem =20
> so they hard code some solution that works for them.
this has always been the case, and we're not changing that. You can still a=
dd code to support unspec'ed functionality. We're just trying to refactor t=
he code for its obvious benefits.
>=20
> Over time will we improve the spec, it will cover more cases and =20
> that's great, but trying to come up with some generic board port =20
> right now is a waste of time. There are a ton of better things to be =20
> spending your guys time on.
>=20
> I've yet to see anything that describes any real value to a customer.
The ability to have a single kernel run on multiple boards is of value, esp=
. if the only thing preventing that from happening is a strcmp between a ke=
rnel string and a string in the dt (both software sources).
>=20
> > Kumar Gala also wrote:
> >
> >> On Dec 12, 2006, at 4:41 PM, Scott Wood wrote:
> >>
> >>> And an 83xx-generic machine description does not stop them from =20
> >>> doing so. "Generic" does not mean "universal". It means =20
> >>> "there's nothing special about this board". If you need board-=20
> >>> specific code in the kernel, then don't label it generic.
> >>>
> >>
> >> But what value does this have? 83xx, and the majority of =20
> >> freescale's devices are not put into something as standard as a =20
> >> desktop computer.
> >
> > Then what value do device-trees have at all? Why require new code =20
> > for new h/w if it's technically unnecessary? If I've understood =20
> > correctly (I confess to not having followed all of the discussion =20
> > nor the finer technical points), this would require new code to =20
> > find its way "upstream" (to whoever/wherever/whatever that means) =20
> > from freescale and then downstream to it's user before the h/w is =20
> > supported, when this situation is precisely what device-trees =20
> > apparently ought to resolve.
>=20
> This is partial true, but if freescale puts out a new processor/board =20
> there is some expectation that its going to require some new code. =20
> If nothing else it's going to require a device-tree be provided. If =20
> the concern is about how long it takes to support new HW for existing =20
> functionality I think that's BS.
>=20
I don't think it's that, my problem is the redundancy in the code. I wanted=
it gone before we added more :)
> > Maybe I'm missing something (quite possible). Ben's objection =20
> > seemed to be one of naming, but yours seems to be that new h/w =20
> > should require new code because it's not wintel fodder for desktop =20
> > grannies? So why bother separating h/w description from the =20
> > compiled kernel in the first place?
>=20
> My argument is that trying to describe all HW variants for embedded =20
> systems in the device tree is never going to happen. Describing the =20
> generality of devices on SoC is useful because everyone has to deal =20
> with that. Once you start going past that you get into trouble =20
> because of all the various ways people hook things up to busses.
but this patch isn't claiming to do that. It doesn't stop providing a base=
to start from.
> There are a number of subtle reasons I think a generic port is =20
> pointless and the only arguments I've heard are some concern about =20
> duplication of code and the ability to boot a kernel w/o modification =20
> on new HW.
yes, and those are indeed valid points. I for one, have access to multiple=
83xx based boards and would love to not have to build a kernel that has on=
e text in a string preventing it from booting on another.
> The duplication code I believe is a style issue and we can reduce the =20
> duplication to a minimum. The ability to boot a kernel w/o =20
> modification on new HW is a nice to have, but I dont see this as =20
> providing any "real value".
>=20
> I'd rather see people spending time on problems which need solutions =20
> and this isn't one of them.
>=20
sorry, this redundancy has been going on for too long. I brought this issu=
e up a long time ago on this list asking for your opinion and got no respon=
se. Now a new board is here. So how long would you have us submit code ge=
nerated by sed?
Having said all that, I acknowledge your comments. For now, I'm willing to=
settle for at least one line of less redundant code than what's in the tre=
e today. How can we make that happen?
Kim
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-13 6:07 ` Kumar Gala
2006-12-13 17:48 ` Geoff Thorpe
2006-12-13 18:21 ` Kim Phillips
@ 2006-12-13 21:13 ` Dan Malek
2 siblings, 0 replies; 43+ messages in thread
From: Dan Malek @ 2006-12-13 21:13 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list
On Dec 13, 2006, at 1:07 AM, Kumar Gala wrote:
> My question has been what's the value in trying to save a few lines
> of code for the reference boards. The idea of a generic board
> doesn't make sense in the embedded space.
This grand unification of embedded board software just
isn't useful. It's a waste of time for the reference board
developers that should be writing useful device drivers
for the SOC peripherals, and also for those of us trying
to develop real products. I spend way too much time
trying to find configuration options or other indirect
function hooks so the special functions I need to be
performed are done properly.
The current 85xx is a pretty good implementation.
Things that are truly generic are provided as functions
that the individual board port initialization files/functions
can use as needed.
> .... The majority of developers dont have the time
> to spend trying to come up with one to solve their specific problem
> so they hard code some solution that works for them.
Don't make it sound like some "hard code" hack :-)
We just have to write software to support all of these
unique product designs. Many of these boards have
custom external hardware than needs to be controlled
with some special configurations or algorithm. There
are just times I have to toggle a set of GPIOs with a
particular algorithm, for example. This was my comment
about "generic" board ports and device tree a while
ago. The device tree is just an information data base,
it doesn't help me when I really have to write some code
that is unique to a board.
If you want to make similar Freescale boards utilize
common code, that's great. Don't assume any product
will look like one of these boards, no matter how much
you want people to do that. In almost all cases, they
aren't even close due to other product design requirements.
All of these efforts to "help" us develop products by
providing generic board ports with the goal of a single
kernel on multiple boards actually costs us development
time due to the lack of flexibility we need. We just need
a library of generic functions, and then 50 to 100 lines of
"board support" initialization that will initialize custom
hardware, data structures, variables, and then call the
more generic functions. There may be only very minor
differences between the board files, but this simplicity
is much nicer than complex indirect paths to enable
features with cute #defines or other complicated
data structures.
Thanks.
-- Dan
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH] powerpc: consolidate mpc83xx platform files
@ 2006-12-14 1:04 Kim Phillips
2006-12-15 16:09 ` Kumar Gala
0 siblings, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-14 1:04 UTC (permalink / raw)
To: linuxppc-dev
Eliminate platforms/83xx code redundancy. Common mpc83xx code cleaned up
and merged into setup.c. Each board maintains its own machine definition
and corresponding probe fn in its own file. Kconfig modified to allow for
multiple board selection in a single kernel image.
This patch also utilizes of_platform_bus_probe() in lieu of manually
calling of_platform_device_create for each ucc_geth device
(consequently, the QE is added to of_default_bus_ids).
The loops_per_jiffy assignment is removed since udelay now uses the timebase.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
arch/powerpc/kernel/of_platform.c | 1 +
arch/powerpc/platforms/83xx/Kconfig | 6 -
arch/powerpc/platforms/83xx/Makefile | 2 +-
arch/powerpc/platforms/83xx/mpc832x_mds.c | 176 +----------------------------
arch/powerpc/platforms/83xx/mpc832x_mds.h | 19 ---
arch/powerpc/platforms/83xx/mpc834x_itx.c | 92 +++------------
arch/powerpc/platforms/83xx/mpc834x_itx.h | 23 ----
arch/powerpc/platforms/83xx/mpc834x_sys.c | 111 +++---------------
arch/powerpc/platforms/83xx/mpc834x_sys.h | 23 ----
arch/powerpc/platforms/83xx/mpc8360e_pb.c | 175 +----------------------------
arch/powerpc/platforms/83xx/mpc83xx.h | 2 +
arch/powerpc/platforms/83xx/setup.c | 176 +++++++++++++++++++++++++++++
12 files changed, 220 insertions(+), 586 deletions(-)
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 3002ea3..72da78b 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -50,6 +50,7 @@ static struct of_device_id of_default_bu
{ .type = "plb5", },
{ .type = "plb4", },
{ .type = "opb", },
+ { .type = "qe", },
{},
};
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index edcd5b8..c236dff 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -1,10 +1,6 @@
menu "Platform support"
depends on PPC_83xx
-choice
- prompt "Machine Type"
- default MPC834x_SYS
-
config MPC832x_MDS
bool "Freescale MPC832x MDS"
select DEFAULT_UIMAGE
@@ -39,8 +35,6 @@ config MPC8360E_PB
help
This option enables support for the MPC836x EMDS Processor Board.
-endchoice
-
config PPC_MPC832x
bool
select PPC_UDBG_16550
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index f1aa7e2..07db146 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for the PowerPC 83xx linux kernel.
#
-obj-y := misc.o
+obj-y := setup.o misc.o
obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index f58c978..37b334c 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -14,33 +14,15 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-#include <asm/of_device.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
#include "mpc83xx.h"
-#include "mpc832x_mds.h"
#undef DEBUG
#ifdef DEBUG
@@ -49,158 +31,6 @@
#define DBG(fmt...)
#endif
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc832x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc832x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- unsigned int *fp =
- (int *)get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc832x_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc832x_declare_of_platform_devices);
-
-void __init mpc832x_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc832x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc832x_rtc_hookup);
-#endif
-
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
@@ -222,8 +52,8 @@ static int __init mpc832x_sys_probe(void
define_machine(mpc832x_mds) {
.name = "MPC832x MDS",
.probe = mpc832x_sys_probe,
- .setup_arch = mpc832x_sys_setup_arch,
- .init_IRQ = mpc832x_sys_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.h b/arch/powerpc/platforms/83xx/mpc832x_mds.h
deleted file mode 100644
index a495889..0000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Description:
- * MPC832x MDS board specific header.
- *
- * 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 __MACH_MPC832x_MDS_H__
-#define __MACH_MPC832x_MDS_H__
-
-extern u8 *get_bcsr(void);
-
-#endif /* __MACH_MPC832x_MDS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 314c42a..5add670 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -15,104 +15,46 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
#include "mpc83xx.h"
-#include <platforms/83xx/mpc834x_sys.h>
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_itx_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_itx_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
#else
- ROOT_DEV = Root_HDA1;
+#define DBG(fmt...)
#endif
-}
-
-void __init mpc834x_itx_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
static int __init mpc834x_itx_probe(void)
{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8349EMITX"))
+ return 0;
+
+ DBG("%s found\n", model);
+
return 1;
}
define_machine(mpc834x_itx) {
.name = "MPC834x ITX",
.probe = mpc834x_itx_probe,
- .setup_arch = mpc834x_itx_setup_arch,
- .init_IRQ = mpc834x_itx_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.h b/arch/powerpc/platforms/83xx/mpc834x_itx.h
deleted file mode 100644
index 174ca4e..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_itx.h
- *
- * MPC834X ITX common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_ITX_H__
-#define __MACH_MPC83XX_ITX_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_ITX_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index 80b735a..93df3ef 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -15,105 +15,21 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
#include "mpc83xx.h"
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-void __init mpc834x_sys_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc834x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc834x_rtc_hookup);
+#define DBG(fmt...)
#endif
/*
@@ -121,17 +37,24 @@ late_initcall(mpc834x_rtc_hookup);
*/
static int __init mpc834x_sys_probe(void)
{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8349EMDS"))
+ return 0;
+
+ DBG("%s found\n", model);
+
return 1;
}
define_machine(mpc834x_sys) {
.name = "MPC834x SYS",
.probe = mpc834x_sys_probe,
- .setup_arch = mpc834x_sys_setup_arch,
- .init_IRQ = mpc834x_sys_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
deleted file mode 100644
index 7d5bbef..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_sys.h
- *
- * MPC834X SYS common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_SYS_H__
-#define __MACH_MPC83XX_SYS_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
index 7bfd47a..f6e9b6a 100644
--- a/arch/powerpc/platforms/83xx/mpc8360e_pb.c
+++ b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
@@ -20,30 +20,13 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-#include <asm/of_device.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
#include "mpc83xx.h"
@@ -54,158 +37,6 @@
#define DBG(fmt...)
#endif
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc8360_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc8360_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc8360_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc8360_declare_of_platform_devices);
-
-void __init mpc8360_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc8360_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc8360_rtc_hookup);
-#endif
-
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
@@ -226,8 +57,8 @@ static int __init mpc8360_sys_probe(void
define_machine(mpc8360_sys) {
.name = "MPC8360E PB",
.probe = mpc8360_sys_probe,
- .setup_arch = mpc8360_sys_setup_arch,
- .init_IRQ = mpc8360_sys_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 01cae10..7419db4 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -13,5 +13,7 @@ extern int add_bridge(struct device_node
extern int mpc83xx_exclude_device(u_char bus, u_char devfn);
extern void mpc83xx_restart(char *cmd);
extern long mpc83xx_time_init(void);
+extern void __init mpc83xx_setup_arch(void);
+extern void __init mpc83xx_init_IRQ(void);
#endif /* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/setup.c b/arch/powerpc/platforms/83xx/setup.c
new file mode 100644
index 0000000..4d59aa0
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/setup.c
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ *
+ * Author: Li Yang <LeoLi@freescale.com>
+ * Yin Olivia <Hong-hua.Yin@freescale.com>
+ *
+ * Description:
+ * MPC83xx board routines.
+ *
+ * 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/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/initrd.h>
+
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/time.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/ipic.h>
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <sysdev/fsl_soc.h>
+#include <asm/qe.h>
+#include <asm/qe_ic.h>
+
+#include "mpc83xx.h"
+
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+#ifndef CONFIG_PCI
+unsigned long isa_io_base = 0;
+unsigned long isa_mem_base = 0;
+#endif
+
+static u8 __iomem *bcsr_regs = NULL;
+
+u8 *get_bcsr(void)
+{
+ return bcsr_regs;
+}
+
+/* ************************************************************************
+ *
+ * Setup the architecture
+ *
+ */
+void __init mpc83xx_setup_arch(void)
+{
+ struct device_node *np;
+
+ if (ppc_md.progress)
+ ppc_md.progress("mpc83xx_setup_arch()", 0);
+
+ /* Map BCSR area */
+ np = of_find_node_by_name(NULL, "bcsr");
+ if (np != 0) {
+ struct resource res;
+
+ of_address_to_resource(np, 0, &res);
+ bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+ of_node_put(np);
+ }
+
+#ifdef CONFIG_PCI
+ for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
+ add_bridge(np);
+ ppc_md.pci_exclude_device = mpc83xx_exclude_device;
+#endif
+
+#ifdef CONFIG_QUICC_ENGINE
+ if ((np = of_find_node_by_type(NULL, "qe")) != NULL) {
+ qe_reset();
+ of_node_put(np);
+ }
+
+ if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
+ par_io_init(np);
+ of_node_put(np);
+
+ for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
+ par_io_of_config(np);
+ }
+
+ if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
+ != NULL){
+ /* Reset the Ethernet PHY */
+ bcsr_regs[9] &= ~0x20;
+ udelay(1000);
+ bcsr_regs[9] |= 0x20;
+ iounmap(bcsr_regs);
+ of_node_put(np);
+ }
+
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+static int __init mpc83xx_publish_devices(void)
+{
+ if (machine_is(mpc83xx))
+ of_platform_bus_probe(NULL, NULL, NULL);
+
+ return 0;
+}
+device_initcall(mpc83xx_publish_devices);
+
+void __init mpc83xx_init_IRQ(void)
+{
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "ipic");
+ if (!np)
+ return;
+
+ ipic_init(np, 0);
+
+ /* Initialize the default interrupt mapping priorities,
+ * in case the boot rom changed something on us.
+ */
+ ipic_set_default_priority();
+ of_node_put(np);
+
+#ifdef CONFIG_QUICC_ENGINE
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+
+ qe_ic_init(np, 0);
+ of_node_put(np);
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
+extern ulong ds1374_get_rtc_time(void);
+extern int ds1374_set_rtc_time(ulong);
+
+static int __init mpc83xx_rtc_hookup(void)
+{
+ struct timespec tv;
+
+ ppc_md.get_rtc_time = ds1374_get_rtc_time;
+ ppc_md.set_rtc_time = ds1374_set_rtc_time;
+
+ tv.tv_nsec = 0;
+ tv.tv_sec = (ppc_md.get_rtc_time) ();
+ do_settimeofday(&tv);
+
+ return 0;
+}
+
+late_initcall(mpc83xx_rtc_hookup);
+#endif
--
1.4.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-14 1:04 [PATCH] powerpc: consolidate mpc83xx platform files Kim Phillips
@ 2006-12-15 16:09 ` Kumar Gala
2006-12-15 17:23 ` Dan Malek
` (2 more replies)
0 siblings, 3 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-15 16:09 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
On Dec 13, 2006, at 7:04 PM, Kim Phillips wrote:
> Eliminate platforms/83xx code redundancy. Common mpc83xx code
> cleaned up
> and merged into setup.c. Each board maintains its own machine
> definition
> and corresponding probe fn in its own file. Kconfig modified to
> allow for
> multiple board selection in a single kernel image.
>
> This patch also utilizes of_platform_bus_probe() in lieu of manually
> calling of_platform_device_create for each ucc_geth device
> (consequently, the QE is added to of_default_bus_ids).
>
> The loops_per_jiffy assignment is removed since udelay now uses the
> timebase.
>
> Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
> ---
> arch/powerpc/kernel/of_platform.c | 1 +
> arch/powerpc/platforms/83xx/Kconfig | 6 -
> arch/powerpc/platforms/83xx/Makefile | 2 +-
> arch/powerpc/platforms/83xx/mpc832x_mds.c | 176
> +----------------------------
> arch/powerpc/platforms/83xx/mpc832x_mds.h | 19 ---
> arch/powerpc/platforms/83xx/mpc834x_itx.c | 92 +++------------
> arch/powerpc/platforms/83xx/mpc834x_itx.h | 23 ----
> arch/powerpc/platforms/83xx/mpc834x_sys.c | 111 +++---------------
> arch/powerpc/platforms/83xx/mpc834x_sys.h | 23 ----
> arch/powerpc/platforms/83xx/mpc8360e_pb.c | 175
> +----------------------------
> arch/powerpc/platforms/83xx/mpc83xx.h | 2 +
> arch/powerpc/platforms/83xx/setup.c | 176 ++++++++++++++++++
> +++++++++++
> 12 files changed, 220 insertions(+), 586 deletions(-)
[snip]
> diff --git a/arch/powerpc/platforms/83xx/setup.c b/arch/powerpc/
> platforms/83xx/setup.c
> new file mode 100644
> index 0000000..4d59aa0
> --- /dev/null
> +++ b/arch/powerpc/platforms/83xx/setup.c
> @@ -0,0 +1,176 @@
> +/*
> + * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights
> reserved.
> + *
> + * Author: Li Yang <LeoLi@freescale.com>
> + * Yin Olivia <Hong-hua.Yin@freescale.com>
> + *
> + * Description:
> + * MPC83xx board routines.
> + *
> + * 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/stddef.h>
> +#include <linux/kernel.h>
> +#include <linux/init.h>
> +#include <linux/errno.h>
> +#include <linux/reboot.h>
> +#include <linux/pci.h>
> +#include <linux/kdev_t.h>
> +#include <linux/major.h>
> +#include <linux/console.h>
> +#include <linux/delay.h>
> +#include <linux/seq_file.h>
> +#include <linux/root_dev.h>
> +#include <linux/initrd.h>
> +
> +#include <asm/of_device.h>
> +#include <asm/of_platform.h>
> +#include <asm/system.h>
> +#include <asm/atomic.h>
> +#include <asm/time.h>
> +#include <asm/io.h>
> +#include <asm/machdep.h>
> +#include <asm/ipic.h>
> +#include <asm/bootinfo.h>
> +#include <asm/irq.h>
> +#include <asm/prom.h>
> +#include <asm/udbg.h>
> +#include <sysdev/fsl_soc.h>
> +#include <asm/qe.h>
> +#include <asm/qe_ic.h>
> +
> +#include "mpc83xx.h"
> +
> +#undef DEBUG
> +#ifdef DEBUG
> +#define DBG(fmt...) udbg_printf(fmt)
> +#else
> +#define DBG(fmt...)
> +#endif
> +
> +#ifndef CONFIG_PCI
> +unsigned long isa_io_base = 0;
> +unsigned long isa_mem_base = 0;
> +#endif
> +
> +static u8 __iomem *bcsr_regs = NULL;
> +
> +u8 *get_bcsr(void)
> +{
> + return bcsr_regs;
> +}
I don't think bcsr code should be setup.c as its not generic, but its
not causing any harm.
> +
> +/*
> **********************************************************************
> **
> + *
> + * Setup the architecture
> + *
> + */
> +void __init mpc83xx_setup_arch(void)
> +{
> + struct device_node *np;
> +
> + if (ppc_md.progress)
> + ppc_md.progress("mpc83xx_setup_arch()", 0);
> +
> + /* Map BCSR area */
> + np = of_find_node_by_name(NULL, "bcsr");
> + if (np != 0) {
> + struct resource res;
> +
> + of_address_to_resource(np, 0, &res);
> + bcsr_regs = ioremap(res.start, res.end - res.start + 1);
> + of_node_put(np);
> + }
> +
> +#ifdef CONFIG_PCI
> + for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
> + add_bridge(np);
> + ppc_md.pci_exclude_device = mpc83xx_exclude_device;
> +#endif
> +
> +#ifdef CONFIG_QUICC_ENGINE
> + if ((np = of_find_node_by_type(NULL, "qe")) != NULL) {
> + qe_reset();
> + of_node_put(np);
> + }
> +
> + if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
> + par_io_init(np);
> + of_node_put(np);
> +
> + for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
> + par_io_of_config(np);
> + }
> +
> + if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
> + != NULL){
> + /* Reset the Ethernet PHY */
> + bcsr_regs[9] &= ~0x20;
> + udelay(1000);
> + bcsr_regs[9] |= 0x20;
> + iounmap(bcsr_regs);
> + of_node_put(np);
> + }
> +
> +#endif /* CONFIG_QUICC_ENGINE */
> +}
> +
> +static int __init mpc83xx_publish_devices(void)
> +{
> + if (machine_is(mpc83xx))
> + of_platform_bus_probe(NULL, NULL, NULL);
> +
Does this every get called, meaning does anything match machine_is
(mpc83xx)?
> + return 0;
> +}
> +device_initcall(mpc83xx_publish_devices);
> +
> +void __init mpc83xx_init_IRQ(void)
> +{
> + struct device_node *np;
> +
> + np = of_find_node_by_type(NULL, "ipic");
> + if (!np)
> + return;
> +
> + ipic_init(np, 0);
> +
> + /* Initialize the default interrupt mapping priorities,
> + * in case the boot rom changed something on us.
> + */
> + ipic_set_default_priority();
> + of_node_put(np);
> +
> +#ifdef CONFIG_QUICC_ENGINE
> + np = of_find_node_by_type(NULL, "qeic");
> + if (!np)
> + return;
> +
> + qe_ic_init(np, 0);
> + of_node_put(np);
> +#endif /* CONFIG_QUICC_ENGINE */
> +}
> +
> +#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
> +extern ulong ds1374_get_rtc_time(void);
> +extern int ds1374_set_rtc_time(ulong);
> +
> +static int __init mpc83xx_rtc_hookup(void)
> +{
> + struct timespec tv;
> +
> + ppc_md.get_rtc_time = ds1374_get_rtc_time;
> + ppc_md.set_rtc_time = ds1374_set_rtc_time;
> +
> + tv.tv_nsec = 0;
> + tv.tv_sec = (ppc_md.get_rtc_time) ();
> + do_settimeofday(&tv);
> +
> + return 0;
> +}
> +
> +late_initcall(mpc83xx_rtc_hookup);
> +#endif
This is sort of evil and we need to clean it up, but we have some
time for 2.6.21. Does the MPC832x MDS have the DS1374?
- k
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-15 16:09 ` Kumar Gala
@ 2006-12-15 17:23 ` Dan Malek
2006-12-18 21:22 ` Benjamin Herrenschmidt
2006-12-15 17:59 ` Olof Johansson
2006-12-18 21:19 ` Benjamin Herrenschmidt
2 siblings, 1 reply; 43+ messages in thread
From: Dan Malek @ 2006-12-15 17:23 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev list
On Dec 15, 2006, at 11:09 AM, Kumar Gala wrote:
>
>> + if (machine_is(mpc83xx))
>> + of_platform_bus_probe(NULL, NULL, NULL);
>> +
>
> Does this every get called, meaning does anything match machine_is
> (mpc83xx)?
I truly dislike this "machine_is" method. Other architectures
do this and it becomes a real PITA. It seems to evolve
into something that never has the proper, useful granularity.
Surprisingly, it often ends up as a guarantee you can't boot
common kernels on similar boards, which is what
I suspect you are trying to achieve.
This is a case where your board specific initialization
should call this, or fill in a ppc_md indirect pointer that
if set is called at the proper time.
Thanks.
-- Dan
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-15 16:09 ` Kumar Gala
2006-12-15 17:23 ` Dan Malek
@ 2006-12-15 17:59 ` Olof Johansson
2006-12-16 1:31 ` Stephen Rothwell
2006-12-18 21:23 ` Benjamin Herrenschmidt
2006-12-18 21:19 ` Benjamin Herrenschmidt
2 siblings, 2 replies; 43+ messages in thread
From: Olof Johansson @ 2006-12-15 17:59 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
On Fri, 15 Dec 2006 10:09:09 -0600 Kumar Gala <galak@kernel.crashing.org> wrote:
> > +#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
> > +extern ulong ds1374_get_rtc_time(void);
> > +extern int ds1374_set_rtc_time(ulong);
> > +
> > +static int __init mpc83xx_rtc_hookup(void)
> > +{
> > + struct timespec tv;
> > +
> > + ppc_md.get_rtc_time = ds1374_get_rtc_time;
> > + ppc_md.set_rtc_time = ds1374_set_rtc_time;
> > +
> > + tv.tv_nsec = 0;
> > + tv.tv_sec = (ppc_md.get_rtc_time) ();
> > + do_settimeofday(&tv);
> > +
> > + return 0;
> > +}
> > +
> > +late_initcall(mpc83xx_rtc_hookup);
> > +#endif
>
> This is sort of evil and we need to clean it up, but we have some
> time for 2.6.21. Does the MPC832x MDS have the DS1374?
s/sort of/pure/
Something like this should work just as well. Seems to work fine on my
system here (that has a DS1338, i.e. ds1307 driver).
Let me know if it works on 83xx and I'll post it with a signed-off-line.
-Olof
Index: linux-2.6/arch/powerpc/Kconfig
===================================================================
--- linux-2.6.orig/arch/powerpc/Kconfig
+++ linux-2.6/arch/powerpc/Kconfig
@@ -600,6 +600,12 @@ config PPC_TODC
---help---
This adds support for many TODC/RTC chips.
+config PPC_GENRTC
+ bool "Generic RTC support"
+ help
+ This adds support for using regular RTC registered with the RTC
+ framework as the main clock on powerpc.
+
endmenu
source arch/powerpc/platforms/embedded6xx/Kconfig
Index: linux-2.6/arch/powerpc/sysdev/Makefile
===================================================================
--- linux-2.6.orig/arch/powerpc/sysdev/Makefile
+++ linux-2.6/arch/powerpc/sysdev/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_40x) += dcr.o
obj-$(CONFIG_U3_DART) += dart_iommu.o
obj-$(CONFIG_MMIO_NVRAM) += mmio_nvram.o
obj-$(CONFIG_FSL_SOC) += fsl_soc.o
+obj-$(CONFIG_PPC_GENRTC) += genrtc.o
obj-$(CONFIG_PPC_TODC) += todc.o
obj-$(CONFIG_TSI108_BRIDGE) += tsi108_pci.o tsi108_dev.o
obj-$(CONFIG_QUICC_ENGINE) += qe_lib/
Index: linux-2.6/arch/powerpc/sysdev/genrtc.c
===================================================================
--- /dev/null
+++ linux-2.6/arch/powerpc/sysdev/genrtc.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) Olof Johansson <olof@lixom.net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <linux/time.h>
+#include <linux/device.h>
+#include <linux/rtc.h>
+
+#include <asm/machdep.h>
+#include <asm/time.h>
+
+static struct class_device *rtc_dev;
+
+static void genrtc_set_rtc_time_work(void *arg);
+
+static struct rtc_time delayed_tm;
+static struct workqueue_struct *rtc_workqueue;
+static DECLARE_WORK(rtc_work, genrtc_set_rtc_time_work, &delayed_tm);
+
+static void genrtc_set_rtc_time_work(void *arg)
+{
+ struct rtc_time *tm = arg;
+ rtc_set_time(rtc_dev, tm);
+}
+
+static int genrtc_set_rtc_time(struct rtc_time *tm)
+{
+ if (in_interrupt()) {
+ /* Can't access RTC with interrupts off, since some of
+ * the drivers might sleep. Delay the setting with a
+ * work queue.
+ */
+ memcpy(&delayed_tm, tm, sizeof(struct rtc_time));
+ queue_work(rtc_workqueue, &rtc_work);
+ return 0;
+ } else
+ return rtc_set_time(rtc_dev, tm);
+}
+
+static void genrtc_get_rtc_time(struct rtc_time *tm)
+{
+ rtc_read_time(rtc_dev, tm);
+}
+
+static int __init genrtc_rtc_hookup(void)
+{
+ /* Don't init if the platform has already set up rtc functions. */
+ if (ppc_md.get_rtc_time || ppc_md.set_rtc_time)
+ return -1;
+
+ rtc_dev = rtc_class_open("rtc0");
+
+ if (!rtc_dev) {
+ printk("genrtc_rtc_hookup: Failed to open rtc0\n");
+ return -1;
+ }
+
+ ppc_md.get_rtc_time = genrtc_get_rtc_time;
+ ppc_md.set_rtc_time = genrtc_set_rtc_time;
+
+ return 0;
+}
+late_initcall(genrtc_rtc_hookup);
+
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-15 17:59 ` Olof Johansson
@ 2006-12-16 1:31 ` Stephen Rothwell
2006-12-18 21:23 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 43+ messages in thread
From: Stephen Rothwell @ 2006-12-16 1:31 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 804 bytes --]
Hi Olaf,
On Fri, 15 Dec 2006 11:59:02 -0600 Olof Johansson <olof@lixom.net> wrote:
>
> +static int __init genrtc_rtc_hookup(void)
> +{
> + /* Don't init if the platform has already set up rtc functions. */
> + if (ppc_md.get_rtc_time || ppc_md.set_rtc_time)
> + return -1;
If this is considered not an error, then please return -ENODEV so that if
initcall_debug is set, the kernel won't consider this worth noting.
> + rtc_dev = rtc_class_open("rtc0");
> +
> + if (!rtc_dev) {
> + printk("genrtc_rtc_hookup: Failed to open rtc0\n");
KERN_ERR?
> + return -1;
init routines should return 0/-<errno number> so that initcall_debug is
useful. Though what Evalue is appropriate here I don't know.
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-11 21:51 ` Kim Phillips
2006-12-11 22:08 ` Kumar Gala
@ 2006-12-18 5:17 ` Paul Mackerras
2006-12-18 17:04 ` Kumar Gala
1 sibling, 1 reply; 43+ messages in thread
From: Paul Mackerras @ 2006-12-18 5:17 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
Kim Phillips writes:
> so the contents of 83xx/fsl.c would look like:
> #ifdef CONFIG_MPC834x_SYS
> define_machine(mpc834x_sys) {
> .name = "MPC834x SYS",
> .probe = mpc83xx_probe,
> .setup_arch = mpc83xx_setup_arch,
> .init_IRQ = mpc83xx_init_IRQ,
> .get_irq = ipic_get_irq,
> .restart = mpc83xx_restart,
> .time_init = mpc83xx_time_init,
> .calibrate_decr = generic_calibrate_decr,
> .progress = udbg_progress,
> };
> #else
Why do you have this #else here? Doesn't it just restrict you for no
gain?
> #ifdef CONFIG_MPC834x_ITX
> define_machine(mpc83xx) {
> .name = "MPC834x ITX",
> <rest is the same>
Your probe function can set ppc_md.name to whatever it wants. So you
could have a define_machine(fsl_83xx_eval_board) whose probe function
would pick up the actual board name from the device tree (e.g. the
root node's model property), put that in ppc_md and return 1 (assuming
of course that the device tree looks like one of your boards).
Paul.
^ permalink raw reply [flat|nested] 43+ messages in thread
* RE: [PATCH] powerpc: consolidate mpc83xx platform files
@ 2006-12-18 14:44 Joakim Tjernlund
2006-12-18 16:51 ` Olof Johansson
0 siblings, 1 reply; 43+ messages in thread
From: Joakim Tjernlund @ 2006-12-18 14:44 UTC (permalink / raw)
To: Olof Johansson, Kumar Gala; +Cc: linuxppc-dev
[SNIP]
> Something like this should work just as well. Seems to work fine on my
> system here (that has a DS1338, i.e. ds1307 driver).
>=20
> Let me know if it works on 83xx and I'll post it with a=20
> signed-off-line.
>=20
>=20
>=20
> -Olof
>=20
>=20
>=20
>=20
> Index: linux-2.6/arch/powerpc/Kconfig
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.orig/arch/powerpc/Kconfig
> +++ linux-2.6/arch/powerpc/Kconfig
> @@ -600,6 +600,12 @@ config PPC_TODC
> ---help---
> This adds support for many TODC/RTC chips.
> =20
> +config PPC_GENRTC
> + bool "Generic RTC support"
> + help
> + This adds support for using regular RTC registered=20
> with the RTC
> + framework as the main clock on powerpc.
> +
> endmenu
> =20
> source arch/powerpc/platforms/embedded6xx/Kconfig
> Index: linux-2.6/arch/powerpc/sysdev/Makefile
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- linux-2.6.orig/arch/powerpc/sysdev/Makefile
> +++ linux-2.6/arch/powerpc/sysdev/Makefile
> @@ -10,6 +10,7 @@ obj-$(CONFIG_40x) +=3D dcr.o
> obj-$(CONFIG_U3_DART) +=3D dart_iommu.o
> obj-$(CONFIG_MMIO_NVRAM) +=3D mmio_nvram.o
> obj-$(CONFIG_FSL_SOC) +=3D fsl_soc.o
> +obj-$(CONFIG_PPC_GENRTC) +=3D genrtc.o
> obj-$(CONFIG_PPC_TODC) +=3D todc.o
> obj-$(CONFIG_TSI108_BRIDGE) +=3D tsi108_pci.o tsi108_dev.o
> obj-$(CONFIG_QUICC_ENGINE) +=3D qe_lib/
> Index: linux-2.6/arch/powerpc/sysdev/genrtc.c
> =
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
> --- /dev/null
> +++ linux-2.6/arch/powerpc/sysdev/genrtc.c
> @@ -0,0 +1,77 @@
> +/*
> + * Copyright (C) Olof Johansson <olof@lixom.net>
> + *
> + * This program is free software; you can redistribute it=20
> and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + *
> + * This program is distributed in the hope that it will be useful,
> + * but WITHOUT ANY WARRANTY; without even the implied warranty of
> + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
> + * GNU General Public License for more details.
> + *
> + * You should have received a copy of the GNU General Public License
> + * along with this program; if not, write to the Free Software
> + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA =20
> 02111-1307 USA
> + */
> +
> +#include <linux/time.h>
> +#include <linux/device.h>
> +#include <linux/rtc.h>
> +
> +#include <asm/machdep.h>
> +#include <asm/time.h>
> +
> +static struct class_device *rtc_dev;
> +
> +static void genrtc_set_rtc_time_work(void *arg);
> +
> +static struct rtc_time delayed_tm;
> +static struct workqueue_struct *rtc_workqueue;
> +static DECLARE_WORK(rtc_work, genrtc_set_rtc_time_work, &delayed_tm);
The workqueue stuff has changed and needs to be adapted. Don't know how
yet though. If you figure it out, drop a line.
Jocke
[SNIP]
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-18 14:44 Joakim Tjernlund
@ 2006-12-18 16:51 ` Olof Johansson
0 siblings, 0 replies; 43+ messages in thread
From: Olof Johansson @ 2006-12-18 16:51 UTC (permalink / raw)
To: Joakim Tjernlund; +Cc: linuxppc-dev
On Mon, 18 Dec 2006 15:44:14 +0100 "Joakim Tjernlund" <joakim.tjernlund@transmode.se> wrote:
> The workqueue stuff has changed and needs to be adapted. Don't know how
> yet though. If you figure it out, drop a line.
Yeah, there's at least one more bug in there too (workqueue arguments).
I should have hardware to test on again a bit later this week; I'll
repost then.
-Olof
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-18 5:17 ` Paul Mackerras
@ 2006-12-18 17:04 ` Kumar Gala
0 siblings, 0 replies; 43+ messages in thread
From: Kumar Gala @ 2006-12-18 17:04 UTC (permalink / raw)
To: Paul Mackerras; +Cc: linuxppc-dev
On Dec 17, 2006, at 11:17 PM, Paul Mackerras wrote:
> Kim Phillips writes:
>
>> so the contents of 83xx/fsl.c would look like:
>> #ifdef CONFIG_MPC834x_SYS
>> define_machine(mpc834x_sys) {
>> .name = "MPC834x SYS",
>> .probe = mpc83xx_probe,
>> .setup_arch = mpc83xx_setup_arch,
>> .init_IRQ = mpc83xx_init_IRQ,
>> .get_irq = ipic_get_irq,
>> .restart = mpc83xx_restart,
>> .time_init = mpc83xx_time_init,
>> .calibrate_decr = generic_calibrate_decr,
>> .progress = udbg_progress,
>> };
>> #else
>
> Why do you have this #else here? Doesn't it just restrict you for no
> gain?
I think you're looking at an old version of the patch.
>> #ifdef CONFIG_MPC834x_ITX
>> define_machine(mpc83xx) {
>> .name = "MPC834x ITX",
>> <rest is the same>
>
> Your probe function can set ppc_md.name to whatever it wants. So you
> could have a define_machine(fsl_83xx_eval_board) whose probe function
> would pick up the actual board name from the device tree (e.g. the
> root node's model property), put that in ppc_md and return 1 (assuming
> of course that the device tree looks like one of your boards).
>
> Paul.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-15 16:09 ` Kumar Gala
2006-12-15 17:23 ` Dan Malek
2006-12-15 17:59 ` Olof Johansson
@ 2006-12-18 21:19 ` Benjamin Herrenschmidt
2 siblings, 0 replies; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-18 21:19 UTC (permalink / raw)
To: Kumar Gala; +Cc: linuxppc-dev
> > +#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
> > +extern ulong ds1374_get_rtc_time(void);
> > +extern int ds1374_set_rtc_time(ulong);
> > +
> > +static int __init mpc83xx_rtc_hookup(void)
> > +{
> > + struct timespec tv;
> > +
> > + ppc_md.get_rtc_time = ds1374_get_rtc_time;
> > + ppc_md.set_rtc_time = ds1374_set_rtc_time;
> > +
> > + tv.tv_nsec = 0;
> > + tv.tv_sec = (ppc_md.get_rtc_time) ();
> > + do_settimeofday(&tv);
> > +
> > + return 0;
> > +}
> > +
> > +late_initcall(mpc83xx_rtc_hookup);
> > +#endif
>
> This is sort of evil and we need to clean it up, but we have some
> time for 2.6.21. Does the MPC832x MDS have the DS1374?
Also, always test if (machine_is(xxx)) in your initcalls since they'll
be called regardless of what machine has been selected.
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-15 17:23 ` Dan Malek
@ 2006-12-18 21:22 ` Benjamin Herrenschmidt
0 siblings, 0 replies; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-18 21:22 UTC (permalink / raw)
To: Dan Malek; +Cc: linuxppc-dev list
On Fri, 2006-12-15 at 12:23 -0500, Dan Malek wrote:
> On Dec 15, 2006, at 11:09 AM, Kumar Gala wrote:
>
> >
> >> + if (machine_is(mpc83xx))
> >> + of_platform_bus_probe(NULL, NULL, NULL);
> >> +
> >
> > Does this every get called, meaning does anything match machine_is
> > (mpc83xx)?
>
>
> I truly dislike this "machine_is" method. Other architectures
> do this and it becomes a real PITA. It seems to evolve
> into something that never has the proper, useful granularity.
> Surprisingly, it often ends up as a guarantee you can't boot
> common kernels on similar boards, which is what
> I suspect you are trying to achieve.
Well, machine_is(mpc83xx) is certainly wrong, it should be
machine_is(whatver_my_board_name_is). It's a way to test for a given bsp
and nothing else. It's served us well for powermac/prep/chrp though I
agree that abusing it is often a sign that something is wrong with the
design.
There is one area on which is needs right now is when a platform adds
initcalls as those will be called regardless of wether that platform was
actually selected at boot or not, though I've been thinking about a way
to add board_xxx_initcall() thingies to fix that.
In general, for better granularity, code shall test specific properties
in the device-tree exposing a given feature.
> This is a case where your board specific initialization
> should call this, or fill in a ppc_md indirect pointer that
> if set is called at the proper time.
Agreed.
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-15 17:59 ` Olof Johansson
2006-12-16 1:31 ` Stephen Rothwell
@ 2006-12-18 21:23 ` Benjamin Herrenschmidt
1 sibling, 0 replies; 43+ messages in thread
From: Benjamin Herrenschmidt @ 2006-12-18 21:23 UTC (permalink / raw)
To: Olof Johansson; +Cc: linuxppc-dev
> +static int __init genrtc_rtc_hookup(void)
> +{
> + /* Don't init if the platform has already set up rtc functions. */
> + if (ppc_md.get_rtc_time || ppc_md.set_rtc_time)
> + return -1;
> +
> + rtc_dev = rtc_class_open("rtc0");
> +
> + if (!rtc_dev) {
> + printk("genrtc_rtc_hookup: Failed to open rtc0\n");
> + return -1;
> + }
> +
> + ppc_md.get_rtc_time = genrtc_get_rtc_time;
> + ppc_md.set_rtc_time = genrtc_set_rtc_time;
> +
> + return 0;
> +}
> +late_initcall(genrtc_rtc_hookup);
> +
This should be called by the platform code. Not all platform want to
hook on genrtc. Even worth, some of the RTC drivers provided by genrtc
aren't suitable at all because the NTP code will call them at interrupt
time (like the i2c ones).
Ben.
^ permalink raw reply [flat|nested] 43+ messages in thread
* [PATCH] powerpc: consolidate mpc83xx platform files
@ 2006-12-19 21:30 Kim Phillips
2006-12-19 22:19 ` Ben Warren
0 siblings, 1 reply; 43+ messages in thread
From: Kim Phillips @ 2006-12-19 21:30 UTC (permalink / raw)
To: linuxppc-dev
Eliminate platforms/83xx code redundancy. Common mpc83xx code cleaned up
and merged into setup.c. Each board maintains its own machine definition
and corresponding probe fn in its own file. Kconfig modified to allow for
multiple board selection in a single kernel image.
The loops_per_jiffy assignment is removed since udelay now uses the timebase.
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
---
exactly the same as last time, minus the publish_devices call (see next patch)
also, rtc code removal is pending ds1374 support in rtc_class (832xMDS has ds1374)
arch/powerpc/platforms/83xx/Kconfig | 6 -
arch/powerpc/platforms/83xx/Makefile | 2 +-
arch/powerpc/platforms/83xx/mpc832x_mds.c | 176 +----------------------------
arch/powerpc/platforms/83xx/mpc832x_mds.h | 19 ---
arch/powerpc/platforms/83xx/mpc834x_itx.c | 92 +++------------
arch/powerpc/platforms/83xx/mpc834x_itx.h | 23 ----
arch/powerpc/platforms/83xx/mpc834x_sys.c | 111 +++---------------
arch/powerpc/platforms/83xx/mpc834x_sys.h | 23 ----
arch/powerpc/platforms/83xx/mpc8360e_pb.c | 175 +----------------------------
arch/powerpc/platforms/83xx/mpc83xx.h | 2 +
arch/powerpc/platforms/83xx/setup.c | 167 +++++++++++++++++++++++++++
11 files changed, 210 insertions(+), 586 deletions(-)
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index edcd5b8..c236dff 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -1,10 +1,6 @@
menu "Platform support"
depends on PPC_83xx
-choice
- prompt "Machine Type"
- default MPC834x_SYS
-
config MPC832x_MDS
bool "Freescale MPC832x MDS"
select DEFAULT_UIMAGE
@@ -39,8 +35,6 @@ config MPC8360E_PB
help
This option enables support for the MPC836x EMDS Processor Board.
-endchoice
-
config PPC_MPC832x
bool
select PPC_UDBG_16550
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index f1aa7e2..07db146 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -1,7 +1,7 @@
#
# Makefile for the PowerPC 83xx linux kernel.
#
-obj-y := misc.o
+obj-y := setup.o misc.o
obj-$(CONFIG_PCI) += pci.o
obj-$(CONFIG_MPC834x_SYS) += mpc834x_sys.o
obj-$(CONFIG_MPC834x_ITX) += mpc834x_itx.o
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.c b/arch/powerpc/platforms/83xx/mpc832x_mds.c
index f58c978..37b334c 100644
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.c
+++ b/arch/powerpc/platforms/83xx/mpc832x_mds.c
@@ -14,33 +14,15 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-#include <asm/of_device.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
#include "mpc83xx.h"
-#include "mpc832x_mds.h"
#undef DEBUG
#ifdef DEBUG
@@ -49,158 +31,6 @@
#define DBG(fmt...)
#endif
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc832x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc832x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- unsigned int *fp =
- (int *)get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc832x_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc832x_declare_of_platform_devices);
-
-void __init mpc832x_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc832x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc832x_rtc_hookup);
-#endif
-
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
@@ -222,8 +52,8 @@ static int __init mpc832x_sys_probe(void
define_machine(mpc832x_mds) {
.name = "MPC832x MDS",
.probe = mpc832x_sys_probe,
- .setup_arch = mpc832x_sys_setup_arch,
- .init_IRQ = mpc832x_sys_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc832x_mds.h b/arch/powerpc/platforms/83xx/mpc832x_mds.h
deleted file mode 100644
index a495889..0000000
--- a/arch/powerpc/platforms/83xx/mpc832x_mds.h
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
- *
- * Description:
- * MPC832x MDS board specific header.
- *
- * 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 __MACH_MPC832x_MDS_H__
-#define __MACH_MPC832x_MDS_H__
-
-extern u8 *get_bcsr(void);
-
-#endif /* __MACH_MPC832x_MDS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.c b/arch/powerpc/platforms/83xx/mpc834x_itx.c
index 314c42a..5add670 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_itx.c
@@ -15,104 +15,46 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
#include "mpc83xx.h"
-#include <platforms/83xx/mpc834x_sys.h>
-
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_itx_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_itx_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
#else
- ROOT_DEV = Root_HDA1;
+#define DBG(fmt...)
#endif
-}
-
-void __init mpc834x_itx_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
static int __init mpc834x_itx_probe(void)
{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8349EMITX"))
+ return 0;
+
+ DBG("%s found\n", model);
+
return 1;
}
define_machine(mpc834x_itx) {
.name = "MPC834x ITX",
.probe = mpc834x_itx_probe,
- .setup_arch = mpc834x_itx_setup_arch,
- .init_IRQ = mpc834x_itx_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc834x_itx.h b/arch/powerpc/platforms/83xx/mpc834x_itx.h
deleted file mode 100644
index 174ca4e..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_itx.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_itx.h
- *
- * MPC834X ITX common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_ITX_H__
-#define __MACH_MPC83XX_ITX_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_ITX_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.c b/arch/powerpc/platforms/83xx/mpc834x_sys.c
index 80b735a..93df3ef 100644
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.c
+++ b/arch/powerpc/platforms/83xx/mpc834x_sys.c
@@ -15,105 +15,21 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
#include "mpc83xx.h"
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc834x_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc834x_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
-
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-void __init mpc834x_sys_init_IRQ(void)
-{
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc834x_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc834x_rtc_hookup);
+#define DBG(fmt...)
#endif
/*
@@ -121,17 +37,24 @@ late_initcall(mpc834x_rtc_hookup);
*/
static int __init mpc834x_sys_probe(void)
{
- /* We always match for now, eventually we should look at the flat
- dev tree to ensure this is the board we are suppose to run on
- */
+ char *model = of_get_flat_dt_prop(of_get_flat_dt_root(),
+ "model", NULL);
+
+ if (model == NULL)
+ return 0;
+ if (strcmp(model, "MPC8349EMDS"))
+ return 0;
+
+ DBG("%s found\n", model);
+
return 1;
}
define_machine(mpc834x_sys) {
.name = "MPC834x SYS",
.probe = mpc834x_sys_probe,
- .setup_arch = mpc834x_sys_setup_arch,
- .init_IRQ = mpc834x_sys_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc834x_sys.h b/arch/powerpc/platforms/83xx/mpc834x_sys.h
deleted file mode 100644
index 7d5bbef..0000000
--- a/arch/powerpc/platforms/83xx/mpc834x_sys.h
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * arch/powerpc/platforms/83xx/mpc834x_sys.h
- *
- * MPC834X SYS common board definitions
- *
- * Maintainer: Kumar Gala <galak@kernel.crashing.org>
- *
- * 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 __MACH_MPC83XX_SYS_H__
-#define __MACH_MPC83XX_SYS_H__
-
-#define PIRQA MPC83xx_IRQ_EXT4
-#define PIRQB MPC83xx_IRQ_EXT5
-#define PIRQC MPC83xx_IRQ_EXT6
-#define PIRQD MPC83xx_IRQ_EXT7
-
-#endif /* __MACH_MPC83XX_SYS_H__ */
diff --git a/arch/powerpc/platforms/83xx/mpc8360e_pb.c b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
index 7bfd47a..f6e9b6a 100644
--- a/arch/powerpc/platforms/83xx/mpc8360e_pb.c
+++ b/arch/powerpc/platforms/83xx/mpc8360e_pb.c
@@ -20,30 +20,13 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/errno.h>
-#include <linux/reboot.h>
-#include <linux/pci.h>
-#include <linux/kdev_t.h>
-#include <linux/major.h>
-#include <linux/console.h>
-#include <linux/delay.h>
-#include <linux/seq_file.h>
-#include <linux/root_dev.h>
-#include <linux/initrd.h>
-#include <asm/of_device.h>
+#include <asm/of_platform.h>
#include <asm/system.h>
-#include <asm/atomic.h>
#include <asm/time.h>
-#include <asm/io.h>
#include <asm/machdep.h>
#include <asm/ipic.h>
-#include <asm/bootinfo.h>
-#include <asm/irq.h>
-#include <asm/prom.h>
#include <asm/udbg.h>
-#include <sysdev/fsl_soc.h>
-#include <asm/qe.h>
-#include <asm/qe_ic.h>
#include "mpc83xx.h"
@@ -54,158 +37,6 @@
#define DBG(fmt...)
#endif
-#ifndef CONFIG_PCI
-unsigned long isa_io_base = 0;
-unsigned long isa_mem_base = 0;
-#endif
-
-static u8 *bcsr_regs = NULL;
-
-u8 *get_bcsr(void)
-{
- return bcsr_regs;
-}
-
-/* ************************************************************************
- *
- * Setup the architecture
- *
- */
-static void __init mpc8360_sys_setup_arch(void)
-{
- struct device_node *np;
-
- if (ppc_md.progress)
- ppc_md.progress("mpc8360_sys_setup_arch()", 0);
-
- np = of_find_node_by_type(NULL, "cpu");
- if (np != 0) {
- const unsigned int *fp =
- get_property(np, "clock-frequency", NULL);
- if (fp != 0)
- loops_per_jiffy = *fp / HZ;
- else
- loops_per_jiffy = 50000000 / HZ;
- of_node_put(np);
- }
-
- /* Map BCSR area */
- np = of_find_node_by_name(NULL, "bcsr");
- if (np != 0) {
- struct resource res;
-
- of_address_to_resource(np, 0, &res);
- bcsr_regs = ioremap(res.start, res.end - res.start +1);
- of_node_put(np);
- }
-
-#ifdef CONFIG_PCI
- for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
- add_bridge(np);
- ppc_md.pci_exclude_device = mpc83xx_exclude_device;
-#endif
-
-#ifdef CONFIG_QUICC_ENGINE
- qe_reset();
-
- if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
- par_io_init(np);
- of_node_put(np);
-
- for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
- par_io_of_config(np);
- }
-
- if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
- != NULL){
- /* Reset the Ethernet PHY */
- bcsr_regs[9] &= ~0x20;
- udelay(1000);
- bcsr_regs[9] |= 0x20;
- iounmap(bcsr_regs);
- of_node_put(np);
- }
-
-#endif /* CONFIG_QUICC_ENGINE */
-
-#ifdef CONFIG_BLK_DEV_INITRD
- if (initrd_start)
- ROOT_DEV = Root_RAM0;
- else
-#endif
-#ifdef CONFIG_ROOT_NFS
- ROOT_DEV = Root_NFS;
-#else
- ROOT_DEV = Root_HDA1;
-#endif
-}
-
-static int __init mpc8360_declare_of_platform_devices(void)
-{
- struct device_node *np;
-
- for (np = NULL; (np = of_find_compatible_node(np, "network",
- "ucc_geth")) != NULL;) {
- int ucc_num;
- char bus_id[BUS_ID_SIZE];
-
- ucc_num = *((uint *) get_property(np, "device-id", NULL)) - 1;
- snprintf(bus_id, BUS_ID_SIZE, "ucc_geth.%u", ucc_num);
- of_platform_device_create(np, bus_id, NULL);
- }
-
- return 0;
-}
-device_initcall(mpc8360_declare_of_platform_devices);
-
-void __init mpc8360_sys_init_IRQ(void)
-{
-
- struct device_node *np;
-
- np = of_find_node_by_type(NULL, "ipic");
- if (!np)
- return;
-
- ipic_init(np, 0);
-
- /* Initialize the default interrupt mapping priorities,
- * in case the boot rom changed something on us.
- */
- ipic_set_default_priority();
- of_node_put(np);
-
-#ifdef CONFIG_QUICC_ENGINE
- np = of_find_node_by_type(NULL, "qeic");
- if (!np)
- return;
-
- qe_ic_init(np, 0);
- of_node_put(np);
-#endif /* CONFIG_QUICC_ENGINE */
-}
-
-#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
-extern ulong ds1374_get_rtc_time(void);
-extern int ds1374_set_rtc_time(ulong);
-
-static int __init mpc8360_rtc_hookup(void)
-{
- struct timespec tv;
-
- ppc_md.get_rtc_time = ds1374_get_rtc_time;
- ppc_md.set_rtc_time = ds1374_set_rtc_time;
-
- tv.tv_nsec = 0;
- tv.tv_sec = (ppc_md.get_rtc_time) ();
- do_settimeofday(&tv);
-
- return 0;
-}
-
-late_initcall(mpc8360_rtc_hookup);
-#endif
-
/*
* Called very early, MMU is off, device-tree isn't unflattened
*/
@@ -226,8 +57,8 @@ static int __init mpc8360_sys_probe(void
define_machine(mpc8360_sys) {
.name = "MPC8360E PB",
.probe = mpc8360_sys_probe,
- .setup_arch = mpc8360_sys_setup_arch,
- .init_IRQ = mpc8360_sys_init_IRQ,
+ .setup_arch = mpc83xx_setup_arch,
+ .init_IRQ = mpc83xx_init_IRQ,
.get_irq = ipic_get_irq,
.restart = mpc83xx_restart,
.time_init = mpc83xx_time_init,
diff --git a/arch/powerpc/platforms/83xx/mpc83xx.h b/arch/powerpc/platforms/83xx/mpc83xx.h
index 01cae10..7419db4 100644
--- a/arch/powerpc/platforms/83xx/mpc83xx.h
+++ b/arch/powerpc/platforms/83xx/mpc83xx.h
@@ -13,5 +13,7 @@ extern int add_bridge(struct device_node
extern int mpc83xx_exclude_device(u_char bus, u_char devfn);
extern void mpc83xx_restart(char *cmd);
extern long mpc83xx_time_init(void);
+extern void __init mpc83xx_setup_arch(void);
+extern void __init mpc83xx_init_IRQ(void);
#endif /* __MPC83XX_H__ */
diff --git a/arch/powerpc/platforms/83xx/setup.c b/arch/powerpc/platforms/83xx/setup.c
new file mode 100644
index 0000000..6177581
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/setup.c
@@ -0,0 +1,167 @@
+/*
+ * Copyright (C) Freescale Semicondutor, Inc. 2006. All rights reserved.
+ *
+ * Author: Li Yang <LeoLi@freescale.com>
+ * Yin Olivia <Hong-hua.Yin@freescale.com>
+ *
+ * Description:
+ * MPC83xx board routines.
+ *
+ * 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/stddef.h>
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/errno.h>
+#include <linux/reboot.h>
+#include <linux/pci.h>
+#include <linux/kdev_t.h>
+#include <linux/major.h>
+#include <linux/console.h>
+#include <linux/delay.h>
+#include <linux/seq_file.h>
+#include <linux/root_dev.h>
+#include <linux/initrd.h>
+
+#include <asm/of_device.h>
+#include <asm/of_platform.h>
+#include <asm/system.h>
+#include <asm/atomic.h>
+#include <asm/time.h>
+#include <asm/io.h>
+#include <asm/machdep.h>
+#include <asm/ipic.h>
+#include <asm/bootinfo.h>
+#include <asm/irq.h>
+#include <asm/prom.h>
+#include <asm/udbg.h>
+#include <sysdev/fsl_soc.h>
+#include <asm/qe.h>
+#include <asm/qe_ic.h>
+
+#include "mpc83xx.h"
+
+#undef DEBUG
+#ifdef DEBUG
+#define DBG(fmt...) udbg_printf(fmt)
+#else
+#define DBG(fmt...)
+#endif
+
+#ifndef CONFIG_PCI
+unsigned long isa_io_base = 0;
+unsigned long isa_mem_base = 0;
+#endif
+
+static u8 __iomem *bcsr_regs = NULL;
+
+u8 *get_bcsr(void)
+{
+ return bcsr_regs;
+}
+
+/* ************************************************************************
+ *
+ * Setup the architecture
+ *
+ */
+void __init mpc83xx_setup_arch(void)
+{
+ struct device_node *np;
+
+ if (ppc_md.progress)
+ ppc_md.progress("mpc83xx_setup_arch()", 0);
+
+ /* Map BCSR area */
+ np = of_find_node_by_name(NULL, "bcsr");
+ if (np != 0) {
+ struct resource res;
+
+ of_address_to_resource(np, 0, &res);
+ bcsr_regs = ioremap(res.start, res.end - res.start + 1);
+ of_node_put(np);
+ }
+
+#ifdef CONFIG_PCI
+ for (np = NULL; (np = of_find_node_by_type(np, "pci")) != NULL;)
+ add_bridge(np);
+ ppc_md.pci_exclude_device = mpc83xx_exclude_device;
+#endif
+
+#ifdef CONFIG_QUICC_ENGINE
+ if ((np = of_find_node_by_type(NULL, "qe")) != NULL) {
+ qe_reset();
+ of_node_put(np);
+ }
+
+ if ((np = of_find_node_by_name(np, "par_io")) != NULL) {
+ par_io_init(np);
+ of_node_put(np);
+
+ for (np = NULL; (np = of_find_node_by_name(np, "ucc")) != NULL;)
+ par_io_of_config(np);
+ }
+
+ if ((np = of_find_compatible_node(NULL, "network", "ucc_geth"))
+ != NULL){
+ /* Reset the Ethernet PHY */
+ bcsr_regs[9] &= ~0x20;
+ udelay(1000);
+ bcsr_regs[9] |= 0x20;
+ iounmap(bcsr_regs);
+ of_node_put(np);
+ }
+
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+void __init mpc83xx_init_IRQ(void)
+{
+ struct device_node *np;
+
+ np = of_find_node_by_type(NULL, "ipic");
+ if (!np)
+ return;
+
+ ipic_init(np, 0);
+
+ /* Initialize the default interrupt mapping priorities,
+ * in case the boot rom changed something on us.
+ */
+ ipic_set_default_priority();
+ of_node_put(np);
+
+#ifdef CONFIG_QUICC_ENGINE
+ np = of_find_node_by_type(NULL, "qeic");
+ if (!np)
+ return;
+
+ qe_ic_init(np, 0);
+ of_node_put(np);
+#endif /* CONFIG_QUICC_ENGINE */
+}
+
+#if defined(CONFIG_I2C_MPC) && defined(CONFIG_SENSORS_DS1374)
+extern ulong ds1374_get_rtc_time(void);
+extern int ds1374_set_rtc_time(ulong);
+
+static int __init mpc83xx_rtc_hookup(void)
+{
+ struct timespec tv;
+
+ ppc_md.get_rtc_time = ds1374_get_rtc_time;
+ ppc_md.set_rtc_time = ds1374_set_rtc_time;
+
+ tv.tv_nsec = 0;
+ tv.tv_sec = (ppc_md.get_rtc_time) ();
+ do_settimeofday(&tv);
+
+ return 0;
+}
+
+late_initcall(mpc83xx_rtc_hookup);
+#endif
--
1.4.4
^ permalink raw reply related [flat|nested] 43+ messages in thread
* Re: [PATCH] powerpc: consolidate mpc83xx platform files
2006-12-19 21:30 Kim Phillips
@ 2006-12-19 22:19 ` Ben Warren
0 siblings, 0 replies; 43+ messages in thread
From: Ben Warren @ 2006-12-19 22:19 UTC (permalink / raw)
To: Kim Phillips; +Cc: linuxppc-dev
On Tue, 2006-12-19 at 15:30 -0600, Kim Phillips wrote:
> diff --git a/arch/powerpc/platforms/83xx/setup.c b/arch/powerpc/platforms/83xx/setup.c
> new file mode 100644
> index 0000000..6177581
> --- /dev/null
> +++ b/arch/powerpc/platforms/83xx/setup.c
<snip>
> +
> +static u8 __iomem *bcsr_regs = NULL;
> +
> +u8 *get_bcsr(void)
> +{
> + return bcsr_regs;
> +}
> +
Sorry for rehashing this, but BCSR is a Freescale-only thing. While I
realize it's something you guys put on all of your evaluation boards, I
doubt anybody else does. It's a tiny amount of code, but does it belong
in the common file?
regards,
Ben
^ permalink raw reply [flat|nested] 43+ messages in thread
end of thread, other threads:[~2006-12-19 22:26 UTC | newest]
Thread overview: 43+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 1:04 [PATCH] powerpc: consolidate mpc83xx platform files Kim Phillips
2006-12-15 16:09 ` Kumar Gala
2006-12-15 17:23 ` Dan Malek
2006-12-18 21:22 ` Benjamin Herrenschmidt
2006-12-15 17:59 ` Olof Johansson
2006-12-16 1:31 ` Stephen Rothwell
2006-12-18 21:23 ` Benjamin Herrenschmidt
2006-12-18 21:19 ` Benjamin Herrenschmidt
-- strict thread matches above, loose matches on Subject: below --
2006-12-19 21:30 Kim Phillips
2006-12-19 22:19 ` Ben Warren
2006-12-18 14:44 Joakim Tjernlund
2006-12-18 16:51 ` Olof Johansson
2006-12-12 17:36 Kim Phillips
2006-12-12 18:03 ` Kumar Gala
2006-12-09 1:07 Kim Phillips
2006-12-09 7:14 ` Benjamin Herrenschmidt
2006-12-11 3:41 ` Kumar Gala
2006-12-11 21:51 ` Kim Phillips
2006-12-11 22:08 ` Kumar Gala
2006-12-12 2:10 ` Kim Phillips
2006-12-12 2:29 ` Benjamin Herrenschmidt
2006-12-12 2:31 ` Kumar Gala
2006-12-12 21:30 ` Scott Wood
2006-12-12 21:47 ` Benjamin Herrenschmidt
2006-12-12 22:06 ` Kumar Gala
2006-12-12 22:24 ` Kim Phillips
2006-12-12 22:28 ` Kumar Gala
2006-12-12 22:38 ` Kim Phillips
2006-12-12 22:44 ` Benjamin Herrenschmidt
2006-12-12 22:51 ` Kim Phillips
2006-12-12 22:40 ` Scott Wood
2006-12-13 0:23 ` Kumar Gala
2006-12-13 5:25 ` Geoff Thorpe
2006-12-13 6:07 ` Kumar Gala
2006-12-13 17:48 ` Geoff Thorpe
2006-12-13 18:21 ` Kim Phillips
2006-12-13 21:13 ` Dan Malek
2006-12-12 22:03 ` Kumar Gala
2006-12-12 22:41 ` Scott Wood
2006-12-12 22:46 ` Benjamin Herrenschmidt
2006-12-13 0:20 ` Kumar Gala
2006-12-18 5:17 ` Paul Mackerras
2006-12-18 17:04 ` Kumar Gala
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).