MPC5121e ADS PCI support
PATCH 1/1 MPC5121e ADS PCI support
Third time's the charm.
Adds PCI support for MPC5121
Tested with drivers/net/rtl8139.c
This patch is identical to the previous except PCI support is now conditonal since pci on old silicon (most silicon currently in field) does not work.
ads5121_PCI_config turns on PCI
--- Makefile | 11 ++- board/ads5121/Makefile | 2 +- board/ads5121/ads5121.c | 1 + board/ads5121/pci.c | 216 +++++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/speed.c | 21 +++- include/asm-ppc/global_data.h | 1 + include/asm-ppc/immap_512x.h | 61 +++++++++++- include/configs/ads5121.h | 32 ++++++- include/mpc512x.h | 84 ++++++++++++++++ 9 files changed, 414 insertions(+), 15 deletions(-) create mode 100644 board/ads5121/pci.c
Makefile +9 -2
@@ -733,8 +733,15 @@ motionpro_config: unconfig ######################################################################### ## MPC512x Systems ######################################################################### -ads5121_config: unconfig - @$(MKCONFIG) ads5121 ppc mpc512x ads5121 +ads5121_config \ +ads5121_PCI_config \ + : unconfig + @echo "" >$(obj)include/config.h + @if [ "$(findstring _PCI_,$@)" ] ; then \ + echo "#define CONFIG_PCI" >>$(obj)include/config.h ; \ + $(XECHO) "... with PCI enabled" ; \ + fi + @$(MKCONFIG) -a ads5121 ppc mpc512x ads5121 #########################################################################
board/ads5121/Makefile +1 -1
@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o +COBJS := $(BOARD).o pci.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS))
board/ads5121/ads5121.c +1 -0
@@ -34,6 +34,7 @@ CLOCK_SCCR1_PSCFIFO_EN | \ CLOCK_SCCR1_DDR_EN | \ CLOCK_SCCR1_FEC_EN | \ + CLOCK_SCCR1_PCI_EN | \ CLOCK_SCCR1_TPR_EN)#define SCCR2_CLOCKS_EN (CLOCK_SCCR2_MEM_EN | \
board/ads5121/pci.c new file +216 -0
216 lines not on this page · raw message
cpu/mpc512x/speed.c +16 -5
@@ -67,12 +67,14 @@ int get_clocks (void)u8 cpmf;u8 sys_div;u8 ips_div; +u8 pci_div;u32 ref_clk =CFG_MPC512X_CLKIN ;u32 spll;u32 sys_clk;u32 core_clk;u32 csb_clk;u32 ips_clk; +u32 pci_clk;if ((im->sysconf.immrbar &IMMRBAR_BASE_ADDR ) != (u32 ) im)return -1 ;
@@ -95,8 +97,16 @@ int get_clocks (void)/* in case we cannot get a sane IPS divisor, fail gracefully */ ips_clk =0 ; } + pci_div = (im->clk.scfr[0 ] &SCFR1_PCI_DIV_MASK ) >>SCFR1_PCI_DIV_SHIFT ; +if (pci_div !=0 ) { + pci_clk = csb_clk / pci_div; + }else { +/* in case we cannot get a sane IPS divisor, fail gracefully */ + pci_clk =333333 ; + } gd->ips_clk = ips_clk; + gd->pci_clk = pci_clk; gd->csb_clk = csb_clk; gd->cpu_clk = core_clk; gd->bus_clk = csb_clk;
@@ -115,11 +125,12 @@ ulong get_bus_freq (ulong dummy)int do_clocks (cmd_tbl_t * cmdtp,int flag,int argc,char *argv[]) { -printf ("Clock configuration:\n" ); -printf (" CPU: %4d MHz\n" , gd->cpu_clk /1000000 ); -printf (" Coherent System Bus: %4d MHz\n" , gd->csb_clk /1000000 ); -printf (" IPS Bus: %4d MHz\n" , gd->ips_clk /1000000 ); -printf (" DDR: %4d MHz\n" ,2 * gd->csb_clk /1000000 ); +printf ("Clock configuration:\n" ); +printf (" CPU: %4d MHz\n" , gd->cpu_clk /1000000 ); +printf (" Coherent System Bus: %4d MHz\n" , gd->csb_clk /1000000 ); +printf (" IPS Bus: %4d MHz\n" , gd->ips_clk /1000000 ); +printf (" PCI: %4d MHz\n" , gd->pci_clk /1000000 ); +printf (" DDR: %4d MHz\n" ,2 * gd->csb_clk /1000000 );return 0 ; }
include/asm-ppc/global_data.h +1 -0
@@ -103,6 +103,7 @@ typedef struct global_data {#if defined(CONFIG_MPC512X )u32 ips_clk;u32 csb_clk; +u32 pci_clk;#endif /* CONFIG_MPC512X */ #if defined(CONFIG_MPC8220 )unsigned long bExtUart;
include/asm-ppc/immap_512x.h +55 -6
92 lines not on this page · raw message
include/configs/ads5121.h +31 -1
@@ -34,6 +34,9 @@* 0x3000_0000 - 0x3001_FFFF SRAM (128 KB) * 0x8000_0000 - 0x803F_FFFF IMMR (4 MB) * 0x8200_0000 - 0x8200_001F CPLD (32 B) +* 0x8400_0000 - 0x82FF_FFFF PCI I/O space (16 MB) +* 0xA000_0000 - 0xAFFF_FFFF PCI memory space (256 MB) +* 0xB000_0000 - 0xBFFF_FFFF PCI memory mapped I/O space (256 MB) * 0xFC00_0000 - 0xFFFF_FFFF NOR Boot FLASH (64 MB) */
@@ -43,7 +46,9 @@#define CONFIG_E300 1/* E300 Family */ #define CONFIG_MPC512X 1/* MPC512X family */ -#undef CONFIG_PCI +#if 0 /* set at config time */ +#define CONFIG_PCI +#endif #define CFG_MPC512X_CLKIN 66000000/* in Hz */
@@ -217,6 +222,31 @@#define CFG_PROMPT_HUSH_PS2 "> "#endif +/* +* PCI +*/ +#ifdef CONFIG_PCI + +/* +* General PCI +*/ +#define CFG_PCI_MEM_BASE 0xA0000000 +#define CFG_PCI_MEM_PHYS CFG_PCI_MEM_BASE +#define CFG_PCI_MEM_SIZE 0x10000000/* 256M */ +#define CFG_PCI_MMIO_BASE (CFG_PCI_MEM_BASE + CFG_PCI_MEM_SIZE) +#define CFG_PCI_MMIO_PHYS CFG_PCI_MMIO_BASE +#define CFG_PCI_MMIO_SIZE 0x10000000/* 256M */ +#define CFG_PCI_IO_BASE 0x00000000 +#define CFG_PCI_IO_PHYS 0x84000000 +#define CFG_PCI_IO_SIZE 0x01000000/* 16M */ + + +#define CONFIG_PCI_PNP /* do pci plug-and-play */ + +#define CONFIG_PCI_SCAN_SHOW /* show pci devices on startup */ + +#endif +/* I2C */ #define CONFIG_HARD_I2C /* I2C with hardware support */ #undef CONFIG_SOFT_I2C/* so disable bit-banged I2C */
include/mpc512x.h +84 -0
100 lines not on this page · raw message
Signature · 1 line
1.5.4
PATCH 1/1 MPC5121e ADS PCI support
board/ads5121/Makefile
Quoted 50 lines · John Rigby
Third time's the charm.
Adds PCI support for MPC5121
Tested with
drivers/net/rtl8139.cThis patch is identical to the previous except PCI support is now conditonal since pci on old silicon (most silicon currently in field) does not work.
ads5121_PCI_configturns on PCISigned-off-by John Rigby <[email protected]>--- Makefile | 11 ++- board/ads5121/Makefile | 2 +- board/ads5121/ads5121.c | 1 + board/ads5121/pci.c | 216 +++++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/speed.c | 21 +++- include/asm-ppc/global_data.h | 1 + include/asm-ppc/immap_512x.h | 61 +++++++++++- include/configs/ads5121.h | 32 ++++++- include/mpc512x.h | 84 ++++++++++++++++ 9 files changed, 414 insertions(+), 15 deletions(-) create mode 100644 board/ads5121/pci.cMakefile +9
-2@@ -733,8 +733,15 @@ motionpro_config: unconfig ######################################################################### ## MPC512x Systems ######################################################################### -ads5121_config: unconfig - @$(MKCONFIG) ads5121 ppc mpc512x ads5121 +ads5121_config \ +ads5121_PCI_config \ + : unconfig + @echo "" >$(obj)include/config.h + @if [ "$(findstring _PCI_,$@)" ] ; then \ + echo "#define CONFIG_PCI" >>$(obj)include/config.h ; \ + $(XECHO) "... with PCI enabled" ; \ + fi + @$(MKCONFIG) -a ads5121 ppc mpc512x ads5121 #########################################################################board/ads5121/Makefile +0
-0
I think I'll be better ot move the CONFIG_PCI to Makefile as follow
board/ads5121/Makefile include $(TOPDIR)/config.mk · line 26
Quoted 5 lines
board/ads5121/Makefile +0
-0@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a
COBJS-y := $(BOARD).o
COBJS-$(CONFIG_PCI) := pci
SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))
instead of
board/ads5121/Makefile include $(TOPDIR)/config.mk
Quoted 9 lines
board/ads5121/Makefile +4
-1-COBJS := $(BOARD).o +COBJS := $(BOARD).o pci.o SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) +#include <common.h> + +#ifdef CONFIG_PCI
so you could remove this
Quoted 11 lines
board/ads5121/Makefile +11
-0+ +#include <asm/mmu.h> +#include <asm/global_data.h> +#include <pci.h> +#if defined(CONFIG_OF_LIBFDT) +#include <libfdt.h> +#include <fdt_support.h> +#endif + +DECLARE_GLOBAL_DATA_PTR; +
...
board/ads5121/Makefile
Quoted 5 lines
board/ads5121/Makefile +5
-0+ tmp[0] = cpu_to_be32(gd->pci_clk); + do_fixup_by_path(blob, path, "clock-frequency", + &tmp, sizeof(tmp[0]), 1); +#endif /* CONFIG_OF_LIBFDT */ +#endif/* CONFIG_PCI */
and this
Quoted 15 lines
include/configs/ads5121.h +3
-0@@ -34,6 +34,9 @@* 0x3000_0000 - 0x3001_FFFF SRAM (128 KB) * 0x8000_0000 - 0x803F_FFFF IMMR (4 MB) * 0x8200_0000 - 0x8200_001F CPLD (32 B) +* 0x8400_0000 - 0x82FF_FFFF PCI I/O space (16 MB) +* 0xA000_0000 - 0xAFFF_FFFF PCI memory space (256 MB) +* 0xB000_0000 - 0xBFFF_FFFF PCI memory mapped I/O space (256 MB) * 0xFC00_0000 - 0xFFFF_FFFF NOR Boot FLASH (64 MB) */
include/configs/ads5121.h line 52
Quoted 8 lines
include/configs/ads5121.h +3
-1@@ -43,7 +46,9 @@#define CONFIG_E300 1/* E300 Family */ #define CONFIG_MPC512X 1/* MPC512X family */ -#undef CONFIG_PCI +#if 0 /* set at config time */ +#define CONFIG_PCI +#endif
I think is not needed, just a simple comment will be enough
include/configs/ads5121.h line 223
Quoted 6 lines
include/configs/ads5121.h +0
-0#define CFG_MPC512X_CLKIN 66000000/* in Hz */ @@ -217,6 +222,31 @@#define CFG_PROMPT_HUSH_PS2 "> "#endif
Best Regards,
J.
PATCH 1/1 MPC5121e ADS PCI support
Quoted 54 lines · Jean-Christophe PLAGNIOL-VILLARD
board/ads5121/Makefile
Quoted 50 lines · John Rigby
Third time's the charm.
Adds PCI support for MPC5121
Tested with
drivers/net/rtl8139.cThis patch is identical to the previous except PCI support is now conditonal since pci on old silicon (most silicon currently in field) does not work.
ads5121_PCI_configturns on PCISigned-off-by John Rigby <[email protected]>--- Makefile | 11 ++- board/ads5121/Makefile | 2 +- board/ads5121/ads5121.c | 1 + board/ads5121/pci.c | 216 +++++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/speed.c | 21 +++- include/asm-ppc/global_data.h | 1 + include/asm-ppc/immap_512x.h | 61 +++++++++++- include/configs/ads5121.h | 32 ++++++- include/mpc512x.h | 84 ++++++++++++++++ 9 files changed, 414 insertions(+), 15 deletions(-) create mode 100644 board/ads5121/pci.cMakefile +9
-2@@ -733,8 +733,15 @@ motionpro_config: unconfig ######################################################################### ## MPC512x Systems ######################################################################### -ads5121_config: unconfig - @$(MKCONFIG) ads5121 ppc mpc512x ads5121 +ads5121_config \ +ads5121_PCI_config \ + : unconfig + @echo "" >$(obj)include/config.h + @if [ "$(findstring _PCI_,$@)" ] ; then \ + echo "#define CONFIG_PCI" >>$(obj)include/config.h ; \ + $(XECHO) "... with PCI enabled" ; \ + fi + @$(MKCONFIG) -a ads5121 ppc mpc512x ads5121 #########################################################################board/ads5121/Makefile +0
-0I think I'll be better ot move the
CONFIG_PCItoMakefileas follow
Quoted 7 lines
board/ads5121/Makefile include $(TOPDIR)/config.mk · line 26
Quoted 5 lines
board/ads5121/Makefile +0
-0@@ -25,7 +25,7 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).aCOBJS-y := $(BOARD).o
COBJS-$(CONFIG_PCI) := pci
sorry a few missing, it will be this
COBJS-y += $(BOARD).o
COBJS-$(CONFIG_PCI) += pci
Quoted 8 lines
SRCS := $(SOBJS:.o=.S) $(COBJS-y:.o=.c)
OBJS := $(addprefix $(obj),$(COBJS-y))instead of
board/ads5121/Makefile include $(TOPDIR)/config.mk · line 28
Quoted 3 lines
board/ads5121/Makefile +1
-1-COBJS := $(BOARD).o +COBJS := $(BOARD).o pci.o
Best Regards,
J.