summaryrefslogtreecommitdiffstats
path: root/drivers/pci
Commit message (Collapse)AuthorAgeFilesLines
* PCI: remove bogus host bridge setup skippingLucas Stach2015-06-251-5/+0
| | | | | | | | | | Apparently this was here to fix issues with some QEMU version, but hasn't worked in the intended way for a long time. The probe code should be mature enough by now, so this workaround isn't needed anymore. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PCI: rework BAR size calculationLucas Stach2015-06-251-5/+34
| | | | | | | | | The probe code now does a much better job at detecting bad BARs. Also make sure to preserve any previous content of the BAR registers if we don't relocate them. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/of-device-id'Sascha Hauer2015-05-062-6/+6
|\
| * of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-302-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/misc'Sascha Hauer2015-05-062-13/+6
|\ \
| * | PCI: imx6: simplify config access codeLucas Stach2015-05-011-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | The PCI core fills in the primary bus number, so there is no need to walk up the PCI hierarchy in the driver manually. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | pci: Do not abuse dev->priv for storing dataSascha Hauer2015-04-171-4/+4
| |/ | | | | | | | | | | | | | | | | dev->priv is for private use of the device driver, so do not use it in the pci core. Instead, introduce a id field in struct pci_device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
* | PCI: fill in bus primary fieldLucas Stach2015-05-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | This was erroneously left uninitialzed as nothing was using it. The i.MX6 PCI driver needs this to be filled properly to decide if a config space access is allowed for a specific devfn. This fixes PCI enumeration on the Gateworks GW54xx board. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | PCI: register and active bridge device before proceeding to scanLucas Stach2015-05-011-2/+6
|/ | | | | | | | | | | | The bridge device needs to be registered and activated before the scanning can proceed, as the bridge is the parent for other devices. This fixes a NULL ptr derefernce when scanning PCI hierarchies with bridges behind bridges. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/pci'Sascha Hauer2015-04-136-20/+1275
|\
| * pci: Add i.MX6 pcie supportSascha Hauer2015-03-173-0/+620
| | | | | | | | | | | | | | Based on the corresponding kernel driver with changes to make it work on barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * pci: Add pcie-designware driverSascha Hauer2015-03-174-0/+639
| | | | | | | | | | | | | | Based on the corresponding kernel driver, only small changes to make it work on barebox. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * pci: fix copy-paste bugSascha Hauer2015-03-171-1/+1
| | | | | | | | | | | | Test for the correct resource before derefencing it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * pci: Use standard pr_debugSascha Hauer2015-03-171-19/+15
| | | | | | | | | | | | Use pr_debug instead of custom DBG macro. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/driver'Sascha Hauer2015-04-131-1/+2
|\ \
| * | driver: Call remove function only when availableSascha Hauer2015-03-171-1/+2
| |/ | | | | | | | | | | | | | | The bus implementations currently call the drivers remove hook unconditionally, but this hook is seldomly populated. Only call it when it's actually populated. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / pci: make sure to activate devices on the root busLucas Stach2015-04-131-0/+7
|/ | | | | | | | | | | | Commit b8a1bb1dd215 (pci: defer device registration until after bridge setup) changed the activation order of devices, so that bridges above the devices could be configured properly before activating the devices below. This commit failed to acknowledge that there may be devices located directly on the root bus without any bridge in between and so those devices would never get enabled. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
* PCI: fix bad bugs in bridge setup codeLucas Stach2015-03-161-2/+4
| | | | | | | | Add the required brackets, so that we don't write unused registers with potentially bogus values. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* sizes.h: move include/sizes.h to include/linux/sizes.hMasahiro Yamada2015-01-083-3/+3
| | | | | | | | | | | | | | This file originates in Linux. Linux has it under include/linux/ directory since commit dccd2304cc90. Let's move it to the same place as well in barebox. This commit was generated by the following commands: find -name '*.[chS]' | xargs sed -i -e 's:<sizes.h>:<linux/sizes.h>:' git mv include/sizes.h include/linux/ Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: tegra: relax link-up timeoutLucas Stach2014-11-171-1/+1
| | | | | | | | | | Some devices need a considerable amount of time from reset deassertion until they are ready to establish a link. Relaxing the link-up timeout helps to detect them more reliable. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: align bridge windowsLucas Stach2014-11-171-0/+4
| | | | | | | | | | | The bridge filtering logic needs a minimum alignment of 1MB for mem and 4KB for io resources. Take this into account while assigning resources to devices in oredr to not produce overlapping windows between different bridges. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: correct BAR size calculationLucas Stach2014-11-171-3/+3
| | | | | | | | The previous math would return negative sizes for some BARs. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: mvebu: Fix uninitialized variable in mvebu_get_target_attr()Thomas Petazzoni2014-11-101-3/+3
| | | | | | | | | | This is the same fix that was applied to the Linux kernel in commit 56fab6e18944 (PCI: mvebu: Fix uninitialized variable in mvebu_get_tgt_attr()). Fixes: 5a9ba98 ("pci: mvebu: Add PCIe driver") Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: tegra: add tegra124 supportLucas Stach2014-11-041-22/+134
| | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: add Tegra host controller driverLucas Stach2014-10-083-0/+1201
| | | | | | | Only tested on Tegra30 for now. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: track parent<->child relationshipLucas Stach2014-10-081-0/+4
| | | | | | | | | So that PCI devices hang down from bridges and root bridges down from the PCI host controller when calling devinfo. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: prettyprint device namesLucas Stach2014-10-081-1/+2
| | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: defer device registration until after bridge setupLucas Stach2014-10-081-1/+5
| | | | | | | | | Otherwise the drivers for a device may probe before the devices parent bridge is fully configured, which leads to errors when accessing the BARs. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: setup bridges and traverse buses behind themLucas Stach2014-10-081-3/+89
| | | | | Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: properly populate prefetchable BARsLucas Stach2014-10-081-14/+45
| | | | | | | | | Some host controllers provide a prefetchable memory area and devices will prefer this for some of their BARs. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: add resource enumLucas Stach2014-10-081-6/+8
| | | | | | | Makes things way clearer than juggling numbers. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: split out device initLucas Stach2014-10-081-63/+74
| | | | | | | To make it reusable and the code more readable. Signed-off-by: Lucas Stach <dev@lynxeye.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: mvebu: Add PCIe driverSebastian Hesselbarth2014-07-315-0/+699
| | | | | | | | | | This adds a PCI driver for the controllers found on Marvell MVEBU SoCs. Besides the functional driver itself, it also adds SoC specific PHY setup required for PCIe. Currently, only Armada 370 is fully supported. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: set auto-incremented bus numberSebastian Hesselbarth2014-07-311-0/+5
| | | | | | | | | | | | | | | When using more than one PCI bus, we have to assign unique numbers to each bus. Use an auto-incremented bus index and assign it to each registered bus. Also, allow the PCI host controller to update internal registers by calling set_busno with assigned bus number. While at it, add pci_controller struct to set_busno callback, add a back reference to pci_controller to pci_bus, and clean up unused left-overs from Linux import. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: ensure device does ignore BAR manglingSebastian Hesselbarth2014-07-311-0/+5
| | | | | | | | | Disable access to PCI devices I/O and memory regions while mangling BAR registers. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: register device after BAR setupSebastian Hesselbarth2014-07-311-3/+3
| | | | | | | | | | As soon as pci_register_device is called, a potential driver will access its registers. This requires BARs to be set up properly, so move pci_register_device after BAR setup. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: pci_scan_bus: respect 64b BARsSebastian Hesselbarth2014-07-311-1/+11
| | | | | | | | | | | In PCI 64-bit BARs span two 32-bit BARs, therefore if BAR type indicates a 64-bit BAR we have to skip the next BAR register. While at it, also set proper IORESOURCE flags for I/O and 32b MEM. Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* pci: pci_alloc_bus(): use xzalloc() instead of kzalloc()Antony Pavlov2014-07-091-8/+8
| | | | | | | | Also drop redundant xzalloc() result check as xzalloc() does not return in case of memory allocation error. Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* PCI: initial commitAntony Pavlov2014-07-045-0/+468
used shorten version of linux-2.6.39 pci_ids.h Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>