Whether the system shutdown function sends PON commands to eMMC on iMx8DualX QNX platform ?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Whether the system shutdown function sends PON commands to eMMC on iMx8DualX QNX platform ?

1,307 Views
Richard__Wang
Contributor I

Hello experts,

    We call the function "shutdown_system_with_reason()" when we want to shutdown our iMx8DualX board, while we want to know whether this function that you supplied sends PON command to eMMC or not ?

    Thanks a lot.

Best regards,

Richard

0 Kudos
4 Replies

1,243 Views
zdenek_zadera
NXP Employee
NXP Employee

Hello @Richard__Wang,

I have checked for the mentioned function. It is not implemnted in BSP by NXP, but provided by QNX as kernel function. I have asked QNX and here is information regarding sending PON to eMMC.

1. requires the driver to be started with:

          pwroff_notify=[short|long] - Set power off notification mode for the eMMC. The notification can either be short or long.

2. the driver need to be terminated to trigger power off notification sequence so if shutdown terminates the driver and it is started with that option, it should occur.

 

Best Regards,

Zdenek

1,208 Views
Richard__Wang
Contributor I

Hello Zdenek,

    Thank you very much for your attention and support!

    We have a detail request for the previous question as below:

    The i.Mx8DualX board uses function "devb-sdmmc-mx8x()" to manage the emmc driver, which is provided by QNX.  Our new question is : "After executing shutdown_system_with_reason(), will devb-sdmmc-mx8x() send PON instructions to EMMC?

    Thanks a lot.

Best Regards,

Richard

0 Kudos

1,052 Views
zdenek_zadera
NXP Employee
NXP Employee

Hello Richard,

yes, this is the right driver. You just need to start the driver devb-sdmmc-mx8x()  with mentioned parameter "pwroff_notify=[short|long]".

Then, when you call shutdown function, the driver will be closed by system, then the driver should send PON to eMMC during closing.

Regards,

Zdenek

0 Kudos

1,062 Views
JudyJeo
Contributor III

If you read the linux source code and check the emmc status at runtime. 

You will find the linux mmc driver, which is NXP BSP based on, already use Power Off Notification 

linux/drivers/mmc/core/sd.c:1110: /* Power Off Notification support at bit 4. */
linux/drivers/mmc/core/sd.c:1629: * one byte offset and is one byte long. The Power Off Notification
linux/drivers/mmc/core/sd.c:1655: * Set the Power Off Notification bit in the power management settings
linux/drivers/mmc/core/mmc.c:1984: pr_err("%s: Power Off Notification timed out, %u\n",

 

static int _mmc_suspend(struct mmc_host *host, bool is_suspend)
{
int err = 0;
unsigned int notify_type = is_suspend ? EXT_CSD_POWER_OFF_SHORT :
EXT_CSD_POWER_OFF_LONG;

mmc_claim_host(host);

if (mmc_card_suspended(host->card))
goto out;

err = _mmc_flush_cache(host);
if (err)
goto out;

if (mmc_can_poweroff_notify(host->card) &&
((host->caps2 & MMC_CAP2_FULL_PWR_CYCLE) || !is_suspend ||
(host->caps2 & MMC_CAP2_FULL_PWR_CYCLE_IN_SUSPEND)))
err = mmc_poweroff_notify(host->card, notify_type);
else if (mmc_can_sleep(host->card))
err = mmc_sleep(host);
else if (!mmc_host_is_spi(host))
err = mmc_deselect_cards(host);

if (!err) {
mmc_power_off(host);
mmc_card_set_suspended(host->card);
}
out:
mmc_release_host(host);
return err;
}

static int mmc_poweroff_notify(struct mmc_card *card, unsigned int notify_type)
{
unsigned int timeout = card->ext_csd.generic_cmd6_time;
int err;

/* Use EXT_CSD_POWER_OFF_SHORT as default notification type. */
if (notify_type == EXT_CSD_POWER_OFF_LONG)
timeout = card->ext_csd.power_off_longtime;

err = __mmc_switch(card, EXT_CSD_CMD_SET_NORMAL,
EXT_CSD_POWER_OFF_NOTIFICATION,
notify_type, timeout, 0, false, false, MMC_CMD_RETRIES);
if (err)
pr_err("%s: Power Off Notification timed out, %u\n",
mmc_hostname(card->host), timeout);

/* Disable the power off notification after the switch operation. */
card->ext_csd.power_off_notification = EXT_CSD_NO_POWER_NOTIFICATION;

return err;
}

 

Here is check on board

root@imx8qxpc0mek:~# mmc extcsd read /dev/mmcblk0
=============================================
Extended CSD rev 1.7 (MMC 5.0)
=============================================

Card Supported Command sets [S_CMD_SET: 0x01]
HPI Features [HPI_FEATURE: 0x01]: implementation based on CMD13
Background operations support [BKOPS_SUPPORT: 0x01]
Max Packet Read Cmd [MAX_PACKED_READS: 0x3f]
Max Packet Write Cmd [MAX_PACKED_WRITES: 0x3f]
Data TAG support [DATA_TAG_SUPPORT: 0x01]
Data TAG Unit Size [TAG_UNIT_SIZE: 0x03]
Tag Resources Size [TAG_RES_SIZE: 0x00]
Context Management Capabilities [CONTEXT_CAPABILITIES: 0x05]
Large Unit Size [LARGE_UNIT_SIZE_M1: 0x03]
Extended partition attribute support [EXT_SUPPORT: 0x03]
Generic CMD6 Timer [GENERIC_CMD6_TIME: 0x0a]
Power off notification [POWER_OFF_LONG_TIME: 0x32]
Cache Size [CACHE_SIZE] is 8192 KiB
Background operations status [BKOPS_STATUS: 0x00]
....
......
......
Context configuration [CONTEXT_CONF[39]]: 0x00
Context configuration [CONTEXT_CONF[38]]: 0x00
Context configuration [CONTEXT_CONF[37]]: 0x00
Packed command status [PACKED_COMMAND_STATUS]: 0x00
Packed command failure index [PACKED_FAILURE_INDEX]: 0x00
Power Off Notification [POWER_OFF_NOTIFICATION]: 0x01
Control to turn the Cache ON/OFF [CACHE_CTRL]: 0x01
eMMC Firmware Version: 85Q0002R

eMMC JEDEC SPEC

Untitled.png

0 Kudos