2 * Copyright (C) 2015, Bin Meng <bmeng.cn@gmail.com>
4 * SPDX-License-Identifier: GPL-2.0+
7 #ifndef _QUARK_MSG_PORT_H_
8 #define _QUARK_MSG_PORT_H_
11 * In the Quark SoC, some chipset commands are accomplished by utilizing
12 * the internal message network within the host bridge (D0:F0). Accesses
13 * to this network are accomplished by populating the message control
14 * register (MCR), Message Control Register eXtension (MCRX) and the
15 * message data register (MDR).
17 #define MSG_CTRL_REG 0xd0 /* Message Control Register */
18 #define MSG_DATA_REG 0xd4 /* Message Data Register */
19 #define MSG_CTRL_EXT_REG 0xd8 /* Message Control Register EXT */
21 /* Normal Read/Write OpCodes */
22 #define MSG_OP_READ 0x10
23 #define MSG_OP_WRITE 0x11
25 /* Alternative Read/Write OpCodes */
26 #define MSG_OP_ALT_READ 0x06
27 #define MSG_OP_ALT_WRITE 0x07
29 /* IO Read/Write OpCodes */
30 #define MSG_OP_IO_READ 0x02
31 #define MSG_OP_IO_WRITE 0x03
33 /* All byte enables */
34 #define MSG_BYTE_ENABLE 0xf0
39 * msg_port_setup - set up the message port control register
41 * @op: message bus access opcode
42 * @port: port number on the message bus
43 * @reg: register number within a port
45 void msg_port_setup(int op, int port, int reg);
48 * msg_port_read - read a message port register using normal opcode
50 * @port: port number on the message bus
51 * @reg: register number within a port
53 * @return: message port register value
55 u32 msg_port_read(u8 port, u32 reg);
58 * msg_port_write - write a message port register using normal opcode
60 * @port: port number on the message bus
61 * @reg: register number within a port
62 * @value: register value to write
64 void msg_port_write(u8 port, u32 reg, u32 value);
67 * msg_port_alt_read - read a message port register using alternative opcode
69 * @port: port number on the message bus
70 * @reg: register number within a port
72 * @return: message port register value
74 u32 msg_port_alt_read(u8 port, u32 reg);
77 * msg_port_alt_write - write a message port register using alternative opcode
79 * @port: port number on the message bus
80 * @reg: register number within a port
81 * @value: register value to write
83 void msg_port_alt_write(u8 port, u32 reg, u32 value);
86 * msg_port_io_read - read a message port register using I/O opcode
88 * @port: port number on the message bus
89 * @reg: register number within a port
91 * @return: message port register value
93 u32 msg_port_io_read(u8 port, u32 reg);
96 * msg_port_io_write - write a message port register using I/O opcode
98 * @port: port number on the message bus
99 * @reg: register number within a port
100 * @value: register value to write
102 void msg_port_io_write(u8 port, u32 reg, u32 value);
104 #endif /* __ASSEMBLY__ */
106 #endif /* _QUARK_MSG_PORT_H_ */