1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* 3 * 4 * Microchip PolarFire SoC (MPFS) 5 * 6 * Copyright (c) 2020 Microchip Corporation. All rights reserved. 7 * 8 * 9 */ 10 11 #ifndef _MPFS_MAILBOX_H__ 12 #define _MPFS_MAILBOX_H__ 13 14 #include <linux/types.h> 15 16 #define BYTES_4 4 17 18 struct udevice; 19 20 /** 21 * struct mpfs_mss_msg - PolarFire SoC message structure 22 * @cmd_opcode: Command opcode 23 * @cmd_data_size: Size of the command data. 24 * @response: Pointer to the response data. 25 * @cmd_data: Pointer to the command data. 26 * @mbox_offset: Mailbox offset 27 * @resp_offset: Response offset 28 * 29 */ 30 struct mpfs_mss_msg { 31 u8 cmd_opcode; 32 u16 cmd_data_size; 33 struct mpfs_mss_response *response; 34 u8 *cmd_data; 35 u16 mbox_offset; 36 u16 resp_offset; 37 }; 38 39 /** 40 * struct mpfs_mss_response - PolarFire SoC response structure 41 * @resp_status: Response status 42 * @resp_msg: Pointer to response message. 43 * @resp_size: Size of the response message. 44 * 45 */ 46 struct mpfs_mss_response { 47 u32 resp_status; 48 u32 *resp_msg; 49 u16 resp_size; 50 }; 51 52 struct mpfs_syscontroller_priv; 53 54 struct mpfs_sys_serv { 55 struct udevice *dev; 56 struct mpfs_syscontroller_priv *sys_controller; 57 struct mpfs_mss_msg *msg; 58 }; 59 60 int mpfs_syscontroller_run_service(struct mpfs_syscontroller_priv *sys_controller, struct mpfs_mss_msg *msg); 61 int mpfs_syscontroller_read_sernum(struct mpfs_sys_serv *sys_serv_priv, u8 *device_serial_number); 62 void mpfs_syscontroller_process_dtbo(struct mpfs_sys_serv *sys_serv_priv); 63 struct mpfs_syscontroller_priv *mpfs_syscontroller_get(struct udevice *dev); 64 65 #endif /* __MPFS_MAILBOX_H__ */ 66 67