blob: 813f7d9f5622e589a512d1ccbdd4248d9104d2ee [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001/* SPDX-License-Identifier: GPL-2.0+ */
Tim Harvey0cee2242015-05-08 18:28:35 -07002/*
3 * Copyright (C) 2013 Gateworks Corporation
4 *
5 * Author: Tim Harvey <tharvey@gateworks.com>
Tim Harvey0cee2242015-05-08 18:28:35 -07006 */
7
8#ifndef _GWVENTANA_COMMON_H_
9#define _GWVENTANA_COMMON_H_
10
11#include "ventana_eeprom.h"
12
13/* GPIO's common to all baseboards */
Tim Harvey0cee2242015-05-08 18:28:35 -070014#define GP_RS232_EN IMX_GPIO_NR(2, 11)
15#define GP_MSATA_SEL IMX_GPIO_NR(2, 8)
16
17#define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
18 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
19 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
20
21#define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
22 PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
23 PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
24
25#define ENET_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
26 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
27 PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
28
29#define SPI_PAD_CTRL (PAD_CTL_HYS | \
30 PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
31 PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
32
Tim Harvey0cee2242015-05-08 18:28:35 -070033#define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
34 PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
35 PAD_CTL_ODE | PAD_CTL_SRE_FAST)
36
37#define IRQ_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
38 PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
39 PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST)
40
Tim Harveydb7edfa2015-05-26 11:04:54 -070041#define DIO_PAD_CFG (MUX_PAD_CTRL(IRQ_PAD_CTRL) | MUX_MODE_SION)
Tim Harvey0cee2242015-05-08 18:28:35 -070042
43#define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
44
45/*
Tim Harvey41595b52016-07-15 07:14:23 -070046 * each baseboard has an optional set user configurable Digital IO lines which
47 * can be pinmuxed as a GPIO or in some cases a PWM
Tim Harvey0cee2242015-05-08 18:28:35 -070048 */
49struct dio_cfg {
50 iomux_v3_cfg_t gpio_padmux[2];
51 unsigned gpio_param;
52 iomux_v3_cfg_t pwm_padmux[2];
53 unsigned pwm_param;
54};
55
56struct ventana {
57 /* pinmux */
58 iomux_v3_cfg_t const *gpio_pads;
59 int num_pads;
60 /* DIO pinmux/val */
Tim Harvey41595b52016-07-15 07:14:23 -070061 struct dio_cfg *dio_cfg;
62 int dio_num;
Tim Harvey0cee2242015-05-08 18:28:35 -070063 /* various gpios (0 if non-existent) */
64 int leds[3];
65 int pcie_rst;
66 int mezz_pwren;
67 int mezz_irq;
68 int rs485en;
69 int gps_shdn;
70 int vidin_en;
71 int dioi2c_en;
72 int pcie_sson;
73 int usb_sel;
74 int wdis;
Tim Harvey86b75322016-05-24 11:03:56 -070075 int msata_en;
Tim Harvey2cb61c12016-07-15 07:14:22 -070076 int rs232_en;
Tim Harveyd7babd42017-03-13 08:51:08 -070077 int vsel_pin;
Tim Harvey63537792017-03-17 07:30:38 -070078 int mmc_cd;
Tim Harvey2cb61c12016-07-15 07:14:22 -070079 /* various features */
Tim Harvey147b5762016-05-24 11:03:59 -070080 bool usd_vsel;
Tim Harveyba9f2342019-02-04 13:10:52 -080081 bool nand;
Tim Harvey0cee2242015-05-08 18:28:35 -070082};
83
84extern struct ventana gpio_cfg[GW_UNKNOWN];
85
86/* configure i2c iomux */
Tim Harveyd04dc812019-02-04 13:10:49 -080087void setup_ventana_i2c(int);
Tim Harvey0cee2242015-05-08 18:28:35 -070088/* configure uart iomux */
89void setup_iomux_uart(void);
90/* conifgure PMIC */
Tim Harvey195bc972015-05-08 18:28:37 -070091void setup_pmic(void);
Tim Harvey0cee2242015-05-08 18:28:35 -070092/* configure gpio iomux/defaults */
93void setup_iomux_gpio(int board, struct ventana_board_info *);
94/* late setup of GPIO (configuration per baseboard and env) */
95void setup_board_gpio(int board, struct ventana_board_info *);
96
97#endif /* #ifndef _GWVENTANA_COMMON_H_ */