162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */ 262306a36Sopenharmony_ci/* Copyright (c) 2018 Jernej Skrabec <jernej.skrabec@siol.net> */ 362306a36Sopenharmony_ci 462306a36Sopenharmony_ci#ifndef _SUN8I_TCON_TOP_H_ 562306a36Sopenharmony_ci#define _SUN8I_TCON_TOP_H_ 662306a36Sopenharmony_ci 762306a36Sopenharmony_ci#include <linux/clk.h> 862306a36Sopenharmony_ci#include <linux/clk-provider.h> 962306a36Sopenharmony_ci#include <linux/reset.h> 1062306a36Sopenharmony_ci#include <linux/spinlock.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#define TCON_TOP_TCON_TV_SETUP_REG 0x00 1362306a36Sopenharmony_ci 1462306a36Sopenharmony_ci#define TCON_TOP_PORT_SEL_REG 0x1C 1562306a36Sopenharmony_ci#define TCON_TOP_PORT_DE0_MSK GENMASK(1, 0) 1662306a36Sopenharmony_ci#define TCON_TOP_PORT_DE1_MSK GENMASK(5, 4) 1762306a36Sopenharmony_ci 1862306a36Sopenharmony_ci#define TCON_TOP_GATE_SRC_REG 0x20 1962306a36Sopenharmony_ci#define TCON_TOP_HDMI_SRC_MSK GENMASK(29, 28) 2062306a36Sopenharmony_ci#define TCON_TOP_TCON_TV1_GATE 24 2162306a36Sopenharmony_ci#define TCON_TOP_TCON_TV0_GATE 20 2262306a36Sopenharmony_ci#define TCON_TOP_TCON_DSI_GATE 16 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci#define CLK_NUM 3 2562306a36Sopenharmony_ci 2662306a36Sopenharmony_cistruct sun8i_tcon_top { 2762306a36Sopenharmony_ci struct clk *bus; 2862306a36Sopenharmony_ci struct clk_hw_onecell_data *clk_data; 2962306a36Sopenharmony_ci void __iomem *regs; 3062306a36Sopenharmony_ci struct reset_control *rst; 3162306a36Sopenharmony_ci 3262306a36Sopenharmony_ci /* 3362306a36Sopenharmony_ci * spinlock is used to synchronize access to same 3462306a36Sopenharmony_ci * register where multiple clock gates can be set. 3562306a36Sopenharmony_ci */ 3662306a36Sopenharmony_ci spinlock_t reg_lock; 3762306a36Sopenharmony_ci}; 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ciextern const struct of_device_id sun8i_tcon_top_of_table[]; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ciint sun8i_tcon_top_set_hdmi_src(struct device *dev, int tcon); 4262306a36Sopenharmony_ciint sun8i_tcon_top_de_config(struct device *dev, int mixer, int tcon); 4362306a36Sopenharmony_ci 4462306a36Sopenharmony_ci#endif /* _SUN8I_TCON_TOP_H_ */ 45