1 /*
2  * Copyright (C) 2016 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     [0] = {
22         .gpioScl = I2C1_GPIO_SCL_PB8,
23         .gpioSda = I2C1_GPIO_SDA_PB9,
24 
25         .gpioPull = GPIO_PULL_NONE,
26 
27         .dmaRx = I2C1_DMA_RX_CFG_A,
28         .dmaTx = I2C1_DMA_TX_CFG_A,
29 
30         .sleepDev = Stm32sleepDevI2c1,
31     },
32 };
33 
boardStmI2cCfg(uint8_t busId)34 const struct StmI2cBoardCfg *boardStmI2cCfg(uint8_t busId)
35 {
36     if (busId >= ARRAY_SIZE(mStmI2cBoardCfgs))
37         return NULL;
38 
39     return &mStmI2cBoardCfgs[busId];
40 }
41