Merge branch '2023-09-22-assorted-bugfixes'
- A few driver fixes and MAINTAINER updates
diff --git a/MAINTAINERS b/MAINTAINERS
index 0a10a43..281a3f8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -723,7 +723,10 @@
F: drivers/video/mcde_simple.c
ARM UNIPHIER
-S: Orphan (Since 2020-09)
+M: Kunihiko Hayashi <hayashi.kunihiko@socionext.com>
+R: Dai Okamura <okamura.dai@socionext.com>
+S: Maintained
+F: arch/arm/dts/uniphier-*
F: arch/arm/mach-uniphier/
F: configs/uniphier_*_defconfig
N: uniphier
diff --git a/board/technexion/pico-imx7d/MAINTAINERS b/board/technexion/pico-imx7d/MAINTAINERS
index 325e173..5dccac4 100644
--- a/board/technexion/pico-imx7d/MAINTAINERS
+++ b/board/technexion/pico-imx7d/MAINTAINERS
@@ -1,5 +1,4 @@
TechNexion PICO-IMX7D board
-M: Vanessa Maegima <vanessa.maegima@nxp.com>
M: Otavio Salvador <otavio@ossystems.com.br>
S: Maintained
F: board/technexion/pico-imx7d/
diff --git a/configs/am65x_evm_r5_usbmsc_defconfig b/configs/am65x_evm_r5_usbmsc_defconfig
index 8da49c7..733a1c1 100644
--- a/configs/am65x_evm_r5_usbmsc_defconfig
+++ b/configs/am65x_evm_r5_usbmsc_defconfig
@@ -85,6 +85,7 @@
CONFIG_DM_MAILBOX=y
CONFIG_K3_SEC_PROXY=y
CONFIG_MISC=y
+CONFIG_SPL_MISC=y
CONFIG_K3_AVS0=y
# CONFIG_MMC is not set
CONFIG_PHY=y
@@ -122,6 +123,7 @@
CONFIG_USB_XHCI_DWC3=y
CONFIG_USB_DWC3=y
CONFIG_USB_DWC3_GENERIC=y
+CONFIG_SPL_USB_DWC3_GENERIC=y
CONFIG_USB_STORAGE=y
CONFIG_SPL_USB_STORAGE=y
CONFIG_USB_GADGET=y
diff --git a/drivers/i2c/mtk_i2c.c b/drivers/i2c/mtk_i2c.c
index 2f331d3..5592fe9 100644
--- a/drivers/i2c/mtk_i2c.c
+++ b/drivers/i2c/mtk_i2c.c
@@ -621,7 +621,7 @@
i2c_writel(priv, REG_INTR_MASK, ~(restart_flag | I2C_HS_NACKERR |
I2C_ACKERR | I2C_TRANSAC_COMP));
- if (!tmo && trans_error != 0) {
+ if (tmo || trans_error != 0) {
if (tmo) {
ret = -ETIMEDOUT;
if (!priv->filter_msg)
diff --git a/drivers/net/sni_netsec.c b/drivers/net/sni_netsec.c
index 9780f20..71afe78 100644
--- a/drivers/net/sni_netsec.c
+++ b/drivers/net/sni_netsec.c
@@ -286,6 +286,8 @@
bool err_flag;
};
+static int netsec_reset_hardware(struct netsec_priv *priv, bool load_ucode);
+
static void netsec_write_reg(struct netsec_priv *priv, u32 reg_addr, u32 val)
{
writel(val, priv->ioaddr + reg_addr);
@@ -532,18 +534,11 @@
return 0;
}
-static int netsec_start_gmac(struct netsec_priv *priv)
+static int netsec_reset_gmac(struct netsec_priv *priv)
{
u32 value = 0;
int ret;
- if (priv->max_speed != SPEED_1000)
- value = (NETSEC_GMAC_MCR_REG_CST |
- NETSEC_GMAC_MCR_REG_HALF_DUPLEX_COMMON);
-
- if (netsec_set_mac_reg(priv, GMAC_REG_MCR, value))
- return -ETIMEDOUT;
-
if (netsec_set_mac_reg(priv, GMAC_REG_BMR,
NETSEC_GMAC_BMR_REG_RESET))
return -ETIMEDOUT;
@@ -558,10 +553,47 @@
if (value & NETSEC_GMAC_BMR_REG_SWR)
return -EAGAIN;
+ /**
+ * NETSEC GMAC sometimes shows the peculiar behaviour where
+ * MAC_REG_DESC_SOFT_RST never been cleared, resulting in the loss of
+ * sending packets.
+ *
+ * Workaround:
+ * Restart NETSEC and PHY, retry again.
+ */
netsec_write_reg(priv, MAC_REG_DESC_SOFT_RST, 1);
- if (netsec_wait_while_busy(priv, MAC_REG_DESC_SOFT_RST, 1))
+ udelay(1000);
+ if (netsec_read_reg(priv, MAC_REG_DESC_SOFT_RST)) {
+ phy_shutdown(priv->phydev);
+ netsec_reset_hardware(priv, false);
+ phy_startup(priv->phydev);
+ return -EAGAIN;
+ }
+ return 0;
+}
+
+static int netsec_start_gmac(struct netsec_priv *priv)
+{
+ u32 value = 0;
+ u32 failure = 0;
+ int ret;
+
+ if (priv->max_speed != SPEED_1000)
+ value = (NETSEC_GMAC_MCR_REG_CST |
+ NETSEC_GMAC_MCR_REG_HALF_DUPLEX_COMMON);
+
+ if (netsec_set_mac_reg(priv, GMAC_REG_MCR, value))
return -ETIMEDOUT;
+ /* Reset GMAC */
+ while ((ret = netsec_reset_gmac(priv)) == -EAGAIN && ++failure < 3)
+ ;
+
+ if (ret) {
+ pr_err("%s: failed to reset gmac(err=%d).\n", __func__, ret);
+ return ret;
+ }
+
netsec_write_reg(priv, MAC_REG_DESC_INIT, 1);
if (netsec_wait_while_busy(priv, MAC_REG_DESC_INIT, 1))
return -ETIMEDOUT;
diff --git a/net/wget.c b/net/wget.c
index 2dbfeb1..8bb4d72 100644
--- a/net/wget.c
+++ b/net/wget.c
@@ -35,7 +35,8 @@
* The actual packet bufers are in the kernel space, and are
* expected to be overwritten by the downloaded image.
*/
-static struct pkt_qd pkt_q[PKTBUFSRX / 4];
+#define PKTQ_SZ (PKTBUFSRX / 4)
+static struct pkt_qd pkt_q[PKTQ_SZ];
static int pkt_q_idx;
static unsigned long content_length;
static unsigned int packets;
@@ -202,6 +203,13 @@
pkt_q[pkt_q_idx].tcp_seq_num = tcp_seq_num;
pkt_q[pkt_q_idx].len = len;
pkt_q_idx++;
+
+ if (pkt_q_idx >= PKTQ_SZ) {
+ printf("wget: Fatal error, queue overrun!\n");
+ net_set_state(NETLOOP_FAIL);
+
+ return;
+ }
} else {
debug_cond(DEBUG_WGET, "wget: Connected HTTP Header %p\n", pkt);
/* sizeof(http_eom) - 1 is the string length of (http_eom) */