| 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 <[email protected]> |
| 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 |
struct resource res; |
| 20 |
|
| 21 |
/* Do not create a name if there is no clock */ |
| 22 |
if (!name) |
| 23 |
return NULL; |
| 24 |
|
| 25 |
of_address_to_resource(np, 0, &res); |
| 26 |
return devm_kasprintf(dev, GFP_KERNEL, "%llx-%s", |
| 27 |
(unsigned long long)res.start, name); |
| 28 |
} |