Skip to content

Commit 96ee19b

Browse files
Murali KaricheriSantoshShilimkar
authored andcommitted
soc: ti: add firmware file name as part of the driver
Currently firmware file name is included in the DTS. This is not scalable as user has to change the DTS if they need upgrade to a new firmware. Instead, add the firmware file name in the driver itself. As long as there is no API change, new firmware upgrade is easy and require no driver change. User is expected to copy the firmware image to the file system and add a sym link to the new firmware for doing an upgrade. Driver add a array of firmware file names to search for the available firmware blobs. This scheme also prepare the driver for future changes to API if ever happens. In such case it is assumed that driver needs to change to accommodate the new firmware and new firmware file name will get added to the array. Also update the DT document to remove the firmware attribute and add description about firmware in the driver documentation. Signed-off-by: Murali Karicheri <m-karicheri2@ti.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Santosh Shilimkar <ssantosh@kernel.org>
1 parent 29204a8 commit 96ee19b

4 files changed

Lines changed: 54 additions & 21 deletions

File tree

‎Documentation/arm/keystone/knav-qmss.txt‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,29 @@ pool management.
2222
knav qmss driver provides a set of APIs to drivers to open/close qmss queues,
2323
allocate descriptor pools, map the descriptors, push/pop to queues etc. For
2424
details of the available APIs, please refers to include/linux/soc/ti/knav_qmss.h
25+
26+
DT documentation is available at
27+
Documentation/devicetree/bindings/soc/ti/keystone-navigator-qmss.txt
28+
29+
Accumulator QMSS queues using PDSP firmware
30+
============================================
31+
The QMSS PDSP firmware support accumulator channel that can monitor a single
32+
queue or multiple contiguous queues. drivers/soc/ti/knav_qmss_acc.c is the
33+
driver that interface with the accumulator PDSP. This configures
34+
accumulator channels defined in DTS (example in DT documentation) to monitor
35+
1 or 32 queues per channel. More description on the firmware is available in
36+
CPPI/QMSS Low Level Driver document (docs/CPPI_QMSS_LLD_SDS.pdf) at
37+
git://git.ti.com/keystone-rtos/qmss-lld.git
38+
39+
k2_qmss_pdsp_acc48_k2_le_1_0_0_9.bin firmware supports upto 48 accumulator
40+
channels. This firmware is available under ti-keystone folder of
41+
firmware.git at
42+
git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
43+
44+
To use copy the firmware image to lib/firmware folder of the initramfs or
45+
ubifs file system and provide a sym link to k2_qmss_pdsp_acc48_k2_le_1_0_0_9.bin
46+
in the file system and boot up the kernel. User would see
47+
48+
"firmware file ks2_qmss_pdsp_acc48.bin downloaded for PDSP"
49+
50+
in the boot up log if loading of firmware to PDSP is successful.

‎Documentation/devicetree/bindings/soc/ti/keystone-navigator-qmss.txt‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ qmss: qmss@2a40000 {
221221
#size-cells = <1>;
222222
ranges;
223223
pdsp0@0x2a10000 {
224-
firmware = "keystone/qmss_pdsp_acc48_k2_le_1_0_0_8.fw";
225224
reg = <0x2a10000 0x1000>,
226225
<0x2a0f000 0x100>,
227226
<0x2a0c000 0x3c8>,

‎drivers/soc/ti/knav_qmss.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ struct knav_pdsp_info {
135135
};
136136
void __iomem *intd;
137137
u32 __iomem *iram;
138-
const char *firmware;
139138
u32 id;
140139
struct list_head list;
141140
};

‎drivers/soc/ti/knav_qmss_queue.c‎

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ static DEFINE_MUTEX(knav_dev_lock);
6868
idx < (kdev)->num_queues_in_use; \
6969
idx++, inst = knav_queue_idx_to_inst(kdev, idx))
7070

71+
/* All firmware file names end up here. List the firmware file names below.
72+
* Newest followed by older ones. Search is done from start of the array
73+
* until a firmware file is found.
74+
*/
75+
const char *knav_acc_firmwares[] = {"ks2_qmss_pdsp_acc48.bin"};
76+
7177
/**
7278
* knav_queue_notify: qmss queue notfier call
7379
*
@@ -1439,7 +1445,6 @@ static int knav_queue_init_pdsps(struct knav_device *kdev,
14391445
struct device *dev = kdev->dev;
14401446
struct knav_pdsp_info *pdsp;
14411447
struct device_node *child;
1442-
int ret;
14431448

14441449
for_each_child_of_node(pdsps, child) {
14451450
pdsp = devm_kzalloc(dev, sizeof(*pdsp), GFP_KERNEL);
@@ -1448,17 +1453,6 @@ static int knav_queue_init_pdsps(struct knav_device *kdev,
14481453
return -ENOMEM;
14491454
}
14501455
pdsp->name = knav_queue_find_name(child);
1451-
ret = of_property_read_string(child, "firmware",
1452-
&pdsp->firmware);
1453-
if (ret < 0 || !pdsp->firmware) {
1454-
dev_err(dev, "unknown firmware for pdsp %s\n",
1455-
pdsp->name);
1456-
devm_kfree(dev, pdsp);
1457-
continue;
1458-
}
1459-
dev_dbg(dev, "pdsp name %s fw name :%s\n", pdsp->name,
1460-
pdsp->firmware);
1461-
14621456
pdsp->iram =
14631457
knav_queue_map_reg(kdev, child,
14641458
KNAV_QUEUE_PDSP_IRAM_REG_INDEX);
@@ -1489,9 +1483,9 @@ static int knav_queue_init_pdsps(struct knav_device *kdev,
14891483
}
14901484
of_property_read_u32(child, "id", &pdsp->id);
14911485
list_add_tail(&pdsp->list, &kdev->pdsps);
1492-
dev_dbg(dev, "added pdsp %s: command %p, iram %p, regs %p, intd %p, firmware %s\n",
1486+
dev_dbg(dev, "added pdsp %s: command %p, iram %p, regs %p, intd %p\n",
14931487
pdsp->name, pdsp->command, pdsp->iram, pdsp->regs,
1494-
pdsp->intd, pdsp->firmware);
1488+
pdsp->intd);
14951489
}
14961490
return 0;
14971491
}
@@ -1518,14 +1512,29 @@ static int knav_queue_load_pdsp(struct knav_device *kdev,
15181512
{
15191513
int i, ret, fwlen;
15201514
const struct firmware *fw;
1515+
bool found = false;
15211516
u32 *fwdata;
15221517

1523-
ret = request_firmware(&fw, pdsp->firmware, kdev->dev);
1524-
if (ret) {
1525-
dev_err(kdev->dev, "failed to get firmware %s for pdsp %s\n",
1526-
pdsp->firmware, pdsp->name);
1527-
return ret;
1518+
for (i = 0; i < ARRAY_SIZE(knav_acc_firmwares); i++) {
1519+
if (knav_acc_firmwares[i]) {
1520+
ret = request_firmware(&fw,
1521+
knav_acc_firmwares[i],
1522+
kdev->dev);
1523+
if (!ret) {
1524+
found = true;
1525+
break;
1526+
}
1527+
}
1528+
}
1529+
1530+
if (!found) {
1531+
dev_err(kdev->dev, "failed to get firmware for pdsp\n");
1532+
return -ENODEV;
15281533
}
1534+
1535+
dev_info(kdev->dev, "firmware file %s downloaded for PDSP\n",
1536+
knav_acc_firmwares[i]);
1537+
15291538
writel_relaxed(pdsp->id + 1, pdsp->command + 0x18);
15301539
/* download the firmware */
15311540
fwdata = (u32 *)fw->data;

0 commit comments

Comments
 (0)