From 0f1867c4d2a9238ddb4a520e53ac086ae698d03f Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:04:21 -0647 Subject: [PATCH 1/2] spi: s3c64xx: Do not cut a PIO transfer that fills the FIFO A PIO transfer of fifo_depth bytes or more is cut into pieces of fifo_depth - 1 bytes, because the RX trigger level of the interrupt mode stops one short of the FIFO. On the Pixel 9a's GNSS link the slave hands out one 64-byte block per chip-select cycle, and the cut loses data at the piece boundary (the channel is reset between the pieces). Transfer a full FIFO in one piece, polled, as the vendor driver does; keep the pieces of longer transfers a whole number of words, so a 32-bit transfer's packet count does not round down and time out. --- drivers/spi/spi-s3c64xx.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-s3c64xx.c b/drivers/spi/spi-s3c64xx.c index 827a2439b4..a65dbe21d2 100644 --- a/drivers/spi/spi-s3c64xx.c +++ b/drivers/spi/spi-s3c64xx.c @@ -832,6 +832,7 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host, const void *tx_buf = NULL; void *rx_buf = NULL; int target_len = 0, origin_len = 0; + unsigned int pio_len; int use_dma = 0; bool use_irq = false; int status; @@ -856,20 +857,31 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host, return status; } + /* + * A PIO piece must stay below the FIFO depth and hold whole words, or + * the packet count rounds down and the transfer times out. + */ + pio_len = rounddown(fifo_len - 1, DIV_ROUND_UP(bpw, BITS_PER_BYTE)); + if (!is_polling(sdd) && xfer->len >= fifo_len && sdd->rx_dma.ch && sdd->tx_dma.ch) { use_dma = 1; - } else if (xfer->len >= fifo_len) { + } else if (xfer->len > fifo_len) { tx_buf = xfer->tx_buf; rx_buf = xfer->rx_buf; origin_len = xfer->len; target_len = xfer->len; - xfer->len = fifo_len - 1; + xfer->len = pio_len; } do { - /* transfer size is greater than 32, change to IRQ mode */ - if (!use_dma && xfer->len > S3C64XX_SPI_POLLING_SIZE) + /* + * Transfers above 32 bytes use the RX trigger interrupt. Its + * level field stops one short of the FIFO, so a transfer that + * fills the FIFO exactly is polled instead of being cut. + */ + if (!use_dma && xfer->len > S3C64XX_SPI_POLLING_SIZE && + xfer->len < fifo_len) use_irq = true; if (use_irq) { @@ -960,7 +972,7 @@ static int s3c64xx_spi_transfer_one(struct spi_controller *host, xfer->rx_buf += xfer->len; if (target_len >= fifo_len) - xfer->len = fifo_len - 1; + xfer->len = pio_len; else xfer->len = target_len; } From 9b939940846cbdf5e8ba878d2492298b9c8bf57a Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Thu, 29 Oct 2026 09:04:33 -0647 Subject: [PATCH 2/2] clk: samsung: zumapro: Let USI3 reach OSCCLK for the GNSS SPI The Pixel 9a's GNSS SPI (SPI21 on HSI0 USI3) asks for 12.5 MHz, but the USI3 mux is read-only on the 399.36 MHz parent and its 4-bit divider stops at /16, so the IP clock is 24.96 MHz and the bus runs at 6.24 MHz, twice what stock uses. Google's clock table makes the 12 MHz setting from OSCCLK / 2. Let the rate request reach the mux (nMUX, so the clock framework may reparent) and pass it up through the divider and the source gate; the framework then picks OSCCLK and /2, 12.288 MHz, a 3.072 MHz bus. USI2 (the touchscreen) is unchanged. --- drivers/clk/samsung/clk-zumapro.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/clk/samsung/clk-zumapro.c b/drivers/clk/samsung/clk-zumapro.c index 44e3f211b9..7b9f1fff50 100644 --- a/drivers/clk/samsung/clk-zumapro.c +++ b/drivers/clk/samsung/clk-zumapro.c @@ -625,9 +625,8 @@ static const struct samsung_mux_clock hsi0_muxes[] __initconst = { MUX_F(CLK_MOUT_HSI0_USI2_LOCAL, "zumapro_mout_hsi0_usi2_local", mout_hsi0_usi2_local_parents, 0x101c, 0, 1, 0, CLK_MUX_READ_ONLY), - MUX_F(CLK_MOUT_HSI0_USI3_LOCAL, "zumapro_mout_hsi0_usi3_local", - mout_hsi0_usi3_local_parents, - 0x1020, 0, 1, 0, CLK_MUX_READ_ONLY), + nMUX(CLK_MOUT_HSI0_USI3_LOCAL, "zumapro_mout_hsi0_usi3_local", + mout_hsi0_usi3_local_parents, 0x1020, 0, 1), }; static const struct samsung_div_clock hsi0_dividers[] __initconst = { @@ -638,7 +637,7 @@ static const struct samsung_div_clock hsi0_dividers[] __initconst = { DIV_F(CLK_DOUT_HSI0_USI2, "zumapro_dout_hsi0_usi2", "zumapro_gout_hsi0_usi2_source", 0x181c, 0, 4, 0, 0), DIV_F(CLK_DOUT_HSI0_USI3, "zumapro_dout_hsi0_usi3", "zumapro_gout_hsi0_usi3_source", - 0x1820, 0, 4, 0, 0), + 0x1820, 0, 4, CLK_SET_RATE_PARENT, 0), }; static const struct samsung_gate_clock hsi0_gates[] __initconst = { @@ -651,7 +650,7 @@ static const struct samsung_gate_clock hsi0_gates[] __initconst = { 0x2100, 21, CLK_IGNORE_UNUSED, 0), GATE(CLK_GOUT_HSI0_USI3_SOURCE, "zumapro_gout_hsi0_usi3_source", "zumapro_mout_hsi0_usi3_local", - 0x2124, 21, CLK_IGNORE_UNUSED, 0), + 0x2124, 21, CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0), GATE(CLK_GOUT_HSI0_USI3_IP, "zumapro_gout_hsi0_usi3_ip", "zumapro_dout_hsi0_usi3", 0x2104, 21, CLK_IGNORE_UNUSED | CLK_SET_RATE_PARENT, 0), GATE(CLK_GOUT_HSI0_USI3_PCLK, "zumapro_gout_hsi0_usi3_pclk", "zumapro_mout_hsi0_noc_local",