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

spi: mediatek: add tick_delay support

This patch support tick_delay setting, some users need use
high-speed spi speed, which can use tick_delay to tuning spi clk timing.

Signed-off-by: Mason Zhang <Mason.Zhang@mediatek.com>
Link: https://lore.kernel.org/r/20210713114048.29509-1-mason.zhang@mediatek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Mason Zhang and committed by
Mark Brown
f84d866a 65ab894f

+11 -1
+10 -1
drivers/spi/spi-mt65xx.c
··· 42 42 #define SPI_CFG1_CS_IDLE_OFFSET 0 43 43 #define SPI_CFG1_PACKET_LOOP_OFFSET 8 44 44 #define SPI_CFG1_PACKET_LENGTH_OFFSET 16 45 - #define SPI_CFG1_GET_TICK_DLY_OFFSET 30 45 + #define SPI_CFG1_GET_TICK_DLY_OFFSET 29 46 46 47 + #define SPI_CFG1_GET_TICK_DLY_MASK 0xe0000000 47 48 #define SPI_CFG1_CS_IDLE_MASK 0xff 48 49 #define SPI_CFG1_PACKET_LOOP_MASK 0xff00 49 50 #define SPI_CFG1_PACKET_LENGTH_MASK 0x3ff0000 ··· 153 152 */ 154 153 static const struct mtk_chip_config mtk_default_chip_info = { 155 154 .sample_sel = 0, 155 + .tick_delay = 0, 156 156 }; 157 157 158 158 static const struct of_device_id mtk_spi_of_match[] = { ··· 276 274 if (mdata->dev_comp->need_pad_sel) 277 275 writel(mdata->pad_sel[spi->chip_select], 278 276 mdata->base + SPI_PAD_SEL_REG); 277 + 278 + /* tick delay */ 279 + reg_val = readl(mdata->base + SPI_CFG1_REG); 280 + reg_val &= ~SPI_CFG1_GET_TICK_DLY_MASK; 281 + reg_val |= ((chip_config->tick_delay & 0x7) 282 + << SPI_CFG1_GET_TICK_DLY_OFFSET); 283 + writel(reg_val, mdata->base + SPI_CFG1_REG); 279 284 280 285 return 0; 281 286 }
+1
include/linux/platform_data/spi-mt65xx.h
··· 12 12 /* Board specific platform_data */ 13 13 struct mtk_chip_config { 14 14 u32 sample_sel; 15 + u32 tick_delay; 15 16 }; 16 17 #endif