Andrew Scull | b4b6d4a | 2019-01-02 15:54:55 +0000 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | #ifndef __LINUX_GOLDFISH_H |
| 3 | #define __LINUX_GOLDFISH_H |
| 4 | |
| 5 | #include <linux/kernel.h> |
| 6 | #include <linux/types.h> |
| 7 | #include <linux/io.h> |
| 8 | |
| 9 | /* Helpers for Goldfish virtual platform */ |
| 10 | |
| 11 | static inline void gf_write_ptr(const void *ptr, void __iomem *portl, |
| 12 | void __iomem *porth) |
| 13 | { |
| 14 | const unsigned long addr = (unsigned long)ptr; |
| 15 | |
| 16 | writel(lower_32_bits(addr), portl); |
| 17 | #ifdef CONFIG_64BIT |
| 18 | writel(upper_32_bits(addr), porth); |
| 19 | #endif |
| 20 | } |
| 21 | |
| 22 | static inline void gf_write_dma_addr(const dma_addr_t addr, |
| 23 | void __iomem *portl, |
| 24 | void __iomem *porth) |
| 25 | { |
| 26 | writel(lower_32_bits(addr), portl); |
| 27 | #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT |
| 28 | writel(upper_32_bits(addr), porth); |
| 29 | #endif |
| 30 | } |
| 31 | |
| 32 | |
| 33 | #endif /* __LINUX_GOLDFISH_H */ |