MPC8xx Platformization
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.
Signature · 2 lines
Jason McMullan <[email protected]> TimeSys Corporation
Date: Wed, 20 Apr 2005 11:11:23 -0400
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(-)
arch/ppc/Makefile +2 -0
@@ -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/
arch/ppc/platforms/8xx/mpc8xx_ads.c new file +22 -0
@@ -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 ; +}
arch/ppc/platforms/8xx/mpc8xx_devices.c new file +282 -0
282 lines not on this page · raw message
arch/ppc/platforms/8xx/mpc8xx_sys.c new file +39 -0
@@ -0,0 +1,39 @@ +/* +* arch/ppc/platforms/8xx/mpc8xx_sys.c +* +* MPC8xx System descriptions +* +* Maintainer: Kumar Gala <[email protected]> +* +* 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 , + }, +};
arch/ppc/syslib/Makefile +2 -1
@@ -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
arch/ppc/syslib/m8xx_setup.c +3 -0
@@ -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 ;
include/asm-ppc/mpc8xx.h +31 -0
@@ -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__ */
include/asm-ppc/ppc_sys.h +2 -0
@@ -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
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
Quoted 18 lines · Jason McMullan
_______________________________________________
Linuxppc-embedded mailing list
[email protected]
https://ozlabs.org/mailman/listinfo/linuxppc-embeddedDate: 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>
Quoted 5 lines · Kumar Gala
Jason,
Two comments:
1. putmpc8xx_devices.c&mpc8xx_sys.cinarch/ppc/syslib(I moved the 85xx ones here and its where 83xx & 52xx are)
Ok.
Quoted 4 lines
2. can we just use hard coded offsets for start & end values. I really hate assuming that the global
immap_tstructure is always correct. I'm assuming on 8xx these values really aren't changing, take a look atmpc83xx_devices.c
No problem. I'll get another patch out soon.
Signature · 2 lines
Jason McMullan <[email protected]> TimeSys Corporation
Hi Jason,
Quoted 5 lines · Jason McMullan
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:
Quoted 6 lines
------------------------------------------------------------------------
Date: Wed, 20 Apr 2005 11:11:23 -0400
Signed-off-by Jason McMullan <[email protected]>Description: MPC8xx platformization
...
Quoted 2 lines
arch/ppc/platforms/8xx/mpc8xx_sys.c new file +0
-0
...
Quoted 5 lines
arch/ppc/platforms/8xx/mpc8xx_sys.c new file +5
-0+struct ppc_sys_spec ppc_sys_specs[] = { + { + .ppc_sys_name ="MPC885" , + .mask =0xFFFF0000 , + .value =0x00500000 ,
...
Quoted 2 lines
arch/ppc/syslib/m8xx_setup.c +0
-0
...
arch/ppc/syslib/m8xx_setup.c line 413
Quoted 3 lines
arch/ppc/syslib/m8xx_setup.c +2
-0+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
Quoted 2 lines · Andrei Konovalov
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