diff options
Diffstat (limited to 'drivers/gpu/drm/meson/meson_drv.c')
| -rw-r--r-- | drivers/gpu/drm/meson/meson_drv.c | 73 | 
1 files changed, 44 insertions, 29 deletions
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c index 2310c96fff46..a24f8dec5adc 100644 --- a/drivers/gpu/drm/meson/meson_drv.c +++ b/drivers/gpu/drm/meson/meson_drv.c @@ -8,35 +8,30 @@   *     Jasper St. Pierre <[email protected]>   */ -#include <linux/kernel.h> -#include <linux/module.h> -#include <linux/mutex.h> -#include <linux/platform_device.h>  #include <linux/component.h> +#include <linux/module.h>  #include <linux/of_graph.h> +#include <linux/platform_device.h> +#include <linux/soc/amlogic/meson-canvas.h> -#include <drm/drmP.h> -#include <drm/drm_atomic.h>  #include <drm/drm_atomic_helper.h> -#include <drm/drm_fb_cma_helper.h> +#include <drm/drm_drv.h>  #include <drm/drm_fb_helper.h> -#include <drm/drm_flip_work.h>  #include <drm/drm_gem_cma_helper.h>  #include <drm/drm_gem_framebuffer_helper.h> -#include <drm/drm_plane_helper.h> +#include <drm/drm_irq.h> +#include <drm/drm_modeset_helper_vtables.h>  #include <drm/drm_probe_helper.h> -#include <drm/drm_rect.h> +#include <drm/drm_vblank.h> +#include "meson_crtc.h"  #include "meson_drv.h" -#include "meson_plane.h"  #include "meson_overlay.h" -#include "meson_crtc.h" +#include "meson_plane.h" +#include "meson_registers.h"  #include "meson_venc_cvbs.h" - -#include "meson_vpp.h"  #include "meson_viu.h" -#include "meson_venc.h" -#include "meson_registers.h" +#include "meson_vpp.h"  #define DRIVER_NAME "meson"  #define DRIVER_DESC "Amlogic Meson DRM driver" @@ -93,9 +88,7 @@ static int meson_dumb_create(struct drm_file *file, struct drm_device *dev,  DEFINE_DRM_GEM_CMA_FOPS(fops);  static struct drm_driver meson_driver = { -	.driver_features	= DRIVER_GEM | -				  DRIVER_MODESET | DRIVER_PRIME | -				  DRIVER_ATOMIC, +	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,  	/* IRQ */  	.irq_handler		= meson_irq, @@ -103,8 +96,6 @@ static struct drm_driver meson_driver = {  	/* PRIME Ops */  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle, -	.gem_prime_import	= drm_gem_prime_import, -	.gem_prime_export	= drm_gem_prime_export,  	.gem_prime_get_sg_table	= drm_gem_cma_prime_get_sg_table,  	.gem_prime_import_sg_table = drm_gem_cma_prime_import_sg_table,  	.gem_prime_vmap		= drm_gem_cma_prime_vmap, @@ -149,10 +140,28 @@ static struct regmap_config meson_regmap_config = {  static void meson_vpu_init(struct meson_drm *priv)  { -	writel_relaxed(0x210000, priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); -	writel_relaxed(0x10000, priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); -	writel_relaxed(0x900000, priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); -	writel_relaxed(0x20000, priv->io_base + _REG(VPU_WRARB_MODE_L2C1)); +	u32 value; + +	/* +	 * Slave dc0 and dc5 connected to master port 1. +	 * By default other slaves are connected to master port 0. +	 */ +	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1) | +		VPU_RDARB_SLAVE_TO_MASTER_PORT(5, 1); +	writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C1)); + +	/* Slave dc0 connected to master port 1 */ +	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(0, 1); +	writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L1C2)); + +	/* Slave dc4 and dc7 connected to master port 1 */ +	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(4, 1) | +		VPU_RDARB_SLAVE_TO_MASTER_PORT(7, 1); +	writel_relaxed(value, priv->io_base + _REG(VPU_RDARB_MODE_L2C1)); + +	/* Slave dc1 connected to master port 1 */ +	value = VPU_RDARB_SLAVE_TO_MASTER_PORT(1, 1); +	writel_relaxed(value, priv->io_base + _REG(VPU_WRARB_MODE_L2C1));  }  static void meson_remove_framebuffers(void) @@ -200,6 +209,8 @@ static int meson_drv_bind_master(struct device *dev, bool has_components)  	priv->drm = drm;  	priv->dev = dev; +	priv->compat = (enum vpu_compatible)of_device_get_match_data(priv->dev); +  	res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vpu");  	regs = devm_ioremap_resource(dev, res);  	if (IS_ERR(regs)) { @@ -444,10 +455,14 @@ static int meson_drv_probe(struct platform_device *pdev)  };  static const struct of_device_id dt_match[] = { -	{ .compatible = "amlogic,meson-gxbb-vpu" }, -	{ .compatible = "amlogic,meson-gxl-vpu" }, -	{ .compatible = "amlogic,meson-gxm-vpu" }, -	{ .compatible = "amlogic,meson-g12a-vpu" }, +	{ .compatible = "amlogic,meson-gxbb-vpu", +	  .data       = (void *)VPU_COMPATIBLE_GXBB }, +	{ .compatible = "amlogic,meson-gxl-vpu", +	  .data       = (void *)VPU_COMPATIBLE_GXL }, +	{ .compatible = "amlogic,meson-gxm-vpu", +	  .data       = (void *)VPU_COMPATIBLE_GXM }, +	{ .compatible = "amlogic,meson-g12a-vpu", +	  .data       = (void *)VPU_COMPATIBLE_G12A },  	{}  };  MODULE_DEVICE_TABLE(of, dt_match);  |