OSDN Git Service

Merge tag 'v4.4.214' into 10
[sagit-ice-cold/kernel_xiaomi_msm8998.git] / drivers / of / address.c
index b3bf876..555d328 100644 (file)
@@ -788,6 +788,22 @@ unsigned long __weak pci_address_to_pio(phys_addr_t address)
 #endif
 }
 
+const __be32 *of_get_address_by_name(struct device_node *dev, const char *name,
+               u64 *size, unsigned int *flags)
+{
+       int index;
+       if (!name)
+               return NULL;
+
+       /* Try to read "reg-names" property and get the index by name */
+       index = of_property_match_string(dev, "reg-names", name);
+       if (index < 0)
+               return NULL;
+
+       return of_get_address(dev, index, size, flags);
+}
+EXPORT_SYMBOL(of_get_address_by_name);
+
 static int __of_address_to_resource(struct device_node *dev,
                const __be32 *addrp, u64 size, unsigned int flags,
                const char *name, struct resource *r)
@@ -1030,3 +1046,19 @@ bool of_dma_is_coherent(struct device_node *np)
        return false;
 }
 EXPORT_SYMBOL_GPL(of_dma_is_coherent);
+
+void __iomem *of_iomap_by_name(struct device_node *np, const char *name)
+{
+       int index;
+
+       if (!name)
+               return NULL;
+
+       /* Try to read "reg-names" property and get the index by name */
+       index = of_property_match_string(np, "reg-names", name);
+       if (index < 0)
+               return NULL;
+
+       return of_iomap(np, index);
+}
+EXPORT_SYMBOL(of_iomap_by_name);