Commit 60fc7bac authored by Thomas Schäfer's avatar Thomas Schäfer
Browse files

pitx-imx8m: fix UART3 and USB1_OTG iomux settings for rev2



Due to HW design errors in rev2, some signals must be reconfigured
to avoid malfunction or possible electrical damage.
- Setup UART3 RTS/CTS lines as GPIOs as polarity has been swapped on rev2
- Make sure to set GPIO1_IO12 (USB1_OTG_PWR) in input mode and remove usb0
  port from u-boot device tree to avoid conflicting drivers when external
  host is attached.
Signed-off-by: Thomas Schäfer's avatarThomas Schaefer <thomas.schaefer@kontron.com>
parent fd71ddf1
......@@ -35,6 +35,7 @@
#include <dwc3-uboot.h>
#include <i2c.h>
#include <search.h>
#include <mapmem.h>
#include "pitx-imx8m.h"
#include "../common/emb_eep.h"
......@@ -530,15 +531,46 @@ int misc_init_r(void)
hw_rev = get_hw_rev();
/* check if hw variant is L120 (7) */
if (hw_rev == 7) {
int nodeoffset;
void *fdt = map_sysmem((ulong)gd->fdt_blob, 0);
imx_iomux_v3_setup_pad(IMX8MQ_PAD_ECSPI1_MISO__GPIO5_IO8 |
MUX_PAD_CTRL(UART_PAD_CTRL));
MUX_PAD_CTRL(UART_PAD_CTRL));
imx_iomux_v3_setup_pad(IMX8MQ_PAD_ECSPI1_SS0__GPIO5_IO9 |
MUX_PAD_CTRL(UART_PAD_CTRL | PAD_CTL_PUE));
MUX_PAD_CTRL(UART_PAD_CTRL | PAD_CTL_PUE));
gpio_request(IMX_GPIO_NR(5, 8), "UART3_CTS#");
gpio_direction_output(IMX_GPIO_NR(5, 8), 0);
gpio_request(IMX_GPIO_NR(5, 9), "UART3_RTS#");
gpio_direction_input(IMX_GPIO_NR(5, 9));
/*
* Set SION for GPIO1_IO12 pad. This ensures that the pad
* cannot be put into GPIO output mode by the CLI 'gpio'
* command causing TPS2062 OUT2 to drive against
* V_5V0_USB1_OTG_VBUS voltage line from external host.
*
* In addition, usb0 port is removed from the u-boot device
* tree. This ensures that SION setting is not overwritten
* when 'usb start' is invoked.
*/
imx_iomux_v3_setup_pad(IMX8MQ_PAD_GPIO1_IO12__GPIO1_IO12 |
MUX_PAD_CTRL(NO_PAD_CTRL) |
MUX_MODE_SION);
/*
* Remove USB OTG port (usb0) from the device tree as we cannot
* use it in host mode on rev2 modules. However, using the ums
* command is still possible.
*/
nodeoffset = fdt_path_offset (fdt, "usb0");
if (nodeoffset < 0) {
printf("libfdt path 'usb0' not found,"
" cannot remove usb0 node\n");
return 0; /* No need to return an error code here */
}
if (!fdt_del_node (fdt, nodeoffset))
printf("Rev2 module: removing USB OTG port from DT\n");
}
return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment