1 /* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
3 * Copyright 2013-2015 Freescale Semiconductor Inc.
10 #ifdef __linux_driver__
12 #include <linux/errno.h>
14 #include <linux/slab.h>
24 #define ioread64(_p) readq(_p)
25 #define iowrite64(_v, _p) writeq(_v, _p)
27 #else /* __linux_driver__ */
34 #include <linux/byteorder/little_endian.h>
37 #define dmb() {__asm__ __volatile__("" : : : "memory"); }
39 #define __iormb() dmb()
40 #define __iowmb() dmb()
41 #define __arch_getq(a) (*(volatile uint64_t *)(a))
42 #define __arch_putq(v, a) (*(volatile uint64_t *)(a) = (v))
43 #define __arch_putq32(v, a) (*(volatile uint32_t *)(a) = (v))
45 ({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
46 #define writeq(v, c) \
47 ({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
48 #define writeq32(v, c) \
49 ({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
50 #define ioread64(_p) readq(_p)
51 #define iowrite64(_v, _p) writeq(_v, _p)
52 #define iowrite32(_v, _p) writeq32(_v, _p)
55 /*GPP is supposed to use MC commands with low priority*/
56 #define CMD_PRI_LOW 0 /*!< Low Priority command indication */
62 #endif /* __linux_driver__ */
64 #endif /* _FSL_MC_SYS_H */