Greg Kroah-Hartman | b244131 | 2017-11-01 15:07:57 +0100 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
Alan | 425f374 | 2014-04-28 20:47:36 +0100 | [diff] [blame] | 2 | #ifndef __LINUX_GOLDFISH_H |
| 3 | #define __LINUX_GOLDFISH_H |
| 4 | |
Roman Kiryanov | 68275680 | 2018-07-23 15:47:27 -0700 | [diff] [blame] | 5 | #include <linux/kernel.h> |
Roman Kiryanov | 72755ee | 2018-07-23 15:47:26 -0700 | [diff] [blame] | 6 | #include <linux/types.h> |
| 7 | #include <linux/io.h> |
| 8 | |
Alan | 425f374 | 2014-04-28 20:47:36 +0100 | [diff] [blame] | 9 | /* Helpers for Goldfish virtual platform */ |
| 10 | |
Peter Senna Tschudin | 07d783f | 2015-05-19 11:44:46 +0200 | [diff] [blame] | 11 | static inline void gf_write_ptr(const void *ptr, void __iomem *portl, |
| 12 | void __iomem *porth) |
Alan | 425f374 | 2014-04-28 20:47:36 +0100 | [diff] [blame] | 13 | { |
Roman Kiryanov | 68275680 | 2018-07-23 15:47:27 -0700 | [diff] [blame] | 14 | const unsigned long addr = (unsigned long)ptr; |
| 15 | |
| 16 | writel(lower_32_bits(addr), portl); |
Alan Cox | 8d9e985 | 2014-05-19 14:34:09 +0100 | [diff] [blame] | 17 | #ifdef CONFIG_64BIT |
Roman Kiryanov | 68275680 | 2018-07-23 15:47:27 -0700 | [diff] [blame] | 18 | writel(upper_32_bits(addr), porth); |
Alan | 425f374 | 2014-04-28 20:47:36 +0100 | [diff] [blame] | 19 | #endif |
| 20 | } |
| 21 | |
Peter Senna Tschudin | 07d783f | 2015-05-19 11:44:46 +0200 | [diff] [blame] | 22 | static inline void gf_write_dma_addr(const dma_addr_t addr, |
| 23 | void __iomem *portl, |
| 24 | void __iomem *porth) |
| 25 | { |
Roman Kiryanov | 68275680 | 2018-07-23 15:47:27 -0700 | [diff] [blame] | 26 | writel(lower_32_bits(addr), portl); |
Peter Senna Tschudin | 07d783f | 2015-05-19 11:44:46 +0200 | [diff] [blame] | 27 | #ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT |
Roman Kiryanov | 68275680 | 2018-07-23 15:47:27 -0700 | [diff] [blame] | 28 | writel(upper_32_bits(addr), porth); |
Peter Senna Tschudin | 07d783f | 2015-05-19 11:44:46 +0200 | [diff] [blame] | 29 | #endif |
| 30 | } |
| 31 | |
| 32 | |
Alan | 425f374 | 2014-04-28 20:47:36 +0100 | [diff] [blame] | 33 | #endif /* __LINUX_GOLDFISH_H */ |