common.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. /* SPDX-License-Identifier: GPL-2.0+ */
  2. /*
  3. * Copyright (C) 2013 Gateworks Corporation
  4. *
  5. * Author: Tim Harvey <tharvey@gateworks.com>
  6. */
  7. #ifndef _GWVENTANA_COMMON_H_
  8. #define _GWVENTANA_COMMON_H_
  9. #include "ventana_eeprom.h"
  10. /* GPIO's common to all baseboards */
  11. #define GP_PHY_RST IMX_GPIO_NR(1, 30)
  12. #define GP_RS232_EN IMX_GPIO_NR(2, 11)
  13. #define GP_MSATA_SEL IMX_GPIO_NR(2, 8)
  14. #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  15. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  16. PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
  17. #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  18. PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
  19. PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
  20. #define ENET_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  21. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  22. PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
  23. #define SPI_PAD_CTRL (PAD_CTL_HYS | \
  24. PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
  25. PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
  26. #define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
  27. PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
  28. PAD_CTL_ODE | PAD_CTL_SRE_FAST)
  29. #define IRQ_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  30. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  31. PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST)
  32. #define DIO_PAD_CFG (MUX_PAD_CTRL(IRQ_PAD_CTRL) | MUX_MODE_SION)
  33. #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
  34. /*
  35. * each baseboard has an optional set user configurable Digital IO lines which
  36. * can be pinmuxed as a GPIO or in some cases a PWM
  37. */
  38. struct dio_cfg {
  39. iomux_v3_cfg_t gpio_padmux[2];
  40. unsigned gpio_param;
  41. iomux_v3_cfg_t pwm_padmux[2];
  42. unsigned pwm_param;
  43. };
  44. struct ventana {
  45. /* pinmux */
  46. iomux_v3_cfg_t const *gpio_pads;
  47. int num_pads;
  48. /* DIO pinmux/val */
  49. struct dio_cfg *dio_cfg;
  50. int dio_num;
  51. /* various gpios (0 if non-existent) */
  52. int leds[3];
  53. int pcie_rst;
  54. int mezz_pwren;
  55. int mezz_irq;
  56. int rs485en;
  57. int gps_shdn;
  58. int vidin_en;
  59. int dioi2c_en;
  60. int pcie_sson;
  61. int usb_sel;
  62. int wdis;
  63. int msata_en;
  64. int rs232_en;
  65. int otgpwr_en;
  66. int vsel_pin;
  67. int mmc_cd;
  68. /* various features */
  69. bool usd_vsel;
  70. };
  71. extern struct ventana gpio_cfg[GW_UNKNOWN];
  72. /* configure i2c iomux */
  73. void setup_ventana_i2c(void);
  74. /* configure uart iomux */
  75. void setup_iomux_uart(void);
  76. /* conifgure PMIC */
  77. void setup_pmic(void);
  78. /* configure gpio iomux/defaults */
  79. void setup_iomux_gpio(int board, struct ventana_board_info *);
  80. /* late setup of GPIO (configuration per baseboard and env) */
  81. void setup_board_gpio(int board, struct ventana_board_info *);
  82. #endif /* #ifndef _GWVENTANA_COMMON_H_ */