Path: blob/master/arch/powerpc/include/asm/dcr-mmio.h
15117 views
/*1* (c) Copyright 2006 Benjamin Herrenschmidt, IBM Corp.2* <[email protected]>3*4* This program is free software; you can redistribute it and/or modify5* it under the terms of the GNU General Public License as published by6* the Free Software Foundation; either version 2 of the License, or7* (at your option) any later version.8*9* This program is distributed in the hope that it will be useful,10* but WITHOUT ANY WARRANTY; without even the implied warranty of11* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See12* the GNU General Public License for more details.13*14* You should have received a copy of the GNU General Public License15* along with this program; if not, write to the Free Software16* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17*/1819#ifndef _ASM_POWERPC_DCR_MMIO_H20#define _ASM_POWERPC_DCR_MMIO_H21#ifdef __KERNEL__2223#include <asm/io.h>2425typedef struct {26void __iomem *token;27unsigned int stride;28unsigned int base;29} dcr_host_mmio_t;3031static inline bool dcr_map_ok_mmio(dcr_host_mmio_t host)32{33return host.token != NULL;34}3536extern dcr_host_mmio_t dcr_map_mmio(struct device_node *dev,37unsigned int dcr_n,38unsigned int dcr_c);39extern void dcr_unmap_mmio(dcr_host_mmio_t host, unsigned int dcr_c);4041static inline u32 dcr_read_mmio(dcr_host_mmio_t host, unsigned int dcr_n)42{43return in_be32(host.token + ((host.base + dcr_n) * host.stride));44}4546static inline void dcr_write_mmio(dcr_host_mmio_t host,47unsigned int dcr_n,48u32 value)49{50out_be32(host.token + ((host.base + dcr_n) * host.stride), value);51}5253extern u64 of_translate_dcr_address(struct device_node *dev,54unsigned int dcr_n,55unsigned int *stride);5657#endif /* __KERNEL__ */58#endif /* _ASM_POWERPC_DCR_MMIO_H */5960616263