From 655dfc90d438a8e223317f197b888a92de3df3a1 Mon Sep 17 00:00:00 2001 From: "SkyLake.Huang" Date: Thu, 23 Jun 2022 18:39:03 +0800 Subject: [PATCH 4/6] drivers: spi-mt65xx: Add controller's calibration paramter Signed-off-by: SkyLake.Huang --- drivers/spi/spi-mt65xx.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) --- a/drivers/spi/spi-mt65xx.c +++ b/drivers/spi/spi-mt65xx.c @@ -842,6 +842,21 @@ static irqreturn_t mtk_spi_interrupt(int return IRQ_WAKE_THREAD; } +static int mtk_spi_append_caldata(struct spi_controller *ctlr) +{ + struct spi_cal_target *cal_target = kmalloc(sizeof(*cal_target), GFP_KERNEL); + struct mtk_spi *mdata = spi_controller_get_devdata(ctlr); + + cal_target->cal_item = &mdata->get_tick_dly; + cal_target->cal_min = 0; + cal_target->cal_max = 7; + cal_target->step = 1; + + list_add(&cal_target->list, ctlr->cal_target); + + return 0; +} + static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem, struct spi_mem_op *op) { @@ -1132,6 +1147,7 @@ static int mtk_spi_probe(struct platform host->setup = mtk_spi_setup; host->set_cs_timing = mtk_spi_set_hw_cs_timing; host->use_gpio_descriptors = true; + host->append_caldata = mtk_spi_append_caldata; mdata = spi_controller_get_devdata(host);