0001
0002
0003
0004
0005
0006
0007 #ifndef _ASM_POWERPC_DCR_MMIO_H
0008 #define _ASM_POWERPC_DCR_MMIO_H
0009 #ifdef __KERNEL__
0010
0011 #include <asm/io.h>
0012
0013 typedef struct {
0014 void __iomem *token;
0015 unsigned int stride;
0016 unsigned int base;
0017 } dcr_host_mmio_t;
0018
0019 static inline bool dcr_map_ok_mmio(dcr_host_mmio_t host)
0020 {
0021 return host.token != NULL;
0022 }
0023
0024 extern dcr_host_mmio_t dcr_map_mmio(struct device_node *dev,
0025 unsigned int dcr_n,
0026 unsigned int dcr_c);
0027 extern void dcr_unmap_mmio(dcr_host_mmio_t host, unsigned int dcr_c);
0028
0029 static inline u32 dcr_read_mmio(dcr_host_mmio_t host, unsigned int dcr_n)
0030 {
0031 return in_be32(host.token + ((host.base + dcr_n) * host.stride));
0032 }
0033
0034 static inline void dcr_write_mmio(dcr_host_mmio_t host,
0035 unsigned int dcr_n,
0036 u32 value)
0037 {
0038 out_be32(host.token + ((host.base + dcr_n) * host.stride), value);
0039 }
0040
0041 #endif
0042 #endif
0043
0044