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/spi.h>
18 #include <util.h>
19
20 static const struct StmSpiBoardCfg mStmSpiBoardCfgs[] = {
21 [0] = {
22 .gpioMiso = GPIO_PA(6),
23 .gpioMosi = GPIO_PA(7),
24 .gpioSclk = GPIO_PA(5),
25 .gpioNss = GPIO_PA(4),
26
27 .gpioFunc = GPIO_AF_SPI1,
28 .gpioSpeed = GPIO_SPEED_MEDIUM,
29
30 .irqNss = EXTI4_IRQn,
31
32 .dmaRx = SPI1_DMA_RX_CFG_B,
33 .dmaTx = SPI1_DMA_TX_CFG_B,
34
35 .sleepDev = -1,
36 },
37 };
38
boardStmSpiCfg(uint8_t busId)39 const struct StmSpiBoardCfg *boardStmSpiCfg(uint8_t busId)
40 {
41 if (busId >= ARRAY_SIZE(mStmSpiBoardCfgs))
42 return NULL;
43
44 return &mStmSpiBoardCfgs[busId];
45 }
46