linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: Reboot using an i2c power-system-controller ?
Date: Thu, 4 Oct 2018 20:08:55 +0200	[thread overview]
Message-ID: <20181004180855.GG4730@lunn.ch> (raw)
In-Reply-To: <20181004162339.19493-1-nicolas.cavallari@green-communications.fr>

On Thu, Oct 04, 2018 at 06:23:37PM +0200, Nicolas Cavallari wrote:
> So i got this ARM board with a rtc controlled by i2c that can also cut
> power.  I want to use it to reboot, because it will also cut power to
> clumsy USB and MMC devices.
> So the natural thing to do would be to just register a restart_handler
> that will kindly do i2c (saw at least a driver doing it), or use
> arm_pm_restart and be done with it.
> 
> Well that what I though.  Most of my naive attempts were met with
> occasional failures and now my understanding is that I do not
> understand why anything works in the first place.

Hi Nicolas

I doubt you can use the platform i2c driver.

If you look at how this is done for sending commands over a UART to a
micro-controller, you will see the reset driver hijack the UART
device. They poke registers with the require baud rate settings, and
then poke registers with the bytes to send, polling for completion of
each byte if needed.

To get this working reliably, i suspect you are going to need to do
the same with your i2c bus controller. Directly control it, stop any
in progress transfers, setup a new transfer, and hope you can do it
polled IO, not DMA.

       Andrew

      parent reply	other threads:[~2018-10-04 18:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-04 16:23 Reboot using an i2c power-system-controller ? Nicolas Cavallari
2018-10-04 16:23 ` [RFC 1/2] reboot: Make restart_handler_list a blocking notifier chain Nicolas Cavallari
2018-10-04 16:49   ` Russell King - ARM Linux
2018-10-05  8:27     ` Nicolas Cavallari
2018-10-05  8:39       ` Russell King - ARM Linux
2018-10-04 16:23 ` [RFC UGLY 2/2] arm: Re-enable interrupts after shutting down non-boot CPUs Nicolas Cavallari
2018-10-04 18:08 ` Andrew Lunn [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181004180855.GG4730@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).