mirror of
https://github.com/openwrt/openwrt.git
synced 2026-10-14 06:38:29 +04:00
bmips: add of_pci_parse_bus_range() version guard
Kernel 6.14 no longer exports of_pci_parse_bus_range(). Re-add a local version to the bmips pci(e) drivers. Signed-off-by: Andrew LaMarche <andrewjlamarche@gmail.com> Link: https://github.com/openwrt/openwrt/pull/25293 Signed-off-by: Jonas Jelonek <jonas@jonasjelonek.de>
This commit is contained in:
1 parent
a1d76643c8
commit
d5472fb9ab
3 files changed
+76
No files matched your search
@@ -22,6 +22,7 @@
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/reset.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/version.h>
|
||||
#include <linux/vmalloc.h>
|
||||
|
||||
#include "../pci.h"
|
||||
@@ -720,6 +721,27 @@ static void bcm6348_pci_setup(struct bcm6348_pci *priv)
|
||||
__raw_writel(val, priv->pci + MPI_LOCINT_REG);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,14,0)
|
||||
/* Kernel 6.14 no longer has this exported in drivers/pci/of.c. Hack it back in. */
|
||||
static int bcm6348_of_pci_parse_bus_range(struct device_node *node, struct resource *res)
|
||||
{
|
||||
u32 bus_range[2];
|
||||
int error;
|
||||
|
||||
error = of_property_read_u32_array(node, "bus-range", bus_range,
|
||||
ARRAY_SIZE(bus_range));
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
res->name = node->name;
|
||||
res->start = bus_range[0];
|
||||
res->end = bus_range[1];
|
||||
res->flags = IORESOURCE_BUS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int bcm6348_pci_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -755,7 +777,11 @@ static int bcm6348_pci_probe(struct platform_device *pdev)
|
||||
if (!bcm6348_pci_mem_resource.start)
|
||||
return -EINVAL;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,14,0)
|
||||
of_pci_parse_bus_range(np, &bcm6348_pci_busn_resource);
|
||||
#else
|
||||
bcm6348_of_pci_parse_bus_range(np, &bcm6348_pci_busn_resource);
|
||||
#endif
|
||||
pci_add_resource(&resources, &bcm6348_pci_busn_resource);
|
||||
|
||||
#ifdef CONFIG_CARDBUS
|
||||
|
||||
@@ -299,6 +299,27 @@ static void bcm6318_pcie_setup(struct bcm6318_pcie *priv)
|
||||
priv->base + PCIE_EXT_CFG_INDEX_REG);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,14,0)
|
||||
/* Kernel 6.14 no longer has this exported in drivers/pci/of.c. Hack it back in. */
|
||||
static int bcm6318_of_pci_parse_bus_range(struct device_node *node, struct resource *res)
|
||||
{
|
||||
u32 bus_range[2];
|
||||
int error;
|
||||
|
||||
error = of_property_read_u32_array(node, "bus-range", bus_range,
|
||||
ARRAY_SIZE(bus_range));
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
res->name = node->name;
|
||||
res->start = bus_range[0];
|
||||
res->end = bus_range[1];
|
||||
res->flags = IORESOURCE_BUS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int bcm6318_pcie_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -371,7 +392,11 @@ static int bcm6318_pcie_probe(struct platform_device *pdev)
|
||||
if (!bcm6318_pcie_mem_resource.start)
|
||||
return -EINVAL;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,14,0)
|
||||
of_pci_parse_bus_range(np, &bcm6318_pcie_busn_resource);
|
||||
#else
|
||||
bcm6318_of_pci_parse_bus_range(np, &bcm6318_pcie_busn_resource);
|
||||
#endif
|
||||
pci_add_resource(&resources, &bcm6318_pcie_busn_resource);
|
||||
|
||||
bcm6318_pcie_reset(priv);
|
||||
|
||||
@@ -287,6 +287,27 @@ static void bcm6328_pcie_setup(struct bcm6328_pcie *priv)
|
||||
__raw_writel(val, priv->base + PCIE_BRIDGE_BAR0_REBASE_ADDR_REG);
|
||||
}
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(6,14,0)
|
||||
/* Kernel 6.14 no longer has this exported in drivers/pci/of.c. Hack it back in. */
|
||||
static int bcm6328_of_pci_parse_bus_range(struct device_node *node, struct resource *res)
|
||||
{
|
||||
u32 bus_range[2];
|
||||
int error;
|
||||
|
||||
error = of_property_read_u32_array(node, "bus-range", bus_range,
|
||||
ARRAY_SIZE(bus_range));
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
res->name = node->name;
|
||||
res->start = bus_range[0];
|
||||
res->end = bus_range[1];
|
||||
res->flags = IORESOURCE_BUS;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int bcm6328_pcie_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
@@ -381,7 +402,11 @@ static int bcm6328_pcie_probe(struct platform_device *pdev)
|
||||
if (!bcm6328_pcie_mem_resource.start)
|
||||
return -EINVAL;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(6,14,0)
|
||||
of_pci_parse_bus_range(np, &bcm6328_pcie_busn_resource);
|
||||
#else
|
||||
bcm6328_of_pci_parse_bus_range(np, &bcm6328_pcie_busn_resource);
|
||||
#endif
|
||||
pci_add_resource(&resources, &bcm6328_pcie_busn_resource);
|
||||
|
||||
bcm6328_pcie_reset(priv);
|
||||
|
||||
Reference in new issue
Block a user