Path: blob/master/arch/arm/mach-orion5x/include/mach/io.h
10820 views
/*1* arch/arm/mach-orion5x/include/mach/io.h2*3* Tzachi Perelstein <[email protected]>4*5* This file is licensed under the terms of the GNU General Public6* License version 2. This program is licensed "as is" without any7* warranty of any kind, whether express or implied.8*/910#ifndef __ASM_ARCH_IO_H11#define __ASM_ARCH_IO_H1213#include "orion5x.h"1415#define IO_SPACE_LIMIT 0xffffffff1617static inline void __iomem *18__arch_ioremap(unsigned long paddr, size_t size, unsigned int mtype)19{20void __iomem *retval;21unsigned long offs = paddr - ORION5X_REGS_PHYS_BASE;22if (mtype == MT_DEVICE && size && offs < ORION5X_REGS_SIZE &&23size <= ORION5X_REGS_SIZE && offs + size <= ORION5X_REGS_SIZE) {24retval = (void __iomem *)ORION5X_REGS_VIRT_BASE + offs;25} else {26retval = __arm_ioremap(paddr, size, mtype);27}2829return retval;30}3132static inline void33__arch_iounmap(void __iomem *addr)34{35if (addr < (void __iomem *)ORION5X_REGS_VIRT_BASE ||36addr >= (void __iomem *)(ORION5X_REGS_VIRT_BASE + ORION5X_REGS_SIZE))37__iounmap(addr);38}3940#define __arch_ioremap __arch_ioremap41#define __arch_iounmap __arch_iounmap42#define __io(a) __typesafe_io(a)43#define __mem_pci(a) (a)444546/*****************************************************************************47* Helpers to access Orion registers48****************************************************************************/49/*50* These are not preempt-safe. Locks, if needed, must be taken51* care of by the caller.52*/53#define orion5x_setbits(r, mask) writel(readl(r) | (mask), (r))54#define orion5x_clrbits(r, mask) writel(readl(r) & ~(mask), (r))555657#endif585960