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

soc: ti: qmss: make acc queue support optional in the driver

acc channels are available only if accumulator PDSP is loaded and
running in the SoC. As this requires firmware and user may not have
firmware in the file system, make the accumulator queue support
available in qmss driver optional. To use accumulator queus user needs
to add firmware to the file system and boot up kernel.

Signed-off-by: Murali Karicheri <m-karicheri2@ti.com>
Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>

authored by

Murali Karicheri and committed by
Santosh Shilimkar
04501690 96ee19be

+31 -7
+6
Documentation/arm/keystone/knav-qmss.txt
··· 48 48 "firmware file ks2_qmss_pdsp_acc48.bin downloaded for PDSP" 49 49 50 50 in the boot up log if loading of firmware to PDSP is successful. 51 + 52 + Use of accumulated queues requires the firmware image to be present in the 53 + file system. The driver doesn't acc queues to the supported queue range if 54 + PDSP is not running in the SoC. The API call fails if there is a queue open 55 + request to an acc queue and PDSP is not running. So make sure to copy firmware 56 + to file system before using these queue types.
+2
drivers/soc/ti/knav_qmss.h
··· 137 137 u32 __iomem *iram; 138 138 u32 id; 139 139 struct list_head list; 140 + bool loaded; 141 + bool started; 140 142 }; 141 143 142 144 struct knav_qmgr_info {
+8 -2
drivers/soc/ti/knav_qmss_acc.c
··· 482 482 * Return 0 on success or error 483 483 */ 484 484 int knav_init_acc_range(struct knav_device *kdev, 485 - struct device_node *node, 486 - struct knav_range_info *range) 485 + struct device_node *node, 486 + struct knav_range_info *range) 487 487 { 488 488 struct knav_acc_channel *acc; 489 489 struct knav_pdsp_info *pdsp; ··· 524 524 dev_err(kdev->dev, "pdsp id %d not found for range %s\n", 525 525 info->pdsp_id, range->name); 526 526 return -EINVAL; 527 + } 528 + 529 + if (!pdsp->started) { 530 + dev_err(kdev->dev, "pdsp id %d not started for range %s\n", 531 + info->pdsp_id, range->name); 532 + return -ENODEV; 527 533 } 528 534 529 535 info->pdsp = pdsp;
+15 -5
drivers/soc/ti/knav_qmss_queue.c
··· 1504 1504 dev_err(kdev->dev, "timed out on pdsp %s stop\n", pdsp->name); 1505 1505 return ret; 1506 1506 } 1507 + pdsp->loaded = false; 1508 + pdsp->started = false; 1507 1509 return 0; 1508 1510 } 1509 1511 ··· 1594 1592 int ret; 1595 1593 1596 1594 knav_queue_stop_pdsps(kdev); 1597 - /* now load them all */ 1595 + /* now load them all. We return success even if pdsp 1596 + * is not loaded as acc channels are optional on having 1597 + * firmware availability in the system. We set the loaded 1598 + * and stated flag and when initialize the acc range, check 1599 + * it and init the range only if pdsp is started. 1600 + */ 1598 1601 for_each_pdsp(kdev, pdsp) { 1599 1602 ret = knav_queue_load_pdsp(kdev, pdsp); 1600 - if (ret < 0) 1601 - return ret; 1603 + if (!ret) 1604 + pdsp->loaded = true; 1602 1605 } 1603 1606 1604 1607 for_each_pdsp(kdev, pdsp) { 1605 - ret = knav_queue_start_pdsp(kdev, pdsp); 1606 - WARN_ON(ret); 1608 + if (pdsp->loaded) { 1609 + ret = knav_queue_start_pdsp(kdev, pdsp); 1610 + if (!ret) 1611 + pdsp->started = true; 1612 + } 1607 1613 } 1608 1614 return 0; 1609 1615 }