• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2017 The Android Open Source Project
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     [1] = {
22         .gpioScl = I2C2_GPIO_SCL_PB10,
23         .gpioSda = I2C2_GPIO_SDA_PB3,
24 
25         .gpioPull = GPIO_PULL_NONE,
26 
27         .dmaRx = I2C2_DMA_RX_CFG_A,
28         .dmaTx = I2C2_DMA_TX_CFG,
29 
30         .sleepDev = Stm32sleepDevI2c2,
31     },
32     [2] = {
33         .gpioScl = I2C3_GPIO_SCL_PA8,
34         .gpioSda = I2C3_GPIO_SDA_PB4,
35 
36         .gpioPull = GPIO_PULL_NONE,
37 
38         .dmaRx = I2C3_DMA_RX_CFG_A,
39         .dmaTx = I2C3_DMA_TX_CFG_A,
40 
41         .sleepDev = Stm32sleepDevI2c3,
42     },
43 };
44 
boardStmI2cCfg(uint8_t busId)45 const struct StmI2cBoardCfg *boardStmI2cCfg(uint8_t busId)
46 {
47     if (busId >= ARRAY_SIZE(mStmI2cBoardCfgs))
48         return NULL;
49 
50     return &mStmI2cBoardCfgs[busId];
51 }
52