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.

mailbox: omap-mailbox: Check for pending msgs only when mbox is exclusive

On TI K3 devices, the mailbox resides in the Always-On power domain
(LPSC_main_alwayson) and is shared among multiple processors. The
mailbox is not solely exclusive to Linux.

Currently, the suspend path checks all FIFO queues for pending messages
and blocks suspend if any are present. This behavior is unnecessary for
K3 devices, since some of the FIFOs are used for RTOS<->RTOS
communication and are independent of Linux.

For FIFOs used in Linux<->RTOS communication, any pending message would
trigger an interrupt, which naturally prevents suspend from completing.
Hence, there is no need for the mailbox driver to explicitly check for
pending messages on K3 platforms.

Introduce a device match flag to indicate whether the mailbox instance
is exclusive to Linux, and skip the pending message check for
non-exclusive instances (such as in K3).

Fixes: a49f991e740f ("arm64: dts: ti: k3-am62-verdin: Add missing cfg for TI IPC Firmware")
Closes: https://lore.kernel.org/all/sid7gtg5vay5qgicsl6smnzwg5mnneoa35cempt5ddwjvedaio@hzsgcx6oo74l/
Signed-off-by: Beleswar Padhi <b-padhi@ti.com>
Tested-by: Hiago De Franco <hiago.franco@toradex.com>
Reviewed-by: Andrew Davis <afd@ti.com>
Signed-off-by: Jassi Brar <jassisinghbrar@gmail.com>

authored by

Beleswar Padhi and committed by
Jassi Brar
060e4e83 ac3fd01e

+20 -15
+20 -15
drivers/mailbox/omap-mailbox.c
··· 68 68 69 69 struct omap_mbox_match_data { 70 70 u32 intr_type; 71 + bool is_exclusive; 71 72 }; 72 73 73 74 struct omap_mbox_device { ··· 79 78 u32 num_users; 80 79 u32 num_fifos; 81 80 u32 intr_type; 81 + const struct omap_mbox_match_data *mbox_data; 82 82 }; 83 83 84 84 struct omap_mbox { ··· 343 341 if (pm_runtime_status_suspended(dev)) 344 342 return 0; 345 343 346 - for (fifo = 0; fifo < mdev->num_fifos; fifo++) { 347 - if (mbox_read_reg(mdev, MAILBOX_MSGSTATUS(fifo))) { 348 - dev_err(mdev->dev, "fifo %d has unexpected unread messages\n", 349 - fifo); 350 - return -EBUSY; 344 + if (mdev->mbox_data->is_exclusive) { 345 + for (fifo = 0; fifo < mdev->num_fifos; fifo++) { 346 + if (mbox_read_reg(mdev, MAILBOX_MSGSTATUS(fifo))) { 347 + dev_err(mdev->dev, "fifo %d has unexpected unread messages\n", 348 + fifo); 349 + return -EBUSY; 350 + } 351 351 } 352 352 } 353 353 ··· 382 378 SET_SYSTEM_SLEEP_PM_OPS(omap_mbox_suspend, omap_mbox_resume) 383 379 }; 384 380 385 - static const struct omap_mbox_match_data omap2_data = { MBOX_INTR_CFG_TYPE1 }; 386 - static const struct omap_mbox_match_data omap4_data = { MBOX_INTR_CFG_TYPE2 }; 381 + static const struct omap_mbox_match_data omap2_data = { MBOX_INTR_CFG_TYPE1, true }; 382 + static const struct omap_mbox_match_data omap4_data = { MBOX_INTR_CFG_TYPE2, true }; 383 + static const struct omap_mbox_match_data am654_data = { MBOX_INTR_CFG_TYPE2, false }; 387 384 388 385 static const struct of_device_id omap_mailbox_of_match[] = { 389 386 { ··· 401 396 }, 402 397 { 403 398 .compatible = "ti,am654-mailbox", 404 - .data = &omap4_data, 399 + .data = &am654_data, 405 400 }, 406 401 { 407 402 .compatible = "ti,am64-mailbox", 408 - .data = &omap4_data, 403 + .data = &am654_data, 409 404 }, 410 405 { 411 406 /* end */ ··· 454 449 struct omap_mbox_fifo *fifo; 455 450 struct device_node *node = pdev->dev.of_node; 456 451 struct device_node *child; 457 - const struct omap_mbox_match_data *match_data; 458 452 struct mbox_controller *controller; 459 453 u32 intr_type, info_count; 460 454 u32 num_users, num_fifos; ··· 465 461 pr_err("%s: only DT-based devices are supported\n", __func__); 466 462 return -ENODEV; 467 463 } 468 - 469 - match_data = of_device_get_match_data(&pdev->dev); 470 - if (!match_data) 471 - return -ENODEV; 472 - intr_type = match_data->intr_type; 473 464 474 465 if (of_property_read_u32(node, "ti,mbox-num-users", &num_users)) 475 466 return -ENODEV; ··· 481 482 mdev = devm_kzalloc(&pdev->dev, sizeof(*mdev), GFP_KERNEL); 482 483 if (!mdev) 483 484 return -ENOMEM; 485 + 486 + mdev->mbox_data = device_get_match_data(&pdev->dev); 487 + if (!mdev->mbox_data) 488 + return -ENODEV; 489 + 490 + intr_type = mdev->mbox_data->intr_type; 484 491 485 492 mdev->mbox_base = devm_platform_ioremap_resource(pdev, 0); 486 493 if (IS_ERR(mdev->mbox_base))