1 /*
2  * Arm SCP/MCP Software
3  * Copyright (c) 2018-2022, Arm Limited and Contributors. All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef MOD_HSSPI_H
9 #define MOD_HSSPI_H
10 
11 #include <fwk_id.h>
12 
13 #include <stdint.h>
14 /*!
15  * \addtogroup GroupModule  Product Modules
16  * \{
17  */
18 
19 /*!
20  * \defgroup GroupHSSPI HSSPI Driver
21  *
22  * \brief  High Speed SPI device driver.
23  *
24  * \details This module implements a device driver for the HSSPI
25  *
26  * \{
27  */
28 enum hsspi_mode {
29     HSSPI_MODE_DIRECT = 0,
30     HSSPI_MODE_COMMAND_SEQUENCE,
31     HSSPI_MODE_COUNT
32 };
33 
34 enum hsspi_clock_select {
35     HSSPI_CLOCK_SELECT_HSEL = 0,
36     HSSPI_CLOCK_SELECT_PSEL,
37     HSSPI_CLOCK_SELECT_COUNT
38 };
39 
40 enum hsspi_deselect_time {
41     HSSPI_DESELECT_TIME_1 = 0,
42     HSSPI_DESELECT_TIME_2,
43     HSSPI_DESELECT_TIME_3,
44     HSSPI_DESELECT_TIME_4,
45     HSSPI_DESELECT_TIME_5,
46     HSSPI_DESELECT_TIME_6,
47     HSSPI_DESELECT_TIME_7,
48     HSSPI_DESELECT_TIME_8,
49     HSSPI_DESELECT_TIME_9,
50     HSSPI_DESELECT_TIME_10,
51     HSSPI_DESELECT_TIME_11,
52     HSSPI_DESELECT_TIME_12,
53     HSSPI_DESELECT_TIME_13,
54     HSSPI_DESELECT_TIME_14,
55     HSSPI_DESELECT_TIME_15,
56     HSSPI_DESELECT_TIME_16,
57     HSSPI_DESELECT_TIME_COUNT
58 };
59 
60 enum hsspi_memory_bank_size {
61     HSSPI_MEMORY_BANK_SIZE_8K = 0,
62     HSSPI_MEMORY_BANK_SIZE_16K,
63     HSSPI_MEMORY_BANK_SIZE_32K,
64     HSSPI_MEMORY_BANK_SIZE_64K,
65     HSSPI_MEMORY_BANK_SIZE_128K,
66     HSSPI_MEMORY_BANK_SIZE_256K,
67     HSSPI_MEMORY_BANK_SIZE_512K,
68     HSSPI_MEMORY_BANK_SIZE_1M,
69     HSSPI_MEMORY_BANK_SIZE_2M,
70     HSSPI_MEMORY_BANK_SIZE_4M,
71     HSSPI_MEMORY_BANK_SIZE_8M,
72     HSSPI_MEMORY_BANK_SIZE_16M,
73     HSSPI_MEMORY_BANK_SIZE_32M,
74     HSSPI_MEMORY_BANK_SIZE_64M,
75     HSSPI_MEMORY_BANK_SIZE_128M,
76     HSSPI_MEMORY_BANK_SIZE_256M,
77     HSSPI_MEMORY_BANK_SIZE_COUNT,
78 };
79 
80 /*!
81  * \brief HSSPI device configuration data.
82  */
83 struct mod_hsspi_dev_config {
84     /*! Base address of the device registers */
85     const uintptr_t reg_base;
86 
87     /*! Base address of the memory mapped area */
88     const uintptr_t memory_base;
89 
90     /*! Division of clock */
91     uint8_t clock_div;
92 
93     /*! Selection of clock source */
94     enum hsspi_clock_select clock_sel;
95 
96     /*! Chip deselection time */
97     enum hsspi_deselect_time deselect_time;
98 
99     /*! Bank size of memory area */
100     enum hsspi_memory_bank_size memory_bank_size;
101 };
102 
103 /*!
104  * \brief HSSPI configuration data.
105  */
106 struct mod_hsspi_config {
107     /*! Base address of the boot_ctl reigster */
108     const uintptr_t bootctl_base;
109 };
110 
111 /*!
112  * \}
113  */
114 
115 /*!
116  * \}
117  */
118 
119 #endif /* MOD_HSSPI_H */
120