Lines Matching +full:signal +full:- +full:guard
1 // SPDX-License-Identifier: GPL-2.0-only
6 // Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
23 int signal; member
41 .signal = 3,
42 .name_sel0 = "spi2-rx-tx",
43 .name_sel1 = "ssp1-rx",
48 .signal = 10,
49 .name_sel0 = "uart7-rx",
50 .name_sel1 = "i2s1-dma1",
55 .signal = 11,
56 .name_sel0 = "spi1-rx-tx",
57 .name_sel1 = "ssp1-tx",
62 .signal = 14,
64 .name_sel1 = "ssp0-rx",
69 .signal = 15,
71 .name_sel1 = "ssp0-tx",
82 dev_dbg(dev, "releasing dma request signal %d routed to %s\n", in lpc32xx_dmamux_release()
83 mux->signal, mux->muxval ? mux->name_sel1 : mux->name_sel1); in lpc32xx_dmamux_release()
85 guard(spinlock)(&dmamux->lock); in lpc32xx_dmamux_release()
87 mux->busy = false; in lpc32xx_dmamux_release()
93 struct platform_device *pdev = of_find_device_by_node(ofdma->of_node); in lpc32xx_dmamux_reserve()
94 struct device *dev = &pdev->dev; in lpc32xx_dmamux_reserve()
100 if (dma_spec->args_count != 3) { in lpc32xx_dmamux_reserve()
101 dev_err(&pdev->dev, "invalid number of dma mux args\n"); in lpc32xx_dmamux_reserve()
102 return ERR_PTR(-EINVAL); in lpc32xx_dmamux_reserve()
106 if (lpc32xx_muxes[i].signal == dma_spec->args[0]) { in lpc32xx_dmamux_reserve()
112 dev_err(&pdev->dev, "invalid mux request number: %d\n", in lpc32xx_dmamux_reserve()
113 dma_spec->args[0]); in lpc32xx_dmamux_reserve()
114 return ERR_PTR(-EINVAL); in lpc32xx_dmamux_reserve()
117 if (dma_spec->args[2] > 1) { in lpc32xx_dmamux_reserve()
118 dev_err(&pdev->dev, "invalid dma mux value: %d\n", in lpc32xx_dmamux_reserve()
119 dma_spec->args[1]); in lpc32xx_dmamux_reserve()
120 return ERR_PTR(-EINVAL); in lpc32xx_dmamux_reserve()
124 dma_spec->np = of_parse_phandle(ofdma->of_node, "dma-masters", 0); in lpc32xx_dmamux_reserve()
125 if (!dma_spec->np) { in lpc32xx_dmamux_reserve()
126 dev_err(&pdev->dev, "can't get dma master\n"); in lpc32xx_dmamux_reserve()
127 return ERR_PTR(-EINVAL); in lpc32xx_dmamux_reserve()
130 spin_lock_irqsave(&dmamux->lock, flags); in lpc32xx_dmamux_reserve()
131 if (mux->busy) { in lpc32xx_dmamux_reserve()
132 spin_unlock_irqrestore(&dmamux->lock, flags); in lpc32xx_dmamux_reserve()
133 dev_err(dev, "dma request signal %d busy, routed to %s\n", in lpc32xx_dmamux_reserve()
134 mux->signal, mux->muxval ? mux->name_sel1 : mux->name_sel1); in lpc32xx_dmamux_reserve()
135 of_node_put(dma_spec->np); in lpc32xx_dmamux_reserve()
136 return ERR_PTR(-EBUSY); in lpc32xx_dmamux_reserve()
139 mux->busy = true; in lpc32xx_dmamux_reserve()
140 mux->muxval = dma_spec->args[2] ? BIT(mux->bit) : 0; in lpc32xx_dmamux_reserve()
142 regmap_update_bits(dmamux->reg, mux->muxreg, BIT(mux->bit), mux->muxval); in lpc32xx_dmamux_reserve()
143 spin_unlock_irqrestore(&dmamux->lock, flags); in lpc32xx_dmamux_reserve()
145 dma_spec->args[2] = 0; in lpc32xx_dmamux_reserve()
146 dma_spec->args_count = 2; in lpc32xx_dmamux_reserve()
148 dev_dbg(dev, "dma request signal %d routed to %s\n", in lpc32xx_dmamux_reserve()
149 mux->signal, mux->muxval ? mux->name_sel1 : mux->name_sel1); in lpc32xx_dmamux_reserve()
156 struct device_node *np = pdev->dev.of_node; in lpc32xx_dmamux_probe()
159 dmamux = devm_kzalloc(&pdev->dev, sizeof(*dmamux), GFP_KERNEL); in lpc32xx_dmamux_probe()
161 return -ENOMEM; in lpc32xx_dmamux_probe()
163 dmamux->reg = syscon_node_to_regmap(np->parent); in lpc32xx_dmamux_probe()
164 if (IS_ERR(dmamux->reg)) { in lpc32xx_dmamux_probe()
165 dev_err(&pdev->dev, "syscon lookup failed\n"); in lpc32xx_dmamux_probe()
166 return PTR_ERR(dmamux->reg); in lpc32xx_dmamux_probe()
169 spin_lock_init(&dmamux->lock); in lpc32xx_dmamux_probe()
171 dmamux->dmarouter.dev = &pdev->dev; in lpc32xx_dmamux_probe()
172 dmamux->dmarouter.route_free = lpc32xx_dmamux_release; in lpc32xx_dmamux_probe()
175 &dmamux->dmarouter); in lpc32xx_dmamux_probe()
179 { .compatible = "nxp,lpc3220-dmamux" },
186 .name = "lpc32xx-dmamux",