Skip to content

Commit d1ac000

Browse files
Marc Zyngierrobherring
authored andcommitted
of: address: Work around missing device_type property in pcie nodes
Recent changes to the DT PCI bus parsing made it mandatory for device tree nodes describing a PCI controller to have the 'device_type = "pci"' property for the node to be matched. Although this follows the letter of the specification, it breaks existing device-trees that have been working fine for years. Rockchip rk3399-based systems are a prime example of such collateral damage, and have stopped discovering their PCI bus. In order to paper over it, let's add a workaround to the code matching the device type, and accept as PCI any node that is named "pcie", A warning will hopefully nudge the user into updating their DT to a fixed version if they can, but the incentive is obviously pretty small. Fixes: 2f96593 ("of_address: Add bus type match for pci ranges parser") Suggested-by: Rob Herring <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]>
1 parent 4364792 commit d1ac000

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

drivers/of/address.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,15 +128,29 @@ static unsigned int of_bus_pci_get_flags(const __be32 *addr)
128128
* PCI bus specific translator
129129
*/
130130

131+
static bool of_node_is_pcie(struct device_node *np)
132+
{
133+
bool is_pcie = of_node_name_eq(np, "pcie");
134+
135+
if (is_pcie)
136+
pr_warn_once("%pOF: Missing device_type\n", np);
137+
138+
return is_pcie;
139+
}
140+
131141
static int of_bus_pci_match(struct device_node *np)
132142
{
133143
/*
134144
* "pciex" is PCI Express
135145
* "vci" is for the /chaos bridge on 1st-gen PCI powermacs
136146
* "ht" is hypertransport
147+
*
148+
* If none of the device_type match, and that the node name is
149+
* "pcie", accept the device as PCI (with a warning).
137150
*/
138151
return of_node_is_type(np, "pci") || of_node_is_type(np, "pciex") ||
139-
of_node_is_type(np, "vci") || of_node_is_type(np, "ht");
152+
of_node_is_type(np, "vci") || of_node_is_type(np, "ht") ||
153+
of_node_is_pcie(np);
140154
}
141155

142156
static void of_bus_pci_count_cells(struct device_node *np,

0 commit comments

Comments
 (0)