From patchwork Mon Mar 30 23:12:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 244578 List-Id: U-Boot discussion From: sjg at chromium.org (Simon Glass) Date: Mon, 30 Mar 2020 17:12:43 -0600 Subject: [PATCH v3 07/29] dm: pci: Allow disabling auto-config for a device In-Reply-To: <20200330231305.130488-1-sjg@chromium.org> References: <20200330231305.130488-1-sjg@chromium.org> Message-ID: <20200330171226.v3.7.I66a7bcb7db931e196e8319d2dbca4e418274f39b@changeid> Add a means to avoid configuring a device when needed. Add an explanation of why this is useful to the binding file. Signed-off-by: Simon Glass Reviewed-by: Bin Meng --- Changes in v3: - Drop acpi,name in example Changes in v2: None doc/device-tree-bindings/pci/x86-pci.txt | 23 +++++++++++++++++++++++ drivers/pci/pci-uclass.c | 2 ++ 2 files changed, 25 insertions(+) diff --git a/doc/device-tree-bindings/pci/x86-pci.txt b/doc/device-tree-bindings/pci/x86-pci.txt index 3aa5bd9a46c..95e370b3e72 100644 --- a/doc/device-tree-bindings/pci/x86-pci.txt +++ b/doc/device-tree-bindings/pci/x86-pci.txt @@ -10,6 +10,17 @@ Optional properties: configuration in TPL/SPL to reduce code size and boot time, since these phases only know about a small subset of PCI devices. +For PCI devices the following optional property is available: + +- pci,no-autoconfig : Don't automatically configure this PCI device at all. + This is used when the device is statically configured and must maintain + this same config throughout the boot process. An example is a serial + UART being used to debug PCI configuration, since reconfiguring it stops + the UART from working until the driver is re-probed, and this can cause + output to be lost. This should not generally be used in production code, + although it is often harmless. + + Example: pci { @@ -21,4 +32,16 @@ pci { 0x42000000 0x0 0xb0000000 0xb0000000 0 0x10000000 0x01000000 0x0 0x1000 0x1000 0 0xefff>; u-boot,skip-auto-config-until-reloc; + + + serial: serial at 18,2 { + reg = <0x0200c210 0 0 0 0>; + u-boot,dm-pre-reloc; + compatible = "intel,apl-ns16550"; + early-regs = <0xde000000 0x20>; + reg-shift = <2>; + clock-frequency = <1843200>; + current-speed = <115200>; + pci,no-autoconfig; + }; }; diff --git a/drivers/pci/pci-uclass.c b/drivers/pci/pci-uclass.c index e2882e3b634..ceb64517047 100644 --- a/drivers/pci/pci-uclass.c +++ b/drivers/pci/pci-uclass.c @@ -536,6 +536,8 @@ int pci_auto_config_devices(struct udevice *bus) int ret; debug("%s: device %s\n", __func__, dev->name); + if (dev_read_bool(dev, "pci,no-autoconfig")) + continue; ret = dm_pciauto_config_device(dev); if (ret < 0) return ret;