armada_ap_cp_helper.c 658 B

123456789101112131415161718192021222324252627282930
  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. #include "armada_ap_cp_helper.h"
  11. #include <linux/device.h>
  12. #include <linux/of.h>
  13. #include <linux/of_address.h>
  14. char *ap_cp_unique_name(struct device *dev, struct device_node *np,
  15. const char *name)
  16. {
  17. const __be32 *reg;
  18. u64 addr;
  19. /* Do not create a name if there is no clock */
  20. if (!name)
  21. return NULL;
  22. reg = of_get_property(np, "reg", NULL);
  23. addr = of_translate_address(np, reg);
  24. return devm_kasprintf(dev, GFP_KERNEL, "%llx-%s",
  25. (unsigned long long)addr, name);
  26. }