board: tqma6: implement ENET errata workaround detection
TQMa6 SOM beginning with hardware rev. 0200 comes in two flavours: With and without a hardware workaround for ENET errata err006687. Therefore we need two flavours of device tree. To be able to detect the presence of the workaround we need to check GPIO1_6 is connected to I2C bus or not. If the I2C bus is detected, the workaround is not used and separate I2C buses are used for the SoM and the baseboard. Later on this detection will be used to select the correct devicetree at runtime. Signed-off-by: Markus Niebel <Markus.Niebel@ew.tq-group.com> Signed-off-by: Max Merchel <Max.Merchel@ew.tq-group.com>
This commit is contained in:
committed by
Fabio Estevam
parent
c6bf5b6a14
commit
17abea6ca0
@@ -31,6 +31,18 @@
|
||||
|
||||
DECLARE_GLOBAL_DATA_PTR;
|
||||
|
||||
/*
|
||||
* Rev. 0200 and newer optionally implements GIGE errata fix.
|
||||
* Use a global var to signal presence of the fix. This should be checked
|
||||
* early. If fix is present, system I2C is I2C1 - otherwise I2C3
|
||||
*/
|
||||
static int has_enet_workaround = -1;
|
||||
|
||||
int tqma6_has_enet_workaround(void)
|
||||
{
|
||||
return has_enet_workaround;
|
||||
}
|
||||
|
||||
int dram_init(void)
|
||||
{
|
||||
gd->ram_size = imx_ddr_size();
|
||||
@@ -38,6 +50,36 @@ int dram_init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define GPIO_REVDET_PAD_CTRL (PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_LOW | \
|
||||
PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
|
||||
|
||||
static const iomux_v3_cfg_t tqma6_revdet_pads[] = {
|
||||
MX6_PAD_GPIO_6__GPIO1_IO06 | MUX_PAD_CTRL(GPIO_REVDET_PAD_CTRL),
|
||||
};
|
||||
|
||||
void tqma6_detect_enet_workaround(void)
|
||||
{
|
||||
int ret;
|
||||
struct gpio_desc desc;
|
||||
|
||||
imx_iomux_v3_setup_multiple_pads(tqma6_revdet_pads,
|
||||
ARRAY_SIZE(tqma6_revdet_pads));
|
||||
|
||||
ret = dm_gpio_lookup_name("GPIO1_6", &desc);
|
||||
if (ret) {
|
||||
pr_err("error: gpio lookup for enet workaround %d\n", ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = dm_gpio_get_value(&desc);
|
||||
if (ret == 0)
|
||||
has_enet_workaround = 1;
|
||||
else if (ret > 0)
|
||||
has_enet_workaround = 0;
|
||||
|
||||
dm_gpio_free(NULL, &desc);
|
||||
}
|
||||
|
||||
int board_early_init_f(void)
|
||||
{
|
||||
return tq_bb_board_early_init_f();
|
||||
@@ -99,11 +141,27 @@ int board_late_init(void)
|
||||
{
|
||||
env_set("board_name", tqma6_get_boardname());
|
||||
|
||||
tqma6_detect_enet_workaround();
|
||||
|
||||
tq_bb_board_late_init();
|
||||
|
||||
printf("Board: %s on a %s\n", tqma6_get_boardname(),
|
||||
tq_bb_get_boardname());
|
||||
|
||||
puts("Enet workaround: ");
|
||||
switch (tqma6_has_enet_workaround()) {
|
||||
case 0:
|
||||
puts("absent");
|
||||
break;
|
||||
case 1:
|
||||
puts("implemented");
|
||||
break;
|
||||
default:
|
||||
puts("Unknown");
|
||||
break;
|
||||
};
|
||||
puts("\n");
|
||||
|
||||
return tq_bb_checkboard();
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-or-later */
|
||||
/*
|
||||
* Copyright (c) 2023-2026 TQ-Systems GmbH <u-boot@ew.tq-group.com>,
|
||||
* D-82229 Seefeld, Germany.
|
||||
* Author: Paul Gerber
|
||||
*/
|
||||
|
||||
#ifndef __TQMA6_H
|
||||
#define __TQMA6_H
|
||||
|
||||
int tqma6_has_enet_workaround(void);
|
||||
|
||||
#endif /* __TQMA6_H */
|
||||
Reference in New Issue
Block a user