* MPC8xx Platformization
@ 2005-04-27 13:47 Jason McMullan
2005-04-27 14:42 ` Kumar Gala
2005-05-20 17:37 ` Andrei Konovalov
0 siblings, 2 replies; 5+ messages in thread
From: Jason McMullan @ 2005-04-27 13:47 UTC (permalink / raw)
To: PPC_LINUX
[-- Attachment #1.1: Type: text/plain, Size: 301 bytes --]
The following is a rough skeleton of platformization for the mpc8xx
series, in the same technique as Kumar's 85xx platformization.
This rough cut will be followed up later with specific
driver platformization fixes.
--
Jason McMullan <jason.mcmullan@timesys.com>
TimeSys Corporation
[-- Attachment #1.2: mpc8xx-platformize.patch --]
[-- Type: text/x-patch, Size: 11907 bytes --]
Date: Wed, 20 Apr 2005 11:11:23 -0400
Signed-Off-By: Jason McMullan <jason.mcmullan@timesys.com>
Description: MPC8xx platformization
Index of changes:
arch/ppc/Makefile | 2
arch/ppc/syslib/Makefile | 3
arch/ppc/syslib/m8xx_setup.c | 3
include/asm-ppc/mpc8xx.h | 31 ++
include/asm-ppc/ppc_sys.h | 2
linux/arch/ppc/platforms/8xx/mpc8xx_ads.c | 22 ++
linux/arch/ppc/platforms/8xx/mpc8xx_devices.c | 282 ++++++++++++++++++++++++++
linux/arch/ppc/platforms/8xx/mpc8xx_sys.c | 39 +++
8 files changed, 383 insertions(+), 1 deletion(-)
--- linux-orig/arch/ppc/Makefile
+++ linux/arch/ppc/Makefile
@@ -38,6 +38,7 @@
cpu-as-$(CONFIG_6xx) += -Wa,-maltivec
cpu-as-$(CONFIG_POWER4) += -Wa,-maltivec
cpu-as-$(CONFIG_E500) += -Wa,-me500
+cpu-as-$(CONFIG_8xx) += -mcpu=860
AFLAGS += $(cpu-as-y)
CFLAGS += $(cpu-as-y)
@@ -57,6 +58,7 @@
core-y += arch/ppc/kernel/ arch/ppc/platforms/ \
arch/ppc/mm/ arch/ppc/lib/ arch/ppc/syslib/
core-$(CONFIG_4xx) += arch/ppc/platforms/4xx/
+core-$(CONFIG_8xx) += arch/ppc/platforms/8xx/
core-$(CONFIG_85xx) += arch/ppc/platforms/85xx/
core-$(CONFIG_MATH_EMULATION) += arch/ppc/math-emu/
core-$(CONFIG_XMON) += arch/ppc/xmon/
--- /dev/null
+++ linux/arch/ppc/platforms/8xx/mpc8xx_ads.c
@@ -0,0 +1,22 @@
+#include <linux/config.h>
+#include <linux/fec_8xx_pd.h>
+#include <asm/ppcboot.h>
+#include <asm/mpc8xx.h>
+#include <asm/ppc_sys.h>
+
+extern unsigned char __res[];
+
+void board_init(void)
+{
+ struct fec_platform_info *fec;
+ bd_t *bi = (void *)&__res[0];
+
+ /* Set up the MAC addresses for the FECs
+ */
+ fec = ppc_sys_platform_devices[MPC8xx_CPM_FEC1].dev.platform_data;
+ memcpy(fec->macaddr,bi->bi_enetaddr,6);
+
+ fec = ppc_sys_platform_devices[MPC8xx_CPM_FEC2].dev.platform_data;
+ memcpy(fec->macaddr,bi->bi_enetaddr,6);
+ fec->macaddr[5] ^= 1;
+}
--- /dev/null
+++ linux/arch/ppc/platforms/8xx/mpc8xx_devices.c
@@ -0,0 +1,282 @@
+/*
+ * arch/ppc/platforms/8xx/mpc8xx_devices.c
+ *
+ * MPC8xx Device descriptions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <linux/serial_8250.h>
+#include <linux/fsl_devices.h>
+#include <linux/fec_8xx_pd.h>
+#include <asm/mpc8xx.h>
+#include <asm/8xx_immap.h>
+#include <asm/irq.h>
+#include <asm/ppc_sys.h>
+
+/* We use offsets for IORESOURCE_MEM since we do not know at compile time
+ * what CCSRBAR is, will get fixed up by mach_mpc8xx_fixup
+ */
+
+static struct fsl_i2c_platform_data mpc8xx_fsl_i2c_pdata = {
+ .device_flags = FSL_I2C_DEV_SEPARATE_DFSRR,
+};
+
+static struct fec_mii_bus_info mii_bus_info = {
+ .method = fecmii_fec,
+ .id = 0,
+};
+
+static struct fec_platform_info mpc8xx_fec_pdata[] = {
+ {
+ .rx_ring = 128,
+ .tx_ring = 16,
+ .rx_copybreak = 240,
+
+ .use_napi = 1,
+ .napi_weight = 17,
+
+ .bus_info = &mii_bus_info,
+ },{
+ .rx_ring = 128,
+ .tx_ring = 16,
+ .rx_copybreak = 240,
+
+ .use_napi = 1,
+ .napi_weight = 17,
+
+ .bus_info = &mii_bus_info,
+ }
+};
+
+#define IMMAP_STRUCT(x) ((((immap_t *)0)->x))
+#define IMMAP_OFFSET(x) ((unsigned long)&IMMAP_STRUCT(x))
+#define IMMAP_END(x) (IMMAP_OFFSET(x) + sizeof(IMMAP_STRUCT(x)) - 1)
+
+#define CPM_OFFSET(x) IMMAP_OFFSET(im_cpm.x)
+#define CPM_END(x) IMMAP_END(im_cpm.x)
+
+struct platform_device ppc_sys_platform_devices[] = {
+#if 0
+ [MPC8xx_I2C] = {
+ .name = "fsl-i2c",
+ .id = 1,
+ .dev.platform_data = &mpc8xx_fsl_i2c_pdata,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = IMMAP_OFFSET(im_i2c),
+ .end = IMMAP_END(im_i2c),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_IRQ_I2C,
+ .end = MPC8xx_IRQ_I2C,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+#endif
+ [MPC8xx_CPM_FEC1] = {
+ .name = "fsl-fec",
+ .id = 0,
+ .dev.platform_data = &mpc8xx_fec_pdata[0],
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_fec1),
+ .end = CPM_END(cp_fec1),
+ .flags = IORESOURCE_MEM,
+
+ },
+ {
+ .start = MPC8xx_INT_FEC1,
+ .end = MPC8xx_INT_FEC1,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+ [MPC8xx_CPM_FEC2] = {
+ .name = "fsl-fec",
+ .id = 1,
+ .dev.platform_data = &mpc8xx_fec_pdata[1],
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_fec2),
+ .end = CPM_END(cp_fec2),
+ .flags = IORESOURCE_MEM,
+
+ },
+ {
+ .start = MPC8xx_INT_FEC2,
+ .end = MPC8xx_INT_FEC2,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+ [MPC8xx_CPM_SCC1] = {
+ .name = "fsl-cpm-scc",
+ .id = 1,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_scc[0]),
+ .end = CPM_END(cp_scc[0]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SCC1,
+ .end = MPC8xx_INT_SCC1,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+ [MPC8xx_CPM_SCC2] = {
+ .name = "fsl-cpm-scc",
+ .id = 2,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_scc[1]),
+ .end = CPM_END(cp_scc[1]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SCC2,
+ .end = MPC8xx_INT_SCC2,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+ [MPC8xx_CPM_SCC3] = {
+ .name = "fsl-cpm-scc",
+ .id = 3,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_scc[2]),
+ .end = CPM_END(cp_scc[2]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SCC3,
+ .end = MPC8xx_INT_SCC3,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+ [MPC8xx_CPM_SCC4] = {
+ .name = "fsl-cpm-scc",
+ .id = 4,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_scc[3]),
+ .end = CPM_END(cp_scc[3]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SCC4,
+ .end = MPC8xx_INT_SCC4,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+#if 0
+ [MPC8xx_CPM_SPI] = {
+ .name = "fsl-cpm-spi",
+ .id = 1,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_spmode),
+ .end = CPM_END(cp_spcom),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SPI,
+ .end = MPC8xx_INT_SPI,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+#endif
+ [MPC8xx_CPM_SMC1] = {
+ .name = "fsl-cpm-smc",
+ .id = 1,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_smc[0]),
+ .end = CPM_END(cp_smc[0]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SMC1,
+ .end = MPC8xx_INT_SMC1,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+ [MPC8xx_CPM_SMC2] = {
+ .name = "fsl-cpm-smc",
+ .id = 2,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_smc[1]),
+ .end = CPM_END(cp_smc[1]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_SMC2,
+ .end = MPC8xx_INT_SMC2,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+#if 0
+ [MPC8xx_CPM_USB] = {
+ .name = "fsl-cpm-usb",
+ .id = 0,
+ .num_resources = 2,
+ .resource = (struct resource[]) {
+ {
+ .start = CPM_OFFSET(cp_scc[0]),
+ .end = CPM_END(cp_scc[0]),
+ .flags = IORESOURCE_MEM,
+ },
+ {
+ .start = MPC8xx_INT_USB,
+ .end = MPC8xx_INT_USB,
+ .flags = IORESOURCE_IRQ,
+ },
+ },
+ },
+#endif
+};
+
+static int __init mach_mpc8xx_fixup(struct platform_device *pdev)
+{
+ ppc_sys_fixup_mem_resource(pdev, IMAP_ADDR);
+ return 0;
+}
+
+static int __init mach_mpc8xx_init(void)
+{
+ ppc_sys_device_fixup = mach_mpc8xx_fixup;
+ return 0;
+}
+
+postcore_initcall(mach_mpc8xx_init);
--- /dev/null
+++ linux/arch/ppc/platforms/8xx/mpc8xx_sys.c
@@ -0,0 +1,39 @@
+/*
+ * arch/ppc/platforms/8xx/mpc8xx_sys.c
+ *
+ * MPC8xx System descriptions
+ *
+ * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ *
+ * Copyright 2005 Freescale Semiconductor Inc.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/device.h>
+#include <asm/ppc_sys.h>
+
+struct ppc_sys_spec *cur_ppc_sys_spec;
+struct ppc_sys_spec ppc_sys_specs[] = {
+ {
+ .ppc_sys_name = "MPC885",
+ .mask = 0xFFFF0000,
+ .value = 0x00500000,
+ .num_devices = 2,
+ .device_list = (enum ppc_sys_devices[])
+ {
+ MPC8xx_CPM_FEC1,
+ MPC8xx_CPM_SCC1,
+ },
+ },
+ { /* default match */
+ .ppc_sys_name = "",
+ .mask = 0x00000000,
+ .value = 0x00000000,
+ },
+};
--- linux-orig/arch/ppc/syslib/Makefile
+++ linux/arch/ppc/syslib/Makefile
@@ -33,7 +33,8 @@
obj-$(CONFIG_PCI) += indirect_pci.o pci_auto.o ppc405_pci.o
endif
endif
-obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y)
+obj-$(CONFIG_8xx) += m8xx_setup.o ppc8xx_pic.o $(wdt-mpc8xx-y) \
+ ppc_sys.o
ifeq ($(CONFIG_8xx),y)
obj-$(CONFIG_PCI) += qspan_pci.o i8259.o
endif
--- linux-orig/arch/ppc/syslib/m8xx_setup.c
+++ linux/arch/ppc/syslib/m8xx_setup.c
@@ -45,6 +45,7 @@
#include <asm/bootinfo.h>
#include <asm/time.h>
#include <asm/xmon.h>
+#include <asm/ppc_sys.h>
#include "ppc8xx_pic.h"
@@ -408,6 +409,8 @@
strcpy(cmd_line, (char *)(r6+KERNELBASE));
}
+ identify_ppc_sys_by_id(mfspr(PVR));
+
ppc_md.setup_arch = m8xx_setup_arch;
ppc_md.show_percpuinfo = m8xx_show_percpuinfo;
ppc_md.irq_canonicalize = NULL;
--- linux-orig/include/asm-ppc/mpc8xx.h
+++ linux/include/asm-ppc/mpc8xx.h
@@ -90,6 +90,10 @@
#endif
#ifndef __ASSEMBLY__
+#include <asm/irq.h>
+#include <asm/mmu.h>
+#include <asm/commproc.h>
+
/* The "residual" data board information structure the boot loader
* hands to us.
*/
@@ -97,7 +101,34 @@
struct pt_regs;
+/* Let modules/drivers get at CCSRBAR */
+extern phys_addr_t get_ccsrbar(void);
+
+#define MPC8xx_INT_FEC1 SIU_LEVEL1
+#define MPC8xx_INT_FEC2 SIU_LEVEL3
+#define MPC8xx_INT_SCC1 (CPM_IRQ_OFFSET + CPMVEC_SCC1)
+#define MPC8xx_INT_SCC2 (CPM_IRQ_OFFSET + CPMVEC_SCC2)
+#define MPC8xx_INT_SCC3 (CPM_IRQ_OFFSET + CPMVEC_SCC3)
+#define MPC8xx_INT_SCC4 (CPM_IRQ_OFFSET + CPMVEC_SCC4)
+#define MPC8xx_INT_SMC1 (CPM_IRQ_OFFSET + CPMVEC_SMC1)
+#define MPC8xx_INT_SMC2 (CPM_IRQ_OFFSET + CPMVEC_SMC2)
+
+enum ppc_sys_devices {
+ MPC8xx_I2C,
+ MPC8xx_CPM_FEC1,
+ MPC8xx_CPM_FEC2,
+ MPC8xx_CPM_SPI,
+ MPC8xx_CPM_USB,
+ MPC8xx_CPM_SCC1,
+ MPC8xx_CPM_SCC2,
+ MPC8xx_CPM_SCC3,
+ MPC8xx_CPM_SCC4,
+ MPC8xx_CPM_SMC1,
+ MPC8xx_CPM_SMC2,
+};
#endif /* !__ASSEMBLY__ */
+
+
#endif /* CONFIG_8xx */
#endif /* __CONFIG_8xx_DEFS */
#endif /* __KERNEL__ */
--- linux-orig/include/asm-ppc/ppc_sys.h
+++ linux/include/asm-ppc/ppc_sys.h
@@ -23,6 +23,8 @@
#if defined(CONFIG_85xx)
#include <asm/mpc85xx.h>
+#elif defined(CONFIG_8xx)
+#include <asm/mpc8xx.h>
#else
#error "need definition of ppc_sys_devices"
#endif
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MPC8xx Platformization
2005-04-27 13:47 MPC8xx Platformization Jason McMullan
@ 2005-04-27 14:42 ` Kumar Gala
2005-04-27 16:38 ` Jason McMullan
2005-05-20 17:37 ` Andrei Konovalov
1 sibling, 1 reply; 5+ messages in thread
From: Kumar Gala @ 2005-04-27 14:42 UTC (permalink / raw)
To: Jason McMullan; +Cc: PPC_LINUX
Jason,
Two comments:
1. put mpc8xx_devices.c & mpc8xx_sys.c in arch/ppc/syslib (I moved the
85xx ones here and its where 83xx & 52xx are)
2. can we just use hard coded offsets for start & end values. I really
hate assuming that the global immap_t structure is always correct. I'm
assuming on 8xx these values really aren't changing, take a look at
mpc83xx_devices.c
thanks
- kumar
On Apr 27, 2005, at 8:47 AM, Jason McMullan wrote:
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
> Date: April 27, 2005 8:48:03 AM CDT
> Subject:
>
>
>
> Date: April 27, 2005 8:48:03 AM CDT
> Subject:
>
>
> <ATT520952.txt><mpc8xx-platformize.patch>
>
> <signature.asc>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MPC8xx Platformization
2005-04-27 13:47 MPC8xx Platformization Jason McMullan
2005-04-27 14:42 ` Kumar Gala
@ 2005-05-20 17:37 ` Andrei Konovalov
2005-05-20 17:51 ` Dan Malek
1 sibling, 1 reply; 5+ messages in thread
From: Andrei Konovalov @ 2005-05-20 17:37 UTC (permalink / raw)
To: Jason McMullan; +Cc: PPC_LINUX
Hi Jason,
Jason McMullan wrote:
> The following is a rough skeleton of platformization for the mpc8xx
> series, in the same technique as Kumar's 85xx platformization.
>
> This rough cut will be followed up later with specific
> driver platformization fixes.
How is the progress on the 8xx platformization?
We are working (in the same direction) on a couple 8xx boards,
and there is an issue which is not addressed by your patch:
> ------------------------------------------------------------------------
>
> Date: Wed, 20 Apr 2005 11:11:23 -0400
> Signed-Off-By: Jason McMullan <jason.mcmullan@timesys.com>
> Description: MPC8xx platformization
>
...
> --- /dev/null
> +++ linux/arch/ppc/platforms/8xx/mpc8xx_sys.c
...
> +struct ppc_sys_spec ppc_sys_specs[] = {
> + {
> + .ppc_sys_name = "MPC885",
> + .mask = 0xFFFF0000,
> + .value = 0x00500000,
...
> --- linux-orig/arch/ppc/syslib/m8xx_setup.c
> +++ linux/arch/ppc/syslib/m8xx_setup.c
...
>
> + identify_ppc_sys_by_id(mfspr(PVR));
> +
All the MPC8xx'es have 0x0050 in the upper half of PVR.
So checking the value of PVR with .mask = 0xFFFF0000 makes no sense.
I've looked at how U-Boot detects the CPU, and the procedure is much more
complicated than just checking PVR and IMMR. U-Boot even probes (writes the
pattern to the register and reads it back) to check if the CPU has FEC.
But it still doesn't distinguish between e.g. MPC885, MPC880, MPC875, and MPC870
- though the set of on-chip devices is different for the four.
Anyone having an idea on what to pass to identify_ppc_sys_by_id() in case of MPC8xx?
Thanks,
Andrei
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: MPC8xx Platformization
2005-05-20 17:37 ` Andrei Konovalov
@ 2005-05-20 17:51 ` Dan Malek
0 siblings, 0 replies; 5+ messages in thread
From: Dan Malek @ 2005-05-20 17:51 UTC (permalink / raw)
To: Andrei Konovalov; +Cc: PPC_LINUX
On May 20, 2005, at 1:37 PM, Andrei Konovalov wrote:
> But it still doesn't distinguish between e.g. MPC885, MPC880, MPC875,
> and MPC870
> - though the set of on-chip devices is different for the four.
I don't believe you can reliably distinguish among many of these parts.
I've had parts stamped with a number on them, but it looks like it had
remnants of other, probably non-working, peripherals from another.
Just poking at some peripheral locations to determine processor
type isn't likely to always be accurate.
I don't think we should be writing any code that relies on the proper
identification of the parts. When building the code for a real product,
you always configure specifically for it to reduce code size and run
time
start up. As a development engineer, you should know the configuration
you are using as well. The only difference is in the peripherals
supported,
so just configure what you want to use.
Thanks.
-- Dan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2005-05-20 17:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-27 13:47 MPC8xx Platformization Jason McMullan
2005-04-27 14:42 ` Kumar Gala
2005-04-27 16:38 ` Jason McMullan
2005-05-20 17:37 ` Andrei Konovalov
2005-05-20 17:51 ` Dan Malek
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).