Skip to content

Commit a1c4313

Browse files
Kumari Pallaviquic-vkatoch
authored andcommitted
BACKPORT: misc: fastrpc: Update dma_bits for CDSP support on Kaanapali SoC
DSP currently supports 32-bit IOVA (32-bit PA + 4-bit SID) for both Q6 and user DMA (uDMA) access. This is being upgraded to 34-bit PA + 4-bit SID due to a hardware revision in CDSP for Kaanapali SoC, which expands the DMA addressable range. Update DMA bits configuration in the driver to support CDSP on Kaanapali SoC. Set the default `dma_bits` to 32-bit and update it to 34-bit based on CDSP and OF matching on the fastrpc node. Link: https://lore.kernel.org/all/[email protected]/ Signed-off-by: Kumari Pallavi <[email protected]> Reviewed-by: Dmitry Baryshkov <[email protected]> Signed-off-by: Vinayak Katoch <[email protected]>
1 parent 5903aac commit a1c4313

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

drivers/misc/fastrpc.c

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ struct fastrpc_session_ctx {
276276

277277
struct fastrpc_soc_data {
278278
u32 sid_pos;
279+
u32 dma_addr_bits_cdsp;
280+
u32 dma_addr_bits_default;
279281
};
280282

281283
struct fastrpc_channel_ctx {
@@ -2317,6 +2319,7 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
23172319
int i, sessions = 0;
23182320
unsigned long flags;
23192321
int rc;
2322+
u32 dma_bits;
23202323

23212324
cctx = dev_get_drvdata(dev->parent);
23222325
if (!cctx)
@@ -2330,12 +2333,16 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
23302333
spin_unlock_irqrestore(&cctx->lock, flags);
23312334
return -ENOSPC;
23322335
}
2336+
dma_bits = cctx->soc_data->dma_addr_bits_default;
23332337
sess = &cctx->session[cctx->sesscount++];
23342338
sess->used = false;
23352339
sess->valid = true;
23362340
sess->dev = dev;
23372341
dev_set_drvdata(dev, sess);
23382342

2343+
if (cctx->domain_id == CDSP_DOMAIN_ID)
2344+
dma_bits = cctx->soc_data->dma_addr_bits_cdsp;
2345+
23392346
if (of_property_read_u32(dev->of_node, "reg", &sess->sid))
23402347
dev_info(dev, "FastRPC Session ID not specified in DT\n");
23412348

@@ -2350,9 +2357,9 @@ static int fastrpc_cb_probe(struct platform_device *pdev)
23502357
}
23512358
}
23522359
spin_unlock_irqrestore(&cctx->lock, flags);
2353-
rc = dma_set_mask(dev, DMA_BIT_MASK(32));
2360+
rc = dma_set_mask(dev, DMA_BIT_MASK(dma_bits));
23542361
if (rc) {
2355-
dev_err(dev, "32-bit DMA enable failed\n");
2362+
dev_err(dev, "%u-bit DMA enable failed\n", dma_bits);
23562363
return rc;
23572364
}
23582365

@@ -2439,10 +2446,14 @@ static int fastrpc_get_domain_id(const char *domain)
24392446

24402447
static const struct fastrpc_soc_data kaanapali_soc_data = {
24412448
.sid_pos = 56,
2449+
.dma_addr_bits_cdsp = 34,
2450+
.dma_addr_bits_default = 32,
24422451
};
24432452

24442453
static const struct fastrpc_soc_data default_soc_data = {
24452454
.sid_pos = 32,
2455+
.dma_addr_bits_cdsp = 32,
2456+
.dma_addr_bits_default = 32,
24462457
};
24472458

24482459
static int fastrpc_rpmsg_probe(struct rpmsg_device *rpdev)

0 commit comments

Comments
 (0)