Skip to content

Commit

Permalink
of: Allows to use the PCI translator without the PCI core
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Gregory CLEMENT authored and Grant Likely committed Feb 20, 2014
1 parent b66548e commit 25a3157
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions drivers/of/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ config OF_DYNAMIC
config OF_ADDRESS
def_bool y
depends on !SPARC
select OF_ADDRESS_PCI if PCI

config OF_ADDRESS_PCI
bool

config OF_IRQ
def_bool y
Expand Down
8 changes: 5 additions & 3 deletions drivers/of/address.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ static unsigned int of_bus_default_get_flags(const __be32 *addr)
return IORESOURCE_MEM;
}

#ifdef CONFIG_PCI
#ifdef CONFIG_OF_ADDRESS_PCI
/*
* PCI bus specific translator
*/
Expand Down Expand Up @@ -165,7 +165,9 @@ static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
{
return of_bus_default_translate(addr + 1, offset, na - 1);
}
#endif /* CONFIG_OF_ADDRESS_PCI */

#ifdef CONFIG_PCI
const __be32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
unsigned int *flags)
{
Expand Down Expand Up @@ -355,7 +357,7 @@ static unsigned int of_bus_isa_get_flags(const __be32 *addr)
*/

static struct of_bus of_busses[] = {
#ifdef CONFIG_PCI
#ifdef CONFIG_OF_ADDRESS_PCI
/* PCI */
{
.name = "pci",
Expand All @@ -366,7 +368,7 @@ static struct of_bus of_busses[] = {
.translate = of_bus_pci_translate,
.get_flags = of_bus_pci_get_flags,
},
#endif /* CONFIG_PCI */
#endif /* CONFIG_OF_ADDRESS_PCI */
/* ISA */
{
.name = "isa",
Expand Down

0 comments on commit 25a3157

Please sign in to comment.