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