cp110_setup.h 1.48 KB
Newer Older
1
2
3
4
5
6
7
8
9
/*
 * Copyright (C) 2018 Marvell International Ltd.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 * https://spdx.org/licenses
 */

/* CP110 Marvell SoC driver */

10
11
#ifndef CP110_SETUP_H
#define CP110_SETUP_H
12

13
14
#include <lib/mmio.h>

15
16
17
18
19
20
21
22
23
#include <mvebu_def.h>

#define MVEBU_DEVICE_ID_REG		(MVEBU_CP_DFX_OFFSET + 0x40)
#define MVEBU_DEVICE_ID_OFFSET		(0)
#define MVEBU_DEVICE_ID_MASK		(0xffff << MVEBU_DEVICE_ID_OFFSET)
#define MVEBU_DEVICE_REV_OFFSET		(16)
#define MVEBU_DEVICE_REV_MASK		(0xf << MVEBU_DEVICE_REV_OFFSET)
#define MVEBU_70X0_DEV_ID		(0x7040)
#define MVEBU_70X0_CP115_DEV_ID		(0x7045)
24
#define MVEBU_3900_DEV_ID		(0x6025)
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#define MVEBU_80X0_DEV_ID		(0x8040)
#define MVEBU_80X0_CP115_DEV_ID		(0x8045)
#define MVEBU_CP110_SA_DEV_ID		(0x110)
#define MVEBU_CP110_REF_ID_A1		1
#define MVEBU_CP110_REF_ID_A2		2
#define MAX_STREAM_ID_PER_CP		(0x10)
#define STREAM_ID_BASE			(0x40)

static inline uint32_t cp110_device_id_get(uintptr_t base)
{
	/* Returns:
	 * - MVEBU_70X0_DEV_ID for A70X0 family
	 * - MVEBU_80X0_DEV_ID for A80X0 family
	 * - MVEBU_CP110_SA_DEV_ID for CP that connected stand alone
	 */
	return (mmio_read_32(base + MVEBU_DEVICE_ID_REG) >>
		MVEBU_DEVICE_ID_OFFSET) &
		MVEBU_DEVICE_ID_MASK;
}

static inline uint32_t cp110_rev_id_get(uintptr_t base)
{
	return (mmio_read_32(base + MVEBU_DEVICE_ID_REG) &
		MVEBU_DEVICE_REV_MASK) >>
		MVEBU_DEVICE_REV_OFFSET;
}

void cp110_init(uintptr_t cp110_base, uint32_t stream_id);
void cp110_ble_init(uintptr_t cp110_base);

55
#endif /* CP110_SETUP_H */