/* Register SPBR */
#define RSPI_SPBR_SPR_MIN 0
-#define RSPI_SPBR_SPR_PCLK_MIN 1
#define RSPI_SPBR_SPR_MAX 255
/* Register SPCMD */
for (brdv = RSPI_SPCMD_BRDV_MIN; brdv <= RSPI_SPCMD_BRDV_MAX; brdv++) {
spr = DIV_ROUND_UP(clk_rate, hz * (1 << (brdv + 1)));
spr--;
+ /*
+ * Skip SPR=0 and BRDV=0 as it is not a valid combination:
+ * - On RZ/G3E, RZ/G3L, RZ/V2H(P) and RZ/V2N, RSPI_n_TCLK is
+ * fixed at 200MHz and SPR=0 and BRDV=0 results in the maximum
+ * bit rate of 100Mbps which is prohibited.
+ * - On RZ/T2H and RZ/N2H, when PCLK (125MHz) is used as
+ * the clock source, SPR=0 and BRDV=0 is explicitly listed
+ * as unsupported in the hardware manual (Table 36.7).
+ */
+ if (!spr && !brdv)
+ continue;
if (spr >= spr_min && spr <= spr_max)
goto clock_found;
}
rspi->info->find_tclk_rate(rspi->tclk, hz, RSPI_SPBR_SPR_MIN,
RSPI_SPBR_SPR_MAX, &best_clock);
- /*
- * T2H and N2H can also use PCLK as a source, which is 125MHz, but not
- * when both SPR and BRDV are 0.
- */
if (best_clock.error && rspi->info->find_pclk_rate)
- rspi->info->find_pclk_rate(rspi->pclk, hz, RSPI_SPBR_SPR_PCLK_MIN,
+ rspi->info->find_pclk_rate(rspi->pclk, hz, RSPI_SPBR_SPR_MIN,
RSPI_SPBR_SPR_MAX, &best_clock);
if (!best_clock.clk_rate)