x86: Convert to use DM PCI APIs completely
cover x86: Convert to use DM PCI APIs completely
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Bin Meng (23):
spi: ich: Some clean up
spi: ich: Use compatible strings to distinguish controller version
spi: ich: Change PCHV_ to ICHV_
x86: tnc: Drop unprotect_spi_flash()
x86: quark: Drop unprotect_spi_flash()
dm: pch: Remove pch_get_version op
dm: pch: Rename get_sbase op to get_spi_base
dm: pch: Add get_gpio_base op
x86: pch: Implement get_gpio_base op
dm: pch: Add get_io_base op
x86: pch9: Implement get_io_base op
x86: ich6_gpio: Convert to use proper DM API
x86: Drop asm/arch/gpio.h
x86: minnowmax: Drop io-base property in the pch_pinctrl node
x86: irq: Get irq_router's bdf via dm_pci_get_bdf()
x86: irq: Move irq_router to a per driver priv
x86: irq: Convert to use DM PCI API
x86: tnc: Change disable_igd() to have a return value
x86: tnc: Use DM PCI API in disable_igd()
x86: tnc: Remove IGD and SDVO devices from driver model
x86: qemu: Convert to use DM PCI API
x86: pci: Use DM PCI APIs in pci_assign_irqs()
x86: pci: Drop legacy PCI APIs
arch/x86/cpu/irq.c | 80 +++++++++--------- arch/x86/cpu/ivybridge/bd82x6x.c | 43 ++++++++-- arch/x86/cpu/pci.c | 59 +------------- arch/x86/cpu/qemu/qemu.c | 34 ++++---- arch/x86/cpu/quark/quark.c | 17 ---- arch/x86/cpu/queensbay/irq.c | 2 +- arch/x86/cpu/queensbay/tnc.c | 80 +++++++++++++----- arch/x86/dts/bayleybay.dts | 88 ++++++++++---------- arch/x86/dts/broadwell_som-6896.dts | 2 +- arch/x86/dts/chromebook_link.dts | 44 +++++----- arch/x86/dts/chromebox_panther.dts | 46 ++++++----- arch/x86/dts/crownbay.dts | 32 ++++---- arch/x86/dts/galileo.dts | 30 +++---- arch/x86/dts/minnowmax.dts | 89 ++++++++++---------- arch/x86/include/asm/arch-baytrail/gpio.h | 13 --- arch/x86/include/asm/arch-coreboot/gpio.h | 13 --- arch/x86/include/asm/arch-efi/gpio.h | 10 --- arch/x86/include/asm/arch-ivybridge/gpio.h | 13 --- arch/x86/include/asm/arch-qemu/gpio.h | 13 --- arch/x86/include/asm/arch-quark/gpio.h | 13 --- arch/x86/include/asm/arch-queensbay/gpio.h | 13 --- arch/x86/include/asm/gpio.h | 1 - arch/x86/include/asm/pci.h | 12 --- arch/x86/include/asm/pirq_routing.h | 12 ++- arch/x86/lib/pirq_routing.c | 12 +-- board/intel/galileo/galileo.c | 5 +- drivers/gpio/intel_ich6_gpio.c | 125 ++++++----------------------- drivers/pch/pch-uclass.c | 30 ++++--- drivers/pch/pch7.c | 43 ++++++++-- drivers/pch/pch9.c | 54 +++++++++++-- drivers/spi/ich.c | 76 ++++++++---------- drivers/spi/ich.h | 61 ++++++++++---- include/configs/crownbay.h | 1 - include/pch.h | 64 +++++++++------ 34 files changed, 588 insertions(+), 642 deletions(-) delete mode 100644 arch/x86/include/asm/arch-baytrail/gpio.h delete mode 100644 arch/x86/include/asm/arch-coreboot/gpio.h delete mode 100644 arch/x86/include/asm/arch-efi/gpio.h delete mode 100644 arch/x86/include/asm/arch-ivybridge/gpio.h delete mode 100644 arch/x86/include/asm/arch-qemu/gpio.h delete mode 100644 arch/x86/include/asm/arch-quark/gpio.h delete mode 100644 arch/x86/include/asm/arch-queensbay/gpio.h
Signature · 1 line
1.8.2.1
PATCH 1/23 spi: ich: Some clean up
This cleans up the ich spi driver a little bit:
- Remove struct ich_spi_slave that is not referenced anywhere
- Remove ending period in some comments
- Move struct ich_spi_platdata and struct ich_spi_priv to ich.h
- Add #ifndef _ICH_H_ .. in ich.h
---
drivers/spi/ich.c | 38 +++++-------------------------------- drivers/spi/ich.h | 56 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 47 deletions(-)
drivers/spi/ich.c +5 -33
@@ -5,6 +5,7 @@* * This file is derived from the flashrom project. */ +#include <common.h> #include <dm.h> #include <errno.h>
@@ -17,41 +18,12 @@#include "ich.h" -#define SPI_OPCODE_WREN 0x06 -#define SPI_OPCODE_FAST_READ 0x0b -#ifdef DEBUG_TRACE #define debug_trace(fmt, args...) debug(fmt, ##args)#else #define debug_trace(x, args...)#endif -struct ich_spi_platdata { -enum pch_version ich_version;/* Controller version, 7 or 9 */ -}; - -struct ich_spi_priv { -int ichspi_lock; -int locked; -int opmenu; -int menubytes; -void *base;/* Base of register set */ -int preop; -int optype; -int addr; -int data; -unsigned databytes; -int status; -int control; -int bbar; -int bcr; -uint32_t *pr;/* only for ich9 */ -int speed;/* pointer to speed control */ -ulong max_speed;/* Maximum bus speed in MHz */ -ulong cur_speed;/* Current bus speed */ -struct spi_trans trans;/* current transaction in progress */ -}; -static u8 ich_readb (struct ich_spi_priv *priv,int reg) {u8 value =readb (priv->base + reg);
@@ -217,7 +189,7 @@ static void spi_setup_type(struct spi_trans *trans, int data_bytes) { trans->type =0xFF ; -/* Try to guess spi type from read/write sizes. */ +/* Try to guess spi type from read/write sizes */ if (trans->bytesin ==0 ) {if (trans->bytesout + data_bytes >4 )/*
@@ -301,7 +273,7 @@ static int spi_setup_opcode(struct ich_spi_priv *ctlr, struct spi_trans *trans)static int spi_setup_offset (struct spi_trans *trans) { -/* Separate the SPI address and data. */ +/* Separate the SPI address and data */ switch (trans->type) {case SPI_OPCODE_TYPE_READ_NO_ADDRESS :case SPI_OPCODE_TYPE_WRITE_NO_ADDRESS :
@@ -410,7 +382,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen, trans->in = din; trans->bytesin = din ? bytes :0 ; -/* There has to always at least be an opcode. */ +/* There has to always at least be an opcode */ if (!trans->bytesout) {debug ("ICH SPI: No opcode for transfer\n" );return -EPROTO ;
@@ -541,7 +513,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,/* write it */ ich_writew (ctlr, control, ctlr->control); -/* Wait for Cycle Done Status or Flash Cycle Error. */ +/* Wait for Cycle Done Status or Flash Cycle Error */ status =ich_status_poll (ctlr,SPIS_CDS |SPIS_FCERR ,1 );if (status <0 )return status;
drivers/spi/ich.h +42 -14
90 lines not on this page · raw message
Signature · 1 line
1.8.2.1
PATCH 1/23 spi: ich: Some clean up
Quoted 7 lines · Bin Meng
This cleans up the ich spi driver a little bit:
- Remove structich_spi_slavethat is not referenced anywhere
- Remove ending period in some comments
- Move structich_spi_platdataand structich_spi_privtoich.h
- Add #ifndef _ICH_H_ .. inich.h
Quoted 6 lines
Signed-off-by Bin Meng <[email protected]>---
drivers/spi/ich.c | 38 +++++-------------------------------- drivers/spi/ich.h | 56 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 47 deletions(-)
PATCH 1/23 spi: ich: Some clean up
Quoted 11 lines · Simon Glass
Quoted 10 lines · Bin Meng
This cleans up the ich spi driver a little bit:
- Remove structich_spi_slavethat is not referenced anywhere
- Remove ending period in some comments
- Move structich_spi_platdataand structich_spi_privtoich.h
- Add #ifndef _ICH_H_ .. inich.hSigned-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 3 lines
drivers/spi/ich.c | 38 +++++-------------------------------- drivers/spi/ich.h | 56 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 47 deletions(-)Reviewed-by Simon Glass <[email protected]>
Signature · 1 line
Jagan.
PATCH 1/23 spi: ich: Some clean up
Quoted 12 lines · Jagan Teki
Quoted 11 lines · Simon Glass
Quoted 10 lines · Bin Meng
This cleans up the ich spi driver a little bit:
- Remove structich_spi_slavethat is not referenced anywhere
- Remove ending period in some comments
- Move structich_spi_platdataand structich_spi_privtoich.h
- Add #ifndef _ICH_H_ .. inich.hSigned-off-by Bin Meng <[email protected]>---
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
drivers/spi/ich.c | 38 +++++-------------------------------- drivers/spi/ich.h | 56 +++++++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 47 insertions(+), 47 deletions(-)Reviewed-by Simon Glass <[email protected]>Reviewed-by Jagan Teki <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 2/23 spi: ich: Use compatible strings to distinguish controller version
In reply to Bin MengAt present ich spi driver gets the controller version information via pch, but this can be simply retrieved via spi node's compatible string.
---
arch/x86/dts/bayleybay.dts | 2 +- arch/x86/dts/broadwell_som-6896.dts | 2 +- arch/x86/dts/chromebook_link.dts | 2 +- arch/x86/dts/chromebox_panther.dts | 2 +- arch/x86/dts/crownbay.dts | 2 +- arch/x86/dts/galileo.dts | 2 +- arch/x86/dts/minnowmax.dts | 2 +- drivers/spi/ich.c | 28 ++++++++++++++++++++++++---- 8 files changed, 31 insertions(+), 11 deletions(-)
arch/x86/dts/bayleybay.dts +1 -1
@@ -187,7 +187,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich9-spi"; spi-flash at 0 { #address-cells = <1>; #size-cells = <1>;
arch/x86/dts/broadwell_som-6896.dts +1 -1
@@ -37,7 +37,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich9-spi"; spi-flash at 0 { reg = <0>; compatible = "winbond,w25q128", "spi-flash";
arch/x86/dts/chromebook_link.dts +1 -1
@@ -255,7 +255,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich9-spi"; spi-flash at 0 { #size-cells = <1>; #address-cells = <1>;
arch/x86/dts/chromebox_panther.dts +1 -1
@@ -59,7 +59,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich9-spi"; spi-flash at 0 { #size-cells = <1>; #address-cells = <1>;
arch/x86/dts/crownbay.dts +1 -1
@@ -234,7 +234,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich7-spi"; spi-flash at 0 { reg = <0>; compatible = "sst,25vf016b",
arch/x86/dts/galileo.dts +1 -1
@@ -118,7 +118,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich7-spi"; spi-flash at 0 { #size-cells = <1>; #address-cells = <1>;
arch/x86/dts/minnowmax.dts +1 -1
@@ -221,7 +221,7 @@ spi: spi { #address-cells = <1>; #size-cells = <0>; - compatible = "intel,ich-spi"; + compatible = "intel,ich9-spi"; spi-flash at 0 { #address-cells = <1>; #size-cells = <1>;
drivers/spi/ich.c +24 -4
@@ -18,6 +18,8 @@#include "ich.h" +DECLARE_GLOBAL_DATA_PTR ; +#ifdef DEBUG_TRACE #define debug_trace(fmt, args...) debug(fmt, ##args)#else
@@ -594,9 +596,6 @@ static int ich_spi_probe(struct udevice *dev)uint8_t bios_cntl;int ret; -/* Check the ICH version */ - plat->ich_version =pch_get_version (dev->parent); - ret =ich_init_controller (dev, plat, priv);if (ret)return ret;
@@ -658,6 +657,25 @@ static int ich_spi_child_pre_probe(struct udevice *dev)return 0 ; } +static int ich_spi_ofdata_to_platdata (struct udevice *dev) +{ +struct ich_spi_platdata *plat =dev_get_platdata (dev); +int ret; + + ret =fdt_node_check_compatible (gd->fdt_blob, dev->of_offset, +"intel,ich7-spi" ); +if (ret ==0 ) { + plat->ich_version =PCHV_7 ; + }else { + ret =fdt_node_check_compatible (gd->fdt_blob, dev->of_offset, +"intel,ich9-spi" ); +if (ret ==0 ) + plat->ich_version =PCHV_9 ; + } + +return ret; +} +static const struct dm_spi_ops ich_spi_ops = { .xfer = ich_spi_xfer, .set_speed = ich_spi_set_speed,
@@ -669,7 +687,8 @@ static const struct dm_spi_ops ich_spi_ops = { };static const struct udevice_id ich_spi_ids[] = { - { .compatible ="intel,ich-spi" }, + { .compatible ="intel,ich7-spi" }, + { .compatible ="intel,ich9-spi" }, { } };
@@ -678,6 +697,7 @@ U_BOOT_DRIVER(ich_spi) = { .id = UCLASS_SPI, .of_match = ich_spi_ids, .ops = &ich_spi_ops, + .ofdata_to_platdata = ich_spi_ofdata_to_platdata, .platdata_auto_alloc_size = sizeof(struct ich_spi_platdata), .priv_auto_alloc_size = sizeof(struct ich_spi_priv), .child_pre_probe = ich_spi_child_pre_probe,
Signature · 1 line
1.8.2.1
PATCH 2/23 spi: ich: Use compatible strings to distinguish controller version
Quoted 6 lines · Bin Meng
At present ich spi driver gets the controller version information via pch, but this can be simply retrieved via spi node's compatible string.
Signed-off-by Bin Meng <[email protected]>---
Quoted 9 lines
arch/x86/dts/bayleybay.dts | 2 +- arch/x86/dts/broadwell_som-6896.dts | 2 +- arch/x86/dts/chromebook_link.dts | 2 +- arch/x86/dts/chromebox_panther.dts | 2 +- arch/x86/dts/crownbay.dts | 2 +- arch/x86/dts/galileo.dts | 2 +- arch/x86/dts/minnowmax.dts | 2 +- drivers/spi/ich.c | 28 ++++++++++++++++++++++++---- 8 files changed, 31 insertions(+), 11 deletions(-)
Tested on Minnowmax:
PATCH 2/23 spi: ich: Use compatible strings to distinguish controller version
Quoted 17 lines · Simon Glass
Quoted 6 lines · Bin Meng
At present ich spi driver gets the controller version information via pch, but this can be simply retrieved via spi node's compatible string.
Signed-off-by Bin Meng <[email protected]>---
Quoted 9 lines
arch/x86/dts/bayleybay.dts | 2 +- arch/x86/dts/broadwell_som-6896.dts | 2 +- arch/x86/dts/chromebook_link.dts | 2 +- arch/x86/dts/chromebox_panther.dts | 2 +- arch/x86/dts/crownbay.dts | 2 +- arch/x86/dts/galileo.dts | 2 +- arch/x86/dts/minnowmax.dts | 2 +- drivers/spi/ich.c | 28 ++++++++++++++++++++++++---- 8 files changed, 31 insertions(+), 11 deletions(-)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
Signature · 1 line
Jagan.
PATCH 2/23 spi: ich: Use compatible strings to distinguish controller version
Quoted 18 lines · Jagan Teki
Quoted 17 lines · Simon Glass
Quoted 15 lines · Bin Meng
At present ich spi driver gets the controller version information via pch, but this can be simply retrieved via spi node's compatible string.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/bayleybay.dts | 2 +- arch/x86/dts/broadwell_som-6896.dts | 2 +- arch/x86/dts/chromebook_link.dts | 2 +- arch/x86/dts/chromebox_panther.dts | 2 +- arch/x86/dts/crownbay.dts | 2 +- arch/x86/dts/galileo.dts | 2 +- arch/x86/dts/minnowmax.dts | 2 +- drivers/spi/ich.c | 28 ++++++++++++++++++++++++---- 8 files changed, 31 insertions(+), 11 deletions(-)
Quoted 6 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>Reviewed-by Jagan Teki <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 3/23 spi: ich: Change PCHV_ to ICHV_
In reply to Bin MengThe ICH SPI controller supports two variants, one of which is ICH7 compatible and the other is ICH9 compatible. Change 'pch_version' to 'ich_version' to better match its original name.
---
drivers/spi/ich.c | 14 +++++++------- drivers/spi/ich.h | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/spi/ich.c +7 -7
@@ -123,7 +123,7 @@ static int ich_init_controller(struct udevice *dev, sbase = (void *)sbase_addr;debug ("%s: sbase=%p\n" , __func__, sbase); -if (plat->ich_version ==PCHV_7 ) { +if (plat->ich_version ==ICHV_7 ) {struct ich7_spi_regs *ich7_spi = sbase; ich7_spi = (struct ich7_spi_regs *)sbase;
@@ -139,7 +139,7 @@ static int ich_init_controller(struct udevice *dev, ctlr->bbar = offsetof(struct ich7_spi_regs , bbar); ctlr->preop = offsetof(struct ich7_spi_regs , preop); ctlr->base = ich7_spi; - }else if (plat->ich_version ==PCHV_9 ) { + }else if (plat->ich_version ==ICHV_9 ) {struct ich9_spi_regs *ich9_spi = sbase; ctlr->ichspi_lock =readw (&ich9_spi->hsfs) &HSFS_FLOCKDN ;
@@ -165,7 +165,7 @@ static int ich_init_controller(struct udevice *dev,/* Work out the maximum speed we can support */ ctlr->max_speed =20000000 ; -if (plat->ich_version ==PCHV_9 &&ich9_can_do_33mhz (dev)) +if (plat->ich_version ==ICHV_9 &&ich9_can_do_33mhz (dev)) ctlr->max_speed =33000000 ;debug ("ICH SPI: Version ID %d detected at %p, speed %ld\n" , plat->ich_version, ctlr->base, ctlr->max_speed);
@@ -394,7 +394,7 @@ static int ich_spi_xfer(struct udevice *dev, unsigned int bitlen,if (ret <0 )return ret; -if (plat->ich_version ==PCHV_7 ) +if (plat->ich_version ==ICHV_7 )ich_writew (ctlr,SPIS_CDS |SPIS_FCERR , ctlr->status);else ich_writeb (ctlr,SPIS_CDS |SPIS_FCERR , ctlr->status);
@@ -649,7 +649,7 @@ static int ich_spi_child_pre_probe(struct udevice *dev)* ICH 7 SPI controller only supports array read command * and byte program command for SST flash */ -if (plat->ich_version ==PCHV_7 ) { +if (plat->ich_version ==ICHV_7 ) { slave->mode_rx =SPI_RX_SLOW ; slave->mode =SPI_TX_BYTE ; }
@@ -665,12 +665,12 @@ static int ich_spi_ofdata_to_platdata(struct udevice *dev) ret =fdt_node_check_compatible (gd->fdt_blob, dev->of_offset,"intel,ich7-spi" );if (ret ==0 ) { - plat->ich_version =PCHV_7 ; + plat->ich_version =ICHV_7 ; }else { ret =fdt_node_check_compatible (gd->fdt_blob, dev->of_offset,"intel,ich9-spi" );if (ret ==0 ) - plat->ich_version =PCHV_9 ; + plat->ich_version =ICHV_9 ; }return ret;
drivers/spi/ich.h +6 -1
@@ -127,8 +127,13 @@ struct spi_trans {#define SPI_OPCODE_WREN 0x06#define SPI_OPCODE_FAST_READ 0x0b +enum ich_version { +ICHV_7 , +ICHV_9 , +}; +struct ich_spi_platdata { -enum pch_version ich_version;/* Controller version, 7 or 9 */ +enum ich_version ich_version;/* Controller version, 7 or 9 */ };struct ich_spi_priv {
Signature · 1 line
1.8.2.1
PATCH 3/23 spi: ich: Change PCHV_ to ICHV_
Quoted 10 lines · Bin Meng
The ICH SPI controller supports two variants, one of which is ICH7 compatible and the other is ICH9 compatible. Change '
pch_version' to 'ich_version' to better match its original name.Signed-off-by Bin Meng <[email protected]>---
drivers/spi/ich.c | 14 +++++++------- drivers/spi/ich.h | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-)
Tested on Minnowmax:
PATCH 3/23 spi: ich: Change PCHV_ to ICHV_
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng
The ICH SPI controller supports two variants, one of which is ICH7 compatible and the other is ICH9 compatible. Change '
pch_version' to 'ich_version' to better match its original name.Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 3 lines
drivers/spi/ich.c | 14 +++++++------- drivers/spi/ich.h | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
Signature · 1 line
Jagan.
PATCH 3/23 spi: ich: Change PCHV_ to ICHV_
Quoted 13 lines · Jagan Teki
Quoted 12 lines · Simon Glass
Quoted 10 lines · Bin Meng
The ICH SPI controller supports two variants, one of which is ICH7 compatible and the other is ICH9 compatible. Change '
pch_version' to 'ich_version' to better match its original name.Signed-off-by Bin Meng <[email protected]>---
drivers/spi/ich.c | 14 +++++++------- drivers/spi/ich.h | 7 ++++++- 2 files changed, 13 insertions(+), 8 deletions(-)
Quoted 6 lines
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>Reviewed-by Jagan Teki <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 4/23 x86: tnc: Drop unprotect_spi_flash()
In reply to Bin MengUnprotecting SPI flash is now handled in the SPI controller driver, via a call to the PCH driver. Drop the ad-hoc version.
---
arch/x86/cpu/queensbay/tnc.c | 16 ---------------- include/configs/crownbay.h | 1 - 2 files changed, 17 deletions(-)
arch/x86/cpu/queensbay/tnc.c +0 -16
@@ -14,15 +14,6 @@#include <asm/fsp/fsp_support.h> #include <asm/processor.h> -static void unprotect_spi_flash (void ) -{ -u32 bc; - - bc =x86_pci_read_config32 (TNC_LPC ,0xd8 ); - bc |=0x1 ;/* unprotect the flash */ -x86_pci_write_config32 (TNC_LPC ,0xd8 , bc); -} -static void __maybe_unused disable_igd (void ) {/*
@@ -68,10 +59,3 @@ int arch_early_init_r(void)return 0 ; } - -int arch_misc_init (void ) -{ -unprotect_spi_flash (); - -return 0 ; -}
include/configs/crownbay.h +0 -1
@@ -16,7 +16,6 @@#define CONFIG_SYS_MONITOR_LEN (1 << 20)#define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_ARCH_EARLY_INIT_R -#define CONFIG_ARCH_MISC_INIT #define CONFIG_SMSC_LPC47M
Signature · 1 line
1.8.2.1
PATCH 4/23 x86: tnc: Drop unprotect_spi_flash()
Quoted 9 lines · Bin Meng
Unprotecting SPI flash is now handled in the SPI controller driver, via a call to the PCH driver. Drop the ad-hoc version.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/queensbay/tnc.c | 16 ---------------- include/configs/crownbay.h | 1 - 2 files changed, 17 deletions(-)
Tested on Minnowmax:
PATCH 4/23 x86: tnc: Drop unprotect_spi_flash()
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
Unprotecting SPI flash is now handled in the SPI controller driver, via a call to the PCH driver. Drop the ad-hoc version.
Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 3 lines
arch/x86/cpu/queensbay/tnc.c | 16 ---------------- include/configs/crownbay.h | 1 - 2 files changed, 17 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 5/23 x86: quark: Drop unprotect_spi_flash()
In reply to Bin MengUnprotecting SPI flash is now handled in the SPI controller driver, via a call to the PCH driver. Drop the ad-hoc version.
---
arch/x86/cpu/quark/quark.c | 17 ----------------- 1 file changed, 17 deletions(-)
arch/x86/cpu/quark/quark.c +0 -17
@@ -20,21 +20,6 @@ static struct pci_device_id mmc_supported[] = { {}, }; -/* -* TODO: -* -* This whole routine should be removed until we fully convert the ICH SPI -* driver to DM and make use of DT to pass the bios control register offset -*/ -static void unprotect_spi_flash (void ) -{ -u32 bc; - -qrk_pci_read_config_dword (QUARK_LEGACY_BRIDGE ,0xd8 , &bc); - bc |=0x1 ;/* unprotect the flash */ -qrk_pci_write_config_dword (QUARK_LEGACY_BRIDGE ,0xd8 , bc); -} -static void quark_setup_mtrr (void ) {u32 base, mask;
@@ -259,8 +244,6 @@ int arch_cpu_init(void)/* Turn on legacy segments (A/B/E/F) decode to system RAM */ quark_enable_legacy_seg (); -unprotect_spi_flash (); -return 0 ; }
Signature · 1 line
1.8.2.1
PATCH 5/23 x86: quark: Drop unprotect_spi_flash()
Quoted 8 lines · Bin Meng
Unprotecting SPI flash is now handled in the SPI controller driver, via a call to the PCH driver. Drop the ad-hoc version.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/quark/quark.c | 17 ----------------- 1 file changed, 17 deletions(-)
Tested on Minnowmax:
PATCH 5/23 x86: quark: Drop unprotect_spi_flash()
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
Unprotecting SPI flash is now handled in the SPI controller driver, via a call to the PCH driver. Drop the ad-hoc version.
Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/cpu/quark/quark.c | 17 ----------------- 1 file changed, 17 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 6/23 dm: pch: Remove pch_get_version op
In reply to Bin Mengpch_get_version op was only used by the ich spi controller driver, and does not really provide a good identification of pch controller so far, since we see plenty of Intel PCH chipsets and one differs from another a lot, which is not simply either a PCHV_7 or PCHV_9. Now that ich spi controller driver was updated to not get such info from pch, the pch_get_version op is useless now.
---
arch/x86/cpu/ivybridge/bd82x6x.c | 6 ------ drivers/pch/pch-uclass.c | 10 ---------- drivers/pch/pch7.c | 6 ------ drivers/pch/pch9.c | 6 ------ include/pch.h | 20 -------------------- 5 files changed, 48 deletions(-)
arch/x86/cpu/ivybridge/bd82x6x.c +0 -6
@@ -182,11 +182,6 @@ static int bd82x6x_pch_get_sbase(struct udevice *dev, ulong *sbasep)return 0 ; } -static enum pch_version bd82x6x_pch_get_version (struct udevice *dev) -{ -return PCHV_9 ; -} -static int bd82x6x_set_spi_protect (struct udevice *dev,bool protect) {uint8_t bios_cntl;
@@ -207,7 +202,6 @@ static int bd82x6x_set_spi_protect(struct udevice *dev, bool protect)static const struct pch_ops bd82x6x_pch_ops = { .get_sbase = bd82x6x_pch_get_sbase, - .get_version = bd82x6x_pch_get_version, .set_spi_protect = bd82x6x_set_spi_protect, };
drivers/pch/pch-uclass.c +0 -10
@@ -23,16 +23,6 @@ int pch_get_sbase(struct udevice *dev, ulong *sbasep)return ops->get_sbase (dev, sbasep); } -enum pch_version pch_get_version (struct udevice *dev) -{ -struct pch_ops *ops =pch_get_ops (dev); - -if (!ops->get_version) -return -ENOSYS ; - -return ops->get_version (dev); -} -int pch_set_spi_protect (struct udevice *dev,bool protect) {struct pch_ops *ops =pch_get_ops (dev);
drivers/pch/pch7.c +0 -6
@@ -22,11 +22,6 @@ static int pch7_get_sbase(struct udevice *dev, ulong *sbasep)return 0 ; } -static enum pch_version pch7_get_version (struct udevice *dev) -{ -return PCHV_7 ; -} -static int pch7_set_spi_protect (struct udevice *dev,bool protect) {uint8_t bios_cntl;
@@ -44,7 +39,6 @@ static int pch7_set_spi_protect(struct udevice *dev, bool protect)static const struct pch_ops pch7_ops = { .get_sbase = pch7_get_sbase, - .get_version = pch7_get_version, .set_spi_protect = pch7_set_spi_protect, };
drivers/pch/pch9.c +0 -6
@@ -20,14 +20,8 @@ static int pch9_get_sbase(struct udevice *dev, ulong *sbasep)return 0 ; } -static enum pch_version pch9_get_version (struct udevice *dev) -{ -return PCHV_9 ; -} -static const struct pch_ops pch9_ops = { .get_sbase = pch9_get_sbase, - .get_version = pch9_get_version, };static const struct udevice_id pch9_ids[] = {
include/pch.h +0 -20
@@ -8,12 +8,6 @@#ifndef __pch_h#define __pch_h -enum pch_version { -PCHV_UNKNOWN , -PCHV_7 , -PCHV_9 , -}; -#define PCH_RCBA 0xf0#define BIOS_CTRL_BIOSWE BIT(0)
@@ -30,13 +24,6 @@ struct pch_ops {int (*get_sbase)(struct udevice *dev,ulong *sbasep);/** -* get_version() - get the PCH version -* -* @return version, or -ENOSYS if unknown -*/ -enum pch_version (*get_version)(struct udevice *dev); - -/** * set_spi_protect() - set whether SPI flash is protected or not * * @dev: PCH device to adjust
@@ -59,13 +46,6 @@ struct pch_ops {int pch_get_sbase (struct udevice *dev,ulong *sbasep);/** -* pch_get_version() - get the PCH version -* -* @return version, or -ENOSYS if unknown -*/ -enum pch_version pch_get_version (struct udevice *dev); - -/** * set_spi_protect() - set whether SPI flash is protected or not * * @dev: PCH device to adjust
Signature · 1 line
1.8.2.1
PATCH 6/23 dm: pch: Remove pch_get_version op
Quoted 8 lines · Bin Meng
pch_get_versionop was only used by the ich spi controller driver, and does not really provide a good identification of pch controller so far, since we see plenty of Intel PCH chipsets and one differs from another a lot, which is not simply either aPCHV_7orPCHV_9. Now that ich spi controller driver was updated to not get such info from pch, thepch_get_versionop is useless now.Signed-off-by Bin Meng <[email protected]>
Quoted 8 lines
---
arch/x86/cpu/ivybridge/bd82x6x.c | 6 ------ drivers/pch/pch-uclass.c | 10 ---------- drivers/pch/pch7.c | 6 ------ drivers/pch/pch9.c | 6 ------ include/pch.h | 20 -------------------- 5 files changed, 48 deletions(-)
Tested on Minnowmax:
PATCH 6/23 dm: pch: Remove pch_get_version op
Quoted 18 lines · Simon Glass
Quoted 8 lines · Bin Meng
pch_get_versionop was only used by the ich spi controller driver, and does not really provide a good identification of pch controller so far, since we see plenty of Intel PCH chipsets and one differs from another a lot, which is not simply either aPCHV_7orPCHV_9. Now that ich spi controller driver was updated to not get such info from pch, thepch_get_versionop is useless now.Signed-off-by Bin Meng <[email protected]>Quoted 8 lines
---
arch/x86/cpu/ivybridge/bd82x6x.c | 6 ------ drivers/pch/pch-uclass.c | 10 ---------- drivers/pch/pch7.c | 6 ------ drivers/pch/pch9.c | 6 ------ include/pch.h | 20 -------------------- 5 files changed, 48 deletions(-)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 7/23 dm: pch: Rename get_sbase op to get_spi_base
In reply to Bin MengSpell out 'sbase' to 'spi_base' so that it looks clearer.
---
arch/x86/cpu/ivybridge/bd82x6x.c | 4 ++-- drivers/pch/pch-uclass.c | 6 +++--- drivers/pch/pch7.c | 4 ++-- drivers/pch/pch9.c | 4 ++-- drivers/spi/ich.c | 2 +- include/pch.h | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-)
arch/x86/cpu/ivybridge/bd82x6x.c +2 -2
@@ -170,7 +170,7 @@ static int bd82x6x_probe(struct udevice *dev)return 0 ; } -static int bd82x6x_pch_get_sbase (struct udevice *dev,ulong *sbasep) +static int bd82x6x_pch_get_spi_base (struct udevice *dev,ulong *sbasep) {u32 rcba;
@@ -201,7 +201,7 @@ static int bd82x6x_set_spi_protect(struct udevice *dev, bool protect) }static const struct pch_ops bd82x6x_pch_ops = { - .get_sbase = bd82x6x_pch_get_sbase, + .get_spi_base = bd82x6x_pch_get_spi_base, .set_spi_protect = bd82x6x_set_spi_protect, };
drivers/pch/pch-uclass.c +3 -3
@@ -12,15 +12,15 @@DECLARE_GLOBAL_DATA_PTR ; -int pch_get_sbase (struct udevice *dev,ulong *sbasep) +int pch_get_spi_base (struct udevice *dev,ulong *sbasep) {struct pch_ops *ops =pch_get_ops (dev); *sbasep =0 ; -if (!ops->get_sbase) +if (!ops->get_spi_base)return -ENOSYS ; -return ops->get_sbase (dev, sbasep); +return ops->get_spi_base (dev, sbasep); }int pch_set_spi_protect (struct udevice *dev,bool protect)
drivers/pch/pch7.c +2 -2
@@ -10,7 +10,7 @@#define BIOS_CTRL 0xd8 -static int pch7_get_sbase (struct udevice *dev,ulong *sbasep) +static int pch7_get_spi_base (struct udevice *dev,ulong *sbasep) {u32 rcba;
@@ -38,7 +38,7 @@ static int pch7_set_spi_protect(struct udevice *dev, bool protect) }static const struct pch_ops pch7_ops = { - .get_sbase = pch7_get_sbase, + .get_spi_base = pch7_get_spi_base, .set_spi_protect = pch7_set_spi_protect, };
drivers/pch/pch9.c +2 -2
@@ -10,7 +10,7 @@#define SBASE_ADDR 0x54 -static int pch9_get_sbase (struct udevice *dev,ulong *sbasep) +static int pch9_get_spi_base (struct udevice *dev,ulong *sbasep) {uint32_t sbase_addr;
@@ -21,7 +21,7 @@ static int pch9_get_sbase(struct udevice *dev, ulong *sbasep) }static const struct pch_ops pch9_ops = { - .get_sbase = pch9_get_sbase, + .get_spi_base = pch9_get_spi_base, };static const struct udevice_id pch9_ids[] = {
drivers/spi/ich.c +1 -1
@@ -119,7 +119,7 @@ static int ich_init_controller(struct udevice *dev,void *sbase;/* SBASE is similar */ -pch_get_sbase (dev->parent, &sbase_addr); +pch_get_spi_base (dev->parent, &sbase_addr); sbase = (void *)sbase_addr;debug ("%s: sbase=%p\n" , __func__, sbase);
include/pch.h +4 -4
@@ -15,13 +15,13 @@/* Operations for the Platform Controller Hub */ struct pch_ops {/** -* get_sbase() - get the address of SPI base +* get_spi_base() - get the address of SPI base * * @dev: PCH device to check * @sbasep: Returns address of SPI base if available, else 0 * @return 0 if OK, -ve on error (e.g. there is no SPI base) */ -int (*get_sbase)(struct udevice *dev,ulong *sbasep); +int (*get_spi_base)(struct udevice *dev,ulong *sbasep);/** * set_spi_protect() - set whether SPI flash is protected or not
@@ -37,13 +37,13 @@ struct pch_ops {#define pch_get_ops (dev) ((struct pch_ops *)(dev)->driver->ops)/** -* pch_get_sbase() - get the address of SPI base +* pch_get_spi_base() - get the address of SPI base * * @dev: PCH device to check * @sbasep: Returns address of SPI base if available, else 0 * @return 0 if OK, -ve on error (e.g. there is no SPI base) */ -int pch_get_sbase (struct udevice *dev,ulong *sbasep); +int pch_get_spi_base (struct udevice *dev,ulong *sbasep);/** * set_spi_protect() - set whether SPI flash is protected or not
Signature · 1 line
1.8.2.1
PATCH 7/23 dm: pch: Rename get_sbase op to get_spi_base
Quoted 5 lines · Bin Meng
Spell out 'sbase' to '
spi_base' so that it looks clearer.Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
arch/x86/cpu/ivybridge/bd82x6x.c | 4 ++-- drivers/pch/pch-uclass.c | 6 +++--- drivers/pch/pch7.c | 4 ++-- drivers/pch/pch9.c | 4 ++-- drivers/spi/ich.c | 2 +- include/pch.h | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-)
Tested on Minnowmax:
PATCH 7/23 dm: pch: Rename get_sbase op to get_spi_base
Quoted 14 lines · Simon Glass
Quoted 5 lines · Bin Meng
Spell out 'sbase' to '
spi_base' so that it looks clearer.Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
arch/x86/cpu/ivybridge/bd82x6x.c | 4 ++-- drivers/pch/pch-uclass.c | 6 +++--- drivers/pch/pch7.c | 4 ++-- drivers/pch/pch9.c | 4 ++-- drivers/spi/ich.c | 2 +- include/pch.h | 8 ++++---- 6 files changed, 14 insertions(+), 14 deletions(-)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 8/23 dm: pch: Add get_gpio_base op
In reply to Bin Mengx86 GPIO registers are accessed via I/O port whose base address is configured in a PCI configuration register on the PCH device. Add an op get_gpio_base to get the GPIO base address from PCH.
---
drivers/pch/pch-uclass.c | 11 +++++++++++ include/pch.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+)
drivers/pch/pch-uclass.c +11 -0
@@ -33,6 +33,17 @@ int pch_set_spi_protect(struct udevice *dev, bool protect)return ops->set_spi_protect (dev, protect); } +int pch_get_gpio_base (struct udevice *dev,u32 *gbasep) +{ +struct pch_ops *ops =pch_get_ops (dev); + + *gbasep =0 ; +if (!ops->get_gpio_base) +return -ENOSYS ; + +return ops->get_gpio_base (dev, gbasep); +} +static int pch_uclass_post_bind (struct udevice *bus) {/*
include/pch.h +18 -0
@@ -32,6 +32,15 @@ struct pch_ops {* @return 0 on success, -ENOSYS if not implemented */ int (*set_spi_protect)(struct udevice *dev,bool protect); + +/** +* get_gpio_base() - get the address of GPIO base +* +* @dev: PCH device to check +* @gbasep: Returns address of GPIO base if available, else 0 +* @return 0 if OK, -ve on error (e.g. there is no GPIO base) +*/ +int (*get_gpio_base)(struct udevice *dev,u32 *gbasep); };#define pch_get_ops (dev) ((struct pch_ops *)(dev)->driver->ops)
@@ -55,4 +64,13 @@ int pch_get_spi_base(struct udevice *dev, ulong *sbasep);*/ int pch_set_spi_protect (struct udevice *dev,bool protect); +/** +* pch_get_gpio_base() - get the address of GPIO base +* +* @dev: PCH device to check +* @gbasep: Returns address of GPIO base if available, else 0 +* @return 0 if OK, -ve on error (e.g. there is no GPIO base) +*/ +int pch_get_gpio_base (struct udevice *dev,u32 *gbasep); +#endif
Signature · 1 line
1.8.2.1
PATCH 8/23 dm: pch: Add get_gpio_base op
Quoted 10 lines · Bin Meng
x86 GPIO registers are accessed via I/O port whose base address is configured in a PCI configuration register on the PCH device. Add an op
get_gpio_baseto get the GPIO base address from PCH.Signed-off-by Bin Meng <[email protected]>---
drivers/pch/pch-uclass.c | 11 +++++++++++ include/pch.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+)
Tested on Minnowmax:
PATCH 8/23 dm: pch: Add get_gpio_base op
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng
x86 GPIO registers are accessed via I/O port whose base address is configured in a PCI configuration register on the PCH device. Add an op
get_gpio_baseto get the GPIO base address from PCH.Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 3 lines
drivers/pch/pch-uclass.c | 11 +++++++++++ include/pch.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 9/23 x86: pch: Implement get_gpio_base op
In reply to Bin MengImplement get_gpio_base op for bd82x6x, pch7 and pch9 drivers.
---
arch/x86/cpu/ivybridge/bd82x6x.c | 33 +++++++++++++++++++++++++++++++++ drivers/pch/pch7.c | 33 +++++++++++++++++++++++++++++++++ drivers/pch/pch9.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+)
arch/x86/cpu/ivybridge/bd82x6x.c +33 -0
@@ -19,6 +19,7 @@#include <asm/arch/pch.h> #include <asm/arch/sandybridge.h> +#define GPIO_BASE 0x48#define BIOS_CTRL 0xdcstatic int pch_revision_id =-1 ;
@@ -200,9 +201,41 @@ static int bd82x6x_set_spi_protect(struct udevice *dev, bool protect)return 0 ; } +static int bd82x6x_get_gpio_base (struct udevice *dev,u32 *gbasep) +{ +u32 base; + +/* +* GPIO_BASE moved to its current offset with ICH6, but prior to +* that it was unused (or undocumented). Check that it looks +* okay: not all ones or zeros. +* +* Note we don't need check bit0 here, because the Tunnel Creek +* GPIO base address register bit0 is reserved (read returns 0), +* while on the Ivybridge the bit0 is used to indicate it is an +* I/O space. +*/ +dm_pci_read_config32 (dev,GPIO_BASE , &base); +if (base ==0x00000000 || base ==0xffffffff ) { +debug ("%s: unexpected BASE value\n" , __func__); +return -ENODEV ; + } + +/* +* Okay, I guess we're looking at the right device. The actual +* GPIO registers are in the PCI device's I/O space, starting +* at the offset that we just read. Bit 0 indicates that it's +* an I/O address, not a memory address, so mask that off. +*/ + *gbasep = base &1 ? base & ~3 : base & ~15 ; + +return 0 ; +} +static const struct pch_ops bd82x6x_pch_ops = { .get_spi_base = bd82x6x_pch_get_spi_base, .set_spi_protect = bd82x6x_set_spi_protect, + .get_gpio_base = bd82x6x_get_gpio_base, };static const struct udevice_id bd82x6x_ids[] = {
drivers/pch/pch7.c +33 -0
@@ -8,6 +8,7 @@#include <dm.h> #include <pch.h> +#define GPIO_BASE 0x44#define BIOS_CTRL 0xd8static int pch7_get_spi_base (struct udevice *dev,ulong *sbasep)
@@ -37,9 +38,41 @@ static int pch7_set_spi_protect(struct udevice *dev, bool protect)return 0 ; } +static int pch7_get_gpio_base (struct udevice *dev,u32 *gbasep) +{ +u32 base; + +/* +* GPIO_BASE moved to its current offset with ICH6, but prior to +* that it was unused (or undocumented). Check that it looks +* okay: not all ones or zeros. +* +* Note we don't need check bit0 here, because the Tunnel Creek +* GPIO base address register bit0 is reserved (read returns 0), +* while on the Ivybridge the bit0 is used to indicate it is an +* I/O space. +*/ +dm_pci_read_config32 (dev,GPIO_BASE , &base); +if (base ==0x00000000 || base ==0xffffffff ) { +debug ("%s: unexpected BASE value\n" , __func__); +return -ENODEV ; + } + +/* +* Okay, I guess we're looking at the right device. The actual +* GPIO registers are in the PCI device's I/O space, starting +* at the offset that we just read. Bit 0 indicates that it's +* an I/O address, not a memory address, so mask that off. +*/ + *gbasep = base &1 ? base & ~3 : base & ~15 ; + +return 0 ; +} +static const struct pch_ops pch7_ops = { .get_spi_base = pch7_get_spi_base, .set_spi_protect = pch7_set_spi_protect, + .get_gpio_base = pch7_get_gpio_base, };static const struct udevice_id pch7_ids[] = {
drivers/pch/pch9.c +33 -0
@@ -8,6 +8,7 @@#include <dm.h> #include <pch.h> +#define GPIO_BASE 0x48#define SBASE_ADDR 0x54static int pch9_get_spi_base (struct udevice *dev,ulong *sbasep)
@@ -20,8 +21,40 @@ static int pch9_get_spi_base(struct udevice *dev, ulong *sbasep)return 0 ; } +static int pch9_get_gpio_base (struct udevice *dev,u32 *gbasep) +{ +u32 base; + +/* +* GPIO_BASE moved to its current offset with ICH6, but prior to +* that it was unused (or undocumented). Check that it looks +* okay: not all ones or zeros. +* +* Note we don't need check bit0 here, because the Tunnel Creek +* GPIO base address register bit0 is reserved (read returns 0), +* while on the Ivybridge the bit0 is used to indicate it is an +* I/O space. +*/ +dm_pci_read_config32 (dev,GPIO_BASE , &base); +if (base ==0x00000000 || base ==0xffffffff ) { +debug ("%s: unexpected BASE value\n" , __func__); +return -ENODEV ; + } + +/* +* Okay, I guess we're looking at the right device. The actual +* GPIO registers are in the PCI device's I/O space, starting +* at the offset that we just read. Bit 0 indicates that it's +* an I/O address, not a memory address, so mask that off. +*/ + *gbasep = base &1 ? base & ~3 : base & ~15 ; + +return 0 ; +} +static const struct pch_ops pch9_ops = { .get_spi_base = pch9_get_spi_base, + .get_gpio_base = pch9_get_gpio_base, };static const struct udevice_id pch9_ids[] = {
Signature · 1 line
1.8.2.1
PATCH 9/23 x86: pch: Implement get_gpio_base op
Quoted 9 lines · Bin Meng
Implement
get_gpio_baseop for bd82x6x, pch7 and pch9 drivers.Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/ivybridge/bd82x6x.c | 33 +++++++++++++++++++++++++++++++++ drivers/pch/pch7.c | 33 +++++++++++++++++++++++++++++++++ drivers/pch/pch9.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+)
Tested on Minnowmax:
PATCH 9/23 x86: pch: Implement get_gpio_base op
Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng
Implement
get_gpio_baseop for bd82x6x, pch7 and pch9 drivers.Signed-off-by Bin Meng <[email protected]>---
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/ivybridge/bd82x6x.c | 33 +++++++++++++++++++++++++++++++++ drivers/pch/pch7.c | 33 +++++++++++++++++++++++++++++++++ drivers/pch/pch9.c | 33 +++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 10/23 dm: pch: Add get_io_base op
In reply to Bin MengOn some newer chipset (eg: BayTrail), there is an IO base address register on the PCH device which configures the base address of a memory-mapped I/O controller.
---
drivers/pch/pch-uclass.c | 11 +++++++++++ include/pch.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+)
drivers/pch/pch-uclass.c +11 -0
@@ -44,6 +44,17 @@ int pch_get_gpio_base(struct udevice *dev, u32 *gbasep)return ops->get_gpio_base (dev, gbasep); } +int pch_get_io_base (struct udevice *dev,u32 *iobasep) +{ +struct pch_ops *ops =pch_get_ops (dev); + + *iobasep =0 ; +if (!ops->get_io_base) +return -ENOSYS ; + +return ops->get_io_base (dev, iobasep); +} +static int pch_uclass_post_bind (struct udevice *bus) {/*
include/pch.h +18 -0
@@ -41,6 +41,15 @@ struct pch_ops {* @return 0 if OK, -ve on error (e.g. there is no GPIO base) */ int (*get_gpio_base)(struct udevice *dev,u32 *gbasep); + +/** +* get_io_base() - get the address of IO base +* +* @dev: PCH device to check +* @iobasep: Returns address of IO base if available, else 0 +* @return 0 if OK, -ve on error (e.g. there is no IO base) +*/ +int (*get_io_base)(struct udevice *dev,u32 *iobasep); };#define pch_get_ops (dev) ((struct pch_ops *)(dev)->driver->ops)
@@ -73,4 +82,13 @@ int pch_set_spi_protect(struct udevice *dev, bool protect);*/ int pch_get_gpio_base (struct udevice *dev,u32 *gbasep); +/** +* pch_get_io_base() - get the address of IO base +* +* @dev: PCH device to check +* @iobasep: Returns address of IO base if available, else 0 +* @return 0 if OK, -ve on error (e.g. there is no IO base) +*/ +int pch_get_io_base (struct udevice *dev,u32 *iobasep); +#endif
Signature · 1 line
1.8.2.1
PATCH 10/23 dm: pch: Add get_io_base op
Quoted 10 lines · Bin Meng
On some newer chipset (eg: BayTrail), there is an IO base address register on the PCH device which configures the base address of a memory-mapped I/O controller.
Signed-off-by Bin Meng <[email protected]>---
drivers/pch/pch-uclass.c | 11 +++++++++++ include/pch.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+)
Tested on Minnowmax:
PATCH 10/23 dm: pch: Add get_io_base op
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng
On some newer chipset (eg: BayTrail), there is an IO base address register on the PCH device which configures the base address of a memory-mapped I/O controller.
Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 3 lines
drivers/pch/pch-uclass.c | 11 +++++++++++ include/pch.h | 18 ++++++++++++++++++ 2 files changed, 29 insertions(+)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 11/23 x86: pch9: Implement get_io_base op
In reply to Bin MengIO_BASE is only seen on PCH9 device, implement the get_io_base op.
---
drivers/pch/pch9.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/pch/pch9.c +17 -0
@@ -9,6 +9,7 @@#include <pch.h> #define GPIO_BASE 0x48 +#define IO_BASE 0x4c#define SBASE_ADDR 0x54static int pch9_get_spi_base (struct udevice *dev,ulong *sbasep)
@@ -52,9 +53,25 @@ static int pch9_get_gpio_base(struct udevice *dev, u32 *gbasep)return 0 ; } +static int pch9_get_io_base (struct udevice *dev,u32 *iobasep) +{ +u32 base; + +dm_pci_read_config32 (dev,IO_BASE , &base); +if (base ==0x00000000 || base ==0xffffffff ) { +debug ("%s: unexpected BASE value\n" , __func__); +return -ENODEV ; + } + + *iobasep = base &1 ? base & ~3 : base & ~15 ; + +return 0 ; +} +static const struct pch_ops pch9_ops = { .get_spi_base = pch9_get_spi_base, .get_gpio_base = pch9_get_gpio_base, + .get_io_base = pch9_get_io_base, };static const struct udevice_id pch9_ids[] = {
Signature · 1 line
1.8.2.1
PATCH 11/23 x86: pch9: Implement get_io_base op
Quoted 7 lines · Bin Meng
IO_BASEis only seen on PCH9 device, implement theget_io_baseop.Signed-off-by Bin Meng <[email protected]>---
drivers/pch/pch9.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
Tested on Minnowmax:
PATCH 11/23 x86: pch9: Implement get_io_base op
Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng
IO_BASEis only seen on PCH9 device, implement theget_io_baseop.Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
drivers/pch/pch9.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 12/23 x86: ich6_gpio: Convert to use proper DM API
In reply to Bin MengAt present this GPIO driver still uses the legacy PCI API. Now that we have proper PCH drivers we can use those to obtain the information we need. While the device tree has nodes for the GPIO peripheral it is not in the right place. It should be on the PCI bus as a sub-peripheral of the PCH device.
Update the device tree files to show the GPIO controller within the PCH, so that PCI access works as expected. This also adds #address-cells and
---
arch/x86/dts/bayleybay.dts | 86 ++++++++++++------------- arch/x86/dts/chromebook_link.dts | 42 ++++++------- arch/x86/dts/chromebox_panther.dts | 44 ++++++------- arch/x86/dts/crownbay.dts | 30 ++++----- arch/x86/dts/galileo.dts | 28 +++++---- arch/x86/dts/minnowmax.dts | 86 ++++++++++++------------- drivers/gpio/intel_ich6_gpio.c | 125 +++++++------------------------------ 7 files changed, 186 insertions(+), 255 deletions(-)
arch/x86/dts/bayleybay.dts +44 -42
@@ -65,48 +65,6 @@ }; }; - gpioa { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0 0x20>; - bank-name = "A"; - }; - - gpiob { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0x20 0x20>; - bank-name = "B"; - }; - - gpioc { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0x40 0x20>; - bank-name = "C"; - }; - - gpiod { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0x60 0x20>; - bank-name = "D"; - }; - - gpioe { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0x80 0x20>; - bank-name = "E"; - }; - - gpiof { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0xA0 0x20>; - bank-name = "F"; - }; - pci { compatible = "pci-x86"; #address-cells = <3>;
@@ -119,6 +77,8 @@ pch at 1f,0 { reg = <0x0000f800 0 0 0 0>; compatible = "intel,pch9"; + #address-cells = <1>; + #size-cells = <1>; irq-router { compatible = "intel,irq-router";
@@ -201,6 +161,48 @@ }; }; }; + + gpioa { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0 0x20>; + bank-name = "A"; + }; + + gpiob { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x20 0x20>; + bank-name = "B"; + }; + + gpioc { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x40 0x20>; + bank-name = "C"; + }; + + gpiod { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x60 0x20>; + bank-name = "D"; + }; + + gpioe { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x80 0x20>; + bank-name = "E"; + }; + + gpiof { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0xA0 0x20>; + bank-name = "F"; + }; }; };
arch/x86/dts/chromebook_link.dts +21 -21
54 lines not on this page · raw message
arch/x86/dts/chromebox_panther.dts +23 -21
62 lines not on this page · raw message
arch/x86/dts/crownbay.dts +16 -14
@@ -50,20 +50,6 @@ }; - gpioa { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0 0x20>; - bank-name = "A"; - }; - - gpiob { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0x20 0x20>; - bank-name = "B"; - }; - chosen { /* * By default the legacy superio serial port is used as the
@@ -166,6 +152,8 @@ pch at 1f,0 { reg = <0x0000f800 0 0 0 0>; compatible = "intel,pch7"; + #address-cells = <1>; + #size-cells = <1>; irq-router { compatible = "intel,queensbay-irq-router";
@@ -242,6 +230,20 @@ memory-map = <0xffe00000 0x00200000>; }; }; + + gpioa { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0 0x20>; + bank-name = "A"; + }; + + gpiob { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x20 0x20>; + bank-name = "B"; + }; }; };
arch/x86/dts/galileo.dts +15 -13
@@ -82,6 +82,8 @@ pch at 1f,0 { reg = <0x0000f800 0 0 0 0>; compatible = "intel,pch7"; + #address-cells = <1>; + #size-cells = <1>; irq-router { compatible = "intel,quark-irq-router";
@@ -132,21 +134,21 @@ }; }; }; - }; - }; - gpioa { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0 0x20>; - bank-name = "A"; - }; + gpioa { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0 0x20>; + bank-name = "A"; + }; - gpiob { - compatible = "intel,ich6-gpio"; - u-boot,dm-pre-reloc; - reg = <0x20 0x20>; - bank-name = "B"; + gpiob { + compatible = "intel,ich6-gpio"; + u-boot,dm-pre-reloc; + reg = <0x20 0x20>; + bank-name = "B"; + }; + }; }; };
arch/x86/dts/minnowmax.dts +44 -42
104 lines not on this page · raw message
drivers/gpio/intel_ich6_gpio.c +23 -102
166 lines not on this page · raw message
Signature · 1 line
1.8.2.1
PATCH 12/23 x86: ich6_gpio: Convert to use proper DM API
Quoted 12 lines · Bin Meng
At present this GPIO driver still uses the legacy PCI API. Now that we have proper PCH drivers we can use those to obtain the information we need. While the device tree has nodes for the GPIO peripheral it is not in the right place. It should be on the PCI bus as a sub-peripheral of the PCH device.
Update the device tree files to show the GPIO controller within the PCH, so that PCI access works as expected. This also adds #address-cells and
Signed-off-by Bin Meng <[email protected]>---
Quoted 8 lines
arch/x86/dts/bayleybay.dts | 86 ++++++++++++------------- arch/x86/dts/chromebook_link.dts | 42 ++++++------- arch/x86/dts/chromebox_panther.dts | 44 ++++++------- arch/x86/dts/crownbay.dts | 30 ++++----- arch/x86/dts/galileo.dts | 28 +++++---- arch/x86/dts/minnowmax.dts | 86 ++++++++++++------------- drivers/gpio/intel_ich6_gpio.c | 125 +++++++------------------------------ 7 files changed, 186 insertions(+), 255 deletions(-)
Tested on Minnowmax:
PATCH 12/23 x86: ich6_gpio: Convert to use proper DM API
Quoted 22 lines · Simon Glass
Quoted 12 lines · Bin Meng
At present this GPIO driver still uses the legacy PCI API. Now that we have proper PCH drivers we can use those to obtain the information we need. While the device tree has nodes for the GPIO peripheral it is not in the right place. It should be on the PCI bus as a sub-peripheral of the PCH device.
Update the device tree files to show the GPIO controller within the PCH, so that PCI access works as expected. This also adds #address-cells and
Signed-off-by Bin Meng <[email protected]>---
Quoted 8 lines
arch/x86/dts/bayleybay.dts | 86 ++++++++++++------------- arch/x86/dts/chromebook_link.dts | 42 ++++++------- arch/x86/dts/chromebox_panther.dts | 44 ++++++------- arch/x86/dts/crownbay.dts | 30 ++++----- arch/x86/dts/galileo.dts | 28 +++++---- arch/x86/dts/minnowmax.dts | 86 ++++++++++++------------- drivers/gpio/intel_ich6_gpio.c | 125 +++++++------------------------------ 7 files changed, 186 insertions(+), 255 deletions(-)
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 13/23 x86: Drop asm/arch/gpio.h
In reply to Bin Mengasm/arch/gpio.h is not needed anymore as we get the GPIO base from PCH driver.
---
arch/x86/include/asm/arch-baytrail/gpio.h | 13 ------------- arch/x86/include/asm/arch-coreboot/gpio.h | 13 ------------- arch/x86/include/asm/arch-efi/gpio.h | 10 ---------- arch/x86/include/asm/arch-ivybridge/gpio.h | 13 ------------- arch/x86/include/asm/arch-qemu/gpio.h | 13 ------------- arch/x86/include/asm/arch-quark/gpio.h | 13 ------------- arch/x86/include/asm/arch-queensbay/gpio.h | 13 ------------- arch/x86/include/asm/gpio.h | 1 - board/intel/galileo/galileo.c | 5 ++--- 9 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 arch/x86/include/asm/arch-baytrail/gpio.h delete mode 100644 arch/x86/include/asm/arch-coreboot/gpio.h delete mode 100644 arch/x86/include/asm/arch-efi/gpio.h delete mode 100644 arch/x86/include/asm/arch-ivybridge/gpio.h delete mode 100644 arch/x86/include/asm/arch-qemu/gpio.h delete mode 100644 arch/x86/include/asm/arch-quark/gpio.h delete mode 100644 arch/x86/include/asm/arch-queensbay/gpio.h
arch/x86/include/asm/arch-baytrail/gpio.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* Copyright (C) 2014, Bin Meng <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -/* Where in config space is the register that points to the GPIO registers? */ -#define PCI_CFG_GPIOBASE 0x48 - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-coreboot/gpio.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* Copyright (c) 2014, Google Inc. -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -/* Where in config space is the register that points to the GPIO registers? */ -#define PCI_CFG_GPIOBASE 0x48 - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-efi/gpio.h deleted +0 -10
@@ -1,10 +0,0 @@ -/* -* Copyright (c) 2015 Google, Inc. -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-ivybridge/gpio.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* Copyright (c) 2014, Google Inc. -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -/* Where in config space is the register that points to the GPIO registers? */ -#define PCI_CFG_GPIOBASE 0x48 - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-qemu/gpio.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* Copyright (C) 2015, Bin Meng <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -/* Where in config space is the register that points to the GPIO registers? */ -#define PCI_CFG_GPIOBASE 0x44 - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-quark/gpio.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* Copyright (C) 2015, Bin Meng <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -/* Where in config space is the register that points to the GPIO registers? */ -#define PCI_CFG_GPIOBASE 0x44 - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/arch-queensbay/gpio.h deleted +0 -13
@@ -1,13 +0,0 @@ -/* -* Copyright (C) 2014, Bin Meng <[email protected]> -* -* SPDX-License-Identifier: GPL-2.0+ -*/ - -#ifndef _X86_ARCH_GPIO_H_ -#define _X86_ARCH_GPIO_H_ - -/* Where in config space is the register that points to the GPIO registers? */ -#define PCI_CFG_GPIOBASE 0x44 - -#endif /* _X86_ARCH_GPIO_H_ */
arch/x86/include/asm/gpio.h +0 -1
@@ -7,7 +7,6 @@#define _X86_GPIO_H_#include <linux/compiler.h> -#include <asm/arch/gpio.h> #include <asm-generic/gpio.h> struct ich6_bank_platdata {
board/intel/galileo/galileo.c +2 -3
@@ -7,7 +7,6 @@#include <common.h> #include <asm/io.h> #include <asm/arch/device.h> -#include <asm/arch/gpio.h> #include <asm/arch/quark.h> int board_early_init_f (void )
@@ -30,7 +29,7 @@ void board_assert_perst(void)u32 base, port, val;/* retrieve the GPIO IO base */ -qrk_pci_read_config_dword (QUARK_LEGACY_BRIDGE ,PCI_CFG_GPIOBASE , &base); +qrk_pci_read_config_dword (QUARK_LEGACY_BRIDGE ,LB_GBA , &base); base = (base &0xffff ) & ~0x7f ;/* enable the pin */
@@ -57,7 +56,7 @@ void board_deassert_perst(void)u32 base, port, val;/* retrieve the GPIO IO base */ -qrk_pci_read_config_dword (QUARK_LEGACY_BRIDGE ,PCI_CFG_GPIOBASE , &base); +qrk_pci_read_config_dword (QUARK_LEGACY_BRIDGE ,LB_GBA , &base); base = (base &0xffff ) & ~0x7f ;/* pull it up (de-assert) */
Signature · 1 line
1.8.2.1
PATCH 13/23 x86: Drop asm/arch/gpio.h
Quoted 15 lines · Bin Meng
asm/arch/gpio.his not needed anymore as we get the GPIO base from PCH driver.Signed-off-by Bin Meng <[email protected]>---
arch/x86/include/asm/arch-baytrail/gpio.h | 13 ------------- arch/x86/include/asm/arch-coreboot/gpio.h | 13 ------------- arch/x86/include/asm/arch-efi/gpio.h | 10 ---------- arch/x86/include/asm/arch-ivybridge/gpio.h | 13 ------------- arch/x86/include/asm/arch-qemu/gpio.h | 13 ------------- arch/x86/include/asm/arch-quark/gpio.h | 13 ------------- arch/x86/include/asm/arch-queensbay/gpio.h | 13 ------------- arch/x86/include/asm/gpio.h | 1 - board/intel/galileo/galileo.c | 5 ++---
Quoted 8 lines
9 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 arch/x86/include/asm/arch-baytrail/gpio.h delete mode 100644 arch/x86/include/asm/arch-coreboot/gpio.h delete mode 100644 arch/x86/include/asm/arch-efi/gpio.h delete mode 100644 arch/x86/include/asm/arch-ivybridge/gpio.h delete mode 100644 arch/x86/include/asm/arch-qemu/gpio.h delete mode 100644 arch/x86/include/asm/arch-quark/gpio.h delete mode 100644 arch/x86/include/asm/arch-queensbay/gpio.h
Tested on Minnowmax:
PATCH 13/23 x86: Drop asm/arch/gpio.h
Quoted 25 lines · Simon Glass
Quoted 15 lines · Bin Meng
asm/arch/gpio.his not needed anymore as we get the GPIO base from PCH driver.Signed-off-by Bin Meng <[email protected]>---
arch/x86/include/asm/arch-baytrail/gpio.h | 13 ------------- arch/x86/include/asm/arch-coreboot/gpio.h | 13 ------------- arch/x86/include/asm/arch-efi/gpio.h | 10 ---------- arch/x86/include/asm/arch-ivybridge/gpio.h | 13 ------------- arch/x86/include/asm/arch-qemu/gpio.h | 13 ------------- arch/x86/include/asm/arch-quark/gpio.h | 13 ------------- arch/x86/include/asm/arch-queensbay/gpio.h | 13 ------------- arch/x86/include/asm/gpio.h | 1 - board/intel/galileo/galileo.c | 5 ++---Quoted 8 lines
9 files changed, 2 insertions(+), 92 deletions(-) delete mode 100644 arch/x86/include/asm/arch-baytrail/gpio.h delete mode 100644 arch/x86/include/asm/arch-coreboot/gpio.h delete mode 100644 arch/x86/include/asm/arch-efi/gpio.h delete mode 100644 arch/x86/include/asm/arch-ivybridge/gpio.h delete mode 100644 arch/x86/include/asm/arch-qemu/gpio.h delete mode 100644 arch/x86/include/asm/arch-quark/gpio.h delete mode 100644 arch/x86/include/asm/arch-queensbay/gpio.h
Quoted 3 lines
Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 14/23 x86: minnowmax: Drop io-base property in the pch_pinctrl node
In reply to Bin MengIOBASE is now obtained from PCH driver, drop this <io-base> property.
---
arch/x86/dts/minnowmax.dts | 1 - 1 file changed, 1 deletion(-)
arch/x86/dts/minnowmax.dts +0 -1
@@ -29,7 +29,6 @@ pch_pinctrl { compatible = "intel,x86-pinctrl"; - io-base = <0x4c>; /* GPIO E0 */ soc_gpio_s5_0 at 0 {
Signature · 1 line
1.8.2.1
PATCH 14/23 x86: minnowmax: Drop io-base property in the pch_pinctrl node
Quoted 7 lines · Bin Meng
IOBASE is now obtained from PCH driver, drop this <io-base> property.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/dts/minnowmax.dts | 1 - 1 file changed, 1 deletion(-)
Tested on Minnowmax:
PATCH 14/23 x86: minnowmax: Drop io-base property in the pch_pinctrl node
Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng
IOBASE is now obtained from PCH driver, drop this <io-base> property.
Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/dts/minnowmax.dts | 1 - 1 file changed, 1 deletion(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 15/23 x86: irq: Get irq_router's bdf via dm_pci_get_bdf()
In reply to Bin MengThere is no need to parse PCH's <reg> property as we have already a DM PCI API dm_pci_get_bdf() that can handle this.
---
arch/x86/cpu/irq.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
arch/x86/cpu/irq.c +1 -8
@@ -86,26 +86,19 @@ static inline void fill_irq_info(struct irq_info *slot, int bus, int device,static int create_pirq_routing_table (struct udevice *dev) {const void *blob = gd->fdt_blob; -struct fdt_pci_addr addr;int node;int len, count;const u32 *cell;struct irq_routing_table *rt;struct irq_info *slot, *slot_base;int irq_entries =0 ; -int parent;int i;int ret; node = dev->of_offset; - parent = dev->parent->of_offset; - ret =fdtdec_get_pci_addr (blob, parent,FDT_PCI_SPACE_CONFIG , -"reg" , &addr); -if (ret) -return ret;/* extract the bdf from fdt_pci_addr */ - irq_router.bdf = addr.phys_hi &0xffff00 ; + irq_router.bdf =dm_pci_get_bdf (dev->parent); ret =fdt_find_string (blob, node,"intel,pirq-config" ,"pci" );if (!ret) {
Signature · 1 line
1.8.2.1
PATCH 15/23 x86: irq: Get irq_router's bdf via dm_pci_get_bdf()
Quoted 8 lines · Bin Meng
There is no need to parse PCH's <reg> property as we have already a DM PCI API
dm_pci_get_bdf()that can handle this.Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/irq.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)
Tested on Minnowmax:
PATCH 15/23 x86: irq: Get irq_router's bdf via dm_pci_get_bdf()
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
There is no need to parse PCH's <reg> property as we have already a DM PCI API
dm_pci_get_bdf()that can handle this.Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/cpu/irq.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 16/23 x86: irq: Move irq_router to a per driver priv
In reply to Bin MengAt present irq_router is declared as a static struct irq_router in arch/x86/cpu/irq.c. Since it's a driver control block, it makes sense to move it to a per driver priv. Adjust existing APIs to accept an additional parameter of irq_router's udevice.
---
arch/x86/cpu/irq.c | 73 +++++++++++++++++++------------------ arch/x86/include/asm/pirq_routing.h | 12 ++++-- arch/x86/lib/pirq_routing.c | 12 +++--- 3 files changed, 51 insertions(+), 46 deletions(-)
arch/x86/cpu/irq.c +37 -36
@@ -16,19 +16,18 @@DECLARE_GLOBAL_DATA_PTR ; -static struct irq_router irq_router;static struct irq_routing_table *pirq_routing_table; -bool pirq_check_irq_routed (int link,u8 irq) +bool pirq_check_irq_routed (struct udevice *dev,int link,u8 irq) { +struct irq_router *priv =dev_get_priv (dev);u8 pirq; -int base = irq_router.link_base; +int base = priv->link_base; -if (irq_router.config ==PIRQ_VIA_PCI ) - pirq =x86_pci_read_config8 (irq_router.bdf, -LINK_N2V (link, base)); +if (priv->config ==PIRQ_VIA_PCI ) + pirq =x86_pci_read_config8 (priv->bdf,LINK_N2V (link, base));else - pirq =readb (irq_router.ibase +LINK_N2V (link, base)); + pirq =readb (priv->ibase +LINK_N2V (link, base)); pirq &=0xf ;
@@ -39,24 +38,26 @@ bool pirq_check_irq_routed(int link, u8 irq)return pirq == irq ? true : false; } -int pirq_translate_link (int link) +int pirq_translate_link (struct udevice *dev,int link) { -return LINK_V2N (link, irq_router.link_base); +struct irq_router *priv =dev_get_priv (dev); + +return LINK_V2N (link, priv->link_base); } -void pirq_assign_irq (int link,u8 irq) +void pirq_assign_irq (struct udevice *dev,int link,u8 irq) { -int base = irq_router.link_base; +struct irq_router *priv =dev_get_priv (dev); +int base = priv->link_base;/* IRQ# 0/1/2/8/13 are reserved */ if (irq <3 || irq ==8 || irq ==13 )return ; -if (irq_router.config ==PIRQ_VIA_PCI ) -x86_pci_write_config8 (irq_router.bdf, -LINK_N2V (link, base), irq); +if (priv->config ==PIRQ_VIA_PCI ) +x86_pci_write_config8 (priv->bdf,LINK_N2V (link, base), irq);else -writeb (irq, irq_router.ibase +LINK_N2V (link, base)); +writeb (irq, priv->ibase +LINK_N2V (link, base)); } static struct irq_info *check_dup_entry(struct irq_info *slot_base,
@@ -74,17 +75,18 @@ static struct irq_info *check_dup_entry(struct irq_info *slot_base,return (i == entry_num) ?NULL : slot; } -static inline void fill_irq_info (struct irq_info *slot,int bus,int device, -int pin,int pirq) +static inline void fill_irq_info (struct irq_router *priv,struct irq_info *slot, +int bus,int device,int pin,int pirq) { slot->bus = bus; slot->devfn = (device <<3 ) |0 ; - slot->irq[pin -1 ].link =LINK_N2V (pirq, irq_router.link_base); - slot->irq[pin -1 ].bitmap = irq_router.irq_mask; + slot->irq[pin -1 ].link =LINK_N2V (pirq, priv->link_base); + slot->irq[pin -1 ].bitmap = priv->irq_mask; }static int create_pirq_routing_table (struct udevice *dev) { +struct irq_router *priv =dev_get_priv (dev);const void *blob = gd->fdt_blob;int node;int len, count;
@@ -98,15 +100,15 @@ static int create_pirq_routing_table(struct udevice *dev) node = dev->of_offset;/* extract the bdf from fdt_pci_addr */ - irq_router.bdf =dm_pci_get_bdf (dev->parent); + priv->bdf =dm_pci_get_bdf (dev->parent); ret =fdt_find_string (blob, node,"intel,pirq-config" ,"pci" );if (!ret) { - irq_router.config =PIRQ_VIA_PCI ; + priv->config =PIRQ_VIA_PCI ; }else { ret =fdt_find_string (blob, node,"intel,pirq-config" ,"ibase" );if (!ret) - irq_router.config =PIRQ_VIA_IBASE ; + priv->config =PIRQ_VIA_IBASE ;else return -EINVAL ; }
@@ -114,12 +116,12 @@ static int create_pirq_routing_table(struct udevice *dev) ret =fdtdec_get_int (blob, node,"intel,pirq-link" ,-1 );if (ret ==-1 )return ret; - irq_router.link_base = ret; + priv->link_base = ret; - irq_router.irq_mask =fdtdec_get_int (blob, node, -"intel,pirq-mask" ,PIRQ_BITMAP ); + priv->irq_mask =fdtdec_get_int (blob, node, +"intel,pirq-mask" ,PIRQ_BITMAP ); -if (irq_router.config ==PIRQ_VIA_IBASE ) { +if (priv->config ==PIRQ_VIA_IBASE ) {int ibase_off; ibase_off =fdtdec_get_int (blob, node,"intel,ibase-offset" ,0 );
@@ -136,9 +138,8 @@ static int create_pirq_routing_table(struct udevice *dev)* 2) memory range decoding is enabled. * Hence we don't do any santify test here. */ - irq_router.ibase =x86_pci_read_config32 (irq_router.bdf, - ibase_off); - irq_router.ibase &= ~0xf ; + priv->ibase =x86_pci_read_config32 (priv->bdf, ibase_off); + priv->ibase &= ~0xf ; } cell =fdt_getprop (blob, node,"intel,pirq-routing" , &len);
@@ -153,9 +154,8 @@ static int create_pirq_routing_table(struct udevice *dev)/* Populate the PIRQ table fields */ rt->signature =PIRQ_SIGNATURE ; rt->version =PIRQ_VERSION ; - rt->rtr_bus =PCI_BUS (irq_router.bdf); - rt->rtr_devfn = (PCI_DEV (irq_router.bdf) <<3 ) | -PCI_FUNC (irq_router.bdf); + rt->rtr_bus =PCI_BUS (priv->bdf); + rt->rtr_devfn = (PCI_DEV (priv->bdf) <<3 ) |PCI_FUNC (priv->bdf); rt->rtr_vendor =PCI_VENDOR_ID_INTEL ; rt->rtr_device =PCI_DEVICE_ID_INTEL_ICH7_31 ;
@@ -192,7 +192,7 @@ static int create_pirq_routing_table(struct udevice *dev)* routing information in the device tree. */ if (slot->irq[pr.pin -1 ].link != -LINK_N2V (pr.pirq, irq_router.link_base)) +LINK_N2V (pr.pirq, priv->link_base))debug ("WARNING: Inconsistent PIRQ routing information\n" );continue ; }
@@ -200,8 +200,8 @@ static int create_pirq_routing_table(struct udevice *dev) slot = slot_base + irq_entries++; }debug ("writing INT%c\n" ,'A' + pr.pin -1 ); -fill_irq_info (slot,PCI_BUS (pr.bdf),PCI_DEV (pr.bdf), pr.pin, - pr.pirq); +fill_irq_info (priv, slot,PCI_BUS (pr.bdf),PCI_DEV (pr.bdf), + pr.pin, pr.pirq); } rt->size = irq_entries *sizeof (struct irq_info ) +32 ;
@@ -221,7 +221,7 @@ int irq_router_common_init(struct udevice *dev)return ret; }/* Route PIRQ */ -pirq_route_irqs (pirq_routing_table->slots, +pirq_route_irqs (dev, pirq_routing_table->slots,get_irq_slot_count (pirq_routing_table));return 0 ;
@@ -250,6 +250,7 @@ U_BOOT_DRIVER(irq_router_drv) = { .id = UCLASS_IRQ, .of_match = irq_router_ids, .probe = irq_router_probe, + .priv_auto_alloc_size = sizeof(struct irq_router), };UCLASS_DRIVER (irq) = {
arch/x86/include/asm/pirq_routing.h +8 -4
@@ -72,12 +72,13 @@ static inline int get_irq_slot_count(struct irq_routing_table *rt)* Note: this function should be provided by the platform codes, as the * implementation of interrupt router may be different. * +* @dev: irq router's udevice * @link: link number which represents a PIRQ * @irq: the 8259 IRQ number * @return: true if the irq is already routed to 8259 for a given link, * false elsewise */ -bool pirq_check_irq_routed (int link,u8 irq); +bool pirq_check_irq_routed (struct udevice *dev,int link,u8 irq);/** * pirq_translate_link() - Translate a link value
@@ -89,10 +90,11 @@ bool pirq_check_irq_routed(int link, u8 irq);* Note: this function should be provided by the platform codes, as the * implementation of interrupt router may be different. * +* @dev: irq router's udevice * @link: platform-specific link value * @return: link number which represents a PIRQ */ -int pirq_translate_link (int link); +int pirq_translate_link (struct udevice *dev,int link);/** * pirq_assign_irq() - Assign an IRQ to a PIRQ link
@@ -103,10 +105,11 @@ int pirq_translate_link(int link);* Note: this function should be provided by the platform codes, as the * implementation of interrupt router may be different. * +* @dev: irq router's udevice * @link: link number which represents a PIRQ * @irq: IRQ to which the PIRQ is routed */ -void pirq_assign_irq (int link,u8 irq); +void pirq_assign_irq (struct udevice *dev,int link,u8 irq);/** * pirq_route_irqs() - Route PIRQs to 8259 PIC
@@ -117,10 +120,11 @@ void pirq_assign_irq(int link, u8 irq);* The configuration source is taken from a struct irq_info table, the format * of which is defined in PIRQ routing table spec and PCI BIOS spec. * +* @dev: irq router's udevice * @irq: pointer to the base address of the struct irq_info * @num: number of entries in the struct irq_info */ -void pirq_route_irqs (struct irq_info *irq,int num); +void pirq_route_irqs (struct udevice *dev,struct irq_info *irq,int num);/** * copy_pirq_routing_table() - Copy a PIRQ routing table
arch/x86/lib/pirq_routing.c +6 -6
@@ -14,7 +14,7 @@static bool irq_already_routed[16 ]; -static u8 pirq_get_next_free_irq (u8 *pirq,u16 bitmap) +static u8 pirq_get_next_free_irq (struct udevice *dev,u8 *pirq,u16 bitmap) {int i, link;u8 irq =0 ;
@@ -33,7 +33,7 @@ static u8 pirq_get_next_free_irq(u8 *pirq, u16 bitmap)continue ;for (link =0 ; link <CONFIG_MAX_PIRQ_LINKS ; link++) { -if (pirq_check_irq_routed (link, irq)) { +if (pirq_check_irq_routed (dev, link, irq)) { irq_already_routed[irq] = true;break ; }
@@ -52,7 +52,7 @@ static u8 pirq_get_next_free_irq(u8 *pirq, u16 bitmap)return irq; } -void pirq_route_irqs (struct irq_info *irq,int num) +void pirq_route_irqs (struct udevice *dev,struct irq_info *irq,int num) {unsigned char irq_slot[MAX_INTX_ENTRIES ];unsigned char pirq[CONFIG_MAX_PIRQ_LINKS ];
@@ -80,11 +80,11 @@ void pirq_route_irqs(struct irq_info *irq, int num) }/* translate link value to link number */ - link =pirq_translate_link (link); + link =pirq_translate_link (dev, link);/* yet not routed */ if (!pirq[link]) { - irq =pirq_get_next_free_irq (pirq, bitmap); + irq =pirq_get_next_free_irq (dev, pirq, bitmap); pirq[link] = irq; }else { irq = pirq[link];
@@ -94,7 +94,7 @@ void pirq_route_irqs(struct irq_info *irq, int num) irq_slot[intx] = irq;/* Assign IRQ in the interrupt router */ -pirq_assign_irq (link, irq); +pirq_assign_irq (dev, link, irq); }/* Bus, device, slots IRQs for {A,B,C,D} */
Signature · 1 line
1.8.2.1
PATCH 16/23 x86: irq: Move irq_router to a per driver priv
Quoted 5 lines · Bin Meng
At present
irq_routeris declared as a static structirq_routerinarch/x86/cpu/irq.c. Since it's a driver control block, it makes sense to move it to a per driver priv. Adjust existing APIs to accept an additional parameter of irq_router's udevice.
Quoted 7 lines
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/irq.c | 73 +++++++++++++++++++------------------ arch/x86/include/asm/pirq_routing.h | 12 ++++-- arch/x86/lib/pirq_routing.c | 12 +++--- 3 files changed, 51 insertions(+), 46 deletions(-)
Tested on Minnowmax:
PATCH 16/23 x86: irq: Move irq_router to a per driver priv
Quoted 9 lines · Simon Glass
Quoted 8 lines · Bin Meng
At present
irq_routeris declared as a static structirq_routerinarch/x86/cpu/irq.c. Since it's a driver control block, it makes sense to move it to a per driver priv. Adjust existing APIs to accept an additional parameter of irq_router's udevice.Signed-off-by Bin Meng <[email protected]>---
Quoted 8 lines
Quoted 4 lines
arch/x86/cpu/irq.c | 73 +++++++++++++++++++------------------ arch/x86/include/asm/pirq_routing.h | 12 ++++-- arch/x86/lib/pirq_routing.c | 12 +++--- 3 files changed, 51 insertions(+), 46 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 17/23 x86: irq: Convert to use DM PCI API
In reply to Bin MengNow that we have irq router's udevice passed as a parameter, it's time to start using the DM PCI API instead of those legacy ones.
---
arch/x86/cpu/irq.c | 6 +++--- arch/x86/cpu/queensbay/irq.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/cpu/irq.c +3 -3
@@ -25,7 +25,7 @@ bool pirq_check_irq_routed(struct udevice *dev, int link, u8 irq)int base = priv->link_base;if (priv->config ==PIRQ_VIA_PCI ) - pirq =x86_pci_read_config8 (priv->bdf,LINK_N2V (link, base)); +dm_pci_read_config8 (dev->parent,LINK_N2V (link, base), &pirq);else pirq =readb (priv->ibase +LINK_N2V (link, base));
@@ -55,7 +55,7 @@ void pirq_assign_irq(struct udevice *dev, int link, u8 irq)return ;if (priv->config ==PIRQ_VIA_PCI ) -x86_pci_write_config8 (priv->bdf,LINK_N2V (link, base), irq); +dm_pci_write_config8 (dev->parent,LINK_N2V (link, base), irq);else writeb (irq, priv->ibase +LINK_N2V (link, base)); }
@@ -138,7 +138,7 @@ static int create_pirq_routing_table(struct udevice *dev)* 2) memory range decoding is enabled. * Hence we don't do any santify test here. */ - priv->ibase =x86_pci_read_config32 (priv->bdf, ibase_off); +dm_pci_read_config32 (dev->parent, ibase_off, &priv->ibase); priv->ibase &= ~0xf ; }
arch/x86/cpu/queensbay/irq.c +1 -1
@@ -18,7 +18,7 @@ int queensbay_irq_router_probe(struct udevice *dev)struct tnc_rcba *rcba;u32 base; - base =x86_pci_read_config32 (TNC_LPC ,LPC_RCBA ); +dm_pci_read_config32 (dev->parent,LPC_RCBA , &base); base &= ~MEM_BAR_EN ; rcba = (struct tnc_rcba *)base;
Signature · 1 line
1.8.2.1
PATCH 17/23 x86: irq: Convert to use DM PCI API
Quoted 9 lines · Bin Meng
Now that we have irq router's udevice passed as a parameter, it's time to start using the DM PCI API instead of those legacy ones.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/irq.c | 6 +++--- arch/x86/cpu/queensbay/irq.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
Tested on Minnowmax:
PATCH 17/23 x86: irq: Convert to use DM PCI API
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
Now that we have irq router's udevice passed as a parameter, it's time to start using the DM PCI API instead of those legacy ones.
Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 3 lines
arch/x86/cpu/irq.c | 6 +++--- arch/x86/cpu/queensbay/irq.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 18/23 x86: tnc: Change disable_igd() to have a return value
In reply to Bin MengSo far disable_igd() does not have any return value, but we may need that in the future.
---
arch/x86/cpu/queensbay/tnc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/x86/cpu/queensbay/tnc.c +7 -3
@@ -14,7 +14,7 @@#include <asm/fsp/fsp_support.h> #include <asm/processor.h> -static void __maybe_unused disable_igd (void ) +static int __maybe_unused disable_igd (void ) {/* * According to Atom E6xx datasheet, setting VGA Disable (bit17)
@@ -36,6 +36,8 @@ static void __maybe_unused disable_igd(void)*/ x86_pci_write_config32 (TNC_IGD ,IGD_FD ,FUNC_DISABLE );x86_pci_write_config32 (TNC_SDVO ,IGD_FD ,FUNC_DISABLE ); + +return 0 ; }int arch_cpu_init (void )
@@ -53,9 +55,11 @@ int arch_cpu_init(void)int arch_early_init_r (void ) { +int ret =0 ; +#ifdef CONFIG_DISABLE_IGD -disable_igd (); + ret =disable_igd ();#endif -return 0 ; +return ret; }
Signature · 1 line
1.8.2.1
PATCH 18/23 x86: tnc: Change disable_igd() to have a return value
Quoted 8 lines · Bin Meng
So far
disable_igd()does not have any return value, but we may need that in the future.Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/queensbay/tnc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
Tested on Minnowmax:
PATCH 18/23 x86: tnc: Change disable_igd() to have a return value
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
So far
disable_igd()does not have any return value, but we may need that in the future.Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/cpu/queensbay/tnc.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 19/23 x86: tnc: Use DM PCI API in disable_igd()
In reply to Bin MengOnce we get udevice of IGD and SDVO, we can use its udevice to access PCI configuration space with dm_pci_write_config32().
---
arch/x86/cpu/queensbay/tnc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
arch/x86/cpu/queensbay/tnc.c +19 -3
@@ -5,9 +5,10 @@*/ #include <common.h> +#include <dm.h> +#include <pci.h> #include <asm/io.h> #include <asm/irq.h> -#include <asm/pci.h> #include <asm/post.h> #include <asm/arch/device.h> #include <asm/arch/tnc.h>
@@ -16,6 +17,21 @@static int __maybe_unused disable_igd (void ) { +struct udevice *igd, *sdvo; +int ret; + + ret =dm_pci_bus_find_bdf (TNC_IGD , &igd); +if (ret) +return ret; +if (!igd) +return 0 ; + + ret =dm_pci_bus_find_bdf (TNC_SDVO , &sdvo); +if (ret) +return ret; +if (!sdvo) +return 0 ; +/* * According to Atom E6xx datasheet, setting VGA Disable (bit17) * of Graphics Controller register (offset 0x50) prevents IGD
@@ -34,8 +50,8 @@ static int __maybe_unused disable_igd(void)* two devices will be completely disabled (invisible in the PCI * configuration space) unless a system reset is performed. */ -x86_pci_write_config32 (TNC_IGD ,IGD_FD ,FUNC_DISABLE ); -x86_pci_write_config32 (TNC_SDVO ,IGD_FD ,FUNC_DISABLE ); +dm_pci_write_config32 (igd,IGD_FD ,FUNC_DISABLE ); +dm_pci_write_config32 (sdvo,IGD_FD ,FUNC_DISABLE );return 0 ; }
Signature · 1 line
1.8.2.1
PATCH 19/23 x86: tnc: Use DM PCI API in disable_igd()
Quoted 8 lines · Bin Meng
Once we get udevice of IGD and SDVO, we can use its udevice to access PCI configuration space with
dm_pci_write_config32().Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/queensbay/tnc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
Tested on Minnowmax:
PATCH 19/23 x86: tnc: Use DM PCI API in disable_igd()
Quoted 7 lines · Simon Glass
Quoted 6 lines · Bin Meng
Once we get udevice of IGD and SDVO, we can use its udevice to access PCI configuration space with
dm_pci_write_config32().Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/cpu/queensbay/tnc.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 20/23 x86: tnc: Remove IGD and SDVO devices from driver model
In reply to Bin MengWith recent DM PCI changes to vesa_fb driver, external graphics card does not work any more. This is because: after setting the function disable bit, IGD and SDVO devices will disappear in the PCI configuration space. This however creates an inconsistent state from a driver model PCI controller point of view, as these two PCI devices are still attached to its parent's child device list as maintained by the driver model. Some driver model PCI APIs like dm_pci_find_class() used in the vesa_fb driver, are referring to the list to speed up the finding process instead of re-enumerating the whole PCI bus, so it gets the stale cached data which is wrong.
To fix this, manually remove these two devices.
---
arch/x86/cpu/queensbay/tnc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
arch/x86/cpu/queensbay/tnc.c +36 -0
@@ -6,6 +6,7 @@#include <common.h> #include <dm.h> +#include <dm/device-internal.h> #include <pci.h> #include <asm/io.h> #include <asm/irq.h>
@@ -53,6 +54,41 @@ static int __maybe_unused disable_igd(void)dm_pci_write_config32 (igd,IGD_FD ,FUNC_DISABLE );dm_pci_write_config32 (sdvo,IGD_FD ,FUNC_DISABLE ); +/* +* After setting the function disable bit, IGD and SDVO devices will +* disappear in the PCI configuration space. This however creates an +* inconsistent state from a driver model PCI controller point of view, +* as these two PCI devices are still attached to its parent's child +* device list as maintained by the driver model. Some driver model PCI +* APIs like dm_pci_find_class(), are referring to the list to speed up +* the finding process instead of re-enumerating the whole PCI bus, so +* it gets the stale cached data which is wrong. +* +* Note x86 PCI enueration normally happens twice, in pre-relocation +* phase and post-relocation. One option might be to call disable_igd() +* in one of the pre-relocation initialization hooks so that it gets +* disabled in the first round, and when it comes to the second round +* driver model PCI will construct a correct list. Unfortunately this +* does not work as Intel FSP is used on this platform to perform low +* level initialization, and fsp_init_phase_pci() is called only once +* in the post-relocation phase. If we disable IGD and SDVO devices, +* fsp_init_phase_pci() simply hangs and never returns. +* +* So the only option we have is to manually remove these two devices. +*/ + ret =device_remove (igd); +if (ret) +return ret; + ret =device_unbind (igd); +if (ret) +return ret; + ret =device_remove (sdvo); +if (ret) +return ret; + ret =device_unbind (sdvo); +if (ret) +return ret; +return 0 ; }
Signature · 1 line
1.8.2.1
PATCH 20/23 x86: tnc: Remove IGD and SDVO devices from driver model
Hi Bin,
Quoted 11 lines · Bin Meng
With recent DM PCI changes to
vesa_fbdriver, external graphics card does not work any more. This is because: after setting the function disable bit, IGD and SDVO devices will disappear in the PCI configuration space. This however creates an inconsistent state from a driver model PCI controller point of view, as these two PCI devices are still attached to its parent's child device list as maintained by the driver model. Some driver model PCI APIs likedm_pci_find_class()used in thevesa_fbdriver, are referring to the list to speed up the finding process instead of re-enumerating the whole PCI bus, so it gets the stale cached data which is wrong.
Quoted 7 lines
To fix this, manually remove these two devices.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/queensbay/tnc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)
Tested on Minnowmax:
I hope that this can be sorted out when x86 moves to driver model for video. We should be able to probe the video quite late. I'm not quite sure how it might work though.
Regards,
Simon
PATCH 20/23 x86: tnc: Remove IGD and SDVO devices from driver model
Quoted 19 lines · Simon Glass
Hi Bin,
Quoted 16 lines · Bin Meng
With recent DM PCI changes to
vesa_fbdriver, external graphics card does not work any more. This is because: after setting the function disable bit, IGD and SDVO devices will disappear in the PCI configuration space. This however creates an inconsistent state from a driver model PCI controller point of view, as these two PCI devices are still attached to its parent's child device list as maintained by the driver model. Some driver model PCI APIs likedm_pci_find_class()used in thevesa_fbdriver, are referring to the list to speed up the finding process instead of re-enumerating the whole PCI bus, so it gets the stale cached data which is wrong.To fix this, manually remove these two devices.
Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 2 lines
arch/x86/cpu/queensbay/tnc.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 21/23 x86: qemu: Convert to use DM PCI API
In reply to Bin MengUse pci_[read|write]_config intead of x86_pci_[read|write]_config.
---
arch/x86/cpu/qemu/qemu.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
arch/x86/cpu/qemu/qemu.c +17 -17
@@ -5,8 +5,8 @@*/ #include <common.h> +#include <pci.h> #include <asm/irq.h> -#include <asm/pci.h> #include <asm/post.h> #include <asm/processor.h> #include <asm/arch/device.h>
@@ -21,23 +21,23 @@ static void enable_pm_piix(void)u16 cmd;/* Set the PM I/O base */ -x86_pci_write_config32 (PIIX_PM ,PMBA ,CONFIG_ACPI_PM1_BASE |1 ); +pci_write_config32 (PIIX_PM ,PMBA ,CONFIG_ACPI_PM1_BASE |1 );/* Enable access to the PM I/O space */ - cmd =x86_pci_read_config16 (PIIX_PM ,PCI_COMMAND ); +pci_read_config16 (PIIX_PM ,PCI_COMMAND , &cmd); cmd |=PCI_COMMAND_IO ; -x86_pci_write_config16 (PIIX_PM ,PCI_COMMAND , cmd); +pci_write_config16 (PIIX_PM ,PCI_COMMAND , cmd);/* PM I/O Space Enable (PMIOSE) */ - en =x86_pci_read_config8 (PIIX_PM ,PMREGMISC ); +pci_read_config8 (PIIX_PM ,PMREGMISC , &en); en |=PMIOSE ; -x86_pci_write_config8 (PIIX_PM ,PMREGMISC , en); +pci_write_config8 (PIIX_PM ,PMREGMISC , en); }static void enable_pm_ich9 (void ) {/* Set the PM I/O base */ -x86_pci_write_config32 (ICH9_PM ,PMBA ,CONFIG_ACPI_PM1_BASE |1 ); +pci_write_config32 (ICH9_PM ,PMBA ,CONFIG_ACPI_PM1_BASE |1 ); }static void qemu_chipset_init (void )
@@ -50,7 +50,7 @@ static void qemu_chipset_init(void)* the same bitfield layout. Here we determine the offset based on its * PCI device ID. */ - device =x86_pci_read_config16 (PCI_BDF (0 ,0 ,0 ),PCI_DEVICE_ID ); +pci_read_config16 (PCI_BDF (0 ,0 ,0 ),PCI_DEVICE_ID , &device); i440fx = (device ==PCI_DEVICE_ID_INTEL_82441 ); pam = i440fx ?I440FX_PAM :Q35_PAM ;
@@ -60,7 +60,7 @@ static void qemu_chipset_init(void)* Configure legacy segments C/D/E/F to system RAM */ for (i =0 ; i <PAM_NUM ; i++) -x86_pci_write_config8 (PCI_BDF (0 ,0 ,0 ), pam + i,PAM_RW ); +pci_write_config8 (PCI_BDF (0 ,0 ,0 ), pam + i,PAM_RW );if (i440fx) {/*
@@ -71,19 +71,19 @@ static void qemu_chipset_init(void)* registers to see whether legacy ports decode is turned on. * This is to make Linux ata_piix driver happy. */ -x86_pci_write_config16 (PIIX_IDE ,IDE0_TIM ,IDE_DECODE_EN ); -x86_pci_write_config16 (PIIX_IDE ,IDE1_TIM ,IDE_DECODE_EN ); +pci_write_config16 (PIIX_IDE ,IDE0_TIM ,IDE_DECODE_EN ); +pci_write_config16 (PIIX_IDE ,IDE1_TIM ,IDE_DECODE_EN );/* Enable I/O APIC */ - xbcs =x86_pci_read_config16 (PIIX_ISA ,XBCS ); +pci_read_config16 (PIIX_ISA ,XBCS , &xbcs); xbcs |=APIC_EN ; -x86_pci_write_config16 (PIIX_ISA ,XBCS , xbcs); +pci_write_config16 (PIIX_ISA ,XBCS , xbcs);enable_pm_piix (); }else {/* Configure PCIe ECAM base address */ -x86_pci_write_config32 (PCI_BDF (0 ,0 ,0 ),PCIEX_BAR , -CONFIG_PCIE_ECAM_BASE |BAR_EN ); +pci_write_config32 (PCI_BDF (0 ,0 ,0 ),PCIEX_BAR , +CONFIG_PCIE_ECAM_BASE |BAR_EN );enable_pm_ich9 (); }
@@ -136,8 +136,8 @@ int mp_determine_pci_dstirq(int bus, int dev, int func, int pirq)* connected to I/O APIC INTPIN#16-19. Instead they are routed * to an irq number controled by the PIRQ routing register. */ - irq =x86_pci_read_config8 (PCI_BDF (bus, dev, func), -PCI_INTERRUPT_LINE ); +pci_read_config8 (PCI_BDF (bus, dev, func), +PCI_INTERRUPT_LINE , &irq); }else {/* * ICH9's PIRQ[A-H] are not consecutive numbers from 0 to 7.
Signature · 1 line
1.8.2.1
PATCH 21/23 x86: qemu: Convert to use DM PCI API
Quoted 7 lines · Bin Meng
Use pci_[read|write]_config intead of x86_pci_[read|write]_config.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/qemu/qemu.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
Tested on Minnowmax:
PATCH 21/23 x86: qemu: Convert to use DM PCI API
Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng
Use pci_[read|write]_config intead of x86_pci_[read|write]_config.
Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/cpu/qemu/qemu.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 22/23 x86: pci: Use DM PCI APIs in pci_assign_irqs()
In reply to Bin MengDrop legacy PCI APIs usage in pci_assign_irqs() as well.
---
arch/x86/cpu/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/cpu/pci.c +3 -3
@@ -119,11 +119,11 @@ void pci_assign_irqs(int bus, int device, u8 irq[4])for (func =0 ; func <8 ; func++) { bdf =PCI_BDF (bus, device, func); - vendor =x86_pci_read_config16 (bdf,PCI_VENDOR_ID ); +pci_read_config16 (bdf,PCI_VENDOR_ID , &vendor);if (vendor ==0xffff || vendor ==0x0000 )continue ; - pin =x86_pci_read_config8 (bdf,PCI_INTERRUPT_PIN ); +pci_read_config8 (bdf,PCI_INTERRUPT_PIN , &pin);/* PCI spec says all values except 1..4 are reserved */ if ((pin <1 ) || (pin >4 ))
@@ -136,6 +136,6 @@ void pci_assign_irqs(int bus, int device, u8 irq[4])debug ("Assigning IRQ %d to PCI device %d.%x.%d (INT%c)\n" , line, bus, device, func,'A' + pin -1 ); -x86_pci_write_config8 (bdf,PCI_INTERRUPT_LINE , line); +pci_write_config8 (bdf,PCI_INTERRUPT_LINE , line); } }
Signature · 1 line
1.8.2.1
PATCH 22/23 x86: pci: Use DM PCI APIs in pci_assign_irqs()
Quoted 7 lines · Bin Meng
Drop legacy PCI APIs usage in
pci_assign_irqs()as well.Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Tested on Minnowmax:
PATCH 22/23 x86: pci: Use DM PCI APIs in pci_assign_irqs()
Quoted 6 lines · Simon Glass
Quoted 5 lines · Bin Meng
Drop legacy PCI APIs usage in
pci_assign_irqs()as well.Signed-off-by Bin Meng <[email protected]>---
Quoted 6 lines
Quoted 2 lines
arch/x86/cpu/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
PATCH 23/23 x86: pci: Drop legacy PCI APIs
In reply to Bin MengNow that we have converted all x86 codes to use DM PCI APIs, drop those legacy ones.
---
arch/x86/cpu/pci.c | 53 ---------------------------------------------- arch/x86/include/asm/pci.h | 12 ----------- 2 files changed, 65 deletions(-)
arch/x86/cpu/pci.c +0 -53
@@ -19,59 +19,6 @@DECLARE_GLOBAL_DATA_PTR ; -static struct pci_controller *get_hose (void ) -{ -if (gd->hose) -return gd->hose; - -return pci_bus_to_hose (0 ); -} - -unsigned int x86_pci_read_config8 (pci_dev_t dev,unsigned where) -{ -uint8_t value; - -if (pci_hose_read_config_byte (get_hose (), dev, where, &value)) -return -1U ; - -return value; -} - -unsigned int x86_pci_read_config16 (pci_dev_t dev,unsigned where) -{ -uint16_t value; - -if (pci_hose_read_config_word (get_hose (), dev, where, &value)) -return -1U ; - -return value; -} - -unsigned int x86_pci_read_config32 (pci_dev_t dev,unsigned where) -{ -uint32_t value; - -if (pci_hose_read_config_dword (get_hose (), dev, where, &value)) -return -1U ; - -return value; -} - -void x86_pci_write_config8 (pci_dev_t dev,unsigned where,unsigned value) -{ -pci_hose_write_config_byte (get_hose (), dev, where, value); -} - -void x86_pci_write_config16 (pci_dev_t dev,unsigned where,unsigned value) -{ -pci_hose_write_config_word (get_hose (), dev, where, value); -} - -void x86_pci_write_config32 (pci_dev_t dev,unsigned where,unsigned value) -{ -pci_hose_write_config_dword (get_hose (), dev, where, value); -} -int pci_x86_read_config (struct udevice *bus,pci_dev_t bdf,uint offset,ulong *valuep,enum pci_size_t size) {
arch/x86/include/asm/pci.h +0 -12
@@ -25,18 +25,6 @@ struct pci_controller;void pci_setup_type1 (struct pci_controller *hose); -/* -* Simple PCI access routines - these work from either the early PCI hose -* or the 'real' one, created after U-Boot has memory available -*/ -unsigned int x86_pci_read_config8 (pci_dev_t dev,unsigned where); -unsigned int x86_pci_read_config16 (pci_dev_t dev,unsigned where); -unsigned int x86_pci_read_config32 (pci_dev_t dev,unsigned where); - -void x86_pci_write_config8 (pci_dev_t dev,unsigned where,unsigned value); -void x86_pci_write_config16 (pci_dev_t dev,unsigned where,unsigned value); -void x86_pci_write_config32 (pci_dev_t dev,unsigned where,unsigned value); -int pci_x86_read_config (struct udevice *bus,pci_dev_t bdf,uint offset,ulong *valuep,enum pci_size_t size);
Signature · 1 line
1.8.2.1
PATCH 23/23 x86: pci: Drop legacy PCI APIs
Quoted 10 lines · Bin Meng
Now that we have converted all x86 codes to use DM PCI APIs, drop those legacy ones.
Signed-off-by Bin Meng <[email protected]>---
arch/x86/cpu/pci.c | 53 ---------------------------------------------- arch/x86/include/asm/pci.h | 12 ----------- 2 files changed, 65 deletions(-)
Tested on Minnowmax:
PATCH 23/23 x86: pci: Drop legacy PCI APIs
Quoted 8 lines · Simon Glass
Quoted 7 lines · Bin Meng
Now that we have converted all x86 codes to use DM PCI APIs, drop those legacy ones.
Signed-off-by Bin Meng <[email protected]>---
Quoted 7 lines
Quoted 3 lines
arch/x86/cpu/pci.c | 53 ---------------------------------------------- arch/x86/include/asm/pci.h | 12 ----------- 2 files changed, 65 deletions(-)Reviewed-by Simon Glass <[email protected]>Tested on Minnowmax:
Tested-by Simon Glass <[email protected]>
applied to u-boot-x86/master, thanks!
cover x86: Convert to use DM PCI APIs completely
In reply to Bin MengHi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- void pci_assign_irqs(int bus, int device, u8 irq[4]) should use a struct udevice
- pci_x86_read/write_config() move into drivers/pci/pci_x86.c (needs ivybridge fix which I'll look at)
- disable DM_PCI_COMPAT for x86
- use the PCI mmio access method instead of I/O once it becomes possible
- moving vesa video to driver model (UCLASS_VIDEO)
Regards,
Simon
cover x86: Convert to use DM PCI APIs completely
Hi Simon,
Quoted 13 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Quoted 7 lines
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udevice
I guess no, unless we expand struct udevice to include interrupt routing information? But that's not generic across architectures. I am not sure how.
Quoted 2 lines
- pci_x86_read/write_config() move into
drivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)
Yep. I wanted to do this when reviewing one of previous patches.
Quoted 1 line
- disable
DM_PCI_COMPATfor x86
Looks e1000 and pch_gbe (Crown Bay) ethernet drivers are still using legacy PCI APIs. e1000 might need quite amount of work as it is being widely used on lots of boards. I can update pch_gbe driver later.
Quoted 1 line
- use the PCI mmio access method instead of I/O once it becomes possible
Yep.
Quoted 1 line
- moving vesa video to driver model (
UCLASS_VIDEO)
I was not following the dm video changes recently, but I guess yes.
Regards,
Bin
cover x86: Convert to use DM PCI APIs completely
Hi Bin,
Quoted 20 lines · Bin Meng
Hi Simon,
Quoted 17 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Quoted 7 lines
Quoted 3 lines
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udeviceI guess no, unless we expand struct udevice to include interrupt routing information? But that's not generic across architectures. I am not sure how.
I suppose we can adjust it to take a struct udevice and drop the bus and device parameters. But then we need to be able to support reading from different functions, so will need to use pci_bus_read_config(). But at least that is a DM function. Hmmm....
Quoted 5 lines
Quoted 3 lines
- pci_x86_read/write_config() move into
drivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)Yep. I wanted to do this when reviewing one of previous patches.
OK let's see what I find.
Quoted 6 lines
Quoted 2 lines
- disable
DM_PCI_COMPATfor x86Looks e1000 and
pch_gbe(Crown Bay) ethernet drivers are still using legacy PCI APIs. e1000 might need quite amount of work as it is being widely used on lots of boards. I can updatepch_gbedriver later.
I converted rtl8169 using #ifdef and it seemed to work OK. We don't need to remove the old code.
Quoted 8 lines
Quoted 2 lines
- use the PCI mmio access method instead of I/O once it becomes possible
Yep.
Quoted 1 line
- moving vesa video to driver model (
UCLASS_VIDEO)I was not following the dm video changes recently, but I guess yes.
It only merged recently. I haven't tried looking at that.
On another note, I just got an Edison. What do you think about supporting that in U-Boot?
Regards,
Simon
cover x86: Convert to use DM PCI APIs completely
Hi Simon,
Quoted 27 lines · Simon Glass
Hi Bin,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udevice
Quoted 9 lines
Quoted 3 lines
I guess no, unless we expand struct udevice to include interrupt routing information? But that's not generic across architectures. I am not sure how.
I suppose we can adjust it to take a struct udevice and drop the bus and device parameters. But then we need to be able to support reading from different functions, so will need to use
pci_bus_read_config(). But at least that is a DM function. Hmmm....
Currently bus and device parameters come from the device tree <intel,pirq-routing> property. If we just pass struct udevice, that means we have to saving the routing information <INTx mapping to PIRQx) somewhere in the udevice. I doubt that will be generic.
Quoted 23 lines
Quoted 5 lines
Quoted 3 lines
- pci_x86_read/write_config() move into
drivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)Yep. I wanted to do this when reviewing one of previous patches.
OK let's see what I find.
Quoted 6 lines
Quoted 2 lines
- disable
DM_PCI_COMPATfor x86Looks e1000 and
pch_gbe(Crown Bay) ethernet drivers are still using legacy PCI APIs. e1000 might need quite amount of work as it is being widely used on lots of boards. I can updatepch_gbedriver later.I converted rtl8169 using #ifdef and it seemed to work OK. We don't need to remove the old code.
Quoted 5 lines
Quoted 2 lines
- use the PCI mmio access method instead of I/O once it becomes possible
Yep.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
- moving vesa video to driver model (
UCLASS_VIDEO)I was not following the dm video changes recently, but I guess yes.
It only merged recently. I haven't tried looking at that.
On another note, I just got an Edison. What do you think about supporting that in U-Boot?
I think that's Intel Edison [1] you are talking about? It's based on one Atom (don't know which exact model it is) plus one Quark processor. Did Intel release any open source SDK for this board?
[1] http://www.intel.com/buy/us/en/product/emergingtechnologies/intel-edison-compute-module-iot-463633
Regards,
Bin
cover x86: Convert to use DM PCI APIs completely
Hi Bin,
Quoted 40 lines · Bin Meng
Hi Simon,
Quoted 27 lines · Simon Glass
Hi Bin,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udeviceQuoted 9 lines
Quoted 3 lines
I guess no, unless we expand struct udevice to include interrupt routing information? But that's not generic across architectures. I am not sure how.
I suppose we can adjust it to take a struct udevice and drop the bus and device parameters. But then we need to be able to support reading from different functions, so will need to use
pci_bus_read_config(). But at least that is a DM function. Hmmm....
Quoted 4 lines
Currently bus and device parameters come from the device tree <intel,pirq-routing> property. If we just pass struct udevice, that means we have to saving the routing information <INTx mapping to PIRQx) somewhere in the udevice. I doubt that will be generic.
OK let's worry about it later.
This series:
Tested on link
Quoted 34 lines
Quoted 24 lines
Quoted 6 lines
Quoted 4 lines
- pci_x86_read/write_config() move into
drivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)Yep. I wanted to do this when reviewing one of previous patches.
OK let's see what I find.
Quoted 6 lines
Quoted 2 lines
- disable
DM_PCI_COMPATfor x86Looks e1000 and
pch_gbe(Crown Bay) ethernet drivers are still using legacy PCI APIs. e1000 might need quite amount of work as it is being widely used on lots of boards. I can updatepch_gbedriver later.I converted rtl8169 using #ifdef and it seemed to work OK. We don't need to remove the old code.
Quoted 5 lines
Quoted 2 lines
- use the PCI mmio access method instead of I/O once it becomes possible
Yep.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
- moving vesa video to driver model (
UCLASS_VIDEO)I was not following the dm video changes recently, but I guess yes.
It only merged recently. I haven't tried looking at that.
On another note, I just got an Edison. What do you think about supporting that in U-Boot?
Quoted 5 lines
I think that's Intel Edison [1] you are talking about? It's based on one Atom (don't know which exact model it is) plus one Quark processor. Did Intel release any open source SDK for this board?
[1] http://www.intel.com/buy/us/en/product/emergingtechnologies/intel-edison-compute-module-iot-463633
It seems that it uses U-Boot:
git at github.com:01org/edison-u-boot.git
I'll see if I can find someone at Intel to ask if they plan to upstream it.
Regards,
Simon
cover x86: Convert to use DM PCI APIs completely
Hi Simon,
Quoted 93 lines · Simon Glass
Hi Bin,
Quoted 40 lines · Bin Meng
Hi Simon,
Quoted 27 lines · Simon Glass
Hi Bin,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udeviceQuoted 9 lines
Quoted 3 lines
I guess no, unless we expand struct udevice to include interrupt routing information? But that's not generic across architectures. I am not sure how.
I suppose we can adjust it to take a struct udevice and drop the bus and device parameters. But then we need to be able to support reading from different functions, so will need to use
pci_bus_read_config(). But at least that is a DM function. Hmmm....Quoted 4 lines
Currently bus and device parameters come from the device tree <intel,pirq-routing> property. If we just pass struct udevice, that means we have to saving the routing information <INTx mapping to PIRQx) somewhere in the udevice. I doubt that will be generic.
OK let's worry about it later.
This series:
Tested on link
Tested-by Simon Glass <[email protected]>Quoted 38 lines
Quoted 24 lines
Quoted 6 lines
Quoted 4 lines
- pci_x86_read/write_config() move into
drivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)Yep. I wanted to do this when reviewing one of previous patches.
OK let's see what I find.
Quoted 6 lines
Quoted 2 lines
- disable
DM_PCI_COMPATfor x86Looks e1000 and
pch_gbe(Crown Bay) ethernet drivers are still using legacy PCI APIs. e1000 might need quite amount of work as it is being widely used on lots of boards. I can updatepch_gbedriver later.I converted rtl8169 using #ifdef and it seemed to work OK. We don't need to remove the old code.
Quoted 5 lines
Quoted 2 lines
- use the PCI mmio access method instead of I/O once it becomes possible
Yep.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
- moving vesa video to driver model (
UCLASS_VIDEO)I was not following the dm video changes recently, but I guess yes.
It only merged recently. I haven't tried looking at that.
On another note, I just got an Edison. What do you think about supporting that in U-Boot?
I think that's Intel Edison [1] you are talking about? It's based on one Atom (don't know which exact model it is) plus one Quark processor. Did Intel release any open source SDK for this board?
Quoted 6 lines
Quoted 1 line
[1] http://www.intel.com/buy/us/en/product/emergingtechnologies/intel-edison-compute-module-iot-463633
It seems that it uses U-Boot:
git at github.com:01org/edison-u-boot.git
This is great! Looks
https://github.com/01org/edison-u-boot/commits/edison-v2015.10 is the branch and commits for edison.
Quoted 2 lines
I'll see if I can find someone at Intel to ask if they plan to upstream it.
That would be nice if Intel is willing to contribute something to the U-Boot x86 support!
Regards,
Bin
cover x86: Convert to use DM PCI APIs completely
Hi Bin,
Quoted 98 lines · Bin Meng
Hi Simon,
Quoted 95 lines · Simon Glass
Hi Bin,
Quoted 40 lines · Bin Meng
Hi Simon,
Quoted 27 lines · Simon Glass
Hi Bin,
Quoted 24 lines · Bin Meng
Hi Simon,
Quoted 20 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udeviceQuoted 9 lines
Quoted 3 lines
I guess no, unless we expand struct udevice to include interrupt routing information? But that's not generic across architectures. I am not sure how.
I suppose we can adjust it to take a struct udevice and drop the bus and device parameters. But then we need to be able to support reading from different functions, so will need to use
pci_bus_read_config(). But at least that is a DM function. Hmmm....Quoted 4 lines
Currently bus and device parameters come from the device tree <intel,pirq-routing> property. If we just pass struct udevice, that means we have to saving the routing information <INTx mapping to PIRQx) somewhere in the udevice. I doubt that will be generic.
OK let's worry about it later.
This series:
Tested on link
Tested-by Simon Glass <[email protected]>Quoted 39 lines
Quoted 24 lines
Quoted 6 lines
Quoted 4 lines
- pci_x86_read/write_config() move into
drivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)Yep. I wanted to do this when reviewing one of previous patches.
OK let's see what I find.
Quoted 6 lines
Quoted 2 lines
- disable
DM_PCI_COMPATfor x86Looks e1000 and
pch_gbe(Crown Bay) ethernet drivers are still using legacy PCI APIs. e1000 might need quite amount of work as it is being widely used on lots of boards. I can updatepch_gbedriver later.I converted rtl8169 using #ifdef and it seemed to work OK. We don't need to remove the old code.
Quoted 5 lines
Quoted 2 lines
- use the PCI mmio access method instead of I/O once it becomes possible
Yep.
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
- moving vesa video to driver model (
UCLASS_VIDEO)I was not following the dm video changes recently, but I guess yes.
It only merged recently. I haven't tried looking at that.
On another note, I just got an Edison. What do you think about supporting that in U-Boot?
I think that's Intel Edison [1] you are talking about? It's based on one Atom (don't know which exact model it is) plus one Quark processor. Did Intel release any open source SDK for this board?
[1] http://www.intel.com/buy/us/en/product/emergingtechnologies/intel-edison-compute-module-iot-463633
Quoted 8 lines
Quoted 4 lines
It seems that it uses U-Boot:
git at github.com:01org/edison-u-boot.git
This is great! Looks
https://github.com/01org/edison-u-boot/commits/edison-v2015.10 is the branch and commits for edison.
Yes - I just built this and it boots OK on edison. I've sent an email to two of the authors to see if they are interested in mainlining it.
Quoted 6 lines
Quoted 3 lines
I'll see if I can find someone at Intel to ask if they plan to upstream it.
That would be nice if Intel is willing to contribute something to the U-Boot x86 support!
Yes.
Regards,
Simon
cover x86: Convert to use DM PCI APIs completely
In reply to Simon GlassHI Bin,
Quoted 15 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
Quoted 7 lines
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udevice
- pci_x86_read/write_config() move intodrivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)
This is baord_debug_uart_init(), but I can't find a way to get rid of this. Let me know if you have ideas. It is called very early, before there is a PCI controller device.
Quoted 6 lines
- disable
DM_PCI_COMPATfor x86
- use the PCI mmio access method instead of I/O once it becomes possible
- moving vesa video to driver model (UCLASS_VIDEO)Regards,
Simon
Regards,
Simon
cover x86: Convert to use DM PCI APIs completely
Hi Simon,
Quoted 26 lines · Simon Glass
HI Bin,
Quoted 15 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
Quoted 7 lines
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udevice
- pci_x86_read/write_config() move intodrivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)
Quoted 3 lines
This is
baord_debug_uart_init(), but I can't find a way to get rid of this. Let me know if you have ideas. It is called very early, before there is a PCI controller device.
I see. Maybe we can move this baord_debug_uart_init() to early_board_init in board/google/common/early_init.S? I see the existing codes in early_init.S program something to a PCI configuration register too.
Quoted 3 lines
Quoted 3 lines
- disable
DM_PCI_COMPATfor x86
- use the PCI mmio access method instead of I/O once it becomes possible
- moving vesa video to driver model (UCLASS_VIDEO)
Regards,
Bin
cover x86: Convert to use DM PCI APIs completely
Hi Bin,
Quoted 29 lines · Bin Meng
Hi Simon,
Quoted 26 lines · Simon Glass
HI Bin,
Quoted 22 lines · Simon Glass
Hi Bin,
Quoted 9 lines · Bin Meng
There are still some codes that use the legacy PCI APIs to access the configuration space registers. This series converts those codes to completely use DM PCI APIs.
This includes adding several new ops to the PCH uclass driver, and some clean up to the SPI/GPIO/IRQ drivers.
Tested on QEMU and Crown Bay. This series is available in pci-working branch of u-boot-x86 repo.
Looks great! This is a big step forward.
I've tested it on minnowmax and will test on link in the next day or so.
Here are a few things that I think can still be cleaned up:
- voidpci_assign_irqs(int bus, int device, u8 irq[4])should use a struct udevice
- pci_x86_read/write_config() move intodrivers/pci/pci_x86.c(needs ivybridge fix which I'll look at)
Quoted 8 lines
Quoted 3 lines
This is
baord_debug_uart_init(), but I can't find a way to get rid of this. Let me know if you have ideas. It is called very early, before there is a PCI controller device.I see. Maybe we can move this
baord_debug_uart_init()toearly_board_initinboard/google/common/early_init.S? I see the existing codes inearly_init.Sprogram something to a PCI configuration register too.
Thinking about it, I don't think it helps to duplicate the PCI access code in link. Probably the way it is is better for now.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
- disable
DM_PCI_COMPATfor x86
- use the PCI mmio access method instead of I/O once it becomes possible
- moving vesa video to driver model (UCLASS_VIDEO)Regards,
Bin
Regards,
Simon