spi/bcm63xx-hsspi: various fixes
Subsystems (2)
cover spi/bcm63xx-hsspi: various fixes
Hi Mark,
these are some of the fixes you requested for the driver. The devm_clk_get() was already taken care of by Jingoo Han, so I based this patchset on his patch(es).
I intentionally did not fix/implement RUNTIME_PM support since I did not get around to proper testing it (to ensure I don't try to disable disabled clocks etc).
Regards
Jonas
Jonas Gorski (3):
spi/bcm63xx-hsspi: check result of clk_prepare_enable spi/bcm63xx-hsspi: use devm_register_master() spi/bcm63xx-hsspi: fix pm sleep support
drivers/spi/spi-bcm63xx-hsspi.c | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-)
Signature · 5 lines
1.8.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1387313088-22493-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org
PATCH 1/3 spi/bcm63xx-hsspi: check result of clk_prepare_enable
Ensure we notice if the clock cannot be enabled for any reason and pass the error down.
--- drivers/spi/spi-bcm63xx-hsspi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/spi/spi-bcm63xx-hsspi.c +3 -1
@@ -351,7 +351,9 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev)if (!rate)return -EINVAL ; -clk_prepare_enable (clk); + ret =clk_prepare_enable (clk); +if (ret) +return ret; master =spi_alloc_master (&pdev->dev,sizeof (*bs));if (!master) {
Signature · 5 lines
1.8.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/3 spi/bcm63xx-hsspi: use devm_register_master()
In reply to a message not in the archiveSimplifies the remove call.
--- drivers/spi/spi-bcm63xx-hsspi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/spi/spi-bcm63xx-hsspi.c +1 -3
@@ -399,7 +399,7 @@ static int bcm63xx_hsspi_probe(struct platform_device *pdev) goto out_put_master;/* register and we are done */ - ret =spi_register_master (master); + ret =devm_spi_register_master (dev, master);if (ret) goto out_put_master;
@@ -418,8 +418,6 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev)struct spi_master *master =platform_get_drvdata (pdev);struct bcm63xx_hsspi *bs =spi_master_get_devdata (master); -spi_unregister_master (master); -/* reset the hardware and block queue progress */ __raw_writel (0 , bs->regs +HSSPI_INT_MASK_REG );clk_disable_unprepare (bs->clk);
Signature · 5 lines
1.8.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 3/3 spi/bcm63xx-hsspi: fix pm sleep support
In reply to a message not in the archiveUse the right CONFIG symbol to guard, properly (un)preprare clocks on suspend/resume, and check the result of it.
--- drivers/spi/spi-bcm63xx-hsspi.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
drivers/spi/spi-bcm63xx-hsspi.c +10 -13
@@ -425,14 +425,14 @@ static int bcm63xx_hsspi_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int bcm63xx_hsspi_suspend (struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);struct bcm63xx_hsspi *bs =spi_master_get_devdata (master);spi_master_suspend (master); -clk_disable (bs->clk); +clk_disable_unprepare (bs->clk);return 0 ; }
@@ -441,30 +441,27 @@ static int bcm63xx_hsspi_resume(struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);struct bcm63xx_hsspi *bs =spi_master_get_devdata (master); +int ret; + + ret =clk_prepare_enable (bs->clk); +if (ret) +return ret; -clk_enable (bs->clk);spi_master_resume (master);return 0 ; } +#endif static const struct dev_pm_ops bcm63xx_hsspi_pm_ops = { - .suspend = bcm63xx_hsspi_suspend, - .resume = bcm63xx_hsspi_resume, +SET_SYSTEM_SLEEP_PM_OPS (bcm63xx_hsspi_suspend, bcm63xx_hsspi_resume) }; -#define BCM63XX_HSSPI_PM_OPS (&bcm63xx_hsspi_pm_ops) -#else -#define BCM63XX_HSSPI_PM_OPS NULL -#endif - - -static struct platform_driver bcm63xx_hsspi_driver = { .driver = { .name ="bcm63xx-hsspi" , .owner =THIS_MODULE , - .pm =BCM63XX_HSSPI_PM_OPS , + .pm = &bcm63xx_hsspi_pm_ops, }, .probe = bcm63xx_hsspi_probe, .remove = bcm63xx_hsspi_remove,
Signature · 5 lines
1.8.5.1 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Mark Brown
AppliedQuoted 5 lines · Jonas Gorski
Hi Mark,
these are some of the fixes you requested for the driver. The
devm_clk_get()was already taken care of by Jingoo Han, so I based this patchset on his patch(es).
Applied, thanks.