lkml.org 
[lkml]   [2021]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v7 1/3] MIPS: Loongson64: Add Loongson-2K1000 reset platform driver
From
Date
Hello!

On 01.07.2021 6:01, Qing Zhang wrote:

> Add power management register operations to support reboot and poweroff.
>
> Signed-off-by: Qing Zhang <zhangqing@loongson.cn>
[...]
> diff --git a/drivers/platform/mips/ls2k-reset.c b/drivers/platform/mips/ls2k-reset.c
> new file mode 100644
> index 000000000000..286d47bf6964
> --- /dev/null
> +++ b/drivers/platform/mips/ls2k-reset.c
> @@ -0,0 +1,53 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Copyright (C) 2021, Qing Zhang <zhangqing@loongson.cn>
> + * Loongson-2K1000 reset support
> + */
> +
> +#include <linux/of_address.h>
> +#include <linux/pm.h>
> +#include <asm/reboot.h>
> +
> +#define PM1_STS 0x0c /* Power Management1 Status Register */
^ space missing?

> +#define PM1_CNT 0x14 /* Power Management 1 Control Register */
> +#define RST_CNT 0x30 /* Reset Control Register */
> +
> +static void __iomem *base;
> +
> +static void ls2k_restart(char *command)
> +{
> + writel(0x1, (void *)base + RST_CNT);
> +}
> +
> +static void ls2k_poweroff(void)
> +{
> + /* Clear */
> + writel((readl((void *)base + PM1_STS) & 0xffffffff), (void *)base + PM1_STS);

Are the pointer casts really necessary above?

> + /* Sleep Enable | Soft Off*/
> + writel(GENMASK(12, 10)|BIT(13), (void *)base + PM1_CNT);

Spaces around that | are needed.

[...]

MBR, Sergei

\
 
 \ /
  Last update: 2021-07-01 11:05    [W:0.047 / U:1.684 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site