How to access SPI from reboot.c file

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

How to access SPI from reboot.c file

703 Views
lalabhaidesai
Contributor I

Hello,

I am using i.MX6UL and i want to access the SPI from "void kernel_power_off(void)" function before shutdown process. so please guide me that how can i access SPI from this function which is in reboot.c file. I want to send some data to my slave device using SPI from this function. I have accessed SPI from user space using spidev and it is working fine. But i could not able to access it from reboot.c file so please guide me ASAP. Thanks in advance.

Labels (1)
0 Kudos
2 Replies

497 Views
igorpadykov
NXP Employee
NXP Employee

Hi Lalabhai

please refer to spi ioctls described in linux/Documentation/spi/spidev

linux-imx.git - i.MX Linux Kernel 

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

0 Kudos

497 Views
lalabhaidesai
Contributor I

Hello sir,

Thanks for your quick response, but I still not able to access SPI from reboot.c kernel file. I want to access the SPI from kernel's file "reboot.c" directly, not from user space. So what should I have to do? please guide.

Function from where I want to access SPI is shown below,

/**
 * kernel_power_off - power_off the system
 *
 * Shutdown everything and perform a clean system power_off.
 */
void kernel_power_off(void)
{
 kernel_shutdown_prepare(SYSTEM_POWER_OFF);
 if (pm_power_off_prepare)
  pm_power_off_prepare();
 migrate_to_reboot_cpu();
 syscore_shutdown();
 pr_emerg("Power down");
 kmsg_dump(KMSG_DUMP_POWEROFF);
 machine_power_off();
}
0 Kudos