Lines Matching +full:r9a06g032 +full:- +full:sysctrl
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2022 Schneider-Electric
13 #include <linux/soc/renesas/r9a06g032-sysctrl.h>
34 dev_dbg(dev, "Unmapping DMAMUX request %u\n", map->req_idx); in rzn1_dmamux_free()
36 clear_bit(map->req_idx, dmamux->used_chans); in rzn1_dmamux_free()
44 struct platform_device *pdev = of_find_device_by_node(ofdma->of_node); in rzn1_dmamux_route_allocate()
51 if (dma_spec->args_count != RNZ1_DMAMUX_NCELLS) in rzn1_dmamux_route_allocate()
52 return ERR_PTR(-EINVAL); in rzn1_dmamux_route_allocate()
56 return ERR_PTR(-ENOMEM); in rzn1_dmamux_route_allocate()
58 chan = dma_spec->args[0]; in rzn1_dmamux_route_allocate()
59 map->req_idx = dma_spec->args[4]; in rzn1_dmamux_route_allocate()
60 val = dma_spec->args[5]; in rzn1_dmamux_route_allocate()
61 dma_spec->args_count -= 2; in rzn1_dmamux_route_allocate()
64 dev_err(&pdev->dev, "Invalid DMA request line: %u\n", chan); in rzn1_dmamux_route_allocate()
65 ret = -EINVAL; in rzn1_dmamux_route_allocate()
69 if (map->req_idx >= RZN1_DMAMUX_MAX_LINES || in rzn1_dmamux_route_allocate()
70 (map->req_idx % RZN1_DMAMUX_LINES_PER_CTLR) != chan) { in rzn1_dmamux_route_allocate()
71 dev_err(&pdev->dev, "Invalid MUX request line: %u\n", map->req_idx); in rzn1_dmamux_route_allocate()
72 ret = -EINVAL; in rzn1_dmamux_route_allocate()
76 dmac_idx = map->req_idx >= RZN1_DMAMUX_LINES_PER_CTLR ? 1 : 0; in rzn1_dmamux_route_allocate()
77 dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", dmac_idx); in rzn1_dmamux_route_allocate()
78 if (!dma_spec->np) { in rzn1_dmamux_route_allocate()
79 dev_err(&pdev->dev, "Can't get DMA master\n"); in rzn1_dmamux_route_allocate()
80 ret = -EINVAL; in rzn1_dmamux_route_allocate()
84 dev_dbg(&pdev->dev, "Mapping DMAMUX request %u to DMAC%u request %u\n", in rzn1_dmamux_route_allocate()
85 map->req_idx, dmac_idx, chan); in rzn1_dmamux_route_allocate()
87 if (test_and_set_bit(map->req_idx, dmamux->used_chans)) { in rzn1_dmamux_route_allocate()
88 ret = -EBUSY; in rzn1_dmamux_route_allocate()
92 mask = BIT(map->req_idx); in rzn1_dmamux_route_allocate()
100 clear_bit(map->req_idx, dmamux->used_chans); in rzn1_dmamux_route_allocate()
109 { .compatible = "renesas,rzn1-dma" },
116 struct device_node *mux_node = pdev->dev.of_node; in rzn1_dmamux_probe()
121 dmamux = devm_kzalloc(&pdev->dev, sizeof(*dmamux), GFP_KERNEL); in rzn1_dmamux_probe()
123 return -ENOMEM; in rzn1_dmamux_probe()
125 dmac_node = of_parse_phandle(mux_node, "dma-masters", 0); in rzn1_dmamux_probe()
127 return dev_err_probe(&pdev->dev, -ENODEV, "Can't get DMA master node\n"); in rzn1_dmamux_probe()
132 return dev_err_probe(&pdev->dev, -EINVAL, "DMA master is not supported\n"); in rzn1_dmamux_probe()
134 dmamux->dmarouter.dev = &pdev->dev; in rzn1_dmamux_probe()
135 dmamux->dmarouter.route_free = rzn1_dmamux_free; in rzn1_dmamux_probe()
140 &dmamux->dmarouter); in rzn1_dmamux_probe()
144 { .compatible = "renesas,rzn1-dmamux" },
151 .name = "renesas,rzn1-dmamux",