blob: d0c7b39f8d349867cd2513c53812b45361e1bf27 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
/* SPDX-License-Identifier: (BSD-3-Clause OR GPL-2.0)
*
* Copyright 2013-2015 Freescale Semiconductor Inc.
* Copyright 2017 NXP
*
*/
#ifndef _FSL_MC_SYS_H
#define _FSL_MC_SYS_H
#ifdef __linux_driver__
#include <linux/errno.h>
#include <asm/io.h>
#include <linux/slab.h>
struct fsl_mc_io {
void *regs;
};
#ifndef ENOTSUP
#define ENOTSUP 95
#endif
#define ioread64(_p) readq(_p)
#define iowrite64(_v, _p) writeq(_v, _p)
#else /* __linux_driver__ */
#include <stdio.h>
#include <stdint.h>
#include <errno.h>
#include <sys/uio.h>
#include <linux/byteorder/little_endian.h>
#ifndef dmb
#define dmb() {__asm__ __volatile__("" : : : "memory"); }
#endif
#define __iormb() dmb()
#define __iowmb() dmb()
#define __arch_getq(a) (*(volatile uint64_t *)(a))
#define __arch_putq(v, a) (*(volatile uint64_t *)(a) = (v))
#define __arch_putq32(v, a) (*(volatile uint32_t *)(a) = (v))
#define readq(c) \
({ uint64_t __v = __arch_getq(c); __iormb(); __v; })
#define writeq(v, c) \
({ uint64_t __v = v; __iowmb(); __arch_putq(__v, c); __v; })
#define writeq32(v, c) \
({ uint32_t __v = v; __iowmb(); __arch_putq32(__v, c); __v; })
#define ioread64(_p) readq(_p)
#define iowrite64(_v, _p) writeq(_v, _p)
#define iowrite32(_v, _p) writeq32(_v, _p)
#define __iomem
/*GPP is supposed to use MC commands with low priority*/
#define CMD_PRI_LOW 0 /*!< Low Priority command indication */
struct fsl_mc_io {
void *regs;
};
#endif /* __linux_driver__ */
#endif /* _FSL_MC_SYS_H */
|