blob: 627f568270b61af8822ddc9c41022aa48aeb52ec [file] [log] [blame]
Stefan Bosch6563ea22020-07-10 19:07:26 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * (C) Copyright 2016 Nexell
4 * Youngbok, Park <park@nexell.co.kr>
5 */
6
7/*
8 *FIXME : Not support device tree & reset control driver.
9 * will remove after support device tree & reset control driver.
10 */
Stefan Bosch6563ea22020-07-10 19:07:26 +020011#include <asm/io.h>
12#include <asm/arch/nexell.h>
13#include <asm/arch/reset.h>
14
15struct nx_rstcon_registerset {
16 u32 regrst[(NUMBER_OF_RESET_MODULE_PIN + 31) >> 5];
17};
18
19static struct nx_rstcon_registerset *nx_rstcon =
20 (struct nx_rstcon_registerset *)PHY_BASEADDR_RSTCON;
21
22void nx_rstcon_setrst(u32 rstindex, enum rstcon status)
23{
24 u32 regnum, bitpos, curstat;
25
26 regnum = rstindex >> 5;
27 curstat = (u32)readl(&nx_rstcon->regrst[regnum]);
28 bitpos = rstindex & 0x1f;
29 curstat &= ~(1UL << bitpos);
30 curstat |= (status & 0x01) << bitpos;
31 writel(curstat, &nx_rstcon->regrst[regnum]);
32}