Skip to content
Permalink
Browse files
soc: xilinx: vcu: Add exported functions
Add exported fuctions to vcu driver. These functions are called
by out of tree driver.
Also probe childs which also requires DT binding extension which are
also coverred by this patch.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Signed-off-by: Rohit Visavalia <rohit.visavalia@xilinx.com>
State: not-upstreamable
  • Loading branch information
Michal Simek committed Apr 16, 2020
1 parent ab7a893 commit 27d1915e73e5bd983ebcc6d6ae4f89e3697956b2
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 2 deletions.
@@ -19,13 +19,43 @@ Required properties:
- clocks: phandle for aclk and pll_ref clocksource
- clock-names: The identification string, "aclk", is always required for
the axi clock. "pll_ref" is required for pll.
- ranges
- VCU Init driver node define the following child nodes:
* Allegro encoder driver node
- compatible: Must be "al,al5e"
- reg: There is a one set of register.
- interrupts: interrupt number to the cpu.
- interrupt-parent: the phandle for the interrupt controller
that services interrupts for this device.
* Allegro decoder driver node
- compatible: Must be "al,al5d"
- reg: There is a one set of register.
- interrupts: interrupt number to the cpu.
- interrupt-parent: the phandle for the interrupt controller
that services interrupts for this device.
Example:

xlnx_vcu: vcu@a0040000 {
compatible = "xlnx,vcu-logicoreip-1.0";
compatible = "xlnx,vcu";
#address-cells = <2>;
#size-cells = <2>;
reg = <0x0 0xa0040000 0x0 0x1000>,
<0x0 0xa0041000 0x0 0x1000>;
reg-names = "vcu_slcr", "logicore";
clocks = <&si570_1>, <&clkc 71>;
clock-names = "pll_ref", "aclk";
ranges;
encoder: al5e@a0000000 {
compatible = "al,al5e";
reg = <0x0 0xa0000000 0x0 0x10000>;
interrupts = <0 89 4>;
interrupt-parent = <&gic>;
};

decoder: al5d@a0020000 {
compatible = "al,al5d";
reg = <0x0 0xa0020000 0x0 0x10000>;
interrupts = <0 89 4>;
interrupt-parent = <&gic>;
};
};
@@ -14,6 +14,8 @@
#include <linux/of_platform.h>
#include <linux/platform_device.h>

#include <soc/xilinx/xlnx_vcu.h>

/* Address map for different registers implemented in the VCU LogiCORE IP. */
#define VCU_ECODER_ENABLE 0x00
#define VCU_DECODER_ENABLE 0x04
@@ -276,6 +278,32 @@ static void xvcu_write_field_reg(void __iomem *iomem, int offset,
xvcu_write(iomem, offset, val);
}

/**
* xvcu_get_color_depth - read the color depth register
* @xvcu: Pointer to the xvcu_device structure
*
* Return: Returns 32bit value
*
*/
u32 xvcu_get_color_depth(struct xvcu_device *xvcu)
{
return xvcu_read(xvcu->logicore_reg_ba, VCU_ENC_COLOR_DEPTH);
}
EXPORT_SYMBOL_GPL(xvcu_get_color_depth);

/**
* xvcu_get_memory_depth - read the memory depth register
* @xvcu: Pointer to the xvcu_device structure
*
* Return: Returns 32bit value
*
*/
u32 xvcu_get_memory_depth(struct xvcu_device *xvcu)
{
return xvcu_read(xvcu->logicore_reg_ba, VCU_MEMORY_DEPTH);
}
EXPORT_SYMBOL_GPL(xvcu_get_memory_depth);

/**
* xvcu_set_vcu_pll_info - Set the VCU PLL info
* @xvcu: Pointer to the xvcu_device structure
@@ -571,6 +599,11 @@ static int xvcu_probe(struct platform_device *pdev)

dev_set_drvdata(&pdev->dev, xvcu);

ret = of_platform_populate(xvcu->dev->of_node, NULL, NULL, &pdev->dev);
if (ret) {
dev_err(&pdev->dev, "Failed to register allegro codecs\n");
goto error_pll_ref;
}
dev_info(&pdev->dev, "%s: Probed successfully\n", __func__);

return 0;
@@ -583,7 +616,7 @@ static int xvcu_probe(struct platform_device *pdev)
}

/**
* xvcu_remove - Insert gasket isolation
* xvcu_remove - Depopulate the child nodes, Insert gasket isolation
* and disable the clock
* @pdev: Pointer to the platform_device structure
*
@@ -598,6 +631,8 @@ static int xvcu_remove(struct platform_device *pdev)
if (!xvcu)
return -ENODEV;

of_platform_depopulate(&pdev->dev);

/* Add the the Gasket isolation and put the VCU in reset. */
xvcu_write(xvcu->logicore_reg_ba, VCU_GASKET_INIT, 0);

@@ -0,0 +1,18 @@
/*
* Xilinx VCU Init
*
* Copyright (C) 2016 - 2017 Xilinx, Inc.
*
* Contacts Dhaval Shah <dshah@xilinx.com>
*
* SPDX-License-Identifier: GPL-2.0
*/
#ifndef _XILINX_VCU_H_
#define _XILINX_VCU_H_

struct xvcu_device;

u32 xvcu_get_color_depth(struct xvcu_device *xvcu);
u32 xvcu_get_memory_depth(struct xvcu_device *xvcu);

#endif /* _XILINX_VCU_H_ */

0 comments on commit 27d1915

Please sign in to comment.