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/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 [1] = {
38 .gpioMiso = GPIO_PB(14),
39 .gpioMosi = GPIO_PB(15),
40 .gpioSclk = GPIO_PB(13),
41 .gpioNss = GPIO_PB(12),
42
43 .gpioSpeed = GPIO_SPEED_MEDIUM,
44 .gpioFunc = GPIO_AF_SPI2_A,
45
46 .irqNss = EXTI15_10_IRQn,
47
48 .dmaRx = SPI2_DMA_RX_CFG,
49 .dmaTx = SPI2_DMA_TX_CFG,
50
51 .sleepDev = Stm32sleepDevSpi2,
52 },
53 };
54
boardStmSpiCfg(uint8_t busId)55 const struct StmSpiBoardCfg *boardStmSpiCfg(uint8_t busId)
56 {
57 if (busId >= ARRAY_SIZE(mStmSpiBoardCfgs))
58 return NULL;
59
60 return &mStmSpiBoardCfgs[busId];
61 }
62