zephyr/dts/common/mem.h
Kumar Gala dacf211d36 dts: introduce macro's to help with changing unit-addr
Since there are times that we include a base .dtsi file and change the
reg address we tend to end up with warnings that the reg address and
unit-address don't match.  To handle this introduce a simple DT_ADDR(x)
macro that will prepend '0x' to a 'unit-address' style address.

  #define DCCM_ADDR 80000000 /* in unit-address format */

  dccm0: dccm@DCCM_ADDR {
     reg = <DT_ADDR(DCCM_ADDR) 0x1>;
     ...
  };

This allows the dts file to override the value of DCCM_ADDR and than to
have the unit-address of the node and the reg address match.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-02-05 17:10:54 -05:00

19 lines
358 B
C

/*
* Copyright (c) 2018 Linaro Limited
*
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef __DT_MEM_H
#define __DT_MEM_H
#define DT_SIZE_K(x) ((x) * 1024)
#define DT_SIZE_M(x) ((x) * 1024 * 1024)
/* concatenate the values of the arguments into one */
#define _DT_DO_CONCAT(x, y) x ## y
#define DT_ADDR(a) _DT_DO_CONCAT(0x, a)
#endif /* __DT_MEM_H */