spi/bcm63xx: fixes and cleanups
Subsystems (2)
cover spi/bcm63xx: fixes and cleanups
Hi Mark,
These four patches aim to improve the bcm63xx spi driver and fix various small issues.
The first two are actually a resend. I accidentially took an old (not working anymore) email address from you, I suspect they went under the radar. They are the same except that I added Florian's Acks.
These might be stable/3.13 material.
The latter two just do some smallish cleanups, and don't necessarily need backporting I think.
Patch 3 depends on Jingoo Han's devm_clk_get() patch, because that one makes sense and I wanted to do the same anyway (actually did, but he was faster ;-).
Regards
Jonas
Jonas Gorski (4):
spi/bcm63xx: don't substract prepend length from total length spi/bcm63xx: don't reject reads >= 256 bytes spi/bcm63xx: check return value of clk_prepare_enable spi/bcm63xx: fix pm sleep support
drivers/spi/spi-bcm63xx.c | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 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): 1387312930-22436-1-git-send-email-jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org
PATCH 1/4 spi/bcm63xx: don't substract prepend length from total length
The spi command must include the full message length including any prepended writes, else transfers larger than 256 bytes will be incomplete.
--- drivers/spi/spi-bcm63xx.c | 2 -- 1 file changed, 2 deletions(-)
drivers/spi/spi-bcm63xx.c +0 -2
@@ -169,8 +169,6 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first, transfer_list); } - len -= prepend_len; -init_completion (&bs->done);/* Fill in the Message control register */
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/4 spi/bcm63xx: don't reject reads >= 256 bytes
In reply to a message not in the archiveThe rx_tail register is only 8 bit wide, so it will wrap around after 256 read bytes. This makes it rather meaningless, so drop any usage of it to not treat reads over 256 as failed.
--- drivers/spi/spi-bcm63xx.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/spi/spi-bcm63xx.c +1 -7
@@ -203,13 +203,7 @@ static int bcm63xx_txrx_bufs(struct spi_device *spi, struct spi_transfer *first,if (!timeout)return -ETIMEDOUT ; -/* read out all data */ - rx_tail =bcm_spi_readb (bs,SPI_RX_TAIL ); - -if (do_rx && rx_tail != len) -return -EIO ; - -if (!rx_tail) +if (!do_rx)return 0 ; len =0 ;
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/4 spi/bcm63xx: check return value of clk_prepare_enable
In reply to a message not in the archiveEnsure we notice if the clock cannot be enabled for any reason and pass the error down.
--- drivers/spi/spi-bcm63xx.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/spi/spi-bcm63xx.c +8 -2
@@ -397,7 +397,10 @@ static int bcm63xx_spi_probe(struct platform_device *pdev) }/* Initialize hardware */ -clk_prepare_enable (bs->clk); + ret =clk_prepare_enable (bs->clk); +if (ret) + goto out_err; +bcm_spi_writeb (bs,SPI_INTR_CLEAR_ALL ,SPI_INT_STATUS );/* register and we are done */
@@ -450,8 +453,11 @@ static int bcm63xx_spi_resume(struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);struct bcm63xx_spi *bs =spi_master_get_devdata (master); +int ret; -clk_prepare_enable (bs->clk); + ret =clk_prepare_enable (bs->clk); +if (ret) +return ret;spi_master_resume (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 4/4 spi/bcm63xx: fix pm sleep support
In reply to a message not in the archiveUse the correct symbol to guard the callbacks and use appropriate defines for setting up the ops struct.
--- drivers/spi/spi-bcm63xx.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
drivers/spi/spi-bcm63xx.c +4 -9
@@ -436,7 +436,7 @@ static int bcm63xx_spi_remove(struct platform_device *pdev)return 0 ; } -#ifdef CONFIG_PM +#ifdef CONFIG_PM_SLEEP static int bcm63xx_spi_suspend (struct device *dev) {struct spi_master *master =dev_get_drvdata (dev);
@@ -463,22 +463,17 @@ static int bcm63xx_spi_resume(struct device *dev)return 0 ; } +#endif static const struct dev_pm_ops bcm63xx_spi_pm_ops = { - .suspend = bcm63xx_spi_suspend, - .resume = bcm63xx_spi_resume, +SET_SYSTEM_SLEEP_PM_OPS (bcm63xx_spi_suspend, bcm63xx_spi_resume) }; -#define BCM63XX_SPI_PM_OPS (&bcm63xx_spi_pm_ops) -#else -#define BCM63XX_SPI_PM_OPS NULL -#endif -static struct platform_driver bcm63xx_spi_driver = { .driver = { .name ="bcm63xx-spi" , .owner =THIS_MODULE , - .pm =BCM63XX_SPI_PM_OPS , + .pm = &bcm63xx_spi_pm_ops, }, .probe = bcm63xx_spi_probe, .remove = bcm63xx_spi_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 4 lines · Jonas Gorski
Hi Mark,
These four patches aim to improve the bcm63xx spi driver and fix various small issues.
Applied all, thanks.