Merge tag 'libnvdimm-for-5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm...
[linux-2.6-microblaze.git] / drivers / clk / mvebu / armada_ap_cp_helper.c
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Marvell Armada AP and CP110 helper
4  *
5  * Copyright (C) 2018 Marvell
6  *
7  * Gregory Clement <gregory.clement@bootlin.com>
8  *
9  */
10
11 #include "armada_ap_cp_helper.h"
12 #include <linux/device.h>
13 #include <linux/of.h>
14 #include <linux/of_address.h>
15
16 char *ap_cp_unique_name(struct device *dev, struct device_node *np,
17                         const char *name)
18 {
19         const __be32 *reg;
20         u64 addr;
21
22         /* Do not create a name if there is no clock */
23         if (!name)
24                 return NULL;
25
26         reg = of_get_property(np, "reg", NULL);
27         addr = of_translate_address(np, reg);
28         return devm_kasprintf(dev, GFP_KERNEL, "%llx-%s",
29                               (unsigned long long)addr, name);
30 }