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

Merge tag 'drivers_soc_for_5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone into arm/drivers

SOC: TI Keystone driver update for v5.9

- TI K3 Ring Accelerator updates
- Few non critical warining fixes

* tag 'drivers_soc_for_5.9' of git://git.kernel.org/pub/scm/linux/kernel/git/ssantosh/linux-keystone:
soc: TI knav_qmss: make symbol 'knav_acc_range_ops' static
firmware: ti_sci: Replace HTTP links with HTTPS ones
soc: ti/ti_sci_protocol.h: drop a duplicated word + clarify
soc: ti: k3: fix semicolon.cocci warnings
soc: ti: k3-ringacc: fix: warn: variable dereferenced before check 'ring'
dmaengine: ti: k3-udma: Switch to k3_ringacc_request_rings_pair
soc: ti: k3-ringacc: separate soc specific initialization
soc: ti: k3-ringacc: add request pair of rings api.
soc: ti: k3-ringacc: add ring's flags to dump
soc: ti: k3-ringacc: Move state tracking variables under a struct
dt-bindings: soc: ti: k3-ringacc: convert bindings to json-schema

Link: https://lore.kernel.org/r/1595711814-7015-1-git-send-email-santosh.shilimkar@oracle.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>

+276 -187
+1 -1
Documentation/devicetree/bindings/interrupt-controller/ti,sci-intr.txt
··· 55 55 corresponds to a range of host irqs. 56 56 57 57 For more details on TISCI IRQ resource management refer: 58 - http://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/rm/rm_irq.html 58 + https://downloads.ti.com/tisci/esd/latest/2_tisci_msgs/rm/rm_irq.html 59 59 60 60 Example: 61 61 --------
-59
Documentation/devicetree/bindings/soc/ti/k3-ringacc.txt
··· 1 - * Texas Instruments K3 NavigatorSS Ring Accelerator 2 - 3 - The Ring Accelerator (RA) is a machine which converts read/write accesses 4 - from/to a constant address into corresponding read/write accesses from/to a 5 - circular data structure in memory. The RA eliminates the need for each DMA 6 - controller which needs to access ring elements from having to know the current 7 - state of the ring (base address, current offset). The DMA controller 8 - performs a read or write access to a specific address range (which maps to the 9 - source interface on the RA) and the RA replaces the address for the transaction 10 - with a new address which corresponds to the head or tail element of the ring 11 - (head for reads, tail for writes). 12 - 13 - The Ring Accelerator is a hardware module that is responsible for accelerating 14 - management of the packet queues. The K3 SoCs can have more than one RA instances 15 - 16 - Required properties: 17 - - compatible : Must be "ti,am654-navss-ringacc"; 18 - - reg : Should contain register location and length of the following 19 - named register regions. 20 - - reg-names : should be 21 - "rt" - The RA Ring Real-time Control/Status Registers 22 - "fifos" - The RA Queues Registers 23 - "proxy_gcfg" - The RA Proxy Global Config Registers 24 - "proxy_target" - The RA Proxy Datapath Registers 25 - - ti,num-rings : Number of rings supported by RA 26 - - ti,sci-rm-range-gp-rings : TI-SCI RM subtype for GP ring range 27 - - ti,sci : phandle on TI-SCI compatible System controller node 28 - - ti,sci-dev-id : TI-SCI device id of the ring accelerator 29 - - msi-parent : phandle for "ti,sci-inta" interrupt controller 30 - 31 - Optional properties: 32 - -- ti,dma-ring-reset-quirk : enable ringacc / udma ring state interoperability 33 - issue software w/a 34 - 35 - Example: 36 - 37 - ringacc: ringacc@3c000000 { 38 - compatible = "ti,am654-navss-ringacc"; 39 - reg = <0x0 0x3c000000 0x0 0x400000>, 40 - <0x0 0x38000000 0x0 0x400000>, 41 - <0x0 0x31120000 0x0 0x100>, 42 - <0x0 0x33000000 0x0 0x40000>; 43 - reg-names = "rt", "fifos", 44 - "proxy_gcfg", "proxy_target"; 45 - ti,num-rings = <818>; 46 - ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */ 47 - ti,dma-ring-reset-quirk; 48 - ti,sci = <&dmsc>; 49 - ti,sci-dev-id = <187>; 50 - msi-parent = <&inta_main_udmass>; 51 - }; 52 - 53 - client: 54 - 55 - dma_ipx: dma_ipx@<addr> { 56 - ... 57 - ti,ringacc = <&ringacc>; 58 - ... 59 - }
+102
Documentation/devicetree/bindings/soc/ti/k3-ringacc.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + # Copyright (C) 2020 Texas Instruments Incorporated - http://www.ti.com/ 3 + %YAML 1.2 4 + --- 5 + $id: "http://devicetree.org/schemas/soc/ti/k3-ringacc.yaml#" 6 + $schema: "http://devicetree.org/meta-schemas/core.yaml#" 7 + 8 + title: Texas Instruments K3 NavigatorSS Ring Accelerator 9 + 10 + maintainers: 11 + - Santosh Shilimkar <ssantosh@kernel.org> 12 + - Grygorii Strashko <grygorii.strashko@ti.com> 13 + 14 + description: | 15 + The Ring Accelerator (RA) is a machine which converts read/write accesses 16 + from/to a constant address into corresponding read/write accesses from/to a 17 + circular data structure in memory. The RA eliminates the need for each DMA 18 + controller which needs to access ring elements from having to know the current 19 + state of the ring (base address, current offset). The DMA controller 20 + performs a read or write access to a specific address range (which maps to the 21 + source interface on the RA) and the RA replaces the address for the transaction 22 + with a new address which corresponds to the head or tail element of the ring 23 + (head for reads, tail for writes). 24 + 25 + The Ring Accelerator is a hardware module that is responsible for accelerating 26 + management of the packet queues. The K3 SoCs can have more than one RA instances 27 + 28 + properties: 29 + compatible: 30 + items: 31 + - const: ti,am654-navss-ringacc 32 + 33 + reg: 34 + items: 35 + - description: real time registers regions 36 + - description: fifos registers regions 37 + - description: proxy gcfg registers regions 38 + - description: proxy target registers regions 39 + 40 + reg-names: 41 + items: 42 + - const: rt 43 + - const: fifos 44 + - const: proxy_gcfg 45 + - const: proxy_target 46 + 47 + msi-parent: true 48 + 49 + ti,num-rings: 50 + $ref: /schemas/types.yaml#/definitions/uint32 51 + description: Number of rings supported by RA 52 + 53 + ti,sci-rm-range-gp-rings: 54 + $ref: /schemas/types.yaml#/definitions/uint32 55 + description: TI-SCI RM subtype for GP ring range 56 + 57 + ti,sci: 58 + $ref: /schemas/types.yaml#definitions/phandle-array 59 + description: phandle on TI-SCI compatible System controller node 60 + 61 + ti,sci-dev-id: 62 + $ref: /schemas/types.yaml#/definitions/uint32 63 + description: TI-SCI device id of the ring accelerator 64 + 65 + ti,dma-ring-reset-quirk: 66 + $ref: /schemas/types.yaml#definitions/flag 67 + description: | 68 + enable ringacc/udma ring state interoperability issue software w/a 69 + 70 + required: 71 + - compatible 72 + - reg 73 + - reg-names 74 + - msi-parent 75 + - ti,num-rings 76 + - ti,sci-rm-range-gp-rings 77 + - ti,sci 78 + - ti,sci-dev-id 79 + 80 + additionalProperties: false 81 + 82 + examples: 83 + - | 84 + bus { 85 + #address-cells = <2>; 86 + #size-cells = <2>; 87 + 88 + ringacc: ringacc@3c000000 { 89 + compatible = "ti,am654-navss-ringacc"; 90 + reg = <0x0 0x3c000000 0x0 0x400000>, 91 + <0x0 0x38000000 0x0 0x400000>, 92 + <0x0 0x31120000 0x0 0x100>, 93 + <0x0 0x33000000 0x0 0x40000>; 94 + reg-names = "rt", "fifos", "proxy_gcfg", "proxy_target"; 95 + ti,num-rings = <818>; 96 + ti,sci-rm-range-gp-rings = <0x2>; /* GP ring range */ 97 + ti,dma-ring-reset-quirk; 98 + ti,sci = <&dmsc>; 99 + ti,sci-dev-id = <187>; 100 + msi-parent = <&inta_main_udmass>; 101 + }; 102 + };
+13 -29
drivers/dma/ti/k3-udma-glue.c
··· 271 271 atomic_set(&tx_chn->free_pkts, cfg->txcq_cfg.size); 272 272 273 273 /* request and cfg rings */ 274 - tx_chn->ringtx = k3_ringacc_request_ring(tx_chn->common.ringacc, 275 - tx_chn->udma_tchan_id, 0); 276 - if (!tx_chn->ringtx) { 277 - ret = -ENODEV; 278 - dev_err(dev, "Failed to get TX ring %u\n", 279 - tx_chn->udma_tchan_id); 280 - goto err; 281 - } 282 - 283 - tx_chn->ringtxcq = k3_ringacc_request_ring(tx_chn->common.ringacc, 284 - -1, 0); 285 - if (!tx_chn->ringtxcq) { 286 - ret = -ENODEV; 287 - dev_err(dev, "Failed to get TXCQ ring\n"); 274 + ret = k3_ringacc_request_rings_pair(tx_chn->common.ringacc, 275 + tx_chn->udma_tchan_id, -1, 276 + &tx_chn->ringtx, 277 + &tx_chn->ringtxcq); 278 + if (ret) { 279 + dev_err(dev, "Failed to get TX/TXCQ rings %d\n", ret); 288 280 goto err; 289 281 } 290 282 ··· 579 587 } 580 588 581 589 /* request and cfg rings */ 582 - flow->ringrx = k3_ringacc_request_ring(rx_chn->common.ringacc, 583 - flow_cfg->ring_rxq_id, 0); 584 - if (!flow->ringrx) { 585 - ret = -ENODEV; 586 - dev_err(dev, "Failed to get RX ring\n"); 590 + ret = k3_ringacc_request_rings_pair(rx_chn->common.ringacc, 591 + flow_cfg->ring_rxq_id, 592 + flow_cfg->ring_rxfdq0_id, 593 + &flow->ringrxfdq, 594 + &flow->ringrx); 595 + if (ret) { 596 + dev_err(dev, "Failed to get RX/RXFDQ rings %d\n", ret); 587 597 goto err_rflow_put; 588 - } 589 - 590 - flow->ringrxfdq = k3_ringacc_request_ring(rx_chn->common.ringacc, 591 - flow_cfg->ring_rxfdq0_id, 0); 592 - if (!flow->ringrxfdq) { 593 - ret = -ENODEV; 594 - dev_err(dev, "Failed to get RXFDQ ring\n"); 595 - goto err_ringrx_free; 596 598 } 597 599 598 600 ret = k3_ringacc_ring_cfg(flow->ringrx, &flow_cfg->rx_cfg); ··· 659 673 660 674 err_ringrxfdq_free: 661 675 k3_ringacc_ring_free(flow->ringrxfdq); 662 - 663 - err_ringrx_free: 664 676 k3_ringacc_ring_free(flow->ringrx); 665 677 666 678 err_rflow_put:
+11 -23
drivers/dma/ti/k3-udma.c
··· 1418 1418 if (ret) 1419 1419 return ret; 1420 1420 1421 - uc->tchan->t_ring = k3_ringacc_request_ring(ud->ringacc, 1422 - uc->tchan->id, 0); 1423 - if (!uc->tchan->t_ring) { 1421 + ret = k3_ringacc_request_rings_pair(ud->ringacc, uc->tchan->id, -1, 1422 + &uc->tchan->t_ring, 1423 + &uc->tchan->tc_ring); 1424 + if (ret) { 1424 1425 ret = -EBUSY; 1425 - goto err_tx_ring; 1426 - } 1427 - 1428 - uc->tchan->tc_ring = k3_ringacc_request_ring(ud->ringacc, -1, 0); 1429 - if (!uc->tchan->tc_ring) { 1430 - ret = -EBUSY; 1431 - goto err_txc_ring; 1426 + goto err_ring; 1432 1427 } 1433 1428 1434 1429 memset(&ring_cfg, 0, sizeof(ring_cfg)); ··· 1442 1447 err_ringcfg: 1443 1448 k3_ringacc_ring_free(uc->tchan->tc_ring); 1444 1449 uc->tchan->tc_ring = NULL; 1445 - err_txc_ring: 1446 1450 k3_ringacc_ring_free(uc->tchan->t_ring); 1447 1451 uc->tchan->t_ring = NULL; 1448 - err_tx_ring: 1452 + err_ring: 1449 1453 udma_put_tchan(uc); 1450 1454 1451 1455 return ret; ··· 1493 1499 1494 1500 rflow = uc->rflow; 1495 1501 fd_ring_id = ud->tchan_cnt + ud->echan_cnt + uc->rchan->id; 1496 - rflow->fd_ring = k3_ringacc_request_ring(ud->ringacc, fd_ring_id, 0); 1497 - if (!rflow->fd_ring) { 1502 + ret = k3_ringacc_request_rings_pair(ud->ringacc, fd_ring_id, -1, 1503 + &rflow->fd_ring, &rflow->r_ring); 1504 + if (ret) { 1498 1505 ret = -EBUSY; 1499 - goto err_rx_ring; 1500 - } 1501 - 1502 - rflow->r_ring = k3_ringacc_request_ring(ud->ringacc, -1, 0); 1503 - if (!rflow->r_ring) { 1504 - ret = -EBUSY; 1505 - goto err_rxc_ring; 1506 + goto err_ring; 1506 1507 } 1507 1508 1508 1509 memset(&ring_cfg, 0, sizeof(ring_cfg)); ··· 1522 1533 err_ringcfg: 1523 1534 k3_ringacc_ring_free(rflow->r_ring); 1524 1535 rflow->r_ring = NULL; 1525 - err_rxc_ring: 1526 1536 k3_ringacc_ring_free(rflow->fd_ring); 1527 1537 rflow->fd_ring = NULL; 1528 - err_rx_ring: 1538 + err_ring: 1529 1539 udma_put_rflow(uc); 1530 1540 err_rflow: 1531 1541 udma_put_rchan(uc);
+1 -1
drivers/firmware/ti_sci.c
··· 2 2 /* 3 3 * Texas Instruments System Control Interface Protocol Driver 4 4 * 5 - * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ 6 6 * Nishanth Menon 7 7 */ 8 8
+1 -1
drivers/firmware/ti_sci.h
··· 6 6 * The system works in a message response protocol 7 7 * See: http://processors.wiki.ti.com/index.php/TISCI for details 8 8 * 9 - * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 9 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ 10 10 */ 11 11 12 12 #ifndef __TI_SCI_H
+1 -1
drivers/irqchip/irq-ti-sci-inta.c
··· 2 2 /* 3 3 * Texas Instruments' K3 Interrupt Aggregator irqchip driver 4 4 * 5 - * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Copyright (C) 2018-2019 Texas Instruments Incorporated - https://www.ti.com/ 6 6 * Lokesh Vutla <lokeshvutla@ti.com> 7 7 */ 8 8
+1 -1
drivers/irqchip/irq-ti-sci-intr.c
··· 2 2 /* 3 3 * Texas Instruments' K3 Interrupt Router irqchip driver 4 4 * 5 - * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Copyright (C) 2018-2019 Texas Instruments Incorporated - https://www.ti.com/ 6 6 * Lokesh Vutla <lokeshvutla@ti.com> 7 7 */ 8 8
+1 -1
drivers/reset/reset-ti-sci.c
··· 1 1 /* 2 2 * Texas Instrument's System Control Interface (TI-SCI) reset driver 3 3 * 4 - * Copyright (C) 2015-2017 Texas Instruments Incorporated - http://www.ti.com/ 4 + * Copyright (C) 2015-2017 Texas Instruments Incorporated - https://www.ti.com/ 5 5 * Andrew F. Davis <afd@ti.com> 6 6 * 7 7 * This program is free software; you can redistribute it and/or modify
+135 -65
drivers/soc/ti/k3-ringacc.c
··· 109 109 }; 110 110 111 111 /** 112 + * struct k3_ring_state - Internal state tracking structure 113 + * 114 + * @free: Number of free entries 115 + * @occ: Occupancy 116 + * @windex: Write index 117 + * @rindex: Read index 118 + */ 119 + struct k3_ring_state { 120 + u32 free; 121 + u32 occ; 122 + u32 windex; 123 + u32 rindex; 124 + }; 125 + 126 + /** 112 127 * struct k3_ring - RA Ring descriptor 113 128 * 114 129 * @rt: Ring control/status registers ··· 136 121 * @elm_size: Size of the ring element 137 122 * @mode: Ring mode 138 123 * @flags: flags 139 - * @free: Number of free elements 140 - * @occ: Ring occupancy 141 - * @windex: Write index (only for @K3_RINGACC_RING_MODE_RING) 142 - * @rindex: Read index (only for @K3_RINGACC_RING_MODE_RING) 143 124 * @ring_id: Ring Id 144 125 * @parent: Pointer on struct @k3_ringacc 145 126 * @use_count: Use count for shared rings ··· 154 143 u32 flags; 155 144 #define K3_RING_FLAG_BUSY BIT(1) 156 145 #define K3_RING_FLAG_SHARED BIT(2) 157 - u32 free; 158 - u32 occ; 159 - u32 windex; 160 - u32 rindex; 146 + struct k3_ring_state state; 161 147 u32 ring_id; 162 148 struct k3_ringacc *parent; 163 149 u32 use_count; 164 150 int proxy_id; 151 + }; 152 + 153 + struct k3_ringacc_ops { 154 + int (*init)(struct platform_device *pdev, struct k3_ringacc *ringacc); 165 155 }; 166 156 167 157 /** ··· 183 171 * @tisci: pointer ti-sci handle 184 172 * @tisci_ring_ops: ti-sci rings ops 185 173 * @tisci_dev_id: ti-sci device id 174 + * @ops: SoC specific ringacc operation 186 175 */ 187 176 struct k3_ringacc { 188 177 struct device *dev; ··· 204 191 const struct ti_sci_handle *tisci; 205 192 const struct ti_sci_rm_ringacc_ops *tisci_ring_ops; 206 193 u32 tisci_dev_id; 194 + 195 + const struct k3_ringacc_ops *ops; 207 196 }; 208 197 209 198 static long k3_ringacc_ring_get_fifo_pos(struct k3_ring *ring) ··· 260 245 &ring->ring_mem_dma); 261 246 dev_dbg(dev, "dump elmsize %d, size %d, mode %d, proxy_id %d\n", 262 247 ring->elm_size, ring->size, ring->mode, ring->proxy_id); 248 + dev_dbg(dev, "dump flags %08X\n", ring->flags); 263 249 264 250 dev_dbg(dev, "dump ring_rt_regs: db%08x\n", readl(&ring->rt->db)); 265 251 dev_dbg(dev, "dump occ%08x\n", readl(&ring->rt->occ)); ··· 329 313 } 330 314 EXPORT_SYMBOL_GPL(k3_ringacc_request_ring); 331 315 316 + int k3_ringacc_request_rings_pair(struct k3_ringacc *ringacc, 317 + int fwd_id, int compl_id, 318 + struct k3_ring **fwd_ring, 319 + struct k3_ring **compl_ring) 320 + { 321 + int ret = 0; 322 + 323 + if (!fwd_ring || !compl_ring) 324 + return -EINVAL; 325 + 326 + *fwd_ring = k3_ringacc_request_ring(ringacc, fwd_id, 0); 327 + if (!(*fwd_ring)) 328 + return -ENODEV; 329 + 330 + *compl_ring = k3_ringacc_request_ring(ringacc, compl_id, 0); 331 + if (!(*compl_ring)) { 332 + k3_ringacc_ring_free(*fwd_ring); 333 + ret = -ENODEV; 334 + } 335 + 336 + return ret; 337 + } 338 + EXPORT_SYMBOL_GPL(k3_ringacc_request_rings_pair); 339 + 332 340 static void k3_ringacc_ring_reset_sci(struct k3_ring *ring) 333 341 { 334 342 struct k3_ringacc *ringacc = ring->parent; ··· 379 339 if (!ring || !(ring->flags & K3_RING_FLAG_BUSY)) 380 340 return; 381 341 382 - ring->occ = 0; 383 - ring->free = 0; 384 - ring->rindex = 0; 385 - ring->windex = 0; 342 + memset(&ring->state, 0, sizeof(ring->state)); 386 343 387 344 k3_ringacc_ring_reset_sci(ring); 388 345 } ··· 593 556 594 557 int k3_ringacc_ring_cfg(struct k3_ring *ring, struct k3_ring_cfg *cfg) 595 558 { 596 - struct k3_ringacc *ringacc = ring->parent; 559 + struct k3_ringacc *ringacc; 597 560 int ret = 0; 598 561 599 562 if (!ring || !cfg) 600 563 return -EINVAL; 564 + ringacc = ring->parent; 565 + 601 566 if (cfg->elm_size > K3_RINGACC_RING_ELSIZE_256 || 602 567 cfg->mode >= K3_RINGACC_RING_MODE_INVALID || 603 568 cfg->size & ~K3_RINGACC_CFG_RING_SIZE_ELCNT_MASK || ··· 629 590 ring->size = cfg->size; 630 591 ring->elm_size = cfg->elm_size; 631 592 ring->mode = cfg->mode; 632 - ring->occ = 0; 633 - ring->free = 0; 634 - ring->rindex = 0; 635 - ring->windex = 0; 593 + memset(&ring->state, 0, sizeof(ring->state)); 636 594 637 595 if (ring->proxy_id != K3_RINGACC_PROXY_NOT_USED) 638 596 ring->proxy = ringacc->proxy_target_base + ··· 649 613 ring->ops = NULL; 650 614 ret = -EINVAL; 651 615 goto err_free_proxy; 652 - }; 616 + } 653 617 654 618 ring->ring_mem_virt = dma_alloc_coherent(ringacc->dev, 655 619 ring->size * (4 << ring->elm_size), ··· 700 664 if (!ring || !(ring->flags & K3_RING_FLAG_BUSY)) 701 665 return -EINVAL; 702 666 703 - if (!ring->free) 704 - ring->free = ring->size - readl(&ring->rt->occ); 667 + if (!ring->state.free) 668 + ring->state.free = ring->size - readl(&ring->rt->occ); 705 669 706 - return ring->free; 670 + return ring->state.free; 707 671 } 708 672 EXPORT_SYMBOL_GPL(k3_ringacc_ring_get_free); 709 673 ··· 774 738 "proxy:memcpy_fromio(x): --> ptr(%p), mode:%d\n", ptr, 775 739 access_mode); 776 740 memcpy_fromio(elem, ptr, (4 << ring->elm_size)); 777 - ring->occ--; 741 + ring->state.occ--; 778 742 break; 779 743 case K3_RINGACC_ACCESS_MODE_PUSH_TAIL: 780 744 case K3_RINGACC_ACCESS_MODE_PUSH_HEAD: ··· 782 746 "proxy:memcpy_toio(x): --> ptr(%p), mode:%d\n", ptr, 783 747 access_mode); 784 748 memcpy_toio(ptr, elem, (4 << ring->elm_size)); 785 - ring->free--; 749 + ring->state.free--; 786 750 break; 787 751 default: 788 752 return -EINVAL; 789 753 } 790 754 791 - dev_dbg(ring->parent->dev, "proxy: free%d occ%d\n", ring->free, 792 - ring->occ); 755 + dev_dbg(ring->parent->dev, "proxy: free%d occ%d\n", ring->state.free, 756 + ring->state.occ); 793 757 return 0; 794 758 } 795 759 ··· 844 808 "memcpy_fromio(x): --> ptr(%p), mode:%d\n", ptr, 845 809 access_mode); 846 810 memcpy_fromio(elem, ptr, (4 << ring->elm_size)); 847 - ring->occ--; 811 + ring->state.occ--; 848 812 break; 849 813 case K3_RINGACC_ACCESS_MODE_PUSH_TAIL: 850 814 case K3_RINGACC_ACCESS_MODE_PUSH_HEAD: ··· 852 816 "memcpy_toio(x): --> ptr(%p), mode:%d\n", ptr, 853 817 access_mode); 854 818 memcpy_toio(ptr, elem, (4 << ring->elm_size)); 855 - ring->free--; 819 + ring->state.free--; 856 820 break; 857 821 default: 858 822 return -EINVAL; 859 823 } 860 824 861 - dev_dbg(ring->parent->dev, "free%d index%d occ%d index%d\n", ring->free, 862 - ring->windex, ring->occ, ring->rindex); 825 + dev_dbg(ring->parent->dev, "free%d index%d occ%d index%d\n", 826 + ring->state.free, ring->state.windex, ring->state.occ, 827 + ring->state.rindex); 863 828 return 0; 864 829 } 865 830 ··· 892 855 { 893 856 void *elem_ptr; 894 857 895 - elem_ptr = k3_ringacc_get_elm_addr(ring, ring->windex); 858 + elem_ptr = k3_ringacc_get_elm_addr(ring, ring->state.windex); 896 859 897 860 memcpy(elem_ptr, elem, (4 << ring->elm_size)); 898 861 899 - ring->windex = (ring->windex + 1) % ring->size; 900 - ring->free--; 862 + ring->state.windex = (ring->state.windex + 1) % ring->size; 863 + ring->state.free--; 901 864 writel(1, &ring->rt->db); 902 865 903 866 dev_dbg(ring->parent->dev, "ring_push_mem: free%d index%d\n", 904 - ring->free, ring->windex); 867 + ring->state.free, ring->state.windex); 905 868 906 869 return 0; 907 870 } ··· 910 873 { 911 874 void *elem_ptr; 912 875 913 - elem_ptr = k3_ringacc_get_elm_addr(ring, ring->rindex); 876 + elem_ptr = k3_ringacc_get_elm_addr(ring, ring->state.rindex); 914 877 915 878 memcpy(elem, elem_ptr, (4 << ring->elm_size)); 916 879 917 - ring->rindex = (ring->rindex + 1) % ring->size; 918 - ring->occ--; 880 + ring->state.rindex = (ring->state.rindex + 1) % ring->size; 881 + ring->state.occ--; 919 882 writel(-1, &ring->rt->db); 920 883 921 884 dev_dbg(ring->parent->dev, "ring_pop_mem: occ%d index%d pos_ptr%p\n", 922 - ring->occ, ring->rindex, elem_ptr); 885 + ring->state.occ, ring->state.rindex, elem_ptr); 923 886 return 0; 924 887 } 925 888 ··· 930 893 if (!ring || !(ring->flags & K3_RING_FLAG_BUSY)) 931 894 return -EINVAL; 932 895 933 - dev_dbg(ring->parent->dev, "ring_push: free%d index%d\n", ring->free, 934 - ring->windex); 896 + dev_dbg(ring->parent->dev, "ring_push: free%d index%d\n", 897 + ring->state.free, ring->state.windex); 935 898 936 899 if (k3_ringacc_ring_is_full(ring)) 937 900 return -ENOMEM; ··· 951 914 return -EINVAL; 952 915 953 916 dev_dbg(ring->parent->dev, "ring_push_head: free%d index%d\n", 954 - ring->free, ring->windex); 917 + ring->state.free, ring->state.windex); 955 918 956 919 if (k3_ringacc_ring_is_full(ring)) 957 920 return -ENOMEM; ··· 970 933 if (!ring || !(ring->flags & K3_RING_FLAG_BUSY)) 971 934 return -EINVAL; 972 935 973 - if (!ring->occ) 974 - ring->occ = k3_ringacc_ring_get_occ(ring); 936 + if (!ring->state.occ) 937 + ring->state.occ = k3_ringacc_ring_get_occ(ring); 975 938 976 - dev_dbg(ring->parent->dev, "ring_pop: occ%d index%d\n", ring->occ, 977 - ring->rindex); 939 + dev_dbg(ring->parent->dev, "ring_pop: occ%d index%d\n", ring->state.occ, 940 + ring->state.rindex); 978 941 979 - if (!ring->occ) 942 + if (!ring->state.occ) 980 943 return -ENODATA; 981 944 982 945 if (ring->ops && ring->ops->pop_head) ··· 993 956 if (!ring || !(ring->flags & K3_RING_FLAG_BUSY)) 994 957 return -EINVAL; 995 958 996 - if (!ring->occ) 997 - ring->occ = k3_ringacc_ring_get_occ(ring); 959 + if (!ring->state.occ) 960 + ring->state.occ = k3_ringacc_ring_get_occ(ring); 998 961 999 - dev_dbg(ring->parent->dev, "ring_pop_tail: occ%d index%d\n", ring->occ, 1000 - ring->rindex); 962 + dev_dbg(ring->parent->dev, "ring_pop_tail: occ%d index%d\n", 963 + ring->state.occ, ring->state.rindex); 1001 964 1002 - if (!ring->occ) 965 + if (!ring->state.occ) 1003 966 return -ENODATA; 1004 967 1005 968 if (ring->ops && ring->ops->pop_tail) ··· 1084 1047 ringacc->rm_gp_range); 1085 1048 } 1086 1049 1087 - static int k3_ringacc_probe(struct platform_device *pdev) 1050 + static int k3_ringacc_init(struct platform_device *pdev, 1051 + struct k3_ringacc *ringacc) 1088 1052 { 1089 - struct k3_ringacc *ringacc; 1090 1053 void __iomem *base_fifo, *base_rt; 1091 1054 struct device *dev = &pdev->dev; 1092 1055 struct resource *res; 1093 1056 int ret, i; 1094 - 1095 - ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL); 1096 - if (!ringacc) 1097 - return -ENOMEM; 1098 - 1099 - ringacc->dev = dev; 1100 - mutex_init(&ringacc->req_lock); 1101 1057 1102 1058 dev->msi_domain = of_msi_get_domain(dev, dev->of_node, 1103 1059 DOMAIN_BUS_TI_SCI_INTA_MSI); ··· 1150 1120 ringacc->rings[i].ring_id = i; 1151 1121 ringacc->rings[i].proxy_id = K3_RINGACC_PROXY_NOT_USED; 1152 1122 } 1153 - dev_set_drvdata(dev, ringacc); 1154 1123 1155 1124 ringacc->tisci_ring_ops = &ringacc->tisci->ops.rm_ring_ops; 1156 - 1157 - mutex_lock(&k3_ringacc_list_lock); 1158 - list_add_tail(&ringacc->list, &k3_ringacc_list); 1159 - mutex_unlock(&k3_ringacc_list_lock); 1160 1125 1161 1126 dev_info(dev, "Ring Accelerator probed rings:%u, gp-rings[%u,%u] sci-dev-id:%u\n", 1162 1127 ringacc->num_rings, ··· 1162 1137 ringacc->dma_ring_reset_quirk ? "enabled" : "disabled"); 1163 1138 dev_info(dev, "RA Proxy rev. %08x, num_proxies:%u\n", 1164 1139 readl(&ringacc->proxy_gcfg->revision), ringacc->num_proxies); 1140 + 1165 1141 return 0; 1166 1142 } 1167 1143 1144 + struct ringacc_match_data { 1145 + struct k3_ringacc_ops ops; 1146 + }; 1147 + 1148 + static struct ringacc_match_data k3_ringacc_data = { 1149 + .ops = { 1150 + .init = k3_ringacc_init, 1151 + }, 1152 + }; 1153 + 1168 1154 /* Match table for of_platform binding */ 1169 1155 static const struct of_device_id k3_ringacc_of_match[] = { 1170 - { .compatible = "ti,am654-navss-ringacc", }, 1156 + { .compatible = "ti,am654-navss-ringacc", .data = &k3_ringacc_data, }, 1171 1157 {}, 1172 1158 }; 1159 + 1160 + static int k3_ringacc_probe(struct platform_device *pdev) 1161 + { 1162 + const struct ringacc_match_data *match_data; 1163 + const struct of_device_id *match; 1164 + struct device *dev = &pdev->dev; 1165 + struct k3_ringacc *ringacc; 1166 + int ret; 1167 + 1168 + match = of_match_node(k3_ringacc_of_match, dev->of_node); 1169 + if (!match) 1170 + return -ENODEV; 1171 + match_data = match->data; 1172 + 1173 + ringacc = devm_kzalloc(dev, sizeof(*ringacc), GFP_KERNEL); 1174 + if (!ringacc) 1175 + return -ENOMEM; 1176 + 1177 + ringacc->dev = dev; 1178 + mutex_init(&ringacc->req_lock); 1179 + ringacc->ops = &match_data->ops; 1180 + 1181 + ret = ringacc->ops->init(pdev, ringacc); 1182 + if (ret) 1183 + return ret; 1184 + 1185 + dev_set_drvdata(dev, ringacc); 1186 + 1187 + mutex_lock(&k3_ringacc_list_lock); 1188 + list_add_tail(&ringacc->list, &k3_ringacc_list); 1189 + mutex_unlock(&k3_ringacc_list_lock); 1190 + 1191 + return 0; 1192 + } 1173 1193 1174 1194 static struct platform_driver k3_ringacc_driver = { 1175 1195 .probe = k3_ringacc_probe,
+1 -1
drivers/soc/ti/knav_qmss_acc.c
··· 450 450 return 0; 451 451 } 452 452 453 - struct knav_range_ops knav_acc_range_ops = { 453 + static struct knav_range_ops knav_acc_range_ops = { 454 454 .set_notify = knav_acc_set_notify, 455 455 .init_queue = knav_acc_init_queue, 456 456 .open_queue = knav_acc_open_queue,
+4
include/linux/soc/ti/k3-ringacc.h
··· 107 107 struct k3_ring *k3_ringacc_request_ring(struct k3_ringacc *ringacc, 108 108 int id, u32 flags); 109 109 110 + int k3_ringacc_request_rings_pair(struct k3_ringacc *ringacc, 111 + int fwd_id, int compl_id, 112 + struct k3_ring **fwd_ring, 113 + struct k3_ring **compl_ring); 110 114 /** 111 115 * k3_ringacc_ring_reset - ring reset 112 116 * @ring: pointer on Ring
+1 -1
include/linux/soc/ti/ti_sci_inta_msi.h
··· 2 2 /* 3 3 * Texas Instruments' K3 TI SCI INTA MSI helper 4 4 * 5 - * Copyright (C) 2018-2019 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Copyright (C) 2018-2019 Texas Instruments Incorporated - https://www.ti.com/ 6 6 * Lokesh Vutla <lokeshvutla@ti.com> 7 7 */ 8 8
+3 -3
include/linux/soc/ti/ti_sci_protocol.h
··· 2 2 /* 3 3 * Texas Instruments System Control Interface Protocol 4 4 * 5 - * Copyright (C) 2015-2016 Texas Instruments Incorporated - http://www.ti.com/ 5 + * Copyright (C) 2015-2016 Texas Instruments Incorporated - https://www.ti.com/ 6 6 * Nishanth Menon 7 7 */ 8 8 ··· 226 226 * and destination 227 227 * @set_event_map: Set an Event based peripheral irq to Interrupt 228 228 * Aggregator. 229 - * @free_irq: Free an an IRQ route between the requested source 230 - * destination. 229 + * @free_irq: Free an IRQ route between the requested source 230 + * and destination. 231 231 * @free_event_map: Free an event based peripheral irq to Interrupt 232 232 * Aggregator. 233 233 */