Stefan Bosch | 6563ea2 | 2020-07-10 19:07:26 +0200 | [diff] [blame] | 1 | // 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 Bosch | 6563ea2 | 2020-07-10 19:07:26 +0200 | [diff] [blame] | 11 | #include <asm/io.h> |
| 12 | #include <asm/arch/nexell.h> |
| 13 | #include <asm/arch/reset.h> |
| 14 | |
| 15 | struct nx_rstcon_registerset { |
| 16 | u32 regrst[(NUMBER_OF_RESET_MODULE_PIN + 31) >> 5]; |
| 17 | }; |
| 18 | |
| 19 | static struct nx_rstcon_registerset *nx_rstcon = |
| 20 | (struct nx_rstcon_registerset *)PHY_BASEADDR_RSTCON; |
| 21 | |
| 22 | void 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 | } |