From a3e3d4698e3c5812bba76cf0f35a0f71b27d5973 Mon Sep 17 00:00:00 2001 From: T Karthik Reddy Date: Fri, 1 Oct 2021 16:38:38 +0530 Subject: mmc: zynq_sdhci: Add xilinx_pm_request weak function Mini emmc does not use any pmufw and ZYNQMP_FIRMWARE is disabled. xilinx_pm_request() will not be compiled and causes undefined reference to `xilinx_pm_request' error. So add a weak function in zynq_sdhci.c file. Signed-off-by: T Karthik Reddy Signed-off-by: Ashok Reddy Soma Link: https://lore.kernel.org/r/1633086518-32636-1-git-send-email-t.karthik.reddy@xilinx.com Signed-off-by: Michal Simek --- drivers/mmc/zynq_sdhci.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'drivers') diff --git a/drivers/mmc/zynq_sdhci.c b/drivers/mmc/zynq_sdhci.c index c94825dceb9..5cea4c695e8 100644 --- a/drivers/mmc/zynq_sdhci.c +++ b/drivers/mmc/zynq_sdhci.c @@ -69,6 +69,12 @@ __weak int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value) return 0; } +__weak int xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, + u32 arg3, u32 *ret_payload) +{ + return 0; +} + #if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) /* Default settings for ZynqMP Clock Phases */ static const u32 zynqmp_iclk_phases[] = {0, 63, 63, 0, 63, 0, -- cgit v1.2.3 From eafdcda4a854932c0319656de7bf3f017f17ae67 Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 15 Oct 2021 15:03:29 +0200 Subject: net: gem: Disable broadcast setting There is no need for GEM to accepts broadcast packets because they are not handled by u-boot anyway. That's why use HW IP feature and don't waste time on these packats which will be dropped anyway. Signed-off-by: Michal Simek Reviewed-by: Ramon Fried Link: https://lore.kernel.org/r/0e236c3a6514a2a633ef3a5b71a967c46f7fbae7.1634303007.git.michal.simek@xilinx.com --- drivers/net/zynq_gem.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers') diff --git a/drivers/net/zynq_gem.c b/drivers/net/zynq_gem.c index ff599822673..c309c3c9549 100644 --- a/drivers/net/zynq_gem.c +++ b/drivers/net/zynq_gem.c @@ -60,6 +60,7 @@ #define ZYNQ_GEM_NWCFG_SPEED100 0x00000001 /* 100 Mbps operation */ #define ZYNQ_GEM_NWCFG_SPEED1000 0x00000400 /* 1Gbps operation */ #define ZYNQ_GEM_NWCFG_FDEN 0x00000002 /* Full Duplex mode */ +#define ZYNQ_GEM_NWCFG_NO_BRDC BIT(5) /* No broadcast */ #define ZYNQ_GEM_NWCFG_FSREM 0x00020000 /* FCS removal */ #define ZYNQ_GEM_NWCFG_SGMII_ENBL 0x08000000 /* SGMII Enable */ #define ZYNQ_GEM_NWCFG_PCS_SEL 0x00000800 /* PCS select */ @@ -77,6 +78,7 @@ #define ZYNQ_GEM_NWCFG_INIT (ZYNQ_GEM_DBUS_WIDTH | \ ZYNQ_GEM_NWCFG_FDEN | \ + ZYNQ_GEM_NWCFG_NO_BRDC | \ ZYNQ_GEM_NWCFG_FSREM | \ ZYNQ_GEM_NWCFG_MDCCLKDIV) -- cgit v1.2.3 From b05cc389bac1151aa6b14e2d6a66d06329d7e3fe Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 15 Oct 2021 16:57:38 +0200 Subject: firmware: zynqmp: Handle errors from ipi_req properly There are multiple errors what can happen in ipi_req but they are not propagated properly. That's why propage all error properly. Signed-off-by: Michal Simek Reviewed-by: Adrian Fiergolski Link: https://lore.kernel.org/r/7ac4f3b2104f04c72d287c46d1ccbce20f138fd4.1634309856.git.michal.simek@xilinx.com --- drivers/firmware/firmware-zynqmp.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index d4dc856bafa..7e0acc5bc8a 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -164,6 +164,7 @@ int __maybe_unused xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, * firmware API is limited by the SMC call size */ u32 regs[] = {api_id, arg0, arg1, arg2, arg3}; + int ret; if (api_id == PM_FPGA_LOAD) { /* Swap addr_hi/low because of incompatibility */ @@ -173,7 +174,10 @@ int __maybe_unused xilinx_pm_request(u32 api_id, u32 arg0, u32 arg1, u32 arg2, regs[2] = temp; } - ipi_req(regs, PAYLOAD_ARG_CNT, ret_payload, PAYLOAD_ARG_CNT); + ret = ipi_req(regs, PAYLOAD_ARG_CNT, ret_payload, + PAYLOAD_ARG_CNT); + if (ret) + return ret; #else return -EPERM; #endif -- cgit v1.2.3 From 53f5d1688e33f4c9c1e68ba132d50f8aca06fc3b Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Fri, 15 Oct 2021 16:57:39 +0200 Subject: firmware: zynqmp: fix write to an uninitialised pointer in ipi_req() When a caller is not interested in the returned message, the ret_payload pointer is set to NULL in the u-boot-sources. In this case, under EL3, the memory from address 0x0 would be overwritten by ipi_req() with the returned IPI message, damaging the original data under this address. The patch, in case ret_payload is NULL, assigns the pointer to the array holding the IPI message being sent. Signed-off-by: Adrian Fiergolski Signed-off-by: Michal Simek Reviewed-by: Adrian Fiergolski Link: https://lore.kernel.org/r/3178ff7651948270b714daa4adad48b94eaca9ba.1634309856.git.michal.simek@xilinx.com --- drivers/firmware/firmware-zynqmp.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'drivers') diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c index 7e0acc5bc8a..b44fede3079 100644 --- a/drivers/firmware/firmware-zynqmp.c +++ b/drivers/firmware/firmware-zynqmp.c @@ -29,6 +29,10 @@ static int ipi_req(const u32 *req, size_t req_len, u32 *res, size_t res_maxlen) { struct zynqmp_ipi_msg msg; int ret; + u32 buffer[PAYLOAD_ARG_CNT]; + + if (!res) + res = buffer; if (req_len > PMUFW_PAYLOAD_ARG_CNT || res_maxlen > PMUFW_PAYLOAD_ARG_CNT) -- cgit v1.2.3 From 4f9d25537ce969b3792c217298aa69df9116477b Mon Sep 17 00:00:00 2001 From: Ashok Reddy Soma Date: Tue, 19 Oct 2021 19:43:00 +0530 Subject: spi: zynqmp_gqspi: Fix write issue at low frequencies With current implementation we are seeing write issues at low frequencies below 15Mhz. Make below changes to fix the issue. 1. Remove dummy genfifo entry in zynqmp_qspi_chipselect() which was incorrectly added in the past 2. Enable and poll for TX_FIFO_Empty after Tx data is filled in FIFO in zynqmp_qspi_fill_tx_fifo(). Signed-off-by: Ashok Reddy Soma Link: https://lore.kernel.org/r/1634652780-21755-1-git-send-email-ashok.reddy.soma@xilinx.com Signed-off-by: Michal Simek --- drivers/spi/zynqmp_gqspi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/spi/zynqmp_gqspi.c b/drivers/spi/zynqmp_gqspi.c index 2db4ae20f1e..c772bae3ccf 100644 --- a/drivers/spi/zynqmp_gqspi.c +++ b/drivers/spi/zynqmp_gqspi.c @@ -37,6 +37,7 @@ */ #define GQSPI_IXR_TXNFULL_MASK 0x00000004 /* QSPI TX FIFO Overflow */ #define GQSPI_IXR_TXFULL_MASK 0x00000008 /* QSPI TX FIFO is full */ +#define GQSPI_IXR_TXFIFOEMPTY_MASK 0x00000100 /* QSPI TX FIFO is Empty */ #define GQSPI_IXR_RXNEMTY_MASK 0x00000010 /* QSPI RX FIFO Not Empty */ #define GQSPI_IXR_GFEMTY_MASK 0x00000080 /* QSPI Generic FIFO Empty */ #define GQSPI_IXR_GFNFULL_MASK 0x00000200 /* QSPI GENFIFO not full */ @@ -279,9 +280,6 @@ static void zynqmp_qspi_chipselect(struct zynqmp_qspi_priv *priv, int is_on) debug("GFIFO_CMD_CS: 0x%x\n", gqspi_fifo_reg); - /* Dummy generic FIFO entry */ - zynqmp_qspi_fill_gen_fifo(priv, 0); - zynqmp_qspi_fill_gen_fifo(priv, gqspi_fifo_reg); } @@ -470,6 +468,13 @@ static int zynqmp_qspi_fill_tx_fifo(struct zynqmp_qspi_priv *priv, u32 size) } } + ret = wait_for_bit_le32(®s->isr, GQSPI_IXR_TXFIFOEMPTY_MASK, 1, + GQSPI_TIMEOUT, 1); + if (ret) { + printf("%s: Timeout\n", __func__); + return ret; + } + priv->tx_buf += len; return 0; } -- cgit v1.2.3