From c7c6da23028f146d912514b95aefa3da7cf37699 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 3 Oct 2007 07:34:10 +0200 Subject: ppc4xx: Make 440SPe PCIe code more generic to use on different 4xx PPCs (1) This patch is the first patch of a series to make the 440SPe PCIe code usable on different 4xx PPC platforms. In preperation for the new 405EX which is also equipped with PCIe interfaces. (1) This patch renames the files from 440spe_pcie to 4xx_pcie Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index a49066f..0c8e6cb 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -24,12 +24,11 @@ #include #include -#include #include -#include -#include - -#include "../cpu/ppc4xx/440spe_pcie.h" +#include +#include +#include +#include #undef PCIE_ENDPOINT /* #define PCIE_ENDPOINT 1 */ -- cgit v1.1 From 026f71106871f31d17d0ea0db9a7547ff92934bc Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 3 Oct 2007 07:48:09 +0200 Subject: ppc4xx: Make 440SPe PCIe code more generic to use on different 4xx PPCs (2) This patch is the first patch of a series to make the 440SPe PCIe code usable on different 4xx PPC platforms. In preperation for the new 405EX which is also equipped with PCIe interfaces. (2) This patch renames the functions from 440spe_ to 4xx_ with a little additional cleanup Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index 0c8e6cb..f1c352c 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -35,9 +35,6 @@ DECLARE_GLOBAL_DATA_PTR; -int ppc440spe_init_pcie_rootport(int port); -void ppc440spe_setup_pcie(struct pci_controller *hose, int port); - int board_early_init_f (void) { unsigned long mfr; @@ -409,9 +406,9 @@ void pcie_setup_hoses(int busno) continue; #ifdef PCIE_ENDPOINT - if (ppc440spe_init_pcie_endport(i)) { + if (ppc4xx_init_pcie_endport(i)) { #else - if (ppc440spe_init_pcie_rootport(i)) { + if (ppc4xx_init_pcie_rootport(i)) { #endif printf("PCIE%d: initialization failed\n", i); continue; @@ -433,13 +430,13 @@ void pcie_setup_hoses(int busno) pci_register_hose(hose); #ifdef PCIE_ENDPOINT - ppc440spe_setup_pcie_endpoint(hose, i); + ppc4xx_setup_pcie_endpoint(hose, i); /* * Reson for no scanning is endpoint can not generate * upstream configuration accesses. */ #else - ppc440spe_setup_pcie_rootpoint(hose, i); + ppc4xx_setup_pcie_rootpoint(hose, i); env = getenv ("pciscandelay"); if (env != NULL) { -- cgit v1.1 From d4cb2d17946466740afeb195a57d6cb290bf4cc0 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Sat, 13 Oct 2007 16:43:23 +0200 Subject: ppc4xx: Dynamic configuration of 4xx PCIe mode as root or endpoint mode This patch adds support for dynamic configuration of PCIe ports for the AMCC PPC4xx boards equipped with PCIe interfaces. These are the PPC440SPe boards Yucca & Katmai and the 405EX board Kilauea. This dynamic configuration is done via the "pcie_mode" environement variable. This variable can be set to "EP" or "RP" for endpoint or rootpoint mode. Multiple values can be joined via the ":" delimiter. Here an example: pcie_mode=RP:EP:EP This way, PCIe port 0 will be configured as rootpoint, PCIe port 1 and 2 as endpoint. Per default Yucca will be configured as: pcie_mode=RP:EP:EP Per default Katmai will be configured as: pcie_mode=RP:RP:REP Per default Kilauea will be configured as: pcie_mode=RP:RP Signed-off-by: Tirumala R Marri Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 65 +++++++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 33 deletions(-) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index f1c352c..0627a7a 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -30,9 +30,6 @@ #include #include -#undef PCIE_ENDPOINT -/* #define PCIE_ENDPOINT 1 */ - DECLARE_GLOBAL_DATA_PTR; int board_early_init_f (void) @@ -392,6 +389,7 @@ void pcie_setup_hoses(int busno) { struct pci_controller *hose; int i, bus; + int ret = 0; char *env; unsigned int delay; @@ -405,11 +403,14 @@ void pcie_setup_hoses(int busno) if (!katmai_pcie_card_present(i)) continue; -#ifdef PCIE_ENDPOINT - if (ppc4xx_init_pcie_endport(i)) { -#else - if (ppc4xx_init_pcie_rootport(i)) { -#endif + if (is_end_point(i)) { + printf("PCIE%d: will be configured as endpoint\n", i); + ret = ppc4xx_init_pcie_endport(i); + } else { + printf("PCIE%d: will be configured as root-complex\n", i); + ret = ppc4xx_init_pcie_rootport(i); + } + if (ret) { printf("PCIE%d: initialization failed\n", i); continue; } @@ -424,35 +425,33 @@ void pcie_setup_hoses(int busno) CFG_PCIE_MEMBASE + i * CFG_PCIE_MEMSIZE, CFG_PCIE_MEMBASE + i * CFG_PCIE_MEMSIZE, CFG_PCIE_MEMSIZE, - PCI_REGION_MEM - ); + PCI_REGION_MEM); hose->region_count = 1; pci_register_hose(hose); -#ifdef PCIE_ENDPOINT - ppc4xx_setup_pcie_endpoint(hose, i); - /* - * Reson for no scanning is endpoint can not generate - * upstream configuration accesses. - */ -#else - ppc4xx_setup_pcie_rootpoint(hose, i); - - env = getenv ("pciscandelay"); - if (env != NULL) { - delay = simple_strtoul (env, NULL, 10); - if (delay > 5) - printf ("Warning, expect noticable delay before PCIe" - "scan due to 'pciscandelay' value!\n"); - mdelay (delay * 1000); + if (is_end_point(i)) { + ppc4xx_setup_pcie_endpoint(hose, i); + /* + * Reson for no scanning is endpoint can not generate + * upstream configuration accesses. + */ + } else { + ppc4xx_setup_pcie_rootpoint(hose, i); + env = getenv ("pciscandelay"); + if (env != NULL) { + delay = simple_strtoul(env, NULL, 10); + if (delay > 5) + printf("Warning, expect noticable delay before " + "PCIe scan due to 'pciscandelay' value!\n"); + mdelay(delay * 1000); + } + + /* + * Config access can only go down stream + */ + hose->last_busno = pci_hose_scan(hose); + bus = hose->last_busno + 1; } - - /* - * Config access can only go down stream - */ - hose->last_busno = pci_hose_scan(hose); - bus = hose->last_busno + 1; -#endif } } #endif /* defined(CONFIG_PCI) */ -- cgit v1.1 From 654f38b3a387886996a5a75771fbfc29cb4f225e Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Mon, 5 Nov 2007 07:43:05 +0100 Subject: ppc4xx: Make output a little shorter on PCIe detection Now not max 3 lines but 2 lines are printed per PCIe port. Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index 0627a7a..669b828 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -403,15 +403,13 @@ void pcie_setup_hoses(int busno) if (!katmai_pcie_card_present(i)) continue; - if (is_end_point(i)) { - printf("PCIE%d: will be configured as endpoint\n", i); + if (is_end_point(i)) ret = ppc4xx_init_pcie_endport(i); - } else { - printf("PCIE%d: will be configured as root-complex\n", i); + else ret = ppc4xx_init_pcie_rootport(i); - } if (ret) { - printf("PCIE%d: initialization failed\n", i); + printf("PCIE%d: initialization as %s failed\n", i, + is_end_point(i) ? "endpoint" : "root-complex"); continue; } -- cgit v1.1 From a27044b14a9e93678a82d7b35f202b93e7687abc Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Thu, 6 Dec 2007 05:58:43 +0100 Subject: ppc4xx: Enable hardware-fix for PCI/DMA errata on AMCC 440SP/SPe boards This patch enables the hardware-fix for the PCI/DMA errata's 19+22 by setting the FIXD bit in the SDR0_MFR register. Here a description of the symptoms: Problem Description ------------------------------ If a DMA is performed between memory and PCI with the DMA 1 Controller using prefetch, and as a result uses a special purpose buffer selected by the PCIXn Bridge Options 1 Register (PCIXn_BRDGOPT1[RBP7] - bits 31-29), the first part of the transfer sequence is performed twice. The PPC440SPe PCI Controller requests more data than was needed such that in the case of enforce memory protection, a host CPU exception can occur. No data is corrupted, because data transfer is stopped in the PCI Controller. Prefetch enable is specified by setting DMA Configuration Register (I2O0_DMAx_CFG[DXEPD] - bit 31) to 0. Behavior that may be observed in a running system --------------------------------------------------------------------------- 1. DMA performance is decreased because of the double access on the PCI bus interface. 2. If an illegal access to some address on the PCI bus is detected at the system level, a machine check or similar system error may occur. Workarounds Available ---------------------------------- 1. Do not program prefetch. Note that a prefetch command cannot be programmed without selecting a special purpose buffer. 2. To avoid crossing a physical boundary of the PCI slave device, add 512 bytes of address to the PCI address range. This patch was originally provided by Pravin M. Bathija from AMCC and slighly changed. Signed-off-by: Pravin M. Bathija Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index 669b828..39a3ef1 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -217,10 +217,9 @@ int board_early_init_f (void) mtdcr (uic0sr, 0x00000000); /* clear all interrupts*/ mtdcr (uic0sr, 0xffffffff); /* clear all interrupts*/ -/* SDR0_MFR should be part of Ethernet init */ - mfsdr (sdr_mfr, mfr); - mfr &= ~SDR0_MFR_ECS_MASK; -/* mtsdr(sdr_mfr, mfr); */ + mfsdr(sdr_mfr, mfr); + mfr |= SDR0_MFR_FIXD; /* Workaround for PCI/DMA */ + mtsdr(sdr_mfr, mfr); mtsdr(SDR0_PFC0, CFG_PFC0); -- cgit v1.1 From bf8324e4a50758daff8cddd04c6a2ff8ed775bea Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Wed, 19 Dec 2007 09:05:40 +0100 Subject: ppc4xx: Add fdt support to AMCC Katmai eval board Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index 39a3ef1..25c9a22 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -25,6 +25,8 @@ #include #include #include +#include +#include #include #include #include @@ -533,3 +535,24 @@ int post_hotkeys_pressed(void) return (ctrlc()); } #endif + +#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) +void ft_board_setup(void *blob, bd_t *bd) +{ + u32 val[4]; + int rc; + + ft_cpu_setup(blob, bd); + + /* Fixup NOR mapping */ + val[0] = 0; /* chip select number */ + val[1] = 0; /* always 0 */ + val[2] = gd->bd->bi_flashstart; + val[3] = gd->bd->bi_flashsize; + rc = fdt_find_and_setprop(blob, "/plb/opb/ebc", "ranges", + val, sizeof(val), 1); + if (rc) + printf("Unable to update property NOR mapping, err=%s\n", + fdt_strerror(rc)); +} +#endif /* defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP) */ -- cgit v1.1 From 845c6c95dbfe6c915ce68a0a115852fa17932fb4 Mon Sep 17 00:00:00 2001 From: Stefan Roese Date: Sat, 5 Jan 2008 09:12:41 +0100 Subject: ppc4xx: Update Katmai/44x_spd_ddr2.c code for optimal DDR2 setup On Katmai the complete auto-calibration somehow doesn't seem to produce the best results, meaning optimal values for RQFD/RFFD. This was discovered by GDA using a high bandwidth scope, analyzing the DDR2 signals. GDA provided a fixed value for RQFD, so now on Katmai "only" RFFD is auto-calibrated. This patch also adds RDCC calibration as mentioned on page 7 of the AMCC PowerPC440SP/SPe DDR2 application note: "DDR1/DDR2 Initialization Sequence and Dynamic Tuning" Signed-off-by: Stefan Roese --- board/amcc/katmai/katmai.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'board/amcc/katmai/katmai.c') diff --git a/board/amcc/katmai/katmai.c b/board/amcc/katmai/katmai.c index 25c9a22..e41caaf 100644 --- a/board/amcc/katmai/katmai.c +++ b/board/amcc/katmai/katmai.c @@ -1,5 +1,5 @@ /* - * (C) Copyright 2007 + * (C) Copyright 2007-2008 * Stefan Roese, DENX Software Engineering, sr@denx.de. * * See file CREDITS for list of people who contributed to this @@ -246,6 +246,18 @@ int checkboard (void) return 0; } +/* + * Override the default functions in cpu/ppc4xx/44x_spd_ddr2.c with + * board specific values. + */ +u32 ddr_wrdtr(u32 default_val) { + return (SDRAM_WRDTR_LLWP_1_CYC | SDRAM_WRDTR_WTR_180_DEG_ADV | 0x823); +} + +u32 ddr_clktr(u32 default_val) { + return (SDRAM_CLKTR_CLKP_90_DEG_ADV); +} + #if defined(CFG_DRAM_TEST) int testdram (void) { -- cgit v1.1