common.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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_RS232_EN IMX_GPIO_NR(2, 11)
  12. #define GP_MSATA_SEL IMX_GPIO_NR(2, 8)
  13. #define UART_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  14. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  15. PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
  16. #define USDHC_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  17. PAD_CTL_PUS_47K_UP | PAD_CTL_SPEED_LOW | \
  18. PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST | PAD_CTL_HYS)
  19. #define ENET_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  20. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  21. PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
  22. #define SPI_PAD_CTRL (PAD_CTL_HYS | \
  23. PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED | \
  24. PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
  25. #define I2C_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
  26. PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | \
  27. PAD_CTL_ODE | PAD_CTL_SRE_FAST)
  28. #define IRQ_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_PUE | \
  29. PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED | \
  30. PAD_CTL_DSE_34ohm | PAD_CTL_HYS | PAD_CTL_SRE_FAST)
  31. #define DIO_PAD_CFG (MUX_PAD_CTRL(IRQ_PAD_CTRL) | MUX_MODE_SION)
  32. #define PC MUX_PAD_CTRL(I2C_PAD_CTRL)
  33. /*
  34. * each baseboard has an optional set user configurable Digital IO lines which
  35. * can be pinmuxed as a GPIO or in some cases a PWM
  36. */
  37. struct dio_cfg {
  38. iomux_v3_cfg_t gpio_padmux[2];
  39. unsigned gpio_param;
  40. iomux_v3_cfg_t pwm_padmux[2];
  41. unsigned pwm_param;
  42. };
  43. struct ventana {
  44. /* pinmux */
  45. iomux_v3_cfg_t const *gpio_pads;
  46. int num_pads;
  47. /* DIO pinmux/val */
  48. struct dio_cfg *dio_cfg;
  49. int dio_num;
  50. /* various gpios (0 if non-existent) */
  51. int mezz_pwren;
  52. int mezz_irq;
  53. int rs485en;
  54. int gps_shdn;
  55. int dioi2c_en;
  56. int pcie_sson;
  57. int usb_sel;
  58. int wdis;
  59. int msata_en;
  60. int rs232_en;
  61. int vsel_pin;
  62. int mmc_cd;
  63. /* various features */
  64. bool usd_vsel;
  65. };
  66. extern struct ventana gpio_cfg[GW_UNKNOWN];
  67. /* configure i2c iomux */
  68. void setup_ventana_i2c(int);
  69. /* configure uart iomux */
  70. void setup_iomux_uart(void);
  71. /* conifgure PMIC */
  72. void setup_pmic(void);
  73. /* configure gpio iomux/defaults */
  74. void setup_iomux_gpio(int board, struct ventana_board_info *);
  75. /* late setup of GPIO (configuration per baseboard and env) */
  76. void setup_board_gpio(int board, struct ventana_board_info *);
  77. /* early model/revision ft fixups */
  78. void ft_early_fixup(void *fdt, int board_type);
  79. #endif /* #ifndef _GWVENTANA_COMMON_H_ */