Stefan Bosch | 95e9a8e | 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 | */ |
| 11 | #include <common.h> |
| 12 | #include <asm/io.h> |
| 13 | #include <asm/arch/nexell.h> |
| 14 | #include <asm/arch/reset.h> |
| 15 | |
| 16 | struct nx_rstcon_registerset { |
| 17 | u32 regrst[(NUMBER_OF_RESET_MODULE_PIN + 31) >> 5]; |
| 18 | }; |
| 19 | |
| 20 | static struct nx_rstcon_registerset *nx_rstcon = |
| 21 | (struct nx_rstcon_registerset *)PHY_BASEADDR_RSTCON; |
| 22 | |
| 23 | void nx_rstcon_setrst(u32 rstindex, enum rstcon status) |
| 24 | { |
| 25 | u32 regnum, bitpos, curstat; |
| 26 | |
| 27 | regnum = rstindex >> 5; |
| 28 | curstat = (u32)readl(&nx_rstcon->regrst[regnum]); |
| 29 | bitpos = rstindex & 0x1f; |
| 30 | curstat &= ~(1UL << bitpos); |
| 31 | curstat |= (status & 0x01) << bitpos; |
| 32 | writel(curstat, &nx_rstcon->regrst[regnum]); |
| 33 | } |