[PATCH 1/2] spi: rockchip-sfc: add RK3506 support

Mark Brown broonie at kernel.org
Thu Nov 26 13:28:16 PST 2026


> The RK3506 SFC reports version 9 but is compatible with the version 6
> feature set. It needs a power-good handshake through the PMU GRF and
> DLL delay-line training for clock rates above 50 MHz.
> 
> Add the version handling, DLL cell detection and training, and the
> optional power-good poll. Parse the rockchip,max-dll property so boards
> can limit the DLL training range.
> 
> Tested on an RK3506B board with the on-board SPI-NAND at 80 MHz.
> DLL training selects cell 64; read and write are stable.

> @@ -375,6 +427,15 @@ static int rockchip_sfc_xfer_setup(struct rockchip_sfc *sfc,
>  	dev_dbg(sfc->dev, "sfc ctrl=%x cmd=%x addr=%llx len=%x\n",
>  		ctrl, cmd, op->addr.val, len);
>  
> +	if (sfc->data && sfc->data->powergood.valid) {
> +		if (regmap_read_poll_timeout(sfc->grf, sfc->data->powergood.grf_offset,
> +					     voltage, voltage & sfc->data->powergood.bits_mask,
> +					     1000, jiffies_to_usecs(HZ))) {
> +			dev_err(sfc->dev, "wait for powergood failed\n");
> +			return -EIO;
> +		}
> +	}

I note that the callers don't seem to check the return value...

> +static void rockchip_sfc_delay_lines_tuning(struct rockchip_sfc *sfc, struct spi_mem *mem)
> +{

> +	if (rockchip_sfc_exec_op_bypass(sfc, mem, &op) ||
> +	    (0xFF == id[0] && 0xFF == id[1]) ||
> +	    (0x00 == id[0] && 0x00 == id[1])) {
> +		dev_dbg(sfc->dev, "no dev, dll by pass\n");
> +		rockchip_sfc_clk_set_rate(sfc, sfc->speed[cs]);
> +		sfc->speed[cs] = SFC_DLL_THRESHOLD_RATE;

Shouldn't we use the safe-frequency fallback?

-- 
Mark Brown <broonie at kernel.org>



More information about the Linux-rockchip mailing list