blob: 7059c3701688001402e39199dee8a9e1b396b991 [file] [log] [blame]
Varun Wadekarb3741032017-09-25 13:27:45 -07001/*
steven kao05ee5822018-01-02 19:07:00 -08002 * Copyright (c) 2017-2018, NVIDIA CORPORATION. All rights reserved.
Varun Wadekarb3741032017-09-25 13:27:45 -07003 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#ifndef INTF_H
8#define INTF_H
9
10/**
11 * Flags used in IPC req
12 */
13#define FLAG_DO_ACK (U(1) << 0)
steven kao05ee5822018-01-02 19:07:00 -080014#define FLAG_RING_DOORBELL (U(1) << 1)
Varun Wadekarb3741032017-09-25 13:27:45 -070015
16/* Bit 1 is designated for CCPlex in secure world */
steven kao05ee5822018-01-02 19:07:00 -080017#define HSP_MASTER_CCPLEX_BIT (U(1) << 1)
Varun Wadekarb3741032017-09-25 13:27:45 -070018/* Bit 19 is designated for BPMP in non-secure world */
19#define HSP_MASTER_BPMP_BIT (U(1) << 19)
20/* Timeout to receive response from BPMP is 1 sec */
21#define TIMEOUT_RESPONSE_FROM_BPMP_US U(1000000) /* in microseconds */
22
23/**
24 * IVC protocol defines and command/response frame
25 */
26
27/**
28 * IVC specific defines
29 */
30#define IVC_CMD_SZ_BYTES U(128)
31#define IVC_DATA_SZ_BYTES U(120)
32
33/**
34 * Holds frame data for an IPC request
35 */
36struct frame_data {
37 /* Identification as to what kind of data is being transmitted */
38 uint32_t mrq;
39
40 /* Flags for slave as to how to respond back */
41 uint32_t flags;
42
43 /* Actual data being sent */
44 uint8_t data[IVC_DATA_SZ_BYTES];
45};
46
47/**
48 * Commands send to the BPMP firmware
49 */
50
51/**
steven kao05ee5822018-01-02 19:07:00 -080052 * MRQ command codes
Varun Wadekarb3741032017-09-25 13:27:45 -070053 */
54#define MRQ_RESET U(20)
steven kao05ee5822018-01-02 19:07:00 -080055#define MRQ_CLK U(22)
Varun Wadekarb3741032017-09-25 13:27:45 -070056
57/**
58 * Reset sub-commands
59 */
60#define CMD_RESET_ASSERT U(1)
61#define CMD_RESET_DEASSERT U(2)
62#define CMD_RESET_MODULE U(3)
63
64/**
65 * Used by the sender of an #MRQ_RESET message to request BPMP to
66 * assert or deassert a given reset line.
67 */
68struct __attribute__((packed)) mrq_reset_request {
69 /* reset action to perform (mrq_reset_commands) */
70 uint32_t cmd;
71 /* id of the reset to affected */
72 uint32_t reset_id;
73};
74
steven kao05ee5822018-01-02 19:07:00 -080075/**
76 * MRQ_CLK sub-commands
77 *
78 */
79enum {
80 CMD_CLK_GET_RATE = 1,
81 CMD_CLK_SET_RATE = 2,
82 CMD_CLK_ROUND_RATE = 3,
83 CMD_CLK_GET_PARENT = 4,
84 CMD_CLK_SET_PARENT = 5,
85 CMD_CLK_IS_ENABLED = 6,
86 CMD_CLK_ENABLE = 7,
87 CMD_CLK_DISABLE = 8,
88 CMD_CLK_GET_ALL_INFO = 14,
89 CMD_CLK_GET_MAX_CLK_ID = 15,
90 CMD_CLK_MAX,
91};
92
93/**
94 * Used by the sender of an #MRQ_CLK message to control clocks. The
95 * clk_request is split into several sub-commands. Some sub-commands
96 * require no additional data. Others have a sub-command specific
97 * payload
98 *
99 * |sub-command |payload |
100 * |----------------------------|-----------------------|
101 * |CMD_CLK_GET_RATE |- |
102 * |CMD_CLK_SET_RATE |clk_set_rate |
103 * |CMD_CLK_ROUND_RATE |clk_round_rate |
104 * |CMD_CLK_GET_PARENT |- |
105 * |CMD_CLK_SET_PARENT |clk_set_parent |
106 * |CMD_CLK_IS_ENABLED |- |
107 * |CMD_CLK_ENABLE |- |
108 * |CMD_CLK_DISABLE |- |
109 * |CMD_CLK_GET_ALL_INFO |- |
110 * |CMD_CLK_GET_MAX_CLK_ID |- |
111 *
112 */
113struct mrq_clk_request {
114 /**
115 * sub-command and clock id concatenated to 32-bit word.
116 * - bits[31..24] is the sub-cmd.
117 * - bits[23..0] is the clock id
118 */
119 uint32_t cmd_and_id;
120};
121
122/**
123 * Macro to prepare the MRQ_CLK sub-command
124 */
125#define make_mrq_clk_cmd(cmd, id) (((cmd) << 24) | (id & 0xFFFFFF))
126
Varun Wadekarb3741032017-09-25 13:27:45 -0700127#endif /* INTF_H */