summaryrefslogtreecommitdiffstats
path: root/drivers/of
diff options
context:
space:
mode:
authorPeter Hurley <peter@hurleysoftware.com>2016-01-16 18:23:44 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-02-07 01:07:37 -0500
commitc90fe9c0394b068ceca16f66e9f35bcd8d948295 (patch)
treee4fc1ed180a6d159ec179a093dcef27691b9569e /drivers/of
parent088da2a17619cf0113b62a76ad38c6a14470ffa6 (diff)
of: earlycon: Move address translation to of_setup_earlycon()
Cleanup the early DT/earlycon separation; remove the 'addr' parameter from of_setup_earlycon() and get the uart phys addr directly with a new wrapper function, of_flat_dt_translate_addr(). Limit fdt_translate_address() to file scope. Acked-by: Rob Herring <robh@kernel.org> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/of')
-rw-r--r--drivers/of/fdt.c8
-rw-r--r--drivers/of/fdt_address.c11
2 files changed, 11 insertions, 8 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index e8fd54a30802..918809e6f913 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -827,19 +827,13 @@ static int __init early_init_dt_scan_chosen_serial(void)
827 return -ENODEV; 827 return -ENODEV;
828 828
829 for (match = __earlycon_table; match < __earlycon_table_end; match++) { 829 for (match = __earlycon_table; match < __earlycon_table_end; match++) {
830 u64 addr;
831
832 if (!match->compatible[0]) 830 if (!match->compatible[0])
833 continue; 831 continue;
834 832
835 if (fdt_node_check_compatible(fdt, offset, match->compatible)) 833 if (fdt_node_check_compatible(fdt, offset, match->compatible))
836 continue; 834 continue;
837 835
838 addr = fdt_translate_address(fdt, offset); 836 of_setup_earlycon(match, offset, options);
839 if (addr == OF_BAD_ADDR)
840 return -ENXIO;
841
842 of_setup_earlycon(addr, match, offset, options);
843 return 0; 837 return 0;
844 } 838 }
845 return -ENODEV; 839 return -ENODEV;
diff --git a/drivers/of/fdt_address.c b/drivers/of/fdt_address.c
index 8d3dc6fbdb7a..dca8f9b93745 100644
--- a/drivers/of/fdt_address.c
+++ b/drivers/of/fdt_address.c
@@ -161,7 +161,7 @@ static int __init fdt_translate_one(const void *blob, int parent,
161 * that can be mapped to a cpu physical address). This is not really specified 161 * that can be mapped to a cpu physical address). This is not really specified
162 * that way, but this is traditionally the way IBM at least do things 162 * that way, but this is traditionally the way IBM at least do things
163 */ 163 */
164u64 __init fdt_translate_address(const void *blob, int node_offset) 164static u64 __init fdt_translate_address(const void *blob, int node_offset)
165{ 165{
166 int parent, len; 166 int parent, len;
167 const struct of_bus *bus, *pbus; 167 const struct of_bus *bus, *pbus;
@@ -239,3 +239,12 @@ u64 __init fdt_translate_address(const void *blob, int node_offset)
239 bail: 239 bail:
240 return result; 240 return result;
241} 241}
242
243/**
244 * of_flat_dt_translate_address - translate DT addr into CPU phys addr
245 * @node: node in the flat blob
246 */
247u64 __init of_flat_dt_translate_address(unsigned long node)
248{
249 return fdt_translate_address(initial_boot_params, node);
250}