Optimize Spreadtrum ADI driver
Subsystems (3)
cover Optimize Spreadtrum ADI driver
This patchset did some optimization to remove some redundant code, add more reboot mode support and change hardware spinlock support to be optional.
Baolin Wang (3):
spi: sprd: adi: Remove redundant address bits setting
spi: sprd: adi: Change hwlock to be optional
dt-bindings: spi: sprd: Change the hwlock support to be optional
Chenxu Wei (1):
spi: sprd: adi: Add a reset reason for TOS panic
Sherry Zong (2):
spi: sprd: adi: Add a reset reason for factory test mode
spi: sprd: adi: Add a reset reason for watchdog mode
.../devicetree/bindings/spi/spi-sprd-adi.txt | 11 ++- drivers/spi/spi-sprd-adi.c | 92 ++++++++++++++------ 2 files changed, 71 insertions(+), 32 deletions(-)
Signature · 1 line
1.7.9.5
PATCH 1/6 spi: sprd: adi: Remove redundant address bits setting
The ADI default transfer address bits is 12bit on Spreadtrum SC9860 platform, thus there is no need to set again, remove it.
--- drivers/spi/spi-sprd-adi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/spi/spi-sprd-adi.c +0 -3
@@ -380,9 +380,6 @@ static void sprd_adi_hw_init(struct sprd_adi *sadi)const __be32 *list;u32 tmp; -/* Address bits select default 12 bits */ -writel_relaxed (0 , sadi->base +REG_ADI_CTRL0 ); -/* Set all channels as default priority */ writel_relaxed (0 , sadi->base +REG_ADI_CHN_PRIL );writel_relaxed (0 , sadi->base +REG_ADI_CHN_PRIH );
Signature · 1 line
1.7.9.5
Mark Brown
maintainerApplied "spi: sprd: adi: Remove redundant address bits setting" to the spi tree
The patch
spi: sprd: adi: Remove redundant address bits setting
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
c627c58acdc48055a9e4d40d6f9f1b434222a68dMon Sep 17 00:00:00 2001
From: Baolin Wang <[email protected]>
Date: Fri, 26 Jul 2019 15:20:48 +0800
Subject: [PATCH] spi: sprd: adi: Remove redundant address bits setting
The ADI default transfer address bits is 12bit on Spreadtrum SC9860 platform, thus there is no need to set again, remove it.
--- drivers/spi/spi-sprd-adi.c | 3 --- 1 file changed, 3 deletions(-)
drivers/spi/spi-sprd-adi.c +0 -3
@@ -380,9 +380,6 @@ static void sprd_adi_hw_init(struct sprd_adi *sadi)const __be32 *list;u32 tmp; -/* Address bits select default 12 bits */ -writel_relaxed (0 , sadi->base +REG_ADI_CTRL0 ); -/* Set all channels as default priority */ writel_relaxed (0 , sadi->base +REG_ADI_CHN_PRIL );writel_relaxed (0 , sadi->base +REG_ADI_CHN_PRIH );
Signature · 1 line
2.20.1
PATCH 2/6 spi: sprd: adi: Add a reset reason for TOS panic
In reply to Baolin WangFrom: Chenxu Wei <[email protected]>
Add a new reset flag to indicate the reset reason is caused by TOS.
--- drivers/spi/spi-sprd-adi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-sprd-adi.c +3 -0
@@ -86,6 +86,7 @@#define BIT_WDG_EN BIT(2)/* Definition of PMIC reset status register */ +#define HWRST_STATUS_SECURITY 0x02#define HWRST_STATUS_RECOVERY 0x20#define HWRST_STATUS_NORMAL 0x40#define HWRST_STATUS_ALARM 0x50
@@ -336,6 +337,8 @@ static int sprd_adi_restart_handler(struct notifier_block *this, reboot_mode =HWRST_STATUS_IQMODE ; else if (!strncmp(cmd, "sprdisk", 7)) reboot_mode =HWRST_STATUS_SPRDISK ; + else if (!strncmp(cmd, "tospanic", 8)) + reboot_mode =HWRST_STATUS_SECURITY ; else reboot_mode =HWRST_STATUS_NORMAL ;
Signature · 1 line
1.7.9.5
Mark Brown
maintainerApplied "spi: sprd: adi: Add a reset reason for TOS panic" to the spi tree
The patch
spi: sprd: adi: Add a reset reason for TOS panic
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
cc6b3431b36a1109d44cb8e4015cc68dddc75208Mon Sep 17 00:00:00 2001
From: Chenxu Wei <[email protected]>
Date: Fri, 26 Jul 2019 15:20:49 +0800
Subject: [PATCH] spi: sprd: adi: Add a reset reason for TOS panic
Add a new reset flag to indicate the reset reason is caused by TOS.
--- drivers/spi/spi-sprd-adi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-sprd-adi.c +3 -0
@@ -86,6 +86,7 @@#define BIT_WDG_EN BIT(2)/* Definition of PMIC reset status register */ +#define HWRST_STATUS_SECURITY 0x02#define HWRST_STATUS_RECOVERY 0x20#define HWRST_STATUS_NORMAL 0x40#define HWRST_STATUS_ALARM 0x50
@@ -336,6 +337,8 @@ static int sprd_adi_restart_handler(struct notifier_block *this, reboot_mode =HWRST_STATUS_IQMODE ; else if (!strncmp(cmd, "sprdisk", 7)) reboot_mode =HWRST_STATUS_SPRDISK ; + else if (!strncmp(cmd, "tospanic", 8)) + reboot_mode =HWRST_STATUS_SECURITY ; else reboot_mode =HWRST_STATUS_NORMAL ;
Signature · 1 line
2.20.1
PATCH 3/6 spi: sprd: adi: Add a reset reason for factory test mode
In reply to Baolin WangFrom: Sherry Zong <[email protected]>
Add a new reset flag to indicate that the system need enter factory test mode after restarting system.
--- drivers/spi/spi-sprd-adi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-sprd-adi.c +3 -0
@@ -98,6 +98,7 @@#define HWRST_STATUS_AUTODLOADER 0xa0#define HWRST_STATUS_IQMODE 0xb0#define HWRST_STATUS_SPRDISK 0xc0 +#define HWRST_STATUS_FACTORYTEST 0xe0/* Use default timeout 50 ms that converts to watchdog values */ #define WDG_LOAD_VAL ((50 * 1000) / 32768)
@@ -339,6 +340,8 @@ static int sprd_adi_restart_handler(struct notifier_block *this, reboot_mode =HWRST_STATUS_SPRDISK ; else if (!strncmp(cmd, "tospanic", 8)) reboot_mode =HWRST_STATUS_SECURITY ; + else if (!strncmp(cmd, "factorytest", 11)) + reboot_mode =HWRST_STATUS_FACTORYTEST ; else reboot_mode =HWRST_STATUS_NORMAL ;
Signature · 1 line
1.7.9.5
Mark Brown
maintainerApplied "spi: sprd: adi: Add a reset reason for factory test mode" to the spi tree
The patch
spi: sprd: adi: Add a reset reason for factory test mode
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
9d9aa1cc91d68e2140e5948c15947b8254e008e2Mon Sep 17 00:00:00 2001
From: Sherry Zong <[email protected]>
Date: Fri, 26 Jul 2019 15:20:50 +0800
Subject: [PATCH] spi: sprd: adi: Add a reset reason for factory test mode
Add a new reset flag to indicate that the system need enter factory test mode after restarting system.
--- drivers/spi/spi-sprd-adi.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/spi/spi-sprd-adi.c +3 -0
@@ -98,6 +98,7 @@#define HWRST_STATUS_AUTODLOADER 0xa0#define HWRST_STATUS_IQMODE 0xb0#define HWRST_STATUS_SPRDISK 0xc0 +#define HWRST_STATUS_FACTORYTEST 0xe0/* Use default timeout 50 ms that converts to watchdog values */ #define WDG_LOAD_VAL ((50 * 1000) / 32768)
@@ -339,6 +340,8 @@ static int sprd_adi_restart_handler(struct notifier_block *this, reboot_mode =HWRST_STATUS_SPRDISK ; else if (!strncmp(cmd, "tospanic", 8)) reboot_mode =HWRST_STATUS_SECURITY ; + else if (!strncmp(cmd, "factorytest", 11)) + reboot_mode =HWRST_STATUS_FACTORYTEST ; else reboot_mode =HWRST_STATUS_NORMAL ;
Signature · 1 line
2.20.1
PATCH 4/6 spi: sprd: adi: Add a reset reason for watchdog mode
In reply to Baolin WangFrom: Sherry Zong <[email protected]>
When the system was rebooted by watchdog, now we did not save the watchdog reset mode which will make system enter a incorrect mode after rebooting.
Thus we should set the watchdog reset mode as default when opening the watchdog configuration, that means if the system was rebooted by other reason through the restart_handler(), then we will clear the default watchdog reset mode to save the correct reset mode.
--- drivers/spi/spi-sprd-adi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/spi/spi-sprd-adi.c +15 -0
@@ -99,6 +99,7 @@#define HWRST_STATUS_IQMODE 0xb0#define HWRST_STATUS_SPRDISK 0xc0#define HWRST_STATUS_FACTORYTEST 0xe0 +#define HWRST_STATUS_WATCHDOG 0xf0/* Use default timeout 50 ms that converts to watchdog values */ #define WDG_LOAD_VAL ((50 * 1000) / 32768)
@@ -309,6 +310,18 @@ static int sprd_adi_transfer_one(struct spi_controller *ctlr,return 0 ; } +static void sprd_adi_set_wdt_rst_mode (struct sprd_adi *sadi) +{ +#ifdef CONFIG_SPRD_WATCHDOG +u32 val; + +/* Set default watchdog reboot mode */ +sprd_adi_read (sadi, sadi->slave_pbase +PMIC_RST_STATUS , &val); + val |=HWRST_STATUS_WATCHDOG ; +sprd_adi_write (sadi, sadi->slave_pbase +PMIC_RST_STATUS , val); +#endif +} +static int sprd_adi_restart_handler (struct notifier_block *this,unsigned long mode,void *cmd) {
@@ -347,6 +360,7 @@ static int sprd_adi_restart_handler(struct notifier_block *this,/* Record the reboot mode */ sprd_adi_read (sadi, sadi->slave_pbase +PMIC_RST_STATUS , &val); + val &= ~HWRST_STATUS_WATCHDOG ; val |= reboot_mode;sprd_adi_write (sadi, sadi->slave_pbase +PMIC_RST_STATUS , val);
@@ -475,6 +489,7 @@ static int sprd_adi_probe(struct platform_device *pdev) }sprd_adi_hw_init (sadi); +sprd_adi_set_wdt_rst_mode (sadi); ctlr->dev.of_node = pdev->dev.of_node; ctlr->bus_num = pdev->id;
Signature · 1 line
1.7.9.5
Mark Brown
maintainerApplied "spi: sprd: adi: Add a reset reason for watchdog mode" to the spi tree
The patch
spi: sprd: adi: Add a reset reason for watchdog mode
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
e6d722ca09c1eebba5660e58b6bcac30c1ccc7caMon Sep 17 00:00:00 2001
From: Sherry Zong <[email protected]>
Date: Fri, 26 Jul 2019 15:20:51 +0800
Subject: [PATCH] spi: sprd: adi: Add a reset reason for watchdog mode
When the system was rebooted by watchdog, now we did not save the watchdog reset mode which will make system enter a incorrect mode after rebooting.
Thus we should set the watchdog reset mode as default when opening the watchdog configuration, that means if the system was rebooted by other reason through the restart_handler(), then we will clear the default watchdog reset mode to save the correct reset mode.
--- drivers/spi/spi-sprd-adi.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/spi/spi-sprd-adi.c +15 -0
@@ -99,6 +99,7 @@#define HWRST_STATUS_IQMODE 0xb0#define HWRST_STATUS_SPRDISK 0xc0#define HWRST_STATUS_FACTORYTEST 0xe0 +#define HWRST_STATUS_WATCHDOG 0xf0/* Use default timeout 50 ms that converts to watchdog values */ #define WDG_LOAD_VAL ((50 * 1000) / 32768)
@@ -309,6 +310,18 @@ static int sprd_adi_transfer_one(struct spi_controller *ctlr,return 0 ; } +static void sprd_adi_set_wdt_rst_mode (struct sprd_adi *sadi) +{ +#ifdef CONFIG_SPRD_WATCHDOG +u32 val; + +/* Set default watchdog reboot mode */ +sprd_adi_read (sadi, sadi->slave_pbase +PMIC_RST_STATUS , &val); + val |=HWRST_STATUS_WATCHDOG ; +sprd_adi_write (sadi, sadi->slave_pbase +PMIC_RST_STATUS , val); +#endif +} +static int sprd_adi_restart_handler (struct notifier_block *this,unsigned long mode,void *cmd) {
@@ -347,6 +360,7 @@ static int sprd_adi_restart_handler(struct notifier_block *this,/* Record the reboot mode */ sprd_adi_read (sadi, sadi->slave_pbase +PMIC_RST_STATUS , &val); + val &= ~HWRST_STATUS_WATCHDOG ; val |= reboot_mode;sprd_adi_write (sadi, sadi->slave_pbase +PMIC_RST_STATUS , val);
@@ -475,6 +489,7 @@ static int sprd_adi_probe(struct platform_device *pdev) }sprd_adi_hw_init (sadi); +sprd_adi_set_wdt_rst_mode (sadi); ctlr->dev.of_node = pdev->dev.of_node; ctlr->bus_num = pdev->id;
Signature · 1 line
2.20.1
PATCH 5/6 spi: sprd: adi: Change hwlock to be optional
In reply to Baolin WangNow Spreadtrum ADI controller supplies multiple master accessing channel to support multiple subsystems accessing, instead of using a hardware spinlock to synchronize between the multiple subsystems.
To keep backward compatibility, we should change the hardware spinlock to be optional. Moreover change to use of_hwspin_lock_get_id() function which return -ENOENT error number to indicate no hwlock support.
--- drivers/spi/spi-sprd-adi.c | 68 +++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 26 deletions(-)
drivers/spi/spi-sprd-adi.c +42 -26
@@ -165,14 +165,16 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg_paddr, u32 *read_val)int read_timeout =ADI_READ_TIMEOUT ;unsigned long flags;u32 val, rd_addr; -int ret; - - ret =hwspin_lock_timeout_irqsave (sadi->hwlock, -ADI_HWSPINLOCK_TIMEOUT , - &flags); -if (ret) { -dev_err (sadi->dev,"get the hw lock failed\n" ); -return ret; +int ret =0 ; + +if (sadi->hwlock) { + ret =hwspin_lock_timeout_irqsave (sadi->hwlock, +ADI_HWSPINLOCK_TIMEOUT , + &flags); +if (ret) { +dev_err (sadi->dev,"get the hw lock failed\n" ); +return ret; + } }/*
@@ -219,7 +221,8 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg_paddr, u32 *read_val) *read_val = val &RD_VALUE_MASK ; out: -hwspin_unlock_irqrestore (sadi->hwlock, &flags); +if (sadi->hwlock) +hwspin_unlock_irqrestore (sadi->hwlock, &flags);return ret; }
@@ -230,12 +233,14 @@ static int sprd_adi_write(struct sprd_adi *sadi, u32 reg_paddr, u32 val)unsigned long flags;int ret; - ret =hwspin_lock_timeout_irqsave (sadi->hwlock, -ADI_HWSPINLOCK_TIMEOUT , - &flags); -if (ret) { -dev_err (sadi->dev,"get the hw lock failed\n" ); -return ret; +if (sadi->hwlock) { + ret =hwspin_lock_timeout_irqsave (sadi->hwlock, +ADI_HWSPINLOCK_TIMEOUT , + &flags); +if (ret) { +dev_err (sadi->dev,"get the hw lock failed\n" ); +return ret; + } } ret =sprd_adi_drain_fifo (sadi);
@@ -261,7 +266,8 @@ static int sprd_adi_write(struct sprd_adi *sadi, u32 reg_paddr, u32 val) } out: -hwspin_unlock_irqrestore (sadi->hwlock, &flags); +if (sadi->hwlock) +hwspin_unlock_irqrestore (sadi->hwlock, &flags);return ret; }
@@ -476,16 +482,26 @@ static int sprd_adi_probe(struct platform_device *pdev) sadi->slave_pbase = res->start +ADI_SLAVE_OFFSET ; sadi->ctlr = ctlr; sadi->dev = &pdev->dev; - ret =of_hwspin_lock_get_id_byname (np,"adi" ); -if (ret <0 ) { -dev_err (&pdev->dev,"can not get the hardware spinlock\n" ); - goto put_ctlr; - } - - sadi->hwlock =devm_hwspin_lock_request_specific (&pdev->dev, ret); -if (!sadi->hwlock) { - ret = -ENXIO ; - goto put_ctlr; + ret =of_hwspin_lock_get_id (np,0 ); +if (ret >0 || (IS_ENABLED (CONFIG_HWSPINLOCK ) && ret ==0 )) { + sadi->hwlock = +devm_hwspin_lock_request_specific (&pdev->dev, ret); +if (!sadi->hwlock) { + ret = -ENXIO ; + goto put_ctlr; + } + }else { +switch (ret) { +case -ENOENT : +dev_info (&pdev->dev,"no hardware spinlock supplied\n" ); +break ; +default : +dev_err (&pdev->dev, +"failed to find hwlock id, %d\n" , ret); +/* fall-through */ +case -EPROBE_DEFER : + goto put_ctlr; + } }sprd_adi_hw_init (sadi);
Signature · 1 line
1.7.9.5
Mark Brown
maintainerApplied "spi: sprd: adi: Change hwlock to be optional" to the spi tree
The patch
spi: sprd: adi: Change hwlock to be optional
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
f9adf61e983f5d03334d841bc30f0e967a340b37Mon Sep 17 00:00:00 2001
From: Baolin Wang <[email protected]>
Date: Fri, 26 Jul 2019 15:20:52 +0800
Subject: [PATCH] spi: sprd: adi: Change hwlock to be optional
Now Spreadtrum ADI controller supplies multiple master accessing channel to support multiple subsystems accessing, instead of using a hardware spinlock to synchronize between the multiple subsystems.
To keep backward compatibility, we should change the hardware spinlock to be optional. Moreover change to use of_hwspin_lock_get_id() function which return -ENOENT error number to indicate no hwlock support.
--- drivers/spi/spi-sprd-adi.c | 68 +++++++++++++++++++++++--------------- 1 file changed, 42 insertions(+), 26 deletions(-)
drivers/spi/spi-sprd-adi.c +42 -26
@@ -165,14 +165,16 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg_paddr, u32 *read_val)int read_timeout =ADI_READ_TIMEOUT ;unsigned long flags;u32 val, rd_addr; -int ret; - - ret =hwspin_lock_timeout_irqsave (sadi->hwlock, -ADI_HWSPINLOCK_TIMEOUT , - &flags); -if (ret) { -dev_err (sadi->dev,"get the hw lock failed\n" ); -return ret; +int ret =0 ; + +if (sadi->hwlock) { + ret =hwspin_lock_timeout_irqsave (sadi->hwlock, +ADI_HWSPINLOCK_TIMEOUT , + &flags); +if (ret) { +dev_err (sadi->dev,"get the hw lock failed\n" ); +return ret; + } }/*
@@ -219,7 +221,8 @@ static int sprd_adi_read(struct sprd_adi *sadi, u32 reg_paddr, u32 *read_val) *read_val = val &RD_VALUE_MASK ; out: -hwspin_unlock_irqrestore (sadi->hwlock, &flags); +if (sadi->hwlock) +hwspin_unlock_irqrestore (sadi->hwlock, &flags);return ret; }
@@ -230,12 +233,14 @@ static int sprd_adi_write(struct sprd_adi *sadi, u32 reg_paddr, u32 val)unsigned long flags;int ret; - ret =hwspin_lock_timeout_irqsave (sadi->hwlock, -ADI_HWSPINLOCK_TIMEOUT , - &flags); -if (ret) { -dev_err (sadi->dev,"get the hw lock failed\n" ); -return ret; +if (sadi->hwlock) { + ret =hwspin_lock_timeout_irqsave (sadi->hwlock, +ADI_HWSPINLOCK_TIMEOUT , + &flags); +if (ret) { +dev_err (sadi->dev,"get the hw lock failed\n" ); +return ret; + } } ret =sprd_adi_drain_fifo (sadi);
@@ -261,7 +266,8 @@ static int sprd_adi_write(struct sprd_adi *sadi, u32 reg_paddr, u32 val) } out: -hwspin_unlock_irqrestore (sadi->hwlock, &flags); +if (sadi->hwlock) +hwspin_unlock_irqrestore (sadi->hwlock, &flags);return ret; }
@@ -476,16 +482,26 @@ static int sprd_adi_probe(struct platform_device *pdev) sadi->slave_pbase = res->start +ADI_SLAVE_OFFSET ; sadi->ctlr = ctlr; sadi->dev = &pdev->dev; - ret =of_hwspin_lock_get_id_byname (np,"adi" ); -if (ret <0 ) { -dev_err (&pdev->dev,"can not get the hardware spinlock\n" ); - goto put_ctlr; - } - - sadi->hwlock =devm_hwspin_lock_request_specific (&pdev->dev, ret); -if (!sadi->hwlock) { - ret = -ENXIO ; - goto put_ctlr; + ret =of_hwspin_lock_get_id (np,0 ); +if (ret >0 || (IS_ENABLED (CONFIG_HWSPINLOCK ) && ret ==0 )) { + sadi->hwlock = +devm_hwspin_lock_request_specific (&pdev->dev, ret); +if (!sadi->hwlock) { + ret = -ENXIO ; + goto put_ctlr; + } + }else { +switch (ret) { +case -ENOENT : +dev_info (&pdev->dev,"no hardware spinlock supplied\n" ); +break ; +default : +dev_err (&pdev->dev, +"failed to find hwlock id, %d\n" , ret); +/* fall-through */ +case -EPROBE_DEFER : + goto put_ctlr; + } }sprd_adi_hw_init (sadi);
Signature · 1 line
2.20.1
PATCH 6/6 dt-bindings: spi: sprd: Change the hwlock support to be optional
In reply to Baolin WangNo need to add hardware spinlock proctection due to add multiple msater channel, so change it to be optional in documentation.
--- .../devicetree/bindings/spi/spi-sprd-adi.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/spi/spi-sprd-adi.txt +8 -3
@@ -25,18 +25,23 @@ data by ADI software channels at the same time, or two parallel routine of setti ADI registers will make ADI controller registers chaos to lead incorrect results. Then we need one hardware spinlock to synchronize between the multiple subsystems. +The new version ADI controller supplies multiple master channels for different +subsystem accessing, that means no need to add hardware spinlock to synchronize, +thus change the hardware spinlock support to be optional to keep backward +compatibility. + Required properties: - compatible: Should be "sprd,sc9860-adi". - reg: Offset and length of ADI-SPI controller register space. -- hwlocks: Reference to a phandle of a hwlock provider node. -- hwlock-names: Reference to hwlock name strings defined in the same order - as the hwlocks, should be "adi". - #address-cells: Number of cells required to define a chip select address on the ADI-SPI bus. Should be set to 1. - #size-cells: Size of cells required to define a chip select address size on the ADI-SPI bus. Should be set to 0. Optional properties: +- hwlocks: Reference to a phandle of a hwlock provider node. +- hwlock-names: Reference to hwlock name strings defined in the same order + as the hwlocks, should be "adi". - sprd,hw-channels: This is an array of channel values up to 49 channels. The first value specifies the hardware channel id which is used to transfer data triggered by hardware automatically, and the second
Signature · 1 line
1.7.9.5
Mark Brown
maintainerRe: [PATCH 6/6] dt-bindings: spi: sprd: Change the hwlock support to be optional
Quoted 2 lines · Baolin Wang
No need to add hardware spinlock proctection due to add multiple msater channel, so change it to be optional in documentation.
Please use subject lines matching the style for the subsystem. This makes it easier for people to identify relevant patches.
Re: [PATCH 6/6] dt-bindings: spi: sprd: Change the hwlock support to be optional
Hi Mark,
Quoted 7 lines · Mark Brown
Quoted 2 lines · Baolin Wang
No need to add hardware spinlock proctection due to add multiple msater channel, so change it to be optional in documentation.
Please use subject lines matching the style for the subsystem. This makes it easier for people to identify relevant patches.
The subject lines format 'dt-bindings: xxx' was recommended by Rob, so I am not sure if I need to change the format as 'spi: sprd:'? Thanks.
Signature · 2 lines
Baolin Wang Best Regards
Mark Brown
maintainerApplied "spi: sprd: Change the hwlock support to be optional" to the spi tree
In reply to Baolin WangThe patch
spi: sprd: Change the hwlock support to be optional
has been applied to the spi tree at
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-5.4
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Quoted 1 line
From
70f69f481b87da0614360e57e05a3ba962d60439Mon Sep 17 00:00:00 2001
From: Baolin Wang <[email protected]>
Date: Fri, 26 Jul 2019 15:20:53 +0800
Subject: [PATCH] spi: sprd: Change the hwlock support to be optional
No need to add hardware spinlock proctection due to add multiple msater channel, so change it to be optional in documentation.
--- .../devicetree/bindings/spi/spi-sprd-adi.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/spi/spi-sprd-adi.txt +8 -3
@@ -25,18 +25,23 @@ data by ADI software channels at the same time, or two parallel routine of setti ADI registers will make ADI controller registers chaos to lead incorrect results. Then we need one hardware spinlock to synchronize between the multiple subsystems. +The new version ADI controller supplies multiple master channels for different +subsystem accessing, that means no need to add hardware spinlock to synchronize, +thus change the hardware spinlock support to be optional to keep backward +compatibility. + Required properties: - compatible: Should be "sprd,sc9860-adi". - reg: Offset and length of ADI-SPI controller register space. -- hwlocks: Reference to a phandle of a hwlock provider node. -- hwlock-names: Reference to hwlock name strings defined in the same order - as the hwlocks, should be "adi". - #address-cells: Number of cells required to define a chip select address on the ADI-SPI bus. Should be set to 1. - #size-cells: Size of cells required to define a chip select address size on the ADI-SPI bus. Should be set to 0. Optional properties: +- hwlocks: Reference to a phandle of a hwlock provider node. +- hwlock-names: Reference to hwlock name strings defined in the same order + as the hwlocks, should be "adi". - sprd,hw-channels: This is an array of channel values up to 49 channels. The first value specifies the hardware channel id which is used to transfer data triggered by hardware automatically, and the second
Signature · 1 line
2.20.1