| |
| /* |
| * drivers/vpp/aml_vpu_reg.h |
| * |
| * Copyright (C) 2015 Amlogic, Inc. All rights reserved. |
| * |
| * This program is free software; you can redistribute it and/or modify |
| * it under the terms of the GNU General Public License as published by |
| * the Free Software Foundation; either version 2 of the License, or |
| * (at your option) any later version. |
| * |
| * This program is distributed in the hope that it will be useful, but WITHOUT |
| * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| * more details. |
| * |
| * You should have received a copy of the GNU General Public License along |
| * with this program; if not, write to the Free Software Foundation, Inc., |
| * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| */ |
| |
| #ifndef __VPP_REG_H__ |
| #define __VPP_REG_H__ |
| #include <asm/arch/io.h> |
| #include <asm/arch/secure_apb.h> |
| |
| /* ******************************** |
| * register define |
| * ********************************* */ |
| /* base & offset */ |
| //#define REG_BASE_VCBUS (0xd0100000L) |
| #define REG_OFFSET_VCBUS(reg) ((reg) << 2) |
| /* memory mapping */ |
| #define REG_ADDR_VCBUS(reg) (REG_BASE_VCBUS + REG_OFFSET_VCBUS(reg)) |
| |
| #ifdef VPP_EOTF_CTL |
| #define VIU_EOTF_CTL VPP_EOTF_CTL |
| #endif |
| |
| #ifdef VPP_EOTF_LUT_ADDR_PORT |
| #define VIU_EOTF_LUT_ADDR_PORT VPP_EOTF_LUT_ADDR_PORT |
| #endif |
| |
| #ifdef VPP_EOTF_LUT_DATA_PORT |
| #define VIU_EOTF_LUT_DATA_PORT VPP_EOTF_LUT_DATA_PORT |
| #endif |
| |
| /* ******************************** |
| * register access api |
| * ********************************* */ |
| |
| static inline unsigned int vpp_reg_read(unsigned int _reg) |
| { |
| return (*(volatile unsigned int *)REG_ADDR_VCBUS(_reg)); |
| }; |
| |
| static inline void vpp_reg_write(unsigned int _reg, unsigned int _value) |
| { |
| *(volatile unsigned int *)REG_ADDR_VCBUS(_reg) = (_value); |
| }; |
| |
| static inline void vpp_reg_setb(unsigned int _reg, unsigned int _value, |
| unsigned int _start, unsigned int _len) |
| { |
| vpp_reg_write(_reg, ((vpp_reg_read(_reg) & |
| ~(((1L << (_len))-1) << (_start))) | |
| (((_value)&((1L<<(_len))-1)) << (_start)))); |
| } |
| |
| static inline unsigned int vpp_reg_getb(unsigned int _reg, |
| unsigned int _start, unsigned int _len) |
| { |
| return (vpp_reg_read(_reg) >> (_start)) & ((1L << (_len)) - 1); |
| } |
| |
| #endif |