armada_ap_cp_helper.c 612 B

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