1 /*
2 * Copyright (C) 2016-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 #include <plat/i2c.h>
18 #include <util.h>
19
20 static const struct StmI2cBoardCfg mStmI2cBoardCfgs[] = {
21 [0] = {
22 .gpioScl = I2C1_GPIO_SCL_PB6,
23 .gpioSda = I2C1_GPIO_SDA_PB7,
24
25 .gpioPull = GPIO_PULL_NONE,
26
27 .dmaRx = I2C1_DMA_RX_CFG_A,
28 .dmaTx = I2C1_DMA_TX_CFG_B,
29
30 .sleepDev = Stm32sleepDevI2c1,
31 },
32 [1] = {
33 .gpioScl = I2C2_GPIO_SCL_PB10,
34 .gpioSda = I2C2_GPIO_SDA_PB9,
35
36 .gpioPull = GPIO_PULL_NONE,
37
38 .dmaRx = I2C2_DMA_RX_CFG_A,
39 .dmaTx = I2C2_DMA_TX_CFG,
40
41 .sleepDev = Stm32sleepDevI2c2,
42 },
43 [2] = {
44 .gpioScl = I2C3_GPIO_SCL_PA8,
45 .gpioSda = I2C3_GPIO_SDA_PB4,
46
47 .gpioPull = GPIO_PULL_NONE,
48
49 .dmaRx = I2C3_DMA_RX_CFG_A,
50 .dmaTx = I2C3_DMA_TX_CFG_B,
51
52 .sleepDev = Stm32sleepDevI2c3,
53 },
54 };
55
boardStmI2cCfg(uint8_t busId)56 const struct StmI2cBoardCfg *boardStmI2cCfg(uint8_t busId)
57 {
58 if (busId >= ARRAY_SIZE(mStmI2cBoardCfgs))
59 return NULL;
60
61 return &mStmI2cBoardCfgs[busId];
62 }
63