developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 1 | From 6411311c9df3bce87ad46650053eb52cf12be889 Mon Sep 17 00:00:00 2001 |
| 2 | From: Sam Shih <sam.shih@mediatek.com> |
| 3 | Date: Fri, 2 Jun 2023 13:06:21 +0800 |
| 4 | Subject: [PATCH] |
| 5 | [spi-and-storage][999-2374-drivers-spi-mt65xx-Add-controller-calibration-parameter.patch] |
developer | ab8830e | 2022-06-23 19:02:41 +0800 | [diff] [blame] | 6 | |
developer | ab8830e | 2022-06-23 19:02:41 +0800 | [diff] [blame] | 7 | --- |
| 8 | drivers/spi/spi-mt65xx.c | 17 +++++++++++++++++ |
| 9 | 1 file changed, 17 insertions(+) |
| 10 | |
| 11 | diff --git a/drivers/spi/spi-mt65xx.c b/drivers/spi/spi-mt65xx.c |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 12 | index 32a0b0264..2034d1979 100644 |
developer | ab8830e | 2022-06-23 19:02:41 +0800 | [diff] [blame] | 13 | --- a/drivers/spi/spi-mt65xx.c |
| 14 | +++ b/drivers/spi/spi-mt65xx.c |
| 15 | @@ -727,6 +727,21 @@ static irqreturn_t mtk_spi_interrupt(int irq, void *dev_id) |
| 16 | return IRQ_HANDLED; |
| 17 | } |
| 18 | |
| 19 | +static int mtk_spi_append_caldata(struct spi_controller *ctlr) |
| 20 | +{ |
| 21 | + struct spi_cal_target *cal_target = kmalloc(sizeof(*cal_target), GFP_KERNEL); |
| 22 | + struct mtk_spi *mdata = spi_master_get_devdata(ctlr); |
| 23 | + |
| 24 | + cal_target->cal_item = &mdata->dev_config.get_tick_dly; |
| 25 | + cal_target->cal_min = 0; |
| 26 | + cal_target->cal_max = 7; |
| 27 | + cal_target->step = 1; |
| 28 | + |
| 29 | + list_add(&cal_target->list, ctlr->cal_target); |
| 30 | + |
| 31 | + return 0; |
| 32 | +} |
| 33 | + |
| 34 | static int mtk_spi_mem_adjust_op_size(struct spi_mem *mem, |
| 35 | struct spi_mem_op *op) |
| 36 | { |
| 37 | @@ -1009,6 +1024,8 @@ static int mtk_spi_probe(struct platform_device *pdev) |
| 38 | master->can_dma = mtk_spi_can_dma; |
| 39 | master->setup = mtk_spi_setup; |
| 40 | |
| 41 | + master->append_caldata = mtk_spi_append_caldata; |
| 42 | + |
| 43 | of_id = of_match_node(mtk_spi_of_match, pdev->dev.of_node); |
| 44 | if (!of_id) { |
| 45 | dev_err(&pdev->dev, "failed to probe of_node\n"); |
| 46 | -- |
developer | 5d148cb | 2023-06-02 13:08:11 +0800 | [diff] [blame] | 47 | 2.34.1 |
developer | ab8830e | 2022-06-23 19:02:41 +0800 | [diff] [blame] | 48 | |