Re: [PATCH v2] power: reset: add linkstation-reset driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




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: signature.asc
Description: PGP signature


[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]
  Powered by Linux