1// SPDX-License-Identifier: GPL-2.0+ 2/* 3 * Copyright (C) 2016 Nexell Co., Ltd. 4 * 5 * Author: junghyun, kim <jhkim@nexell.co.kr> 6 */ 7 8#include <linux/types.h> 9#include <linux/io.h> 10 11#include "s5pxx18_soc_hdmi.h" 12 13static u32 *hdmi_base_addr; 14 15u32 nx_hdmi_get_reg(u32 module_index, u32 offset) 16{ 17 u32 *reg_addr; 18 u32 regvalue; 19 20 reg_addr = hdmi_base_addr + (offset / sizeof(u32)); 21 regvalue = readl((u32 *)reg_addr); 22 23 return regvalue; 24} 25 26void nx_hdmi_set_reg(u32 module_index, u32 offset, u32 regvalue) 27{ 28 s64 offset_new = (s64)((int32_t)offset); 29 u32 *reg_addr; 30 31 reg_addr = hdmi_base_addr + (offset_new / sizeof(u32)); 32 writel(regvalue, (u32 *)reg_addr); 33} 34 35void nx_hdmi_set_base_address(u32 module_index, void *base_address) 36{ 37 hdmi_base_addr = (u32 *)base_address; 38} 39 40void *nx_hdmi_get_base_address(u32 module_index) 41{ 42 return (u32 *)hdmi_base_addr; 43} 44 45u32 nx_hdmi_get_physical_address(u32 module_index) 46{ 47 const u32 physical_addr[] = PHY_BASEADDR_HDMI_LIST; 48 49 return physical_addr[module_index]; 50} 51