18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * ARC PGU DRM driver.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Copyright (C) 2016 Synopsys, Inc. (www.synopsys.com)
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef _ARCPGU_H_
98c2ecf20Sopenharmony_ci#define _ARCPGU_H_
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_cistruct arcpgu_drm_private {
128c2ecf20Sopenharmony_ci	void __iomem		*regs;
138c2ecf20Sopenharmony_ci	struct clk		*clk;
148c2ecf20Sopenharmony_ci	struct drm_framebuffer	*fb;
158c2ecf20Sopenharmony_ci	struct drm_crtc		crtc;
168c2ecf20Sopenharmony_ci	struct drm_plane	*plane;
178c2ecf20Sopenharmony_ci};
188c2ecf20Sopenharmony_ci
198c2ecf20Sopenharmony_ci#define crtc_to_arcpgu_priv(x) container_of(x, struct arcpgu_drm_private, crtc)
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_cistatic inline void arc_pgu_write(struct arcpgu_drm_private *arcpgu,
228c2ecf20Sopenharmony_ci				 unsigned int reg, u32 value)
238c2ecf20Sopenharmony_ci{
248c2ecf20Sopenharmony_ci	iowrite32(value, arcpgu->regs + reg);
258c2ecf20Sopenharmony_ci}
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_cistatic inline u32 arc_pgu_read(struct arcpgu_drm_private *arcpgu,
288c2ecf20Sopenharmony_ci			       unsigned int reg)
298c2ecf20Sopenharmony_ci{
308c2ecf20Sopenharmony_ci	return ioread32(arcpgu->regs + reg);
318c2ecf20Sopenharmony_ci}
328c2ecf20Sopenharmony_ci
338c2ecf20Sopenharmony_ciint arc_pgu_setup_crtc(struct drm_device *dev);
348c2ecf20Sopenharmony_ciint arcpgu_drm_hdmi_init(struct drm_device *drm, struct device_node *np);
358c2ecf20Sopenharmony_ciint arcpgu_drm_sim_init(struct drm_device *drm, struct device_node *np);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci#endif
38