add support for bcm63xx HSSPI controller
Subsystems (3)
cover add support for bcm63xx HSSPI controller
This patch set adds support for the high speed SPI controller found in newer BCM63XX SoCs.
Patches 1 to 4 add the required platform data to bcm63xx, while Patch 5 adds the actual driver.
Since all the driver needs are the register block offset, an interrupt and a clock with a rate, it does not need any extra platform data. Therefore there is no compile time dependency, and patches 1 to 4, and patch 5 can go through different trees (these patches are based on spi/for-next).
While the controller itself has the same limitations as the old SPI controller, that is automatic deactivation of the CS line after flushing its hardware buffer.
But in contrast to the old one it supports CS polarity configuration, which allows us to work around it and manually control the CS lines. In addition to that it also supports dual mode (both read and write) and 3-wire, but both of them are not supported by the driver yet.
This driver was run tested on BCM63281, BCM63283 and BCM6361, and build tested for x86 to ensure COMPILE_TEST works.
Jonas Gorski (5):
MIPS: BCM63XX: expose the HSSPI clock
MIPS: BCM63XX: setup the HSSPI clock rate
MIPS: BCM63XX: add HSSPI IRQ and register offsets
MIPS: BCM63XX: add HSSPI platform device and register it
spi: add bcm63xx HSSPI driver
arch/mips/bcm63xx/Makefile | 4 +- arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 + arch/mips/bcm63xx/clk.c | 42 ++ arch/mips/bcm63xx/dev-hsspi.c | 47 ++ arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 18 + .../include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h | 8 + drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-bcm63xx-hsspi.c | 484 +++++++++++++++++++++ 9 files changed, 612 insertions(+), 2 deletions(-) create mode 100644 arch/mips/bcm63xx/dev-hsspi.c create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h create mode 100644 drivers/spi/spi-bcm63xx-hsspi.c
Signature · 5 lines
1.8.4.rc3 -- 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 1/5 MIPS: BCM63XX: expose the HSSPI clock
--- arch/mips/bcm63xx/clk.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
arch/mips/bcm63xx/clk.c +24 -0
@@ -226,6 +226,28 @@ static struct clk clk_spi = { };/* +* HSSPI clock +*/ +static void hsspi_set (struct clk *clk,int enable) +{ +u32 mask; + +if (BCMCPU_IS_6328 ()) + mask =CKCTL_6328_HSSPI_EN ; +else if (BCMCPU_IS_6362 ()) + mask =CKCTL_6362_HSSPI_EN ; +else +return ; + +bcm_hwclock_set (mask, enable); +} + +static struct clk clk_hsspi = { + .set = hsspi_set, +}; + + +/* * XTM clock */ static void xtm_set (struct clk *clk,int enable)
@@ -346,6 +368,8 @@ struct clk *clk_get(struct device *dev, const char *id)return &clk_usbd;if (!strcmp (id,"spi" ))return &clk_spi; +if (!strcmp (id,"hsspi" )) +return &clk_hsspi;if (!strcmp (id,"xtm" ))return &clk_xtm;if (!strcmp (id,"periph" ))
Signature · 5 lines
1.8.4.rc3 -- 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/5 MIPS: BCM63XX: setup the HSSPI clock rate
In reply to Jonas GorskiProperly set up the HSSPI clock rate depending on the SoC's PLL rate.
--- arch/mips/bcm63xx/clk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/mips/bcm63xx/clk.c +18 -0
@@ -390,3 +390,21 @@ void clk_put(struct clk *clk) }EXPORT_SYMBOL (clk_put); + +#define HSSPI_PLL_HZ_6328 133333333 +#define HSSPI_PLL_HZ_6362 400000000 + +static int __init bcm63xx_clk_init (void ) +{ +switch (bcm63xx_get_cpu_id ()) { +case BCM6328_CPU_ID : + clk_hsspi.rate =HSSPI_PLL_HZ_6328 ; +break ; +case BCM6362_CPU_ID : + clk_hsspi.rate =HSSPI_PLL_HZ_6362 ; +break ; + } + +return 0 ; +} +arch_initcall (bcm63xx_clk_init);
Signature · 5 lines
1.8.4.rc3 -- 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/5 MIPS: BCM63XX: add HSSPI IRQ and register offsets
In reply to Jonas Gorski--- arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
arch/mips/include/asm/mach-bcm63xx/bcm63xx_cpu.h +18 -0
@@ -145,6 +145,7 @@ enum bcm63xx_regs_set {RSET_UART1 ,RSET_GPIO ,RSET_SPI , +RSET_HSSPI ,RSET_UDC0 ,RSET_OHCI0 , RSET_OHCI_PRIV,
@@ -193,6 +194,7 @@ enum bcm63xx_regs_set {#define RSET_ENETDMAS_SIZE (chans) (16 * (chans))#define RSET_ENETSW_SIZE 65536#define RSET_UART_SIZE 24 +#define RSET_HSSPI_SIZE 1536#define RSET_UDC_SIZE 256#define RSET_OHCI_SIZE 256#define RSET_EHCI_SIZE 256
@@ -265,6 +267,7 @@ enum bcm63xx_regs_set {#define BCM_6328_UART1_BASE (0xb0000120)#define BCM_6328_GPIO_BASE (0xb0000080)#define BCM_6328_SPI_BASE (0xdeadbeef) +#define BCM_6328_HSSPI_BASE (0xb0001000)#define BCM_6328_UDC0_BASE (0xdeadbeef)#define BCM_6328_USBDMA_BASE (0xb000c000)#define BCM_6328_OHCI0_BASE (0xb0002600)
@@ -313,6 +316,7 @@ enum bcm63xx_regs_set {#define BCM_6338_UART1_BASE (0xdeadbeef)#define BCM_6338_GPIO_BASE (0xfffe0400)#define BCM_6338_SPI_BASE (0xfffe0c00) +#define BCM_6338_HSSPI_BASE (0xdeadbeef)#define BCM_6338_UDC0_BASE (0xdeadbeef)#define BCM_6338_USBDMA_BASE (0xfffe2400)#define BCM_6338_OHCI0_BASE (0xdeadbeef)
@@ -360,6 +364,7 @@ enum bcm63xx_regs_set {#define BCM_6345_UART1_BASE (0xdeadbeef)#define BCM_6345_GPIO_BASE (0xfffe0400)#define BCM_6345_SPI_BASE (0xdeadbeef) +#define BCM_6345_HSSPI_BASE (0xdeadbeef)#define BCM_6345_UDC0_BASE (0xdeadbeef)#define BCM_6345_USBDMA_BASE (0xfffe2800)#define BCM_6345_ENET0_BASE (0xfffe1800)
@@ -406,6 +411,7 @@ enum bcm63xx_regs_set {#define BCM_6348_UART1_BASE (0xdeadbeef)#define BCM_6348_GPIO_BASE (0xfffe0400)#define BCM_6348_SPI_BASE (0xfffe0c00) +#define BCM_6348_HSSPI_BASE (0xdeadbeef)#define BCM_6348_UDC0_BASE (0xfffe1000)#define BCM_6348_USBDMA_BASE (0xdeadbeef)#define BCM_6348_OHCI0_BASE (0xfffe1b00)
@@ -451,6 +457,7 @@ enum bcm63xx_regs_set {#define BCM_6358_UART1_BASE (0xfffe0120)#define BCM_6358_GPIO_BASE (0xfffe0080)#define BCM_6358_SPI_BASE (0xfffe0800) +#define BCM_6358_HSSPI_BASE (0xdeadbeef)#define BCM_6358_UDC0_BASE (0xfffe0800)#define BCM_6358_USBDMA_BASE (0xdeadbeef)#define BCM_6358_OHCI0_BASE (0xfffe1400)
@@ -553,6 +560,7 @@ enum bcm63xx_regs_set {#define BCM_6368_UART1_BASE (0xb0000120)#define BCM_6368_GPIO_BASE (0xb0000080)#define BCM_6368_SPI_BASE (0xb0000800) +#define BCM_6368_HSSPI_BASE (0xdeadbeef)#define BCM_6368_UDC0_BASE (0xdeadbeef)#define BCM_6368_USBDMA_BASE (0xb0004800)#define BCM_6368_OHCI0_BASE (0xb0001600)
@@ -604,6 +612,7 @@ extern const unsigned long *bcm63xx_regs_base; __GEN_RSET_BASE(__cpu, UART1) \ __GEN_RSET_BASE(__cpu, GPIO) \ __GEN_RSET_BASE(__cpu, SPI) \ + __GEN_RSET_BASE(__cpu, HSSPI) \ __GEN_RSET_BASE(__cpu, UDC0) \ __GEN_RSET_BASE(__cpu, OHCI0) \__GEN_RSET_BASE (__cpu,OHCI_PRIV ) \
@@ -647,6 +656,7 @@ extern const unsigned long *bcm63xx_regs_base; [RSET_UART1] = BCM_## __cpu ##_UART1_BASE, \ [RSET_GPIO] = BCM_## __cpu ##_GPIO_BASE, \ [RSET_SPI] = BCM_## __cpu ##_SPI_BASE, \ + [RSET_HSSPI] = BCM_## __cpu ##_HSSPI_BASE, \ [RSET_UDC0] = BCM_## __cpu ##_UDC0_BASE, \ [RSET_OHCI0] = BCM_## __cpu ##_OHCI0_BASE, \ [RSET_OHCI_PRIV] = BCM_## __cpu ##_OHCI_PRIV_BASE, \
@@ -727,6 +737,7 @@ enum bcm63xx_irq {IRQ_ENET0 ,IRQ_ENET1 ,IRQ_ENET_PHY , +IRQ_HSSPI ,IRQ_OHCI0 ,IRQ_EHCI0 , IRQ_USBD,
@@ -815,6 +826,7 @@ enum bcm63xx_irq {#define BCM_6328_ENET0_IRQ 0#define BCM_6328_ENET1_IRQ 0#define BCM_6328_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) +#define BCM_6328_HSSPI_IRQ (IRQ_INTERNAL_BASE + 29)#define BCM_6328_OHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 9)#define BCM_6328_EHCI0_IRQ (BCM_6328_HIGH_IRQ_BASE + 10)#define BCM_6328_USBD_IRQ (IRQ_INTERNAL_BASE + 4)
@@ -860,6 +872,7 @@ enum bcm63xx_irq {#define BCM_6338_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)#define BCM_6338_ENET1_IRQ 0#define BCM_6338_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) +#define BCM_6338_HSSPI_IRQ 0#define BCM_6338_OHCI0_IRQ 0#define BCM_6338_EHCI0_IRQ 0#define BCM_6338_USBD_IRQ 0
@@ -898,6 +911,7 @@ enum bcm63xx_irq {#define BCM_6345_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)#define BCM_6345_ENET1_IRQ 0#define BCM_6345_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 12) +#define BCM_6345_HSSPI_IRQ 0#define BCM_6345_OHCI0_IRQ 0#define BCM_6345_EHCI0_IRQ 0#define BCM_6345_USBD_IRQ 0
@@ -936,6 +950,7 @@ enum bcm63xx_irq {#define BCM_6348_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)#define BCM_6348_ENET1_IRQ (IRQ_INTERNAL_BASE + 7)#define BCM_6348_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) +#define BCM_6348_HSSPI_IRQ 0#define BCM_6348_OHCI0_IRQ (IRQ_INTERNAL_BASE + 12)#define BCM_6348_EHCI0_IRQ 0#define BCM_6348_USBD_IRQ 0
@@ -974,6 +989,7 @@ enum bcm63xx_irq {#define BCM_6358_ENET0_IRQ (IRQ_INTERNAL_BASE + 8)#define BCM_6358_ENET1_IRQ (IRQ_INTERNAL_BASE + 6)#define BCM_6358_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 9) +#define BCM_6358_HSSPI_IRQ 0#define BCM_6358_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)#define BCM_6358_EHCI0_IRQ (IRQ_INTERNAL_BASE + 10)#define BCM_6358_USBD_IRQ 0
@@ -1086,6 +1102,7 @@ enum bcm63xx_irq {#define BCM_6368_ENET0_IRQ 0#define BCM_6368_ENET1_IRQ 0#define BCM_6368_ENET_PHY_IRQ (IRQ_INTERNAL_BASE + 15) +#define BCM_6368_HSSPI_IRQ 0#define BCM_6368_OHCI0_IRQ (IRQ_INTERNAL_BASE + 5)#define BCM_6368_EHCI0_IRQ (IRQ_INTERNAL_BASE + 7)#define BCM_6368_USBD_IRQ (IRQ_INTERNAL_BASE + 8)
@@ -1133,6 +1150,7 @@ extern const int *bcm63xx_irqs; [IRQ_ENET0] = BCM_## __cpu ##_ENET0_IRQ, \ [IRQ_ENET1] = BCM_## __cpu ##_ENET1_IRQ, \ [IRQ_ENET_PHY] = BCM_## __cpu ##_ENET_PHY_IRQ, \ + [IRQ_HSSPI] = BCM_## __cpu ##_HSSPI_IRQ, \ [IRQ_OHCI0] = BCM_## __cpu ##_OHCI0_IRQ, \ [IRQ_EHCI0] = BCM_## __cpu ##_EHCI0_IRQ, \ [IRQ_USBD] = BCM_## __cpu ##_USBD_IRQ, \
Signature · 5 lines
1.8.4.rc3 -- 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/5 MIPS: BCM63XX: add HSSPI platform device and register it
In reply to Jonas Gorski--- arch/mips/bcm63xx/Makefile | 4 +- arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 ++ arch/mips/bcm63xx/dev-hsspi.c | 47 ++++++++++++++++++++++ .../include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h | 8 ++++ 4 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 arch/mips/bcm63xx/dev-hsspi.c create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
arch/mips/bcm63xx/Makefile +2 -2
@@ -1,7 +1,7 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ - dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \ - dev-usb-usbd.o + dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ + dev-wdt.o dev-usb-usbd.o obj-$(CONFIG_EARLY_PRINTK) += early_printk.o obj-y += boards/
arch/mips/bcm63xx/boards/board_bcm963xx.c +3 -0
@@ -23,6 +23,7 @@#include <bcm63xx_dev_enet.h> #include <bcm63xx_dev_dsp.h> #include <bcm63xx_dev_flash.h> +#include <bcm63xx_dev_hsspi.h> #include <bcm63xx_dev_pcmcia.h> #include <bcm63xx_dev_spi.h> #include <bcm63xx_dev_usb_usbd.h>
@@ -915,6 +916,8 @@ int __init board_register_devices(void)bcm63xx_spi_register (); +bcm63xx_hsspi_register (); +bcm63xx_flash_register (); bcm63xx_led_data.num_leds =ARRAY_SIZE (board.leds);
arch/mips/bcm63xx/dev-hsspi.c new file +47 -0
47 lines not on this page · raw message
arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef BCM63XX_DEV_HSSPI_H +#define BCM63XX_DEV_HSSPI_H + +#include <linux/types.h> + +int bcm63xx_hsspi_register (void ); + +#endif /* BCM63XX_DEV_HSSPI_H */
Signature · 5 lines
1.8.4.rc3 -- 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 5/5 spi: add bcm63xx HSSPI driver
In reply to Jonas GorskiAdd a driver for the High Speed SPI controller found on newer BCM63XX SoCs.
It does feature some new modes like 3-wire or dual spi, but neither of it is currently implemented.
--- drivers/spi/Kconfig | 7 + drivers/spi/Makefile | 1 + drivers/spi/spi-bcm63xx-hsspi.c | 484 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 492 insertions(+) create mode 100644 drivers/spi/spi-bcm63xx-hsspi.c
drivers/spi/Kconfig +7 -0
@@ -118,6 +118,13 @@ config SPI_BCM63XX help Enable support for the SPI controller on the Broadcom BCM63xx SoCs. +config SPI_BCM63XX_HSSPI + tristate "Broadcom BCM63XX HS SPI controller driver" + depends on BCM63XX || COMPILE_TEST + help + This enables support for the High Speed SPI controller present on + newer Broadcom BCM63XX SoCs. + config SPI_BITBANG tristate "Utilities for Bitbanging SPI masters" help
drivers/spi/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_SPI_ATH79) += spi-ath79.o obj-$(CONFIG_SPI_AU1550) += spi-au1550.o obj-$(CONFIG_SPI_BCM2835) += spi-bcm2835.o obj-$(CONFIG_SPI_BCM63XX) += spi-bcm63xx.o +obj-$(CONFIG_SPI_BCM63XX_HSSPI) += spi-bcm63xx-hsspi.o obj-$(CONFIG_SPI_BFIN5XX) += spi-bfin5xx.o obj-$(CONFIG_SPI_BFIN_V3) += spi-bfin-v3.o obj-$(CONFIG_SPI_BFIN_SPORT) += spi-bfin-sport.o
drivers/spi/spi-bcm63xx-hsspi.c new file +484 -0
484 lines not on this page · raw message
Signature · 5 lines
1.8.4.rc3 -- 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
maintainerRe: [PATCH 5/5] spi: add bcm63xx HSSPI driver
Quoted 4 lines · Jonas Gorski
Add a driver for the High Speed SPI controller found on newer BCM63XX SoCs.
It does feature some new modes like 3-wire or dual spi, but neither of it is currently implemented.
This is basically good so I've applied it but there are a few minor things that could use improving, please send incremental patches for these.
drivers/spi/spi-bcm63xx-hsspi.c line 345
Quoted 1 line
drivers/spi/spi-bcm63xx-hsspi.c new file +1
-0+ clk =clk_get (dev,"hsspi" );
Use devm_clk_get().
drivers/spi/spi-bcm63xx-hsspi.c line 356
Quoted 1 line
drivers/spi/spi-bcm63xx-hsspi.c new file +1
-0+clk_prepare_enable (clk);
You should check the return value here.
drivers/spi/spi-bcm63xx-hsspi.c line 404
Quoted 4 lines
drivers/spi/spi-bcm63xx-hsspi.c new file +4
-0+/* register and we are done */ + ret =spi_register_master (master); +if (ret) + goto out_put_master;
devm_spi_register_master().
Quoted 1 line
+#ifdef
CONFIG_PM
This should be CONFIG_PM_SLEEP.
drivers/spi/spi-bcm63xx-hsspi.c line 441
Quoted 7 lines
drivers/spi/spi-bcm63xx-hsspi.c new file +7
-0+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);
This ought to be disable_unprepare(). It would also be better to move this to runtime PM (you can set auto_runtime_pm to have the core manage the enable and disable for you) since that will save a bit of power.
drivers/spi/spi-bcm63xx-hsspi.c line 452
Quoted 7 lines
drivers/spi/spi-bcm63xx-hsspi.c new file +7
-0+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); + +clk_enable (bs->clk); +spi_master_resume (master);
Similar comments here, plus you should be checking errors.
Re: [PATCH 5/5] spi: add bcm63xx HSSPI driver
Quoted 9 lines · Mark Brown
Quoted 4 lines · Jonas Gorski
Add a driver for the High Speed SPI controller found on newer BCM63XX SoCs.
It does feature some new modes like 3-wire or dual spi, but neither of it is currently implemented.
This is basically good so I've applied it but there are a few minor things that could use improving, please send incremental patches for these.
Cool, thanks, will do. Expect a few days delay since I'm in the middle of a cold. I Don't want to introduce thinkos ;-)
Quoted 4 lines
Quoted 2 lines
+ clk =
clk_get(dev, "hsspi");Use
devm_clk_get().
Oh, it indeed seems to work now. The last time I tried it broke compilation because bcm63xx does not implement CLKDEV (or something like that).
Quoted 4 lines
Quoted 2 lines
+
clk_prepare_enable(clk);You should check the return value here.
True, even if it can't fail in the current supported platforms.
Quoted 7 lines
drivers/spi/spi-bcm63xx-hsspi.c line 404
Quoted 5 lines
drivers/spi/spi-bcm63xx-hsspi.c new file +4
-0+/* register and we are done */ + ret =spi_register_master (master); +if (ret) + goto out_put_master;
devm_spi_register_master().
Sure thing.
Quoted 4 lines
Quoted 2 lines
+#ifdef
CONFIG_PMThis should be
CONFIG_PM_SLEEP.
Ah, dammit, I knew I forgot something. I remember the same issue was fixed for spi-bcm63xx.c, but somehow forgot to check for it in this driver.
Quoted 11 lines
drivers/spi/spi-bcm63xx-hsspi.c line 441
Quoted 7 lines
drivers/spi/spi-bcm63xx-hsspi.c new file +7
-0+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);This ought to be
disable_unprepare(). It would also be better to move this to runtime PM (you can setauto_runtime_pmto have the core manage the enable and disable for you) since that will save a bit of power.
I already set auto_runtime_pm to true. I basically copied what's currently in spi-bcm63xx.c *coughs*. Is there anything else needed besides what you mentioned?
Quoted 10 lines
drivers/spi/spi-bcm63xx-hsspi.c line 452
Quoted 8 lines
drivers/spi/spi-bcm63xx-hsspi.c new file +7
-0+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); + +clk_enable (bs->clk); +spi_master_resume (master);Similar comments here, plus you should be checking errors.
Will fix that, too.
Regards
Jonas
--
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
maintainerRe: [PATCH 5/5] spi: add bcm63xx HSSPI driver
Quoted 9 lines · Jonas Gorski
Quoted 3 lines · Mark Brown
This ought to be
disable_unprepare(). It would also be better to move this to runtime PM (you can setauto_runtime_pmto have the core manage the enable and disable for you) since that will save a bit of power.I already set
auto_runtime_pmto true. I basically copied what's currently inspi-bcm63xx.c*coughs*. Is there anything else needed besides what you mentioned?
You'll need to call pm_runtime_enable() and so on to turn on runtime PM in probe() and reverse that in remove() but otherwise no, just adding the runtime callbacks should be fine.
Re: [PATCH 5/5] spi: add bcm63xx HSSPI driver
Quoted 7 lines · Mark Brown
Quoted 5 lines · Jonas Gorski
Quoted 3 lines · Mark Brown
This ought to be
disable_unprepare(). It would also be better to move this to runtime PM (you can setauto_runtime_pmto have the core manage the enable and disable for you) since that will save a bit of power.
Quoted 7 lines
Quoted 3 lines
I already set
auto_runtime_pmto true. I basically copied what's currently inspi-bcm63xx.c*coughs*. Is there anything else needed besides what you mentioned?You'll need to call
pm_runtime_enable()and so on to turn on runtime PM inprobe()and reverse that inremove()but otherwise no, just adding the runtime callbacks should be fine.
I see. Looks like I just copied your oversight from 5355d96d6fb56507761f261a23c0831f67fa0e0f ("spi/bcm63xx: Convert to core runtime PM") :P I'll add that to my list of things to fix.
Grepping through drivers/spi, I see a few drivers not calling pm_runtime_enable(), but setting auto_runtime_pm to true, and a few doing the opposite. These should probably aligned, too.
Regards
Jonas
--
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
maintainerRe: [PATCH 5/5] spi: add bcm63xx HSSPI driver
Quoted 9 lines · Jonas Gorski
Quoted 3 lines · Mark Brown
You'll need to call
pm_runtime_enable()and so on to turn on runtime PM inprobe()and reverse that inremove()but otherwise no, just adding the runtime callbacks should be fine.I see. Looks like I just copied your oversight from
5355d96d6fb56507761f261a23c0831f67fa0e0f("spi/bcm63xx: Convert to core runtime PM") :P I'll add that to my list of things to fix.
The driver was already broken there - the requirement to enable runtime PM is a part of the core runtime PM API. All that change did was factor out the enable and disable calls.
Quoted 3 lines
Grepping through
drivers/spi, I see a few drivers not callingpm_runtime_enable(), but settingauto_runtime_pmto true, and a few doing the opposite. These should probably aligned, too.
Not using the core runtime PM is fine, there may be reasons the driver wants to do this by hand. Things not enabling runtime PM are definitely buggy though.