[PATCH 09/13] uio: uio_pruss: add devicetree support
Mark Rutland
mark.rutland at arm.com
Mon Jun 30 02:36:06 PDT 2014
On Sun, Jun 29, 2014 at 05:21:43PM +0100, Andre Heider wrote:
> Add support to probe via devicetree.
>
> Signed-off-by: Andre Heider <a.heider at gmail.com>
> ---
> drivers/uio/uio_pruss.c | 46 +++++++++++++++++++++++++++++++++++++++-------
> 1 file changed, 39 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/uio/uio_pruss.c b/drivers/uio/uio_pruss.c
> index afaf726..2df54ab 100644
> --- a/drivers/uio/uio_pruss.c
> +++ b/drivers/uio/uio_pruss.c
> @@ -26,6 +26,7 @@
> #include <linux/dma-mapping.h>
> #include <linux/slab.h>
> #include <linux/genalloc.h>
> +#include <linux/of_device.h>
>
> #define DRV_NAME "pruss_uio"
> #define DRV_VERSION "1.0"
> @@ -70,6 +71,27 @@ struct uio_pruss_dev {
> struct gen_pool *sram_pool;
> };
>
> +#ifdef CONFIG_OF
> +struct uio_pruss_params {
> + u32 pintc_offset;
> +};
> +
> +static const struct uio_pruss_params uio_pruss_v1_params = {
> + .pintc_offset = 0x4000,
> +};
> +
> +static const struct uio_pruss_params uio_pruss_v2_params = {
> + .pintc_offset = 0x20000,
> +};
> +
> +static const struct of_device_id pruss_of_match_table[] = {
> + { .compatible = "ti,pruss-v1", .data = &uio_pruss_v1_params, },
> + { .compatible = "ti,pruss-v2", .data = &uio_pruss_v2_params, },
> + {},
> +};
> +MODULE_DEVICE_TABLE(of, pruss_of_match_table);
> +#endif
> +
> static irqreturn_t pruss_handler(int irq, struct uio_info *info)
> {
> struct uio_pruss_dev *gdev = info->priv;
> @@ -111,6 +133,8 @@ static int pruss_probe(struct platform_device *pdev)
> struct uio_pruss_dev *gdev;
> struct resource *regs_prussio;
> struct device *dev = &pdev->dev;
> + const struct of_device_id *match;
> + const struct uio_pruss_params *params;
> int ret = -ENODEV, cnt = 0, i;
> struct uio_pruss_pdata *pdata = dev_get_platdata(dev);
> dma_addr_t ddr_paddr;
> @@ -123,13 +147,21 @@ static int pruss_probe(struct platform_device *pdev)
> if (!gdev->info)
> return -ENOMEM;
>
> - /* Power on PRU in case its not done as part of boot-loader */
> - gdev->pruss_clk = clk_get(dev, "pruss");
> - if (IS_ERR(gdev->pruss_clk)) {
> - dev_err(dev, "Failed to get clock\n");
> - return PTR_ERR(gdev->pruss_clk);
> + if (dev->of_node) {
> + match = of_match_device(pruss_of_match_table, dev);
> + params = match->data;
> + gdev->pintc_base = params->pintc_offset;
> } else {
> + /* Power on PRU in case its not done as part of boot-loader */
> + gdev->pruss_clk = clk_get(dev, "pruss");
> + if (IS_ERR(gdev->pruss_clk)) {
> + dev_err(dev, "Failed to get clock\n");
> + return PTR_ERR(gdev->pruss_clk);
> + }
The "pruss" clock was not documented in the binding.
Is the clock really called "pruss", or is it given a specific name in
the manual?
Cheers,
Mark.
More information about the linux-arm-kernel
mailing list