[][kernel][mt7986][spi][spi-calibration: Fix probe flow error if flash devices don't need calibration]
[Description]
Fix probe flow error if flash devices don't need calibration
[Release-log]
N/A
Change-Id: I802edc6c7a5eceb5ec4109900fe123073d993ec2
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/7368325
diff --git a/target/linux/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch b/target/linux/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch
index 8a71a9c..17102ea 100644
--- a/target/linux/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch
+++ b/target/linux/mediatek/patches-5.4/9014-drivers-spi-Add-support-for-dynamic-calibration.patch
@@ -11,15 +11,14 @@
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
-@@ -1109,6 +1109,72 @@ static int spi_transfer_wait(struct spi_
+@@ -1109,6 +1109,73 @@ static int spi_transfer_wait(struct spi_
return 0;
}
+int spi_do_calibration(struct spi_controller *ctlr, struct spi_device *spi,
+ int (*cal_read)(void *priv, u32 *addr, int addrlen, u8 *buf, int readlen), void *drv_priv)
+{
-+ int datalen = ctlr->cal_rule->datalen;
-+ int addrlen = ctlr->cal_rule->addrlen;
++ int datalen, addrlen;
+ u8 *buf;
+ int ret;
+ int i;
@@ -33,6 +32,8 @@
+ /* Make sure we can start calibration */
+ if(!ctlr->cal_target || !ctlr->cal_rule || !ctlr->append_caldata)
+ return -EINVAL;
++ datalen = ctlr->cal_rule->datalen;
++ addrlen = ctlr->cal_rule->addrlen;
+
+ buf = kzalloc(datalen * sizeof(u8), GFP_KERNEL);
+ if(!buf)
@@ -84,7 +85,7 @@
static void _spi_transfer_delay_ns(u32 ns)
{
if (!ns)
-@@ -1720,6 +1786,75 @@ void spi_flush_queue(struct spi_controll
+@@ -1720,6 +1787,75 @@ void spi_flush_queue(struct spi_controll
/*-------------------------------------------------------------------------*/
#if defined(CONFIG_OF)
@@ -160,7 +161,7 @@
static int of_spi_parse_dt(struct spi_controller *ctlr, struct spi_device *spi,
struct device_node *nc)
{
-@@ -1841,6 +1976,10 @@ of_register_spi_device(struct spi_contro
+@@ -1841,6 +1977,10 @@ of_register_spi_device(struct spi_contro
if (rc)
goto err_out;