Skip to content

Commit 25a3157

Browse files
gclementglikely
authored andcommitted
of: Allows to use the PCI translator without the PCI core
Translating an address from a PCI node of the device-tree into a CPU physical address doesn't require the core PCI support. Those translations are just related to the device tree itself. The use case to translate an address from a PCI node without actually using the PCI core support is when one needs to access the PCI controller without accessing any PCI devices. Marvell SoCs, such as Kirkwood, Dove or Armada XP for instance, come with an IP of a PCI controller. In the registers of this controller are stored the ID and the revision of a SoC. With this patch it will be possible to read the SoC ID of a board without any PCI device and then without the PCI core support. Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com> Tested-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com> Signed-off-by: Grant Likely <grant.likely@linaro.org>
1 parent b66548e commit 25a3157

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

‎drivers/of/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ config OF_DYNAMIC
4444
config OF_ADDRESS
4545
def_bool y
4646
depends on !SPARC
47+
select OF_ADDRESS_PCI if PCI
48+
49+
config OF_ADDRESS_PCI
50+
bool
4751

4852
config OF_IRQ
4953
def_bool y

‎drivers/of/address.c‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr)
9191
return IORESOURCE_MEM;
9292
}
9393

94-
#ifdef CONFIG_PCI
94+
#ifdef CONFIG_OF_ADDRESS_PCI
9595
/*
9696
* PCI bus specific translator
9797
*/
@@ -165,7 +165,9 @@ static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
165165
{
166166
return of_bus_default_translate(addr + 1, offset, na - 1);
167167
}
168+
#endif /* CONFIG_OF_ADDRESS_PCI */
168169

170+
#ifdef CONFIG_PCI
169171
const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
170172
unsigned int *flags)
171173
{
@@ -355,7 +357,7 @@ static unsigned int of_bus_isa_get_flags(const __be32 *addr)
355357
*/
356358

357359
static struct of_bus of_busses[] = {
358-
#ifdef CONFIG_PCI
360+
#ifdef CONFIG_OF_ADDRESS_PCI
359361
/* PCI */
360362
{
361363
.name = "pci",
@@ -366,7 +368,7 @@ static struct of_bus of_busses[] = {
366368
.translate = of_bus_pci_translate,
367369
.get_flags = of_bus_pci_get_flags,
368370
},
369-
#endif /* CONFIG_PCI */
371+
#endif /* CONFIG_OF_ADDRESS_PCI */
370372
/* ISA */
371373
{
372374
.name = "isa",

0 commit comments

Comments
 (0)