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
This commit is contained in:
@@ -330,13 +330,11 @@ static int fsl_lpspi_set_bitrate(struct fsl_lpspi_data *fsl_lpspi)
|
||||
}
|
||||
|
||||
if (config.speed_hz > perclk_rate / 2) {
|
||||
dev_err(fsl_lpspi->dev,
|
||||
"per-clk should be at least two times of transfer speed");
|
||||
return -EINVAL;
|
||||
div = 2;
|
||||
} else {
|
||||
div = DIV_ROUND_UP(perclk_rate, config.speed_hz);
|
||||
}
|
||||
|
||||
div = DIV_ROUND_UP(perclk_rate, config.speed_hz);
|
||||
|
||||
for (prescale = 0; prescale <= prescale_max; prescale++) {
|
||||
scldiv = div / (1 << prescale) - 2;
|
||||
if (scldiv >= 0 && scldiv < 256) {
|
||||
|
||||
@@ -265,6 +265,9 @@ static bool spi_mem_internal_supports_op(struct spi_mem *mem,
|
||||
*/
|
||||
bool spi_mem_supports_op(struct spi_mem *mem, const struct spi_mem_op *op)
|
||||
{
|
||||
/* Make sure the operation frequency is correct before going futher */
|
||||
spi_mem_adjust_op_freq(mem, (struct spi_mem_op *)op);
|
||||
|
||||
if (spi_mem_check_op(op))
|
||||
return false;
|
||||
|
||||
@@ -577,6 +580,7 @@ EXPORT_SYMBOL_GPL(spi_mem_adjust_op_freq);
|
||||
* spi_mem_calc_op_duration() - Derives the theoretical length (in ns) of an
|
||||
* operation. This helps finding the best variant
|
||||
* among a list of possible choices.
|
||||
* @mem: the SPI memory
|
||||
* @op: the operation to benchmark
|
||||
*
|
||||
* Some chips have per-op frequency limitations, PCBs usually have their own
|
||||
|
||||
@@ -210,13 +210,21 @@ static int qcom_spi_ooblayout_ecc(struct mtd_info *mtd, int section,
|
||||
struct qcom_nand_controller *snandc = nand_to_qcom_snand(nand);
|
||||
struct qpic_ecc *qecc = snandc->qspi->ecc;
|
||||
|
||||
if (section > 1)
|
||||
return -ERANGE;
|
||||
switch (section) {
|
||||
case 0:
|
||||
oobregion->offset = 0;
|
||||
oobregion->length = qecc->bytes * (qecc->steps - 1) +
|
||||
qecc->bbm_size;
|
||||
return 0;
|
||||
case 1:
|
||||
oobregion->offset = qecc->bytes * (qecc->steps - 1) +
|
||||
qecc->bbm_size +
|
||||
qecc->steps * 4;
|
||||
oobregion->length = mtd->oobsize - oobregion->offset;
|
||||
return 0;
|
||||
}
|
||||
|
||||
oobregion->length = qecc->ecc_bytes_hw + qecc->spare_bytes;
|
||||
oobregion->offset = mtd->oobsize - oobregion->length;
|
||||
|
||||
return 0;
|
||||
return -ERANGE;
|
||||
}
|
||||
|
||||
static int qcom_spi_ooblayout_free(struct mtd_info *mtd, int section,
|
||||
@@ -1196,7 +1204,7 @@ static int qcom_spi_program_oob(struct qcom_nand_controller *snandc,
|
||||
u32 cfg0, cfg1, ecc_bch_cfg, ecc_buf_cfg;
|
||||
|
||||
cfg0 = (ecc_cfg->cfg0 & ~CW_PER_PAGE_MASK) |
|
||||
FIELD_PREP(CW_PER_PAGE_MASK, num_cw - 1);
|
||||
FIELD_PREP(CW_PER_PAGE_MASK, 0);
|
||||
cfg1 = ecc_cfg->cfg1;
|
||||
ecc_bch_cfg = ecc_cfg->ecc_bch_cfg;
|
||||
ecc_buf_cfg = ecc_cfg->ecc_buf_cfg;
|
||||
|
||||
@@ -378,7 +378,7 @@ static void spi_st_remove(struct platform_device *pdev)
|
||||
pinctrl_pm_select_sleep_state(&pdev->dev);
|
||||
}
|
||||
|
||||
static int __maybe_unused spi_st_runtime_suspend(struct device *dev)
|
||||
static int spi_st_runtime_suspend(struct device *dev)
|
||||
{
|
||||
struct spi_controller *host = dev_get_drvdata(dev);
|
||||
struct spi_st *spi_st = spi_controller_get_devdata(host);
|
||||
@@ -391,7 +391,7 @@ static int __maybe_unused spi_st_runtime_suspend(struct device *dev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int __maybe_unused spi_st_runtime_resume(struct device *dev)
|
||||
static int spi_st_runtime_resume(struct device *dev)
|
||||
{
|
||||
struct spi_controller *host = dev_get_drvdata(dev);
|
||||
struct spi_st *spi_st = spi_controller_get_devdata(host);
|
||||
@@ -428,8 +428,8 @@ static int __maybe_unused spi_st_resume(struct device *dev)
|
||||
}
|
||||
|
||||
static const struct dev_pm_ops spi_st_pm = {
|
||||
SET_SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
|
||||
SET_RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL)
|
||||
SYSTEM_SLEEP_PM_OPS(spi_st_suspend, spi_st_resume)
|
||||
RUNTIME_PM_OPS(spi_st_runtime_suspend, spi_st_runtime_resume, NULL)
|
||||
};
|
||||
|
||||
static const struct of_device_id stm_spi_match[] = {
|
||||
@@ -441,7 +441,7 @@ MODULE_DEVICE_TABLE(of, stm_spi_match);
|
||||
static struct platform_driver spi_st_driver = {
|
||||
.driver = {
|
||||
.name = "spi-st",
|
||||
.pm = pm_sleep_ptr(&spi_st_pm),
|
||||
.pm = pm_ptr(&spi_st_pm),
|
||||
.of_match_table = of_match_ptr(stm_spi_match),
|
||||
},
|
||||
.probe = spi_st_probe,
|
||||
|
||||
Reference in New Issue
Block a user