Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013 Gateworks Corporation |
| 4 | * |
| 5 | * Author: Tim Harvey <tharvey@gateworks.com> |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef _GWVENTANA_COMMON_H_ |
| 9 | #define _GWVENTANA_COMMON_H_ |
| 10 | |
Tim Harvey | 4137785 | 2022-04-13 09:29:16 -0700 | [diff] [blame^] | 11 | #include "eeprom.h" |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 12 | |
| 13 | /* GPIO's common to all baseboards */ |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 14 | #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 Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 33 | #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 Harvey | db7edfa | 2015-05-26 11:04:54 -0700 | [diff] [blame] | 41 | #define DIO_PAD_CFG (MUX_PAD_CTRL(IRQ_PAD_CTRL) | MUX_MODE_SION) |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 42 | |
| 43 | #define PC MUX_PAD_CTRL(I2C_PAD_CTRL) |
| 44 | |
| 45 | /* |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 46 | * 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 Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 48 | */ |
| 49 | struct 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 | |
| 56 | struct ventana { |
| 57 | /* pinmux */ |
| 58 | iomux_v3_cfg_t const *gpio_pads; |
| 59 | int num_pads; |
| 60 | /* DIO pinmux/val */ |
Tim Harvey | 41595b5 | 2016-07-15 07:14:23 -0700 | [diff] [blame] | 61 | struct dio_cfg *dio_cfg; |
| 62 | int dio_num; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 63 | /* various gpios (0 if non-existent) */ |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 64 | int mezz_pwren; |
| 65 | int mezz_irq; |
| 66 | int rs485en; |
| 67 | int gps_shdn; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 68 | int dioi2c_en; |
| 69 | int pcie_sson; |
| 70 | int usb_sel; |
| 71 | int wdis; |
Tim Harvey | 86b7532 | 2016-05-24 11:03:56 -0700 | [diff] [blame] | 72 | int msata_en; |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 73 | int rs232_en; |
Tim Harvey | d7babd4 | 2017-03-13 08:51:08 -0700 | [diff] [blame] | 74 | int vsel_pin; |
Tim Harvey | 6353779 | 2017-03-17 07:30:38 -0700 | [diff] [blame] | 75 | int mmc_cd; |
Tim Harvey | 2cb61c1 | 2016-07-15 07:14:22 -0700 | [diff] [blame] | 76 | /* various features */ |
Tim Harvey | 147b576 | 2016-05-24 11:03:59 -0700 | [diff] [blame] | 77 | bool usd_vsel; |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 78 | }; |
| 79 | |
| 80 | extern struct ventana gpio_cfg[GW_UNKNOWN]; |
| 81 | |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 82 | /* configure gpio iomux/defaults */ |
Tim Harvey | 4137785 | 2022-04-13 09:29:16 -0700 | [diff] [blame^] | 83 | void setup_iomux_gpio(int board); |
Tim Harvey | 0cee224 | 2015-05-08 18:28:35 -0700 | [diff] [blame] | 84 | |
| 85 | #endif /* #ifndef _GWVENTANA_COMMON_H_ */ |