Jorge Ramirez-Ortiz | d26a722 | 2018-09-23 09:41:39 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2015-2018, Renesas Electronics Corporation. All rights reserved. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
Jorge Ramirez-Ortiz | d26a722 | 2018-09-23 09:41:39 +0200 | [diff] [blame] | 7 | #include <stdint.h> |
| 8 | #include <string.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 9 | |
| 10 | #include <common/debug.h> |
| 11 | #include <lib/mmio.h> |
| 12 | |
Jorge Ramirez-Ortiz | d26a722 | 2018-09-23 09:41:39 +0200 | [diff] [blame] | 13 | #include "cpg_registers.h" |
| 14 | #include "rpc_registers.h" |
Jorge Ramirez-Ortiz | d26a722 | 2018-09-23 09:41:39 +0200 | [diff] [blame] | 15 | #include "rcar_private.h" |
| 16 | |
| 17 | #define MSTPSR9_RPC_BIT (0x00020000U) |
| 18 | #define RPC_CMNCR_MD_BIT (0x80000000U) |
| 19 | |
| 20 | static void rpc_enable(void) |
| 21 | { |
| 22 | /* Enable clock supply to RPC. */ |
| 23 | mstpcr_write(CPG_SMSTPCR9, CPG_MSTPSR9, MSTPSR9_RPC_BIT); |
| 24 | } |
| 25 | |
| 26 | static void rpc_setup(void) |
| 27 | { |
| 28 | if (mmio_read_32(RPC_CMNCR) & RPC_CMNCR_MD_BIT) |
| 29 | mmio_clrbits_32(RPC_CMNCR, RPC_CMNCR_MD_BIT); |
| 30 | } |
| 31 | |
| 32 | void rcar_rpc_init(void) |
| 33 | { |
| 34 | rpc_enable(); |
| 35 | rpc_setup(); |
| 36 | } |