|
|
@@ -1,4 +1,4 @@
|
|
|
-From bfd3acc428085742d754a6d328d1a93ebf9451df Mon Sep 17 00:00:00 2001
|
|
|
+From bfa7cf42e610d820b935b4805aa80484d591cb1f Mon Sep 17 00:00:00 2001
|
|
|
From: "SkyLake.Huang" <[email protected]>
|
|
|
Date: Thu, 23 Jun 2022 18:29:51 +0800
|
|
|
Subject: [PATCH 1/6] drivers: spi-mt65xx: Move chip_config to driver's private
|
|
|
@@ -6,22 +6,22 @@ Subject: [PATCH 1/6] drivers: spi-mt65xx: Move chip_config to driver's private
|
|
|
|
|
|
Signed-off-by: SkyLake.Huang <[email protected]>
|
|
|
---
|
|
|
- drivers/spi/spi-mt65xx.c | 29 +++++++++---------------
|
|
|
+ drivers/spi/spi-mt65xx.c | 28 ++++++++++--------------
|
|
|
include/linux/platform_data/spi-mt65xx.h | 17 --------------
|
|
|
- 2 files changed, 11 insertions(+), 35 deletions(-)
|
|
|
+ 2 files changed, 11 insertions(+), 34 deletions(-)
|
|
|
delete mode 100644 include/linux/platform_data/spi-mt65xx.h
|
|
|
|
|
|
--- a/drivers/spi/spi-mt65xx.c
|
|
|
+++ b/drivers/spi/spi-mt65xx.c
|
|
|
-@@ -14,7 +14,6 @@
|
|
|
- #include <linux/of.h>
|
|
|
+@@ -15,7 +15,6 @@
|
|
|
#include <linux/gpio/consumer.h>
|
|
|
+ #include <linux/pinctrl/consumer.h>
|
|
|
#include <linux/platform_device.h>
|
|
|
-#include <linux/platform_data/spi-mt65xx.h>
|
|
|
#include <linux/pm_runtime.h>
|
|
|
#include <linux/spi/spi.h>
|
|
|
#include <linux/spi/spi-mem.h>
|
|
|
-@@ -171,6 +170,8 @@ struct mtk_spi {
|
|
|
+@@ -172,6 +171,8 @@ struct mtk_spi {
|
|
|
struct device *dev;
|
|
|
dma_addr_t tx_dma;
|
|
|
dma_addr_t rx_dma;
|
|
|
@@ -30,7 +30,7 @@ Signed-off-by: SkyLake.Huang <[email protected]>
|
|
|
};
|
|
|
|
|
|
static const struct mtk_spi_compatible mtk_common_compat;
|
|
|
-@@ -216,15 +217,6 @@ static const struct mtk_spi_compatible m
|
|
|
+@@ -217,15 +218,6 @@ static const struct mtk_spi_compatible m
|
|
|
.no_need_unprepare = true,
|
|
|
};
|
|
|
|
|
|
@@ -46,15 +46,15 @@ Signed-off-by: SkyLake.Huang <[email protected]>
|
|
|
static const struct of_device_id mtk_spi_of_match[] = {
|
|
|
{ .compatible = "mediatek,spi-ipm",
|
|
|
.data = (void *)&mtk_ipm_compat,
|
|
|
-@@ -352,7 +344,6 @@ static int mtk_spi_hw_init(struct spi_ma
|
|
|
+@@ -353,7 +345,6 @@ static int mtk_spi_hw_init(struct spi_co
|
|
|
{
|
|
|
u16 cpha, cpol;
|
|
|
u32 reg_val;
|
|
|
- struct mtk_chip_config *chip_config = spi->controller_data;
|
|
|
- struct mtk_spi *mdata = spi_master_get_devdata(master);
|
|
|
+ struct mtk_spi *mdata = spi_controller_get_devdata(host);
|
|
|
|
|
|
cpha = spi->mode & SPI_CPHA ? 1 : 0;
|
|
|
-@@ -402,7 +393,7 @@ static int mtk_spi_hw_init(struct spi_ma
|
|
|
+@@ -403,7 +394,7 @@ static int mtk_spi_hw_init(struct spi_co
|
|
|
else
|
|
|
reg_val &= ~SPI_CMD_CS_POL;
|
|
|
|
|
|
@@ -63,7 +63,7 @@ Signed-off-by: SkyLake.Huang <[email protected]>
|
|
|
reg_val |= SPI_CMD_SAMPLE_SEL;
|
|
|
else
|
|
|
reg_val &= ~SPI_CMD_SAMPLE_SEL;
|
|
|
-@@ -429,20 +420,20 @@ static int mtk_spi_hw_init(struct spi_ma
|
|
|
+@@ -430,20 +421,20 @@ static int mtk_spi_hw_init(struct spi_co
|
|
|
if (mdata->dev_comp->ipm_design) {
|
|
|
reg_val = readl(mdata->base + SPI_CMD_REG);
|
|
|
reg_val &= ~SPI_CMD_IPM_GET_TICKDLY_MASK;
|
|
|
@@ -87,9 +87,9 @@ Signed-off-by: SkyLake.Huang <[email protected]>
|
|
|
<< SPI_CFG1_GET_TICK_DLY_OFFSET_V1);
|
|
|
writel(reg_val, mdata->base + SPI_CFG1_REG);
|
|
|
}
|
|
|
-@@ -732,9 +723,6 @@ static int mtk_spi_setup(struct spi_devi
|
|
|
+@@ -733,9 +724,6 @@ static int mtk_spi_setup(struct spi_devi
|
|
|
{
|
|
|
- struct mtk_spi *mdata = spi_master_get_devdata(spi->master);
|
|
|
+ struct mtk_spi *mdata = spi_controller_get_devdata(spi->controller);
|
|
|
|
|
|
- if (!spi->controller_data)
|
|
|
- spi->controller_data = (void *)&mtk_default_chip_info;
|
|
|
@@ -97,17 +97,18 @@ Signed-off-by: SkyLake.Huang <[email protected]>
|
|
|
if (mdata->dev_comp->need_pad_sel && spi_get_csgpiod(spi, 0))
|
|
|
/* CS de-asserted, gpiolib will handle inversion */
|
|
|
gpiod_direction_output(spi_get_csgpiod(spi, 0), 0);
|
|
|
-@@ -1140,6 +1128,10 @@ static int mtk_spi_probe(struct platform
|
|
|
- mdata = spi_master_get_devdata(master);
|
|
|
- mdata->dev_comp = device_get_match_data(dev);
|
|
|
+@@ -1146,6 +1134,11 @@ static int mtk_spi_probe(struct platform
|
|
|
+ host->use_gpio_descriptors = true;
|
|
|
|
|
|
+ mdata = spi_controller_get_devdata(host);
|
|
|
++
|
|
|
+ /* Set device configs to default first. Calibrate it later. */
|
|
|
+ mdata->sample_sel = 0;
|
|
|
+ mdata->get_tick_dly = 2;
|
|
|
+
|
|
|
- if (mdata->dev_comp->enhance_timing)
|
|
|
- master->mode_bits |= SPI_CS_HIGH;
|
|
|
+ mdata->dev_comp = device_get_match_data(dev);
|
|
|
|
|
|
+ if (mdata->dev_comp->enhance_timing)
|
|
|
--- a/include/linux/platform_data/spi-mt65xx.h
|
|
|
+++ /dev/null
|
|
|
@@ -1,17 +0,0 @@
|