Konstantin Porotchkin | 01c84d4 | 2018-02-26 16:01:57 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2018 Marvell International Ltd. |
| 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | * https://spdx.org/licenses |
| 6 | */ |
| 7 | |
| 8 | /* CP110 Marvell SoC driver */ |
| 9 | |
| 10 | #ifndef __CP110_SETUP_H__ |
| 11 | #define __CP110_SETUP_H__ |
| 12 | |
| 13 | #include <mmio.h> |
| 14 | #include <mvebu_def.h> |
| 15 | |
| 16 | #define MVEBU_DEVICE_ID_REG (MVEBU_CP_DFX_OFFSET + 0x40) |
| 17 | #define MVEBU_DEVICE_ID_OFFSET (0) |
| 18 | #define MVEBU_DEVICE_ID_MASK (0xffff << MVEBU_DEVICE_ID_OFFSET) |
| 19 | #define MVEBU_DEVICE_REV_OFFSET (16) |
| 20 | #define MVEBU_DEVICE_REV_MASK (0xf << MVEBU_DEVICE_REV_OFFSET) |
| 21 | #define MVEBU_70X0_DEV_ID (0x7040) |
| 22 | #define MVEBU_70X0_CP115_DEV_ID (0x7045) |
| 23 | #define MVEBU_80X0_DEV_ID (0x8040) |
| 24 | #define MVEBU_80X0_CP115_DEV_ID (0x8045) |
| 25 | #define MVEBU_CP110_SA_DEV_ID (0x110) |
| 26 | #define MVEBU_CP110_REF_ID_A1 1 |
| 27 | #define MVEBU_CP110_REF_ID_A2 2 |
| 28 | #define MAX_STREAM_ID_PER_CP (0x10) |
| 29 | #define STREAM_ID_BASE (0x40) |
| 30 | |
| 31 | static inline uint32_t cp110_device_id_get(uintptr_t base) |
| 32 | { |
| 33 | /* Returns: |
| 34 | * - MVEBU_70X0_DEV_ID for A70X0 family |
| 35 | * - MVEBU_80X0_DEV_ID for A80X0 family |
| 36 | * - MVEBU_CP110_SA_DEV_ID for CP that connected stand alone |
| 37 | */ |
| 38 | return (mmio_read_32(base + MVEBU_DEVICE_ID_REG) >> |
| 39 | MVEBU_DEVICE_ID_OFFSET) & |
| 40 | MVEBU_DEVICE_ID_MASK; |
| 41 | } |
| 42 | |
| 43 | static inline uint32_t cp110_rev_id_get(uintptr_t base) |
| 44 | { |
| 45 | return (mmio_read_32(base + MVEBU_DEVICE_ID_REG) & |
| 46 | MVEBU_DEVICE_REV_MASK) >> |
| 47 | MVEBU_DEVICE_REV_OFFSET; |
| 48 | } |
| 49 | |
| 50 | void cp110_init(uintptr_t cp110_base, uint32_t stream_id); |
| 51 | void cp110_ble_init(uintptr_t cp110_base); |
| 52 | |
| 53 | #endif /* __CP110_SETUP_H__ */ |