linux-stable/include/linux/goldfish.h
Laurent Vivier da31de35cd tty: goldfish: use __raw_writel()/__raw_readl()
gf_early_console_putchar() uses __raw_writel() but the standard driver
uses writel()/readl(). This means we can't use both on the same machine
as the device is either big-endian, little-endian or native-endian.

As android implementation defines the endianness of the device is the one
of the architecture replace all writel()/readl() by
__raw_writel()/__raw_readl()

https://android.googlesource.com/platform/external/qemu/+/refs/heads/emu-master-dev/hw/char/goldfish_tty.c#222

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Link: https://lore.kernel.org/r/20201010004749.1201695-1-laurent@vivier.eu
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-10-28 13:44:43 +01:00

33 lines
762 B
C

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef __LINUX_GOLDFISH_H
#define __LINUX_GOLDFISH_H
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/io.h>
/* Helpers for Goldfish virtual platform */
static inline void gf_write_ptr(const void *ptr, void __iomem *portl,
void __iomem *porth)
{
const unsigned long addr = (unsigned long)ptr;
__raw_writel(lower_32_bits(addr), portl);
#ifdef CONFIG_64BIT
__raw_writel(upper_32_bits(addr), porth);
#endif
}
static inline void gf_write_dma_addr(const dma_addr_t addr,
void __iomem *portl,
void __iomem *porth)
{
__raw_writel(lower_32_bits(addr), portl);
#ifdef CONFIG_ARCH_DMA_ADDR_T_64BIT
__raw_writel(upper_32_bits(addr), porth);
#endif
}
#endif /* __LINUX_GOLDFISH_H */