aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory CLEMENT <gregory.clement@free-electrons.com>2014-02-19 17:14:55 -0500
committerGrant Likely <grant.likely@linaro.org>2014-02-20 10:34:35 -0500
commit25a31579ea19dce7947fc11295fbed2e460a83cb (patch)
tree7255a9ad976c02b5d0ea1069df30fd2dc828e6e0
parentb66548e2a9baf65ccebeb3750f0ab9ddbef500f6 (diff)
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>
-rw-r--r--drivers/of/Kconfig4
-rw-r--r--drivers/of/address.c8
2 files changed, 9 insertions, 3 deletions
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig
index c6973f101a3e..ffdcb11f75fb 100644
--- a/drivers/of/Kconfig
+++ b/drivers/of/Kconfig
@@ -44,6 +44,10 @@ config OF_DYNAMIC
44config OF_ADDRESS 44config OF_ADDRESS
45 def_bool y 45 def_bool y
46 depends on !SPARC 46 depends on !SPARC
47 select OF_ADDRESS_PCI if PCI
48
49config OF_ADDRESS_PCI
50 bool
47 51
48config OF_IRQ 52config OF_IRQ
49 def_bool y 53 def_bool y
diff --git a/drivers/of/address.c b/drivers/of/address.c
index d3dd41c840f1..fe44c74ff4bd 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -91,7 +91,7 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr)
91 return IORESOURCE_MEM; 91 return IORESOURCE_MEM;
92} 92}
93 93
94#ifdef CONFIG_PCI 94#ifdef CONFIG_OF_ADDRESS_PCI
95/* 95/*
96 * PCI bus specific translator 96 * PCI bus specific translator
97 */ 97 */
@@ -165,7 +165,9 @@ static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
165{ 165{
166 return of_bus_default_translate(addr + 1, offset, na - 1); 166 return of_bus_default_translate(addr + 1, offset, na - 1);
167} 167}
168#endif /* CONFIG_OF_ADDRESS_PCI */
168 169
170#ifdef CONFIG_PCI
169const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size, 171const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
170 unsigned int *flags) 172 unsigned int *flags)
171{ 173{
@@ -355,7 +357,7 @@ static unsigned int of_bus_isa_get_flags(const __be32 *addr)
355 */ 357 */
356 358
357static struct of_bus of_busses[] = { 359static struct of_bus of_busses[] = {
358#ifdef CONFIG_PCI 360#ifdef CONFIG_OF_ADDRESS_PCI
359 /* PCI */ 361 /* PCI */
360 { 362 {
361 .name = "pci", 363 .name = "pci",
@@ -366,7 +368,7 @@ static struct of_bus of_busses[] = {
366 .translate = of_bus_pci_translate, 368 .translate = of_bus_pci_translate,
367 .get_flags = of_bus_pci_get_flags, 369 .get_flags = of_bus_pci_get_flags,
368 }, 370 },
369#endif /* CONFIG_PCI */ 371#endif /* CONFIG_OF_ADDRESS_PCI */
370 /* ISA */ 372 /* ISA */
371 { 373 {
372 .name = "isa", 374 .name = "isa",