Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

uio: pruss: Remove this driver

This UIO driver was used to control the PRU processors found on various
TI SoCs. It was created before the Remoteproc framework, but now with
that we have a standard way to program and manage the PRU processors.
The proper PRU Remoteproc driver should be used instead of this driver.

This driver only supported the original class of PRUSS (OMAP-L1xx /
AM17xx / AM18xx / TMS320C674x / DA8xx) but when these platforms were
switched to use Device Tree the support for DT was not added to this
driver and so it is now unused/unusable. Support for these platforms
can be added to the proper PRU Remoteproc driver if ever needed.

Remove this driver.

Signed-off-by: Andrew Davis <afd@ti.com>
Link: https://lore.kernel.org/r/20240410144803.126831-1-afd@ti.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andrew Davis and committed by
Greg Kroah-Hartman
1019fa48 b2c6a73f

-292
-18
drivers/uio/Kconfig
··· 125 125 Information about this hardware can be found at: 126 126 http://www.hilscher.com/netx 127 127 128 - config UIO_PRUSS 129 - tristate "Texas Instruments PRUSS driver" 130 - select GENERIC_ALLOCATOR 131 - depends on HAS_IOMEM && HAS_DMA 132 - help 133 - PRUSS driver for OMAPL138/DA850/AM18XX devices 134 - PRUSS driver requires user space components, examples and user space 135 - driver is available from below SVN repo - you may use anonymous login 136 - 137 - https://gforge.ti.com/gf/project/pru_sw/ 138 - 139 - More info on API is available at below wiki 140 - 141 - http://processors.wiki.ti.com/index.php/PRU_Linux_Application_Loader 142 - 143 - To compile this driver as a module, choose M here: the module 144 - will be called uio_pruss. 145 - 146 128 config UIO_MF624 147 129 tristate "Humusoft MF624 DAQ PCI card driver" 148 130 depends on PCI
-1
drivers/uio/Makefile
··· 7 7 obj-$(CONFIG_UIO_SERCOS3) += uio_sercos3.o 8 8 obj-$(CONFIG_UIO_PCI_GENERIC) += uio_pci_generic.o 9 9 obj-$(CONFIG_UIO_NETX) += uio_netx.o 10 - obj-$(CONFIG_UIO_PRUSS) += uio_pruss.o 11 10 obj-$(CONFIG_UIO_MF624) += uio_mf624.o 12 11 obj-$(CONFIG_UIO_FSL_ELBC_GPCM) += uio_fsl_elbc_gpcm.o 13 12 obj-$(CONFIG_UIO_HV_GENERIC) += uio_hv_generic.o
-255
drivers/uio/uio_pruss.c
··· 1 - // SPDX-License-Identifier: GPL-2.0-only 2 - /* 3 - * Programmable Real-Time Unit Sub System (PRUSS) UIO driver (uio_pruss) 4 - * 5 - * This driver exports PRUSS host event out interrupts and PRUSS, L3 RAM, 6 - * and DDR RAM to user space for applications interacting with PRUSS firmware 7 - * 8 - * Copyright (C) 2010-11 Texas Instruments Incorporated - http://www.ti.com/ 9 - */ 10 - #include <linux/device.h> 11 - #include <linux/module.h> 12 - #include <linux/moduleparam.h> 13 - #include <linux/platform_device.h> 14 - #include <linux/uio_driver.h> 15 - #include <linux/platform_data/uio_pruss.h> 16 - #include <linux/io.h> 17 - #include <linux/clk.h> 18 - #include <linux/dma-mapping.h> 19 - #include <linux/sizes.h> 20 - #include <linux/slab.h> 21 - #include <linux/genalloc.h> 22 - 23 - #define DRV_NAME "pruss_uio" 24 - #define DRV_VERSION "1.0" 25 - 26 - static int sram_pool_sz = SZ_16K; 27 - module_param(sram_pool_sz, int, 0); 28 - MODULE_PARM_DESC(sram_pool_sz, "sram pool size to allocate "); 29 - 30 - static int extram_pool_sz = SZ_256K; 31 - module_param(extram_pool_sz, int, 0); 32 - MODULE_PARM_DESC(extram_pool_sz, "external ram pool size to allocate"); 33 - 34 - /* 35 - * Host event IRQ numbers from PRUSS - PRUSS can generate up to 8 interrupt 36 - * events to AINTC of ARM host processor - which can be used for IPC b/w PRUSS 37 - * firmware and user space application, async notification from PRU firmware 38 - * to user space application 39 - * 3 PRU_EVTOUT0 40 - * 4 PRU_EVTOUT1 41 - * 5 PRU_EVTOUT2 42 - * 6 PRU_EVTOUT3 43 - * 7 PRU_EVTOUT4 44 - * 8 PRU_EVTOUT5 45 - * 9 PRU_EVTOUT6 46 - * 10 PRU_EVTOUT7 47 - */ 48 - #define MAX_PRUSS_EVT 8 49 - 50 - #define PINTC_HIDISR 0x0038 51 - #define PINTC_HIPIR 0x0900 52 - #define HIPIR_NOPEND 0x80000000 53 - #define PINTC_HIER 0x1500 54 - 55 - struct uio_pruss_dev { 56 - struct uio_info *info; 57 - struct clk *pruss_clk; 58 - dma_addr_t sram_paddr; 59 - dma_addr_t ddr_paddr; 60 - void __iomem *prussio_vaddr; 61 - unsigned long sram_vaddr; 62 - void *ddr_vaddr; 63 - unsigned int hostirq_start; 64 - unsigned int pintc_base; 65 - struct gen_pool *sram_pool; 66 - }; 67 - 68 - static irqreturn_t pruss_handler(int irq, struct uio_info *info) 69 - { 70 - struct uio_pruss_dev *gdev = info->priv; 71 - int intr_bit = (irq - gdev->hostirq_start + 2); 72 - int val, intr_mask = (1 << intr_bit); 73 - void __iomem *base = gdev->prussio_vaddr + gdev->pintc_base; 74 - void __iomem *intren_reg = base + PINTC_HIER; 75 - void __iomem *intrdis_reg = base + PINTC_HIDISR; 76 - void __iomem *intrstat_reg = base + PINTC_HIPIR + (intr_bit << 2); 77 - 78 - val = ioread32(intren_reg); 79 - /* Is interrupt enabled and active ? */ 80 - if (!(val & intr_mask) && (ioread32(intrstat_reg) & HIPIR_NOPEND)) 81 - return IRQ_NONE; 82 - /* Disable interrupt */ 83 - iowrite32(intr_bit, intrdis_reg); 84 - return IRQ_HANDLED; 85 - } 86 - 87 - static void pruss_cleanup(struct device *dev, struct uio_pruss_dev *gdev) 88 - { 89 - int cnt; 90 - struct uio_info *p = gdev->info; 91 - 92 - for (cnt = 0; cnt < MAX_PRUSS_EVT; cnt++, p++) { 93 - uio_unregister_device(p); 94 - } 95 - iounmap(gdev->prussio_vaddr); 96 - if (gdev->ddr_vaddr) { 97 - dma_free_coherent(dev, extram_pool_sz, gdev->ddr_vaddr, 98 - gdev->ddr_paddr); 99 - } 100 - if (gdev->sram_vaddr) 101 - gen_pool_free(gdev->sram_pool, 102 - gdev->sram_vaddr, 103 - sram_pool_sz); 104 - clk_disable(gdev->pruss_clk); 105 - } 106 - 107 - static int pruss_probe(struct platform_device *pdev) 108 - { 109 - struct uio_info *p; 110 - struct uio_pruss_dev *gdev; 111 - struct resource *regs_prussio; 112 - struct device *dev = &pdev->dev; 113 - int ret, cnt, i, len; 114 - struct uio_pruss_pdata *pdata = dev_get_platdata(dev); 115 - 116 - gdev = devm_kzalloc(dev, sizeof(struct uio_pruss_dev), GFP_KERNEL); 117 - if (!gdev) 118 - return -ENOMEM; 119 - 120 - gdev->info = devm_kcalloc(dev, MAX_PRUSS_EVT, sizeof(*p), GFP_KERNEL); 121 - if (!gdev->info) 122 - return -ENOMEM; 123 - 124 - /* Power on PRU in case its not done as part of boot-loader */ 125 - gdev->pruss_clk = devm_clk_get(dev, "pruss"); 126 - if (IS_ERR(gdev->pruss_clk)) { 127 - dev_err(dev, "Failed to get clock\n"); 128 - return PTR_ERR(gdev->pruss_clk); 129 - } 130 - 131 - ret = clk_enable(gdev->pruss_clk); 132 - if (ret) { 133 - dev_err(dev, "Failed to enable clock\n"); 134 - return ret; 135 - } 136 - 137 - regs_prussio = platform_get_resource(pdev, IORESOURCE_MEM, 0); 138 - if (!regs_prussio) { 139 - dev_err(dev, "No PRUSS I/O resource specified\n"); 140 - ret = -EIO; 141 - goto err_clk_disable; 142 - } 143 - 144 - if (!regs_prussio->start) { 145 - dev_err(dev, "Invalid memory resource\n"); 146 - ret = -EIO; 147 - goto err_clk_disable; 148 - } 149 - 150 - if (pdata->sram_pool) { 151 - gdev->sram_pool = pdata->sram_pool; 152 - gdev->sram_vaddr = 153 - (unsigned long)gen_pool_dma_alloc(gdev->sram_pool, 154 - sram_pool_sz, &gdev->sram_paddr); 155 - if (!gdev->sram_vaddr) { 156 - dev_err(dev, "Could not allocate SRAM pool\n"); 157 - ret = -ENOMEM; 158 - goto err_clk_disable; 159 - } 160 - } 161 - 162 - gdev->ddr_vaddr = dma_alloc_coherent(dev, extram_pool_sz, 163 - &(gdev->ddr_paddr), GFP_KERNEL | GFP_DMA); 164 - if (!gdev->ddr_vaddr) { 165 - dev_err(dev, "Could not allocate external memory\n"); 166 - ret = -ENOMEM; 167 - goto err_free_sram; 168 - } 169 - 170 - len = resource_size(regs_prussio); 171 - gdev->prussio_vaddr = ioremap(regs_prussio->start, len); 172 - if (!gdev->prussio_vaddr) { 173 - dev_err(dev, "Can't remap PRUSS I/O address range\n"); 174 - ret = -ENOMEM; 175 - goto err_free_ddr_vaddr; 176 - } 177 - 178 - ret = platform_get_irq(pdev, 0); 179 - if (ret < 0) 180 - goto err_unmap; 181 - 182 - gdev->hostirq_start = ret; 183 - gdev->pintc_base = pdata->pintc_base; 184 - 185 - for (cnt = 0, p = gdev->info; cnt < MAX_PRUSS_EVT; cnt++, p++) { 186 - p->mem[0].addr = regs_prussio->start; 187 - p->mem[0].size = resource_size(regs_prussio); 188 - p->mem[0].memtype = UIO_MEM_PHYS; 189 - 190 - p->mem[1].addr = gdev->sram_paddr; 191 - p->mem[1].size = sram_pool_sz; 192 - p->mem[1].memtype = UIO_MEM_PHYS; 193 - 194 - p->mem[2].addr = (uintptr_t) gdev->ddr_vaddr; 195 - p->mem[2].dma_addr = gdev->ddr_paddr; 196 - p->mem[2].size = extram_pool_sz; 197 - p->mem[2].memtype = UIO_MEM_DMA_COHERENT; 198 - p->mem[2].dma_device = dev; 199 - 200 - p->name = devm_kasprintf(dev, GFP_KERNEL, "pruss_evt%d", cnt); 201 - p->version = DRV_VERSION; 202 - 203 - /* Register PRUSS IRQ lines */ 204 - p->irq = gdev->hostirq_start + cnt; 205 - p->handler = pruss_handler; 206 - p->priv = gdev; 207 - 208 - ret = uio_register_device(dev, p); 209 - if (ret < 0) 210 - goto err_unloop; 211 - } 212 - 213 - platform_set_drvdata(pdev, gdev); 214 - return 0; 215 - 216 - err_unloop: 217 - for (i = 0, p = gdev->info; i < cnt; i++, p++) { 218 - uio_unregister_device(p); 219 - } 220 - err_unmap: 221 - iounmap(gdev->prussio_vaddr); 222 - err_free_ddr_vaddr: 223 - dma_free_coherent(dev, extram_pool_sz, gdev->ddr_vaddr, 224 - gdev->ddr_paddr); 225 - err_free_sram: 226 - if (pdata->sram_pool) 227 - gen_pool_free(gdev->sram_pool, gdev->sram_vaddr, sram_pool_sz); 228 - err_clk_disable: 229 - clk_disable(gdev->pruss_clk); 230 - 231 - return ret; 232 - } 233 - 234 - static int pruss_remove(struct platform_device *dev) 235 - { 236 - struct uio_pruss_dev *gdev = platform_get_drvdata(dev); 237 - 238 - pruss_cleanup(&dev->dev, gdev); 239 - return 0; 240 - } 241 - 242 - static struct platform_driver pruss_driver = { 243 - .probe = pruss_probe, 244 - .remove = pruss_remove, 245 - .driver = { 246 - .name = DRV_NAME, 247 - }, 248 - }; 249 - 250 - module_platform_driver(pruss_driver); 251 - 252 - MODULE_LICENSE("GPL v2"); 253 - MODULE_VERSION(DRV_VERSION); 254 - MODULE_AUTHOR("Amit Chatterjee <amit.chatterjee@ti.com>"); 255 - MODULE_AUTHOR("Pratheesh Gangadhar <pratheesh@ti.com>");
-18
include/linux/platform_data/uio_pruss.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0-only */ 2 - /* 3 - * include/linux/platform_data/uio_pruss.h 4 - * 5 - * Platform data for uio_pruss driver 6 - * 7 - * Copyright (C) 2010-11 Texas Instruments Incorporated - https://www.ti.com/ 8 - */ 9 - 10 - #ifndef _UIO_PRUSS_H_ 11 - #define _UIO_PRUSS_H_ 12 - 13 - /* To configure the PRUSS INTC base offset for UIO driver */ 14 - struct uio_pruss_pdata { 15 - u32 pintc_base; 16 - struct gen_pool *sram_pool; 17 - }; 18 - #endif /* _UIO_PRUSS_H_ */