hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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
/* SPDX-License-Identifier: GPL-2.0+ */
/*
 * spi-codec.h - Rockchip Spi-Codec Driver
 *
 * Copyright (C) 2023 Rockchip Electronics Co., Ltd.
 */
 
#ifndef __SPI_CODEC_H__
#define __SPI_CODEC_H__
 
#define PAYLOAD_MAX                (4096)
 
#define SS_CMD_BEGIN                (0xF4190BE6UL)
 
#define SS_CMD_PROGRAM                (0xFAAD0552UL)
#define SS_CMD_PARAMETER_SAFE            (0xA5015AFEUL)
#define SS_CMD_BLOCK_PARAMETER_SAFE        (0x4EA5B15AUL)
#define SS_CMD_BLOCK_PARAMETER_NO_SAFE        (0xFFA1F05EUL)
 
#define SS_CMD_END                (0xF1D20E2DUL)
#define SS_CMD_PARTIAL_END            (0xE1D21E2DUL)
 
#define SS_CMD_READ_REQUEST            (0xF3D20C2DUL)
#define SS_CMD_BK_MIPS_VALUE            (0x00CE6319UL)
#define SS_CMD_BK_ERROR_CODE            (0x00F7E808UL)
#define SS_CMD_BK_READ_VALUE            (0x00BC543AUL)
#define SS_CMD_BK_ACKNOWLEDGE            (0x00000000UL)
#define SS_CMD_BK_VERSION_INFO            (0x003EDC12UL)
 
struct spi_codec_protocol_packet {
   unsigned int cmd_begin;
 
   /* indicates the nature of payload */
   unsigned int cmd_type;
 
   /* payload data length */
   unsigned int payload_len;
   unsigned int payload[PAYLOAD_MAX];
 
   /* payload or entire packet */
   unsigned int crc;
 
   /* parameter id */
   unsigned int address;
 
   unsigned int cmd_end;
};
 
#endif