IXP425: Fixing PCI access
PATCH v2 1/1 IXP425: Fixing PCI access
This patch fixes the PCI handling routines of the IXP port. It seems that this hasn't been touched for quite a while and u-boot PCI handling has changed since then (but nobody update IXP).
Changes (list uncomplete):
- non_prefetched_read/write now return ERROR on (master-) abort.
- fixed pci configuration space access.
- pci_read_config_XXX now return value 0xff even in case of error (as some callers do not check the return value)
- Removed CONFIG_PCI_SCAN_SHOW, as printf is not possible at the time pci_scan is called initially
- fixed some IXP initialization of memory spaces
- fixed address and irq assignment to PCI devices
- fixed pci_find_device
- some reformatting
Note: I think boards should always define IXP425_PCI_SIMPLE_MAPPING
Patch was tested with Janz emPC-A400.
---
I revised the patch as I found some more errors.
board/ixdp425/ixdp425.c | 9 + cpu/ixp/pci.c | 407 ++++++++++++++++++++-------------- drivers/pci/pci_indirect.c | 4 +- include/asm-arm/arch-ixp/ixp425pci.h | 14 +- 4 files changed, 260 insertions(+), 174 deletions(-)
board/ixdp425/ixdp425.c +9 -0
@@ -118,9 +118,18 @@ void pci_init_board(void) pci_ixp_init(&hose); } + +#include <pci.h> +int pciTranslateIrq (pci_dev_t dev,int intPin) +{ +/* FIXME: This needs to be implemented by someone +who onws an IXDP425 board */ +return 0 ; +}#endif int board_eth_init (bd_t *bis) {return pci_eth_init (bis); } +
cpu/ixp/pci.c +243 -164
588 lines not on this page · raw message
drivers/pci/pci_indirect.c +2 -2
@@ -11,7 +11,7 @@#include <common.h> -#if (!defined(__I386__) && !defined(CONFIG_IXDP425 )) +#if (!defined(__I386__) && !defined(CONFIG_IXP425 ))#include <asm/processor.h> #include <asm/io.h>
@@ -133,4 +133,4 @@ void pci_setup_indirect(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data) hose->cfg_data = (unsigned char *) cfg_data; } -#endif /* !__I386__ && !CONFIG_IXDP425 */ +#endif /* !__I386__ && !CONFIG_IXP425 */
include/asm-arm/arch-ixp/ixp425pci.h +6 -8
@@ -52,9 +52,7 @@ typedef struct typedef struct { - unsigned int bus; - unsigned int device; - unsigned int func; + pci_dev_t device; unsigned int irq; BOOL error; unsigned short vendor_id;
@@ -74,13 +72,13 @@ typedef struct#define IXP425_PCI_BAR_QUERY 0xffffffff -#define IXP425_PCI_BAR_MEM_BASE 0x100000 -#define IXP425_PCI_BAR_IO_BASE 0x000000 +#define IXP425_PCI_BAR_MEM_BASE 0x48000000 +#define IXP425_PCI_BAR_IO_BASE 0x00000000/* not supported */ /*define the maximum number of bus segments - we support a single segment*/ -#define IXP425_PCI_MAX_BUS 1 +#define IXP425_PCI_MAX_BUS 4/*define the maximum number of cards per bus segment*/ -#define IXP425_PCI_MAX_DEV 4 +#define IXP425_PCI_MAX_DEV 8/*define the maximum number of functions per device*/ #define IXP425_PCI_MAX_FUNC 8/* define the maximum number of separate functions that we can
@@ -153,7 +151,7 @@ typedef struct/*define the default setting of the AHB memory base reg*/ #define IXP425_PCI_AHBMEMBASE_DEFAULT 0x00010203#define IXP425_PCI_AHBIOBASE_DEFAULT 0x0 -#define IXP425_PCI_PCIMEMBASE_DEFAULT 0x0 +#define IXP425_PCI_PCIMEMBASE_DEFAULT 0x48494a4b/*define the default settings for the controller's BARs*/ #ifdef IXP425_PCI_SIMPLE_MAPPING
Signature · 1 line
1.5.4.5
PATCH v2 1/1 IXP425: Fixing PCI access
This fixes conflict existing with IXP425_PCI_SIMPLE_MAPPING. BAR0 and BAR4 were both defined 0, which prevented external bus masters from accessing first 16MByte of main memory.
This is an incrmental patch to patch posted 20081206.
--- cpu/ixp/pci.c | 3 +-- include/asm-arm/arch-ixp/ixp425pci.h | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-)
cpu/ixp/pci.c +1 -2
@@ -340,11 +340,10 @@ void pci_ixp_init (struct pci_controller *hose)REG_WRITE (PCI_CSR_BASE ,PCI_PCIMEMBASE_OFFSET ,IXP425_PCI_PCIMEMBASE_DEFAULT ); -crp_write (PCI_CFG_SUB_VENDOR_ID ,IXP425_PCI_SUB_VENDOR_SYSTEM ); -REG_READ (PCI_CSR_BASE ,PCI_CSR_OFFSET , regval); regval |=PCI_CSR_IC |PCI_CSR_ABE |PCI_CSR_PDS ;REG_WRITE (PCI_CSR_BASE ,PCI_CSR_OFFSET , regval); +crp_write (PCI_CFG_COMMAND ,PCI_CFG_CMD_MAE |PCI_CFG_CMD_BME );udelay (1000 );
include/asm-arm/arch-ixp/ixp425pci.h +2 -2
@@ -159,8 +159,8 @@ typedef struct#define IXP425_PCI_BAR_1_DEFAULT 0x01000000#define IXP425_PCI_BAR_2_DEFAULT 0x02000000#define IXP425_PCI_BAR_3_DEFAULT 0x03000000 -#define IXP425_PCI_BAR_4_DEFAULT 0x00000000 -#define IXP425_PCI_BAR_5_DEFAULT 0x00000000 +#define IXP425_PCI_BAR_4_DEFAULT 0xff000000 +#define IXP425_PCI_BAR_5_DEFAULT 0xfffff000#else #define IXP425_PCI_BAR_0_DEFAULT 0x40000000#define IXP425_PCI_BAR_1_DEFAULT 0x41000000
Signature · 1 line
1.5.4.5
PATCH v2 1/1 IXP425: Fixing PCI access
In reply to Stefan AlthoeferDear Stefan Althoefer,
Quoted 5 lines · In message <[email protected]> you wrote:
This patch fixes the PCI handling routines of the IXP port. It seems that this hasn't been touched for quite a while and u-boot PCI handling has changed since then (but nobody update IXP).
Quoted 13 lines
Changes (list uncomplete):
- non_prefetched_read/write now return ERROR on (master-) abort.
- fixed pci configuration space access.
-pci_read_config_XXXnow return value0xffeven in case of error (as some callers do not check the return value)
- RemovedCONFIG_PCI_SCAN_SHOW, as printf is not possible at the timepci_scanis called initially
- fixed some IXP initialization of memory spaces
- fixed address and irq assignment to PCI devices
- fixedpci_find_device
- some reformatting
I think most (all?) of my coding style comments for theold version of this patch still apply and need to be addressed.
Quoted 1 line
Note: I think boards should always define
IXP425_PCI_SIMPLE_MAPPING
In this case IXP425_PCI_SIMPLE_MAPPING should be eliminated.
Best regards,
Wolfgang Denk
Signature · 6 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 That's the thing about people who think they hate computers. What they really hate is lousy programmers. - Larry Niven and Jerry Pournelle in "Oath of Fealty"