blob: 265a099cd3b83dce18e24a36e37d6038e25fc7d0 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Alan425f3742014-04-28 20:47:36 +01002#ifndef __LINUX_GOLDFISH_H
3#define __LINUX_GOLDFISH_H
4
Roman Kiryanov682756802018-07-23 15:47:27 -07005#include <linux/kernel.h>
Roman Kiryanov72755ee2018-07-23 15:47:26 -07006#include <linux/types.h>
7#include <linux/io.h>
8
Alan425f3742014-04-28 20:47:36 +01009/* Helpers for Goldfish virtual platform */
10
Peter Senna Tschudin07d783f2015-05-19 11:44:46 +020011static inline void gf_write_ptr(const void *ptr, void __iomem *portl,
12 void __iomem *porth)
Alan425f3742014-04-28 20:47:36 +010013{
Roman Kiryanov682756802018-07-23 15:47:27 -070014 const unsigned long addr = (unsigned long)ptr;
15
16 writel(lower_32_bits(addr), portl);
Alan Cox8d9e9852014-05-19 14:34:09 +010017#ifdef CONFIG_64BIT
Roman Kiryanov682756802018-07-23 15:47:27 -070018 writel(upper_32_bits(addr), porth);
Alan425f3742014-04-28 20:47:36 +010019#endif
20}
21
Peter Senna Tschudin07d783f2015-05-19 11:44:46 +020022static inline void gf_write_dma_addr(const dma_addr_t addr,
23 void __iomem *portl,
24 void __iomem *porth)
25{
Roman Kiryanov682756802018-07-23 15:47:27 -070026 writel(lower_32_bits(addr), portl);
Peter Senna Tschudin07d783f2015-05-19 11:44:46 +020027#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
Roman Kiryanov682756802018-07-23 15:47:27 -070028 writel(upper_32_bits(addr), porth);
Peter Senna Tschudin07d783f2015-05-19 11:44:46 +020029#endif
30}
31
32
Alan425f3742014-04-28 20:47:36 +010033#endif /* __LINUX_GOLDFISH_H */