Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'spi-fix-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi

Pull spi fixes from Mark Brown:
"A small collection of fixes that came in during the past week, a few
driver specifics plus one fix for the spi-mem core where we weren't
taking account of the frequency capabilities of the system when
determining if it can support an operation"

* tag 'spi-fix-v6.17-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
spi: st: fix PM macros to use CONFIG_PM instead of CONFIG_PM_SLEEP
spi: spi-qpic-snand: fix calculating of ECC OOB regions' properties
spi: spi-fsl-lpspi: Clamp too high speed_hz
spi: spi-mem: add spi_mem_adjust_op_freq() in spi_mem_supports_op()
spi: spi-mem: Add missing kdoc argument
spi: spi-qpic-snand: use correct CW_PER_PAGE value for OOB write

+27 -17
+3 -5
drivers/spi/spi-fsl-lpspi.c
··· 330 330 } 331 331 332 332 if (config.speed_hz > perclk_rate / 2) { 333 - dev_err(fsl_lpspi->dev, 334 - "per-clk should be at least two times of transfer speed"); 335 - return -EINVAL; 333 + div = 2; 334 + } else { 335 + div = DIV_ROUND_UP(perclk_rate, config.speed_hz); 336 336 } 337 - 338 - div = DIV_ROUND_UP(perclk_rate, config.speed_hz); 339 337 340 338 for (prescale = 0; prescale <= prescale_max; prescale++) { 341 339 scldiv = div / (1 << prescale) - 2;
+4
drivers/spi/spi-mem.c
··· 265 265 */ 266 266 bool spi_mem_supports_op(struct spi_mem *mem, const struct spi_mem_op *op) 267 267 { 268 + /* Make sure the operation frequency is correct before going futher */ 269 + spi_mem_adjust_op_freq(mem, (struct spi_mem_op *)op); 270 + 268 271 if (spi_mem_check_op(op)) 269 272 return false; 270 273 ··· 580 577 * spi_mem_calc_op_duration() - Derives the theoretical length (in ns) of an 581 578 * operation. This helps finding the best variant 582 579 * among a list of possible choices. 580 + * @mem: the SPI memory 583 581 * @op: the operation to benchmark 584 582 * 585 583 * Some chips have per-op frequency limitations, PCBs usually have their own
+15 -7
drivers/spi/spi-qpic-snand.c
··· 210 210 struct qcom_nand_controller *snandc = nand_to_qcom_snand(nand); 211 211 struct qpic_ecc *qecc = snandc->qspi->ecc; 212 212 213 - if (section > 1) 214 - return -ERANGE; 213 + switch (section) { 214 + case 0: 215 + oobregion->offset = 0; 216 + oobregion->length = qecc->bytes * (qecc->steps - 1) + 217 + qecc->bbm_size; 218 + return 0; 219 + case 1: 220 + oobregion->offset = qecc->bytes * (qecc->steps - 1) + 221 + qecc->bbm_size + 222 + qecc->steps * 4; 223 + oobregion->length = mtd->oobsize - oobregion->offset; 224 + return 0; 225 + } 215 226 216 - oobregion->length = qecc->ecc_bytes_hw + qecc->spare_bytes; 217 - oobregion->offset = mtd->oobsize - oobregion->length; 218 - 219 - return 0; 227 + return -ERANGE; 220 228 } 221 229 222 230 static int qcom_spi_ooblayout_free(struct mtd_info *mtd, int section, ··· 1204 1196 u32 cfg0, cfg1, ecc_bch_cfg, ecc_buf_cfg; 1205 1197 1206 1198 cfg0 = (ecc_cfg->cfg0 & ~CW_PER_PAGE_MASK) | 1207 - FIELD_PREP(CW_PER_PAGE_MASK, num_cw - 1); 1199 + FIELD_PREP(CW_PER_PAGE_MASK, 0); 1208 1200 cfg1 = ecc_cfg->cfg1; 1209 1201 ecc_bch_cfg = ecc_cfg->ecc_bch_cfg; 1210 1202 ecc_buf_cfg = ecc_cfg->ecc_buf_cfg;
+5 -5
drivers/spi/spi-st-ssc4.c
··· 378 378 pinctrl_pm_select_sleep_state(&pdev->dev); 379 379 } 380 380 381 - static int __maybe_unused spi_st_runtime_suspend(struct device *dev) 381 + static int spi_st_runtime_suspend(struct device *dev) 382 382 { 383 383 struct spi_controller *host = dev_get_drvdata(dev); 384 384 struct spi_st *spi_st = spi_controller_get_devdata(host); ··· 391 391 return 0; 392 392 } 393 393 394 - static int __maybe_unused spi_st_runtime_resume(struct device *dev) 394 + static int spi_st_runtime_resume(struct device *dev) 395 395 { 396 396 struct spi_controller *host = dev_get_drvdata(dev); 397 397 struct spi_st *spi_st = spi_controller_get_devdata(host); ··· 428 428 } 429 429 430 430 static const struct dev_pm_ops spi_st_pm = { 431 - SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume) 432 - SET_RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL) 431 + SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume) 432 + RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL) 433 433 }; 434 434 435 435 static const struct of_device_id stm_spi_match[] = { ··· 441 441 static struct platform_driver spi_st_driver = { 442 442 .driver = { 443 443 .name = "spi-st", 444 - .pm = pm_sleep_ptr(&spi_st_pm), 444 + .pm = pm_ptr(&spi_st_pm), 445 445 .of_match_table = of_match_ptr(stm_spi_match), 446 446 }, 447 447 .probe = spi_st_probe,