2019-05-27 13:55:05 +07:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
2006-11-11 13:24:53 +07:00
|
|
|
/*
|
|
|
|
* (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.
|
|
|
|
* <benh@kernel.crashing.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _ASM_POWERPC_DCR_H
|
|
|
|
#define _ASM_POWERPC_DCR_H
|
|
|
|
#ifdef __KERNEL__
|
2008-05-07 01:29:17 +07:00
|
|
|
#ifndef __ASSEMBLY__
|
2006-12-11 12:15:47 +07:00
|
|
|
#ifdef CONFIG_PPC_DCR
|
2006-11-11 13:24:53 +07:00
|
|
|
|
|
|
|
#ifdef CONFIG_PPC_DCR_NATIVE
|
|
|
|
#include <asm/dcr-native.h>
|
2008-05-07 01:29:17 +07:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef CONFIG_PPC_DCR_MMIO
|
2006-11-11 13:24:53 +07:00
|
|
|
#include <asm/dcr-mmio.h>
|
|
|
|
#endif
|
|
|
|
|
2008-05-07 01:29:17 +07:00
|
|
|
|
|
|
|
/* Indirection layer for providing both NATIVE and MMIO support. */
|
|
|
|
|
|
|
|
#if defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO)
|
|
|
|
|
|
|
|
#include <asm/dcr-generic.h>
|
|
|
|
|
|
|
|
#define DCR_MAP_OK(host) dcr_map_ok_generic(host)
|
|
|
|
#define dcr_map(dev, dcr_n, dcr_c) dcr_map_generic(dev, dcr_n, dcr_c)
|
|
|
|
#define dcr_unmap(host, dcr_c) dcr_unmap_generic(host, dcr_c)
|
|
|
|
#define dcr_read(host, dcr_n) dcr_read_generic(host, dcr_n)
|
|
|
|
#define dcr_write(host, dcr_n, value) dcr_write_generic(host, dcr_n, value)
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#ifdef CONFIG_PPC_DCR_NATIVE
|
|
|
|
typedef dcr_host_native_t dcr_host_t;
|
|
|
|
#define DCR_MAP_OK(host) dcr_map_ok_native(host)
|
|
|
|
#define dcr_map(dev, dcr_n, dcr_c) dcr_map_native(dev, dcr_n, dcr_c)
|
|
|
|
#define dcr_unmap(host, dcr_c) dcr_unmap_native(host, dcr_c)
|
|
|
|
#define dcr_read(host, dcr_n) dcr_read_native(host, dcr_n)
|
|
|
|
#define dcr_write(host, dcr_n, value) dcr_write_native(host, dcr_n, value)
|
|
|
|
#else
|
|
|
|
typedef dcr_host_mmio_t dcr_host_t;
|
|
|
|
#define DCR_MAP_OK(host) dcr_map_ok_mmio(host)
|
|
|
|
#define dcr_map(dev, dcr_n, dcr_c) dcr_map_mmio(dev, dcr_n, dcr_c)
|
|
|
|
#define dcr_unmap(host, dcr_c) dcr_unmap_mmio(host, dcr_c)
|
|
|
|
#define dcr_read(host, dcr_n) dcr_read_mmio(host, dcr_n)
|
|
|
|
#define dcr_write(host, dcr_n, value) dcr_write_mmio(host, dcr_n, value)
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* defined(CONFIG_PPC_DCR_NATIVE) && defined(CONFIG_PPC_DCR_MMIO) */
|
|
|
|
|
2006-11-11 13:24:53 +07:00
|
|
|
/*
|
2008-08-01 23:44:11 +07:00
|
|
|
* additional helpers to read the DCR * base from the device-tree
|
2006-11-11 13:24:53 +07:00
|
|
|
*/
|
2007-02-06 07:48:28 +07:00
|
|
|
struct device_node;
|
2008-12-19 15:17:54 +07:00
|
|
|
extern unsigned int dcr_resource_start(const struct device_node *np,
|
2006-11-11 13:24:53 +07:00
|
|
|
unsigned int index);
|
2008-12-19 15:17:54 +07:00
|
|
|
extern unsigned int dcr_resource_len(const struct device_node *np,
|
2006-11-11 13:24:53 +07:00
|
|
|
unsigned int index);
|
2006-12-11 12:15:47 +07:00
|
|
|
#endif /* CONFIG_PPC_DCR */
|
2008-05-07 01:29:17 +07:00
|
|
|
#endif /* __ASSEMBLY__ */
|
2006-11-11 13:24:53 +07:00
|
|
|
#endif /* __KERNEL__ */
|
|
|
|
#endif /* _ASM_POWERPC_DCR_H */
|