From: Sebastian Reichel <sre-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Roger Shimizu <rogershimizu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>,
Ryan Tandy <ryan-pRYBVO4bdZ33fQ9qLvQP4Q@public.gmane.org>,
Martin Michlmayr <tbm-R+vWnYXSFMfQT0dZR+AlfA@public.gmane.org>,
Sylver Bruneau
<sylver.bruneau-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
Herbert Valerio Riedel <hvr-mXXj517/zsQ@public.gmane.org>,
Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v2] power: reset: add linkstation-reset driver
Date: Wed, 21 Dec 2016 16:59:29 +0100 [thread overview]
Message-ID: <20161221155929.o4ihvqezbuqx2stl@earth> (raw)
In-Reply-To: <CAEQ9gEnQEHdcA4ox3teOXKcrdf2AAqUMp=A6W6c7nXhk4VrKiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2141 bytes --]
Hi,
On Tue, Dec 20, 2016 at 02:37:39AM +0900, Roger Shimizu wrote:
> [...]
>
> >> +static void linkstation_reset(void)
> >> +{
> >> + const unsigned divisor = ((tclk + (8 * cfg->baud)) / (16 * cfg->baud));
> >> +
> >> + pr_err("%s: triggering power-off...\n", __func__);
> >> +
> >> + /* hijack UART1 and reset into sane state */
> >> + writel(0x83, UART1_REG(LCR));
> >> + writel(divisor & 0xff, UART1_REG(DLL));
> >> + writel((divisor >> 8) & 0xff, UART1_REG(DLM));
> >> + writel(cfg->magic[0], UART1_REG(LCR));
> >> + writel(cfg->magic[1], UART1_REG(IER));
> >> + writel(cfg->magic[2], UART1_REG(FCR));
> >> + writel(cfg->magic[3], UART1_REG(MCR));
> >> +
> >> + /* send the power-off command to PIC */
> >> + if(cfg->cmd[0][0] == 1 && cfg->cmd[1][0] == 0) {
> >> + /* if it's simply one-byte command, send it directly */
> >> + writel(cfg->cmd[0][1], UART1_REG(TX));
> >> + }
> >
> > I guess this optimization can be dropped and you can directly
> > call the for loop with uart1_micon_send().
>
> Same response regarding above two comments.
> The code is extensible because I want to extend in the future.
>
> Current implementation is just for Linkstation Pro / KuroBox Pro to be
> able to power-off.
> But for some other model of Linkstation, restart also need similar
> command via UART1.
>
> Just one example, Linkstation Pro is ARM based, but it was PowerPC based before.
> And the device support still exists in kernel tree:
> arch/powerpc/platforms/embedded6xx/linkstation.c
> arch/powerpc/platforms/embedded6xx/ls_uart.c
> It shows sending "C" to restart and sending "E" to power-off for
> PowerPC based Linkstation.
>
> I'm not actually interested in PowerPC based Linkstation, it's just an
> example to show the reason to be flexible.
>
> If other part is fine, may I send the v3 patch after merging
> linkstation-common.c into linkstation-reset.c?
> Thank you!
These models can just be added to qnap-poweroff, which handles
exactly this special case as far as I can see.
-- Sebastian
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2016-12-21 15:59 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20161207172415.9776-1-rogershimizu@gmail.com>
[not found] ` <20161216100501.18173-1-rogershimizu@gmail.com>
2016-12-19 15:38 ` [PATCH v2] power: reset: add linkstation-reset driver Sebastian Reichel
2016-12-19 16:03 ` Andrew Lunn
2016-12-19 16:12 ` Roger Shimizu
2016-12-19 17:37 ` Roger Shimizu
[not found] ` <CAEQ9gEnQEHdcA4ox3teOXKcrdf2AAqUMp=A6W6c7nXhk4VrKiw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-12-21 15:59 ` Sebastian Reichel [this message]
2016-12-21 16:41 ` Andrew Lunn
[not found] ` <20161221164136.GM30952-g2DYL2Zd6BY@public.gmane.org>
2016-12-22 14:49 ` Sebastian Reichel
2016-12-26 16:13 ` Roger Shimizu
2016-12-27 7:06 ` [PATCH v3 0/3] make kurobox-pro be able to shutdown after device-tree migration Roger Shimizu
2016-12-27 7:06 ` [PATCH v3 1/3] power: reset: add linkstation-reset driver Roger Shimizu
[not found] ` <20161227070611.14852-2-rogershimizu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-03 5:19 ` Florian Fainelli
2017-01-03 13:09 ` Andrew Lunn
2017-01-03 14:08 ` Roger Shimizu
[not found] ` <CAEQ9gE=MoQcr3eX0DAxZtvx0FW9pzgkUGjdxKHcsKwH7_+UsUw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-01-03 18:39 ` Florian Fainelli
2016-12-27 7:06 ` [PATCH v3 2/3] DT: bingdings: power: reset: add linkstation-reset doc Roger Shimizu
2017-01-03 5:21 ` Florian Fainelli
2017-01-03 13:12 ` Andrew Lunn
2017-01-03 14:11 ` Roger Shimizu
2017-01-03 17:09 ` Rob Herring
2017-01-06 12:18 ` Roger Shimizu
2016-12-27 7:06 ` [PATCH v3 3/3] ARM: DT: add power-off support to linkstation lsgl and kuroboxpro Roger Shimizu
2017-01-07 15:04 ` [PATCH v4 0/2] make kurobox-pro be able to shutdown after device-tree migration Roger Shimizu
[not found] ` <20170107150451.17912-1-rogershimizu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2017-01-07 15:04 ` [PATCH v4 1/2] power: reset: add linkstation-reset driver Roger Shimizu
2017-01-08 17:02 ` Ryan Tandy
2017-01-09 3:31 ` Roger Shimizu
2017-01-09 5:43 ` Ryan Tandy
2017-01-18 12:08 ` Roger Shimizu
2017-01-19 4:43 ` Sebastian Reichel
2017-01-26 15:28 ` Gregory CLEMENT
2017-01-26 15:33 ` Roger Shimizu
2017-01-27 9:15 ` Gregory CLEMENT
2017-01-07 15:04 ` [PATCH v4 2/2] ARM: DT: add power-off support to linkstation lsgl and kuroboxpro Roger Shimizu
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=20161221155929.o4ihvqezbuqx2stl@earth \
--to=sre-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=andrew-g2DYL2Zd6BY@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hvr-mXXj517/zsQ@public.gmane.org \
--cc=linux-pm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mark.rutland-5wv7dgnIgG8@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=rogershimizu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=ryan-pRYBVO4bdZ33fQ9qLvQP4Q@public.gmane.org \
--cc=sylver.bruneau-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
--cc=tbm-R+vWnYXSFMfQT0dZR+AlfA@public.gmane.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).