Re: [PATCH] ARM: dts: at91: sama5d2_ptc_ek: fix nand pinctrl
On 07/09/2018 at 10:18, Ludovic Desroches wrote: The drive strength has to be set to medium otherwise some data corruption may happen. Signed-off-by: Ludovic Desroches Acked-by: Nicolas Ferre --- Hi, This fix depends on the support of the drive-strength for the atmel pio4 pinctroller. It has been added in v4.19 but I omitted to send it at the same time. Could be good to be queued for "4.19-fixes". Best regards, Nicolas Ludovic arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts index b10dccd0958f..3b1baa8605a7 100644 --- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts @@ -11,6 +11,7 @@ #include "sama5d2-pinfunc.h" #include #include +#include / { model = "Atmel SAMA5D2 PTC EK"; @@ -299,6 +300,7 @@ , ; bias-pull-up; + atmel,drive-strength = ; }; ale_cle_rdy_cs { -- Nicolas Ferre
Re: [PATCH 0/6] shutdown procedure verification for SAMA5D2
On 30/08/2018 at 13:50, Claudiu Beznea wrote: Hi, Patch 1 from this series implement a fix for shutdown procedure for SAMA5D2. The rest of the patch are improvements as follows: patch 2 - use only one function for poweroff patches 3-6 - cosmetic improvements For the whole series: Acked-by: Nicolas Ferre The patches are based on latest sys-reset/for-next [1]. Thank you, Claudiu Beznea [1] https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git Claudiu Beznea (6): power: reset: at91-poweroff: switch to slow clock before shutdown power: reset: at91-poweroff: use only one poweroff function power: reset: at91-poweroff: make mpddrc_base part of struct shdwc power: reset: at91-poweroff: make sclk part of struct shdwc power: reset: at91-poweroff: rename at91_shdwc_base member of struct shdwc power: reset: at91-poweroff: do not procede if at91_shdwc is allocated arch/arm/mach-at91/pm_suspend.S | 8 +++ drivers/power/reset/at91-sama5d2_shdwc.c | 119 +-- 2 files changed, 88 insertions(+), 39 deletions(-) -- Nicolas Ferre
[PATCH 11/11] MAINTAINERS: sdhci: move the Microchip entry to proper location
All SDHCI controller drivers are gathered at the same place, add the Microchip one there. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 78044223d90f..df2f61548308 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2483,12 +2483,6 @@ S: Maintained F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c -ATMEL SDMMC DRIVER -M: Ludovic Desroches -L: linux-...@vger.kernel.org -S: Supported -F: drivers/mmc/host/sdhci-of-at91.c - ATMEL WIRELESS DRIVER M: Simon Kelley L: linux-wirel...@vger.kernel.org @@ -13006,6 +13000,12 @@ L: linux-...@vger.kernel.org S: Maintained F: drivers/mmc/host/sdhci-pci-dwc-mshc.c +SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) MICROCHIP DRIVER +M: Ludovic Desroches +L: linux-...@vger.kernel.org +S: Supported +F: drivers/mmc/host/sdhci-of-at91.c + SECURE DIGITAL HOST CONTROLLER INTERFACE (SDHCI) SAMSUNG DRIVER M: Ben Dooks M: Jaehoon Chung -- 2.17.1
[PATCH 03/11] MAINTAINERS: media: change Microchip ISI, ISC maintainers
For ISC, Songjun is not with Microchip anymore, his address shouldn't be reachable. For ISI, Eugen can handle the maintenance now. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 43fa2ebb292e..6eaf54960c1c 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2494,7 +2494,7 @@ S:Supported F: drivers/i2c/busses/i2c-at91.c ATMEL ISI DRIVER -M: Ludovic Desroches +M: Eugen Hristev L: linux-me...@vger.kernel.org S: Supported F: drivers/media/platform/atmel/atmel-isi.c @@ -9520,7 +9520,7 @@ S:Maintained F: drivers/crypto/atmel-ecc.* MICROCHIP / ATMEL ISC DRIVER -M: Songjun Wu +M: Eugen Hristev L: linux-me...@vger.kernel.org S: Supported F: drivers/media/platform/atmel/atmel-isc.c -- 2.17.1
[PATCH 09/11] MAINTAINERS: remove the / ATMEL string from MICROCHIP entries
No need to keep this additional string as it can puzzle people while adding new driver's entries. Move the NAND entry to keep it alphabetically ordered. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 3f5494b33d89..4e9b9a52bc6e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9501,13 +9501,13 @@ T: git git://git.monstr.eu/linux-2.6-microblaze.git S: Supported F: arch/microblaze/ -MICROCHIP / ATMEL AT91 SERIAL DRIVER +MICROCHIP AT91 SERIAL DRIVER M: Richard Genoud S: Maintained F: drivers/tty/serial/atmel_serial.c F: drivers/tty/serial/atmel_serial.h -MICROCHIP / ATMEL DMA DRIVER +MICROCHIP DMA DRIVER M: Ludovic Desroches L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) L: dmaeng...@vger.kernel.org @@ -9518,13 +9518,13 @@ F: include/linux/platform_data/dma-atmel.h F: Documentation/devicetree/bindings/dma/atmel-dma.txt F: include/dt-bindings/dma/at91.h -MICROCHIP / ATMEL ECC DRIVER +MICROCHIP ECC DRIVER M: Tudor Ambarus L: linux-cry...@vger.kernel.org S: Maintained F: drivers/crypto/atmel-ecc.* -MICROCHIP / ATMEL ISC DRIVER +MICROCHIP ISC DRIVER M: Eugen Hristev L: linux-me...@vger.kernel.org S: Supported @@ -9532,13 +9532,6 @@ F: drivers/media/platform/atmel/atmel-isc.c F: drivers/media/platform/atmel/atmel-isc-regs.h F: devicetree/bindings/media/atmel-isc.txt -MICROCHIP / ATMEL NAND DRIVER -M: Tudor Ambarus -L: linux-...@lists.infradead.org -S: Supported -F: drivers/mtd/nand/raw/atmel/* -F: Documentation/devicetree/bindings/mtd/atmel-nand.txt - MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh M: Microchip Linux Driver Support @@ -9556,6 +9549,13 @@ L: net...@vger.kernel.org S: Maintained F: drivers/net/ethernet/microchip/lan743x_* +MICROCHIP NAND DRIVER +M: Tudor Ambarus +L: linux-...@lists.infradead.org +S: Supported +F: drivers/mtd/nand/raw/atmel/* +F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + MICROCHIP PWM DRIVER M: Claudiu Beznea L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) -- 2.17.1
[PATCH 10/11] MAINTAINERS: move former ATMEL entries to proper MICROCHIP location
Standardize the Microchip / Atmel entries with the same form and move them so that they are all located at the same place, under the newer MICROCHIP banner. Only modifications to the titles of the entries are done in this patch. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 154 ++-- 1 file changed, 77 insertions(+), 77 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 4e9b9a52bc6e..78044223d90f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2471,42 +2471,6 @@ F: drivers/atm/ F: include/linux/atm* F: include/uapi/linux/atm* -ATMEL AT91 / AT32 MCI DRIVER -M: Ludovic Desroches -S: Maintained -F: drivers/mmc/host/atmel-mci.c - -ATMEL AT91 SAMA5D2-Compatible Shutdown Controller -M: Nicolas Ferre -S: Supported -F: drivers/power/reset/at91-sama5d2_shdwc.c - -ATMEL Audio ALSA driver -M: Codrin Ciubotariu -L: alsa-de...@alsa-project.org (moderated for non-subscribers) -S: Supported -F: sound/soc/atmel - -ATMEL I2C DRIVER -M: Ludovic Desroches -L: linux-...@vger.kernel.org -S: Supported -F: drivers/i2c/busses/i2c-at91.c - -ATMEL ISI DRIVER -M: Eugen Hristev -L: linux-me...@vger.kernel.org -S: Supported -F: drivers/media/platform/atmel/atmel-isi.c -F: include/media/atmel-isi.h - -ATMEL LCDFB DRIVER -M: Nicolas Ferre -L: linux-fb...@vger.kernel.org -S: Maintained -F: drivers/video/fbdev/atmel_lcdfb.c -F: include/video/atmel_lcdc.h - ATMEL MACB ETHERNET DRIVER M: Nicolas Ferre S: Supported @@ -2519,46 +2483,12 @@ S: Maintained F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c -ATMEL SAMA5D2 ADC DRIVER -M: Ludovic Desroches -M: Eugen Hristev -L: linux-...@vger.kernel.org -S: Supported -F: drivers/iio/adc/at91-sama5d2_adc.c -F: Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt -F: include/dt-bindings/iio/adc/at91-sama5d2_adc.h - ATMEL SDMMC DRIVER M: Ludovic Desroches L: linux-...@vger.kernel.org S: Supported F: drivers/mmc/host/sdhci-of-at91.c -ATMEL SPI DRIVER -M: Nicolas Ferre -S: Supported -F: drivers/spi/spi-atmel.* - -ATMEL SSC DRIVER -M: Nicolas Ferre -L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) -S: Supported -F: drivers/misc/atmel-ssc.c -F: include/linux/atmel-ssc.h - -ATMEL Timer Counter (TC) AND CLOCKSOURCE DRIVERS -M: Nicolas Ferre -L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) -S: Supported -F: drivers/misc/atmel_tclib.c -F: drivers/clocksource/tcb_clksrc.c - -ATMEL USBA UDC DRIVER -M: Cristian Birsan -L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) -S: Supported -F: drivers/usb/gadget/udc/atmel_usba_udc.* - ATMEL WIRELESS DRIVER M: Simon Kelley L: linux-wirel...@vger.kernel.org @@ -2567,13 +2497,6 @@ W: http://atmelwlandriver.sourceforge.net/ S: Maintained F: drivers/net/wireless/atmel/atmel* -ATMEL XDMA DRIVER -M: Ludovic Desroches -L: linux-arm-ker...@lists.infradead.org -L: dmaeng...@vger.kernel.org -S: Supported -F: drivers/dma/at_xdmac.c - ATOMIC INFRASTRUCTURE M: Will Deacon M: Peter Zijlstra @@ -9507,6 +9430,12 @@ S: Maintained F: drivers/tty/serial/atmel_serial.c F: drivers/tty/serial/atmel_serial.h +MICROCHIP AUDIO ASOC DRIVERS +M: Codrin Ciubotariu +L: alsa-de...@alsa-project.org (moderated for non-subscribers) +S: Supported +F: sound/soc/atmel + MICROCHIP DMA DRIVER M: Ludovic Desroches L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) @@ -9524,6 +9453,12 @@ L: linux-cry...@vger.kernel.org S: Maintained F: drivers/crypto/atmel-ecc.* +MICROCHIP I2C DRIVER +M: Ludovic Desroches +L: linux-...@vger.kernel.org +S: Supported +F: drivers/i2c/busses/i2c-at91.c + MICROCHIP ISC DRIVER M: Eugen Hristev L: linux-me...@vger.kernel.org @@ -9532,6 +9467,13 @@ F: drivers/media/platform/atmel/atmel-isc.c F: drivers/media/platform/atmel/atmel-isc-regs.h F: devicetree/bindings/media/atmel-isc.txt +MICROCHIP ISI DRIVER +M: Eugen Hristev +L: linux-me...@vger.kernel.org +S: Supported +F: drivers/media/platform/atmel/atmel-isi.c +F: include/media/atmel-isi.h + MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh M: Microchip Linux Driver Support @@ -9549,6 +9491,18 @@ L: net...@vger.kernel.org S: Maintained F: drivers/net/ethernet/microchip/lan743x_* +MICROCHIP LCDFB DRIVER +M: Nicolas Ferre +L: linux-fb...@vger.kernel.org +S: Maintained +F: drivers/video/fbdev/atmel_lcdfb.c +F: include/video/atmel_lcdc.h + +MICROCHIP MMC/SD/SDIO MCI DRIVER +M: Ludovic Desroches +S
[PATCH 08/11] MAINTAINERS: iio: add co-maintainer to SAMA5D2-compatible ADC driver
Add Eugen as co-maintainer with Ludovic of Microchip SAMA5D2-compatible ADC driver. Also add the binding documentation/include as file pattern. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index fca67dcb84e0..3f5494b33d89 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2521,9 +2521,12 @@ F: drivers/input/touchscreen/atmel_mxt_ts.c ATMEL SAMA5D2 ADC DRIVER M: Ludovic Desroches +M: Eugen Hristev L: linux-...@vger.kernel.org S: Supported F: drivers/iio/adc/at91-sama5d2_adc.c +F: Documentation/devicetree/bindings/iio/adc/at91-sama5d2_adc.txt +F: include/dt-bindings/iio/adc/at91-sama5d2_adc.h ATMEL SDMMC DRIVER M: Ludovic Desroches -- 2.17.1
[PATCH 01/11] MAINTAINERS: ARM: at91: add co-maintainer for ARM/Microchip
Add Ludovic as a new co-maintainer for the AT91 Microchip ARM sub-architecture. Add the newly created kernel.org group git tree that we will use from now on. Cc: Alexandre Belloni Signed-off-by: Nicolas Ferre --- MAINTAINERS | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index a5b256b25905..7f97f1f83398 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1703,9 +1703,10 @@ S: Odd Fixes ARM/Microchip (AT91) SoC support M: Nicolas Ferre M: Alexandre Belloni +M: Ludovic Desroches L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) W: http://www.linux4sam.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git +T: git git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git S: Supported N: at91 N: atmel -- 2.17.1
[PATCH 07/11] MAINTAINERS: pwm: add entry for Microchip pwm driver
Add the entry that was missing for pwm-atmel.c driver. Add binding file as well. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 414324563009..fca67dcb84e0 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9553,6 +9553,14 @@ L: net...@vger.kernel.org S: Maintained F: drivers/net/ethernet/microchip/lan743x_* +MICROCHIP PWM DRIVER +M: Claudiu Beznea +L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) +L: linux-...@vger.kernel.org +S: Supported +F: drivers/pwm/pwm-atmel.c +F: Documentation/devicetree/bindings/pwm/atmel-pwm.txt + MICROCHIP USB251XB DRIVER M: Richard Leitner L: linux-...@vger.kernel.org -- 2.17.1
[PATCH 02/11] MAINTAINERS: update entry for Microchip NAND driver support
Replace the Microchip/Atmel NAND controller driver maintainer by removing Josh and adding Tudor. Cc: Josh Wu Signed-off-by: Nicolas Ferre --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 7f97f1f83398..43fa2ebb292e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9528,7 +9528,7 @@ F:drivers/media/platform/atmel/atmel-isc-regs.h F: devicetree/bindings/media/atmel-isc.txt MICROCHIP / ATMEL NAND DRIVER -M: Josh Wu +M: Tudor Ambarus L: linux-...@lists.infradead.org S: Supported F: drivers/mtd/nand/raw/atmel/* -- 2.17.1
[PATCH 06/11] MAINTAINERS: dmaengine: add files to Microchip dma entry
In Microchip DMA (HDMA actually) entry, add the missing files for better matching with get_maintainer.pl tool. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index fe1280b92a2e..414324563009 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -9512,6 +9512,8 @@ S:Supported F: drivers/dma/at_hdmac.c F: drivers/dma/at_hdmac_regs.h F: include/linux/platform_data/dma-atmel.h +F: Documentation/devicetree/bindings/dma/atmel-dma.txt +F: include/dt-bindings/dma/at91.h MICROCHIP / ATMEL ECC DRIVER M: Tudor Ambarus -- 2.17.1
[PATCH 05/11] MAINTAINERS: USB: change maintainer for Microchip USBA gadget driver
Hand over this USB gadget driver to Cristian: atmel_usba. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 686822714e6b..fe1280b92a2e 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2551,7 +2551,7 @@ F:drivers/misc/atmel_tclib.c F: drivers/clocksource/tcb_clksrc.c ATMEL USBA UDC DRIVER -M: Nicolas Ferre +M: Cristian Birsan L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) S: Supported F: drivers/usb/gadget/udc/atmel_usba_udc.* -- 2.17.1
[PATCH 00/11] MAINTAINERS: update of of some Microchip entries
Hi, This is an update of most of Microchip MAINTAINERS' entries. I took advantage of the addition of Ludovic as co-maintainer to go through some of the entries that were outdated. There are moves of entries in the 3 last patches of this series. You can drop them if they introduce too much headaches while updating this MAINTAINERS file. Series based on v4.19-rc1. Nicolas Ferre (11): MAINTAINERS: ARM: at91: add co-maintainer for ARM/Microchip MAINTAINERS: update entry for Microchip NAND driver support MAINTAINERS: media: change Microchip ISI, ISC maintainers MAINTAINERS: ASoC: change maintainer for Microchip ALSA drivers MAINTAINERS: USB: change maintainer for Microchip USBA gadget driver MAINTAINERS: dmaengine: add files to Microchip dma entry MAINTAINERS: pwm: add entry for Microchip pwm driver MAINTAINERS: iio: add co-maintainer to SAMA5D2-compatible ADC driver MAINTAINERS: remove the / ATMEL string from MICROCHIP entries MAINTAINERS: move former ATMEL entries to proper MICROCHIP location MAINTAINERS: sdhci: move the Microchip entry to proper location MAINTAINERS | 196 1 file changed, 105 insertions(+), 91 deletions(-) -- 2.17.1
[PATCH 04/11] MAINTAINERS: ASoC: change maintainer for Microchip ALSA drivers
Hand over to Codrin for Microchip Audio SoC drivers in "atmel" directory. Signed-off-by: Nicolas Ferre --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 6eaf54960c1c..686822714e6b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2482,7 +2482,7 @@ S:Supported F: drivers/power/reset/at91-sama5d2_shdwc.c ATMEL Audio ALSA driver -M: Nicolas Ferre +M: Codrin Ciubotariu L: alsa-de...@alsa-project.org (moderated for non-subscribers) S: Supported F: sound/soc/atmel -- 2.17.1
at91 git tree in linux-next
Stephen, Alexandre Ludovic and myself are the group of maintainers for Microchip ARM SoCs. The current tree that we have in linux-next is mine [1] and we are moving to a common group kernel.org tree. So, can you please add our new tree to linux-next: at91 git git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git#at91-next instead of: git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git#at91-next In addition to that, we also have now a "fixes" branch. Can you please add it to your "fixes" tree? at91 git git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git#at91-fixes Thanks for your help, best regards, Nicolas [1] https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/Next/Trees#n84 Reference of previous request below... back in the days... On 31/03/2015 at 15:22, Nicolas Ferre wrote: Hi Stephen, I am the maintainer for the Atmel ARM SoCs (aka at91) and I would like to know if it's possible for you to include my git tree in linux-next. It is usually pulled in by the ARM-soc guys (in copy). Here it is, with the branch that you would pull: "at91-next". git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git at91-next I usually merge branches in this particular one when I send a pull-request to Arnd, Olof and Kevin so the material is usually pretty "stable". Thanks, bye, -- Nicolas Ferre
[PATCH] ARM: dts: at91/trivial: remove old NAND bindings leftover in sama5d2
As the new bindings are already in place in sama5d2.dtsi and that it's used in the only Mainline board for this product (at91-sama5d2_ptc_ek.dts), we can safely remove the old bindings. Cc: Boris Brezillon Signed-off-by: Nicolas Ferre --- arch/arm/boot/dts/sama5d2.dtsi | 38 -- 1 file changed, 38 deletions(-) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 61f68e5c48e9..fd1a401f2914 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -323,44 +323,6 @@ }; }; - nand0: nand@8000 { - compatible = "atmel,sama5d2-nand"; - #address-cells = <1>; - #size-cells = <1>; - ranges; - reg = < /* EBI CS3 */ - 0x8000 0x0800 - /* SMC PMECC regs */ - 0xf8014070 0x0490 - /* SMC PMECC Error Location regs */ - 0xf8014500 0x0200 - /* ROM Galois tables */ - 0x0004 0x00018000 - >; - interrupts = <17 IRQ_TYPE_LEVEL_HIGH 6>; - atmel,nand-addr-offset = <21>; - atmel,nand-cmd-offset = <22>; - atmel,nand-has-dma; - atmel,has-pmecc; - atmel,pmecc-lookup-table-offset = <0x0 0x8000>; - status = "disabled"; - - nfc@c000 { - compatible = "atmel,sama5d3-nfc"; - #address-cells = <1>; - #size-cells = <1>; - reg = < /* NFC Command Registers */ - 0xc000 0x0800 - /* NFC HSMC regs */ - 0xf8014000 0x0070 - /* NFC SRAM banks */ - 0x0010 0x0010 - >; - clocks = <&hsmc_clk>; - atmel,write-by-sram; - }; - }; - sdmmc0: sdio-host@a000 { compatible = "atmel,sama5d2-sdhci"; reg = <0xa000 0x300>; -- 2.15.1
Re: [PATCH v10 0/6] Driver for at91 usart in spi mode
On 25/06/2018 at 19:22, Radu Pirea wrote: Hello, This is the second version of driver. I added a mfd driver which by default probes atmel_serial driver and if in dt is specified to probe the spi driver, then the spi-at91-usart driver will be probed. The compatible for atmel_serial is now the compatible for at91-usart mfd driver and compatilbe for atmel_serial driver was changed in order to keep the bindings for serial as they are. Changes in v10: -fixed kbuild test robot warning Changes in v9: - minor changes - rebased on top of broonie/for-4.19 Changes in v8: - fixed passing an empty mfd cell if "atmel,usart-mode" value is invalid Changes in v7: - synced up SPDIX license with module license - numbering of usart modes starts from 0 insteand of 1 Changes in v6: - removed unused compatible strings from serial and spi drivers Changes in v5: - fixed usage of stdout-path property with atmel_serial driver Changes in v4: - modified the spi driver to use cs gpio support form spi subsystem - fixed dma transfers for serial driver - squashed binding for spi and serial and moved them to mfd/atmel-usart.txt Changes in v3: - fixed spi slaves probing Changes in v2: - added at91-usart mfd driver - modified spi-at91-usart driver to work as mfd driver child - modified atmel_serial driver to work as mfd driver child Changes in v1: - added spi-at91-usart driver Radu Pirea (6): MAINTAINERS: add at91 usart mfd driver dt-bindings: add binding for atmel-usart in SPI mode mfd: at91-usart: added mfd driver for usart MAINTAINERS: add at91 usart spi driver spi: at91-usart: add driver for at91-usart as spi tty/serial: atmel: change the driver to work under at91-usart mfd For the record or if needed by the MAINTAINERS changes, you can add my: Acked-by: Nicolas Ferre for the whole series. Once the remarks by Mark are addressed, you can certainly re-send the series with all tags collected for Lee to take it, if he is okay with this process, of course... Thanks, best regards, Nicolas .../bindings/{serial => mfd}/atmel-usart.txt | 25 +- MAINTAINERS | 16 + drivers/mfd/Kconfig | 9 + drivers/mfd/Makefile | 1 + drivers/mfd/at91-usart.c | 71 +++ drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-at91-usart.c | 432 ++ drivers/tty/serial/Kconfig| 1 + drivers/tty/serial/atmel_serial.c | 42 +- include/dt-bindings/mfd/at91-usart.h | 17 + 11 files changed, 607 insertions(+), 17 deletions(-) rename Documentation/devicetree/bindings/{serial => mfd}/atmel-usart.txt (76%) create mode 100644 drivers/mfd/at91-usart.c create mode 100644 drivers/spi/spi-at91-usart.c create mode 100644 include/dt-bindings/mfd/at91-usart.h -- Nicolas Ferre
Re: [PATCH 1/4] arm: dts: add support for Laird WB45N cpu module and DVK
h our old code reviews and found this message relating to testing reboot over several thousand times in our testbed: After the slow clock has been enabled on the reset controller via upstream changes, the dram disable access and power down code is causing the SAM9G25 to hang occasionally on reboot. Using the simple reset function provided for SAMA5D3 instead. So it appears to be a workaround for a bug that existed ~2 years ago, may still be relevant as there haven't been many changes to the reset code in that time. All right, I read too quickly and thought it was sama5d3... Your feedback is interesting anyway. I'll store this for future reference and investigation. + + }; + }; + + atheros { + compatible = "atheros,ath6kl"; + atheros,board-id = "SD32"; + }; +}; + +&slow_xtal { + clock-frequency = <32768>; +}; + +&main_xtal { + clock-frequency = <1200>; +}; + +&ebi { + status = "okay"; + nand_controller: nand-controller { + pinctrl-0 = <&pinctrl_nand_cs &pinctrl_nand_rb &pinctrl_nand_oe_we>; + pinctrl-names = "default"; + status = "okay"; + + nand@3 { + reg = <0x3 0x0 0x80>; + rb-gpios = <&pioD 5 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioD 4 GPIO_ACTIVE_HIGH>; + nand-bus-width = <8>; + nand-ecc-mode = "hw"; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-on-flash-bbt; + label = "atmel_nand"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + at91bootstrap@0 { + label = "at91bs"; + reg = <0x0 0x2>; + }; + + uboot@2 { + label = "u-boot"; + reg = <0x2 0x8>; + }; + + ubootenv@a { + label = "u-boot-env"; + reg = <0xa 0x2>; + }; + + ubootenv@c { + label = "redund-env"; + reg = <0xc 0x2>; + }; + + kernel-a@e { + label = "kernel-a"; + reg = <0xe 0x28>; + }; + + kernel-b@36 { + label = "kernel-b"; + reg = <0x36 0x28>; + }; + + rootfs-a@5e { + label = "rootfs-a"; + reg = <0x5e 0x260>; + }; + + rootfs-b@2be { + label = "rootfs-b"; + reg = <0x2be 0x260>; + }; + + user@51e { + label = "user"; + reg = <0x51e 0x2dc>; + }; + + logs@7fa { + label = "logs"; + reg = <0x7fa 0x6>; + }; + + }; + }; + }; +}; + +&usb0 { This must be &usb1 label, isn't it? Because you are referring to ohci binding I suspect (found by having a look at: atmel,oc-gpio property...). I believe usb0 is correct, as this is a at91sam9x5 part, the node in dtsi is -ohci. sama5d3 is usb1 for -ohci. All right, like previous comment, I thought it was sama5d3: sorry for the noise. Best regards, Nicolas -- Nicolas Ferre
Re: [PATCH 4/4] arm: dts: add support for Laird SOM60 module and DVK boards
}; + + pinctrl_usart1_sck: usart1_sck { + atmel,pins = + ; /* Conflicts with GETH_INT */ + }; + + pinctrl_eth_int: eth_int { + atmel,pins = + ; + }; + + pinctrl_pck2_as_audio_mck: pck2_as_audio_mck { + atmel,pins = + ; + }; + }; + }; + }; + }; +}; + +&mmc0 { + slot@0 { + reg = <0>; + bus-width = <8>; + }; +}; + +&mmc1 { + status = "okay"; + slot@0 { + reg = <0>; + bus-width = <4>; + }; +}; + +&spi0 { + cs-gpios = <&pioD 13 0>, <0>, <0>, <0>; +}; + +&usart0 { + atmel,use-dma-rx; + atmel,use-dma-tx; + status = "okay"; + pinctrl-0 = <&pinctrl_usart0 &pinctrl_usart0_rts_cts>; +}; + +&usart1 { + pinctrl-0 = <&pinctrl_usart1 &pinctrl_usart1_rts_cts>; +}; + +&usart2 { + pinctrl-0 = <&pinctrl_usart2 &pinctrl_usart2_rts_cts>; +}; + +&usart3 { + pinctrl-0 = <&pinctrl_usart3 &pinctrl_usart3_rts_cts>; +}; + +&adc0 { + pinctrl-0 = < + &pinctrl_adc0_adtrg + &pinctrl_adc0_ad0 + &pinctrl_adc0_ad1 + &pinctrl_adc0_ad2 + &pinctrl_adc0_ad3 + &pinctrl_adc0_ad4 + &pinctrl_adc0_ad5 + >; +}; + +&macb0 { + phy-mode = "rgmii"; +}; + +&macb1 { + phy-mode = "rmii"; +}; + + +&ebi { + pinctrl-0 = <&pinctrl_ebi_nand_addr>; + pinctrl-names = "default"; + status = "okay"; +}; + +&nand_controller { + status = "okay"; + + nand: nand@3 { + reg = <0x3 0x0 0x2>; + atmel,rb = <0>; + nand-bus-width = <8>; + nand-ecc-mode = "hw"; + nand-ecc-strength = <8>; + nand-ecc-step-size = <512>; + nand-on-flash-bbt; + label = "atmel_nand"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + ubootspl@0 { + label = "u-boot-spl"; + reg = <0x0 0x2>; + }; + + uboot@2 { + label = "u-boot"; + reg = <0x2 0x8>; + }; + + ubootenv@a { + label = "u-boot-env"; + reg = <0xa 0x2>; + }; + + ubootenv@c { + label = "u-boot-env"; + reg = <0xc 0x2>; + }; + + ubi@e { + label = "ubi"; + reg = <0xe 0xfe0>; + }; + }; + }; +}; + +&usb0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usba_vbus>; + atmel,vbus-gpio = <&pioC 14 GPIO_ACTIVE_HIGH>; +}; + +&usb1 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_usb_vbus &pinctrl_usb_oc>; + num-ports = <3>; + atmel,vbus-gpio = <0 + &pioE 20 GPIO_ACTIVE_HIGH + 0>; + atmel,oc-gpio = <0 + &pioE 15 GPIO_ACTIVE_LOW + 0>; +}; -- Nicolas Ferre
Re: [PATCH 1/4] arm: dts: add support for Laird WB45N cpu module and DVK
os,ath6kl"; + atheros,board-id = "SD32"; + }; +}; + +&slow_xtal { + clock-frequency = <32768>; +}; + +&main_xtal { + clock-frequency = <1200>; +}; + +&ebi { + status = "okay"; + nand_controller: nand-controller { + pinctrl-0 = <&pinctrl_nand_cs &pinctrl_nand_rb &pinctrl_nand_oe_we>; + pinctrl-names = "default"; + status = "okay"; + + nand@3 { + reg = <0x3 0x0 0x80>; + rb-gpios = <&pioD 5 GPIO_ACTIVE_HIGH>; + cs-gpios = <&pioD 4 GPIO_ACTIVE_HIGH>; + nand-bus-width = <8>; + nand-ecc-mode = "hw"; + nand-ecc-strength = <4>; + nand-ecc-step-size = <512>; + nand-on-flash-bbt; + label = "atmel_nand"; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + at91bootstrap@0 { + label = "at91bs"; + reg = <0x0 0x2>; + }; + + uboot@2 { + label = "u-boot"; + reg = <0x2 0x8>; + }; + + ubootenv@a { + label = "u-boot-env"; + reg = <0xa 0x2>; + }; + + ubootenv@c { + label = "redund-env"; + reg = <0xc 0x2>; + }; + + kernel-a@e { + label = "kernel-a"; + reg = <0xe 0x28>; + }; + + kernel-b@36 { + label = "kernel-b"; + reg = <0x36 0x28>; + }; + + rootfs-a@5e { + label = "rootfs-a"; + reg = <0x5e 0x260>; + }; + + rootfs-b@2be { + label = "rootfs-b"; + reg = <0x2be 0x260>; + }; + + user@51e { + label = "user"; + reg = <0x51e 0x2dc>; + }; + + logs@7fa { + label = "logs"; + reg = <0x7fa 0x6>; + }; + + }; + }; + }; +}; + +&usb0 { This must be &usb1 label, isn't it? Because you are referring to ohci binding I suspect (found by having a look at: atmel,oc-gpio property...). + num-ports = <2>; + atmel,vbus-gpio = < + &pioB 12 GPIO_ACTIVE_HIGH + &pioA 31 GPIO_ACTIVE_HIGH + >; + atmel,oc-gpio = <&pioB 13 GPIO_ACTIVE_LOW>; +}; + +&macb0 { + phy-mode = "rmii"; +}; + +&spi0 { + cs-gpios = <&pioA 14 0>, <&pioA 7 0>, <0>, <0>; +}; + +&usb2 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_board_usb2>; + atmel,vbus-gpio = <&pioB 11 GPIO_ACTIVE_HIGH>; +}; + +&mmc0 { + pinctrl-0 = < + &pinctrl_mmc0_slot0_clk_cmd_dat0 + &pinctrl_mmc0_slot0_dat1_3>; + slot@0 { + reg = <0>; + bus-width = <4>; + }; +}; -- Nicolas Ferre
Re: [PATCH 2/4] arm: dts: add support for Laird WB50N cpu module and DVK
On 14/06/2018 at 11:50, Alexandre Belloni wrote: On 14/06/2018 09:51:55+0100, Ben Whitten wrote: Signed-off-by: Ben Whitten --- arch/arm/boot/dts/Makefile| 3 +- arch/arm/boot/dts/at91-wb50n.dts | 116 ++ arch/arm/boot/dts/at91-wb50n.dtsi | 202 ++ 3 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/at91-wb50n.dts create mode 100644 arch/arm/boot/dts/at91-wb50n.dtsi diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 1ee94ee..fd5f8a6 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -61,7 +61,8 @@ dtb-$(CONFIG_SOC_SAM_V7) += \ at91-sama5d4_ma5d4evk.dtb \ at91-sama5d4_xplained.dtb \ at91-sama5d4ek.dtb \ - at91-vinco.dtb + at91-vinco.dtb \ + at91-wb50n.dtb I know we have been bad at this but this should be at91--.dtb so at91-sama5d31-wb50n.dtb See new message by Alexandre. Actually, the current convention is explained here: https://elixir.bootlin.com/linux/latest/source/Documentation/arm/Microchip/README#L159 dtb-$(CONFIG_ARCH_ATLAS6) += \ atlas6-evb.dtb dtb-$(CONFIG_ARCH_ATLAS7) += \ diff --git a/arch/arm/boot/dts/at91-wb50n.dts b/arch/arm/boot/dts/at91-wb50n.dts new file mode 100644 index 000..ee4f823 --- /dev/null +++ b/arch/arm/boot/dts/at91-wb50n.dts @@ -0,0 +1,116 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * at91-wb50n.dts - Device Tree file for wb50n evaluation board + * + * Copyright (C) 2018 Laird + * + */ + +/dts-v1/; +#include "at91-wb50n.dtsi" + +/ { + model = "Laird Workgroup Bridge 50N - Atmel SAMA5D"; + compatible = "laird,wb50n", "atmel,sama5d31", "atmel,sama5d3", "atmel,sama5"; + + ahb { + apb { + watchdog@fe40 { I don't mind if you want to have a preparation patch adding the necessary labels in the soc dtsi so you don't have to reproduce the ahb/apb hierarchy here. I agree: +1 + ahb { + apb { + pinctrl@f200 { Ditto + board { + pinctrl_mmc0_cd: mmc0_cd { + atmel,pins = ; /* PC26 GPIO with pullup deglitch */ + }; + + pinctrl_usba_vbus: usba_vbus { + atmel,pins = ; /* PB13 GPIO with deglitch */ + }; + }; + }; + }; + }; +}; + +&slow_osc { + atmel,osc-bypass; +}; After the clock binding rework, this will have to be moved to the pmc node (the rework is not posted, this is just to remind me that this will have to be done). + +&usart1_clk { + atmel,clk-output-range = <0 13200>; +}; The datasheet explicitly states that 66 MHz is the maximum allowed frequency for the USART. Note that the new binding will not allow you to do that. However, I see the table disappeared from the latest datasheet. Maybe Nicolas can comment on that? You're right, 66 MHz is the maximum frequency for all USART and UART on this sama5d3 SoC. The disappearing of this table is a bug in the latest datasheet. I can see that the one "11121B–ATARM–08-Mar-13" still have it. I report this issue to the team in charge of datasheets (it will be certainly fixed for next release of this document). Best regards, -- Nicolas Ferre
Re: [PATCH 0/4] Fix suspend resume on at91sam9261 and at91sam9263
On 07/06/2018 at 10:41, Alexandre Belloni wrote: USB clock detection may not work properly on at91sam9261 and at91sam9263 because they currently use the same bit mask as at91rm9200 instead of the one for at91sam9260. Take the opportunity to also change the PMC compatible strings for all the other SoCs in preparation for the new clock bindings. Alexandre Belloni (4): dt-bindings: arm: remove PMC bindings dt-bindings: clk: at91: Document all the PMC compatibles ARM: at91: fix USB clock detection handling ARM: dts: fix PMC compatible To the whole series: Acked-by: Nicolas Ferre Thanks, best regards. .../devicetree/bindings/arm/atmel-pmc.txt | 14 -- .../devicetree/bindings/clock/at91-clock.txt | 9 - arch/arm/boot/dts/at91sam9261.dtsi | 2 +- arch/arm/boot/dts/at91sam9263.dtsi | 2 +- arch/arm/boot/dts/at91sam9rl.dtsi | 2 +- arch/arm/boot/dts/sama5d4.dtsi | 2 +- arch/arm/mach-at91/pm.c| 5 + 7 files changed, 13 insertions(+), 23 deletions(-) delete mode 100644 Documentation/devicetree/bindings/arm/atmel-pmc.txt -- Nicolas Ferre
Re: [PATCH v4 5/6] spi: at91-usart: add driver for at91-usart as spi
On 29/05/2018 at 16:34, Nicolas Ferre wrote: On 29/05/2018 at 16:28, Radu Pirea wrote: On 05/28/2018 11:21 AM, Andy Shevchenko wrote: On Fri, May 25, 2018 at 8:19 PM, Radu Pirea wrote: This is the driver for at91-usart in spi mode. The USART IP can be configured to work in many modes and one of them is SPI. [..] +static int at91_usart_gpio_setup(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.parent->of_node; Your driver is not OF specific as far as I can see. Drop all these device_node stuff and change API calls respectively. Ok. What do you suggest to use instead of OF API to get the count of cs-gpios and to read their values one by one? As Alexandre said, we can make this driver OF specific. What could be interesting is to use the gpio descriptors API and not the older one. This would allow us to have far more control over the gpio that we use in our drivers (Ludovic is converting our drivers to only use gpiod structures). Oh, but we already said that we cannot. Disregard my comment then, sorry for the noise. Regards, Nicolas + int i; + int ret = 0; + int nb = 0; What happened to indentation? Redundnant assignment for both. + if (!np) + return -EINVAL; + + nb = of_gpio_named_count(np, "cs-gpios"); + for (i = 0; i < nb; i++) { + int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); + + if (cs_gpio < 0) + return cs_gpio; + + if (gpio_is_valid(cs_gpio)) { + ret = devm_gpio_request_one(&pdev->dev, cs_gpio, + GPIOF_DIR_OUT, + dev_name(&pdev->dev)); + if (ret) + return ret; + } + } + + return 0; +} [..] -- Nicolas Ferre
Re: [PATCH v4 5/6] spi: at91-usart: add driver for at91-usart as spi
On 29/05/2018 at 16:28, Radu Pirea wrote: On 05/28/2018 11:21 AM, Andy Shevchenko wrote: On Fri, May 25, 2018 at 8:19 PM, Radu Pirea wrote: This is the driver for at91-usart in spi mode. The USART IP can be configured to work in many modes and one of them is SPI. [..] +static int at91_usart_gpio_setup(struct platform_device *pdev) +{ + struct device_node *np = pdev->dev.parent->of_node; Your driver is not OF specific as far as I can see. Drop all these device_node stuff and change API calls respectively. Ok. What do you suggest to use instead of OF API to get the count of cs-gpios and to read their values one by one? As Alexandre said, we can make this driver OF specific. What could be interesting is to use the gpio descriptors API and not the older one. This would allow us to have far more control over the gpio that we use in our drivers (Ludovic is converting our drivers to only use gpiod structures). Regards, Nicolas + int i; + int ret = 0; + int nb = 0; What happened to indentation? Redundnant assignment for both. + if (!np) + return -EINVAL; + + nb = of_gpio_named_count(np, "cs-gpios"); + for (i = 0; i < nb; i++) { + int cs_gpio = of_get_named_gpio(np, "cs-gpios", i); + + if (cs_gpio < 0) + return cs_gpio; + + if (gpio_is_valid(cs_gpio)) { + ret = devm_gpio_request_one(&pdev->dev, cs_gpio, + GPIOF_DIR_OUT, + dev_name(&pdev->dev)); + if (ret) + return ret; + } + } + + return 0; +} [..] -- Nicolas Ferre
Re: [PATCH] mtd: nand: raw: atmel: add module param to avoid using dma
On 28/05/2018 at 17:52, Peter Rosin wrote: On 2018-05-28 16:27, Boris Brezillon wrote: [..] Could it just be that you're reaching the DDR bus limit. As I said previously, when you go through the CPU, and assuming you're consuming the data directly, you have: 1/ NFC SRAM -> CPU 2/ CPU -> L1 data cache --write-back--> DRAM 3/ L1-cache -> CPU While, if you use DMA you get: 1/ NFC SRAM -> DRAM 2/ SDRAM -> L1 data cache -> CPU So, if you're approaching the limit of (LP)DDR bandwidth, using the CPU might make things a bit better. Still, if the limitation really comes from the DDR bus, my opinion is that you should maybe use a smaller resolution or use a more compact pixel format (RGB565?). The issue is still there if I use a CLUT mode instead of rgb565, which is what I normally use (and what I would like to use, CLUT is just alien and a pain these days). The panels we are using only supports one resolution (each), but the issue is there with both 1920x1080@16bpp and 1024x768@8bpp (~60Hz). Did you calculate how much of the bandwidth is taken by the HLCDC block and compared it to the max (LP)DDR bandwidth? I did, but don't remember the exact details. There is some room even for 1920x1080@16bpp, but not oceans of it. We were a bit uncertain if 16bpp would be possible, and in fact that was the reason I worked on CLUT support for atmel-hlcdc last year. But since the problem persists with much less memory pressure as well, I don't think that's it either. Just jumping in the conversation with another perspective (maybe already tried actually). Can you try to make all that you can to maximize the blanking period of your screen (some are more tolerant than others according to that). By doing so, you would allow the LCD FIFO to recover better after each line. You might loose some columns on the side of your display but it would give us a good idea of how far we are from getting rid of those annoying LCD reset glitches (that are due to underruns on LCD FIFO). Admittedly I have not tested these AHB matrix tricks with a smaller panel (it would take a bit of work to arrange for those tests), but the issue was there when I last tried (using defaults). If what I said earlier has an impact, reducing the panel size will also make a difference. But the question is how small is "smaller" ;-) Best regards, -- Nicolas Ferre
Re: [PATCH] spi-nor: Add support for Atmel Dataflash memories
On 04/05/2018 at 20:38, Boris Brezillon wrote: Hi Radu, Sorry for the late reply. On Wed, 28 Feb 2018 13:55:01 +0200 Radu Pirea wrote: This patch add support in spi-nor for allmost all dataflash memories supported by old mtd_dataflash driver. Those devices clearly use a different instruction set, so I don't think they fit in this framework. Can you tell us why you want to move dataflash support to the SPI NOR framework. I think I know why, but I'd like to get your version. My guess is that some people want to connect dataflash chips to the Atmel QSPI controller, and it's not supported right now because the Atmel QSPI controller implements the SPI-NOR interface and not the generic SPI one, thus preventing anything that is not a SPI NOR from being connected to this controller. If I'm right, then the solution is to convert the QSPI driver to the spi-mem interface [1] and move it to drivers/spi/. No, I we didn't think about this. Dataflash is not so popular those days and we don't want to revive it anyway. Our QSPI driver has already a lot of things to handle in QSPI-related topics to not mix it with oldies ;-) The rationale behind this work is to get rid of the very old dataflash standalone driver and benefit from the whole spi-nor infrastructure like cache coherency management and DMA handling (which were broken in the old dataflash driver in recent kernels). Best regards, Nicolas [1]http://patchwork.ozlabs.org/project/linux-mtd/list/?series=41174 -- Nicolas Ferre
Re: [PATCH 43/61] pwm: simplify getting .drvdata
On 19/04/2018 at 16:06, Wolfram Sang wrote: We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang Acked-by: Nicolas Ferre --- Build tested only. buildbot is happy. Please apply individually. drivers/pwm/pwm-atmel-tcb.c | 6 ++ drivers/pwm/pwm-rcar.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c index 4fb1be246c44..0d0f8376bc35 100644 --- a/drivers/pwm/pwm-atmel-tcb.c +++ b/drivers/pwm/pwm-atmel-tcb.c @@ -460,8 +460,7 @@ MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids); #ifdef CONFIG_PM_SLEEP static int atmel_tcb_pwm_suspend(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); + struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev); void __iomem *base = tcbpwm->tc->regs; int i; @@ -478,8 +477,7 @@ static int atmel_tcb_pwm_suspend(struct device *dev) static int atmel_tcb_pwm_resume(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); + struct atmel_tcb_pwm_chip *tcbpwm = dev_get_drvdata(dev); void __iomem *base = tcbpwm->tc->regs; int i; diff --git a/drivers/pwm/pwm-rcar.c b/drivers/pwm/pwm-rcar.c index 91d11f2e2fef..748f614d5375 100644 --- a/drivers/pwm/pwm-rcar.c +++ b/drivers/pwm/pwm-rcar.c @@ -261,8 +261,7 @@ MODULE_DEVICE_TABLE(of, rcar_pwm_of_table); #ifdef CONFIG_PM_SLEEP static struct pwm_device *rcar_pwm_dev_to_pwm_dev(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct rcar_pwm_chip *rcar_pwm = platform_get_drvdata(pdev); + struct rcar_pwm_chip *rcar_pwm = dev_get_drvdata(dev); struct pwm_chip *chip = &rcar_pwm->chip; return &chip->pwms[0]; -- Nicolas Ferre
Re: [PATCH 61/61] ASoC: atmel: simplify getting .drvdata
On 19/04/2018 at 16:06, Wolfram Sang wrote: We should get drvdata from struct device directly. Going via platform_device is an unneeded step back and forth. Signed-off-by: Wolfram Sang Acked-by: Nicolas Ferre --- Build tested only. buildbot is happy. Please apply individually. sound/soc/atmel/atmel_ssc_dai.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index a1e2c5682dcd..4a0275a6505d 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -1002,8 +1002,7 @@ static const struct snd_soc_component_driver atmel_ssc_component = { static int asoc_ssc_init(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct ssc_device *ssc = platform_get_drvdata(pdev); + struct ssc_device *ssc = dev_get_drvdata(dev); int ret; ret = snd_soc_register_component(dev, &atmel_ssc_component, @@ -1033,8 +1032,7 @@ static int asoc_ssc_init(struct device *dev) static void asoc_ssc_exit(struct device *dev) { - struct platform_device *pdev = to_platform_device(dev); - struct ssc_device *ssc = platform_get_drvdata(pdev); + struct ssc_device *ssc = dev_get_drvdata(dev); if (ssc->pdata->use_dma) atmel_pcm_dma_platform_unregister(dev); -- Nicolas Ferre
Re: [PATCH 0/3] Fix an Atmel USBA UDC issue introducted in 4.17-rc1
On 16/04/2018 at 11:34, Romain Izard wrote: The use of GPIO descriptors takes care of inversion flags declared in the device tree. The conversion of the Atmel USBA UDC driver introduced in 4.17-rc1 missed it, and as a result the inversion will not work. In addition, cleanup the code to remove an include left behind after the suppression of the support of platform_data to declare USBA controllers. These changes have not been tested on any hardware, as I do not have a board that needs to use inverted GPIOs. Romain Izard (3): usb: gadget: udc: atmel: GPIO inversion is handled by gpiod usb: gadget: udc: atmel: Remove obsolete include usb: gadget: udc: atmel: Fix indenting To the whole series: Acked-by: Nicolas Ferre Thank you Romain. Best regards, Nicolas drivers/usb/gadget/udc/atmel_usba_udc.c | 22 ++ drivers/usb/gadget/udc/atmel_usba_udc.h | 1 - include/linux/usb/atmel_usba_udc.h | 24 3 files changed, 10 insertions(+), 37 deletions(-) delete mode 100644 include/linux/usb/atmel_usba_udc.h -- Nicolas Ferre
Re: [PATCH 2/3] dt-bindings: add binding for at91-usart in spi mode
On 13/04/2018 at 18:23, Alexandre Belloni wrote: On 13/04/2018 19:11:16+0300, Radu Pirea wrote: These are bindings for at91-usart IP in spi spi mode. There is no support for internal chip select. Only kind of chip selects available are gpio chip selects. Signed-off-by: Radu Pirea --- .../bindings/spi/microchip,at91-usart-spi.txt | 24 +++ 1 file changed, 24 insertions(+) create mode 100644 Documentation/devicetree/bindings/spi/microchip,at91-usart-spi.txt diff --git a/Documentation/devicetree/bindings/spi/microchip,at91-usart-spi.txt b/Documentation/devicetree/bindings/spi/microchip,at91-usart-spi.txt new file mode 100644 index ..92d33ccdffae --- /dev/null +++ b/Documentation/devicetree/bindings/spi/microchip,at91-usart-spi.txt @@ -0,0 +1,24 @@ +* Universal Synchronous Asynchronous Receiver/Transmitter (USART) in SPI mode + +Required properties: +- #size-cells : Must be <0> +- #address-cells : Must be <1> +- compatible: Should be "microchip,at91sam9g45-usart-spi" or "microchip,sama5d2-usart-spi" +- reg: Should contain registers location and length +- interrupts: Should contain interrupt +- clocks: phandles to input clocks. +- clock-names: tuple listing input clock names. + Required elements: "usart" +- cs-gpios: chipselects (internal cs not supported) + +Example: + spi0: spi@f001c000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "microchip,sama5d2-usart-spi", "microchip,at91sam9g45-usart-spi"; I'm pretty sure this will be considered configuration rather than hardware description. Why don't you do something like the flexcom mode selection? Because we are not in the same situation as having a glue layer that would select one of the already existing peripherals with associated drivers above. This layout of the hardware is completely different from the USART one and it seems to makes sense to address it with a different hardware description and so a different compatible string. Regards, Nicolas + reg = <0xf001c000 0x100>; + interrupts = <12 IRQ_TYPE_LEVEL_HIGH>; + clocks = <&usart0_clk>; + clock-names = "usart"; + cs-gpios = <&pioB 3 0>; + }; -- 2.17.0 -- Nicolas Ferre
Re: [PATCH] mtd: nand: raw: atmel: add module param to avoid using dma
ess all of them can be used. Looks like I was wrong. According to "Table 15-3. SAMA5D3 Master to Slave Access", LCDC port 0 can only access DDR port 2 and LCDC port 1 can only access DDR port 3. About that table, someone with HW-knowledge should have a real close look at it! Why? I peeked at all the PRxSy registers and there are a lot of '3' entries for all the MxPR fields. In fact, the '3' entries align very neatly with the checks in this "Master to Slave Access" table. Except they don't, after a while. Here's how the table looks in my datasheet: 0 vv--v--v--- 1 vv--v--v--- 2 vv- 3 vvvvv-- 4 vv- 5 v-- 6 vv--vv- v-- 7 v-- 8 --v-v--v--- 9 -v---v--v--v--- 10 -vv-vvv 11 v--v--- 12 v-v And here's the '3' entries when digging in the registers (the extra dash at the end is for the 16th non-existent slave): 0 33--3--3---- 1 33--3--3---- 2 33-- 3 -3333--- 4 33-- 5 3--- 6 33--33-- 7 --3-3--3 8 -3---3--3--3 9 --3-3--3-33-333- 10 3--3 11 3-3- 12 13 14 15 There's a big mismatch for the four DDR2 lines in the table; they seem to map to only three registers. Other than that, the only tweak or anomaly is that first entry (Cortex A5) for master 3 (Int ROM). *time passes* Arrrgh!! You say "Table 15-3". This is Table 14-3 for me! I believe I'm using the latest datasheet (02-Feb-16). What are you reading???!? Oops, I was reading an old datasheet (from 2014). -- Nicolas Ferre
Re: [PATCH] ASoC: atmel_ssc_dai: fix spelling mistake: "Stoping" -> "Stopping"
On 31/03/2018 at 10:54, Alexandre Belloni wrote: On 30/03/2018 at 16:44:20 +0100, Colin King wrote: From: Colin Ian King Trivial fix to spelling mistake in pr_debug message text Acked-by: Alexandre Belloni Acked-by: Nicolas Ferre Signed-off-by: Colin Ian King --- sound/soc/atmel/atmel_ssc_dai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c index a1e2c5682dcd..1c7af0ca98ec 100644 --- a/sound/soc/atmel/atmel_ssc_dai.c +++ b/sound/soc/atmel/atmel_ssc_dai.c @@ -820,7 +820,7 @@ static int atmel_ssc_hw_params(struct snd_pcm_substream *substream, if (ret < 0) { printk(KERN_WARNING "atmel_ssc_dai: request_irq failure\n"); - pr_debug("Atmel_ssc_dai: Stoping clock\n"); + pr_debug("Atmel_ssc_dai: Stopping clock\n"); clk_disable(ssc_p->ssc->clk); return ret; } -- 2.15.1 -- Nicolas Ferre
Re: [PATCH] mtd: nand: raw: atmel: add module param to avoid using dma
On 29/03/2018 at 15:10, Peter Rosin wrote: On a sama5d31 with a Full-HD dual LVDS panel (132MHz pixel clock) NAND flash accesses have a tendency to cause display disturbances. Add a module param to disable DMA from the NAND controller, since that fixes the display problem for me. Signed-off-by: Peter Rosin --- drivers/mtd/nand/raw/atmel/nand-controller.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/nand/raw/atmel/nand-controller.c b/drivers/mtd/nand/raw/atmel/nand-controller.c index b2f00b398490..2ff7a77c7b8e 100644 --- a/drivers/mtd/nand/raw/atmel/nand-controller.c +++ b/drivers/mtd/nand/raw/atmel/nand-controller.c @@ -129,6 +129,11 @@ #define DEFAULT_TIMEOUT_MS1000 #define MIN_DMA_LEN 128 +static bool atmel_nand_avoid_dma __read_mostly; + +MODULE_PARM_DESC(avoiddma, "Avoid using DMA"); +module_param_named(avoiddma, atmel_nand_avoid_dma, bool, 0400); We had the DT parameter "atmel,nand-has-dma" for this purpose and it was associated with a module parameter as well (use_dma,). Is it only managed by old DT binding? Best regards, Nicoals enum atmel_nand_rb_type { ATMEL_NAND_NO_RB, ATMEL_NAND_NATIVE_RB, @@ -1977,7 +1982,7 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, return ret; } - if (nc->caps->has_dma) { + if (nc->caps->has_dma && !atmel_nand_avoid_dma) { dma_cap_mask_t mask; dma_cap_zero(mask); -- Nicolas Ferre
Re: [PATCH v3 2/2] net: macb: Try to retrieve MAC addess from nvmem provider
On 27/03/2018 at 11:52, Mike Looijmans wrote: Call of_get_nvmem_mac_address() to fetch the MAC address from an nvmem cell, if one is provided in the device tree. This allows the address to be stored in an I2C EEPROM device for example. Signed-off-by: Mike Looijmans For this part: Acked-by: Nicolas Ferre --- drivers/net/ethernet/cadence/macb_main.c | 12 +--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c index e84afcf..eabe14f 100644 --- a/drivers/net/ethernet/cadence/macb_main.c +++ b/drivers/net/ethernet/cadence/macb_main.c @@ -3950,10 +3950,16 @@ static int macb_probe(struct platform_device *pdev) dev->max_mtu = ETH_DATA_LEN; mac = of_get_mac_address(np); - if (mac) + if (mac) { ether_addr_copy(bp->dev->dev_addr, mac); - else - macb_get_hwaddr(bp); + } else { + err = of_get_nvmem_mac_address(np, bp->dev->dev_addr); + if (err) { + if (err == -EPROBE_DEFER) + goto err_out_free_netdev; + macb_get_hwaddr(bp); + } + } err = of_get_phy_mode(np); if (err < 0) { -- Nicolas Ferre
Re: [PATCH v2 2/2] mtd: nand: Remove print after allocation failure
On 20/03/2018 at 16:31, Arushi Singhal wrote: The prints after [k|v][m|z|c]alloc() etc. functions are not needed, because in case of failure, allocator will print their internal error prints anyway. Signed-off-by: Arushi Singhal Reviewed-by: Miquel Raynal --- drivers/mtd/nand/ams-delta.c | 1 - drivers/mtd/nand/atmel/nand-controller.c | 13 +++- For Atmel NAND driver: Acked-by: Nicolas Ferre drivers/mtd/nand/marvell_nand.c | 8 ++-- drivers/mtd/nand/nandsim.c | 35 drivers/mtd/nand/ndfc.c | 4 +--- drivers/mtd/nand/sunxi_nand.c| 4 +--- 6 files changed, 15 insertions(+), 50 deletions(-) diff --git a/drivers/mtd/nand/ams-delta.c b/drivers/mtd/nand/ams-delta.c index 9de6572..6e7f6e0 100644 --- a/drivers/mtd/nand/ams-delta.c +++ b/drivers/mtd/nand/ams-delta.c @@ -185,7 +185,6 @@ static int ams_delta_init(struct platform_device *pdev) /* Allocate memory for MTD device structure and private data */ this = kzalloc(sizeof(struct nand_chip), GFP_KERNEL); if (!this) { - printk (KERN_WARNING "Unable to allocate E3 NAND MTD device structure.\n"); err = -ENOMEM; goto out; } diff --git a/drivers/mtd/nand/atmel/nand-controller.c b/drivers/mtd/nand/atmel/nand-controller.c index b2f00b3..b973d42 100644 --- a/drivers/mtd/nand/atmel/nand-controller.c +++ b/drivers/mtd/nand/atmel/nand-controller.c @@ -1615,10 +1615,8 @@ static int atmel_nand_register(struct atmel_nand *nand) mtd->name = devm_kasprintf(nc->dev, GFP_KERNEL, "%s:nand.%d", dev_name(nc->dev), nand->cs[0].id); - if (!mtd->name) { - dev_err(nc->dev, "Failed to allocate mtd->name\n"); + if (!mtd->name) return -ENOMEM; - } } ret = nand_scan_tail(mtd); @@ -1657,10 +1655,8 @@ static struct atmel_nand *atmel_nand_create(struct atmel_nand_controller *nc, nand = devm_kzalloc(nc->dev, sizeof(*nand) + (numcs * sizeof(*nand->cs)), GFP_KERNEL); - if (!nand) { - dev_err(nc->dev, "Failed to allocate NAND object\n"); + if (!nand) return ERR_PTR(-ENOMEM); - } nand->numcs = numcs; @@ -2217,11 +2213,8 @@ atmel_hsmc_nand_controller_init(struct atmel_hsmc_nand_controller *nc) nc->sram.virt = gen_pool_dma_alloc(nc->sram.pool, ATMEL_NFC_SRAM_SIZE, &nc->sram.dma); - if (!nc->sram.virt) { - dev_err(nc->base.dev, - "Could not allocate memory from the NFC SRAM pool\n"); + if (!nc->sram.virt) return -ENOMEM; - } return 0; } diff --git a/drivers/mtd/nand/marvell_nand.c b/drivers/mtd/nand/marvell_nand.c index 2196f2a..9dd2673 100644 --- a/drivers/mtd/nand/marvell_nand.c +++ b/drivers/mtd/nand/marvell_nand.c @@ -2307,10 +2307,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, (nsels * sizeof(struct marvell_nand_chip_sel)), GFP_KERNEL); - if (!marvell_nand) { - dev_err(dev, "could not allocate chip structure\n"); + if (!marvell_nand) return -ENOMEM; - } marvell_nand->nsels = nsels; marvell_nand->selected_die = -1; @@ -2506,10 +2504,8 @@ static int marvell_nand_chip_init(struct device *dev, struct marvell_nfc *nfc, mtd->name = devm_kasprintf(nfc->dev, GFP_KERNEL, "%s:nand.%d", dev_name(nfc->dev), marvell_nand->sels[0].cs); - if (!mtd->name) { - dev_err(nfc->dev, "Failed to allocate mtd->name\n"); + if (!mtd->name) return -ENOMEM; - } } ret = nand_scan_tail(mtd); diff --git a/drivers/mtd/nand/nandsim.c b/drivers/mtd/nand/nandsim.c index 44322a3..b6a5c09 100644 --- a/drivers/mtd/nand/nandsim.c +++ b/drivers/mtd/nand/nandsim.c @@ -569,13 +569,11 @@ static int __init alloc_device(struct nandsim *ns) ns->pages_written = vzalloc(BITS_TO_LONGS(ns->geom.pgnum) * sizeof(unsigned long)); if (!ns->pages_written) { - NS_ERR("alloc_device: unable to allocate pages written array\n");
[PATCH] ARM: dts: at91: at91sam9g25: fix mux-mask pinctrl property
There are only 19 PIOB pins having primary names PB0-PB18. Not all of them have a 'C' function. So the pinctrl property mask ends up being the same as the other SoC of the at91sam9x5 series. Reported-by: Marek Sieranski Signed-off-by: Nicolas Ferre Cc: # v3.8+ --- arch/arm/boot/dts/at91sam9g25.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/at91sam9g25.dtsi b/arch/arm/boot/dts/at91sam9g25.dtsi index a7da0dd0c98f..0898213f3bb2 100644 --- a/arch/arm/boot/dts/at91sam9g25.dtsi +++ b/arch/arm/boot/dts/at91sam9g25.dtsi @@ -21,7 +21,7 @@ atmel,mux-mask = < /*A B C */ 0x 0xffe0399f 0xc01c /* pioA */ - 0x0007 0x8000fe3f 0x /* pioB */ + 0x0007 0x00047e3f 0x /* pioB */ 0x8000 0x07c0 0xb83f /* pioC */ 0x003f 0x003f8000 0x /* pioD */ >; -- 2.15.1
[PATCH 1/3] MAINTAINERS: ARM: at91: update entry for ARM/Microchip
Change the entry name and move it to its alphabetical location. We move to ARM/Microchip instead of ARM/ATMEL to reflect the merger that is now nearly 2 years old. AT91 is kept as the identity of our community. The atmel pattern is obviously kept as well. I removed the names of the different SoCs as they are better exposed in the arch/arm/mach-at91/Kconfig entries. Signed-off-by: Nicolas Ferre --- Hi, This patch goes on top of linux-next because Alexandre's email change is taken into account (already in arm-soc). Best regards, Nicolas MAINTAINERS | 42 +- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 866a5d0c0f64..88759f8a13ba 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1236,27 +1236,6 @@ M: Boris Brezillon S: Maintained F: drivers/clk/at91 -ARM/ATMEL AT91RM9200, AT91SAM9 AND SAMA5 SOC SUPPORT -M: Nicolas Ferre -M: Alexandre Belloni -L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) -W: http://www.linux4sam.org -T: git git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git -S: Supported -N: at91 -N: atmel -F: arch/arm/mach-at91/ -F: include/soc/at91/ -F: arch/arm/boot/dts/at91*.dts -F: arch/arm/boot/dts/at91*.dtsi -F: arch/arm/boot/dts/sama*.dts -F: arch/arm/boot/dts/sama*.dtsi -F: arch/arm/include/debug/at91.S -F: drivers/memory/atmel* -F: drivers/watchdog/sama5d4_wdt.c -X: drivers/input/touchscreen/atmel_mxt_ts.c -X: drivers/net/wireless/atmel/ - ARM/CALXEDA HIGHBANK ARCHITECTURE M: Rob Herring L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) @@ -1656,6 +1635,27 @@ L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) F: arch/arm/mach-ks8695/ S: Odd Fixes +ARM/Microchip (AT91) SoC support +M: Nicolas Ferre +M: Alexandre Belloni +L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) +W: http://www.linux4sam.org +T: git git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git +S: Supported +N: at91 +N: atmel +F: arch/arm/mach-at91/ +F: include/soc/at91/ +F: arch/arm/boot/dts/at91*.dts +F: arch/arm/boot/dts/at91*.dtsi +F: arch/arm/boot/dts/sama*.dts +F: arch/arm/boot/dts/sama*.dtsi +F: arch/arm/include/debug/at91.S +F: drivers/memory/atmel* +F: drivers/watchdog/sama5d4_wdt.c +X: drivers/input/touchscreen/atmel_mxt_ts.c +X: drivers/net/wireless/atmel/ + ARM/MIOA701 MACHINE SUPPORT M: Robert Jarzmik L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) -- 2.15.1
[PATCH 3/3] ARM: at91: Kconfig: Update company to Microchip
Update AT91 Kconfig text and help to move from Atmel to Microchip. The AT91 wording is kept in the title for historical reasons. Signed-off-by: Nicolas Ferre --- arch/arm/mach-at91/Kconfig | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 6d870421a7a6..1254bf9d91b4 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -1,5 +1,5 @@ menuconfig ARCH_AT91 - bool "Atmel SoCs" + bool "AT91/Microchip SoCs" depends on ARCH_MULTI_V4T || ARCH_MULTI_V5 || ARCH_MULTI_V7 || ARM_SINGLE_ARMV7M select ARM_CPU_SUSPEND if PM && ARCH_MULTI_V7 select COMMON_CLK_AT91 @@ -13,7 +13,7 @@ config SOC_SAMV7 select COMMON_CLK_AT91 select PINCTRL_AT91 help - Select this if you are using an SoC from Atmel's SAME7, SAMS7 or SAMV7 + Select this if you are using an SoC from Microchip's SAME7, SAMS7 or SAMV7 families. config SOC_SAMA5D2 @@ -29,7 +29,7 @@ config SOC_SAMA5D2 select HAVE_AT91_AUDIO_PLL select PINCTRL_AT91PIO4 help - Select this if ou are using one of Atmel's SAMA5D2 family SoC. + Select this if ou are using one of Microchip's SAMA5D2 family SoC. config SOC_SAMA5D3 bool "SAMA5D3 family" @@ -41,7 +41,7 @@ config SOC_SAMA5D3 select HAVE_AT91_USB_CLK select PINCTRL_AT91 help - Select this if you are using one of Atmel's SAMA5D3 family SoC. + Select this if you are using one of Microchip's SAMA5D3 family SoC. This support covers SAMA5D31, SAMA5D33, SAMA5D34, SAMA5D35, SAMA5D36. config SOC_SAMA5D4 @@ -56,7 +56,7 @@ config SOC_SAMA5D4 select HAVE_AT91_H32MX select PINCTRL_AT91 help - Select this if you are using one of Atmel's SAMA5D4 family SoC. + Select this if you are using one of Microchip's SAMA5D4 family SoC. config SOC_AT91RM9200 bool "AT91RM9200" @@ -70,7 +70,7 @@ config SOC_AT91RM9200 select SOC_SAM_V4_V5 select SRAM if PM help - Select this if you are using Atmel's AT91RM9200 SoC. + Select this if you are using Microchip's AT91RM9200 SoC. config SOC_AT91SAM9 bool "AT91SAM9" @@ -88,7 +88,7 @@ config SOC_AT91SAM9 select SOC_SAM_V4_V5 select SRAM if PM help - Select this if you are using one of those Atmel SoC: + Select this if you are using one of those Microchip SoC: AT91SAM9260 AT91SAM9261 AT91SAM9263 -- 2.15.1
[PATCH 2/3] Documentation: at91: Update Microchip SoC documentation
We move the former Atmel wording to the the new Microchip name for this SoC family. With the name of the directory we also change the content in relation with the update of the MAINTAINERS file. The Datasheet links now point to real documents instead of 404s. Signed-off-by: Nicolas Ferre --- Documentation/arm/{Atmel => Microchip}/README | 52 +-- 1 file changed, 25 insertions(+), 27 deletions(-) rename Documentation/arm/{Atmel => Microchip}/README (64%) diff --git a/Documentation/arm/Atmel/README b/Documentation/arm/Microchip/README similarity index 64% rename from Documentation/arm/Atmel/README rename to Documentation/arm/Microchip/README index afb13c15389d..a366f37d38f1 100644 --- a/Documentation/arm/Atmel/README +++ b/Documentation/arm/Microchip/README @@ -1,54 +1,54 @@ -ARM Atmel SoCs (aka AT91) -= +ARM Microchip SoCs (aka AT91) += Introduction -This document gives useful information about the ARM Atmel SoCs that are +This document gives useful information about the ARM Microchip SoCs that are currently supported in Linux Mainline (you know, the one on kernel.org). -It is important to note that the Atmel | SMART ARM-based MPU product line is -historically named "AT91" or "at91" throughout the Linux kernel development -process even if this product prefix has completely disappeared from the -official Atmel product name. Anyway, files, directories, git trees, +It is important to note that the Microchip (previously Atmel) ARM-based MPU +product line is historically named "AT91" or "at91" throughout the Linux kernel +development process even if this product prefix has completely disappeared from +the official Microchip product name. Anyway, files, directories, git trees, git branches/tags and email subject always contain this "at91" sub-string. AT91 SoCs - Documentation and detailed datasheet for each product are available on -the Atmel website: http://www.atmel.com. +the Microchip website: http://www.microchip.com. Flavors: * ARM 920 based SoC - at91rm9200 + Datasheet - http://www.atmel.com/Images/doc1768.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-1768-32-bit-ARM920T-Embedded-Microprocessor-AT91RM9200_Datasheet.pdf * ARM 926 based SoCs - at91sam9260 + Datasheet - http://www.atmel.com/Images/doc6221.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6221-32-bit-ARM926EJ-S-Embedded-Microprocessor-SAM9260_Datasheet.pdf - at91sam9xe + Datasheet - http://www.atmel.com/Images/Atmel-6254-32-bit-ARM926EJ-S-Embedded-Microprocessor-SAM9XE_Datasheet.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6254-32-bit-ARM926EJ-S-Embedded-Microprocessor-SAM9XE_Datasheet.pdf - at91sam9261 + Datasheet - http://www.atmel.com/Images/doc6062.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6062-ARM926EJ-S-Microprocessor-SAM9261_Datasheet.pdf - at91sam9263 + Datasheet - http://www.atmel.com/Images/Atmel_6249_32-bit-ARM926EJ-S-Microcontroller_SAM9263_Datasheet.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6249-32-bit-ARM926EJ-S-Embedded-Microprocessor-SAM9263_Datasheet.pdf - at91sam9rl + Datasheet - http://www.atmel.com/Images/doc6289.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/doc6289.pdf - at91sam9g20 + Datasheet - http://www.atmel.com/Images/doc6384.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/DS60001516A.pdf - at91sam9g45 family - at91sam9g45 @@ -56,7 +56,7 @@ the Atmel website: http://www.atmel.com. - at91sam9m10 - at91sam9m11 (device superset) + Datasheet - http://www.atmel.com/Images/Atmel-6437-32-bit-ARM926-Embedded-Microprocessor-SAM9M11_Datasheet.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-6437-32-bit-ARM926-Embedded-Microprocessor-SAM9M11_Datasheet.pdf - at91sam9x5 family (aka "The 5 series") - at91sam9g15 @@ -65,11 +65,11 @@ the Atmel website: http://www.atmel.com. - at91sam9x25 - at91sam9x35 + Datasheet (can be considered as covering the whole family) - http://www.atmel.com/Images/Atmel_11055_32-bit-ARM926EJ-S-Microcontroller_SAM9X35_Datasheet.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-11055-32-bit-ARM926EJ-S-Microcontroller-SAM9X35_Datasheet.pdf - at91sam9n12 + Datasheet - http://www.atmel.com/Images/Atmel_11063_32-bit-ARM926EJ-S-Microcontroller_SAM9N12CN11CN12_Datasheet.pdf + http://ww1.microchip.com/downloads/en/DeviceDoc/DS60001517A.pdf * ARM Cortex-A5 based SoCs - sama5d
Re: [PATCH] spi: atmel: init FIFOs before spi enable
On 27/02/2018 at 11:25, Eugen Hristev wrote: The datasheet recommends initializing FIFOs before SPI enable. If we do not do it like this, there may be a strange behavior. We noticed that DMA does not work properly with FIFOs if we do not clear them beforehand or enable them before SPIEN. Signed-off-by: Eugen Hristev Ok, good: Acked-by: Nicolas Ferre --- drivers/spi/spi-atmel.c | 8 +--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 6694709..0478758 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c @@ -1489,6 +1489,11 @@ static void atmel_spi_init(struct atmel_spi *as) { spi_writel(as, CR, SPI_BIT(SWRST)); spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ + + /* It is recommended to enable FIFOs first thing after reset */ + if (as->fifo_size) + spi_writel(as, CR, SPI_BIT(FIFOEN)); + if (as->caps.has_wdrbt) { spi_writel(as, MR, SPI_BIT(WDRBT) | SPI_BIT(MODFDIS) | SPI_BIT(MSTR)); @@ -1499,9 +1504,6 @@ static void atmel_spi_init(struct atmel_spi *as) if (as->use_pdc) spi_writel(as, PTCR, SPI_BIT(RXTDIS) | SPI_BIT(TXTDIS)); spi_writel(as, CR, SPI_BIT(SPIEN)); - - if (as->fifo_size) - spi_writel(as, CR, SPI_BIT(FIFOEN)); } static int atmel_spi_probe(struct platform_device *pdev) -- Nicolas Ferre
Re: [PATCH] MAINTAINERS: ARM: at91: update my email address
On 16/02/2018 at 11:03, Alexandre Belloni wrote: Free Electrons is now Bootlin. Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre Sure! Welcome Bootlin! Regards, Nicolas --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 3bdc260e36b7..99038a885ba6 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -1238,7 +1238,7 @@ F:drivers/clk/at91 ARM/ATMEL AT91RM9200, AT91SAM9 AND SAMA5 SOC SUPPORT M:Nicolas Ferre -M: Alexandre Belloni +M: Alexandre Belloni L:linux-arm-ker...@lists.infradead.org (moderated for non-subscribers) W:http://www.linux4sam.org T:git git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git -- Nicolas Ferre
Re: [PATCH v3 1/7] watchdog: sama5d4: make use of timeout-secs provided in devicetree
On 11/02/2018 at 21:08, Marcus Folkesson wrote: > watchdog_init_timeout() will allways pick timeout_param since it > defaults to a valid timeout. > > Following best practice described in > Documentation/watchdog/watchdog-kernel-api.txt to make use of > the parameter logic. > > Signed-off-by: Marcus Folkesson Acked-by: Nicolas Ferre Thanks, best regards, Nicolas > --- > > Notes: > v3: > - Use wdd->timeout instead of wdt_timeout when print out > timout in probe function. > > drivers/watchdog/sama5d4_wdt.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/watchdog/sama5d4_wdt.c b/drivers/watchdog/sama5d4_wdt.c > index 0ae947c3d7bc..255169916dbb 100644 > --- a/drivers/watchdog/sama5d4_wdt.c > +++ b/drivers/watchdog/sama5d4_wdt.c > @@ -33,7 +33,7 @@ struct sama5d4_wdt { > unsigned long last_ping; > }; > > -static int wdt_timeout = WDT_DEFAULT_TIMEOUT; > +static int wdt_timeout; > static bool nowayout = WATCHDOG_NOWAYOUT; > > module_param(wdt_timeout, int, 0); > @@ -212,7 +212,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) > return -ENOMEM; > > wdd = &wdt->wdd; > - wdd->timeout = wdt_timeout; > + wdd->timeout = WDT_DEFAULT_TIMEOUT; > wdd->info = &sama5d4_wdt_info; > wdd->ops = &sama5d4_wdt_ops; > wdd->min_timeout = MIN_WDT_TIMEOUT; > @@ -273,7 +273,7 @@ static int sama5d4_wdt_probe(struct platform_device *pdev) > platform_set_drvdata(pdev, wdt); > > dev_info(&pdev->dev, "initialized (timeout = %d sec, nowayout = %d)\n", > - wdt_timeout, nowayout); > + wdd->timeout, nowayout); > > return 0; > } > -- Nicolas Ferre
Re: [RESEND][PATCH] video: fbdev: atmel_lcdfb: convert to use GPIO descriptors
On 05/02/2018 at 09:47, Ludovic Desroches wrote: > Use GPIO descriptors instead of relying on the old method. > > Signed-off-by: Ludovic Desroches Acked-by: Nicolas Ferre On this resent patch as well ;-) > --- > drivers/video/fbdev/atmel_lcdfb.c | 30 -- > 1 file changed, 12 insertions(+), 18 deletions(-) > > diff --git a/drivers/video/fbdev/atmel_lcdfb.c > b/drivers/video/fbdev/atmel_lcdfb.c > index 3dee267d7c75..ef3d4198014f 100644 > --- a/drivers/video/fbdev/atmel_lcdfb.c > +++ b/drivers/video/fbdev/atmel_lcdfb.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -61,8 +62,7 @@ struct atmel_lcdfb_info { > }; > > struct atmel_lcdfb_power_ctrl_gpio { > - int gpio; > - int active_low; > + struct gpio_desc *gpiod; > > struct list_head list; > }; > @@ -1018,7 +1018,7 @@ static void atmel_lcdfb_power_control_gpio(struct > atmel_lcdfb_pdata *pdata, int > struct atmel_lcdfb_power_ctrl_gpio *og; > > list_for_each_entry(og, &pdata->pwr_gpios, list) > - gpio_set_value(og->gpio, on); > + gpiod_set_value(og->gpiod, on); > } > > static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) > @@ -1031,11 +1031,11 @@ static int atmel_lcdfb_of_init(struct > atmel_lcdfb_info *sinfo) > struct device_node *display_np; > struct device_node *timings_np; > struct display_timings *timings; > - enum of_gpio_flags flags; > struct atmel_lcdfb_power_ctrl_gpio *og; > bool is_gpio_power = false; > int ret = -ENOENT; > - int i, gpio; > + int i; > + struct gpio_desc *gpiod; > > sinfo->config = (struct atmel_lcdfb_config*) > of_match_device(atmel_lcdfb_dt_ids, dev)->data; > @@ -1072,28 +1072,22 @@ static int atmel_lcdfb_of_init(struct > atmel_lcdfb_info *sinfo) > > INIT_LIST_HEAD(&pdata->pwr_gpios); > ret = -ENOMEM; > - for (i = 0; i < of_gpio_named_count(display_np, > "atmel,power-control-gpio"); i++) { > - gpio = of_get_named_gpio_flags(display_np, > "atmel,power-control-gpio", > -i, &flags); > - if (gpio < 0) > + for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) { > + gpiod = devm_gpiod_get_index_optional(dev, > + "atmel,power-control", i, GPIOD_ASIS); > + if (!gpiod) > continue; > > og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL); > if (!og) > goto put_display_node; > > - og->gpio = gpio; > - og->active_low = flags & OF_GPIO_ACTIVE_LOW; > + og->gpiod = gpiod; > is_gpio_power = true; > - ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio"); > - if (ret) { > - dev_err(dev, "request gpio %d failed\n", gpio); > - goto put_display_node; > - } > > - ret = gpio_direction_output(gpio, og->active_low); > + ret = gpiod_direction_output(gpiod, gpiod_is_active_low(gpiod)); > if (ret) { > - dev_err(dev, "set direction output gpio %d failed\n", > gpio); > + dev_err(dev, "set direction output gpio > atmel,power-control[%d] failed\n", i); > goto put_display_node; > } > list_add(&og->list, &pdata->pwr_gpios); > -- Nicolas Ferre
Re: [PATCH] video: fbdev: convert to use GPIO descriptors
On 05/02/2018 at 09:23, Ludovic Desroches wrote: > Use GPIO descriptors instead of relying on the old method. > > Signed-off-by: Ludovic Desroches Acked-by: Nicolas Ferre Thanks! > --- > drivers/video/fbdev/atmel_lcdfb.c | 30 -- > 1 file changed, 12 insertions(+), 18 deletions(-) > > diff --git a/drivers/video/fbdev/atmel_lcdfb.c > b/drivers/video/fbdev/atmel_lcdfb.c > index 3dee267d7c75..ef3d4198014f 100644 > --- a/drivers/video/fbdev/atmel_lcdfb.c > +++ b/drivers/video/fbdev/atmel_lcdfb.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -61,8 +62,7 @@ struct atmel_lcdfb_info { > }; > > struct atmel_lcdfb_power_ctrl_gpio { > - int gpio; > - int active_low; > + struct gpio_desc *gpiod; > > struct list_head list; > }; > @@ -1018,7 +1018,7 @@ static void atmel_lcdfb_power_control_gpio(struct > atmel_lcdfb_pdata *pdata, int > struct atmel_lcdfb_power_ctrl_gpio *og; > > list_for_each_entry(og, &pdata->pwr_gpios, list) > - gpio_set_value(og->gpio, on); > + gpiod_set_value(og->gpiod, on); > } > > static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) > @@ -1031,11 +1031,11 @@ static int atmel_lcdfb_of_init(struct > atmel_lcdfb_info *sinfo) > struct device_node *display_np; > struct device_node *timings_np; > struct display_timings *timings; > - enum of_gpio_flags flags; > struct atmel_lcdfb_power_ctrl_gpio *og; > bool is_gpio_power = false; > int ret = -ENOENT; > - int i, gpio; > + int i; > + struct gpio_desc *gpiod; > > sinfo->config = (struct atmel_lcdfb_config*) > of_match_device(atmel_lcdfb_dt_ids, dev)->data; > @@ -1072,28 +1072,22 @@ static int atmel_lcdfb_of_init(struct > atmel_lcdfb_info *sinfo) > > INIT_LIST_HEAD(&pdata->pwr_gpios); > ret = -ENOMEM; > - for (i = 0; i < of_gpio_named_count(display_np, > "atmel,power-control-gpio"); i++) { > - gpio = of_get_named_gpio_flags(display_np, > "atmel,power-control-gpio", > -i, &flags); > - if (gpio < 0) > + for (i = 0; i < gpiod_count(dev, "atmel,power-control"); i++) { > + gpiod = devm_gpiod_get_index_optional(dev, > + "atmel,power-control", i, GPIOD_ASIS); > + if (!gpiod) > continue; > > og = devm_kzalloc(dev, sizeof(*og), GFP_KERNEL); > if (!og) > goto put_display_node; > > - og->gpio = gpio; > - og->active_low = flags & OF_GPIO_ACTIVE_LOW; > + og->gpiod = gpiod; > is_gpio_power = true; > - ret = devm_gpio_request(dev, gpio, "lcd-power-control-gpio"); > - if (ret) { > - dev_err(dev, "request gpio %d failed\n", gpio); > - goto put_display_node; > - } > > - ret = gpio_direction_output(gpio, og->active_low); > + ret = gpiod_direction_output(gpiod, gpiod_is_active_low(gpiod)); > if (ret) { > - dev_err(dev, "set direction output gpio %d failed\n", > gpio); > + dev_err(dev, "set direction output gpio > atmel,power-control[%d] failed\n", i); > goto put_display_node; > } > list_add(&og->list, &pdata->pwr_gpios); > -- Nicolas Ferre
Re: [PATCH] ARM: dts: at91: sam9rl: Prperly assign copyright
On 16/01/2018 at 15:29, Alexandre Belloni wrote: > The copyright holder for this work is Microchip (formerly Atmel) > > Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre > --- > arch/arm/boot/dts/at91sam9rl.dtsi | 3 ++- > arch/arm/boot/dts/at91sam9rlek.dts | 3 ++- > 2 files changed, 4 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/boot/dts/at91sam9rl.dtsi > b/arch/arm/boot/dts/at91sam9rl.dtsi > index 52f0e9ef8f67..5d388fa214b6 100644 > --- a/arch/arm/boot/dts/at91sam9rl.dtsi > +++ b/arch/arm/boot/dts/at91sam9rl.dtsi > @@ -1,7 +1,8 @@ > /* > * at91sam9rl.dtsi - Device Tree Include file for AT91SAM9RL family SoC > * > - * Copyright (C) 2014 Alexandre Belloni > > + * Copyright (C) 2014 Microchip > + * Alexandre Belloni > * > * Licensed under GPLv2 or later. > */ > diff --git a/arch/arm/boot/dts/at91sam9rlek.dts > b/arch/arm/boot/dts/at91sam9rlek.dts > index ea6ed98960c9..433f5464a887 100644 > --- a/arch/arm/boot/dts/at91sam9rlek.dts > +++ b/arch/arm/boot/dts/at91sam9rlek.dts > @@ -1,7 +1,8 @@ > /* > * at91sam9rlek.dts - Device Tree file for Atmel at91sam9rl reference board > * > - * Copyright (C) 2014 Alexandre Belloni > > + * Copyright (C) 2014 Microchip > + * Alexandre Belloni > * > * Licensed under GPLv2 only > */ > -- Nicolas Ferre
Re: [PATCH 1/2] MAINTAINERS: linux-media: update Microchip ISI and ISC entries
On 09/01/2018 at 14:46, Nicolas Ferre wrote: > These two image capture interface drivers are now handled > by Wenyou Yang. > I benefit from this change to update the two entries by correcting the > binding documentation link for ISC and moving the ISI to the new > MICROCHIP / ATMEL location. > > Signed-off-by: Nicolas Ferre > --- > Hi, > > Patch against next-20180109. > Note that I didn't find it useful to have several patches for these changes. > Tell me if you feel differently. > > I would like to have the Ack from Ludovic and Wenyou obviously. I don't know > if > Songjun can answer as he's not with Microchip anymore. Update on this patch: Boris took the second patch of the series through NAND/MTD tree so this one can go alone upstream through the linux-media tree. I also have the 2 required Ack. So, do you want me to re-send this one independently or should we wait for 4.16-rc1? Best regards, Nicolas > MAINTAINERS | 19 ++- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/MAINTAINERS b/MAINTAINERS > index a7d10a2bb980..65c4b59b582f 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -2353,13 +2353,6 @@ L: linux-...@vger.kernel.org > S: Supported > F: drivers/i2c/busses/i2c-at91.c > > -ATMEL ISI DRIVER > -M: Ludovic Desroches > -L: linux-me...@vger.kernel.org > -S: Supported > -F: drivers/media/platform/atmel/atmel-isi.c > -F: include/media/atmel-isi.h > - > ATMEL LCDFB DRIVER > M: Nicolas Ferre > L: linux-fb...@vger.kernel.org > @@ -9102,12 +9095,20 @@ S:Maintained > F: drivers/crypto/atmel-ecc.* > > MICROCHIP / ATMEL ISC DRIVER > -M: Songjun Wu > +M: Wenyou Yang > L: linux-me...@vger.kernel.org > S: Supported > F: drivers/media/platform/atmel/atmel-isc.c > F: drivers/media/platform/atmel/atmel-isc-regs.h > -F: devicetree/bindings/media/atmel-isc.txt > +F: Documentation/devicetree/bindings/media/atmel-isc.txt > + > +MICROCHIP / ATMEL ISI DRIVER > +M: Wenyou Yang > +L: linux-me...@vger.kernel.org > +S: Supported > +F: drivers/media/platform/atmel/atmel-isi.c > +F: include/media/atmel-isi.h > +F: Documentation/devicetree/bindings/media/atmel-isi.txt > > MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER > M: Woojung Huh > -- Nicolas Ferre
[PATCH v2] MAINTAINERS: mtd/nand: update Microchip nand entry
Update Wenyou Yang email address. Take advantage of this update to move this entry to the MICROCHIP / ATMEL location and add the DT binding documentation link. Signed-off-by: Nicolas Ferre Acked-by: Wenyou Yang --- v2: - patch agains 09ec417b0ea8 ("mtd: nand: samsung: Disable subpage writes on E-die NAND") of http://git.infradead.org/linux-mtd.git/shortlog/refs/heads/nand/next - Ack by Wenyou added Hi, v1 patch was part of a series because it was conflicting with the previous one named: "[PATCH 1/2] MAINTAINERS: linux-media: update Microchip ISI and ISC entries" Boris asked me to rebase it so that they are independent. So, if this first one goes upstream through another tree, conflicts will have to be resolved at one point. Best regards, Nicolas MAINTAINERS | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index aa71ab52fd76..37ee5ae4bae2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2382,13 +2382,6 @@ F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c F: include/linux/platform_data/atmel_mxt_ts.h -ATMEL NAND DRIVER -M: Wenyou Yang -M: Josh Wu -L: linux-...@lists.infradead.org -S: Supported -F: drivers/mtd/nand/atmel/* - ATMEL SAMA5D2 ADC DRIVER M: Ludovic Desroches L: linux-...@vger.kernel.org @@ -9045,6 +9038,14 @@ F: drivers/media/platform/atmel/atmel-isc.c F: drivers/media/platform/atmel/atmel-isc-regs.h F: devicetree/bindings/media/atmel-isc.txt +MICROCHIP / ATMEL NAND DRIVER +M: Wenyou Yang +M: Josh Wu +L: linux-...@lists.infradead.org +S: Supported +F: drivers/mtd/nand/atmel/* +F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh M: Microchip Linux Driver Support -- 2.9.0
[PATCH 1/2] MAINTAINERS: linux-media: update Microchip ISI and ISC entries
These two image capture interface drivers are now handled by Wenyou Yang. I benefit from this change to update the two entries by correcting the binding documentation link for ISC and moving the ISI to the new MICROCHIP / ATMEL location. Signed-off-by: Nicolas Ferre --- Hi, Patch against next-20180109. Note that I didn't find it useful to have several patches for these changes. Tell me if you feel differently. I would like to have the Ack from Ludovic and Wenyou obviously. I don't know if Songjun can answer as he's not with Microchip anymore. Best regards, Nicolas MAINTAINERS | 19 ++- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index a7d10a2bb980..65c4b59b582f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2353,13 +2353,6 @@ L: linux-...@vger.kernel.org S: Supported F: drivers/i2c/busses/i2c-at91.c -ATMEL ISI DRIVER -M: Ludovic Desroches -L: linux-me...@vger.kernel.org -S: Supported -F: drivers/media/platform/atmel/atmel-isi.c -F: include/media/atmel-isi.h - ATMEL LCDFB DRIVER M: Nicolas Ferre L: linux-fb...@vger.kernel.org @@ -9102,12 +9095,20 @@ S: Maintained F: drivers/crypto/atmel-ecc.* MICROCHIP / ATMEL ISC DRIVER -M: Songjun Wu +M: Wenyou Yang L: linux-me...@vger.kernel.org S: Supported F: drivers/media/platform/atmel/atmel-isc.c F: drivers/media/platform/atmel/atmel-isc-regs.h -F: devicetree/bindings/media/atmel-isc.txt +F: Documentation/devicetree/bindings/media/atmel-isc.txt + +MICROCHIP / ATMEL ISI DRIVER +M: Wenyou Yang +L: linux-me...@vger.kernel.org +S: Supported +F: drivers/media/platform/atmel/atmel-isi.c +F: include/media/atmel-isi.h +F: Documentation/devicetree/bindings/media/atmel-isi.txt MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh -- 2.9.0
[PATCH 2/2] MAINTAINERS: mtd/nand: update Microchip nand entry
Update Wenyou Yang email address. Take advantage of this update to move this entry to the MICROCHIP / ATMEL location and add the DT binding documentation link. Signed-off-by: Nicolas Ferre --- Hi, Patch against next-20180109. This patch is somehow dependent on the previous one in the series ("MAINTAINERS: linux-media: update Microchip ISI and ISC entries") but can be rebased easily. I don't know if it's better to have them added at the end of the development cycle or just after rc1: let me know if you plan to take them or if I need to rebase them for next cycle. Best regards, Nicolas MAINTAINERS | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 65c4b59b582f..b48e217d41fb 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -2373,13 +2373,6 @@ F: Documentation/devicetree/bindings/input/atmel,maxtouch.txt F: drivers/input/touchscreen/atmel_mxt_ts.c F: include/linux/platform_data/atmel_mxt_ts.h -ATMEL NAND DRIVER -M: Wenyou Yang -M: Josh Wu -L: linux-...@lists.infradead.org -S: Supported -F: drivers/mtd/nand/atmel/* - ATMEL SAMA5D2 ADC DRIVER M: Ludovic Desroches L: linux-...@vger.kernel.org @@ -9110,6 +9103,14 @@ F: drivers/media/platform/atmel/atmel-isi.c F: include/media/atmel-isi.h F: Documentation/devicetree/bindings/media/atmel-isi.txt +MICROCHIP / ATMEL NAND DRIVER +M: Wenyou Yang +M: Josh Wu +L: linux-...@lists.infradead.org +S: Supported +F: drivers/mtd/nand/atmel/* +F: Documentation/devicetree/bindings/mtd/atmel-nand.txt + MICROCHIP KSZ SERIES ETHERNET SWITCH DRIVER M: Woojung Huh M: Microchip Linux Driver Support -- 2.9.0
Re: [RFC] ARM: dts: sama5d2: qspi DMA fixes spi DMA
On 26/12/2017 at 20:52, Adam Ford wrote: > For some reason without this patch, using SPI0 with DMA yields the > following message: > > atmel_spi f800.spi: DMA TX channel not available, SPI unable to use DMA > > With the patch, trying to use SPI0 yields the following: > > atmel_spi f800.spi: Using dma0chan0 (tx) and dma0chan1 (rx) for DMA > transfers It seems related to SPI interface, handled by drivers/spi/spi-atmel.c driver. DMA properties are already set for this driver. > The QSPI driver doesn't appear to me to be using the DMA but the > datasheet seems indicate the DMA is supported. I am not sure why patch would > fix the errors, so I'm posting it as RFC. QSPI is a totally different IP and so driver: drivers/mtd/spi-nor/atmel-quadspi.c Actually what you modify hereunder is the QSPI DT and the DMA is disabled for it because we miss a way to make sure that the buffer we are handling are DMA capable (continuous for instance). The support for a way to handle this is being discussed right now (by Cyrille in copy). Once settled, we will be able to use DMA with QSPI in this driver. DT binding is not determined yet BTW. For now, your patch is not usable. Thanks, best regards. Nicolas > Signed-off-by: Adam Ford > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi > index 61f68e5..fd55e91 100644 > --- a/arch/arm/boot/dts/sama5d2.dtsi > +++ b/arch/arm/boot/dts/sama5d2.dtsi > @@ -999,6 +999,13 @@ > reg = <0xf002 0x100>, <0xd000 > 0x0800>; > reg-names = "qspi_base", "qspi_mmap"; > interrupts = <52 IRQ_TYPE_LEVEL_HIGH 7>; > + dmas = <&dma0 > + (AT91_XDMAC_DT_MEM_IF(0) | > AT91_XDMAC_DT_PER_IF(1) | > + AT91_XDMAC_DT_PERID(4))>, > +<&dma0 > + (AT91_XDMAC_DT_MEM_IF(0) | > AT91_XDMAC_DT_PER_IF(1) | > + AT91_XDMAC_DT_PERID(5))>; > + dma-names = "tx", "rx"; > clocks = <&qspi0_clk>; > #address-cells = <1>; > #size-cells = <0>; > @@ -1010,6 +1017,13 @@ > reg = <0xf0024000 0x100>, <0xd800 > 0x0800>; > reg-names = "qspi_base", "qspi_mmap"; > interrupts = <53 IRQ_TYPE_LEVEL_HIGH 7>; > + dmas = <&dma1 > + (AT91_XDMAC_DT_MEM_IF(0) | > AT91_XDMAC_DT_PER_IF(1) | > + AT91_XDMAC_DT_PERID(48))>, > +<&dma0 > + (AT91_XDMAC_DT_MEM_IF(0) | > AT91_XDMAC_DT_PER_IF(1) | > + AT91_XDMAC_DT_PERID(49))>; > + dma-names = "tx", "rx"; > clocks = <&qspi1_clk>; > #address-cells = <1>; > #size-cells = <0>; > -- Nicolas Ferre
[PATCH] ARM: dts: at91: sama5d2_ptc_ek: use TCB0 as timers
Use tcb0 for timers as selected in sama5_defconfig. Signed-off-by: Nicolas Ferre --- Hi Alex, Adding the newly added sama5d2_ptc_ek to the series. Not tested though. Regards, Nicolas arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts index 186cb03e2672..e603a267bdf1 100644 --- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts @@ -149,6 +149,18 @@ }; }; + tcb0: timer@f800c000 { + timer0: timer@0 { + compatible = "atmel,tcb-timer"; + reg = <0>; + }; + + timer1: timer@1 { + compatible = "atmel,tcb-timer"; + reg = <1>; + }; + }; + uart0: serial@f801c000 { pinctrl-names = "default"; pinctrl-0 = <&pinctrl_uart0_default>; -- 2.9.0
Re: [PATCH 00/45] Migrate TCB bindings
On 19/12/2017 at 22:31, Alexandre Belloni wrote: > Hi, > > As the bindings were acked by Rob a while ago [1] and I think there is > consensus on what they look like, I'm planning to apply that series for > 4.16 so we get a smoother transition for the TCB driver rework. > > I've simply removed the PWM binding change that I will submit with the > driver change itself. > There is also a small fix in the at91sam9261ek patch. > > [1] https://patchwork.kernel.org/patch/9755341/ > > Cc: Antoine Aubert > Cc: devicet...@vger.kernel.org > Cc: Douglas Gilbert > Cc: Fabio Porcedda > Cc: Gregory CLEMENT > Cc: Joachim Eastwood > Cc: Marek Vasut > Cc: Martin Reimann > Cc: Peter Rosin > Cc: Raashid Muhammed > Cc: Rob Herring > Cc: Rodolfo Giometti > Cc: Sergio Tanzilli > Cc: Tim Schendekehl > > Alexandre Belloni (45): > ARM: at91: Document new TCB bindings > ARM: dts: at91: at91rm9200: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91rm9200ek: use TCB0 for timers > ARM: dts: at91: mpa1600: use TCB0 as timers > ARM: dts: at91: at91sam9260: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9260ek: use TCB0 as timers > ARM: dts: at91: sam9_l9260: use TCB0 as timers > ARM: dts: at91: ethernut5: use TCB0 as timers > ARM: dts: at91: foxg20: use TCB0 as timers > ARM: dts: at91: animeo_ip: use TCB0 as timers > ARM: dts: at91: kizbox: use TCB0 as timers > ARM: dts: at91: at91sam9g20ek: use TCB0 as timers > ARM: dts: at91: ge863-pro3: use TCB0 as timers > ARM: dts: at91: at91sam9261: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9261ek: use TCB0 as timers > ARM: dts: at91: at91sam9263: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9263ek: use TCB0 as timers > ARM: dts: at91: calao: use TCB0 as timers > ARM: dts: at91: at91sam9g45: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9m10g45ek: use TCB0 as timers > ARM: dts: at91: pm9g45: use TCB0 as timers > ARM: dts: at91: at91sam9rl: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9rlek: use TCB0 as timers > ARM: dts: at91: at91sam9n12: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9n12ek: use TCB0 as timers > ARM: dts: at91: at91sam9x5: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: at91sam9x5cm: use TCB0 as timers > ARM: dts: at91: acme/g25: use TCB0 as timers > ARM: dts: at91: cosino: use TCB0 as timers > ARM: dts: at91: kizboxmini: use TCB0 as timers > ARM: dts: at91: sama5d3: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: sama5d3xek: use TCB0 as timers > ARM: dts: at91: sama5d3 Xplained: use TCB0 as timers > ARM: dts: at91: kizbox2: use TCB0 as timers > ARM: dts: at91: sama5d3xek_cmp: use TCB0 as timers > ARM: dts: at91: linea/tse850-3: use TCB0 as timers > ARM: dts: at91: sama5d4: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: sama5d4: Add TCB2 > ARM: dts: at91: sama5d4ek: use TCB2 as timers > ARM: dts: at91: sama5d4 Xplained: use TCB2 as timers > ARM: dts: at91: ma5d4: use TCB2 as timers > ARM: dts: at91: vinco: use TCB2 as timers > ARM: dts: at91: sama5d2: TC blocks are also simple-mfd and syscon > devices > ARM: dts: at91: sama5d2 Xplained: use TCB0 as timers > ARM: dts: at91: sama5d27_som1_ek: use TCB0 as timers For the whole series: Acked-by: Nicolas Ferre Thanks, best regards, Nicolas > .../devicetree/bindings/arm/atmel-at91.txt | 32 - > .../devicetree/bindings/mfd/atmel-tcb.txt | 56 > ++ > arch/arm/boot/dts/animeo_ip.dts| 12 + > arch/arm/boot/dts/at91-ariag25.dts | 12 + > arch/arm/boot/dts/at91-ariettag25.dts | 12 + > arch/arm/boot/dts/at91-cosino.dtsi | 12 + > arch/arm/boot/dts/at91-foxg20.dts | 12 + > arch/arm/boot/dts/at91-kizbox.dts | 12 + > arch/arm/boot/dts/at91-kizbox2.dts | 12 + > arch/arm/boot/dts/at91-kizboxmini.dts | 12 + > arch/arm/boot/dts/at91-linea.dtsi | 12 + > arch/arm/boot/dts/at91-qil_a9260.dts | 12 + > arch/arm/boot/dts/at91-sam9_l9260.dts | 12 + > arch/arm/boot/dts/at91-sama5d27_som1_ek.dts| 12 + > arch/arm/boot/dts/at91-sama5d2_xplained.dts| 12 + > arch/arm/boot/dts/at91-sama5d3_xplained.dts| 12 + > arch/arm/boo
Re: [PATCH] pwm: atmel-tcb: Delete an error message for a failed memory allocation in atmel_tcb_pwm_probe()
Hi, On 15/12/2017 at 19:00, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 15 Dec 2017 18:55:11 +0100 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. Can you point which coccinelle script highlited this issue? > Signed-off-by: Markus Elfring > --- > drivers/pwm/pwm-atmel-tcb.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c > index acd3ce8ecf3f..4fb1be246c44 100644 > --- a/drivers/pwm/pwm-atmel-tcb.c > +++ b/drivers/pwm/pwm-atmel-tcb.c > @@ -401,7 +401,6 @@ static int atmel_tcb_pwm_probe(struct platform_device > *pdev) > tcbpwm = devm_kzalloc(&pdev->dev, sizeof(*tcbpwm), GFP_KERNEL); > if (tcbpwm == NULL) { > err = -ENOMEM; > - dev_err(&pdev->dev, "failed to allocate memory\n"); We have this in case of error: atmel-tcb-pwm pwm: failed to allocate memory atmel-tcb-pwm: probe of pwm failed with error -12 Which is somehow redundant I admit... > goto err_free_tc; > } > > -- Nicolas Ferre
Re: [PATCH v2] spi: atmel: Implements transfers with bounce buffer
On 12/12/2017 at 16:37, Radu Pirea wrote: > This patch enables DMA transfers for Atmel SAM9 SoCs and implements a bounce > buffer for transfers which have vmalloc allocated buffers. Those buffers are > not cache coherent even if they have been transformed into sg lists. UBIFS > is affected by this cache coherency issue. > > In this patch I also reverted "spi: atmel: fix corrupted data issue on SAM9 > family SoCs"(7094576ccdc3acfe1e06a1e2ab547add375baf7f). > > > Signed-off-by: Radu Pirea Acked-by: Nicolas Ferre Best regards, Nicolas > --- > Please ignore the previous version. I messed up with file names. > drivers/spi/spi-atmel.c | 113 > +++- > 1 file changed, 84 insertions(+), 29 deletions(-) > > diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c > index f95da36..198b4cd 100644 > --- a/drivers/spi/spi-atmel.c > +++ b/drivers/spi/spi-atmel.c > @@ -291,6 +291,10 @@ struct atmel_spi { > struct spi_transfer *current_transfer; > int current_remaining_bytes; > int done_status; > + dma_addr_t dma_addr_rx_bbuf; > + dma_addr_t dma_addr_tx_bbuf; > + void*addr_rx_bbuf; > + void*addr_tx_bbuf; > > struct completion xfer_completion; > > @@ -436,6 +440,11 @@ static void atmel_spi_unlock(struct atmel_spi *as) > __releases(&as->lock) > spin_unlock_irqrestore(&as->lock, as->flags); > } > > +static inline bool atmel_spi_is_vmalloc_xfer(struct spi_transfer *xfer) > +{ > + return is_vmalloc_addr(xfer->tx_buf) || is_vmalloc_addr(xfer->rx_buf); > +} > + > static inline bool atmel_spi_use_dma(struct atmel_spi *as, > struct spi_transfer *xfer) > { > @@ -448,7 +457,12 @@ static bool atmel_spi_can_dma(struct spi_master *master, > { > struct atmel_spi *as = spi_master_get_devdata(master); > > - return atmel_spi_use_dma(as, xfer); > + if (IS_ENABLED(CONFIG_SOC_SAM_V4_V5)) > + return atmel_spi_use_dma(as, xfer) && > + !atmel_spi_is_vmalloc_xfer(xfer); > + else > + return atmel_spi_use_dma(as, xfer); > + > } > > static int atmel_spi_dma_slave_config(struct atmel_spi *as, > @@ -594,6 +608,11 @@ static void dma_callback(void *data) > struct spi_master *master = data; > struct atmel_spi*as = spi_master_get_devdata(master); > > + if (is_vmalloc_addr(as->current_transfer->rx_buf) && > + IS_ENABLED(CONFIG_SOC_SAM_V4_V5)) { > + memcpy(as->current_transfer->rx_buf, as->addr_rx_bbuf, > +as->current_transfer->len); > + } > complete(&as->xfer_completion); > } > > @@ -744,17 +763,41 @@ static int atmel_spi_next_xfer_dma_submit(struct > spi_master *master, > goto err_exit; > > /* Send both scatterlists */ > - rxdesc = dmaengine_prep_slave_sg(rxchan, > - xfer->rx_sg.sgl, xfer->rx_sg.nents, > - DMA_FROM_DEVICE, > - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); > + if (atmel_spi_is_vmalloc_xfer(xfer) && > + IS_ENABLED(CONFIG_SOC_SAM_V4_V5)) { > + rxdesc = dmaengine_prep_slave_single(rxchan, > + as->dma_addr_rx_bbuf, > + xfer->len, > + DMA_FROM_DEVICE, > + DMA_PREP_INTERRUPT | > + DMA_CTRL_ACK); > + } else { > + rxdesc = dmaengine_prep_slave_sg(rxchan, > + xfer->rx_sg.sgl, > + xfer->rx_sg.nents, > + DMA_FROM_DEVICE, > + DMA_PREP_INTERRUPT | > + DMA_CTRL_ACK); > + } > if (!rxdesc) > goto err_dma; > > - txdesc = dmaengine_prep_slave_sg(txchan, > - xfer->tx_sg.sgl, xfer->tx_sg.nents, > - DMA_TO_DEVICE, > - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); > + if (atmel_spi_is_vmalloc_xfer(xfer) && > + IS_ENABLED(CONFIG_SOC_SAM_V4_V5)) { > +
Re: [PATCH] spi: atmel: fixed spin_lock usage inside atmel_spi_remove
On 15/12/2017 at 16:40, Radu Pirea wrote: > The only part of atmel_spi_remove which needs to be atomic is hardware > reset. > > atmel_spi_stop_dma calls dma_terminate_all and this needs interrupts > enabled. > atmel_spi_release_dma calls dma_release_channel and dma_release_channel > locks a mutex inside of spin_lock. > > So the call of these functions can't be inside a spin_lock. > > Reported-by: Jia-Ju Bai > Signed-off-by: Radu Pirea Acked-by: Nicolas Ferre Thanks Radu. Regards, Nicolas > --- > drivers/spi/spi-atmel.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c > index f95da36..6694709 100644 > --- a/drivers/spi/spi-atmel.c > +++ b/drivers/spi/spi-atmel.c > @@ -1661,12 +1661,12 @@ static int atmel_spi_remove(struct platform_device > *pdev) > pm_runtime_get_sync(&pdev->dev); > > /* reset the hardware and block queue progress */ > - spin_lock_irq(&as->lock); > if (as->use_dma) { > atmel_spi_stop_dma(master); > atmel_spi_release_dma(master); > } > > + spin_lock_irq(&as->lock); > spi_writel(as, CR, SPI_BIT(SWRST)); > spi_writel(as, CR, SPI_BIT(SWRST)); /* AT91SAM9263 Rev B workaround */ > spi_readl(as, SR); > -- Nicolas Ferre
Re: [PATCH v6] atmel_flexcom: Support resuming after a chip reset
On 18/12/2017 at 21:19, Alexandre Belloni wrote: > On 12/12/2017 at 17:21:19 +0100, Romain Izard wrote: >> The controller used by a flexcom module is configured at boot, and left >> alone after this. In the suspend mode called "backup with self-refresh" >> available on SAMA5D2, the chip will resume with most of its registers >> reset. In this case, we need to restore the state of the flexcom driver >> on resume. >> >> Signed-off-by: Romain Izard > > Seems good to me > > Acked-by: Alexandre Belloni Thanks Romain, of course I can add the tags that I gave you already: Acked-by: Nicolas Ferre Tested-by: Nicolas Ferre Lee, It seems that you already gave your tag for the v5 of this patch. The wording is even better with this patch. So, can you take this patch in your tree? Best regards, Nicolas >> --- >> Changes in v5: >> * extract from the patch series, and send as a standalone patch >> >> Changes in v6: >> * Reword the patch title and description >> * Rename the internal structure to ddata >> >> drivers/mfd/atmel-flexcom.c | 63 >> ++--- >> 1 file changed, 48 insertions(+), 15 deletions(-) >> >> diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c >> index 064bde9cff5a..f684a93a3340 100644 >> --- a/drivers/mfd/atmel-flexcom.c >> +++ b/drivers/mfd/atmel-flexcom.c >> @@ -39,34 +39,43 @@ >> #define FLEX_MR_OPMODE(opmode) (((opmode) << FLEX_MR_OPMODE_OFFSET) & >> \ >> FLEX_MR_OPMODE_MASK) >> >> +struct atmel_flexcom { >> +void __iomem *base; >> +u32 opmode; >> +struct clk *clk; >> +}; >> >> static int atmel_flexcom_probe(struct platform_device *pdev) >> { >> struct device_node *np = pdev->dev.of_node; >> -struct clk *clk; >> struct resource *res; >> -void __iomem *base; >> -u32 opmode; >> +struct atmel_flexcom *ddata; >> int err; >> >> -err = of_property_read_u32(np, "atmel,flexcom-mode", &opmode); >> +ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); >> +if (!ddata) >> +return -ENOMEM; >> + >> +platform_set_drvdata(pdev, ddata); >> + >> +err = of_property_read_u32(np, "atmel,flexcom-mode", &ddata->opmode); >> if (err) >> return err; >> >> -if (opmode < ATMEL_FLEXCOM_MODE_USART || >> -opmode > ATMEL_FLEXCOM_MODE_TWI) >> +if (ddata->opmode < ATMEL_FLEXCOM_MODE_USART || >> +ddata->opmode > ATMEL_FLEXCOM_MODE_TWI) >> return -EINVAL; >> >> res = platform_get_resource(pdev, IORESOURCE_MEM, 0); >> -base = devm_ioremap_resource(&pdev->dev, res); >> -if (IS_ERR(base)) >> -return PTR_ERR(base); >> +ddata->base = devm_ioremap_resource(&pdev->dev, res); >> +if (IS_ERR(ddata->base)) >> +return PTR_ERR(ddata->base); >> >> -clk = devm_clk_get(&pdev->dev, NULL); >> -if (IS_ERR(clk)) >> -return PTR_ERR(clk); >> +ddata->clk = devm_clk_get(&pdev->dev, NULL); >> +if (IS_ERR(ddata->clk)) >> +return PTR_ERR(ddata->clk); >> >> -err = clk_prepare_enable(clk); >> +err = clk_prepare_enable(ddata->clk); >> if (err) >> return err; >> >> @@ -76,9 +85,9 @@ static int atmel_flexcom_probe(struct platform_device >> *pdev) >> * inaccessible and are read as zero. Also the external I/O lines of the >> * Flexcom are muxed to reach the selected device. >> */ >> -writel(FLEX_MR_OPMODE(opmode), base + FLEX_MR); >> +writel(FLEX_MR_OPMODE(ddata->opmode), ddata->base + FLEX_MR); >> >> -clk_disable_unprepare(clk); >> +clk_disable_unprepare(ddata->clk); >> >> return devm_of_platform_populate(&pdev->dev); >> } >> @@ -89,10 +98,34 @@ static const struct of_device_id >> atmel_flexcom_of_match[] = { >> }; >> MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match); >> >> +#ifdef CONFIG_PM_SLEEP >> +static int atmel_flexcom_resume(struct device *dev) >> +{ >> +struct atmel_flexcom *ddata = dev_get_drvdata(dev); >> +int err; >> +u32 val; >> + >> +err = clk_prepare_enable(ddata->clk); >> +if (err) >> +return err; >> + >> +val = FLEX_MR_OPMODE(ddata->opmode), >> +writel(val, ddata->base + FLEX_MR); >> + >> +clk_disable_unprepare(ddata->clk); >> + >> +return 0; >> +} >> +#endif >> + >> +static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, >> + atmel_flexcom_resume); >> + >> static struct platform_driver atmel_flexcom_driver = { >> .probe = atmel_flexcom_probe, >> .driver = { >> .name = "atmel_flexcom", >> +.pm = &atmel_flexcom_pm_ops, >> .of_match_table = atmel_flexcom_of_match, >> }, >> }; >> -- >> 2.14.1 >> > -- Nicolas Ferre
Re: [PATCH v2] clocksource: tcb_clksrc: Fix clock speed message
On 07/12/2017 at 12:01, Daniel Lezcano wrote: > On 01/12/2017 13:22, Romain Izard wrote: >> The clock speed displayed at boot in an information message was 500 kHz >> too high compared to its real value. As the value is not used anywhere, >> there is no functional impact. >> >> Fix the rounding formula to display the correct value. >> >> Signed-off-by: Romain Izard >> --- >> v2: rebase over v4.15-rc1 >> >> There is no specified maintainer for this file, only supporters. > > That is not correct, it defaults to Thomas and me, the maintainers of > drivers/clocksource :) > >> Nicolas, could you pick this through the at91 tree as the TCB block >> is an AT91 peripheral ? > > Nicolas, do you agree with this change ? If yes, I will take it. Yes, fine with me: Acked-by: Nicolas Ferre Thanks Daniel for the "heads-up". Best regards, Nicolas >> drivers/clocksource/tcb_clksrc.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/clocksource/tcb_clksrc.c >> b/drivers/clocksource/tcb_clksrc.c >> index 9de47d4d2d9e..43f4d5c4d6fa 100644 >> --- a/drivers/clocksource/tcb_clksrc.c >> +++ b/drivers/clocksource/tcb_clksrc.c >> @@ -384,7 +384,7 @@ static int __init tcb_clksrc_init(void) >> >> printk(bootinfo, clksrc.name, CONFIG_ATMEL_TCB_CLKSRC_BLOCK, >> divided_rate / 100, >> -((divided_rate + 50) % 100) / 1000); >> +((divided_rate % 100) + 500) / 1000); >> if (tc->tcb_config && tc->tcb_config->counter_width == 32) { >> /* use apropriate function to read 32 bit counter */ >> > > -- Nicolas Ferre
Re: [PATCH 2/2] net: macb: kill useless use of list_empty()
On 05/12/2017 at 21:18, Julia Cartwright wrote: > The list_for_each_entry() macro already handles the case where the list > is empty (by not executing the loop body). It's not necessary to handle > this case specially, so stop doing so. > > Cc: Rafal Ozieblo > Signed-off-by: Julia Cartwright > --- > This is an additional cleanup patch found when looking at this code. > >Julia Acked-by: Nicolas Ferre Thanks > > drivers/net/ethernet/cadence/macb_main.c | 34 > > 1 file changed, 13 insertions(+), 21 deletions(-) > > diff --git a/drivers/net/ethernet/cadence/macb_main.c > b/drivers/net/ethernet/cadence/macb_main.c > index e7ef104a077d..3643c6ad2322 100644 > --- a/drivers/net/ethernet/cadence/macb_main.c > +++ b/drivers/net/ethernet/cadence/macb_main.c > @@ -2815,25 +2815,22 @@ static int gem_add_flow_filter(struct net_device > *netdev, > spin_lock_irqsave(&bp->rx_fs_lock, flags); > > /* find correct place to add in list */ > - if (list_empty(&bp->rx_fs_list.list)) > - list_add(&newfs->list, &bp->rx_fs_list.list); > - else { > - list_for_each_entry(item, &bp->rx_fs_list.list, list) { > - if (item->fs.location > newfs->fs.location) { > - list_add_tail(&newfs->list, &item->list); > - added = true; > - break; > - } else if (item->fs.location == fs->location) { > - netdev_err(netdev, "Rule not added: location %d > not free!\n", > - fs->location); > - ret = -EBUSY; > - goto err; > - } > + list_for_each_entry(item, &bp->rx_fs_list.list, list) { > + if (item->fs.location > newfs->fs.location) { > + list_add_tail(&newfs->list, &item->list); > + added = true; > + break; > + } else if (item->fs.location == fs->location) { > + netdev_err(netdev, "Rule not added: location %d not > free!\n", > + fs->location); > + ret = -EBUSY; > + goto err; > } > - if (!added) > - list_add_tail(&newfs->list, &bp->rx_fs_list.list); > } > > + if (!added) > + list_add_tail(&newfs->list, &bp->rx_fs_list.list); > + > gem_prog_cmp_regs(bp, fs); > bp->rx_fs_list.count++; > /* enable filtering if NTUPLE on */ > @@ -2859,11 +2856,6 @@ static int gem_del_flow_filter(struct net_device > *netdev, > > spin_lock_irqsave(&bp->rx_fs_lock, flags); > > - if (list_empty(&bp->rx_fs_list.list)) { > - spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > - return -EINVAL; > - } > - > list_for_each_entry(item, &bp->rx_fs_list.list, list) { > if (item->fs.location == cmd->fs.location) { > /* disable screener regs for the flow entry */ > -- Nicolas Ferre
Re: [PATCH 1/2] net: macb: reduce scope of rx_fs_lock-protected regions
On 05/12/2017 at 21:17, Julia Cartwright wrote: > Commit ae8223de3df5 ("net: macb: Added support for RX filtering") > introduces a lock, rx_fs_lock which is intended to protect the list of > rx_flow items and synchronize access to the hardware rx filtering > registers. > > However, the region protected by this lock is overscoped, unnecessarily > including things like slab allocation. Reduce this lock scope to only > include operations which must be performed atomically: list traversal, > addition, and removal, and hitting the macb filtering registers. > > This fixes the use of kmalloc w/ GFP_KERNEL in atomic context. > > Fixes: ae8223de3df5 ("net: macb: Added support for RX filtering") > Cc: Rafal Ozieblo > Cc: Julia Lawall > Signed-off-by: Julia Cartwright > --- > While Julia Lawall's cocci-generated patch fixes the problem, the right > solution is to obviate the problem altogether. > > Thanks, >The Other Julia Julia, Thanks for your patch, it seems good indeed. Here is my: Acked-by: Nicolas Ferre As the patch by Julia L. is already in net-next, I suspect that you would need to add a kind of revert patch if we want to come back to a more usual GFP_KERNEL for the kmalloc. Best regards, Nicolas > drivers/net/ethernet/cadence/macb_main.c | 20 ++-- > 1 file changed, 14 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/ethernet/cadence/macb_main.c > b/drivers/net/ethernet/cadence/macb_main.c > index c5fa87cdc6c4..e7ef104a077d 100644 > --- a/drivers/net/ethernet/cadence/macb_main.c > +++ b/drivers/net/ethernet/cadence/macb_main.c > @@ -2796,6 +2796,7 @@ static int gem_add_flow_filter(struct net_device > *netdev, > struct macb *bp = netdev_priv(netdev); > struct ethtool_rx_flow_spec *fs = &cmd->fs; > struct ethtool_rx_fs_item *item, *newfs; > + unsigned long flags; > int ret = -EINVAL; > bool added = false; > > @@ -2811,6 +2812,8 @@ static int gem_add_flow_filter(struct net_device > *netdev, > htonl(fs->h_u.tcp_ip4_spec.ip4dst), > htons(fs->h_u.tcp_ip4_spec.psrc), > htons(fs->h_u.tcp_ip4_spec.pdst)); > > + spin_lock_irqsave(&bp->rx_fs_lock, flags); > + > /* find correct place to add in list */ > if (list_empty(&bp->rx_fs_list.list)) > list_add(&newfs->list, &bp->rx_fs_list.list); > @@ -2837,9 +2840,11 @@ static int gem_add_flow_filter(struct net_device > *netdev, > if (netdev->features & NETIF_F_NTUPLE) > gem_enable_flow_filters(bp, 1); > > + spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > return 0; > > err: > + spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > kfree(newfs); > return ret; > } > @@ -2850,9 +2855,14 @@ static int gem_del_flow_filter(struct net_device > *netdev, > struct macb *bp = netdev_priv(netdev); > struct ethtool_rx_fs_item *item; > struct ethtool_rx_flow_spec *fs; > + unsigned long flags; > > - if (list_empty(&bp->rx_fs_list.list)) > + spin_lock_irqsave(&bp->rx_fs_lock, flags); > + > + if (list_empty(&bp->rx_fs_list.list)) { > + spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > return -EINVAL; > + } > > list_for_each_entry(item, &bp->rx_fs_list.list, list) { > if (item->fs.location == cmd->fs.location) { > @@ -2869,12 +2879,14 @@ static int gem_del_flow_filter(struct net_device > *netdev, > gem_writel_n(bp, SCRT2, fs->location, 0); > > list_del(&item->list); > - kfree(item); > bp->rx_fs_list.count--; > + spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > + kfree(item); > return 0; > } > } > > + spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > return -EINVAL; > } > > @@ -2943,11 +2955,8 @@ static int gem_get_rxnfc(struct net_device *netdev, > struct ethtool_rxnfc *cmd, > static int gem_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc > *cmd) > { > struct macb *bp = netdev_priv(netdev); > - unsigned long flags; > int ret; > > - spin_lock_irqsave(&bp->rx_fs_lock, flags); > - > switch (cmd->cmd) { > case ETHTOOL_SRXCLSRLINS: > if ((cmd->fs.location >= bp->max_tuples) > @@ -2966,7 +2975,6 @@ static int gem_set_rxnfc(struct net_device *netdev, > struct ethtool_rxnfc *cmd) > ret = -EOPNOTSUPP; > } > > - spin_unlock_irqrestore(&bp->rx_fs_lock, flags); > return ret; > } > > -- Nicolas Ferre
Re: Applied "ASoC: atmel-classd: select correct Kconfig symbol" to the asoc tree
On 05/12/2017 at 13:48, Mark Brown wrote: > The patch > >ASoC: atmel-classd: select correct Kconfig symbol > > has been applied to the asoc tree at > >https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git Mark, Actually the discussion is still ongoing regarding these issues and this fix isn't the proper one (aka NACK). Is an incremental patch has to be prepared or do you remove this patch? Thanks, regards, Nicolas > 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 > >>From 7e3dba272e5ef5b38fba8710f98b4b3da7232ea5 Mon Sep 17 00:00:00 2001 > From: Arnd Bergmann > Date: Tue, 5 Dec 2017 11:09:38 +0100 > Subject: [PATCH] ASoC: atmel-classd: select correct Kconfig symbol > > Commit 061981ff8cc8 ("ASoC: atmel: properly select dma driver state") > changed the way that the dependencies are handled, but then the > Class D amplifier support got merged, which used the old method. > > This seems to have triggered a very rare randconfig condition for me > now, leading to a link error: > > sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_set_audio': > atmel_ssc_dai.c:(.text+0x79c): undefined reference to > `atmel_pcm_dma_platform_register' > atmel_ssc_dai.c:(.text+0x79c): relocation truncated to fit: R_AARCH64_CALL26 > against undefined symbol `atmel_pcm_dma_platform_register' > sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_put_audio': > atmel_ssc_dai.c:(.text+0xf24): undefined reference to > `atmel_pcm_dma_platform_unregister' > atmel_ssc_dai.c:(.text+0xf24): relocation truncated to fit: R_AARCH64_CALL26 > against undefined symbol `atmel_pcm_dma_platform_unregister' > > Changing it to select SND_ATMEL_SOC_SSC_DMA as intended rather than > SND_ATMEL_SOC_DMA directly makes it work again. > > Fixes: e0a25b6d1862 ("ASoC: atmel-classd: add the Audio Class D Amplifier") > Signed-off-by: Arnd Bergmann > Acked-by: Alexandre Belloni > Signed-off-by: Mark Brown > --- > sound/soc/atmel/Kconfig | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig > index 4a56f3dfba51..2d998e5c4fb5 100644 > --- a/sound/soc/atmel/Kconfig > +++ b/sound/soc/atmel/Kconfig > @@ -64,7 +64,7 @@ config SND_AT91_SOC_SAM9X5_WM8731 > config SND_ATMEL_SOC_CLASSD > tristate "Atmel ASoC driver for boards using CLASSD" > depends on ARCH_AT91 || COMPILE_TEST > - select SND_ATMEL_SOC_DMA > + select SND_ATMEL_SOC_SSC_DMA > select REGMAP_MMIO > help > Say Y if you want to add support for Atmel ASoC driver for boards > using > -- Nicolas Ferre
Re: [PATCH] ASoC: atmel-classd: select correct Kconfig symbol
On 05/12/2017 at 12:13, Arnd Bergmann wrote: > On Tue, Dec 5, 2017 at 11:57 AM, Alexandre Belloni > wrote: >> On 05/12/2017 at 11:09:38 +0100, Arnd Bergmann wrote: >>> Commit 061981ff8cc8 ("ASoC: atmel: properly select dma driver state") >>> changed the way that the dependencies are handled, but then the >>> Class D amplifier support got merged, which used the old method. >>> >>> This seems to have triggered a very rare randconfig condition for me >>> now, leading to a link error: >>> >>> sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_set_audio': >>> atmel_ssc_dai.c:(.text+0x79c): undefined reference to >>> `atmel_pcm_dma_platform_register' >>> atmel_ssc_dai.c:(.text+0x79c): relocation truncated to fit: >>> R_AARCH64_CALL26 against undefined symbol `atmel_pcm_dma_platform_register' >>> sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_put_audio': >>> atmel_ssc_dai.c:(.text+0xf24): undefined reference to >>> `atmel_pcm_dma_platform_unregister' >>> atmel_ssc_dai.c:(.text+0xf24): relocation truncated to fit: >>> R_AARCH64_CALL26 against undefined symbol >>> `atmel_pcm_dma_platform_unregister' >>> >>> Changing it to select SND_ATMEL_SOC_SSC_DMA as intended rather than >>> SND_ATMEL_SOC_DMA directly makes it work again. >>> >>> Fixes: e0a25b6d1862 ("ASoC: atmel-classd: add the Audio Class D Amplifier") >>> Signed-off-by: Arnd Bergmann >> Acked-by: Alexandre Belloni > > Unfortunately, my testing just found a new problem with this patch > applied, I had > not run enough randconfig tests on top of it: > > sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_set_audio': > atmel_ssc_dai.c:(.text+0x73c): undefined reference to `ssc_request' > sound/soc/atmel/atmel_ssc_dai.o: In function `atmel_ssc_put_audio': > atmel_ssc_dai.c:(.text+0x7be): undefined reference to `ssc_free' > > This is for a configuration with SND_ATMEL_SOC_CLASSD=y > and CONFIG_ATMEL_SSC=n. Could you tell me whether that is a > sensible configuration that should work, or whether we need a dependency > on ATMEL_SSC in SND_ATMEL_SOC_CLASSD? I can't really tell > from the source code, but you probably know the answer. Actually, they are two different interfaces which can be enabled at the same time or not and CLASSD doesn't use the SSC. So no dependency between them. It might be an issue with SND_ATMEL_SOC_DMA not selecting the proper code... Regards, -- Nicolas Ferre
Re: [PATCH] pcmcia: at91_cf: Use PTR_ERR_OR_ZERO()
On 28/11/2017 at 16:21, Vasyl Gomonovych wrote: > Fix ptr_ret.cocci warnings: > drivers/pcmcia/at91_cf.c:239:1-3: WARNING: PTR_ERR_OR_ZERO can be used > > Use PTR_ERR_OR_ZERO rather than if(IS_ERR(...)) + PTR_ERR > > Generated by: scripts/coccinelle/api/ptr_ret.cocci > > Signed-off-by: Vasyl Gomonovych okay... Acked-by: Nicolas Ferre > --- > drivers/pcmcia/at91_cf.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/pcmcia/at91_cf.c b/drivers/pcmcia/at91_cf.c > index 87147bcd1655..7da7b0f0ae1b 100644 > --- a/drivers/pcmcia/at91_cf.c > +++ b/drivers/pcmcia/at91_cf.c > @@ -236,10 +236,8 @@ static int at91_cf_dt_init(struct platform_device *pdev) > pdev->dev.platform_data = board; > > mc = syscon_regmap_lookup_by_compatible("atmel,at91rm9200-sdramc"); > - if (IS_ERR(mc)) > - return PTR_ERR(mc); > > - return 0; > + return PTR_ERR_OR_ZERO(mc); > } > #else > static int at91_cf_dt_init(struct platform_device *pdev) > -- Nicolas Ferre
Re: [PATCH 2/2 v3] misc: atmel-ssc: Fix platform_get_irq's error checking
On 19/11/2017 at 05:34, Arvind Yadav wrote: > The platform_get_irq() function returns negative if an error occurs. > zero or positive number on success. platform_get_irq() error checking > for zero is not correct. > > Signed-off-by: Arvind Yadav > --- > changes in v2 : > Add failure case '<= 0' instead of '< 0'. IRQ 0 is not valid. > changes in v3: > Return -ENODEV instead of ssc->irq. Okay, I didn't see this v3 before commenting on v2... > > drivers/misc/atmel-ssc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c > index b2a0340..2ec0f9e 100644 > --- a/drivers/misc/atmel-ssc.c > +++ b/drivers/misc/atmel-ssc.c > @@ -235,7 +235,7 @@ static int ssc_probe(struct platform_device *pdev) > clk_disable_unprepare(ssc->clk); > > ssc->irq = platform_get_irq(pdev, 0); > - if (!ssc->irq) { > + if (ssc->irq <= 0) { > dev_dbg(&pdev->dev, "could not get irq\n"); > return -ENXIO; > } > -- Nicolas Ferre
Re: [PATCH 2/2 v2] misc: atmel-ssc: Fix platform_get_irq's error checking
On 18/11/2017 at 10:10, Arvind Yadav wrote: > The platform_get_irq() function returns negative if an error occurs. > zero or positive number on success. platform_get_irq() error checking > for zero is not correct. > > Signed-off-by: Arvind Yadav > --- > changes in v2 : > Add failure case '<= 0' instead of '< 0'. IRQ 0 is not valid. > > drivers/misc/atmel-ssc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c > index b2a0340..9d9eeae 100644 > --- a/drivers/misc/atmel-ssc.c > +++ b/drivers/misc/atmel-ssc.c > @@ -235,9 +235,9 @@ static int ssc_probe(struct platform_device *pdev) > clk_disable_unprepare(ssc->clk); > > ssc->irq = platform_get_irq(pdev, 0); > - if (!ssc->irq) { > + if (ssc->irq <= 0) { > dev_dbg(&pdev->dev, "could not get irq\n"); > - return -ENXIO; > + return ssc->irq; if ssc->irq = 0, I believe that returning 0 is not the right thing to do. Regards, > } > > spin_lock(&user_lock); > -- Nicolas Ferre
Re: [PATCH 2/2] rtc: at91rm9200: fix reading alarm value
On 10/11/2017 at 09:59, Alexandre Belloni wrote: > When alarm value is read at boot time, at91_alarm_year is not yet set to > the proper value so the year is always set to 1900. > > This results in that kind of message at boot: > rtc rtc0: invalid alarm value: 1900-1-14 2:11:39 > > There is no way to recover from that as the alarm is now only read when > booting. > > Instead, rely on the rtc core to figure out the proper year. > > Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre > --- > drivers/rtc/rtc-at91rm9200.c | 18 ++ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c > index e84f5ec4faf6..de81ecedd571 100644 > --- a/drivers/rtc/rtc-at91rm9200.c > +++ b/drivers/rtc/rtc-at91rm9200.c > @@ -42,8 +42,6 @@ > #define at91_rtc_write(field, val) \ > writel_relaxed((val), at91_rtc_regs + field) > > -#define AT91_RTC_EPOCH 1900UL /* just like > arch/arm/common/rtctime.c */ > - > struct at91_rtc_config { > bool use_shadow_imr; > }; > @@ -51,7 +49,6 @@ struct at91_rtc_config { > static const struct at91_rtc_config *at91_rtc_config; > static DECLARE_COMPLETION(at91_rtc_updated); > static DECLARE_COMPLETION(at91_rtc_upd_rdy); > -static unsigned int at91_alarm_year = AT91_RTC_EPOCH; > static void __iomem *at91_rtc_regs; > static int irq; > static DEFINE_SPINLOCK(at91_rtc_lock); > @@ -131,8 +128,7 @@ static void at91_rtc_decodetime(unsigned int timereg, > unsigned int calreg, > > /* >* The Calendar Alarm register does not have a field for > - * the year - so these will return an invalid value. When an > - * alarm is set, at91_alarm_year will store the current year. > + * the year - so these will return an invalid value. >*/ > tm->tm_year = bcd2bin(date & AT91_RTC_CENT) * 100; /* century */ > tm->tm_year += bcd2bin((date & AT91_RTC_YEAR) >> 8);/* year */ > @@ -208,14 +204,14 @@ static int at91_rtc_readalarm(struct device *dev, > struct rtc_wkalrm *alrm) > struct rtc_time *tm = &alrm->time; > > at91_rtc_decodetime(AT91_RTC_TIMALR, AT91_RTC_CALALR, tm); > - tm->tm_year = at91_alarm_year - 1900; > + tm->tm_year = -1; > > alrm->enabled = (at91_rtc_read_imr() & AT91_RTC_ALARM) > ? 1 : 0; > > - dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, > - 1900 + tm->tm_year, tm->tm_mon, tm->tm_mday, > - tm->tm_hour, tm->tm_min, tm->tm_sec); > + dev_dbg(dev, "%s(): %02d-%02d %02d:%02d:%02d %sabled\n", __func__, > + tm->tm_mon, tm->tm_mday, tm->tm_hour, tm->tm_min, tm->tm_sec, > + alrm->enabled ? "en" : "dis"); > > return 0; > } > @@ -229,8 +225,6 @@ static int at91_rtc_setalarm(struct device *dev, struct > rtc_wkalrm *alrm) > > at91_rtc_decodetime(AT91_RTC_TIMR, AT91_RTC_CALR, &tm); > > - at91_alarm_year = tm.tm_year; > - > tm.tm_mon = alrm->time.tm_mon; > tm.tm_mday = alrm->time.tm_mday; > tm.tm_hour = alrm->time.tm_hour; > @@ -254,7 +248,7 @@ static int at91_rtc_setalarm(struct device *dev, struct > rtc_wkalrm *alrm) > } > > dev_dbg(dev, "%s(): %4d-%02d-%02d %02d:%02d:%02d\n", __func__, > - at91_alarm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, > + tm.tm_year, tm.tm_mon, tm.tm_mday, tm.tm_hour, > tm.tm_min, tm.tm_sec); > > return 0; > -- Nicolas Ferre
Re: [PATCH 1/2] rtc: at91rm9200: stop calculating yday in at91_rtc_readalarm
On 10/11/2017 at 09:59, Alexandre Belloni wrote: > Calculating yday in the read_alarm callback is useless as this value is > never used later. Also, it was buggy anyway because at the time this is > done, tm_year is always 0 as the alarm register doesn't hold the year. > > Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre > --- > drivers/rtc/rtc-at91rm9200.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/rtc/rtc-at91rm9200.c b/drivers/rtc/rtc-at91rm9200.c > index e221b78b6f10..e84f5ec4faf6 100644 > --- a/drivers/rtc/rtc-at91rm9200.c > +++ b/drivers/rtc/rtc-at91rm9200.c > @@ -208,7 +208,6 @@ static int at91_rtc_readalarm(struct device *dev, struct > rtc_wkalrm *alrm) > struct rtc_time *tm = &alrm->time; > > at91_rtc_decodetime(AT91_RTC_TIMALR, AT91_RTC_CALALR, tm); > - tm->tm_yday = rtc_year_days(tm->tm_mday, tm->tm_mon, tm->tm_year); > tm->tm_year = at91_alarm_year - 1900; > > alrm->enabled = (at91_rtc_read_imr() & AT91_RTC_ALARM) > -- Nicolas Ferre
Re: video: atmel_lcdfb: Use common error handling code in atmel_lcdfb_of_init()
On 06/11/2017 at 10:32, SF Markus Elfring wrote: >> Sorry but NACK: the message was malformed and resulted in the >> duplication of the error log that you spotted. >> >> The proper way to fix this is to modify the second occurrence of this >> message. > > * Would you like to achieve that a corresponding message will mention > anything around a property “atmel,dmacon” (instead of “bits-per-pixel”)? Yes: that would actually fix the wrong log message. > * Can it make sense to adjust the used message format then? In another patch, why not... Beware about the added complexity though. Regards, -- Nicolas Ferre
Re: [PATCH] video: atmel_lcdfb: Use common error handling code in atmel_lcdfb_of_init()
On 05/11/2017 at 14:10, SF Markus Elfring wrote: > From: Markus Elfring > Date: Sun, 5 Nov 2017 14:00:52 +0100 > > Add a jump target so that a specific error message is stored only once > at the end of this function implementation. > Replace two calls of the function "dev_err" by goto statements. > > This issue was detected by using the Coccinelle software. > > Signed-off-by: Markus Elfring Sorry but NACK: the message was malformed and resulted in the duplication of the error log that you spotted. The proper way to fix this is to modify the second occurrence of this message. If you want to lower the size of strings in this driver, you can do it, but not like this. Regards, Nicolas > --- > drivers/video/fbdev/atmel_lcdfb.c | 16 > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/drivers/video/fbdev/atmel_lcdfb.c > b/drivers/video/fbdev/atmel_lcdfb.c > index e06358da4b99..3672c2e52ebd 100644 > --- a/drivers/video/fbdev/atmel_lcdfb.c > +++ b/drivers/video/fbdev/atmel_lcdfb.c > @@ -1047,10 +1047,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info > *sinfo) > } > > ret = of_property_read_u32(display_np, "bits-per-pixel", > &var->bits_per_pixel); > - if (ret < 0) { > - dev_err(dev, "failed to get property bits-per-pixel\n"); > - goto put_display_node; > - } > + if (ret < 0) > + goto report_bits_failure; > > ret = of_property_read_u32(display_np, "atmel,guard-time", > &pdata->guard_time); > if (ret < 0) { > @@ -1065,10 +1063,8 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info > *sinfo) > } > > ret = of_property_read_u32(display_np, "atmel,dmacon", > &pdata->default_dmacon); > - if (ret < 0) { > - dev_err(dev, "failed to get property bits-per-pixel\n"); > - goto put_display_node; > - } > + if (ret < 0) > + goto report_bits_failure; > > INIT_LIST_HEAD(&pdata->pwr_gpios); > ret = -ENOMEM; > @@ -1147,6 +1143,10 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info > *sinfo) > put_display_node: > of_node_put(display_np); > return ret; > + > +report_bits_failure: > + dev_err(dev, "failed to get property bits-per-pixel\n"); > + goto put_display_node; > } > #else > static int atmel_lcdfb_of_init(struct atmel_lcdfb_info *sinfo) > -- Nicolas Ferre
Re: [PATCH v5] atmel_flexcom: Support backup mode
On 23/10/2017 at 19:03, Romain Izard wrote: > 2017-10-23 18:07 GMT+02:00 Lee Jones : >> On Mon, 23 Oct 2017, Lee Jones wrote: >>> On Thu, 19 Oct 2017, Romain Izard wrote: >>> >>>> The controller used by a flexcom module is configured at boot, and left >>>> alone after this. As the configuration will be lost after backup mode, >>>> restore the state of the flexcom driver on resume. >>>> >>>> Signed-off-by: Romain Izard >>>> Acked-by: Nicolas Ferre >>>> Tested-by: Nicolas Ferre >>>> --- >>>> Changes in v5: >>>> * extract from the patch series, and send as a standalone patch >>>> >>>> drivers/mfd/atmel-flexcom.c | 65 >>>> ++--- >>>> 1 file changed, 50 insertions(+), 15 deletions(-) >>>> >>>> diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c >>>> index 064bde9cff5a..ef1235c4a179 100644 >>>> --- a/drivers/mfd/atmel-flexcom.c >>>> +++ b/drivers/mfd/atmel-flexcom.c >>>> @@ -39,34 +39,44 @@ >>>> #define FLEX_MR_OPMODE(opmode) (((opmode) << FLEX_MR_OPMODE_OFFSET) & >>>> \ >>>> FLEX_MR_OPMODE_MASK) >>>> >>>> +struct atmel_flexcom { >>>> + void __iomem *base; >>>> + u32 opmode; >>>> + struct clk *clk; >>>> +}; >>>> >>>> static int atmel_flexcom_probe(struct platform_device *pdev) >>>> { >>>> struct device_node *np = pdev->dev.of_node; >>>> - struct clk *clk; >>>> struct resource *res; >>>> - void __iomem *base; >>>> - u32 opmode; >>>> + struct atmel_flexcom *afc; >>> >>> Nit: I'd prefer if you call this 'ddata'. >>> >>> But the concept and implementation is fine, so if you're going to >>> change it please do so and apply my: >>> >>> Acked-by: Lee Jones >> >> Also, 'back-up mode' isn't really a thing is it? >> >> How about "Reinstall state on resume" or similar? >> > > The expression comes from the SAMA5D2's datasheet. > > Other Atmel chips use a different single suspend mode with Linux, where > the SoC remains completely powered with a slow clock. The registers are > preserved in this mode, so there is no need for a specific suspend and > resume code. > > The SoC can also be powered down, but the CPU is reset and only a small > part is powered with a backup battery to maintain a valid RTC and a > small internal SRAM. > > In the SAMA5D2, the mode with only the backup power supply has been > extended to isolate the memory I/O lines, making it possible to keep the > external SDRAM memory in self-refresh. This mode has a lower consumption > compared to the slow clock mode, but it has a higher wakeup latency, and > needs specific software support in the bootloader and the kernel. > > As a result, the "backup mode" expression is used to contrast with the > "slow clock" expression when describing the different suspend modes > supported by the chip. aka: Ultra Low Power modes (ULP0 and ULP1). > But if you think that it is necessary, I can reword the commit. Thanks for the whole explanation Romain. Yes we have such a wording in our documents and we used some kind of "Backup mode", "Backup+Self-Refresh (B+SR or B+S-R)", "Backup and DDR in Self-refresh" or "suspend-to-mem" wording for our patches. I take advantage of this discussion to list all them here, for the record ;-) So, I have the feeling that together with the commit message itself, we can go with this wording. Best regards, -- Nicolas Ferre
[GIT PULL] at91: fixes for 4.14 #2
Arnd, Olof, A second batch of fixes for AT91, all about DT modifications. We discovered the Ethernet phy issue lately and the ADC fixes are patches that we forgot while converting sama5d2 ADC to use hardware triggers. The 2 ADC patches are needed so that the driver can probe corectly again: https://storage.kernelci.org/mainline/master/v4.14-rc2-255-g74d83ec2b734/arm/sama5_defconfig/lab-free-electrons/boot-at91-sama5d2_xplained.txt It will certainly be the last "fixes" PR for this cycle. Thanks, best regards, The following changes since commit 093d79f62a89f47d9b5fd0746768146d9696535c: ARM: at91: Replace uses of virt_to_phys with __pa_symbol (2017-09-18 10:05:38 +0200) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git tags/at91-fixes2 for you to fetch changes up to 27d90f46f253ccc7c5447f6fa62505acb1c246fe: ARM: dts: at91: sama5d2: add ADC hw trigger edge type (2017-10-09 15:34:22 +0200) Fixes: second batch for 4.14: - one DT phy address fix for the new sama5d27 som1 ek - two DT ADC patches that were forgotten while moving to hardware triggers for sama5d2 (iio changes already applied) Eugen Hristev (2): ARM: dts: at91: sama5d2_xplained: enable ADTRG pin ARM: dts: at91: sama5d2: add ADC hw trigger edge type Ludovic Desroches (1): ARM: dts: at91: at91-sama5d27_som1: fix PHY ID arch/arm/boot/dts/at91-sama5d27_som1.dtsi | 4 ++-- arch/arm/boot/dts/at91-sama5d2_xplained.dts | 16 +++- arch/arm/boot/dts/sama5d2.dtsi | 1 + 3 files changed, 18 insertions(+), 3 deletions(-) -- Nicolas Ferre
Re: [PATCH] mtd: nand: atmel: fix buffer overflow in atmel_pmecc_user
On 27/09/2017 at 14:49, Richard Genoud wrote: > When calculating the size needed by struct atmel_pmecc_user *user, > the dmu and delta buffer sizes were forgotten. > This lead to a memory corruption (especially with a large ecc_strength). > > Link: http://lkml.kernel.org/r/1506503157.3016.5.ca...@gmail.com > Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver") > Cc: Nicolas Ferre Yes: Reviewed-by: Nicolas Ferre Thanks Richard and Boris for this quick fix! Regards, Nicolas > Cc: sta...@vger.kernel.org > Reported-by: Richard Genoud > Pointed-at-by: Boris Brezillon > Signed-off-by: Richard Genoud > --- > drivers/mtd/nand/atmel/pmecc.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c > index 146af8218314..8268636675ef 100644 > --- a/drivers/mtd/nand/atmel/pmecc.c > +++ b/drivers/mtd/nand/atmel/pmecc.c > @@ -363,7 +363,7 @@ atmel_pmecc_create_user(struct atmel_pmecc *pmecc, > size += (req->ecc.strength + 1) * sizeof(u16); > /* Reserve space for mu, dmu and delta. */ > size = ALIGN(size, sizeof(s32)); > - size += (req->ecc.strength + 1) * sizeof(s32); > + size += (req->ecc.strength + 1) * sizeof(s32) * 3; > > user = kzalloc(size, GFP_KERNEL); > if (!user) > -- Nicolas Ferre
Re: [PATCH v2 7/9] pwm: atmel-tcb: Support backup mode
On 15/09/2017 at 16:04, Romain Izard wrote: > Save and restore registers for the PWM on suspend and resume, which > makes hibernation and backup modes possible. > > Signed-off-by: Romain Izard Seems good to me: Acked-by: Nicolas Ferre > --- > drivers/pwm/pwm-atmel-tcb.c | 63 > +++-- > 1 file changed, 61 insertions(+), 2 deletions(-) > > diff --git a/drivers/pwm/pwm-atmel-tcb.c b/drivers/pwm/pwm-atmel-tcb.c > index 75db585a2a94..acd3ce8ecf3f 100644 > --- a/drivers/pwm/pwm-atmel-tcb.c > +++ b/drivers/pwm/pwm-atmel-tcb.c > @@ -37,11 +37,20 @@ struct atmel_tcb_pwm_device { > unsigned period;/* PWM period expressed in clk cycles */ > }; > > +struct atmel_tcb_channel { > + u32 enabled; > + u32 cmr; > + u32 ra; > + u32 rb; > + u32 rc; > +}; > + > struct atmel_tcb_pwm_chip { > struct pwm_chip chip; > spinlock_t lock; > struct atmel_tc *tc; > struct atmel_tcb_pwm_device *pwms[NPWM]; > + struct atmel_tcb_channel bkup[NPWM / 2]; > }; > > static inline struct atmel_tcb_pwm_chip *to_tcb_chip(struct pwm_chip *chip) > @@ -175,12 +184,15 @@ static void atmel_tcb_pwm_disable(struct pwm_chip > *chip, struct pwm_device *pwm) >* Use software trigger to apply the new setting. >* If both PWM devices in this group are disabled we stop the clock. >*/ > - if (!(cmr & (ATMEL_TC_ACPC | ATMEL_TC_BCPC))) > + if (!(cmr & (ATMEL_TC_ACPC | ATMEL_TC_BCPC))) { > __raw_writel(ATMEL_TC_SWTRG | ATMEL_TC_CLKDIS, >regs + ATMEL_TC_REG(group, CCR)); > - else > + tcbpwmc->bkup[group].enabled = 1; > + } else { > __raw_writel(ATMEL_TC_SWTRG, regs + >ATMEL_TC_REG(group, CCR)); > + tcbpwmc->bkup[group].enabled = 0; > + } > > spin_unlock(&tcbpwmc->lock); > } > @@ -263,6 +275,7 @@ static int atmel_tcb_pwm_enable(struct pwm_chip *chip, > struct pwm_device *pwm) > /* Use software trigger to apply the new setting */ > __raw_writel(ATMEL_TC_CLKEN | ATMEL_TC_SWTRG, >regs + ATMEL_TC_REG(group, CCR)); > + tcbpwmc->bkup[group].enabled = 1; > spin_unlock(&tcbpwmc->lock); > return 0; > } > @@ -445,10 +458,56 @@ static const struct of_device_id atmel_tcb_pwm_dt_ids[] > = { > }; > MODULE_DEVICE_TABLE(of, atmel_tcb_pwm_dt_ids); > > +#ifdef CONFIG_PM_SLEEP > +static int atmel_tcb_pwm_suspend(struct device *dev) > +{ > + struct platform_device *pdev = to_platform_device(dev); > + struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); > + void __iomem *base = tcbpwm->tc->regs; > + int i; > + > + for (i = 0; i < (NPWM / 2); i++) { > + struct atmel_tcb_channel *chan = &tcbpwm->bkup[i]; > + > + chan->cmr = readl(base + ATMEL_TC_REG(i, CMR)); > + chan->ra = readl(base + ATMEL_TC_REG(i, RA)); > + chan->rb = readl(base + ATMEL_TC_REG(i, RB)); > + chan->rc = readl(base + ATMEL_TC_REG(i, RC)); > + } > + return 0; > +} > + > +static int atmel_tcb_pwm_resume(struct device *dev) > +{ > + struct platform_device *pdev = to_platform_device(dev); > + struct atmel_tcb_pwm_chip *tcbpwm = platform_get_drvdata(pdev); > + void __iomem *base = tcbpwm->tc->regs; > + int i; > + > + for (i = 0; i < (NPWM / 2); i++) { > + struct atmel_tcb_channel *chan = &tcbpwm->bkup[i]; > + > + writel(chan->cmr, base + ATMEL_TC_REG(i, CMR)); > + writel(chan->ra, base + ATMEL_TC_REG(i, RA)); > + writel(chan->rb, base + ATMEL_TC_REG(i, RB)); > + writel(chan->rc, base + ATMEL_TC_REG(i, RC)); > + if (chan->enabled) { > + writel(ATMEL_TC_CLKEN | ATMEL_TC_SWTRG, > + base + ATMEL_TC_REG(i, CCR)); > + } > + } > + return 0; > +} > +#endif > + > +static SIMPLE_DEV_PM_OPS(atmel_tcb_pwm_pm_ops, atmel_tcb_pwm_suspend, > + atmel_tcb_pwm_resume); > + > static struct platform_driver atmel_tcb_pwm_driver = { > .driver = { > .name = "atmel-tcb-pwm", > .of_match_table = atmel_tcb_pwm_dt_ids, > + .pm = &atmel_tcb_pwm_pm_ops, > }, > .probe = atmel_tcb_pwm_probe, > .remove = atmel_tcb_pwm_remove, > -- Nicolas Ferre
Re: [PATCH v2 6/9] ehci-atmel: Power down during suspend is normal
On 15/09/2017 at 16:04, Romain Izard wrote: > When an Atmel SoC is suspended with the backup mode, the USB bus will be > powered down. As this is expected, do not return an error to the driver > core when ehci_resume detects it. > > Signed-off-by: Romain Izard > --- > drivers/usb/host/ehci-atmel.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/usb/host/ehci-atmel.c b/drivers/usb/host/ehci-atmel.c > index 7440722bfbf0..2a8b9bdc0e57 100644 > --- a/drivers/usb/host/ehci-atmel.c > +++ b/drivers/usb/host/ehci-atmel.c > @@ -205,7 +205,8 @@ static int __maybe_unused ehci_atmel_drv_resume(struct > device *dev) > struct atmel_ehci_priv *atmel_ehci = hcd_to_atmel_ehci_priv(hcd); > > atmel_start_clock(atmel_ehci); > - return ehci_resume(hcd, false); > + ehci_resume(hcd, false); > + return 0; Ok, I agree with that as the underlying function takes care about the controller, in any case (even for !B+S-R case). So we don't have any added value to propagate this information. Acked-by: Nicolas Ferre > } > > #ifdef CONFIG_OF > -- Nicolas Ferre
Re: [PATCH v2 1/9] clk: at91: pmc: Wait for clocks when resuming
On 15/09/2017 at 16:04, Romain Izard wrote: > Wait for the syncronization of all clocks when resuming, not only the > UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() > when interrupts are masked, which is the case in here. > > Signed-off-by: Romain Izard And here is my: Acked-by: Nicolas Ferre > --- > drivers/clk/at91/pmc.c | 24 > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index 775af473fe11..5c2b26de303e 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -107,10 +107,20 @@ static int pmc_suspend(void) > return 0; > } > > +static bool pmc_ready(unsigned int mask) > +{ > + unsigned int status; > + > + regmap_read(pmcreg, AT91_PMC_SR, &status); > + > + return ((status & mask) == mask) ? 1 : 0; > +} > + > static void pmc_resume(void) > { > - int i, ret = 0; > + int i; > u32 tmp; > + u32 mask = AT91_PMC_MCKRDY | AT91_PMC_LOCKA; > > regmap_read(pmcreg, AT91_PMC_MCKR, &tmp); > if (pmc_cache.mckr != tmp) > @@ -134,13 +144,11 @@ static void pmc_resume(void) >AT91_PMC_PCR_CMD); > } > > - if (pmc_cache.uckr & AT91_PMC_UPLLEN) { > - ret = regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp, > -!(tmp & AT91_PMC_LOCKU), > -10, 5000); > - if (ret) > - pr_crit("USB PLL didn't lock when resuming\n"); > - } > + if (pmc_cache.uckr & AT91_PMC_UPLLEN) > + mask |= AT91_PMC_LOCKU; > + > + while (!pmc_ready(mask)) > + cpu_relax(); > } > > static struct syscore_ops pmc_syscore_ops = { > -- Nicolas Ferre
Re: [PATCH v1 01/10] clk: at91: pmc: Wait for clocks when resuming
On 14/09/2017 at 18:15, Romain Izard wrote: > 2017-09-13 14:15 GMT+02:00 Nicolas Ferre : >> On 08/09/2017 at 17:35, Romain Izard wrote: >>> Wait for the syncronization of all clocks when resuming, not only the >>> UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() >>> when interrupts are masked, which is the case in here. >>> >>> Signed-off-by: Romain Izard >>> --- >>> drivers/clk/at91/pmc.c | 24 >>> 1 file changed, 16 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c >>> index 775af473fe11..5c2b26de303e 100644 >>> --- a/drivers/clk/at91/pmc.c >>> +++ b/drivers/clk/at91/pmc.c >>> @@ -107,10 +107,20 @@ static int pmc_suspend(void) >>> return 0; >>> } >>> >>> +static bool pmc_ready(unsigned int mask) >>> +{ >>> + unsigned int status; >>> + >>> + regmap_read(pmcreg, AT91_PMC_SR, &status); >>> + >>> + return ((status & mask) == mask) ? 1 : 0; >>> +} >>> + >>> static void pmc_resume(void) >>> { >>> - int i, ret = 0; >>> + int i; >>> u32 tmp; >>> + u32 mask = AT91_PMC_MCKRDY | AT91_PMC_LOCKA; >>> >>> regmap_read(pmcreg, AT91_PMC_MCKR, &tmp); >>> if (pmc_cache.mckr != tmp) >>> @@ -134,13 +144,11 @@ static void pmc_resume(void) >>>AT91_PMC_PCR_CMD); >>> } >>> >>> - if (pmc_cache.uckr & AT91_PMC_UPLLEN) { >>> - ret = regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp, >>> -!(tmp & AT91_PMC_LOCKU), >>> -10, 5000); >>> - if (ret) >>> - pr_crit("USB PLL didn't lock when resuming\n"); >>> - } >>> + if (pmc_cache.uckr & AT91_PMC_UPLLEN) >>> + mask |= AT91_PMC_LOCKU; >>> + >>> + while (!pmc_ready(mask)) >>> + cpu_relax(); >> >> Okay, but I would prefer to keep the timeout property in it. So we may >> need to re-implement a timeout way-out here. >> > > We need to have a reference clock to measure the timeout delay. If we use > the kernel's timekeeping, it relies on the clocks that we are configuring in > this code. Moreover, my experience with the mainline code is that when > something goes wrong, nothing will work. No oops or panic will be reported, > the device will just stop working. > > In my case, I had obvious failures (it just stopped working unless I removed > USB wakeup or activated the console during suspend) but also very rare > failures, that occurred in the bootloader. Those issues were detected when > testing repeated suspend cycles for a night: the memory controller would > never enter the self-refresh mode during the resume sequence. > > This led me to question the bootloader's code first, and I set up 4 boards > with the backup prototype code on v4.9 to verify that it was stable on > suspend. I've reached 1.5 million sleep cycles over 3 weeks without > failure, so this hinted towards the difference between the prototype and the > backup code provided for v4.12 (which contained the patch that got in > v4.13). Once I integrated this patch, I've run the v4.12 code for 2 weeks > without issue as well. > > In the end, I don't want to touch this code if I do not have to, as checking > that it does not regress is really cumbersome. The timeout was more for PLL like the one use for USB. I didn't want to block only for USB PLL failure (which is kind of hypothetical, I admit). Anyway, I understand your arguments and taking into account the extensive tests that you've run, I agree with your approach. I'm adding my Ack to the v2. Thanks for having take the time to describe your debugging session: it's valuable information for everybody. Best regards, -- Nicolas Ferre
Re: [PATCH v2 3/9] clk: at91: pmc: Support backup for programmable clocks
On 15/09/2017 at 16:04, Romain Izard wrote: > From: Romain Izard > > When an AT91 programmable clock is declared in the device tree, register > it into the Power Management Controller driver. On entering suspend mode, > the driver saves and restores the Programmable Clock registers to support > the backup mode for these clocks. > > Signed-off-by: Romain Izard Romain, Some nitpicking and one comment. But on the overall patch, here is my: Acked-by: Nicolas Ferre See below: > --- > Changes in v2: > * register PCKs on clock startup > > drivers/clk/at91/clk-programmable.c | 2 ++ > drivers/clk/at91/pmc.c | 27 +++ > drivers/clk/at91/pmc.h | 2 ++ > 3 files changed, 31 insertions(+) > > diff --git a/drivers/clk/at91/clk-programmable.c > b/drivers/clk/at91/clk-programmable.c > index 85a449cf61e3..0e6aab1252fc 100644 > --- a/drivers/clk/at91/clk-programmable.c > +++ b/drivers/clk/at91/clk-programmable.c > @@ -204,6 +204,8 @@ at91_clk_register_programmable(struct regmap *regmap, > if (ret) { > kfree(prog); > hw = ERR_PTR(ret); Nit: "else" not needed. > + } else { > + pmc_register_pck(id); > } > > return hw; > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index 07dc2861ad3f..3910b7537152 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -22,6 +22,7 @@ > #include "pmc.h" > > #define PMC_MAX_IDS 128 > +#define PMC_MAX_PCKS 8 > > int of_at91_get_clk_range(struct device_node *np, const char *propname, > struct clk_range *range) > @@ -50,6 +51,7 @@ EXPORT_SYMBOL_GPL(of_at91_get_clk_range); > static struct regmap *pmcreg; > > static u8 registered_ids[PMC_MAX_IDS]; > +static u8 registered_pcks[PMC_MAX_PCKS]; > > static struct > { > @@ -66,8 +68,10 @@ static struct > u32 pcr[PMC_MAX_IDS]; > u32 audio_pll0; > u32 audio_pll1; > + u32 pckr[PMC_MAX_PCKS]; > } pmc_cache; > > +/* Clock ID 0 is invalid */ (read: so we can use the 0 value as an indicator that this place in the table hasn't been filled, so unused) > void pmc_register_id(u8 id) > { > int i; > @@ -82,6 +86,21 @@ void pmc_register_id(u8 id) > } > } > > +/* Programmable Clock 0 is valid */ I understand the rationale behind these ^^ two comments, but I would like that it's more explicit. Saying that you will store the pck id as (id + 1) and that you would have to invert this operation while using the stored id. Maybe add a comment about this transformation to the struct definition as well... > +void pmc_register_pck(u8 pck) > +{ > + int i; > + > + for (i = 0; i < PMC_MAX_PCKS; i++) { > + if (registered_pcks[i] == 0) { > + registered_pcks[i] = pck + 1; > + break; > + } > + if (registered_pcks[i] == (pck + 1)) > + break; > + } > +} > + > static int pmc_suspend(void) > { > int i; > @@ -103,6 +122,10 @@ static int pmc_suspend(void) > regmap_read(pmcreg, AT91_PMC_PCR, > &pmc_cache.pcr[registered_ids[i]]); > } > + for (i = 0; registered_pcks[i]; i++) { > + u8 num = registered_pcks[i] - 1; Nit: declaration are better made at the beginning of the function. This lead to a checkpatch warning: "WARNING: Missing a blank line after declarations" > + regmap_read(pmcreg, AT91_PMC_PCKR(num), &pmc_cache.pckr[num]); > + } > > return 0; > } > @@ -143,6 +166,10 @@ static void pmc_resume(void) >pmc_cache.pcr[registered_ids[i]] | >AT91_PMC_PCR_CMD); > } > + for (i = 0; registered_pcks[i]; i++) { > + u8 num = registered_pcks[i] - 1; Ditto > + regmap_write(pmcreg, AT91_PMC_PCKR(num), pmc_cache.pckr[num]); > + } > > if (pmc_cache.uckr & AT91_PMC_UPLLEN) > mask |= AT91_PMC_LOCKU; > diff --git a/drivers/clk/at91/pmc.h b/drivers/clk/at91/pmc.h > index 858e8ef7e8db..d22b1fa9ecdc 100644 > --- a/drivers/clk/at91/pmc.h > +++ b/drivers/clk/at91/pmc.h > @@ -31,8 +31,10 @@ int of_at91_get_clk_range(struct device_node *np, const > char *propname, > > #ifdef CONFIG_PM > void pmc_register_id(u8 id); > +void pmc_register_pck(u8 pck); > #else > static inline void pmc_register_id(u8 id) {} > +static inline void pmc_register_pck(u8 pck) {} > #endif > > #endif /* __PMC_H_ */ > -- Nicolas Ferre
Re: [PATCH v2 9/9] tty/serial: atmel: Prevent a warning on suspend
On 15/09/2017 at 16:04, Romain Izard wrote: > The atmel serial port driver reported the following warning on suspend: > atmel_usart f802.serial: ttyS1: Unable to drain transmitter > > As the ATMEL_US_TXEMPTY status bit in ATMEL_US_CSR is always cleared > when the transmitter is disabled, we need to know the transmitter's > state to return the real fifo state. And as ATMEL_US_CR is write-only, > it is necessary to save the state of the transmitter in a local > variable, and update the variable when TXEN and TXDIS is written in > ATMEL_US_CR. > > After those changes, atmel_tx_empty can return "empty" on suspend, the > warning in uart_suspend_port disappears, and suspending is 20ms shorter > for each enabled Atmel serial port. > > Signed-off-by: Romain Izard Tested-by: Nicolas Ferre on sama5d2 Xplained. Acked-by: Nicolas Ferre > --- > drivers/tty/serial/atmel_serial.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/tty/serial/atmel_serial.c > b/drivers/tty/serial/atmel_serial.c > index 7551cab438ff..783af6648be0 100644 > --- a/drivers/tty/serial/atmel_serial.c > +++ b/drivers/tty/serial/atmel_serial.c > @@ -171,6 +171,7 @@ struct atmel_uart_port { > boolhas_hw_timer; > struct timer_list uart_timer; > > + booltx_stopped; > boolsuspended; > unsigned intpending; > unsigned intpending_status; > @@ -380,6 +381,10 @@ static int atmel_config_rs485(struct uart_port *port, > */ > static u_int atmel_tx_empty(struct uart_port *port) > { > + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > + > + if (atmel_port->tx_stopped) > + return TIOCSER_TEMT; > return (atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXEMPTY) ? > TIOCSER_TEMT : > 0; > @@ -485,6 +490,7 @@ static void atmel_stop_tx(struct uart_port *port) >* is fully transmitted. >*/ > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS); > + atmel_port->tx_stopped = true; > > /* Disable interrupts */ > atmel_uart_writel(port, ATMEL_US_IDR, atmel_port->tx_done_mask); > @@ -492,6 +498,7 @@ static void atmel_stop_tx(struct uart_port *port) > if ((port->rs485.flags & SER_RS485_ENABLED) && > !(port->rs485.flags & SER_RS485_RX_DURING_TX)) > atmel_start_rx(port); > + > } > > /* > @@ -521,6 +528,7 @@ static void atmel_start_tx(struct uart_port *port) > > /* re-enable the transmitter */ > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); > + atmel_port->tx_stopped = false; > } > > /* > @@ -1866,6 +1874,7 @@ static int atmel_startup(struct uart_port *port) > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); > /* enable xmit & rcvr */ > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); > + atmel_port->tx_stopped = false; > > setup_timer(&atmel_port->uart_timer, > atmel_uart_timer_callback, > @@ -2122,6 +2131,7 @@ static void atmel_set_termios(struct uart_port *port, > struct ktermios *termios, > > /* disable receiver and transmitter */ > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXDIS | ATMEL_US_RXDIS); > + atmel_port->tx_stopped = true; > > /* mode */ > if (port->rs485.flags & SER_RS485_ENABLED) { > @@ -2207,6 +2217,7 @@ static void atmel_set_termios(struct uart_port *port, > struct ktermios *termios, > atmel_uart_writel(port, ATMEL_US_BRGR, quot); > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN | ATMEL_US_RXEN); > + atmel_port->tx_stopped = false; > > /* restore interrupts */ > atmel_uart_writel(port, ATMEL_US_IER, imr); > @@ -2450,6 +2461,7 @@ static void atmel_console_write(struct console *co, > const char *s, u_int count) > > /* Make sure that tx path is actually able to send characters */ > atmel_uart_writel(port, ATMEL_US_CR, ATMEL_US_TXEN); > + atmel_port->tx_stopped = false; > > uart_console_write(port, s, count, atmel_console_putchar); > > @@ -2511,6 +2523,7 @@ static int __init atmel_console_setup(struct console > *co, char *options) > { > int ret; > struct uart_port *port = &atmel_ports[co->index].uart; > + struct atmel_uart_port *atmel_port = to_atmel_uart_port(port); > int baud = 115200; &g
Re: [PATCH v2 8/9] atmel_flexcom: Support backup mode
On 15/09/2017 at 16:04, Romain Izard wrote: > The controller used by a flexcom module is configured at boot, and left > alone after this. As the configuration will be lost after backup mode, > restore the state of the flexcom driver on resume. > > Signed-off-by: Romain Izard Tested-by: Nicolas Ferre On sama5d2 Xplained board (i2c0 from flexcom 4). and obviously: Acked-by: Nicolas Ferre Thanks Romain! Regards, > --- > drivers/mfd/atmel-flexcom.c | 65 > ++--- > 1 file changed, 50 insertions(+), 15 deletions(-) > > diff --git a/drivers/mfd/atmel-flexcom.c b/drivers/mfd/atmel-flexcom.c > index 064bde9cff5a..ef1235c4a179 100644 > --- a/drivers/mfd/atmel-flexcom.c > +++ b/drivers/mfd/atmel-flexcom.c > @@ -39,34 +39,44 @@ > #define FLEX_MR_OPMODE(opmode) (((opmode) << FLEX_MR_OPMODE_OFFSET) & > \ >FLEX_MR_OPMODE_MASK) > > +struct atmel_flexcom { > + void __iomem *base; > + u32 opmode; > + struct clk *clk; > +}; > > static int atmel_flexcom_probe(struct platform_device *pdev) > { > struct device_node *np = pdev->dev.of_node; > - struct clk *clk; > struct resource *res; > - void __iomem *base; > - u32 opmode; > + struct atmel_flexcom *afc; > int err; > + u32 val; > + > + afc = devm_kzalloc(&pdev->dev, sizeof(*afc), GFP_KERNEL); > + if (!afc) > + return -ENOMEM; > > - err = of_property_read_u32(np, "atmel,flexcom-mode", &opmode); > + platform_set_drvdata(pdev, afc); > + > + err = of_property_read_u32(np, "atmel,flexcom-mode", &afc->opmode); > if (err) > return err; > > - if (opmode < ATMEL_FLEXCOM_MODE_USART || > - opmode > ATMEL_FLEXCOM_MODE_TWI) > + if (afc->opmode < ATMEL_FLEXCOM_MODE_USART || > + afc->opmode > ATMEL_FLEXCOM_MODE_TWI) > return -EINVAL; > > res = platform_get_resource(pdev, IORESOURCE_MEM, 0); > - base = devm_ioremap_resource(&pdev->dev, res); > - if (IS_ERR(base)) > - return PTR_ERR(base); > + afc->base = devm_ioremap_resource(&pdev->dev, res); > + if (IS_ERR(afc->base)) > + return PTR_ERR(afc->base); > > - clk = devm_clk_get(&pdev->dev, NULL); > - if (IS_ERR(clk)) > - return PTR_ERR(clk); > + afc->clk = devm_clk_get(&pdev->dev, NULL); > + if (IS_ERR(afc->clk)) > + return PTR_ERR(afc->clk); > > - err = clk_prepare_enable(clk); > + err = clk_prepare_enable(afc->clk); > if (err) > return err; > > @@ -76,9 +86,10 @@ static int atmel_flexcom_probe(struct platform_device > *pdev) >* inaccessible and are read as zero. Also the external I/O lines of the >* Flexcom are muxed to reach the selected device. >*/ > - writel(FLEX_MR_OPMODE(opmode), base + FLEX_MR); > + val = FLEX_MR_OPMODE(afc->opmode); > + writel(val, afc->base + FLEX_MR); > > - clk_disable_unprepare(clk); > + clk_disable_unprepare(afc->clk); > > return devm_of_platform_populate(&pdev->dev); > } > @@ -89,10 +100,34 @@ static const struct of_device_id > atmel_flexcom_of_match[] = { > }; > MODULE_DEVICE_TABLE(of, atmel_flexcom_of_match); > > +#ifdef CONFIG_PM_SLEEP > +static int atmel_flexcom_resume(struct device *dev) > +{ > + struct atmel_flexcom *afc = dev_get_drvdata(dev); > + int err; > + u32 val; > + > + err = clk_prepare_enable(afc->clk); > + if (err) > + return err; > + > + val = FLEX_MR_OPMODE(afc->opmode), > + writel(val, afc->base + FLEX_MR); > + > + clk_disable_unprepare(afc->clk); > + > + return 0; > +} > +#endif > + > +static SIMPLE_DEV_PM_OPS(atmel_flexcom_pm_ops, NULL, > + atmel_flexcom_resume); > + > static struct platform_driver atmel_flexcom_driver = { > .probe = atmel_flexcom_probe, > .driver = { > .name = "atmel_flexcom", > + .pm = &atmel_flexcom_pm_ops, > .of_match_table = atmel_flexcom_of_match, > }, > }; > -- Nicolas Ferre
[GIT PULL] ARM: at91: fixes for 4.14 #1
From: Nicolas Ferre Arnd, Olof, Here are some fixes for 4.14. I send them while Alexandre is in the US. The most of this PR are modifications to the sama5d27 SOM1 EK board that was introducts lately. These modifications are errors due to typos, misunderstanding of the DT binding or simply last minute hardware modifications. I also added one patch for the AT91 PM subsystem as it is the re-alignment on one treewide change by Russell to get rid of virt_to_phys() in low-level code. I think that unifying this move the soonest for all ARM platform is better. Thanks, best regards, The following changes since commit 2bd6bf03f4c1c59381d62c61d03f6cc3fe71f66e: Linux 4.14-rc1 (2017-09-16 15:47:51 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git tags/at91-fixes for you to fetch changes up to 093d79f62a89f47d9b5fd0746768146d9696535c: ARM: at91: Replace uses of virt_to_phys with __pa_symbol (2017-09-18 10:05:38 +0200) Fixes for 4.14: - three DT fixes for the newly introduced sama5d27_som1_ek board - one treewide modification that didn't touch this new PM code: we synchronize now to be coherent with the other ARM platforms Alexandre Belloni (1): ARM: at91: Replace uses of virt_to_phys with __pa_symbol Ludovic Desroches (2): ARM: dts: at91: sama5d27_som1_ek: update pinmux/pinconf for LEDs and USB ARM: dts: at91: sama5d27_som1_ek: fix typos Nicolas Ferre (1): ARM: dts: at91: sama5d27_som1_ek: fix USB host vbus arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 19 +++ arch/arm/mach-at91/pm.c | 4 ++-- 2 files changed, 13 insertions(+), 10 deletions(-) -- Nicolas Ferre
Re: [PATCH 2/3] ARM: dts: at91: usb_a9g20: fix rtc node
On 15/09/2017 at 04:00, Alexandre Belloni wrote: > The rv3029 compatible is missing its vendor string, add it. > Also fix the node name to be a proper generic name. > > Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre > --- > arch/arm/boot/dts/usb_a9g20_common.dtsi | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/boot/dts/usb_a9g20_common.dtsi > b/arch/arm/boot/dts/usb_a9g20_common.dtsi > index 088c2c3685ab..81c3fe0465d9 100644 > --- a/arch/arm/boot/dts/usb_a9g20_common.dtsi > +++ b/arch/arm/boot/dts/usb_a9g20_common.dtsi > @@ -20,8 +20,8 @@ > }; > > i2c-gpio-0 { > - rv3029c2@56 { > - compatible = "rv3029c2"; > + rtc@56 { > + compatible = "microcrystal,rv3029"; > reg = <0x56>; > }; > }; > -- Nicolas Ferre
Re: [PATCH 0/3] SoM1 EK board fixes
On 14/09/2017 at 16:28, Claudiu Beznea wrote: > Hi, > > This series contains fixes for SAMA5D27 SoM1 EK board. It would be > good if we will have this in 4.14 version. > > Thank you, > Claudiu > > Ludovic Desroches (2): > ARM: dts: at91: sama5d27_som1_ek: update pinmux/pinconf for LEDs and > USB > ARM: dts: at91: sama5d27_som1_ek: fix typos Additional: Acked-by: Nicolas Ferre For those 2. I merged them in a at91-4.14-fixes branch here: https://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git/log/?h=at91-4.14-fixes and merge it in at91-next. It should appear in tomorrow's linux-next. Alexandre, do you agree with these 3 patches for fixes? Do you see other patches to add to this "-fixes" branch? like: ARM: at91: Replace uses of virt_to_phys with __pa_symbol ... Do you want me to do the RP while you are at "Linux plumbers"? Bye, > Nicolas Ferre (1): > ARM: dts: at91: sama5d27_som1_ek: fix USB host vbus > > arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 19 +++---- > 1 file changed, 11 insertions(+), 8 deletions(-) > -- Nicolas Ferre
Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks
On 14/09/2017 at 09:41, romain izard wrote: > 2017-09-13 19:03 GMT+02:00 Alexandre Belloni > : >> On 13/09/2017 at 14:29:35 +0200, Nicolas Ferre wrote: >>> On 08/09/2017 at 17:35, Romain Izard wrote: >>>> From: Romain Izard >>>> >>>> Save and restore the System Clock and Programmable Clock register for >>>> the backup use case. >>> >>> "System Clock" seems to be handled in another patch. >>> >>>> Signed-off-by: Romain Izard >>>> --- >>>> drivers/clk/at91/pmc.c | 5 + >>>> 1 file changed, 5 insertions(+) >>>> >>>> diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c >>>> index 07dc2861ad3f..5421b03553ec 100644 >>>> --- a/drivers/clk/at91/pmc.c >>>> +++ b/drivers/clk/at91/pmc.c >>>> @@ -66,6 +66,7 @@ static struct >>>> u32 pcr[PMC_MAX_IDS]; >>>> u32 audio_pll0; >>>> u32 audio_pll1; >>>> + u32 pckr[3]; >>> >>> Some products have different numbers of PCK (only 2 on at91sam9x5 for >>> instance)... >>> >> >> My opinion is that it will be time to change that when multiple SoCs will >> need to save their registers. >> > For the next version, I'll add a #define. But as this code requires a > device tree node with the compatible string "atmel,sama5d2-pmc", I believe > that we can ignore other chips for now. Fair enough, let's go for this. Bye, -- Nicolas Ferre
Re: [PATCH v1 03/10] clk: at91: pmc: Support backup for programmable clocks
On 08/09/2017 at 17:35, Romain Izard wrote: > From: Romain Izard > > Save and restore the System Clock and Programmable Clock register for > the backup use case. "System Clock" seems to be handled in another patch. > Signed-off-by: Romain Izard > --- > drivers/clk/at91/pmc.c | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index 07dc2861ad3f..5421b03553ec 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -66,6 +66,7 @@ static struct > u32 pcr[PMC_MAX_IDS]; > u32 audio_pll0; > u32 audio_pll1; > + u32 pckr[3]; Some products have different numbers of PCK (only 2 on at91sam9x5 for instance)... > } pmc_cache; > > void pmc_register_id(u8 id) > @@ -103,6 +104,8 @@ static int pmc_suspend(void) > regmap_read(pmcreg, AT91_PMC_PCR, > &pmc_cache.pcr[registered_ids[i]]); > } > + for (i = 0; i < 3; i++) And it might be a good practice to have this constant value in a #define. We have "#define PROG_ID_MAX 7" defined in drivers/clk/at91/clk-programmable.c. Regards, > + regmap_read(pmcreg, AT91_PMC_PCKR(i), &pmc_cache.pckr[i]); > > return 0; > } > @@ -143,6 +146,8 @@ static void pmc_resume(void) >pmc_cache.pcr[registered_ids[i]] | >AT91_PMC_PCR_CMD); > } > + for (i = 0; i < 3; i++) > + regmap_write(pmcreg, AT91_PMC_PCKR(i), pmc_cache.pckr[i]); > > if (pmc_cache.uckr & AT91_PMC_UPLLEN) > mask |= AT91_PMC_LOCKU; > -- Nicolas Ferre
Re: [PATCH v1 01/10] clk: at91: pmc: Wait for clocks when resuming
On 08/09/2017 at 17:35, Romain Izard wrote: > Wait for the syncronization of all clocks when resuming, not only the > UPLL clock. Do not use regmap_read_poll_timeout, as it will call BUG() > when interrupts are masked, which is the case in here. > > Signed-off-by: Romain Izard > --- > drivers/clk/at91/pmc.c | 24 > 1 file changed, 16 insertions(+), 8 deletions(-) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index 775af473fe11..5c2b26de303e 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -107,10 +107,20 @@ static int pmc_suspend(void) > return 0; > } > > +static bool pmc_ready(unsigned int mask) > +{ > + unsigned int status; > + > + regmap_read(pmcreg, AT91_PMC_SR, &status); > + > + return ((status & mask) == mask) ? 1 : 0; > +} > + > static void pmc_resume(void) > { > - int i, ret = 0; > + int i; > u32 tmp; > + u32 mask = AT91_PMC_MCKRDY | AT91_PMC_LOCKA; > > regmap_read(pmcreg, AT91_PMC_MCKR, &tmp); > if (pmc_cache.mckr != tmp) > @@ -134,13 +144,11 @@ static void pmc_resume(void) >AT91_PMC_PCR_CMD); > } > > - if (pmc_cache.uckr & AT91_PMC_UPLLEN) { > - ret = regmap_read_poll_timeout(pmcreg, AT91_PMC_SR, tmp, > -!(tmp & AT91_PMC_LOCKU), > -10, 5000); > - if (ret) > - pr_crit("USB PLL didn't lock when resuming\n"); > - } > + if (pmc_cache.uckr & AT91_PMC_UPLLEN) > + mask |= AT91_PMC_LOCKU; > + > + while (!pmc_ready(mask)) > + cpu_relax(); Okay, but I would prefer to keep the timeout property in it. So we may need to re-implement a timeout way-out here. Regards, > } > > static struct syscore_ops pmc_syscore_ops = { > -- Nicolas Ferre
Re: [PATCH v1 02/10] clk: at91: pmc: Save SCSR during suspend
On 08/09/2017 at 17:35, Romain Izard wrote: > The contents of the System Clock Status Register (SCSR) needs to be > restored into the System Clock Enable Register (SCER). > > As the bootloader will restore some clocks by itself, the issue can be > missed as only the USB controller, the LCD controller, the Image Sensor > controller and the programmable clocks will be impacted. > > Fix the obvious typo in the suspend/resume code, as the IMR register > does not need to be saved twice. > > Signed-off-by: Romain Izard Yes, it looks like a typo: Acked-by: Nicolas Ferre I didn't experienced the issue with LCD nor USB though. Regards, > --- > drivers/clk/at91/pmc.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/clk/at91/pmc.c b/drivers/clk/at91/pmc.c > index 5c2b26de303e..07dc2861ad3f 100644 > --- a/drivers/clk/at91/pmc.c > +++ b/drivers/clk/at91/pmc.c > @@ -86,7 +86,7 @@ static int pmc_suspend(void) > { > int i; > > - regmap_read(pmcreg, AT91_PMC_IMR, &pmc_cache.scsr); > + regmap_read(pmcreg, AT91_PMC_SCSR, &pmc_cache.scsr); > regmap_read(pmcreg, AT91_PMC_PCSR, &pmc_cache.pcsr0); > regmap_read(pmcreg, AT91_CKGR_UCKR, &pmc_cache.uckr); > regmap_read(pmcreg, AT91_CKGR_MOR, &pmc_cache.mor); > @@ -129,7 +129,7 @@ static void pmc_resume(void) > if (pmc_cache.pllar != tmp) > pr_warn("PLLAR was not configured properly by the firmware\n"); > > - regmap_write(pmcreg, AT91_PMC_IMR, pmc_cache.scsr); > + regmap_write(pmcreg, AT91_PMC_SCER, pmc_cache.scsr); > regmap_write(pmcreg, AT91_PMC_PCER, pmc_cache.pcsr0); > regmap_write(pmcreg, AT91_CKGR_UCKR, pmc_cache.uckr); > regmap_write(pmcreg, AT91_CKGR_MOR, pmc_cache.mor); > -- Nicolas Ferre
Re: [PATCH v1 07/10] iio:adc:at91-sama5d2: Support backup mode
tor_enable(st->vref); > + if (err) > + return err; > + > + at91_adc_init_hw(st, st->current_rate); > + > + err = clk_prepare_enable(st->per_clk); > + return err; > +} > +#endif > + > +static SIMPLE_DEV_PM_OPS(at91_adc_pm_ops, at91_adc_suspend, at91_adc_resume); > + > static struct platform_driver at91_adc_driver = { > .probe = at91_adc_probe, > .remove = at91_adc_remove, > .driver = { > .name = "at91-sama5d2_adc", > .of_match_table = at91_adc_dt_match, > + .pm = &at91_adc_pm_ops, > }, > }; > module_platform_driver(at91_adc_driver) > -- Nicolas Ferre
[PATCH RESEND new email address] usb: gadget: udc: atmel: set vbus irqflags explicitly
The driver triggers actions on both edges of the vbus signal. The former PIO controller was triggering IRQs on both falling and rising edges by default. Newer PIO controller don't, so it's better to set it explicitly to IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING. Without this patch we may trigger the connection with host but only on some bouncing signal conditions and thus lose connecting events. Signed-off-by: Nicolas Ferre Cc: stable # v4.4+ --- drivers/usb/gadget/udc/atmel_usba_udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 98d71400f8a1..a884c022df7a 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -29,6 +29,8 @@ #include #include "atmel_usba_udc.h" +#define USBA_VBUS_IRQFLAGS (IRQF_ONESHOT \ + | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING) #ifdef CONFIG_USB_GADGET_DEBUG_FS #include @@ -2361,7 +2363,7 @@ static int usba_udc_probe(struct platform_device *pdev) IRQ_NOAUTOEN); ret = devm_request_threaded_irq(&pdev->dev, gpio_to_irq(udc->vbus_pin), NULL, - usba_vbus_irq_thread, IRQF_ONESHOT, + usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS, "atmel_usba_udc", udc); if (ret) { udc->vbus_pin = -ENODEV; -- 2.9.0
[PATCH] usb: gadget: udc: atmel: set vbus irqflags explicitly
From: Nicolas Ferre The driver triggers actions on both edges of the vbus signal. The former PIO controller was triggering IRQs on both falling and rising edges by default. Newer PIO controller don't, so it's better to set it explicitly to IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING. Without this patch we may trigger the connection with host but only on some bouncing signal conditions and thus lose connecting events. Signed-off-by: Nicolas Ferre Cc: stable # v4.4+ --- drivers/usb/gadget/udc/atmel_usba_udc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/usb/gadget/udc/atmel_usba_udc.c b/drivers/usb/gadget/udc/atmel_usba_udc.c index 98d71400f8a1..a884c022df7a 100644 --- a/drivers/usb/gadget/udc/atmel_usba_udc.c +++ b/drivers/usb/gadget/udc/atmel_usba_udc.c @@ -29,6 +29,8 @@ #include #include "atmel_usba_udc.h" +#define USBA_VBUS_IRQFLAGS (IRQF_ONESHOT \ + | IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING) #ifdef CONFIG_USB_GADGET_DEBUG_FS #include @@ -2361,7 +2363,7 @@ static int usba_udc_probe(struct platform_device *pdev) IRQ_NOAUTOEN); ret = devm_request_threaded_irq(&pdev->dev, gpio_to_irq(udc->vbus_pin), NULL, - usba_vbus_irq_thread, IRQF_ONESHOT, + usba_vbus_irq_thread, USBA_VBUS_IRQFLAGS, "atmel_usba_udc", udc); if (ret) { udc->vbus_pin = -ENODEV; -- 2.9.0
Re: [PATCH] ARM: at91: Replace uses of virt_to_phys with __pa_symbol
On 24/08/2017 at 13:44, Alexandre Belloni wrote: > The PM code wrongly uses virt_to_phys() instead of __pa_symbol() and was > not updated by commit 64fc2a947a98 ("ARM: 8641/1: treewide: Replace uses of > virt_to_phys with __pa_symbol") because it was not yet in tree. > > Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre > --- > arch/arm/mach-at91/pm.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c > index b1a59d638321..cc138d13 100644 > --- a/arch/arm/mach-at91/pm.c > +++ b/arch/arm/mach-at91/pm.c > @@ -535,8 +535,8 @@ static void __init at91_pm_backup_init(void) > } > > pm_bu->suspended = 0; > - pm_bu->canary = virt_to_phys(&canary); > - pm_bu->resume = virt_to_phys(cpu_resume); > + pm_bu->canary = __pa_symbol(&canary); > + pm_bu->resume = __pa_symbol(cpu_resume); > > return; > > -- Nicolas Ferre
Re: [PATCH] MAINTAINERS: Add SoC drivers to AT91 entry
On 12/08/2017 at 23:53, Alexandre Belloni wrote: > We (the AT91/Atmel SoC maintainers) are not seeing patches for several > drivers present only on our SoCs. Add more patterns to match at91 and atmel > drivers. > > Signed-off-by: Alexandre Belloni Acked-by: Nicolas Ferre > --- > MAINTAINERS | 5 + > 1 file changed, 5 insertions(+) > > diff --git a/MAINTAINERS b/MAINTAINERS > index 205d3977ac46..6ba83a50a926 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -1158,6 +1158,8 @@ L: linux-arm-ker...@lists.infradead.org (moderated > for non-subscribers) > W: http://www.linux4sam.org > T: git git://git.kernel.org/pub/scm/linux/kernel/git/nferre/linux-at91.git > S: Supported > +N: at91 > +N: atmel > F: arch/arm/mach-at91/ > F: include/soc/at91/ > F: arch/arm/boot/dts/at91*.dts > @@ -1166,6 +1168,9 @@ F: arch/arm/boot/dts/sama*.dts > F: arch/arm/boot/dts/sama*.dtsi > F: arch/arm/include/debug/at91.S > F: drivers/memory/atmel* > +F: drivers/watchdog/sama5d4_wdt.c > +X: drivers/input/touchscreen/atmel_mxt_ts.c > +X: drivers/net/wireless/atmel/ > > ARM/ATMEL AT91 Clock Support > M: Boris Brezillon > -- Nicolas Ferre
Re: [PATCH v4 2/9] dt-bindings: clk: at91: add audio plls to the compatible list
On 25/07/2017 at 09:37, Quentin Schulz wrote: > This new clock driver set allows to have a fractional divided clock that > would generate a precise clock particularly suitable for audio > applications. > > The main audio pll clock has two children clocks: one that is connected > to the PMC, the other that can directly drive a pad. As these two routes > have different enable bits and different dividers and divider formulas, > they are handled by two different drivers. > > This adds the audio plls (frac, pad and pmc) to the compatible list of > at91 clocks in DT binding. > > Signed-off-by: Quentin Schulz > Acked-by: Rob Herring > Acked-by: Boris Brezillon Acked-by: Nicolas Ferre > --- > Documentation/devicetree/bindings/clock/at91-clock.txt | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/Documentation/devicetree/bindings/clock/at91-clock.txt > b/Documentation/devicetree/bindings/clock/at91-clock.txt > index 5f3ad65..51c259a 100644 > --- a/Documentation/devicetree/bindings/clock/at91-clock.txt > +++ b/Documentation/devicetree/bindings/clock/at91-clock.txt > @@ -81,6 +81,16 @@ Required properties: > "atmel,sama5d2-clk-generated": > at91 generated clock > > + "atmel,sama5d2-clk-audio-pll-frac": > + at91 audio fractional pll > + > + "atmel,sama5d2-clk-audio-pll-pad": > + at91 audio pll CLK_AUDIO output pin > + > + "atmel,sama5d2-clk-audio-pll-pmc" > + at91 audio pll output on AUDIOPLLCLK that feeds the PMC > + and can be used by peripheral clock or generic clock > + > Required properties for SCKC node: > - reg : defines the IO memory reserved for the SCKC. > - #size-cells : shall be 0 (reg is used to encode clk id). > -- Nicolas Ferre
Re: [PATCH v4 0/9] add support for Sama5d2 audio PLLs and enable ClassD
On 25/07/2017 at 09:37, Quentin Schulz wrote: > This patch series adds support for the audio PLLs and enables ClassD that > can be found in ATMEL Sama5d2 SoC. > > There are two audio PLLs (PMC and PAD) that shares the same parent (FRAC). > FRAC can output between 620 and 700MHz and only multiply the rate of its > parent. The two audio PLLs then divide the FRAC rate to best match the > asked rate. > > I basically took an old patch series posted by Nicolas on December, 6th > 2016[1][2][3] and the comments Boris did on the first version[4] Nicolas > sent on July, 15th 2015. > > I also fixed the function used to compute the divisors, removed useless > spinlocks and added a range to the audio frac PLL to stay within vendor's > supported range. Clocks that are children of gclk (generated-clk) are now > able to propagate rate to the audio PLL clocks when needed. > > However, there are multiple children clocks that could technically > change the rate of audio_pll (via gck). With the rate locking introduced > in Jerome Brunet's patch series[5], the first consumer to enable the clock > will be the one definitely setting the rate of the clock. Without the rate > locking, the last consumer to set the rate will be able to mess with the > rate. > Since audio IPs are most likely to request the same rate, we enforce > that the only clks able to modify gck rate are those of audio IPs. > > To remain consistent, we deny other clocks to be children of audio_pll. Quentin, Thanks for having revived this series. Everything's okay on my side for this v4. I think that my tag isn't missing from any patch of this series. Now we surely need to define which path it must take... Best regards, > v4: > - initialized the clk_init_data structure, > - switched to of_clk_parent_fill instead of manually setting > parent_names, > - removed include of clkdev.h in favor of slab.h, > - removed unnecessary second cast in operation, > - used clamp instead of two conditions, > - removed dependency on clock-output-names, the name is gotten from DT > node, > - merged all three drivers for audio PLLs (FRAC, PMC, PAD) into one, > > v3: > - added a flag per generated clock to know which one is allowed to > modify audio_pll rate, > - set the flag in setup function depending on the compatible and the > clock ID, > > v2: > - split big patch containing dt-binding, pll drivers and classd > modifications, > - removed unused AUDIO_PLL_*FOUT* defines from clk-audio-pll-pmc, > - added conditions for audio pll rate setting restriction for SSC and > I2S, > - renamed all mentions of ACLK to GCLK in classD driver, > > Thanks, > Quentin > > [1] https://patchwork.kernel.org/patch/9462351/ > [2] https://patchwork.kernel.org/patch/9462347/ > [3] https://patchwork.kernel.org/patch/9462349/ > [4] https://www.spinics.net/lists/arm-kernel/msg436120.html > [5] http://www.spinics.net/lists/linux-clk/msg17927.html > > Cyrille Pitchen (2): > ARM: dts: at91: sama5d2: add classd nodes > ARM: dts: at91: sama5d2_xplained: add pin muxing and enable classd > > Quentin Schulz (7): > clk: at91: clk-generated: remove useless divisor loop > dt-bindings: clk: at91: add audio plls to the compatible list > clk: at91: add audio pll clock drivers > clk: at91: clk-generated: create function to find best_diff > clk: at91: clk-generated: make gclk determine audio_pll rate > ASoC: atmel-classd: remove aclk clock from DT binding > ASoC: atmel-classd: remove aclk clock > > Documentation/devicetree/bindings/clock/at91-clock.txt | 10 +- > Documentation/devicetree/bindings/sound/atmel-classd.txt | 9 +- > arch/arm/boot/dts/at91-sama5d2_xplained.dts | 16 +- > arch/arm/boot/dts/sama5d2.dtsi | 39 +- > arch/arm/mach-at91/Kconfig | 4 +- > drivers/clk/at91/Makefile| 1 +- > drivers/clk/at91/clk-audio-pll.c | 531 - > drivers/clk/at91/clk-generated.c | 101 +- > include/linux/clk/at91_pmc.h | 25 +- > sound/soc/atmel/atmel-classd.c | 47 +- > 10 files changed, 724 insertions(+), 59 deletions(-) > create mode 100644 drivers/clk/at91/clk-audio-pll.c > > base-commit: 047a0f692a9354d730dad30f25e1ebd8437b32b1 > -- Nicolas Ferre
Re: [PATCH v4 8/9] ASoC: atmel-classd: remove aclk clock
On 25/07/2017 at 09:37, Quentin Schulz wrote: > Since gclk (generated-clk) is now able to determine the rate of the > audio_pll, there is no need for classd to have a direct phandle to the > audio_pll while already having a phandle to gclk. > > Thus, remove all mentions to aclk in classd driver and update macros and > variable names. > > Signed-off-by: Quentin Schulz > Acked-by: Mark Brown Acked-by: Nicolas Ferre > --- > sound/soc/atmel/atmel-classd.c | 47 ++- > 1 file changed, 14 insertions(+), 33 deletions(-) > > diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c > index b7ef8c5..be6b775 100644 > --- a/sound/soc/atmel/atmel-classd.c > +++ b/sound/soc/atmel/atmel-classd.c > @@ -32,7 +32,6 @@ struct atmel_classd { > struct regmap *regmap; > struct clk *pclk; > struct clk *gclk; > - struct clk *aclk; > int irq; > const struct atmel_classd_pdata *pdata; > }; > @@ -330,11 +329,6 @@ static int atmel_classd_codec_dai_startup(struct > snd_pcm_substream *substream, > { > struct snd_soc_pcm_runtime *rtd = substream->private_data; > struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); > - int ret; > - > - ret = clk_prepare_enable(dd->aclk); > - if (ret) > - return ret; > > return clk_prepare_enable(dd->gclk); > } > @@ -357,31 +351,31 @@ static int atmel_classd_codec_dai_digital_mute(struct > snd_soc_dai *codec_dai, > return 0; > } > > -#define CLASSD_ACLK_RATE_11M2896_MPY_8 (112896 * 100 * 8) > -#define CLASSD_ACLK_RATE_12M288_MPY_8 (12288 * 1000 * 8) > +#define CLASSD_GCLK_RATE_11M2896_MPY_8 (112896 * 100 * 8) > +#define CLASSD_GCLK_RATE_12M288_MPY_8 (12288 * 1000 * 8) > > static struct { > int rate; > int sample_rate; > int dsp_clk; > - unsigned long aclk_rate; > + unsigned long gclk_rate; > } const sample_rates[] = { > { 8000, CLASSD_INTPMR_FRAME_8K, > - CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_ACLK_RATE_12M288_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_GCLK_RATE_12M288_MPY_8 }, > { 16000, CLASSD_INTPMR_FRAME_16K, > - CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_ACLK_RATE_12M288_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_GCLK_RATE_12M288_MPY_8 }, > { 32000, CLASSD_INTPMR_FRAME_32K, > - CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_ACLK_RATE_12M288_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_GCLK_RATE_12M288_MPY_8 }, > { 48000, CLASSD_INTPMR_FRAME_48K, > - CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_ACLK_RATE_12M288_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_GCLK_RATE_12M288_MPY_8 }, > { 96000, CLASSD_INTPMR_FRAME_96K, > - CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_ACLK_RATE_12M288_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_12M288, CLASSD_GCLK_RATE_12M288_MPY_8 }, > { 22050, CLASSD_INTPMR_FRAME_22K, > - CLASSD_INTPMR_DSP_CLK_FREQ_11M2896, CLASSD_ACLK_RATE_11M2896_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_11M2896, CLASSD_GCLK_RATE_11M2896_MPY_8 }, > { 44100, CLASSD_INTPMR_FRAME_44K, > - CLASSD_INTPMR_DSP_CLK_FREQ_11M2896, CLASSD_ACLK_RATE_11M2896_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_11M2896, CLASSD_GCLK_RATE_11M2896_MPY_8 }, > { 88200, CLASSD_INTPMR_FRAME_88K, > - CLASSD_INTPMR_DSP_CLK_FREQ_11M2896, CLASSD_ACLK_RATE_11M2896_MPY_8 }, > + CLASSD_INTPMR_DSP_CLK_FREQ_11M2896, CLASSD_GCLK_RATE_11M2896_MPY_8 }, > }; > > static int > @@ -410,13 +404,12 @@ atmel_classd_codec_dai_hw_params(struct > snd_pcm_substream *substream, > } > > dev_dbg(codec->dev, > - "Selected SAMPLE_RATE of %dHz, ACLK_RATE of %ldHz\n", > - sample_rates[best].rate, sample_rates[best].aclk_rate); > + "Selected SAMPLE_RATE of %dHz, GCLK_RATE of %ldHz\n", > + sample_rates[best].rate, sample_rates[best].gclk_rate); > > clk_disable_unprepare(dd->gclk); > - clk_disable_unprepare(dd->aclk); > > - ret = clk_set_rate(dd->aclk, sample_rates[best].aclk_rate); > + ret = clk_set_rate(dd->gclk, sample_rates[best].gclk_rate); > if (ret) > return ret; > > @@ -426,10 +419,6 @@ atmel_classd_codec_dai_hw_params(struct > snd_pcm_substream *substream, > > snd_soc_update_bits(codec, CLASSD_INTPMR, mask, val); > > - ret = clk_prepare_enable(dd->aclk); > - if (ret) > - return ret; > - > return clk_prepare_enable(dd->gclk); > } > > @@ -441,7 +430,6 @@ atmel_classd_codec_dai_shutdown(struct snd_
Re: [PATCH v4 7/9] ASoC: atmel-classd: remove aclk clock from DT binding
On 25/07/2017 at 09:37, Quentin Schulz wrote: > Since gclk (generated-clk) is now able to determine the rate of the > audio_pll, there is no need for classd to have a direct phandle to the > audio_pll while already having a phandle to gclk. > > This binding is used by no board in mainline so it is safe to be > modified. > > Signed-off-by: Quentin Schulz > Acked-by: Mark Brown > Acked-by: Rob Herring Acked-by: Nicolas Ferre > --- > Documentation/devicetree/bindings/sound/atmel-classd.txt | 9 +++-- > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/Documentation/devicetree/bindings/sound/atmel-classd.txt > b/Documentation/devicetree/bindings/sound/atmel-classd.txt > index 549e701..8985510 100644 > --- a/Documentation/devicetree/bindings/sound/atmel-classd.txt > +++ b/Documentation/devicetree/bindings/sound/atmel-classd.txt > @@ -13,13 +13,11 @@ Required properties: > Must be "tx". > - clock-names > Tuple listing input clock names. > - Required elements: "pclk", "gclk" and "aclk". > + Required elements: "pclk" and "gclk". > - clocks > Please refer to clock-bindings.txt. > - assigned-clocks > Should be <&classd_gclk>. > -- assigned-clock-parents > - Should be <&audio_pll_pmc>. > > Optional properties: > - pinctrl-names, pinctrl-0 > @@ -45,10 +43,9 @@ classd: classd@fc048000 { > (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) > | AT91_XDMAC_DT_PERID(47))>; > dma-names = "tx"; > - clocks = <&classd_clk>, <&classd_gclk>, <&audio_pll_pmc>; > - clock-names = "pclk", "gclk", "aclk"; > + clocks = <&classd_clk>, <&classd_gclk>; > + clock-names = "pclk", "gclk"; > assigned-clocks = <&classd_gclk>; > - assigned-clock-parents = <&audio_pll_pmc>; > > pinctrl-names = "default"; > pinctrl-0 = <&pinctrl_classd_default>; > -- Nicolas Ferre
Re: [PATCH v4 6/9] clk: at91: clk-generated: make gclk determine audio_pll rate
On 25/07/2017 at 09:37, Quentin Schulz wrote: > This allows gclk to determine audio_pll rate and set the parent rate > accordingly. > > However, there are multiple children clocks that could technically > change the rate of audio_pll (via gck). With the rate locking, the first > consumer to enable the clock will be the one definitely setting the rate > of the clock. > > Since audio IPs are most likely to request the same rate, we enforce > that the only clks able to modify gck rate are those of audio IPs. > > To remain consistent, we deny other clocks to be children of audio_pll. > > Signed-off-by: Quentin Schulz > Acked-by: Boris Brezillon Acked-by: Nicolas Ferre > --- > drivers/clk/at91/clk-generated.c | 63 + > 1 file changed, 57 insertions(+), 6 deletions(-) > > diff --git a/drivers/clk/at91/clk-generated.c > b/drivers/clk/at91/clk-generated.c > index 7260e49..3348136 100644 > --- a/drivers/clk/at91/clk-generated.c > +++ b/drivers/clk/at91/clk-generated.c > @@ -26,6 +26,13 @@ > #define GENERATED_SOURCE_MAX 6 > #define GENERATED_MAX_DIV255 > > +#define GCK_ID_SSC0 43 > +#define GCK_ID_SSC1 44 > +#define GCK_ID_I2S0 54 > +#define GCK_ID_I2S1 55 > +#define GCK_ID_CLASSD59 > +#define GCK_INDEX_DT_AUDIO_PLL 5 > + > struct clk_generated { > struct clk_hw hw; > struct regmap *regmap; > @@ -34,6 +41,7 @@ struct clk_generated { > u32 id; > u32 gckdiv; > u8 parent_id; > + bool audio_pll_allowed; > }; > > #define to_clk_generated(hw) \ > @@ -126,15 +134,14 @@ static int clk_generated_determine_rate(struct clk_hw > *hw, > { > struct clk_generated *gck = to_clk_generated(hw); > struct clk_hw *parent = NULL; > + struct clk_rate_request req_parent = *req; > long best_rate = -EINVAL; > - unsigned long min_rate; > + unsigned long min_rate, parent_rate; > int best_diff = -1; > int i; > + u32 div; > > - for (i = 0; i < clk_hw_get_num_parents(hw); i++) { > - u32 div; > - unsigned long parent_rate; > - > + for (i = 0; i < clk_hw_get_num_parents(hw) - 1; i++) { > parent = clk_hw_get_parent_by_index(hw, i); > if (!parent) > continue; > @@ -150,11 +157,38 @@ static int clk_generated_determine_rate(struct clk_hw > *hw, > clk_generated_best_diff(req, parent, parent_rate, div, > &best_diff, &best_rate); > > + if (!best_diff) > + break; > + } > + > + /* > + * The audio_pll rate can be modified, unlike the five others clocks > + * that should never be altered. > + * The audio_pll can technically be used by multiple consumers. However, > + * with the rate locking, the first consumer to enable to clock will be > + * the one definitely setting the rate of the clock. > + * Since audio IPs are most likely to request the same rate, we enforce > + * that the only clks able to modify gck rate are those of audio IPs. > + */ > + > + if (!gck->audio_pll_allowed) > + goto end; > + > + parent = clk_hw_get_parent_by_index(hw, GCK_INDEX_DT_AUDIO_PLL); > + if (!parent) > + goto end; > + > + for (div = 1; div < GENERATED_MAX_DIV + 2; div++) { > + req_parent.rate = req->rate * div; > + __clk_determine_rate(parent, &req_parent); > + clk_generated_best_diff(req, parent, req_parent.rate, div, > + &best_diff, &best_rate); > > if (!best_diff) > break; > } > > +end: > pr_debug("GCLK: %s, best_rate = %ld, parent clk: %s @ %ld\n", >__func__, best_rate, >__clk_get_name((req->best_parent_hw)->clk), > @@ -264,7 +298,8 @@ at91_clk_register_generated(struct regmap *regmap, > spinlock_t *lock, > init.ops = &generated_ops; > init.parent_names = parent_names; > init.num_parents = num_parents; > - init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE; > + init.flags = CLK_SET_RATE_GATE | CLK_SET_PARENT_GATE | > + CLK_SET_RATE_PARENT; > > gck->id = id; > gck->hw.init = &init; > @@ -296,6 +331,7 @@ static void __init of_sama5d2_clk_generated_setup(struct > device_node *np) > struct device_node *gcknp; > struct clk_range range = CLK_RANGE(0, 0); >
Re: [PATCH v4 5/9] clk: at91: clk-generated: create function to find best_diff
On 25/07/2017 at 09:37, Quentin Schulz wrote: > The way to find the best_diff and do the appropriate process afterwards > can be re-used. > > This patch prepares the driver for an upcoming patch that will allow > clk_generated to determine the rate of the audio_pll. > > Signed-off-by: Quentin Schulz > Acked-by: Boris Brezillon Acked-by: Nicolas Ferre > --- > drivers/clk/at91/clk-generated.c | 41 + > 1 file changed, 27 insertions(+), 14 deletions(-) > > diff --git a/drivers/clk/at91/clk-generated.c > b/drivers/clk/at91/clk-generated.c > index ef4b4e0..7260e49 100644 > --- a/drivers/clk/at91/clk-generated.c > +++ b/drivers/clk/at91/clk-generated.c > @@ -99,15 +99,36 @@ clk_generated_recalc_rate(struct clk_hw *hw, > return DIV_ROUND_CLOSEST(parent_rate, gck->gckdiv + 1); > } > > +static void clk_generated_best_diff(struct clk_rate_request *req, > + struct clk_hw *parent, > + unsigned long parent_rate, u32 div, > + int *best_diff, long *best_rate) > +{ > + unsigned long tmp_rate; > + int tmp_diff; > + > + if (!div) > + tmp_rate = parent_rate; > + else > + tmp_rate = parent_rate / div; > + tmp_diff = abs(req->rate - tmp_rate); > + > + if (*best_diff < 0 || *best_diff > tmp_diff) { > + *best_rate = tmp_rate; > + *best_diff = tmp_diff; > + req->best_parent_rate = parent_rate; > + req->best_parent_hw = parent; > + } > +} > + > static int clk_generated_determine_rate(struct clk_hw *hw, > struct clk_rate_request *req) > { > struct clk_generated *gck = to_clk_generated(hw); > struct clk_hw *parent = NULL; > long best_rate = -EINVAL; > - unsigned long tmp_rate, min_rate; > + unsigned long min_rate; > int best_diff = -1; > - int tmp_diff; > int i; > > for (i = 0; i < clk_hw_get_num_parents(hw); i++) { > @@ -125,18 +146,10 @@ static int clk_generated_determine_rate(struct clk_hw > *hw, > continue; > > div = DIV_ROUND_CLOSEST(parent_rate, req->rate); > - if (!div) > - tmp_rate = parent_rate; > - else > - tmp_rate = parent_rate / div; > - tmp_diff = abs(req->rate - tmp_rate); > - > - if (best_diff < 0 || best_diff > tmp_diff) { > - best_rate = tmp_rate; > - best_diff = tmp_diff; > - req->best_parent_rate = parent_rate; > - req->best_parent_hw = parent; > - } > + > + clk_generated_best_diff(req, parent, parent_rate, div, > + &best_diff, &best_rate); > + > > if (!best_diff) > break; > -- Nicolas Ferre
Re: [PATCH v4 1/9] clk: at91: clk-generated: remove useless divisor loop
On 25/07/2017 at 09:37, Quentin Schulz wrote: > The driver requests the current clk rate of each of its parent clocks to > decide whether a clock rate is suitable or not. It does not request > determine_rate from a parent clock which could request a rate change in > parent clock (i.e. there is no parent rate propagation). > > We know the rate we want (passed along req argument of the function) and > the parent clock rate, thus we know the closest rounded divisor, we > don't need to iterate over the available divisors to find the best one > for a given clock. > > Signed-off-by: Quentin Schulz > Acked-by: Boris Brezillon Acked-by: Nicolas Ferre > --- > drivers/clk/at91/clk-generated.c | 25 - > 1 file changed, 12 insertions(+), 13 deletions(-) > > diff --git a/drivers/clk/at91/clk-generated.c > b/drivers/clk/at91/clk-generated.c > index f0b7ae9..ef4b4e0 100644 > --- a/drivers/clk/at91/clk-generated.c > +++ b/drivers/clk/at91/clk-generated.c > @@ -124,19 +124,18 @@ static int clk_generated_determine_rate(struct clk_hw > *hw, > (gck->range.max && min_rate > gck->range.max)) > continue; > > - for (div = 1; div < GENERATED_MAX_DIV + 2; div++) { > - tmp_rate = DIV_ROUND_CLOSEST(parent_rate, div); > - tmp_diff = abs(req->rate - tmp_rate); > - > - if (best_diff < 0 || best_diff > tmp_diff) { > - best_rate = tmp_rate; > - best_diff = tmp_diff; > - req->best_parent_rate = parent_rate; > - req->best_parent_hw = parent; > - } > - > - if (!best_diff || tmp_rate < req->rate) > - break; > + div = DIV_ROUND_CLOSEST(parent_rate, req->rate); > + if (!div) > + tmp_rate = parent_rate; > + else > + tmp_rate = parent_rate / div; > + tmp_diff = abs(req->rate - tmp_rate); > + > + if (best_diff < 0 || best_diff > tmp_diff) { > + best_rate = tmp_rate; > + best_diff = tmp_diff; > + req->best_parent_rate = parent_rate; > + req->best_parent_hw = parent; > } > > if (!best_diff) > -- Nicolas Ferre
Re: [PATCH] media: Convert to using %pOF instead of full_name
On 18/07/2017 at 23:43, Rob Herring wrote: > Now that we have a custom printf format specifier, convert users of > full_name to use %pOF instead. This is preparation to remove storing > of the full path string for each node. > > Signed-off-by: Rob Herring > Cc: Kyungmin Park > Cc: Andrzej Hajda > Cc: Mauro Carvalho Chehab > Cc: "Lad, Prabhakar" > Cc: Songjun Wu > Cc: Sylwester Nawrocki > Cc: Kukjin Kim > Cc: Krzysztof Kozlowski > Cc: Javier Martinez Canillas > Cc: Minghsiu Tsai > Cc: Houlong Wei > Cc: Andrew-CT Chen > Cc: Matthias Brugger > Cc: Laurent Pinchart > Cc: "Niklas Söderlund" > Cc: Guennadi Liakhovetski > Cc: Hyun Kwon > Cc: Michal Simek > Cc: "Sören Brinkmann" > Cc: linux-me...@vger.kernel.org > Cc: linux-arm-ker...@lists.infradead.org > Cc: linux-samsung-...@vger.kernel.org > Cc: linux-media...@lists.infradead.org > Cc: linux-renesas-...@vger.kernel.org > --- > drivers/media/i2c/s5c73m3/s5c73m3-core.c | 3 +- > drivers/media/i2c/s5k5baf.c| 7 ++-- > drivers/media/platform/am437x/am437x-vpfe.c| 4 +- > drivers/media/platform/atmel/atmel-isc.c | 4 +- Instead of Songjun, here is my: Acked-by: Nicolas Ferre > drivers/media/platform/davinci/vpif_capture.c | 16 > drivers/media/platform/exynos4-is/fimc-is.c| 8 ++-- > drivers/media/platform/exynos4-is/fimc-lite.c | 3 +- > drivers/media/platform/exynos4-is/media-dev.c | 8 ++-- > drivers/media/platform/exynos4-is/mipi-csis.c | 4 +- > drivers/media/platform/mtk-mdp/mtk_mdp_comp.c | 6 +-- > drivers/media/platform/mtk-mdp/mtk_mdp_core.c | 8 ++-- > drivers/media/platform/omap3isp/isp.c | 8 ++-- > drivers/media/platform/pxa_camera.c| 2 +- > drivers/media/platform/rcar-vin/rcar-core.c| 4 +- > drivers/media/platform/soc_camera/soc_camera.c | 6 +-- > drivers/media/platform/xilinx/xilinx-vipp.c| 52 > +- > drivers/media/v4l2-core/v4l2-async.c | 4 +- > drivers/media/v4l2-core/v4l2-clk.c | 3 +- > include/media/v4l2-clk.h | 4 +- > 19 files changed, 71 insertions(+), 83 deletions(-) > > diff --git a/drivers/media/i2c/s5c73m3/s5c73m3-core.c > b/drivers/media/i2c/s5c73m3/s5c73m3-core.c > index f434fb2ee6fc..cdc4f2392ef9 100644 > --- a/drivers/media/i2c/s5c73m3/s5c73m3-core.c > +++ b/drivers/media/i2c/s5c73m3/s5c73m3-core.c > @@ -1635,8 +1635,7 @@ static int s5c73m3_get_platform_data(struct s5c73m3 > *state) > > node_ep = of_graph_get_next_endpoint(node, NULL); > if (!node_ep) { > - dev_warn(dev, "no endpoint defined for node: %s\n", > - node->full_name); > + dev_warn(dev, "no endpoint defined for node: %pOF\n", node); > return 0; > } > > diff --git a/drivers/media/i2c/s5k5baf.c b/drivers/media/i2c/s5k5baf.c > index 962051b9939d..9c22fc963901 100644 > --- a/drivers/media/i2c/s5k5baf.c > +++ b/drivers/media/i2c/s5k5baf.c > @@ -1863,8 +1863,7 @@ static int s5k5baf_parse_device_node(struct s5k5baf > *state, struct device *dev) > > node_ep = of_graph_get_next_endpoint(node, NULL); > if (!node_ep) { > - dev_err(dev, "no endpoint defined at node %s\n", > - node->full_name); > + dev_err(dev, "no endpoint defined at node %pOF\n", node); > return -EINVAL; > } > > @@ -1882,8 +1881,8 @@ static int s5k5baf_parse_device_node(struct s5k5baf > *state, struct device *dev) > case V4L2_MBUS_PARALLEL: > break; > default: > - dev_err(dev, "unsupported bus in endpoint defined at node %s\n", > - node->full_name); > + dev_err(dev, "unsupported bus in endpoint defined at node > %pOF\n", > + node); > return -EINVAL; > } > > diff --git a/drivers/media/platform/am437x/am437x-vpfe.c > b/drivers/media/platform/am437x/am437x-vpfe.c > index 466aba8b0e00..dfcc484cab89 100644 > --- a/drivers/media/platform/am437x/am437x-vpfe.c > +++ b/drivers/media/platform/am437x/am437x-vpfe.c > @@ -2490,8 +2490,8 @@ vpfe_get_pdata(struct platform_device *pdev) > > rem = of_graph_get_remote_port_parent(endpoint); > if (!rem) { > - dev_err(&pdev->dev, "Remote device at %s not found\n", > - endpoint->full_name); > + dev_err(&pdev->dev, "Remote device at %pOF not found\n"
Re: [PATCH v2 1/3] mfd: syscon: update Atmel SMC binding doc
On 18/07/2017 at 15:22, Ludovic Desroches wrote: > A new compatible string is introduced for SMC on sama5d2 to manage a > different layout of the registers. > > Signed-off-by: Ludovic Desroches > Acked-by: Rob Herring Acked-by: Nicolas Ferre > --- > Documentation/devicetree/bindings/mfd/atmel-smc.txt | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/Documentation/devicetree/bindings/mfd/atmel-smc.txt > b/Documentation/devicetree/bindings/mfd/atmel-smc.txt > index 26eeed373934..1103ce2030fb 100644 > --- a/Documentation/devicetree/bindings/mfd/atmel-smc.txt > +++ b/Documentation/devicetree/bindings/mfd/atmel-smc.txt > @@ -8,6 +8,7 @@ Required properties: > - compatible:Should be one of the following > "atmel,at91sam9260-smc", "syscon" > "atmel,sama5d3-smc", "syscon" > + "atmel,sama5d2-smc", "syscon" > - reg: Contains offset/length value of the SMC memory > region. > > -- Nicolas Ferre
Re: [PATCH v2 3/3] ARM: dts: at91: sama5d2: use sama5d2 compatible string for SMC
On 18/07/2017 at 15:22, Ludovic Desroches wrote: > A new compatible string has been introduced for sama5d2 SMC to allow to > manage the registers mapping change. > > Signed-off-by: Ludovic Desroches Acked-by: Nicolas Ferre > --- > arch/arm/boot/dts/sama5d2.dtsi | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi > index cc06da394366..3e6e2dbc2595 100644 > --- a/arch/arm/boot/dts/sama5d2.dtsi > +++ b/arch/arm/boot/dts/sama5d2.dtsi > @@ -1048,7 +1048,7 @@ > }; > > hsmc: hsmc@f8014000 { > - compatible = "atmel,sama5d3-smc", "syscon", > "simple-mfd"; > + compatible = "atmel,sama5d2-smc", "syscon", > "simple-mfd"; > reg = <0xf8014000 0x1000>; > interrupts = <5 IRQ_TYPE_LEVEL_HIGH 6>; > clocks = <&hsmc_clk>; > -- Nicolas Ferre