dm: x86: PCI/SPI fixes for minnowboard MAX
cover dm: x86: PCI/SPI fixes for minnowboard MAX
The SPI flash starts off protected on baytrail. The code which is supposed to fix this is broken. This series fixes that, enables the SPI environment and adds documentation.
Also when driver model is enabled for PCI some bugs appear. This series fixes those and enables driver model for PCI on minnowboard MAX.
Simon Glass (11):
spi: sf: Print the error code on failure
dm: spi: Correct minor nits in ICH driver
dm: spi: Correct status register access width
dm: spi: Correct BIOS protection logic for ICH9
dm: spi: Enable environment for minnowmax
x86: Add ROM image description for minnowmax
x86: pci: Tidy up the generic x86 PCI driver
dm: x86: minnowmax: Move PCI to use driver model
dm: pci: Use the correct hose when configuring devices
dm: pci: Correct bus number when scanning sub-buses
dm: x86: baytrail: Correct PCI region 3 when driver model is used
arch/x86/cpu/baytrail/Makefile | 1 - arch/x86/cpu/baytrail/pci.c | 46 ------------------------------------------ arch/x86/dts/minnowmax.dts | 10 +++++++++ common/cmd_sf.c | 8 ++++++-- configs/minnowmax_defconfig | 1 + doc/README.x86 | 17 ++++++++++++++++ drivers/pci/pci-uclass.c | 11 +++++++--- drivers/pci/pci_common.c | 6 ++++++ drivers/pci/pci_x86.c | 5 ++++- drivers/spi/ich.c | 11 +++++----- include/configs/minnowmax.h | 6 +++--- include/pci.h | 10 +++++++++ 12 files changed, 70 insertions(+), 62 deletions(-) delete mode 100644 arch/x86/cpu/baytrail/pci.c
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 1/11 spi: sf: Print the error code on failure
Rather than just 'ERROR', display the error code, which may be useful, at least with driver model.
---
common/cmd_sf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
common/cmd_sf.c +6 -2
@@ -300,8 +300,12 @@ static int do_spi_flash_read_write(int argc, char * const argv[])else ret =spi_flash_write (flash, offset, len, buf); -printf ("SF: %zu bytes @ %#x %s: %s\n" , (size_t )len, (u32 )offset, - read ?"Read" :"Written" , ret ?"ERROR" :"OK" ); +printf ("SF: %zu bytes @ %#x %s: " , (size_t )len, (u32 )offset, + read ?"Read" :"Written" ); +if (ret) +printf ("ERROR %d\n" , ret); +else +printf ("OK\n" ); }unmap_physmem (buf, len);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 1/11 spi: sf: Print the error code on failure
Quoted 19 lines · Simon Glass
Rather than just 'ERROR', display the error code, which may be useful, at least with driver model.
Signed-off-by Simon Glass <[email protected]>---
common/cmd_sf.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)common/cmd_sf.c +0
-2@@ -300,8 +300,12 @@ static int do_spi_flash_read_write(int argc, char * const argv[])else ret =spi_flash_write (flash, offset, len, buf); -printf ("SF: %zu bytes @ %#x %s: %s\n" , (size_t )len, (u32 )offset, - read ?"Read" :"Written" , ret ?"ERROR" :"OK" );
common/cmd_sf.c static int do_spi_flash_read_write(int argc, char * const argv[])
Quoted 10 lines
common/cmd_sf.c +6
-1+printf ("SF: %zu bytes @ %#x %s: " , (size_t )len, (u32 )offset, + read ?"Read" :"Written" ); +if (ret) +printf ("ERROR %d\n" , ret); +else +printf ("OK\n" ); }unmap_physmem (buf, len); --
PATCH 1/11 spi: sf: Print the error code on failure
In reply to Simon GlassQuoted 4 lines · Simon Glass
Rather than just 'ERROR', display the error code, which may be useful, at least with driver model.
Signed-off-by Simon Glass <[email protected]>
Best regards,
Marek Vasut
PATCH 1/11 spi: sf: Print the error code on failure
Quoted 7 lines · Marek Vasut
Quoted 4 lines · Simon Glass
Rather than just 'ERROR', display the error code, which may be useful, at least with driver model.
Signed-off-by Simon Glass <[email protected]>Acked-by Marek Vasut <[email protected]>
thanks!
Signature · 1 line
Jagan | Openedev.
PATCH 1/11 spi: sf: Print the error code on failure
Quoted 10 lines · Jagan Teki
Quoted 7 lines · Marek Vasut
Quoted 4 lines · Simon Glass
Rather than just 'ERROR', display the error code, which may be useful, at least with driver model.
Signed-off-by Simon Glass <[email protected]>Acked-by Marek Vasut <[email protected]>Reviewed-by Jagan Teki <[email protected]>
Since this is part of a bug-fix series I'll apply it now.
Applied to u-boot-x86.
PATCH 2/11 dm: spi: Correct minor nits in ICH driver
In reply to Simon GlassTidy up three minor problems in this file.
---
drivers/spi/ich.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/spi/ich.c +2 -3
@@ -422,7 +422,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,int using_cmd =0 ;int ret; -/* Ee don't support writing partial bytes. */ +/* We don't support writing partial bytes */ if (bitlen %8 ) {debug ("ICH SPI: Accessing partial bytes not supported\n" );return -EPROTONOSUPPORT ;
@@ -601,7 +601,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return status;if (status &SPIS_FCERR ) { -debug ("ICH SPI: Data transaction error\n" ); +debug ("ICH SPI: Data transaction error %x\n" , status);return -EIO ; }
@@ -619,7 +619,6 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return 0 ; } -/* * This uses the SPI controller from the Intel Cougar Point and Panther Point * PCH to write-protect portions of the SPI flash until reboot. The changes
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 2/11 dm: spi: Correct minor nits in ICH driver
Quoted 31 lines · Simon Glass
Tidy up three minor problems in this file.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/spi/ich.c +2
-2@@ -422,7 +422,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,int using_cmd =0 ;int ret; -/* Ee don't support writing partial bytes. */ +/* We don't support writing partial bytes */ if (bitlen %8 ) {debug ("ICH SPI: Accessing partial bytes not supported\n" );return -EPROTONOSUPPORT ;@@ -601,7 +601,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return status;if (status &SPIS_FCERR ) { -debug ("ICH SPI: Data transaction error\n" ); +debug ("ICH SPI: Data transaction error %x\n" , status);return -EIO ; }
drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
Quoted 8 lines
drivers/spi/ich.c +0
-2@@ -619,7 +619,6 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return 0 ; } -/* * This uses the SPI controller from the Intel Cougar Point and Panther Point * PCH to write-protect portions of the SPI flash until reboot. The changes --
PATCH 2/11 dm: spi: Correct minor nits in ICH driver
Quoted 35 lines · Bin Meng
Quoted 34 lines · Simon Glass
Tidy up three minor problems in this file.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/spi/ich.c +2
-2@@ -422,7 +422,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,int using_cmd =0 ;int ret; -/* Ee don't support writing partial bytes. */ +/* We don't support writing partial bytes */ if (bitlen %8 ) {debug ("ICH SPI: Accessing partial bytes not supported\n" );return -EPROTONOSUPPORT ;@@ -601,7 +601,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return status;if (status &SPIS_FCERR ) { -debug ("ICH SPI: Data transaction error\n" ); +debug ("ICH SPI: Data transaction error %x\n" , status);return -EIO ; }@@ -619,7 +619,6 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return 0 ; }
Quoted 7 lines
drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
Quoted 5 lines
drivers/spi/ich.c +0
-2-/* * This uses the SPI controller from the Intel Cougar Point and Panther Point * PCH to write-protect portions of the SPI flash until reboot. The changes -- Reviewed-by Bin Meng <[email protected]>
thanks!
Signature · 1 line
Jagan | Openedev.
PATCH 2/11 dm: spi: Correct minor nits in ICH driver
Quoted 44 lines · Jagan Teki
Quoted 35 lines · Bin Meng
Quoted 34 lines · Simon Glass
Tidy up three minor problems in this file.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/spi/ich.c +2
-2@@ -422,7 +422,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,int using_cmd =0 ;int ret; -/* Ee don't support writing partial bytes. */ +/* We don't support writing partial bytes */ if (bitlen %8 ) {debug ("ICH SPI: Accessing partial bytes not supported\n" );return -EPROTONOSUPPORT ;@@ -601,7 +601,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return status;if (status &SPIS_FCERR ) { -debug ("ICH SPI: Data transaction error\n" ); +debug ("ICH SPI: Data transaction error %x\n" , status);return -EIO ; }@@ -619,7 +619,6 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,return 0 ; }Quoted 7 lines
drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
Quoted 5 lines
drivers/spi/ich.c +0
-2-/* * This uses the SPI controller from the Intel Cougar Point and Panther Point * PCH to write-protect portions of the SPI flash until reboot. The changes -- Reviewed-by Bin Meng <[email protected]>
Quoted 1 line
Reviewed-by Jagan Teki <[email protected]>
Since this is part of a bug-fix series I'll apply it now.
Applied to u-boot-x86.
PATCH 3/11 dm: spi: Correct status register access width
In reply to Simon GlassThe status register is a single byte, so use byte access when writing to it, to avoid updating the control register also.
---
drivers/spi/ich.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/ich.c +1 -1
@@ -477,7 +477,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,if (ret <0 )return ret; -ich_writew (ctlr,SPIS_CDS |SPIS_FCERR , ctlr->status); +ich_writeb (ctlr,SPIS_CDS |SPIS_FCERR , ctlr->status);spi_setup_type (trans, using_cmd ? bytes :0 ); opcode_index =spi_setup_opcode (ctlr, trans);
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 3/11 dm: spi: Correct status register access width
Hi Simon,
Quoted 14 lines · Simon Glass
The status register is a single byte, so use byte access when writing to it, to avoid updating the control register also.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/spi/ich.c +0
-0
drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen, · line 480
Quoted 5 lines
drivers/spi/ich.c +1
-1@@ -477,7 +477,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,if (ret <0 )return ret; -ich_writew (ctlr,SPIS_CDS |SPIS_FCERR , ctlr->status); +ich_writeb (ctlr,SPIS_CDS |SPIS_FCERR , ctlr->status);
But for ICH7 the status is 16-bit. Please handle both cases.
drivers/spi/ich.c static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,
Quoted 4 lines
drivers/spi/ich.c +0
-1spi_setup_type (trans, using_cmd ? bytes :0 ); opcode_index =spi_setup_opcode (ctlr, trans); --
Regards,
Bin
PATCH 4/11 dm: spi: Correct BIOS protection logic for ICH9
In reply to Simon GlassThe logic is incorrect and currently has no effect. Fix it so that we can write to SPI flash, since by default it is write-protected.
---
drivers/spi/ich.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/ich.c +2 -2
@@ -687,10 +687,10 @@ static int ich_spi_probe(struct udevice *bus)struct ich9_spi_regs *ich9_spi; ich9_spi = priv->base; - bios_cntl =ich_readb (priv, ich9_spi->bcr); + bios_cntl =readb (&ich9_spi->bcr); bios_cntl &= ~(1 <<5 );/* clear Enable InSMM_STS (EISS) */ bios_cntl |=1 ;/* Write Protect Disable (WPD) */ -ich_writeb (priv, bios_cntl, ich9_spi->bcr); +writeb (bios_cntl, &ich9_spi->bcr); }else {pci_read_config_byte (plat->dev,0xdc , &bios_cntl);if (plat->ich_version ==9 )
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 4/11 dm: spi: Correct BIOS protection logic for ICH9
Quoted 17 lines · Simon Glass
The logic is incorrect and currently has no effect. Fix it so that we can write to SPI flash, since by default it is write-protected.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/ich.c +0
-0@@ -687,10 +687,10 @@ static int ich_spi_probe(struct udevice *bus)struct ich9_spi_regs *ich9_spi; ich9_spi = priv->base;
drivers/spi/ich.c static int ich_spi_probe(struct udevice *bus)
Quoted 10 lines
drivers/spi/ich.c +2
-3- bios_cntl =ich_readb (priv, ich9_spi->bcr); + bios_cntl =readb (&ich9_spi->bcr); bios_cntl &= ~(1 <<5 );/* clear Enable InSMM_STS (EISS) */ bios_cntl |=1 ;/* Write Protect Disable (WPD) */ -ich_writeb (priv, bios_cntl, ich9_spi->bcr); +writeb (bios_cntl, &ich9_spi->bcr); }else {pci_read_config_byte (plat->dev,0xdc , &bios_cntl);if (plat->ich_version ==9 ) --
PATCH 4/11 dm: spi: Correct BIOS protection logic for ICH9
In reply to Simon GlassHi Simon,
Quoted 14 lines · Simon Glass
The logic is incorrect and currently has no effect. Fix it so that we can write to SPI flash, since by default it is write-protected.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/ich.c +0
-0
drivers/spi/ich.c static int ich_spi_probe(struct udevice *bus) · line 690
Quoted 5 lines
drivers/spi/ich.c +1
-1@@ -687,10 +687,10 @@ static int ich_spi_probe(struct udevice *bus)struct ich9_spi_regs *ich9_spi; ich9_spi = priv->base; - bios_cntl =ich_readb (priv, ich9_spi->bcr); + bios_cntl =readb (&ich9_spi->bcr);
Couldn't understand based on the commit message, So for BIOS protection base shouldn't require or something?
It's not looks good to me to use generic io calls (readb|writeb) with in the functionality
code though we have a private calls defined on top to use generic ones.
Quoted 10 lines
drivers/spi/ich.c +1
-2bios_cntl &= ~(1 <<5 );/* clear Enable InSMM_STS (EISS) */ bios_cntl |=1 ;/* Write Protect Disable (WPD) */ -ich_writeb (priv, bios_cntl, ich9_spi->bcr); +writeb (bios_cntl, &ich9_spi->bcr); }else {pci_read_config_byte (plat->dev,0xdc , &bios_cntl);if (plat->ich_version ==9 ) --2.2.0.rc0.207.ga3a616c
thanks!
Signature · 1 line
Jagan | Openedev.
PATCH 4/11 dm: spi: Correct BIOS protection logic for ICH9
Hi Jagan,
Quoted 19 lines · Jagan Teki
Hi Simon,
Quoted 16 lines · Simon Glass
The logic is incorrect and currently has no effect. Fix it so that we can write to SPI flash, since by default it is write-protected.
Signed-off-by Simon Glass <[email protected]>---
drivers/spi/ich.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/spi/ich.c +0
-0@@ -687,10 +687,10 @@ static int ich_spi_probe(struct udevice *bus)struct ich9_spi_regs *ich9_spi;
Quoted 7 lines
drivers/spi/ich.c static int ich_spi_probe(struct udevice *bus) · line 690
Quoted 3 lines
drivers/spi/ich.c +1
-1ich9_spi = priv->base; - bios_cntl =ich_readb (priv, ich9_spi->bcr); + bios_cntl =readb (&ich9_spi->bcr);Couldn't understand based on the commit message, So for BIOS protection base shouldn't require or something?
This is because ich9_spi->bcr is the full address (i.e. not just offset of the register like the others in this driver file)
Quoted 4 lines
It's not looks good to me to use generic io calls (readb|writeb) with in the functionality
code though we have a private calls defined on top to use generic ones.
Then we need make ich9_spi->bcr become its offset, so the private calls can be used.
Quoted 8 lines
drivers/spi/ich.c static int ich_spi_probe(struct udevice *bus)
Quoted 8 lines
drivers/spi/ich.c +1
-2bios_cntl &= ~(1 <<5 );/* clear Enable InSMM_STS (EISS) */ bios_cntl |=1 ;/* Write Protect Disable (WPD) */ -ich_writeb (priv, bios_cntl, ich9_spi->bcr); +writeb (bios_cntl, &ich9_spi->bcr); }else {pci_read_config_byte (plat->dev,0xdc , &bios_cntl);if (plat->ich_version ==9 ) --
Regards,
Bin
PATCH 5/11 dm: spi: Enable environment for minnowmax
In reply to Simon GlassEnable a SPI environment and store it in a suitable place.
---
include/configs/minnowmax.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
include/configs/minnowmax.h +2 -3
@@ -65,8 +65,7 @@/* Avoid a warning in the Realtek Ethernet driver */ #define CONFIG_SYS_CACHELINE_SIZE 16 -/* Environment in SPI flash is unsupported for now */ -#undef CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SECT_SIZE 0x1000 +#define CONFIG_ENV_OFFSET 0x007fe000#endif /* __CONFIG_H */
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 5/11 dm: spi: Enable environment for minnowmax
Quoted 14 lines · Simon Glass
Enable a SPI environment and store it in a suitable place.
Signed-off-by Simon Glass <[email protected]>---
include/configs/minnowmax.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/configs/minnowmax.h +0
-0@@ -65,8 +65,7 @@/* Avoid a warning in the Realtek Ethernet driver */
include/configs/minnowmax.h
Quoted 10 lines
include/configs/minnowmax.h +2
-4#define CONFIG_SYS_CACHELINE_SIZE 16 -/* Environment in SPI flash is unsupported for now */ -#undef CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SECT_SIZE 0x1000 +#define CONFIG_ENV_OFFSET 0x007fe000#endif /* __CONFIG_H */ --
PATCH 5/11 dm: spi: Enable environment for minnowmax
Quoted 23 lines · Bin Meng
Quoted 22 lines · Simon Glass
Enable a SPI environment and store it in a suitable place.
Signed-off-by Simon Glass <[email protected]>---
include/configs/minnowmax.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)include/configs/minnowmax.h +2
-3@@ -65,8 +65,7 @@/* Avoid a warning in the Realtek Ethernet driver */ #define CONFIG_SYS_CACHELINE_SIZE 16 -/* Environment in SPI flash is unsupported for now */ -#undef CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_IS_NOWHERE +#define CONFIG_ENV_SECT_SIZE 0x1000 +#define CONFIG_ENV_OFFSET 0x007fe000
Quoted 4 lines
include/configs/minnowmax.h
Quoted 2 lines
include/configs/minnowmax.h +0
-1#endif /* __CONFIG_H */ --Reviewed-by Bin Meng <[email protected]>
thanks!
Signature · 1 line
Jagan | Openedev.
PATCH 6/11 x86: Add ROM image description for minnowmax
In reply to Simon GlassThe layout of the ROM is a bit hard to discover by reading the code. Add a table to make it easier.
---
doc/README.x86 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
doc/README.x86 +17 -0
@@ -160,6 +160,23 @@ Now you can build U-Boot and obtain u-boot.rom $ make minnowmax_defconfig $ make all +The ROM image is broken up into these parts: + +Offset Description Controlling config +------------------------------------------------------------ +000000 descriptor.bin Hard-coded to 0 in iftool +001000 me.bin Set by the descriptor +500000 <spare> +700000 u-boot-dtb.bin CONFIG_SYS_TEXT_BASE +790000 vga.bin CONFIG_X86_OPTION_ROM_ADDR +7c0000 fsp.bin CONFIG_FSP_ADDR +7f8000 <spare> (depends on size of fsp.bin) +7fe000 Emvironment CONFIG_ENV_OFFSET +7ff800 U-Boot 16-bit boot CONFIG_SYS_X86_START16 + +Overall ROM image size is controlled by CONFIG_ROM_SIZE. + + Intel Galileo instructions: Only one binary blob is needed for Remote Management Unit (RMU) within Intel
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 6/11 x86: Add ROM image description for minnowmax
Hi Simon,
Quoted 14 lines · Simon Glass
The layout of the ROM is a bit hard to discover by reading the code. Add a table to make it easier.
Signed-off-by Simon Glass <[email protected]>---
doc/README.x86 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)doc/README.x86 +0
-0
doc/README.x86 Now you can build U-Boot and obtain u-boot.rom · line 167
Quoted 8 lines
doc/README.x86 +5
-0@@ -160,6 +160,23 @@ Now you can build U-Boot and obtain u-boot.rom $ make minnowmax_defconfig $ make all +The ROM image is broken up into these parts: + +Offset Description Controlling config +------------------------------------------------------------ +000000 descriptor.bin Hard-coded to 0 in iftool
iftool -> ifdtool
doc/README.x86 Now you can build U-Boot and obtain u-boot.rom · line 174
Quoted 7 lines
doc/README.x86 +7
-0+001000 me.bin Set by the descriptor +500000 <spare> +700000 u-boot-dtb.bin CONFIG_SYS_TEXT_BASE +790000 vga.bin CONFIG_X86_OPTION_ROM_ADDR +7c0000 fsp.bin CONFIG_FSP_ADDR +7f8000 <spare> (depends on size of fsp.bin) +7fe000 Emvironment CONFIG_ENV_OFFSET
Environment
doc/README.x86 Now you can build U-Boot and obtain u-boot.rom
Quoted 9 lines
doc/README.x86 +5
-1+7ff800 U-Boot 16-bit boot CONFIG_SYS_X86_START16 + +Overall ROM image size is controlled by CONFIG_ROM_SIZE. + + Intel Galileo instructions: Only one binary blob is needed for Remote Management Unit (RMU) within Intel --
Regards,
Bin
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
In reply to Simon GlassThis driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/pci/pci_x86.c +4 -1
@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> static const struct dm_pci_ops x86_pci_ops = { + .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config, };static const struct udevice_id x86_pci_ids[] = { - { .compatible ="x86,pci" }, + { .compatible ="pci-x86" }, { } };
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Simon,
Quoted 14 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +0
-0
drivers/pci/pci_x86.c line 12
Quoted 6 lines
drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> static const struct dm_pci_ops x86_pci_ops = {
To keep the consistent naming to match the driver name, can we rename this to pci_x86_ops?
drivers/pci/pci_x86.c line 14
Quoted 2 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,
Can we move pci_x86_read_config() and pci_x86_write_config() from arch/x86/cpu/pci.c to this file to make it a complete driver file? Also create a new header file pci_x86.h to declare these two so that it can be used by ivybridge.
drivers/pci/pci_x86.c line 17
Quoted 3 lines
drivers/pci/pci_x86.c +0
-0};static const struct udevice_id x86_pci_ids[] = {
Can we rename this to pci_x86_ids?
drivers/pci/pci_x86.c
Quoted 6 lines
drivers/pci/pci_x86.c +1
-2- { .compatible = "x86,pci" }, + { .compatible = "pci-x86" }, { } }; --
Regards,
Bin
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 19 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h>
Quoted 4 lines
drivers/pci/pci_x86.c line 12
Quoted 1 line
drivers/pci/pci_x86.c +0
-0static const struct dm_pci_ops x86_pci_ops = {To keep the consistent naming to match the driver name, can we rename this to
pci_x86_ops?
OK
Quoted 8 lines
drivers/pci/pci_x86.c line 14
Quoted 3 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,Can we move
pci_x86_read_config()andpci_x86_write_config()fromarch/x86/cpu/pci.cto this file to make it a complete driver file? Also create a new header filepci_x86.hto declare these two so that it can be used by ivybridge.
I can certainly drop the ivybridge duplication. But I don't think it is right to call directly into a driver in drivers/...
We should use driver model for this if we want to do it properly. I would like to continue the work to move x86 fully to driver model.
In the meantime I think that directly called functions should be in arch/x86.
Quoted 6 lines
drivers/pci/pci_x86.c line 17
Quoted 4 lines
drivers/pci/pci_x86.c +0
-0};static const struct udevice_id x86_pci_ids[] = {Can we rename this to
pci_x86_ids?
OK
Quoted 8 lines
drivers/pci/pci_x86.c
Quoted 7 lines
drivers/pci/pci_x86.c +1
-2- { .compatible = "x86,pci" }, + { .compatible = "pci-x86" }, { } }; --
Regards,
Simon
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Simon,
Quoted 41 lines · Simon Glass
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 19 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> Quoted 4 lines
drivers/pci/pci_x86.c line 12
Quoted 1 line
drivers/pci/pci_x86.c +0
-0static const struct dm_pci_ops x86_pci_ops = {To keep the consistent naming to match the driver name, can we rename this to
pci_x86_ops?OK
Quoted 8 lines
drivers/pci/pci_x86.c line 14
Quoted 3 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,Can we move
pci_x86_read_config()andpci_x86_write_config()fromarch/x86/cpu/pci.cto this file to make it a complete driver file? Also create a new header filepci_x86.hto declare these two so that it can be used by ivybridge.
Quoted 8 lines
I can certainly drop the ivybridge duplication. But I don't think it is right to call directly into a driver in
drivers/...We should use driver model for this if we want to do it properly. I would like to continue the work to move x86 fully to driver model.
In the meantime I think that directly called functions should be in
arch/x86.
Sorry I don't get it. I mean moving the implementation of pci_x86_read_config() and pci_x86_write_config() to drivers/pci/pci_x86.c. Do you have some concern about this?
[snip]
Regards,
Bin
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Bin,
Quoted 50 lines · Bin Meng
Hi Simon,
Quoted 47 lines · Simon Glass
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 19 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> Quoted 4 lines
drivers/pci/pci_x86.c line 12
Quoted 1 line
drivers/pci/pci_x86.c +0
-0static const struct dm_pci_ops x86_pci_ops = {To keep the consistent naming to match the driver name, can we rename this to
pci_x86_ops?OK
Quoted 8 lines
drivers/pci/pci_x86.c line 14
Quoted 3 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,Can we move
pci_x86_read_config()andpci_x86_write_config()fromarch/x86/cpu/pci.cto this file to make it a complete driver file? Also create a new header filepci_x86.hto declare these two so that it can be used by ivybridge.I can certainly drop the ivybridge duplication. But I don't think it is right to call directly into a driver in
drivers/...We should use driver model for this if we want to do it properly. I would like to continue the work to move x86 fully to driver model.
Quoted 8 lines
Quoted 2 lines
In the meantime I think that directly called functions should be in
arch/x86.Sorry I don't get it. I mean moving the implementation of
pci_x86_read_config()andpci_x86_write_config()todrivers/pci/pci_x86.c. Do you have some concern about this?[snip]
Yes it is still used by arch/x86/cpu/coreboot/pci.c - and as I say I don't like the 'call directly into driver' idea. If we could remove the coreboot case then it would be fine.
Regards,
Simon
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Simon,
Quoted 60 lines · Simon Glass
Hi Bin,
Quoted 57 lines · Bin Meng
Hi Simon,
Quoted 41 lines · Simon Glass
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 19 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> Quoted 4 lines
drivers/pci/pci_x86.c line 12
Quoted 1 line
drivers/pci/pci_x86.c +0
-0static const struct dm_pci_ops x86_pci_ops = {To keep the consistent naming to match the driver name, can we rename this to
pci_x86_ops?OK
Quoted 8 lines
drivers/pci/pci_x86.c line 14
Quoted 3 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,Can we move
pci_x86_read_config()andpci_x86_write_config()fromarch/x86/cpu/pci.cto this file to make it a complete driver file? Also create a new header filepci_x86.hto declare these two so that it can be used by ivybridge.Quoted 8 lines
I can certainly drop the ivybridge duplication. But I don't think it is right to call directly into a driver in
drivers/...We should use driver model for this if we want to do it properly. I would like to continue the work to move x86 fully to driver model.
In the meantime I think that directly called functions should be in
arch/x86.Sorry I don't get it. I mean moving the implementation of
pci_x86_read_config()andpci_x86_write_config()todrivers/pci/pci_x86.c. Do you have some concern about this?
Quoted 5 lines
Quoted 1 line
[snip]
Yes it is still used by
arch/x86/cpu/coreboot/pci.c- and as I say I don't like the 'call directly into driver' idea. If we could remove the coreboot case then it would be fine.
Why not we drop this coreboot pci driver (arch/x86/cpu/coreboot/pci.c) and use the new one (drivers/pci/pci_x86.c) directly?
Regards,
Bin
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Bin,
Quoted 63 lines · Bin Meng
Hi Simon,
Quoted 60 lines · Simon Glass
Hi Bin,
Quoted 57 lines · Bin Meng
Hi Simon,
Quoted 41 lines · Simon Glass
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 19 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> Quoted 4 lines
drivers/pci/pci_x86.c line 12
Quoted 1 line
drivers/pci/pci_x86.c +0
-0static const struct dm_pci_ops x86_pci_ops = {To keep the consistent naming to match the driver name, can we rename this to
pci_x86_ops?OK
Quoted 8 lines
drivers/pci/pci_x86.c line 14
Quoted 3 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,Can we move
pci_x86_read_config()andpci_x86_write_config()fromarch/x86/cpu/pci.cto this file to make it a complete driver file? Also create a new header filepci_x86.hto declare these two so that it can be used by ivybridge.Quoted 8 lines
I can certainly drop the ivybridge duplication. But I don't think it is right to call directly into a driver in
drivers/...We should use driver model for this if we want to do it properly. I would like to continue the work to move x86 fully to driver model.
In the meantime I think that directly called functions should be in
arch/x86.Sorry I don't get it. I mean moving the implementation of
pci_x86_read_config()andpci_x86_write_config()todrivers/pci/pci_x86.c. Do you have some concern about this?
Quoted 8 lines
Quoted 5 lines
Quoted 1 line
[snip]
Yes it is still used by
arch/x86/cpu/coreboot/pci.c- and as I say I don't like the 'call directly into driver' idea. If we could remove the coreboot case then it would be fine.Why not we drop this coreboot pci driver (
arch/x86/cpu/coreboot/pci.c) and use the new one (drivers/pci/pci_x86.c) directly?
Yes let's do that. I can't see any reason not to.
Regards,
Simon
PATCH 7/11 x86: pci: Tidy up the generic x86 PCI driver
Hi Bin,
Quoted 68 lines · Simon Glass
Hi Bin,
Quoted 65 lines · Bin Meng
Hi Simon,
Quoted 62 lines · Simon Glass
Hi Bin,
Quoted 58 lines · Bin Meng
Hi Simon,
Quoted 41 lines · Simon Glass
Hi Bin,
Quoted 22 lines · Bin Meng
Hi Simon,
Quoted 19 lines · Simon Glass
This driver should use the x86 PCI configuration functions. Also adjust its compatible string to something generic (i.e. without a vendor name).
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci_x86.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/pci/pci_x86.c +1
-0@@ -7,12 +7,15 @@#include <common.h> #include <dm.h> #include <pci.h> +#include <asm/pci.h> Quoted 4 lines
drivers/pci/pci_x86.c line 12
Quoted 1 line
drivers/pci/pci_x86.c +0
-0static const struct dm_pci_ops x86_pci_ops = {To keep the consistent naming to match the driver name, can we rename this to
pci_x86_ops?OK
Quoted 8 lines
drivers/pci/pci_x86.c line 14
Quoted 3 lines
drivers/pci/pci_x86.c +2
-0+ .read_config = pci_x86_read_config, + .write_config = pci_x86_write_config,Can we move
pci_x86_read_config()andpci_x86_write_config()fromarch/x86/cpu/pci.cto this file to make it a complete driver file? Also create a new header filepci_x86.hto declare these two so that it can be used by ivybridge.Quoted 8 lines
I can certainly drop the ivybridge duplication. But I don't think it is right to call directly into a driver in
drivers/...We should use driver model for this if we want to do it properly. I would like to continue the work to move x86 fully to driver model.
In the meantime I think that directly called functions should be in
arch/x86.Sorry I don't get it. I mean moving the implementation of
pci_x86_read_config()andpci_x86_write_config()todrivers/pci/pci_x86.c. Do you have some concern about this?[snip]
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Yes it is still used by
arch/x86/cpu/coreboot/pci.c- and as I say I don't like the 'call directly into driver' idea. If we could remove the coreboot case then it would be fine.Why not we drop this coreboot pci driver (
arch/x86/cpu/coreboot/pci.c) and use the new one (drivers/pci/pci_x86.c) directly?Yes let's do that. I can't see any reason not to.
I think the problem is that cpu/ivybridge/pci.c has its own driver and wants to call the pci_x86_read/write_config() functions. So they really need to be in a generic area. I was thinking about coreboot yesterday, but the problem is ivybridge.
Regards,
Simon
PATCH 8/11 dm: x86: minnowmax: Move PCI to use driver model
In reply to Simon GlassAdjust minnowmax to use driver model for PCI. This requires adding a device tree node to specify the ranges, removing the board-specific PCI code and ensuring that the host bridge is configured.
---
arch/x86/cpu/baytrail/Makefile | 1 - arch/x86/cpu/baytrail/pci.c | 46 ------------------------------------------ arch/x86/dts/minnowmax.dts | 10 +++++++++ configs/minnowmax_defconfig | 1 + include/configs/minnowmax.h | 1 + 5 files changed, 12 insertions(+), 47 deletions(-) delete mode 100644 arch/x86/cpu/baytrail/pci.c
arch/x86/cpu/baytrail/Makefile +0 -1
@@ -7,5 +7,4 @@ obj-y += cpu.o obj-y += early_uart.o obj-y += fsp_configs.o -obj-y += pci.o obj-y += valleyview.o
arch/x86/cpu/baytrail/pci.c deleted +0 -46
46 lines not on this page · raw message
arch/x86/dts/minnowmax.dts +10 -0
@@ -111,6 +111,16 @@ }; + pci { + compatible = "intel,pci-baytrail", "pci-x86"; + #address-cells = <3>; + #size-cells = <2>; + u-boot,dm-pre-reloc; + ranges = <0x02000000 0x0 0xd0000000 0xd0000000 0 0x10000000 + 0x42000000 0x0 0xc0000000 0xc0000000 0 0x10000000 + 0x01000000 0x0 0x2000 0x2000 0 0xe000>; + }; + spi { #address-cells = <1>; #size-cells = <0>;
configs/minnowmax_defconfig +1 -0
@@ -12,3 +12,4 @@ CONFIG_CMD_CPU=y CONFIG_CMD_NET=y CONFIG_OF_CONTROL=y CONFIG_CPU=y +CONFIG_DM_PCI=y
include/configs/minnowmax.h +1 -0
@@ -32,6 +32,7 @@#define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS#define CONFIG_PCI_IO_SIZE 0xe000 +#define CONFIG_PCI_CONFIG_HOST_BRIDGE #define CONFIG_SYS_EARLY_PCI_INIT #define CONFIG_PCI_PNP #define CONFIG_RTL8169
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 8/11 dm: x86: minnowmax: Move PCI to use driver model
Quoted 112 lines · Simon Glass
Adjust minnowmax to use driver model for PCI. This requires adding a device tree node to specify the ranges, removing the board-specific PCI code and ensuring that the host bridge is configured.
Signed-off-by Simon Glass <[email protected]>---
arch/x86/cpu/baytrail/Makefile | 1 - arch/x86/cpu/baytrail/pci.c | 46 ------------------------------------------ arch/x86/dts/minnowmax.dts | 10 +++++++++ configs/minnowmax_defconfig | 1 + include/configs/minnowmax.h | 1 + 5 files changed, 12 insertions(+), 47 deletions(-) delete mode 100644 arch/x86/cpu/baytrail/pci.carch/x86/cpu/baytrail/Makefile +0
-1@@ -7,5 +7,4 @@ obj-y += cpu.o obj-y += early_uart.o obj-y += fsp_configs.o -obj-y += pci.o obj-y += valleyview.oarch/x86/cpu/baytrail/pci.c deleted +0
-46@@ -1,46 +0,0 @@ -/* -* Copyright (C) 2014, Bin Meng <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#include <common.h> -#include <pci.h> -#include <asm/pci.h> -#include <asm/fsp/fsp_support.h> - -DECLARE_GLOBAL_DATA_PTR ; - -void board_pci_setup_hose (struct pci_controller *hose) -{ - hose->first_busno =0 ; - hose->last_busno =0 ; - -/* PCI memory space */ -pci_set_region (hose->regions +0 , -CONFIG_PCI_MEM_BUS , -CONFIG_PCI_MEM_PHYS , -CONFIG_PCI_MEM_SIZE , -PCI_REGION_MEM ); - -/* PCI IO space */ -pci_set_region (hose->regions +1 , -CONFIG_PCI_IO_BUS , -CONFIG_PCI_IO_PHYS , -CONFIG_PCI_IO_SIZE , -PCI_REGION_IO ); - -pci_set_region (hose->regions +2 , -CONFIG_PCI_PREF_BUS , -CONFIG_PCI_PREF_PHYS , -CONFIG_PCI_PREF_SIZE , -PCI_REGION_PREFETCH ); - -pci_set_region (hose->regions +3 , -0 , -0 , - gd->ram_size <0x80000000 ? gd->ram_size :0x80000000 , -PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); - - hose->region_count =4 ; -}arch/x86/dts/minnowmax.dts +10
-0@@ -111,6 +111,16 @@ }; + pci { + compatible = "intel,pci-baytrail", "pci-x86"; + #address-cells = <3>; + #size-cells = <2>; + u-boot,dm-pre-reloc; + ranges = <0x02000000 0x0 0xd0000000 0xd0000000 0 0x10000000 + 0x42000000 0x0 0xc0000000 0xc0000000 0 0x10000000 + 0x01000000 0x0 0x2000 0x2000 0 0xe000>; + }; + spi { #address-cells = <1>; #size-cells = <0>;configs/minnowmax_defconfig +1
-0@@ -12,3 +12,4 @@ CONFIG_CMD_CPU=y CONFIG_CMD_NET=y CONFIG_OF_CONTROL=y CONFIG_CPU=y +CONFIG_DM_PCI=yinclude/configs/minnowmax.h +0
-0
include/configs/minnowmax.h
Quoted 8 lines
include/configs/minnowmax.h +1
-1@@ -32,6 +32,7 @@#define CONFIG_PCI_IO_PHYS CONFIG_PCI_IO_BUS#define CONFIG_PCI_IO_SIZE 0xe000 +#define CONFIG_PCI_CONFIG_HOST_BRIDGE #define CONFIG_SYS_EARLY_PCI_INIT #define CONFIG_PCI_PNP #define CONFIG_RTL8169 --
PATCH 9/11 dm: pci: Use the correct hose when configuring devices
In reply to Simon GlassOnly the PCI controller has access to the PCI region information. Make sure to use the controller (rather than any attached bridges) when configuring devices.
This corrects a failure to scan and configure devices when driver model is enabled for PCI.
Also add a comment to explain the problem.
---
drivers/pci/pci-uclass.c | 6 +++++- drivers/pci/pci_common.c | 6 ++++++ include/pci.h | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-)
drivers/pci/pci-uclass.c +5 -1
@@ -296,6 +296,7 @@ int pci_auto_config_devices(struct udevice *bus) !ret && dev; ret = device_find_next_child(&dev)) {struct pci_child_platdata *pplat; +struct pci_controller *ctlr_hose; pplat =dev_get_parent_platdata (dev);unsigned int max_bus;
@@ -303,7 +304,10 @@ int pci_auto_config_devices(struct udevice *bus) bdf =PCI_ADD_BUS (bus->seq, pplat->devfn);debug ("%s: device %s\n" , __func__, dev->name); - max_bus =pciauto_config_device (hose, bdf); + +/* The root controller has the region information */ + ctlr_hose = hose->ctlr->uclass_priv; + max_bus =pciauto_config_device (ctlr_hose, bdf); sub_bus =max (sub_bus, max_bus); }debug ("%s: done\n" , __func__);
drivers/pci/pci_common.c +6 -0
@@ -11,6 +11,7 @@*/ #include <common.h> +#include <dm.h> #include <errno.h> #include <pci.h> #include <asm/io.h>
@@ -221,6 +222,11 @@ phys_addr_t pci_hose_bus_to_phys(struct pci_controller *hose,return phys_addr; } +#ifdef CONFIG_DM_PCI +/* The root controller has the region information */ + hose = hose->ctlr->uclass_priv; +#endif +/* * if PCI_REGION_MEM is set we do a two pass search with preference * on matches that don't have PCI_REGION_SYS_MEMORY set
include/pci.h +10 -0
@@ -513,6 +513,16 @@ struct pci_controller {int indirect_type; +/* +* TODO(sjg at chromium.org): With driver model we use struct +* pci_controller for both the controller and any bridge devices +* attached to it. But there is only one region list and it is in the +* top-level controller. +* +* This could be changed so that struct pci_controller is only used +* for PCI controllers and a separate UCLASS (or perhaps +* UCLASS_PCI_GENERIC) is used for bridges. +*/ struct pci_region regions[MAX_PCI_REGIONS ];int region_count;
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 9/11 dm: pci: Use the correct hose when configuring devices
Quoted 9 lines · Simon Glass
Only the PCI controller has access to the PCI region information. Make sure to use the controller (rather than any attached bridges) when configuring devices.
This corrects a failure to scan and configure devices when driver model is enabled for PCI.
Also add a comment to explain the problem.
Quoted 7 lines
Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci-uclass.c | 6 +++++- drivers/pci/pci_common.c | 6 ++++++ include/pci.h | 10 ++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-)
Applied to u-boot-86.
PATCH 10/11 dm: pci: Correct bus number when scanning sub-buses
In reply to Simon GlassThe sub-bus passed to pciauto_prescan_setup_bridge() is incorrect. Fix it so that sub-buses are numbered correctly.
---
drivers/pci/pci-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/pci-uclass.c +1 -1
@@ -334,7 +334,7 @@ int dm_pci_hose_probe_bus(struct pci_controller *hose, pci_dev_t bdf) sub_bus =pci_get_bus_max () +1 ;debug ("%s: bus = %d/%s\n" , __func__, sub_bus, bus->name); -pciauto_prescan_setup_bridge (hose, bdf, bus->seq); +pciauto_prescan_setup_bridge (hose, bdf, sub_bus); ret =device_probe (bus);if (ret) {
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 10/11 dm: pci: Correct bus number when scanning sub-buses
Quoted 8 lines · Simon Glass
The sub-bus passed to
pciauto_prescan_setup_bridge()is incorrect. Fix it so that sub-buses are numbered correctly.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied to u-boot-86.
PATCH 11/11 dm: x86: baytrail: Correct PCI region 3 when driver model is used
In reply to Simon GlassCommit afbbd413a fixed this for non-driver-model. Make sure that the driver model code handles this also.
---
drivers/pci/pci-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/pci-uclass.c +2 -1
@@ -495,7 +495,8 @@ static int decode_regions(struct pci_controller *hose, const void *blob,/* Add a region for our local memory */ pci_set_region (hose->regions + hose->region_count++,0 ,0 , - gd->ram_size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + gd->ram_size <0x80000000U ? gd->ram_size :0x80000000U , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );return 0 ; }
Signature · 1 line
2.2.0.rc0.207.ga3a616c
PATCH 11/11 dm: x86: baytrail: Correct PCI region 3 when driver model is used
Hi Simon,
Quoted 14 lines · Simon Glass
Commit
afbbd413afixed this for non-driver-model. Make sure that the driver model code handles this also.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/pci-uclass.c +0
-0
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, const void *blob,
Quoted 10 lines
drivers/pci/pci-uclass.c +2
-2@@ -495,7 +495,8 @@ static int decode_regions(struct pci_controller *hose, const void *blob,/* Add a region for our local memory */ pci_set_region (hose->regions + hose->region_count++,0 ,0 , - gd->ram_size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + gd->ram_size <0x80000000U ? gd->ram_size :0x80000000U , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );return 0 ; } --
I think this is specific to baytrail fsp configuration. It should not be put into a common driver.
Regards,
Bin
PATCH 11/11 dm: x86: baytrail: Correct PCI region 3 when driver model is used
Hi Bin / Simon,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 21 lines · Simon Glass
Commit
afbbd413afixed this for non-driver-model. Make sure that the driver model code handles this also.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/pci-uclass.c +2
-1@@ -495,7 +495,8 @@ static int decode_regions(struct pci_controller *hose, const void *blob,/* Add a region for our local memory */ pci_set_region (hose->regions + hose->region_count++,0 ,0 , - gd->ram_size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + gd->ram_size <0x80000000U ? gd->ram_size :0x80000000U , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );
Quoted 6 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, const void *blob,
Quoted 3 lines
drivers/pci/pci-uclass.c +0
-1return 0 ; } --I think this is specific to baytrail fsp configuration. It should not be put into a common driver.
Yes, I agree with Bin, this is likely only a Bay Trail (or maybe a very small number of other processors) configuration. I believe your change here will impact all PCI hosts which have > 2 GiB of RAM.
It might be a bit ugly to have an #ifdef in this file, it all seems like nice clean generic code. But maybe it's not a big deal to limit all u-boot to 2 GiB of RAM for this region?
Thanks,
Andrew
PATCH 11/11 dm: x86: baytrail: Correct PCI region 3 when driver model is used
Hi,
Quoted 34 lines · Andrew Bradford
Hi Bin / Simon,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 21 lines · Simon Glass
Commit
afbbd413afixed this for non-driver-model. Make sure that the driver model code handles this also.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/pci-uclass.c +2
-1@@ -495,7 +495,8 @@ static int decode_regions(struct pci_controller *hose, const void *blob,/* Add a region for our local memory */ pci_set_region (hose->regions + hose->region_count++,0 ,0 , - gd->ram_size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + gd->ram_size <0x80000000U ? gd->ram_size :0x80000000U , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );Quoted 6 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, const void *blob,
Quoted 3 lines
drivers/pci/pci-uclass.c +0
-1return 0 ; } --I think this is specific to baytrail fsp configuration. It should not be put into a common driver.
Quoted 7 lines
Yes, I agree with Bin, this is likely only a Bay Trail (or maybe a very small number of other processors) configuration. I believe your change here will impact all PCI hosts which have > 2 GiB of RAM.
It might be a bit ugly to have an #ifdef in this file, it all seems like nice clean generic code. But maybe it's not a big deal to limit all u-boot to 2 GiB of RAM for this region?
Yes, this will bite us when something else moves PCI to driver model and we may as well fix it now.
What is the best option? We could add a pci_max_addr to global_data perhaps? This could be set to ram_size for most machines, and adjusted for x86. I'd prefer to avoid #ifdef CONFIG_X86.
Regards,
Simon
PATCH 11/11 dm: x86: baytrail: Correct PCI region 3 when driver model is used
Hi Simon,
Quoted 45 lines · Simon Glass
Hi,
Quoted 41 lines · Andrew Bradford
Hi Bin / Simon,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 21 lines · Simon Glass
Commit
afbbd413afixed this for non-driver-model. Make sure that the driver model code handles this also.Signed-off-by Simon Glass <[email protected]>---
drivers/pci/pci-uclass.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/pci/pci-uclass.c +2
-1@@ -495,7 +495,8 @@ static int decode_regions(struct pci_controller *hose, const void *blob,/* Add a region for our local memory */ pci_set_region (hose->regions + hose->region_count++,0 ,0 , - gd->ram_size,PCI_REGION_MEM |PCI_REGION_SYS_MEMORY ); + gd->ram_size <0x80000000U ? gd->ram_size :0x80000000U , +PCI_REGION_MEM |PCI_REGION_SYS_MEMORY );Quoted 6 lines
drivers/pci/pci-uclass.c static int decode_regions(struct pci_controller *hose, const void *blob,
Quoted 3 lines
drivers/pci/pci-uclass.c +0
-1return 0 ; } --I think this is specific to baytrail fsp configuration. It should not be put into a common driver.
Yes, I agree with Bin, this is likely only a Bay Trail (or maybe a very small number of other processors) configuration. I believe your change here will impact all PCI hosts which have > 2 GiB of RAM.
It might be a bit ugly to have an #ifdef in this file, it all seems like nice clean generic code. But maybe it's not a big deal to limit all u-boot to 2 GiB of RAM for this region?
Yep, maybe not a big deal, but it may also break some boards if the allocated buffer for PCI device happens to be above 2 GiB, but that case might be rare (ie: like 3 GiB memory is installed where on most cases we only see boards with 1 GiB, 2 GiB, 4 GiB memory)
Quoted 6 lines
Yes, this will bite us when something else moves PCI to driver model and we may as well fix it now.
What is the best option? We could add a
pci_max_addrtoglobal_dataperhaps? This could be set toram_sizefor most machines, and adjusted for x86. I'd prefer to avoid #ifdefCONFIG_X86.
Adding pci_max_addr to global_data sounds good if we want to avoid #ifdefs. It would be good to hear more comments from other domains?
Regards,
Bin
cover dm: x86: PCI/SPI fixes for minnowboard MAX
In reply to Simon GlassHi Simon,
Quoted 8 lines · Simon Glass
The SPI flash starts off protected on baytrail. The code which is supposed to fix this is broken. This series fixes that, enables the SPI environment and adds documentation.
Also when driver model is enabled for PCI some bugs appear. This series fixes those and enables driver model for PCI on minnowboard MAX.
Quoted 13 lines
Simon Glass (11):
spi: sf: Print the error code on failure
dm: spi: Correct minor nits in ICH driver
dm: spi: Correct status register access width
dm: spi: Correct BIOS protection logic for ICH9
dm: spi: Enable environment for minnowmax
x86: Add ROM image description for minnowmax
x86: pci: Tidy up the generic x86 PCI driver
dm: x86: minnowmax: Move PCI to use driver model
dm: pci: Use the correct hose when configuring devices
dm: pci: Correct bus number when scanning sub-buses
dm: x86: baytrail: Correct PCI region 3 when driver model is used
I've finished review for the series except #9 and #10 which are driver model related as I am not quite familiar with the dm stuff.
[snip]
Regards,
Bin