MPC5121e ADS PCI support take 3
PATCH 1/1 MPC5121e ADS PCI support take 3
Adds PCI support for MPC5121
Tested with drivers/net/rtl8139.c
Support is conditional since pci on old silicon
does not work.
ads5121_PCI_config turns on PCI
In this version, condition compilation of PCI code has
been moved from ifdef in board/ads5121/pci.c to board/ads5121/Makefile as suggested by Jean-Christophe PLAGNIOL-VILLARD
--- Makefile | 11 ++- board/ads5121/Makefile | 4 +- board/ads5121/ads5121.c | 1 + board/ads5121/pci.c | 213 +++++++++++++++++++++++++++++++++++++++++ cpu/mpc512x/speed.c | 21 +++- include/asm-ppc/global_data.h | 1 + include/asm-ppc/immap_512x.h | 61 +++++++++++- include/configs/ads5121.h | 30 ++++++- include/mpc512x.h | 84 ++++++++++++++++ 9 files changed, 411 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 +3 -1
@@ -25,8 +25,10 @@ include $(TOPDIR)/config.mk LIB = $(obj)lib$(BOARD).a -COBJS := $(BOARD).o +COBJS-y := $(BOARD).o +COBJS-$(CONFIG_PCI) += pci.o +COBJS := $(COBJS-y) SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS))
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 +213 -0
213 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 +29 -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,7 @@#define CONFIG_E300 1/* E300 Family */ #define CONFIG_MPC512X 1/* MPC512X family */ -#undef CONFIG_PCI +/* CONFIG_PCI is defined at config time */ #define CFG_MPC512X_CLKIN 66000000/* in Hz */
@@ -217,6 +220,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
Wolfgang Denk
AppliedPATCH 1/1 MPC5121e ADS PCI support take 3
Quoted 7 lines · In message <[email protected]> you wrote:
Adds PCI support for MPC5121
Tested with
drivers/net/rtl8139.cSupport is conditional since pci on old silicon
does not work.
Quoted 7 lines
ads5121_PCI_configturns on PCIIn this version, condition compilation of PCI code has
been moved from ifdef inboard/ads5121/pci.cto board/ads5121/Makefile as suggested by Jean-Christophe PLAGNIOL-VILLARDSigned-off-by John Rigby <[email protected]>
Applied, thanks.
Best regards,
Wolfgang Denk
Signature · 7 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
In any group of employed individuals the only naturally early riser
is _always_ the office manager, who will _always_ leave reproachful
little notes ... on the desks of their subordinates.
- Terry Pratchett, _Lords and Ladies_