1/*
2 * Copyright (C) 2017 STMicroelectronics
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#ifndef _VARIANT_ARGONKEY_H_
18#define _VARIANT_ARGONKEY_H_
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#define PLATFORM_HW_TYPE            0x4172   // 'Ar' -> argonkey
25
26#define VARIANT_VER                 0x00000000
27
28//we have LSE in argonkey
29#define RTC_CLK                     RTC_CLK_LSE
30#define RTC_PREDIV_A                0UL
31#define RTC_PREDIV_S                32767UL
32
33//spi bus for comms
34#define PLATFORM_HOST_INTF_SPI_BUS  0
35
36#define SH_INT_WAKEUP               GPIO_PA(0)
37#define SH_EXTI_WAKEUP_IRQ          EXTI0_IRQn
38#define AP_INT_WAKEUP               GPIO_PA(1)
39/*
40 * Allocating a GPIO for non-wakeup host interrupt is optional in CHRE.
41 * ArgonKey implements this feature and enables it here. If you want to use
42 * the GPIO_PA(3) for other purposes, you should comment the line below and
43 * the corresponding line in the host's devicetree.
44 */
45#define AP_INT_NONWAKEUP            GPIO_PA(3)
46
47#define DEBUG_UART_UNITNO           1
48#define DEBUG_UART_GPIO_TX          GPIO_PA(9)
49#define DEBUG_UART_GPIO_RX          GPIO_PA(10)
50
51#define DEBUG_LOG_EVT               0x3B474F4C
52
53#define BL_FLASH_TABLE                                                  \
54{                                                                       \
55    { (uint8_t *)(&BL),                      0x04000, BL_FLASH_BL     },\
56    { (uint8_t *)(__eedata_start),           0x04000, BL_FLASH_EEDATA },\
57    { (uint8_t *)(__eedata_start + 0x04000), 0x04000, BL_FLASH_EEDATA },\
58    { (uint8_t *)(__code_start),             0x04000, BL_FLASH_KERNEL },\
59    { (uint8_t *)(__code_start + 0x04000),   0x10000, BL_FLASH_KERNEL },\
60    { (uint8_t *)(__code_start + 0x14000),   0x20000, BL_FLASH_KERNEL },\
61    { (uint8_t *)(__shared_start),           0x20000, BL_FLASH_SHARED },\
62    { (uint8_t *)(__shared_start + 0x20000), 0x20000, BL_FLASH_SHARED },\
63    { (uint8_t *)(__shared_start + 0x40000), 0x20000, BL_FLASH_SHARED },\
64    { (uint8_t *)(__shared_start + 0x60000), 0x20000, BL_FLASH_SHARED },\
65    { (uint8_t *)(__shared_start + 0x80000), 0x20000, BL_FLASH_SHARED },\
66    { (uint8_t *)(__shared_start + 0xA0000), 0x20000, BL_FLASH_SHARED },\
67}
68
69/* ------------------------------------------------------------------------ */
70/* sensor accel+gyro lsm6dsl (compatible lsm6dsm) on spi */
71
72// #define LSM6DSM_DBG_ENABLED                 1
73
74#define LSM6DSM_SPI_SLAVE_BUS_ID               1
75#define LSM6DSM_SPI_SLAVE_FREQUENCY_HZ         8000000
76#define LSM6DSM_SPI_SLAVE_CS_GPIO              GPIO_PB(12)
77
78#define LSM6DSM_INT_IRQ                        EXTI1_IRQn
79#define LSM6DSM_INT1_GPIO                      GPIO_PB(1)
80
81/* i2c slave sensor mag lis2mdl (lsm303agr compatible) */
82#define LSM6DSM_I2C_MASTER_LSM303AGR           1
83
84#define LSM6DSM_ACCEL_GYRO_ROT_MATRIX          -1, 0, 0, 0, -1, 0, 0, 0, 1
85#define LSM6DSM_MAGN_ROT_MATRIX                -1, 0, 0, 0, 1, 0, 0, 0, 1
86
87#define LSM6DSM_GYRO_CALIB_ENABLED             1
88#define LSM6DSM_MAGN_CALIB_ENABLED             1
89
90/* ------------------------------------------------------------------------ */
91/* sensor baro+temp lps22hb on i2c */
92/* unused PIN GPIO_PA(15), INT EXTI15_10_IRQn */
93
94// #define LPS22HB_DBG_ENABLED                 1
95
96#define LPS22HB_I2C_BUS_ID                     1
97#define LPS22HB_I2C_SPEED                      400000
98#define LPS22HB_I2C_ADDR                       0x5D
99
100/* ------------------------------------------------------------------------ */
101/* sensor humidity hts221 on i2c */
102/* unused PIN GPIO_PA(2), INT EXTI2_IRQn is used as button */
103
104// #define HTS221_DBG_ENABLED                  1
105
106#define HTS221_I2C_BUS_ID                      1
107#define HTS221_I2C_SPEED                       400000
108#define HTS221_I2C_ADDR                        0x5F
109
110/* ------------------------------------------------------------------------ */
111/* sensor als isl29034 on i2c */
112
113#define ISL29034_I2C_BUS_ID                    1
114#define ISL29034_I2C_SPEED                     400000
115#define ISL29034_I2C_ADDR                      0x44
116
117/* ------------------------------------------------------------------------ */
118/* sensor proximity vl53l0x on i2c */
119
120// FIXME
121// I2C_BUS_ID 1
122// I2C_SPEED  400000
123// I2C_ADDR   0x29
124// PIN        GPIO_PB(3)
125// IRQ        EXTI3_IRQn
126
127/* ------------------------------------------------------------------------ */
128/* sensor hall mrms501a on gpio */
129
130#define HALL_PIN                               GPIO_PB(5)
131#define HALL_IRQ                               EXTI9_5_IRQn
132
133/* ------------------------------------------------------------------------ */
134/* microphone on i2s */
135
136// FIXME
137// I2S_BUS_ID 4
138
139/* ------------------------------------------------------------------------ */
140/* led controller lp3943 on i2c */
141
142#define LP3943_I2C_BUS_ID                      2
143#define LP3943_I2C_SPEED                       200000
144#define LP3943_I2C_ADDR                        0x60
145
146/* ------------------------------------------------------------------------ */
147/* button on gpio */
148
149// FIXME
150// PIN GPIO_PA(2)
151// INT EXTI2_IRQn
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif
158