Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0+
0002 /*
0003  * Marvell Armada AP and CP110 helper
0004  *
0005  * Copyright (C) 2018 Marvell
0006  *
0007  * Gregory Clement <gregory.clement@bootlin.com>
0008  *
0009  */
0010 
0011 #include "armada_ap_cp_helper.h"
0012 #include <linux/device.h>
0013 #include <linux/of.h>
0014 #include <linux/of_address.h>
0015 
0016 char *ap_cp_unique_name(struct device *dev, struct device_node *np,
0017             const char *name)
0018 {
0019     const __be32 *reg;
0020     u64 addr;
0021 
0022     /* Do not create a name if there is no clock */
0023     if (!name)
0024         return NULL;
0025 
0026     reg = of_get_property(np, "reg", NULL);
0027     addr = of_translate_address(np, reg);
0028     return devm_kasprintf(dev, GFP_KERNEL, "%llx-%s",
0029                   (unsigned long long)addr, name);
0030 }