mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / google / storm / cdp.c
blob9dd184e62da3c166c6c59f84d25d197045937fef
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <device/mmio.h>
4 #include <gpio.h>
5 #include <soc/cdp.h>
6 #include <soc/ebi2.h>
7 #include <soc/clock.h>
8 #include <types.h>
9 #include <boardid.h>
11 void ipq_configure_gpio(const gpio_func_data_t *gpio, unsigned int count)
13 int i;
15 for (i = 0; i < count; i++) {
16 gpio_tlmm_config(gpio->gpio, gpio->func, gpio->dir,
17 gpio->pull, gpio->drvstr, gpio->enable);
18 gpio++;
22 static void configure_nand_gpio(void)
24 /* EBI2 CS, CLE, ALE, WE, OE */
25 gpio_tlmm_config(34, 1, 0, GPIO_NO_PULL, GPIO_10MA, GPIO_DISABLE);
26 gpio_tlmm_config(35, 1, 0, GPIO_NO_PULL, GPIO_10MA, GPIO_DISABLE);
27 gpio_tlmm_config(36, 1, 0, GPIO_NO_PULL, GPIO_10MA, GPIO_DISABLE);
28 gpio_tlmm_config(37, 1, 0, GPIO_NO_PULL, GPIO_10MA, GPIO_DISABLE);
29 gpio_tlmm_config(38, 1, 0, GPIO_NO_PULL, GPIO_10MA, GPIO_DISABLE);
31 /* EBI2 BUSY */
32 gpio_tlmm_config(39, 1, 0, GPIO_PULL_UP, GPIO_10MA, GPIO_DISABLE);
34 /* EBI2 D7 - D0 */
35 gpio_tlmm_config(40, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
36 gpio_tlmm_config(41, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
37 gpio_tlmm_config(42, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
38 gpio_tlmm_config(43, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
39 gpio_tlmm_config(44, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
40 gpio_tlmm_config(45, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
41 gpio_tlmm_config(46, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
42 gpio_tlmm_config(47, 1, 0, GPIO_KEEPER, GPIO_10MA, GPIO_DISABLE);
45 void board_nand_init(void)
47 struct ebi2cr_regs *ebi2_regs;
49 if (board_id() != BOARD_ID_PROTO_0_2_NAND)
50 return;
52 ebi2_regs = (struct ebi2cr_regs *)EBI2CR_BASE;
54 nand_clock_config();
55 configure_nand_gpio();
57 /* NAND Flash is connected to CS0 */
58 clrsetbits32(&ebi2_regs->chip_select_cfg0, CS0_CFG_MASK,
59 CS0_CFG_SERIAL_FLASH_DEVICE);