Dump PMIC configuration for i.MX6Q

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

Dump PMIC configuration for i.MX6Q

1,778 Views
riteshpatel
Contributor II

Hi ,

We are using i.MX6Q on our custom board, with pf0100 PMIC.

We want to configure above PMIC in dump PMIC mode to shut down the processor by Linux "poweroff" command.

I found that there are two bits of the register "SNVS_LPCR" we need to set for the above functions. 

We have found that the initialization code if written in the "drivers/input/keyboard/snvs_pwrkey.c - imx_snvs_pwrkey_probe() " file, where dump PMIC mode is being set inside the "Turn off System Power'" function, please let us know how we can set the "Turn off System Power(TOP)" bit of the register?

 

As per our understanding, after above configurations "PMIC_ON_REQ" pin should go low, to turn off the PMIC.

I have written the above register in the imx_snvs_pwrkey_probe() function, however still the above pin is high, please support for the changes required for the same/

Regards.

Ritesh

Labels (1)
0 Kudos
Reply
3 Replies

1,189 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ritesh

for sw control PMIC_ON_REQ pin one can look at patch on

Q&A: How is mx6 PMIC_ON_REQ under SW control? 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,189 Views
riteshpatel
Contributor II

Hi Igor,

Thank you for the reply, we have found the driver, however, still, we are not getting system shutdown working. We have enabled the CONFIG_POWER_RESET_IMX driver from the kernel menuconfig and added following device tree node for the same, under the snvs section of the device tree in imx6qdl.dtsi file.

+ snvs_poweroff: snvs-poweroff@38 {
+       compatible = "fsl,sec-v4.0-poweroff";


+ };

However, we are not getting ioremap memory with the above device tree changes, we are getting"failed to get memory", error while writing the code. please suggest the next steps for debugging.

******************************************************

/* Power off driver for i.mx6
* Copyright (c) 2014, FREESCALE CORPORATION. All rights reserved.
*
* based on msm-poweroff.c
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/

#include <linux/err.h>
#include <linux/init.h>
#include <linux/io.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_address.h>
#include <linux/platform_device.h>

static void __iomem *snvs_base;

static void do_imx_poweroff(void)
{
u32 value = readl(snvs_base);

/* set TOP and DP_EN bit */
writel(value | 0x60, snvs_base);
}

static int imx_poweroff_probe(struct platform_device *pdev)
{
snvs_base = of_iomap(pdev->dev.of_node, 0);
if (!snvs_base) {
dev_err(&pdev->dev, "failed to get memory\n");
return -ENODEV;
}

pm_power_off = do_imx_poweroff;
return 0;
}

static const struct of_device_id of_imx_poweroff_match[] = {
{ .compatible = "fsl,sec-v4.0-poweroff", },
{},
};
MODULE_DEVICE_TABLE(of, of_imx_poweroff_match);

static struct platform_driver imx_poweroff_driver = {
.probe = imx_poweroff_probe,
.driver = {
.name = "imx-snvs-poweroff",
.of_match_table = of_match_ptr(of_imx_poweroff_match),
},
};

static int __init imx_poweroff_init(void)
{
return platform_driver_register(&imx_poweroff_driver);
}
device_initcall(imx_poweroff_init);

********************************************************

Please let us know the correct device tree entry, looks like it is not proper, please mention changes for the same

Regards.

0 Kudos
Reply

1,189 Views
igorpadykov
NXP Employee
NXP Employee

Hi Ritesh

what bsp used in the case, please try with nxp release

linux-imx - i.MX Linux kernel 

Best regards
igor

0 Kudos
Reply