[PATCH] ARM: dts: at91: sama5d2/trivial: fix letter case for etm hex address

2021-04-08 Thread nicolas.ferre
From: Nicolas Ferre 

Fix the etm node hex address to lower case for matching regexp
specification and removing the additional warning that looks like:

arch/arm/boot/dts/at91-sama5d2_ptc_ek.dt.yaml: /: 'etm@73C000' does not
match any of the regexes: '@(0|[1-9a-f][0-9a-f]*)$', '^[^@]+$',
'pinctrl-[0-9]+'

Reported-by: Arnd Bergmann 
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d2.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index a27294394508..801969c113d6 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -56,9 +56,9 @@ etb_in: endpoint {
};
};
 
-   etm@73C000 {
+   etm@73c000 {
compatible = "arm,coresight-etm3x", "arm,primecell";
-   reg = <0x73C000 0x1000>;
+   reg = <0x73c000 0x1000>;
 
clocks = < PMC_TYPE_CORE PMC_MCK>;
clock-names = "apb_pclk";
-- 
2.31.1



[GIT PULL] ARM: at91: dt for 5.13

2021-04-07 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

Here is first batch of dt changes for 5.13. Please pull.

Thanks, best regards,
  Nicolas

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git tags/at91-dt-5.13

for you to fetch changes up to 4d930c421e3b4f5bb3a9dd6b2eba2b15d458fcb5:

  ARM: dts: at91: sama5d2: add ETB and ETM unit name (2021-04-07 13:33:19 +0200)


AT91 dt for 5.13:

- two little fixes (typo, W=1)
- a change in gpio button keycode for recent boards


Bhaskar Chowdhury (1):
  ARM: dts: at91: Fix a typo

Ludovic Desroches (1):
  ARM: dts: at91: change the key code of the gpio key

Nicolas Ferre (1):
  ARM: dts: at91: sama5d2: add ETB and ETM unit name

 arch/arm/boot/dts/at91-sam9x60ek.dts  | 3 ++-
 arch/arm/boot/dts/at91-sama5d27_som1_ek.dts   | 3 ++-
 arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts | 3 ++-
 arch/arm/boot/dts/at91-sama5d2_icp.dts| 3 ++-
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 3 ++-
 arch/arm/boot/dts/at91-sama5d2_xplained.dts   | 3 ++-
 arch/arm/boot/dts/at91-sama5d3_xplained.dts   | 3 ++-
 arch/arm/boot/dts/at91sam9260ek.dts   | 3 ++-
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi   | 3 ++-
 arch/arm/boot/dts/sama5d2.dtsi| 4 ++--
 arch/arm/boot/dts/sama5d3.dtsi| 2 +-
 11 files changed, 21 insertions(+), 12 deletions(-)

-- 
Nicolas Ferre


[PATCH] ARM: dts: at91: sama5d2: add ETB and ETM unit name

2021-04-02 Thread nicolas.ferre
From: Nicolas Ferre 

Add unit address to the ETB and ETM nodes.

It also allow us to get rid of the warnings:
../arch/arm/boot/dts/sama5d2.dtsi:43.6-57.4: Warning
(unit_address_vs_reg): /etb: node has a reg or ranges property, but no
unit name
../arch/arm/boot/dts/sama5d2.dtsi:59.6-73.4: Warning
(unit_address_vs_reg): /etm: node has a reg or ranges property, but no
unit name
when we compile with W=1.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/sama5d2.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 2c4952427296..a27294394508 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -40,7 +40,7 @@ pmu {
interrupts = <2 IRQ_TYPE_LEVEL_HIGH 0>;
};
 
-   etb {
+   etb@74 {
compatible = "arm,coresight-etb10", "arm,primecell";
reg = <0x74 0x1000>;
 
@@ -56,7 +56,7 @@ etb_in: endpoint {
};
};
 
-   etm {
+   etm@73C000 {
compatible = "arm,coresight-etm3x", "arm,primecell";
reg = <0x73C000 0x1000>;
 
-- 
2.31.1



[PATCH] ARM: dts: at91: change the key code of the gpio key

2021-04-02 Thread nicolas.ferre
From: Ludovic Desroches 

Having a button code and not a key code causes issues with libinput.
udev won't set ID_INPUT_KEY. If it is forced, then it causes a bug
within libinput.

Signed-off-by: Ludovic Desroches 
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/at91-sam9x60ek.dts  | 3 ++-
 arch/arm/boot/dts/at91-sama5d27_som1_ek.dts   | 3 ++-
 arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts | 3 ++-
 arch/arm/boot/dts/at91-sama5d2_icp.dts| 3 ++-
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 3 ++-
 arch/arm/boot/dts/at91-sama5d2_xplained.dts   | 3 ++-
 arch/arm/boot/dts/at91-sama5d3_xplained.dts   | 3 ++-
 arch/arm/boot/dts/at91sam9260ek.dts   | 3 ++-
 arch/arm/boot/dts/at91sam9g20ek_common.dtsi   | 3 ++-
 9 files changed, 18 insertions(+), 9 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts 
b/arch/arm/boot/dts/at91-sam9x60ek.dts
index 73b6b1f89de9..f68284cdff54 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -8,6 +8,7 @@
  */
 /dts-v1/;
 #include "sam9x60.dtsi"
+#include 
 
 / {
model = "Microchip SAM9X60-EK";
@@ -84,7 +85,7 @@ gpio_keys {
sw1 {
label = "SW1";
gpios = < 18 GPIO_ACTIVE_LOW>;
-   linux,code=<0x104>;
+   linux,code=;
wakeup-source;
};
};
diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts 
b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
index 84e1180f3e89..a9e6fee55a2a 100644
--- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
+++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts
@@ -11,6 +11,7 @@
 #include "at91-sama5d27_som1.dtsi"
 #include 
 #include 
+#include 
 
 / {
model = "Atmel SAMA5D27 SOM1 EK";
@@ -466,7 +467,7 @@ gpio_keys {
pb4 {
label = "USER";
gpios = < PIN_PA29 GPIO_ACTIVE_LOW>;
-   linux,code = <0x104>;
+   linux,code = ;
wakeup-source;
};
};
diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts 
b/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts
index 180a08765cb8..ff83967fd008 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts
@@ -8,6 +8,7 @@
  */
 /dts-v1/;
 #include "at91-sama5d27_wlsom1.dtsi"
+#include 
 
 / {
model = "Microchip SAMA5D27 WLSOM1 EK";
@@ -35,7 +36,7 @@ gpio_keys {
sw4 {
label = "USER BUTTON";
gpios = < PIN_PB2 GPIO_ACTIVE_LOW>;
-   linux,code = <0x104>;
+   linux,code = ;
wakeup-source;
};
};
diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts 
b/arch/arm/boot/dts/at91-sama5d2_icp.dts
index 46722a163184..bd64721fa23c 100644
--- a/arch/arm/boot/dts/at91-sama5d2_icp.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts
@@ -12,6 +12,7 @@
 #include "sama5d2.dtsi"
 #include "sama5d2-pinfunc.h"
 #include 
+#include 
 #include 
 
 / {
@@ -51,7 +52,7 @@ gpio_keys {
sw4 {
label = "USER_PB1";
gpios = < PIN_PD0 GPIO_ACTIVE_LOW>;
-   linux,code = <0x104>;
+   linux,code = ;
wakeup-source;
};
};
diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts 
b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts
index 8de57d164acd..dfd150eb0fd8 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 
 #include 
 
 / {
@@ -402,7 +403,7 @@ gpio_keys {
bp1 {
label = "PB_USER";
gpios = < PIN_PA10 GPIO_ACTIVE_LOW>;
-   linux,code = <0x104>;
+   linux,code = ;
wakeup-source;
};
};
diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts 
b/arch/arm/boot/dts/at91-sama5d2_xplained.dts
index 4e7cf21f124c..509c732a0d8b 100644
--- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts
+++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts
@@ -10,6 +10,7 @@
 #include "sama5d2-pinfunc.h"
 #include 
 #include 
+#include 
 #include 
 
 / {
@@ -712,7 +713,7 @@ gpio_keys {
bp1 {
label = "PB_USER";
gpios = < PIN_PB9 GPIO_ACTIVE_LOW>;
-   linux,code = <0x104>;
+   linux,code = ;
wakeup-source;
};
};
diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts 
b/arch/arm/boot/dts/at91-sama5d3_xplained.dts
index 5179258f9247..9c55a921263b 100644
--- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts
+++ 

[GIT PULL] ARM: at91: defconfig for 5.13

2021-04-01 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

Here are the defconfig changes for 5.13 which is bigger than usual for aligning
with options that we use frequently and some changes which will be beneficial
for CI.
There is an update with savedefconfig included, tell me if you prefer the PR
without this first patch of the series.

Thanks, best regards,
  Nicolas

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git 
tags/at91-defconfig-5.13

for you to fetch changes up to 4136c4443efce6f028eca74885870ac649981da1:

  ARM: configs: at91: Modernize UBI defconfig part (2021-03-29 11:27:14 +0200)


AT91 defconfig for 5.13:

- aligment with recent kernel for sama5_defconfig
- move of 2 options to built-in
- addition of useful modules for validation and CI
- addition of Hantro G1 VPU from staging


Codrin Ciubotariu (1):
  ARM: configs: at91: sama5: Add audio MIKROE PROTO board

Emil Velikov (2):
  ARM: configs: at91: sama5: update with savedefconfig
  ARM: configs: at91: sama5: enable the Hantro G1 engine

Nicolas Ferre (4):
  ARM: configs: at91: sama5: MCP16502 regulator as built-in
  ARM: configs: at91: Add mtd tests as modules
  ARM: configs: at91: Add USB Video webcam class
  ARM: configs: at91: Modernize UBI defconfig part

Razvan Stefanescu (2):
  ARM: configs: at91: sama5: PIOBU as built-in
  ARM: configs: at91: sama5: Enable LAN78XX as module

 arch/arm/configs/at91_dt_defconfig |  5 +++-
 arch/arm/configs/sama5_defconfig   | 51 ---
 2 files changed, 33 insertions(+), 23 deletions(-)

-- 
Nicolas Ferre


[GIT PULL] ARM: at91: soc for 5.13

2021-04-01 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

One single patch for now on our SoC branch. Stakeholders agreed to make it
travel with at91 -> arm-soc.

Thanks, best regards,
  Nicolas

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git 
tags/at91-soc-5.13

for you to fetch changes up to 41dbf4a146a06443d1cbf39e238f02fa1ca9d626:

  ARM: at91: pm: Move prototypes to mutually included header (2021-03-26 
18:20:49 +0100)


AT91 soc for 5.13:

- Fixing a W=1 warning


Lee Jones (1):
  ARM: at91: pm: Move prototypes to mutually included header

 arch/arm/mach-at91/pm.c| 19 ---
 drivers/pinctrl/pinctrl-at91.c |  2 ++
 include/soc/at91/pm.h  | 16 
 3 files changed, 26 insertions(+), 11 deletions(-)
 create mode 100644 include/soc/at91/pm.h

-- 
Nicolas Ferre


[PATCH 7/7] ARM: configs: at91: Modernize UBI defconfig part

2021-03-29 Thread nicolas.ferre
From: Nicolas Ferre 

UBI_GLUEBI is not so common and UBI_FASTMAP is used for several years.
Make them part of a modernization of UBI defconfig options.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91_dt_defconfig | 2 +-
 arch/arm/configs/sama5_defconfig   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index e033d08c9cda..06c888a45eb3 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -54,7 +54,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_ATMEL=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_GLUEBI=y
+CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 99d167623940..17db3b3e2dd3 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -63,7 +63,7 @@ CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_ATMEL=y
 CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
-CONFIG_MTD_UBI_GLUEBI=y
+CONFIG_MTD_UBI_FASTMAP=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=4
-- 
2.31.1



[PATCH 6/7] ARM: configs: at91: Add USB Video webcam class

2021-03-29 Thread nicolas.ferre
From: Nicolas Ferre 

USB webcams are used during validation process, add them as modules.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91_dt_defconfig | 2 ++
 arch/arm/configs/sama5_defconfig   | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index a462d0ddaa2f..e033d08c9cda 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -132,6 +132,8 @@ CONFIG_MEDIA_SUPPORT_FILTER=y
 # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
 CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_MEDIA_PLATFORM_SUPPORT=y
+CONFIG_MEDIA_USB_SUPPORT=y
+CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_ATMEL_ISI=y
 CONFIG_VIDEO_OV2640=m
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index bb8c8000318b..99d167623940 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -147,6 +147,8 @@ CONFIG_MEDIA_SUPPORT_FILTER=y
 # CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
 CONFIG_MEDIA_CAMERA_SUPPORT=y
 CONFIG_MEDIA_PLATFORM_SUPPORT=y
+CONFIG_MEDIA_USB_SUPPORT=y
+CONFIG_USB_VIDEO_CLASS=m
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_ATMEL_ISC=y
 CONFIG_VIDEO_ATMEL_ISI=y
-- 
2.31.1



[PATCH 5/7] ARM: configs: at91: Add mtd tests as modules

2021-03-29 Thread nicolas.ferre
From: Nicolas Ferre 

Add MTD tests as they are used in CI and for validation plan.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91_dt_defconfig | 1 +
 arch/arm/configs/sama5_defconfig   | 1 +
 2 files changed, 2 insertions(+)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index 6403b064e8dc..a462d0ddaa2f 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -46,6 +46,7 @@ CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 CONFIG_MTD=y
+CONFIG_MTD_TESTS=m
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_DATAFLASH=y
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 774e25a7b246..bb8c8000318b 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -55,6 +55,7 @@ CONFIG_DEVTMPFS_MOUNT=y
 # CONFIG_STANDALONE is not set
 # CONFIG_PREVENT_FIRMWARE_BUILD is not set
 CONFIG_MTD=y
+CONFIG_MTD_TESTS=m
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
-- 
2.31.1



[PATCH 3/7] ARM: configs: at91: sama5: Enable LAN78XX as module

2021-03-29 Thread nicolas.ferre
From: Razvan Stefanescu 

Include this driver as the USB-Ethernet chip is present on SAMA5D2-ICP
board.

Signed-off-by: Razvan Stefanescu 
[nicolas.fe...@microchip.com: update commit subject and message]
Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/sama5_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 26222046a9cb..a528438ed678 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -89,6 +89,7 @@ CONFIG_MACB=y
 # CONFIG_NET_VENDOR_STMICRO is not set
 # CONFIG_NET_VENDOR_WIZNET is not set
 CONFIG_MICREL_PHY=y
+CONFIG_USB_LAN78XX=m
 CONFIG_LIBERTAS_THINFIRM=m
 CONFIG_LIBERTAS_THINFIRM_USB=m
 CONFIG_MWIFIEX=m
-- 
2.31.1



[PATCH 4/7] ARM: configs: at91: sama5: Add audio MIKROE PROTO board

2021-03-29 Thread nicolas.ferre
From: Codrin Ciubotariu 

Add this board as a module as it's useful for testing audio on multiple
AT91 boards.

Signed-off-by: Codrin Ciubotariu 
[nicolas.fe...@microchip.com: adap to newer kernel]
Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/sama5_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index a528438ed678..774e25a7b246 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -170,6 +170,7 @@ CONFIG_SND_ATMEL_SOC_CLASSD=y
 CONFIG_SND_ATMEL_SOC_PDMIC=y
 CONFIG_SND_ATMEL_SOC_TSE850_PCM5142=m
 CONFIG_SND_ATMEL_SOC_I2S=y
+CONFIG_SND_SOC_MIKROE_PROTO=m
 # CONFIG_HID_GENERIC is not set
 CONFIG_USB=y
 CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
-- 
2.31.1



[PATCH 2/7] ARM: configs: at91: sama5: PIOBU as built-in

2021-03-29 Thread nicolas.ferre
From: Razvan Stefanescu 

Include as built-in as it's used by multiple boards.

Signed-off-by: Razvan Stefanescu 
[nicolas.fe...@microchip.com: adap to newer kernel]
Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/sama5_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 72e58a835c37..26222046a9cb 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -123,7 +123,7 @@ CONFIG_SPI_ATMEL=y
 CONFIG_SPI_ATMEL_QUADSPI=y
 CONFIG_SPI_GPIO=y
 CONFIG_GPIO_SYSFS=y
-CONFIG_GPIO_SAMA5D2_PIOBU=m
+CONFIG_GPIO_SAMA5D2_PIOBU=y
 CONFIG_POWER_RESET=y
 CONFIG_POWER_SUPPLY=y
 CONFIG_BATTERY_ACT8945A=y
-- 
2.31.1



[PATCH 0/7] ARM: configs: at91: updates to defconfigs

2021-03-29 Thread nicolas.ferre
From: Nicolas Ferre 

Hi,

I collected some of the defconfig modifications that we carry in our vendor
tree for some time. They are interesting for both users and validation process 
as
most are part of validation plans or CI.

Don't hesitate to indicate missing pieces to add to this serries.

The base of this serries are patches by Emil Velikov as part of "[PATCH v2
00/10] Microship SAMA5D4 VPU support et al" and not included here. They will be
part of pull-request to ARM-SOC.

Best regards,
  Nicolas


Codrin Ciubotariu (1):
  ARM: configs: at91: sama5: Add audio MIKROE PROTO board

Nicolas Ferre (4):
  ARM: configs: at91: sama5: MCP16502 regulator as built-in
  ARM: configs: at91: Add mtd tests as modules
  ARM: configs: at91: Add USB Video webcam class
  ARM: configs: at91: Modernize UBI defconfig part

Razvan Stefanescu (2):
  ARM: configs: at91: sama5: PIOBU as built-in
  ARM: configs: at91: sama5: Enable LAN78XX as module

 arch/arm/configs/at91_dt_defconfig |  5 -
 arch/arm/configs/sama5_defconfig   | 11 ---
 2 files changed, 12 insertions(+), 4 deletions(-)

-- 
2.31.1



[PATCH 1/7] ARM: configs: at91: sama5: MCP16502 regulator as built-in

2021-03-29 Thread nicolas.ferre
From: Nicolas Ferre 

This regulator is needed by several SoC or external peripherals on
different boards, providing required power rails.  Make it built-in
to match usual use-cases.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/sama5_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 5bcf16aecf2f..72e58a835c37 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -138,7 +138,7 @@ CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_ACT8865=y
 CONFIG_REGULATOR_ACT8945A=y
-CONFIG_REGULATOR_MCP16502=m
+CONFIG_REGULATOR_MCP16502=y
 CONFIG_REGULATOR_PWM=m
 CONFIG_MEDIA_SUPPORT=y
 CONFIG_MEDIA_SUPPORT_FILTER=y
-- 
2.31.1



[GIT PULL] ARM: at91: fixes for 5.12

2021-03-10 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

Here are some fixes for 5.12. It's not regression vs. previous revision, this
is why I send them early in the cycle.
I based my branch on top of 5.12-rc2 because I noticed that your "master"
branch was pointing to it (and of course the "-dontuse" suffix from Linus).
Tell me if you prefer that I use a more usual "-rc1".

Thanks, best regards,
  Nicolas

The following changes since commit a38fd8748464831584a19438cbb3082b5a2dab15:

  Linux 5.12-rc2 (2021-03-05 17:33:41 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git 
tags/at91-fixes-5.12

for you to fetch changes up to 2c69c8a1736eace8de491d480e6e577a27c2087c:

  ARM: dts: at91: sam9x60: fix mux-mask to match product's datasheet 
(2021-03-10 16:38:15 +0100)


AT91 fixes for 5.12:

- only DT changes
-- wrong phy address that blocks Ethernet use on boards with sama5d27 SoM1
-- restrictive PIN possibilities for sam9x60


Claudiu Beznea (1):
  ARM: dts: at91-sama5d27_som1: fix phy address to 7

Federico Pellegrin (1):
  ARM: dts: at91: sam9x60: fix mux-mask for PA7 so it can be set to A, B 
and C

Nicolas Ferre (1):
  ARM: dts: at91: sam9x60: fix mux-mask to match product's datasheet

 arch/arm/boot/dts/at91-sam9x60ek.dts  | 8 
 arch/arm/boot/dts/at91-sama5d27_som1.dtsi | 4 ++--
 arch/arm/boot/dts/sam9x60.dtsi| 9 +
 3 files changed, 11 insertions(+), 10 deletions(-)

-- 
Nicolas Ferre


[PATCH v2] ARM: dts: at91: sam9x60: fix mux-mask to match product's datasheet

2021-03-10 Thread nicolas.ferre
From: Nicolas Ferre 

Fix the whole mux-mask table according to datasheet for the sam9x60
product.  Too much functions for pins were disabled leading to
misunderstandings when enabling more peripherals or taking this table
as an example for another board.
Take advantage of this fix to move the mux-mask in the SoC file where it
belongs and use lower case letters for hex numbers like everywhere in
the file.

Signed-off-by: Nicolas Ferre 
Fixes: 1e5f532c2737 ("ARM: dts: at91: sam9x60: add device tree for soc and 
board")
Cc:  # 5.6+
Cc: Sandeep Sheriker Mallikarjun 
---
v1 -> v2:
- move to SoC dtsi file: it applies to all boards using the sam9x60 SoC version
- use lower case for hex numbers instead of mixed nonsense

 arch/arm/boot/dts/at91-sam9x60ek.dts | 8 
 arch/arm/boot/dts/sam9x60.dtsi   | 9 +
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts 
b/arch/arm/boot/dts/at91-sam9x60ek.dts
index 4c40ae571154..775ceb3acb6c 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -334,14 +334,6 @@ ethernet-phy@0 {
 };
 
  {
-   atmel,mux-mask = <
-/* A   B   C   */
-0xFEFF 0xC0E039FF 0xEF00019D   /* pioA */
-0x03FF 0x02FC7E68 0x0078   /* pioB */
-0x 0xF83F 0xB800F3FC   /* pioC */
-0x003F 0x003F8000 0x   /* pioD */
->;
-
adc {
pinctrl_adc_default: adc_default {
atmel,pins = ;
diff --git a/arch/arm/boot/dts/sam9x60.dtsi b/arch/arm/boot/dts/sam9x60.dtsi
index 84066c1298df..ec45ced3cde6 100644
--- a/arch/arm/boot/dts/sam9x60.dtsi
+++ b/arch/arm/boot/dts/sam9x60.dtsi
@@ -606,6 +606,15 @@ pinctrl: pinctrl@f400 {
compatible = "microchip,sam9x60-pinctrl", 
"atmel,at91sam9x5-pinctrl", "atmel,at91rm9200-pinctrl", "simple-bus";
ranges = <0xf400 0xf400 0x800>;
 
+   /* mux-mask corresponding to sam9x60 SoC in 
TFBGA228L package */
+   atmel,mux-mask = <
+/* A   B   C   
*/
+0x 0xffe03fff 
0xef00019d   /* pioA */
+0x03ff 0x02fc7e7f 
0x0078   /* pioB */
+0x 0x 
0xf83f   /* pioC */
+0x003f 0x003f8000 
0x   /* pioD */
+>;
+
pioA: gpio@f400 {
compatible = "microchip,sam9x60-gpio", 
"atmel,at91sam9x5-gpio", "atmel,at91rm9200-gpio";
reg = <0xf400 0x200>;
-- 
2.30.2



[PATCH] ARM: dts: at91: sam9x60: fix mux-mask to match product's datasheet

2021-03-08 Thread nicolas.ferre
From: Nicolas Ferre 

Fix the whole mux-mask table according to datasheet for the sam9x60
product.  Too much functions for pins were disabled leading to
misunderstandings when enabling more peripherals or taking this table
as an example for another board.

Signed-off-by: Nicolas Ferre 
Fixes: 1e5f532c2737 ("ARM: dts: at91: sam9x60: add device tree for soc and 
board")
Cc:  # 5.6+
Cc: Sandeep Sheriker Mallikarjun 
---
 arch/arm/boot/dts/at91-sam9x60ek.dts | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts 
b/arch/arm/boot/dts/at91-sam9x60ek.dts
index 4c40ae571154..63207c952223 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -336,9 +336,9 @@ ethernet-phy@0 {
  {
atmel,mux-mask = <
 /* A   B   C   */
-0xFEFF 0xC0E039FF 0xEF00019D   /* pioA */
-0x03FF 0x02FC7E68 0x0078   /* pioB */
-0x 0xF83F 0xB800F3FC   /* pioC */
+0x 0xFFE03FFF 0xEF00019D   /* pioA */
+0x03FF 0x02FC7E7F 0x0078   /* pioB */
+0x 0x 0xF83F   /* pioC */
 0x003F 0x003F8000 0x   /* pioD */
 >;
 
-- 
2.30.1



[PATCH] ARM: dts: at91: sam9x60: fix mux-mask for PA7 so it can be set to A, B and C

2021-02-18 Thread nicolas.ferre
From: Federico Pellegrin 

According to the datasheet PA7 can be set to either function A, B or
C (see table 6-2 of DS60001579D). The previous value would permit just
configuring with function C.

Signed-off-by: Federico Pellegrin 
Fixes: 1e5f532c2737 ("ARM: dts: at91: sam9x60: add device tree for soc and 
board")
Cc:  # 5.6+
Cc: Sandeep Sheriker Mallikarjun 
Signed-off-by: Nicolas Ferre 
---
 arch/arm/boot/dts/at91-sam9x60ek.dts | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/at91-sam9x60ek.dts 
b/arch/arm/boot/dts/at91-sam9x60ek.dts
index 73b6b1f89de9..4c40ae571154 100644
--- a/arch/arm/boot/dts/at91-sam9x60ek.dts
+++ b/arch/arm/boot/dts/at91-sam9x60ek.dts
@@ -336,7 +336,7 @@ ethernet-phy@0 {
  {
atmel,mux-mask = <
 /* A   B   C   */
-0xFE7F 0xC0E0397F 0xEF00019D   /* pioA */
+0xFEFF 0xC0E039FF 0xEF00019D   /* pioA */
 0x03FF 0x02FC7E68 0x0078   /* pioB */
 0x 0xF83F 0xB800F3FC   /* pioC */
 0x003F 0x003F8000 0x   /* pioD */
-- 
2.30.0



[PATCH] ARM: dts: at91-sama5d27_som1: fix phy address to 7

2021-02-17 Thread nicolas.ferre
From: Claudiu Beznea 

Fix the phy address to 7 for Ethernet PHY on SAMA5D27 SOM1. No
connection established if phy address 0 is used.

The board uses the 24 pins version of the KSZ8081RNA part, KSZ8081RNA
pin 16 REFCLK as PHYAD bit [2] has weak internal pull-down.  But at
reset, connected to PD09 of the MPU it's connected with an internal
pull-up forming PHYAD[2:0] = 7.

Signed-off-by: Claudiu Beznea 
Fixes: 2f61929eb10a ("ARM: dts: at91: at91-sama5d27_som1: fix PHY ID")
Cc: Ludovic Desroches 
Signed-off-by: Nicolas Ferre 
Cc:  # 4.14+
---
 arch/arm/boot/dts/at91-sama5d27_som1.dtsi | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d27_som1.dtsi 
b/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
index 1b1163858b1d..e3251f3e3eaa 100644
--- a/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_som1.dtsi
@@ -84,8 +84,8 @@ macb0: ethernet@f8008000 {
pinctrl-0 = <_macb0_default>;
phy-mode = "rmii";
 
-   ethernet-phy@0 {
-   reg = <0x0>;
+   ethernet-phy@7 {
+   reg = <0x7>;
interrupt-parent = <>;
interrupts = ;
pinctrl-names = "default";
-- 
2.30.0



[GIT PULL] ARM: at91: defconfig for 5.12 #2

2021-02-08 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

Here is the second batch of defconfig changes for 5.12.

Thanks, best regards,
  Nicolas

The following changes since commit 00a1aa475f507454fab82f02c6230c8fb2312a12:

  ARM: configs: multi_{v5,v7}: remove ATMEL_TCLIB (2021-01-02 14:06:48 +0100)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git 
tags/at91-defconfig-5.11-2

for you to fetch changes up to b33f4da7b3efcb7521399d5e18cdd15e60ab34df:

  ARM: configs: sama5_defconfig: add QSPI driver (2021-02-08 09:55:00 +0100)


AT91 defconfig for 5.12, part 2:

- only at91_dt_defconfig and sama5_defconfig modified
- update to match current options, unneeded options removed
- missing drivers added, some are on-SoC peripherals, some are helpers
- modify legacy ATAGS or DT options to match common usage


Claudiu Beznea (1):
  ARM: configs: at91: enable drivers for sam9x60

Nicolas Ferre (5):
  ARM: configs: sama5_defconfig: update and remove unneeded options
  ARM: configs: at91: DT/ATAG defconfig modifications
  ARM: configs: at91_dt_defconfig: add useful helper options
  ARM: configs: at91_dt_defconfig: add ov7740 module
  ARM: configs: sama5_defconfig: add QSPI driver

 arch/arm/configs/at91_dt_defconfig | 17 -
 arch/arm/configs/sama5_defconfig   | 14 ++
 2 files changed, 14 insertions(+), 17 deletions(-)

-- 
Nicolas Ferre


[PATCH] ARM: configs: sama5_defconfig: add QSPI driver

2021-02-08 Thread nicolas.ferre
From: Nicolas Ferre 

Add Quad SPI driver to the sama5 defconfig. This driver is needed for
sama5d2 SoC.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/sama5_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index b72bd38a1c45..f4c3c0652432 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -121,6 +121,7 @@ CONFIG_I2C_AT91=y
 CONFIG_I2C_GPIO=y
 CONFIG_SPI=y
 CONFIG_SPI_ATMEL=y
+CONFIG_SPI_ATMEL_QUADSPI=y
 CONFIG_SPI_GPIO=y
 CONFIG_GPIO_SYSFS=y
 CONFIG_GPIO_SAMA5D2_PIOBU=m
-- 
2.30.0



[PATCH] ARM: configs: at91_dt_defconfig: add ov7740 module

2021-02-05 Thread nicolas.ferre
From: Nicolas Ferre 

Add OV7740 as a module as it's useful testing camera sensors on
sam9x60ek for instance. Unify with sama5_defconfig as well.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91_dt_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index 690c0c158a94..6403b064e8dc 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -134,6 +134,7 @@ CONFIG_MEDIA_PLATFORM_SUPPORT=y
 CONFIG_V4L_PLATFORM_DRIVERS=y
 CONFIG_VIDEO_ATMEL_ISI=y
 CONFIG_VIDEO_OV2640=m
+CONFIG_VIDEO_OV7740=m
 CONFIG_VIDEO_MT9V032=m
 CONFIG_DRM=y
 CONFIG_DRM_ATMEL_HLCDC=y
-- 
2.30.0



[PATCH 1/3] ARM: configs: sama5_defconfig: update and remove unneeded options

2021-02-05 Thread nicolas.ferre
From: Nicolas Ferre 

Kconfig options are not present anymore or selected by default: remove
them from sama5_defconfig.
No change to kernel compilation expected.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/sama5_defconfig | 11 ---
 1 file changed, 11 deletions(-)

diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index d3e0d4d79424..64573caa0ecd 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -1,7 +1,6 @@
 # CONFIG_LOCALVERSION_AUTO is not set
 # CONFIG_SWAP is not set
 CONFIG_SYSVIPC=y
-CONFIG_FHANDLE=y
 CONFIG_NO_HZ_IDLE=y
 CONFIG_HIGH_RES_TIMERS=y
 CONFIG_LOG_BUF_SHIFT=14
@@ -19,10 +18,7 @@ CONFIG_SOC_SAMA5D2=y
 CONFIG_SOC_SAMA5D3=y
 CONFIG_SOC_SAMA5D4=y
 # CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
-CONFIG_AEABI=y
 CONFIG_UACCESS_WITH_MEMCPY=y
-CONFIG_ZBOOT_ROM_TEXT=0x0
-CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x2110,25165824 root=/dev/ram0 
rw"
 CONFIG_KEXEC=y
@@ -41,13 +37,7 @@ CONFIG_IP_PNP=y
 CONFIG_IP_PNP_DHCP=y
 CONFIG_IP_PNP_BOOTP=y
 CONFIG_IP_PNP_RARP=y
-# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_INET_DIAG is not set
-# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
-# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
-# CONFIG_INET6_XFRM_MODE_BEET is not set
 CONFIG_IPV6_SIT_6RD=y
 CONFIG_BRIDGE=m
 CONFIG_BRIDGE_VLAN_FILTERING=y
@@ -68,7 +58,6 @@ CONFIG_MTD=y
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
-CONFIG_MTD_M25P80=y
 CONFIG_MTD_RAW_NAND=y
 CONFIG_MTD_NAND_ATMEL=y
 CONFIG_MTD_SPI_NOR=y
-- 
2.30.0



[PATCH 3/3] ARM: configs: at91_dt_defconfig: add useful helper options

2021-02-05 Thread nicolas.ferre
From: Nicolas Ferre 

Add GPIO, SPI and I2C options that were missing from the
at91_dt_defconfig whereas they were in sama5_defconfig. It unifies all
AT91 defconfigs with same set of useful options.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91_dt_defconfig | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index 3e4adbd30a53..edd888214873 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -107,10 +107,13 @@ CONFIG_LEGACY_PTY_COUNT=4
 CONFIG_SERIAL_ATMEL=y
 CONFIG_SERIAL_ATMEL_CONSOLE=y
 CONFIG_HW_RANDOM=y
+CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_AT91=y
 CONFIG_I2C_GPIO=y
 CONFIG_SPI=y
 CONFIG_SPI_ATMEL=y
+CONFIG_SPI_GPIO=y
+CONFIG_GPIO_SYSFS=y
 CONFIG_SPI_ATMEL_QUADSPI=y
 CONFIG_PINCTRL_MCP23S08=m
 CONFIG_POWER_RESET=y
-- 
2.30.0



[PATCH 2/3] ARM: configs: at91: DT/ATAG defconfig modifications

2021-02-05 Thread nicolas.ferre
From: Nicolas Ferre 

As all AT91 platforms are converted to DT for a long time, adapt the
defconfigs by:
- removing legacy CONFIG_ATAGS as a DT will always be provided;
- removing the CONFIG_ARM_APPENDED_DTB option on SAMA5 devices as the
  vast majority of systems will use a DT-aware bootloader on these
  devices.

Signed-off-by: Nicolas Ferre 
---
 arch/arm/configs/at91_dt_defconfig | 1 +
 arch/arm/configs/sama5_defconfig   | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/arm/configs/at91_dt_defconfig 
b/arch/arm/configs/at91_dt_defconfig
index e274f8c492d2..3e4adbd30a53 100644
--- a/arch/arm/configs/at91_dt_defconfig
+++ b/arch/arm/configs/at91_dt_defconfig
@@ -17,6 +17,7 @@ CONFIG_SOC_SAM9X60=y
 # CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
 CONFIG_AEABI=y
 CONFIG_UACCESS_WITH_MEMCPY=y
+# CONFIG_ATAGS is not set
 CONFIG_ARM_APPENDED_DTB=y
 CONFIG_ARM_ATAG_DTB_COMPAT=y
 CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x2110,25165824 root=/dev/ram0 
rw"
diff --git a/arch/arm/configs/sama5_defconfig b/arch/arm/configs/sama5_defconfig
index 64573caa0ecd..b72bd38a1c45 100644
--- a/arch/arm/configs/sama5_defconfig
+++ b/arch/arm/configs/sama5_defconfig
@@ -19,7 +19,7 @@ CONFIG_SOC_SAMA5D3=y
 CONFIG_SOC_SAMA5D4=y
 # CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
 CONFIG_UACCESS_WITH_MEMCPY=y
-CONFIG_ARM_APPENDED_DTB=y
+# CONFIG_ATAGS is not set
 CONFIG_CMDLINE="console=ttyS0,115200 initrd=0x2110,25165824 root=/dev/ram0 
rw"
 CONFIG_KEXEC=y
 CONFIG_VFP=y
-- 
2.30.0



[GIT PULL] ARM: at91: dt for 5.12

2021-01-22 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

Here is the first batch of dt changes for 5.12. As for the SoC PR, I plan to do
another one by mid-next-week. Tell me if it's fine with you.

Thanks, best regards,

The following changes since commit 5c8fe583cce542aa0b84adc939ce85293de36e5e:

  Linux 5.11-rc1 (2020-12-27 15:30:22 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git tags/at91-dt-5.12

for you to fetch changes up to 53efdfbb3b5f91c3db151243e090f755ee48219d:

  ARM: dts: at91: sama5d2: remove atmel,wakeup-type references (2021-01-22 
13:31:51 +0100)


AT91 DT for 5.12:

- removing a property never documented nor used
- adding i2c recovery GPI for one more board


Claudiu Beznea (1):
  ARM: dts: at91: sama5d2: remove atmel,wakeup-type references

Nicolas Ferre (1):
  ARM: dts: at91-sama5d27_wlsom1: add i2c recovery

 arch/arm/boot/dts/at91-kizbox3_common.dtsi|  1 -
 arch/arm/boot/dts/at91-sama5d27_som1_ek.dts   |  1 -
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi   | 22 --
 arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts |  1 -
 arch/arm/boot/dts/at91-sama5d2_icp.dts|  1 -
 arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts |  1 -
 arch/arm/boot/dts/at91-sama5d2_xplained.dts   |  1 -
 7 files changed, 20 insertions(+), 8 deletions(-)

-- 
Nicolas Ferre


[GIT PULL] ARM: at91: defconfig for 5.12

2021-01-22 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

Here are the defconfig changes for 5.12 which contains the removal of old
wrapper code that we called tclib. No such config option to be used anymore in
next kernel.

Thanks, best regards,

The following changes since commit 5c8fe583cce542aa0b84adc939ce85293de36e5e:

  Linux 5.11-rc1 (2020-12-27 15:30:22 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git 
tags/at91-defconfig-5.12

for you to fetch changes up to 00a1aa475f507454fab82f02c6230c8fb2312a12:

  ARM: configs: multi_{v5,v7}: remove ATMEL_TCLIB (2021-01-02 14:06:48 +0100)


AT91 defconfig for 5.12:

- remove ATMEL_TCLIB as the driver was deleted


Alexandre Belloni (2):
  ARM: configs: at91: remove ATMEL_TCLIB
  ARM: configs: multi_{v5,v7}: remove ATMEL_TCLIB

 arch/arm/configs/at91_dt_defconfig  | 1 -
 arch/arm/configs/multi_v5_defconfig | 1 -
 arch/arm/configs/multi_v7_defconfig | 1 -
 arch/arm/configs/sama5_defconfig| 1 -
 4 files changed, 4 deletions(-)

-- 
Nicolas Ferre


[GIT PULL] ARM: at91: soc for 5.12

2021-01-22 Thread nicolas.ferre
From: Nicolas Ferre 

Arnd, Olof,

I'm taking back the lead on sending the pull-requests for AT91 and hope that I
didn't loose the knowledge in the meantime. Tell me if there's something I'm
missing. Thanks a lot to Alexandre who kept our flow steady and very
predictable during all those years!

Here are the first SoC changes for 5.12 which contain a single patch for multi
platform kernels.

I plan to send another pull-request for the SoC changes related to new sama7g5
that Claudiu sent to the mainling-list recently. I'll let it mature in
linux-next by the beginning of next week and will send another pull-request by
mid-next-week.
Tell me if you see a problem with this approach.

Thanks, best regards,

The following changes since commit 5c8fe583cce542aa0b84adc939ce85293de36e5e:

  Linux 5.11-rc1 (2020-12-27 15:30:22 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/at91/linux.git 
tags/at91-soc-5.12

for you to fetch changes up to 960ddf70cc11024e6e9dac206316d0160e00a77d:

  drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs (2020-12-28 
17:58:20 +0100)


AT91 SoC for 5.12

 - Only call atmel/soc.c driver on AT91 platforms


Sudeep Holla (1):
  drivers: soc: atmel: Avoid calling at91_soc_init on non AT91 SoCs

 drivers/soc/atmel/soc.c | 12 
 1 file changed, 12 insertions(+)

-- 
Nicolas Ferre


[PATCH] ARM: dts: at91-sama5d27_wlsom1: add i2c recovery

2021-01-17 Thread nicolas.ferre
From: Nicolas Ferre 

Add the i2c gpio pinctrls to support the i2c bus recovery on this board.

Signed-off-by: Nicolas Ferre 
Reviewed-by: Codrin Ciubotariu 
---
 arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 22 +++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi 
b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
index a06700e53e4c..025a78310e3a 100644
--- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
+++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi
@@ -43,14 +43,20 @@ uart6: serial@200 {
 
  {
pinctrl-0 = <_i2c0_default>;
-   pinctrl-names = "default";
+   pinctrl-1 = <_i2c0_gpio>;
+   pinctrl-names = "default", "gpio";
+   sda-gpios = < PIN_PD21 GPIO_ACTIVE_HIGH>;
+   scl-gpios = < PIN_PD22 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
status = "okay";
 };
 
  {
dmas = <0>, <0>;
-   pinctrl-names = "default";
+   pinctrl-names = "default", "gpio";
pinctrl-0 = <_i2c1_default>;
+   pinctrl-1 = <_i2c1_gpio>;
+   sda-gpios = < PIN_PD19 GPIO_ACTIVE_HIGH>;
+   scl-gpios = < PIN_PD20 (GPIO_ACTIVE_HIGH | GPIO_OPEN_DRAIN)>;
status = "okay";
 
mcp16502@5b {
@@ -258,12 +264,24 @@ pinctrl_i2c0_default: i2c0_default {
bias-disable;
};
 
+   pinctrl_i2c0_gpio: i2c0_gpio {
+   pinmux = ,
+;
+   bias-disable;
+   };
+
pinctrl_i2c1_default: i2c1_default {
pinmux = ,
 ;
bias-disable;
};
 
+   pinctrl_i2c1_gpio: i2c1_gpio {
+   pinmux = ,
+;
+   bias-disable;
+   };
+
pinctrl_macb0_default: macb0_default {
pinmux = ,
 ,
-- 
2.30.0



[PATCH] ARM: dts: at91: sama5d2: fix CAN message ram offset and size

2020-12-03 Thread nicolas.ferre
From: Nicolas Ferre 

CAN0 and CAN1 instances share the same message ram configured
at 0x21 on sama5d2 Linux systems.
According to current configuration of CAN0, we need 0x1c00 bytes
so that the CAN1 don't overlap its message ram:
64 x RX FIFO0 elements => 64 x 72 bytes
32 x TXE (TX Event FIFO) elements => 32 x 8 bytes
32 x TXB (TX Buffer) elements => 32 x 72 bytes
So a total of 7168 bytes (0x1C00).

Fix offset to match this needed size.
Make the CAN0 message ram ioremap match exactly this size so that is
easily understandable.  Adapt CAN1 size accordingly.

Reported-by: Dan Sneddon 
Signed-off-by: Nicolas Ferre 
Tested-by: Cristian Birsan 
Fixes: bc6d5d7666b7 ("ARM: dts: at91: sama5d2: add m_can nodes")
Cc: sta...@vger.kernel.org # v4.13+
---
 arch/arm/boot/dts/sama5d2.dtsi | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
index 2ddc85dff8ce..8f3c40e5b7ca 100644
--- a/arch/arm/boot/dts/sama5d2.dtsi
+++ b/arch/arm/boot/dts/sama5d2.dtsi
@@ -724,7 +724,7 @@ AT91_XDMAC_DT_PERID(31))>,
 
can0: can@f8054000 {
compatible = "bosch,m_can";
-   reg = <0xf8054000 0x4000>, <0x21 0x4000>;
+   reg = <0xf8054000 0x4000>, <0x21 0x1c00>;
reg-names = "m_can", "message_ram";
interrupts = <56 IRQ_TYPE_LEVEL_HIGH 7>,
 <64 IRQ_TYPE_LEVEL_HIGH 7>;
@@ -1130,7 +1130,7 @@ AT91_XDMAC_DT_PERID(33))>,
 
can1: can@fc05 {
compatible = "bosch,m_can";
-   reg = <0xfc05 0x4000>, <0x21 0x4000>;
+   reg = <0xfc05 0x4000>, <0x21 0x3800>;
reg-names = "m_can", "message_ram";
interrupts = <57 IRQ_TYPE_LEVEL_HIGH 7>,
 <65 IRQ_TYPE_LEVEL_HIGH 7>;
@@ -1140,7 +1140,7 @@ can1: can@fc05 {
assigned-clocks = < PMC_TYPE_GCK 57>;
assigned-clock-parents = < PMC_TYPE_CORE 
PMC_UTMI>;
assigned-clock-rates = <4000>;
-   bosch,mram-cfg = <0x1100 0 0 64 0 0 32 32>;
+   bosch,mram-cfg = <0x1c00 0 0 64 0 0 32 32>;
status = "disabled";
};
 
-- 
2.29.2



Re: [PATCH v3] MAINTAINERS: Add Kamel Bouhara as TCB counter driver maintainer

2020-11-23 Thread Nicolas.Ferre
On 21/11/2020 at 19:58, William Breathitt Gray wrote:
> Acked-by: Kamel Bouhara 
> Signed-off-by: William Breathitt Gray 
> ---
>   Changes in v3:
>- Reorder entries to match preferred MAINTAINERS ordering
> 
>   MAINTAINERS | 7 +++
>   1 file changed, 7 insertions(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 913b5eb64e44..1ee380dfe189 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -2104,6 +2104,13 @@ S:   Supported
>   F: arch/arm64/boot/dts/microchip/
>   N: sparx5
> 
> +ARM/Microchip Timer Counter Block (TCB) Capture Driver

Nit: we don't use the ARM/Microchip string for drivers which could be 
multi-architecture. Only AT91 and Sparx5 families have these entries.

I'm not holding the patch for this:
Acked-by: Nicolas Ferre 

> +M: Kamel Bouhara 
> +L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
> +L: linux-...@vger.kernel.org
> +S: Maintained
> +F: drivers/counter/microchip-tcb-capture.c
> +
>   ARM/MIOA701 MACHINE SUPPORT
>   M: Robert Jarzmik 
>   L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
> --
> 2.29.2
> 
> 
> ___
> linux-arm-kernel mailing list
> linux-arm-ker...@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
> 


-- 
Nicolas Ferre


net: macb: linux-next: null pointer dereference in phylink_major_config()

2020-11-04 Thread Nicolas.Ferre
Hi,

Heads-up on this kernel Oops that happened and has been observed on
linux-next since 20201103 and was not existing in 20201030.

I didn't went further until now but wanted to report it
as soon as possible.
Could it be related to newly included patch
e4e143e26ce8 ("net: macb: add support for high speed interface")?

Tell us if you saw it on other platforms or if you couldn't reproduce it.

[..]
Linux version 5.10.0-rc2-next-20201104 (root@linux-ci-43h78-cjbps) 
(arm-linux-gnueabihf-gcc (GNU Toolchain for the A-profile Architecture 
8.3-2019.03 (arm-rel-8.36)) 8.3.0, GNU ld (GNU Toolchain for the A-profile 
Architecture 8.3-2019.03 (arm-rel-8.36)) 2.32.0.20190321) #2 Wed Nov 4 07:31:39 
UTC 2020

[..]
OF: fdt: Machine model: Atmel SAMA5D4 Xplained

[..]
libphy: Fixed MDIO Bus: probed
libphy: MACB_mii_bus: probed
macb f802.ethernet eth0: Cadence GEM rev 0x00020120 at 0xf802 irq 27 
(fc:c2:3d:0d:eb:27)

[..]

Configuring network interfaces...
macb f802.ethernet eth0: PHY [f802.ethernet-:01] driver [Micrel 
KSZ8081 or KSZ8091] (irq=46)
macb f802.ethernet eth0: configuring for phy/rmii link mode
8<--- cut here ---
Unable to handle kernel NULL pointer dereference at virtual address 
pgd = 8fd7a220
[] *pgd=
Internal error: Oops: 8005 [#1] ARM
Modules linked in:
CPU: 0 PID: 250 Comm: ip Not tainted 5.10.0-rc2-next-20201104 #2
Hardware name: Atmel SAMA5
PC is at 0x0
LR is at phylink_major_config+0x84/0x1a8
pc : [<>]lr : []psr: a0050013
sp : c1cdb8f0  ip : c09530c4  fp : c09530d4
r10: c12204e0  r9 :   r8 : 0001
r7 : 0001  r6 :   r5 : c1cdb918  r4 : c1266800
r3 : c1cdb918  r2 : 0007  r1 :   r0 : c1221100
Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment none
Control: 10c53c7d  Table: 21d60059  DAC: 0051
Process ip (pid: 250, stack limit = 0x362b1cfa)
Stack: (0xc1cdb8f0 to 0xc1cdc000)
b8e0: 0001 c0a58564 c1cdb8f0 c1266800
b900: c0d03208 c1cdb918 c122 c050b3c8 c0a4bc38   
b920:     0007  00ff 
b940:  a0250c4f c12204e0  dfbf0318 c051c450 c12206a4 c122
b960: c1221000 c1220668 0001 c051fbac  fff1 c122 c0d03208
b980: c09530d4 c1cdbd48 1002 c1cdbd48 c1cdbd48 c064af9c  
b9a0:  c122 c1cdbd48 a0250c4f  c122 0001 1003
b9c0: c0d03208 c064b368      a0250c4f
b9e0:  c122 1002  c1220138 c1cdbc68 c1082810 c064b3e0
ba00: c0d03208 c1cdbb88 c122 c1d29900 c1cdbc68 c0656f20  
ba20:        
ba40:        
ba60:  a0250c4f  c1082820 c1d29900 c1082800 c1cdbd48 a0250c4f
ba80: c1cdbd48 c1082800 c122  c1cdbd48   
baa0: c097c1dc c065d2c4 c1cdbb88 c1cdbc68  c122 c0d3cce0 c1082810
bac0:  c0d03208 c1d44a00 c1d29900 0009 c070df20 c1d29900 
bae0:       c1bd c0d3d72c
bb00: 0180 c03a6a70 c1d29900 c1bd03c0 c1d29900 c03a6ab4 c1d29900 c065c0d0
bb20: 0003 a0250c4f c0656170 c1cdbb54 c0d03208 c068a824 f601f5ae c101e000
bb40: c1cdbb38 0004 0294  0001  c068a2c8 c0688238
bb60: c1cc7c00 c0d03208 a0250c4f c1cc7c00 c1d29900 03bc c1087400 c1087564
bb80: f601f5ae c0d03208      
bba0:        
bbc0:        
bbe0:        
bc00:        
bc20:        
bc40:        
bc60:   c1082800     
bc80:        
bca0:   c0d03208 c064ce3c  a0250c4f  c1d44a00
bcc0: c1d29900 c1082800 c1cdbd48 c1d29900 c1cdbd48 c1082800 c0d5fb34 c065d548
bce0:   c0d03208 c0d5fb34 c1d29900 c0657e90 c1d09ac0 c10800c0
bd00: c0d03208 c1cdbf60 03bc c0d03208 c1d41bbc c1cdbd3c c0d03208 a0250c4f
bd20:  c1d29900 c0d03208 c0657c48 c1082800 0020  c0d03208
bd40:  c068cb10      
bd60:    a0250c4f c1087400 0020 c1d29900 c1cc7400
bd80: c1cc7564 c068c270 7fff a0250c4f 0008 c1cdbf58 c0d03208 c1cc7400
bda0: c1d29900 0020  c068c4d8 0001 c035ca40  c1cdbe64
bdc0:  c1cdbe64 

[PATCH] ARM: at91: sam9x60 SiP types added to soc description

2020-10-08 Thread nicolas.ferre
From: Kai Stuhlemmer 

Adding SAM9X60 SIP variants to the soc description list.

Signed-off-by: Kai Stuhlemmer 
Signed-off-by: Nicolas Ferre 
---
 drivers/soc/atmel/soc.c | 6 ++
 drivers/soc/atmel/soc.h | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/drivers/soc/atmel/soc.c b/drivers/soc/atmel/soc.c
index 55a1f57a4d8c..c4472b68b7c2 100644
--- a/drivers/soc/atmel/soc.c
+++ b/drivers/soc/atmel/soc.c
@@ -69,6 +69,12 @@ static const struct at91_soc __initconst socs[] = {
 #endif
 #ifdef CONFIG_SOC_SAM9X60
AT91_SOC(SAM9X60_CIDR_MATCH, SAM9X60_EXID_MATCH, "sam9x60", "sam9x60"),
+   AT91_SOC(SAM9X60_CIDR_MATCH, SAM9X60_D5M_EXID_MATCH,
+"sam9x60 64MiB DDR2 SiP", "sam9x60"),
+   AT91_SOC(SAM9X60_CIDR_MATCH, SAM9X60_D1G_EXID_MATCH,
+"sam9x60 128MiB DDR2 SiP", "sam9x60"),
+   AT91_SOC(SAM9X60_CIDR_MATCH, SAM9X60_D6K_EXID_MATCH,
+"sam9x60 8MiB SDRAM SiP", "sam9x60"),
 #endif
 #ifdef CONFIG_SOC_SAMA5
AT91_SOC(SAMA5D2_CIDR_MATCH, SAMA5D21CU_EXID_MATCH,
diff --git a/drivers/soc/atmel/soc.h b/drivers/soc/atmel/soc.h
index ee652e4841a5..5849846a69d6 100644
--- a/drivers/soc/atmel/soc.h
+++ b/drivers/soc/atmel/soc.h
@@ -60,6 +60,9 @@ at91_soc_init(const struct at91_soc *socs);
 #define AT91SAM9CN11_EXID_MATCH0x0009
 
 #define SAM9X60_EXID_MATCH 0x
+#define SAM9X60_D5M_EXID_MATCH 0x0001
+#define SAM9X60_D1G_EXID_MATCH 0x0010
+#define SAM9X60_D6K_EXID_MATCH 0x0011
 
 #define AT91SAM9XE128_CIDR_MATCH   0x329973a0
 #define AT91SAM9XE256_CIDR_MATCH   0x329a93a0
-- 
2.28.0



Re: [PATCH 1/2] dt-bindings: pinctrl: at91-pio4: add microchip,sama7g5

2020-09-17 Thread Nicolas.Ferre
On 17/09/2020 at 15:12, Eugen Hristev wrote:
> Add compatible string for microchip sama7g5 SoC.
> 
> Signed-off-by: Eugen Hristev 

Reviewed-by: Nicolas Ferre 

> ---
>   .../devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt   | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git 
> a/Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt 
> b/Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt
> index 04d16fb69eb7..265015bc0603 100644
> --- a/Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt
> +++ b/Documentation/devicetree/bindings/pinctrl/atmel,at91-pio4-pinctrl.txt
> @@ -4,7 +4,9 @@ The Atmel PIO4 controller is used to select the function of a 
> pin and to
>   configure it.
>   
>   Required properties:
> -- compatible: "atmel,sama5d2-pinctrl".
> +- compatible:
> + "atmel,sama5d2-pinctrl"
> + "microchip,sama7g5-pinctrl"
>   - reg: base address and length of the PIO controller.
>   - interrupts: interrupt outputs from the controller, one for each bank.
>   - interrupt-controller: mark the device node as an interrupt controller.
> 


-- 
Nicolas Ferre


Re: [trivial PATCH] treewide: Convert switch/case fallthrough; to break;

2020-09-10 Thread Nicolas.Ferre
Joe,

Please drop this chunk: it's a successive controller version number 
which are all backward compatible with "fallthrough" on each case so 
removing from this last one makes it inconsistent.

In sort: NACK for atmel-mci.

Best regards,
   Nicolas


On 09/09/2020 at 22:06, Joe Perches wrote:
> diff --git a/drivers/mmc/host/atmel-mci.c b/drivers/mmc/host/atmel-mci.c
> index 444bd3a0a922..8324312e4f42 100644
> --- a/drivers/mmc/host/atmel-mci.c
> +++ b/drivers/mmc/host/atmel-mci.c
> @@ -2435,7 +2435,7 @@ static void atmci_get_cap(struct atmel_mci *host)
>  case 0x100:
>  host->caps.has_bad_data_ordering = 0;
>  host->caps.need_reset_after_xfer = 0;
> -   fallthrough;
> +   break;
>  case 0x0:
>  break;
>  default:


-- 
Nicolas Ferre


Re: [PATCH 0/5] ARM: dts: at91: fix dtbs_check warnings

2020-09-02 Thread Nicolas.Ferre
On 31/08/2020 at 19:11, Alexandre Belloni wrote:
> Hi,
> 
> This series fixes some of the dtbs_check warnings. The remaining ones
> are mainly missing documentation or the documentation has not been
> converted to yaml.
> 
> Alexandre Belloni (5):
>ARM: dts: at91: fix cpu node
>ARM: dts: at91: fix sram nodes
>ARM: dts: at91: move mmc pinctrl-names property to board dts
>ARM: dts: at91: add unit-address to memory node
>ARM: dts: at91: sama5d2: add missing flexcom spi node properties

You can add my:
Reviewed-by: Nicolas Ferre 

To the whole series.
Thanks for having handled that Alexandre.

Best regards,
   Nicolas

>   arch/arm/boot/dts/animeo_ip.dts   |  3 ++-
>   arch/arm/boot/dts/at91-ariag25.dts|  3 ++-
>   arch/arm/boot/dts/at91-ariettag25.dts |  3 ++-
>   arch/arm/boot/dts/at91-cosino.dtsi|  3 ++-
>   arch/arm/boot/dts/at91-cosino_mega2560.dts|  1 +
>   arch/arm/boot/dts/at91-foxg20.dts |  3 ++-
>   arch/arm/boot/dts/at91-kizbox.dts |  2 +-
>   arch/arm/boot/dts/at91-kizbox2-common.dtsi|  2 +-
>   arch/arm/boot/dts/at91-kizboxmini-common.dtsi |  2 +-
>   arch/arm/boot/dts/at91-linea.dtsi |  2 +-
>   arch/arm/boot/dts/at91-qil_a9260.dts  |  3 ++-
>   arch/arm/boot/dts/at91-sam9_l9260.dts |  3 ++-
>   arch/arm/boot/dts/at91-sama5d3_xplained.dts   |  2 +-
>   arch/arm/boot/dts/at91-sama5d4_ma5d4.dtsi |  2 +-
>   arch/arm/boot/dts/at91-sama5d4_xplained.dts   |  2 +-
>   arch/arm/boot/dts/at91-sama5d4ek.dts  |  2 +-
>   arch/arm/boot/dts/at91-som60.dtsi |  2 +-
>   arch/arm/boot/dts/at91-vinco.dts  |  2 +-
>   arch/arm/boot/dts/at91-wb45n.dtsi |  3 ++-
>   arch/arm/boot/dts/at91-wb50n.dtsi |  2 +-
>   arch/arm/boot/dts/at91rm9200.dtsi | 11 +++
>   arch/arm/boot/dts/at91rm9200ek.dts|  2 +-
>   arch/arm/boot/dts/at91sam9260.dtsi| 11 +++
>   arch/arm/boot/dts/at91sam9260ek.dts   |  3 ++-
>   arch/arm/boot/dts/at91sam9261.dtsi| 10 +++---
>   arch/arm/boot/dts/at91sam9261ek.dts   |  2 +-
>   arch/arm/boot/dts/at91sam9263.dtsi| 15 ++-
>   arch/arm/boot/dts/at91sam9263ek.dts   |  3 ++-
>   arch/arm/boot/dts/at91sam9g20.dtsi|  5 -
>   arch/arm/boot/dts/at91sam9g20ek_common.dtsi   |  3 ++-
>   arch/arm/boot/dts/at91sam9g45.dtsi| 12 +++-
>   arch/arm/boot/dts/at91sam9m10g45ek.dts|  4 +++-
>   arch/arm/boot/dts/at91sam9n12.dtsi| 10 +++---
>   arch/arm/boot/dts/at91sam9n12ek.dts   |  2 +-
>   arch/arm/boot/dts/at91sam9rl.dtsi | 10 +++---
>   arch/arm/boot/dts/at91sam9rlek.dts|  2 +-
>   arch/arm/boot/dts/at91sam9x5.dtsi | 12 +++-
>   arch/arm/boot/dts/at91sam9x5cm.dtsi   |  2 +-
>   arch/arm/boot/dts/at91sam9x5ek.dtsi   |  2 ++
>   arch/arm/boot/dts/at91sam9xe.dtsi |  3 +++
>   arch/arm/boot/dts/ethernut5.dts   |  2 +-
>   arch/arm/boot/dts/mpa1600.dts |  2 +-
>   arch/arm/boot/dts/pm9g45.dts  |  3 ++-
>   arch/arm/boot/dts/sam9x60.dtsi| 10 +++---
>   arch/arm/boot/dts/sama5d2.dtsi| 19 ++-
>   arch/arm/boot/dts/sama5d3.dtsi|  8 +++-
>   arch/arm/boot/dts/sama5d3xcm.dtsi |  2 +-
>   arch/arm/boot/dts/sama5d3xcm_cmp.dtsi |  2 +-
>   arch/arm/boot/dts/sama5d4.dtsi|  8 +++-
>   arch/arm/boot/dts/tny_a9260_common.dtsi   |  2 +-
>   arch/arm/boot/dts/tny_a9263.dts   |  2 +-
>   arch/arm/boot/dts/usb_a9260.dts   |  2 +-
>   arch/arm/boot/dts/usb_a9263.dts   |  2 +-
>   arch/arm/boot/dts/usb_a9g20_common.dtsi   |  2 +-
>   54 files changed, 160 insertions(+), 77 deletions(-)
> 
> --
> 2.26.2
> 


-- 
Nicolas Ferre


[PATCH v7 1/2] net: macb: WoL support for GEM type of Ethernet controller

2020-07-20 Thread nicolas.ferre
From: Nicolas Ferre 

Adapt the Wake-on-Lan feature to the Cadence GEM Ethernet controller.
This controller has different register layout and cannot be handled by
previous code.
We disable completely interrupts on all the queues but the queue 0.
Handling of WoL interrupt is done in another interrupt handler
positioned depending on the controller version used, just between
suspend() and resume() calls.
It allows to lower pressure on the generic interrupt hot path by
removing the need to handle 2 tests for each IRQ: the first figuring out
the controller revision, the second for actually knowing if the WoL bit
is set.

Queue management in suspend()/resume() functions inspired from RFC patch
by Harini Katakam , thanks!

Cc: Claudiu Beznea 
Cc: Harini Katakam 
Signed-off-by: Nicolas Ferre 
---
Changes in v7:
- Release the spinlock before exiting macb_suspend/resume in case of error
  changing IRQ handler

 drivers/net/ethernet/cadence/macb.h  |   3 +
 drivers/net/ethernet/cadence/macb_main.c | 153 +++
 2 files changed, 129 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.h 
b/drivers/net/ethernet/cadence/macb.h
index ab827fb4b6b9..4f1b41569260 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -90,6 +90,7 @@
 #define GEM_SA3T   0x009C /* Specific3 Top */
 #define GEM_SA4B   0x00A0 /* Specific4 Bottom */
 #define GEM_SA4T   0x00A4 /* Specific4 Top */
+#define GEM_WOL0x00b8 /* Wake on LAN */
 #define GEM_EFTSH  0x00e8 /* PTP Event Frame Transmitted Seconds 
Register 47:32 */
 #define GEM_EFRSH  0x00ec /* PTP Event Frame Received Seconds 
Register 47:32 */
 #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted 
Seconds Register 47:32 */
@@ -396,6 +397,8 @@
 #define MACB_PDRSFT_SIZE   1
 #define MACB_SRI_OFFSET26 /* TSU Seconds Register Increment */
 #define MACB_SRI_SIZE  1
+#define GEM_WOL_OFFSET 28 /* Enable wake-on-lan interrupt */
+#define GEM_WOL_SIZE   1
 
 /* Timer increment fields */
 #define MACB_TI_CNS_OFFSET 0
diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index e5e37aa81b02..0f2417f09514 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1517,6 +1517,35 @@ static void macb_tx_restart(struct macb_queue *queue)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
 }
 
+static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
+{
+   struct macb_queue *queue = dev_id;
+   struct macb *bp = queue->bp;
+   u32 status;
+
+   status = queue_readl(queue, ISR);
+
+   if (unlikely(!status))
+   return IRQ_NONE;
+
+   spin_lock(>lock);
+
+   if (status & GEM_BIT(WOL)) {
+   queue_writel(queue, IDR, GEM_BIT(WOL));
+   gem_writel(bp, WOL, 0);
+   netdev_vdbg(bp->dev, "GEM WoL: queue = %u, isr = 0x%08lx\n",
+   (unsigned int)(queue - bp->queues),
+   (unsigned long)status);
+   if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
+   queue_writel(queue, ISR, GEM_BIT(WOL));
+   pm_wakeup_event(>pdev->dev, 0);
+   }
+
+   spin_unlock(>lock);
+
+   return IRQ_HANDLED;
+}
+
 static irqreturn_t macb_interrupt(int irq, void *dev_id)
 {
struct macb_queue *queue = dev_id;
@@ -3316,6 +3345,8 @@ static const struct ethtool_ops macb_ethtool_ops = {
 static const struct ethtool_ops gem_ethtool_ops = {
.get_regs_len   = macb_get_regs_len,
.get_regs   = macb_get_regs,
+   .get_wol= macb_get_wol,
+   .set_wol= macb_set_wol,
.get_link   = ethtool_op_get_link,
.get_ts_info= macb_get_ts_info,
.get_ethtool_stats  = gem_get_ethtool_stats,
@@ -4567,33 +4598,68 @@ static int __maybe_unused macb_suspend(struct device 
*dev)
struct macb_queue *queue = bp->queues;
unsigned long flags;
unsigned int q;
+   int err;
 
if (!netif_running(netdev))
return 0;
 
if (bp->wol & MACB_WOL_ENABLED) {
-   macb_writel(bp, IER, MACB_BIT(WOL));
-   macb_writel(bp, WOL, MACB_BIT(MAG));
-   enable_irq_wake(bp->queues[0].irq);
-   netif_device_detach(netdev);
-   } else {
-   netif_device_detach(netdev);
+   spin_lock_irqsave(>lock, flags);
+   /* Flush all status bits */
+   macb_writel(bp, TSR, -1);
+   macb_writel(bp, RSR, -1);
for (q = 0, queue = bp->queues; q < bp->num_queues;
-++q, ++queue)
-   napi_disable(>napi);
+++q, ++queue) {
+  

[PATCH v7 2/2] net: macb: Add WoL interrupt support for MACB type of Ethernet controller

2020-07-20 Thread nicolas.ferre
From: Nicolas Ferre 

Handle the Wake-on-Lan interrupt for the Cadence MACB Ethernet
controller.
As we do for the GEM version, we handle of WoL interrupt in a
specialized interrupt handler for MACB version that is positionned
just between suspend() and resume() calls.

Cc: Claudiu Beznea 
Cc: Harini Katakam 
Signed-off-by: Nicolas Ferre 
---
Changes in v7:
- Release the spinlock before exiting macb_suspend in case of error
  changing IRQ handler

 drivers/net/ethernet/cadence/macb_main.c | 40 +++-
 1 file changed, 39 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 0f2417f09514..a6a35e1b0115 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1517,6 +1517,35 @@ static void macb_tx_restart(struct macb_queue *queue)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
 }
 
+static irqreturn_t macb_wol_interrupt(int irq, void *dev_id)
+{
+   struct macb_queue *queue = dev_id;
+   struct macb *bp = queue->bp;
+   u32 status;
+
+   status = queue_readl(queue, ISR);
+
+   if (unlikely(!status))
+   return IRQ_NONE;
+
+   spin_lock(>lock);
+
+   if (status & MACB_BIT(WOL)) {
+   queue_writel(queue, IDR, MACB_BIT(WOL));
+   macb_writel(bp, WOL, 0);
+   netdev_vdbg(bp->dev, "MACB WoL: queue = %u, isr = 0x%08lx\n",
+   (unsigned int)(queue - bp->queues),
+   (unsigned long)status);
+   if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
+   queue_writel(queue, ISR, MACB_BIT(WOL));
+   pm_wakeup_event(>pdev->dev, 0);
+   }
+
+   spin_unlock(>lock);
+
+   return IRQ_HANDLED;
+}
+
 static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
 {
struct macb_queue *queue = dev_id;
@@ -4619,8 +4648,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
/* Change interrupt handler and
 * Enable WoL IRQ on queue 0
 */
+   devm_free_irq(dev, bp->queues[0].irq, bp->queues);
if (macb_is_gem(bp)) {
-   devm_free_irq(dev, bp->queues[0].irq, bp->queues);
err = devm_request_irq(dev, bp->queues[0].irq, 
gem_wol_interrupt,
   IRQF_SHARED, netdev->name, 
bp->queues);
if (err) {
@@ -4633,6 +4662,15 @@ static int __maybe_unused macb_suspend(struct device 
*dev)
queue_writel(bp->queues, IER, GEM_BIT(WOL));
gem_writel(bp, WOL, MACB_BIT(MAG));
} else {
+   err = devm_request_irq(dev, bp->queues[0].irq, 
macb_wol_interrupt,
+  IRQF_SHARED, netdev->name, 
bp->queues);
+   if (err) {
+   dev_err(dev,
+   "Unable to request IRQ %d (error %d)\n",
+   bp->queues[0].irq, err);
+   spin_unlock_irqrestore(>lock, flags);
+   return err;
+   }
queue_writel(bp->queues, IER, MACB_BIT(WOL));
macb_writel(bp, WOL, MACB_BIT(MAG));
}
-- 
2.27.0



[PATCH v7 0/2] net: macb: Wake-on-Lan magic packet GEM and MACB handling

2020-07-20 Thread nicolas.ferre
From: Nicolas Ferre 

Hi,

Here is the second part of support for WoL magic-packet on the current macb
driver. This one
is addressing the bulk of the feature and is based on current net-next/master.

MACB and GEM code must co-exist and as they don't share exactly the same
register layout, I had to specialize a bit the suspend/resume paths and plug a
specific IRQ handler in order to avoid overloading the "normal" IRQ hot path.

These changes were tested on both sam9x60 which embeds a MACB+FIFO controller
and sama5d2 which has a GEM+packet buffer type of controller.

Best regards,
  Nicolas

Changes in v7:
- Release the spinlock before exiting macb_suspend/resume in case of error
  changing IRQ handler

Changes in v6:
- rebase on net-next/master now that the "fixes" patches of the series are
  merged in both net and net-next.
- GEM addition and MACB update to finish the support of WoL magic-packet on the
  two revisions of the controller.

These 2 patches were last posted in v3 series.

History of previous changes already added to git commit message here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f9f41e3db40ee8d61b427d4d88c7365d968052a9


Nicolas Ferre (2):
  net: macb: WoL support for GEM type of Ethernet controller
  net: macb: Add WoL interrupt support for MACB type of Ethernet
controller

 drivers/net/ethernet/cadence/macb.h  |   3 +
 drivers/net/ethernet/cadence/macb_main.c | 191 +++
 2 files changed, 167 insertions(+), 27 deletions(-)

-- 
2.27.0



Re: linux-next: manual merge of the dmaengine tree with the wireless-drivers-next and Linus' trees

2020-07-20 Thread Nicolas.Ferre
On 17/07/2020 at 14:05, Kalle Valo wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the 
> content is safe
> 
> Stephen Rothwell  writes:
> 
>> Today's linux-next merge of the dmaengine tree got a conflict in:
>>
>>MAINTAINERS
>>
>> between commit:
>>
>>5625f965d764 ("wilc1000: move wilc driver out of staging")
>>
>> from the wireless-drivers-next tree, commit:
>>
>>6e701c299469 ("MAINTAINERS: merge entries for felix and ocelot drivers")
>>
>> from Linus' tree and commit:
>>
>>c3846c4cce15 ("MAINTAINERS: dmaengine: Microchip: add Tudor Ambarus
>> as co-maintainer")
>>
>> from the dmaengine tree.
> 
> I think this is trivial enough that Linus can take care of it without
> any extra actions. Thanks for the report.

 From my perspective your resolution Stephen is good.

Thanks to both of you for the heads-up.

Best regards,
   Nicolas

> --
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches
> 


-- 
Nicolas Ferre


Re: [PATCH v6 1/2] net: macb: WoL support for GEM type of Ethernet controller

2020-07-15 Thread Nicolas.Ferre
On 13/07/2020 at 17:45, Claudiu Beznea - M18063 wrote:
> Hi Nicolas,
> 
> 
> On 13.07.2020 13:05, nicolas.fe...@microchip.com wrote:
>> From: Nicolas Ferre 
>>
>> Adapt the Wake-on-Lan feature to the Cadence GEM Ethernet controller.
>> This controller has different register layout and cannot be handled by
>> previous code.
>> We disable completely interrupts on all the queues but the queue 0.
>> Handling of WoL interrupt is done in another interrupt handler
>> positioned depending on the controller version used, just between
>> suspend() and resume() calls.
>> It allows to lower pressure on the generic interrupt hot path by
>> removing the need to handle 2 tests for each IRQ: the first figuring out
>> the controller revision, the second for actually knowing if the WoL bit
>> is set.
>>
>> Queue management in suspend()/resume() functions inspired from RFC patch
>> by Harini Katakam , thanks!
>>
>> Cc: Claudiu Beznea 
>> Cc: Harini Katakam 
>> Signed-off-by: Nicolas Ferre 
>> ---
>> Changes in v6:
>> - Values of registers usrio and scrt2 properly read in any case (WoL or not)
>>during macb_suspend() to be restored during macb_resume()
>>
>> Changes in v3:
>> - In macb_resume(), move to a more in-depth re-configuration of the 
>> controller
>>even on the non-WoL path in order to accept deeper sleep states.
>> - this ends up having a phylink_stop()/phylink_start() for each of the
>>WoL/!WoL paths
>> - In macb_resume(), keep setting the MPE bit in NCR register which is needed 
>> in
>>case of deep power saving mode used
>> - Tests done in "standby" as well as our deeper Power Management mode:
>>Backup Self-Refresh (BSR)
>>
>> Changes in v2:
>> - Addition of pm_wakeup_event() in WoL IRQ
>> - In macb_resume(), removal of setting the MPE bit in NCR register which is 
>> not
>>needed in any case: IP is reset on the usual path and kept alive if WoL 
>> is used
>> - In macb_resume(), complete reset of the controller is kept only for non-WoL
>>case. For the WoL case, we only replace the usual IRQ handler.
>>
>>   drivers/net/ethernet/cadence/macb.h  |   3 +
>>   drivers/net/ethernet/cadence/macb_main.c | 151 +++
>>   2 files changed, 127 insertions(+), 27 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb.h 
>> b/drivers/net/ethernet/cadence/macb.h
>> index ab827fb4b6b9..4f1b41569260 100644
>> --- a/drivers/net/ethernet/cadence/macb.h
>> +++ b/drivers/net/ethernet/cadence/macb.h
>> @@ -90,6 +90,7 @@
>>   #define GEM_SA3T   0x009C /* Specific3 Top */
>>   #define GEM_SA4B   0x00A0 /* Specific4 Bottom */
>>   #define GEM_SA4T   0x00A4 /* Specific4 Top */
>> +#define GEM_WOL 0x00b8 /* Wake on LAN */
>>   #define GEM_EFTSH  0x00e8 /* PTP Event Frame Transmitted Seconds 
>> Register 47:32 */
>>   #define GEM_EFRSH  0x00ec /* PTP Event Frame Received Seconds 
>> Register 47:32 */
>>   #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted 
>> Seconds Register 47:32 */
>> @@ -396,6 +397,8 @@
>>   #define MACB_PDRSFT_SIZE   1
>>   #define MACB_SRI_OFFSET26 /* TSU Seconds Register Increment */
>>   #define MACB_SRI_SIZE  1
>> +#define GEM_WOL_OFFSET  28 /* Enable wake-on-lan interrupt */
>> +#define GEM_WOL_SIZE1
>>   
>>   /* Timer increment fields */
>>   #define MACB_TI_CNS_OFFSET 0
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
>> b/drivers/net/ethernet/cadence/macb_main.c
>> index e5e37aa81b02..122c54e40f91 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -1517,6 +1517,35 @@ static void macb_tx_restart(struct macb_queue *queue)
>>  macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
>>   }
>>   
>> +static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
>> +{
>> +struct macb_queue *queue = dev_id;
>> +struct macb *bp = queue->bp;
>> +u32 status;
>> +
>> +status = queue_readl(queue, ISR);
>> +
>> +if (unlikely(!status))
>> +return IRQ_NONE;
>> +
>> +spin_lock(>lock);
>> +
>> +if (status & GEM_BIT(WOL)) {
>> +queue_writel(queue, IDR, GEM_BIT(WOL));
>> +gem_writel(bp, WOL, 0);
>> +netdev_vdbg(bp->dev, "GEM WoL: queue = %u, isr = 0x%08lx\n",
>> +(unsigned int)(queue - bp->queues),
>> +(unsigned long)status);
>> +if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
>> +queue_writel(queue, ISR, GEM_BIT(WOL));
>> +pm_wakeup_event(>pdev->dev, 0);
>> +}
>> +
>> +spin_unlock(>lock);
>> +
>> +return IRQ_HANDLED;
>> +}
>> +
>>   static irqreturn_t macb_interrupt(int irq, void *dev_id)
>>   {
>>  struct macb_queue *queue = dev_id;
>> @@ -3316,6 +3345,8 @@ static const struct ethtool_ops macb_ethtool_ops = {
>>   static const struct ethtool_ops gem_ethtool_ops = {
>>  

[PATCH v6 0/2] net: macb: Wake-on-Lan magic packet GEM and MACB handling

2020-07-13 Thread nicolas.ferre
From: Nicolas Ferre 

Hi,

Here is the second part of support for WoL magic-packet on the current macb 
driver. This one
is addressing the bulk of the feature and is based on current net-next/master.

MACB and GEM code must co-exist and as they don't share exactly the same
register layout, I had to specialize a bit the suspend/resume paths and plug a
specific IRQ handler in order to avoid overloading the "normal" IRQ hot path.

These changes were tested on both sam9x60 which embeds a MACB+FIFO controller
and sama5d2 which has a GEM+packet buffer type of controller.

Best regards,
  Nicolas

Changes in v6:
- rebase on net-next/master now that the "fixes" patches of the series are
  merged in both net and net-next.
- GEM addition and MACB update to finish the support of WoL magic-packet on the
  two revisions of the controller.

These 2 patches were last posted in v3 series.

History of previous changes already added to git commit message here:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f9f41e3db40ee8d61b427d4d88c7365d968052a9

Nicolas Ferre (2):
  net: macb: WoL support for GEM type of Ethernet controller
  net: macb: Add WoL interrupt support for MACB type of Ethernet
controller

 drivers/net/ethernet/cadence/macb.h  |   3 +
 drivers/net/ethernet/cadence/macb_main.c | 188 +++
 2 files changed, 164 insertions(+), 27 deletions(-)

-- 
2.27.0



[PATCH v6 2/2] net: macb: Add WoL interrupt support for MACB type of Ethernet controller

2020-07-13 Thread nicolas.ferre
From: Nicolas Ferre 

Handle the Wake-on-Lan interrupt for the Cadence MACB Ethernet
controller.
As we do for the GEM version, we handle of WoL interrupt in a
specialized interrupt handler for MACB version that is positionned
just between suspend() and resume() calls.

Cc: Claudiu Beznea 
Cc: Harini Katakam 
Signed-off-by: Nicolas Ferre 
---
Changes in v2:
- Addition of pm_wakeup_event() in WoL IRQ

 drivers/net/ethernet/cadence/macb_main.c | 39 +++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 122c54e40f91..fce5d545ebab 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1517,6 +1517,35 @@ static void macb_tx_restart(struct macb_queue *queue)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
 }
 
+static irqreturn_t macb_wol_interrupt(int irq, void *dev_id)
+{
+   struct macb_queue *queue = dev_id;
+   struct macb *bp = queue->bp;
+   u32 status;
+
+   status = queue_readl(queue, ISR);
+
+   if (unlikely(!status))
+   return IRQ_NONE;
+
+   spin_lock(>lock);
+
+   if (status & MACB_BIT(WOL)) {
+   queue_writel(queue, IDR, MACB_BIT(WOL));
+   macb_writel(bp, WOL, 0);
+   netdev_vdbg(bp->dev, "MACB WoL: queue = %u, isr = 0x%08lx\n",
+   (unsigned int)(queue - bp->queues),
+   (unsigned long)status);
+   if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
+   queue_writel(queue, ISR, MACB_BIT(WOL));
+   pm_wakeup_event(>pdev->dev, 0);
+   }
+
+   spin_unlock(>lock);
+
+   return IRQ_HANDLED;
+}
+
 static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
 {
struct macb_queue *queue = dev_id;
@@ -4619,8 +4648,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
/* Change interrupt handler and
 * Enable WoL IRQ on queue 0
 */
+   devm_free_irq(dev, bp->queues[0].irq, bp->queues);
if (macb_is_gem(bp)) {
-   devm_free_irq(dev, bp->queues[0].irq, bp->queues);
err = devm_request_irq(dev, bp->queues[0].irq, 
gem_wol_interrupt,
   IRQF_SHARED, netdev->name, 
bp->queues);
if (err) {
@@ -4632,6 +4661,14 @@ static int __maybe_unused macb_suspend(struct device 
*dev)
queue_writel(bp->queues, IER, GEM_BIT(WOL));
gem_writel(bp, WOL, MACB_BIT(MAG));
} else {
+   err = devm_request_irq(dev, bp->queues[0].irq, 
macb_wol_interrupt,
+  IRQF_SHARED, netdev->name, 
bp->queues);
+   if (err) {
+   dev_err(dev,
+   "Unable to request IRQ %d (error %d)\n",
+   bp->queues[0].irq, err);
+   return err;
+   }
queue_writel(bp->queues, IER, MACB_BIT(WOL));
macb_writel(bp, WOL, MACB_BIT(MAG));
}
-- 
2.27.0



[PATCH v6 1/2] net: macb: WoL support for GEM type of Ethernet controller

2020-07-13 Thread nicolas.ferre
From: Nicolas Ferre 

Adapt the Wake-on-Lan feature to the Cadence GEM Ethernet controller.
This controller has different register layout and cannot be handled by
previous code.
We disable completely interrupts on all the queues but the queue 0.
Handling of WoL interrupt is done in another interrupt handler
positioned depending on the controller version used, just between
suspend() and resume() calls.
It allows to lower pressure on the generic interrupt hot path by
removing the need to handle 2 tests for each IRQ: the first figuring out
the controller revision, the second for actually knowing if the WoL bit
is set.

Queue management in suspend()/resume() functions inspired from RFC patch
by Harini Katakam , thanks!

Cc: Claudiu Beznea 
Cc: Harini Katakam 
Signed-off-by: Nicolas Ferre 
---
Changes in v6:
- Values of registers usrio and scrt2 properly read in any case (WoL or not)
  during macb_suspend() to be restored during macb_resume()

Changes in v3:
- In macb_resume(), move to a more in-depth re-configuration of the controller
  even on the non-WoL path in order to accept deeper sleep states.
- this ends up having a phylink_stop()/phylink_start() for each of the
  WoL/!WoL paths
- In macb_resume(), keep setting the MPE bit in NCR register which is needed in
  case of deep power saving mode used
- Tests done in "standby" as well as our deeper Power Management mode:
  Backup Self-Refresh (BSR)

Changes in v2:
- Addition of pm_wakeup_event() in WoL IRQ
- In macb_resume(), removal of setting the MPE bit in NCR register which is not
  needed in any case: IP is reset on the usual path and kept alive if WoL is 
used
- In macb_resume(), complete reset of the controller is kept only for non-WoL
  case. For the WoL case, we only replace the usual IRQ handler.

 drivers/net/ethernet/cadence/macb.h  |   3 +
 drivers/net/ethernet/cadence/macb_main.c | 151 +++
 2 files changed, 127 insertions(+), 27 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.h 
b/drivers/net/ethernet/cadence/macb.h
index ab827fb4b6b9..4f1b41569260 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -90,6 +90,7 @@
 #define GEM_SA3T   0x009C /* Specific3 Top */
 #define GEM_SA4B   0x00A0 /* Specific4 Bottom */
 #define GEM_SA4T   0x00A4 /* Specific4 Top */
+#define GEM_WOL0x00b8 /* Wake on LAN */
 #define GEM_EFTSH  0x00e8 /* PTP Event Frame Transmitted Seconds 
Register 47:32 */
 #define GEM_EFRSH  0x00ec /* PTP Event Frame Received Seconds 
Register 47:32 */
 #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted 
Seconds Register 47:32 */
@@ -396,6 +397,8 @@
 #define MACB_PDRSFT_SIZE   1
 #define MACB_SRI_OFFSET26 /* TSU Seconds Register Increment */
 #define MACB_SRI_SIZE  1
+#define GEM_WOL_OFFSET 28 /* Enable wake-on-lan interrupt */
+#define GEM_WOL_SIZE   1
 
 /* Timer increment fields */
 #define MACB_TI_CNS_OFFSET 0
diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index e5e37aa81b02..122c54e40f91 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1517,6 +1517,35 @@ static void macb_tx_restart(struct macb_queue *queue)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
 }
 
+static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
+{
+   struct macb_queue *queue = dev_id;
+   struct macb *bp = queue->bp;
+   u32 status;
+
+   status = queue_readl(queue, ISR);
+
+   if (unlikely(!status))
+   return IRQ_NONE;
+
+   spin_lock(>lock);
+
+   if (status & GEM_BIT(WOL)) {
+   queue_writel(queue, IDR, GEM_BIT(WOL));
+   gem_writel(bp, WOL, 0);
+   netdev_vdbg(bp->dev, "GEM WoL: queue = %u, isr = 0x%08lx\n",
+   (unsigned int)(queue - bp->queues),
+   (unsigned long)status);
+   if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
+   queue_writel(queue, ISR, GEM_BIT(WOL));
+   pm_wakeup_event(>pdev->dev, 0);
+   }
+
+   spin_unlock(>lock);
+
+   return IRQ_HANDLED;
+}
+
 static irqreturn_t macb_interrupt(int irq, void *dev_id)
 {
struct macb_queue *queue = dev_id;
@@ -3316,6 +3345,8 @@ static const struct ethtool_ops macb_ethtool_ops = {
 static const struct ethtool_ops gem_ethtool_ops = {
.get_regs_len   = macb_get_regs_len,
.get_regs   = macb_get_regs,
+   .get_wol= macb_get_wol,
+   .set_wol= macb_set_wol,
.get_link   = ethtool_op_get_link,
.get_ts_info= macb_get_ts_info,
.get_ethtool_stats  = gem_get_ethtool_stats,
@@ -4567,33 +4598,67 @@ static int __maybe_unused macb_suspend(struct 

[PATCH v5 5/5] net: macb: fix call to pm_runtime in the suspend/resume functions

2020-07-10 Thread nicolas.ferre
From: Nicolas Ferre 

The calls to pm_runtime_force_suspend/resume() functions are only
relevant if the device is not configured to act as a WoL wakeup source.
Add the device_may_wakeup() test before calling them.

Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Sergio Prado 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
Changes in v3:
 - remove the parenthesis around device_may_wakeup()
Changes in v2:
- new in v2 serries
 drivers/net/ethernet/cadence/macb_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 548815255e22..f1f0976e7669 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4606,7 +4606,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
 
if (bp->ptp_info)
bp->ptp_info->ptp_remove(netdev);
-   pm_runtime_force_suspend(dev);
+   if (!device_may_wakeup(dev))
+   pm_runtime_force_suspend(dev);
 
return 0;
 }
@@ -4621,7 +4622,8 @@ static int __maybe_unused macb_resume(struct device *dev)
if (!netif_running(netdev))
return 0;
 
-   pm_runtime_force_resume(dev);
+   if (!device_may_wakeup(dev))
+   pm_runtime_force_resume(dev);
 
if (bp->wol & MACB_WOL_ENABLED) {
macb_writel(bp, IDR, MACB_BIT(WOL));
-- 
2.27.0



[PATCH v5 2/5] net: macb: mark device wake capable when "magic-packet" property present

2020-07-10 Thread nicolas.ferre
From: Nicolas Ferre 

Change the way the "magic-packet" DT property is handled in the
macb_probe() function, matching DT binding documentation.
Now we mark the device as "wakeup capable" instead of calling the
device_init_wakeup() function that would enable the wakeup source.

For Ethernet WoL, enabling the wakeup_source is done by
using ethtool and associated macb_set_wol() function that
already calls device_set_wakeup_enable() for this purpose.

That would reduce power consumption by cutting more clocks if
"magic-packet" property is set but WoL is not configured by ethtool.

Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Sergio Prado 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
 drivers/net/ethernet/cadence/macb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 55e680f35022..4cafe343c0a2 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4422,7 +4422,7 @@ static int macb_probe(struct platform_device *pdev)
bp->wol = 0;
if (of_get_property(np, "magic-packet", NULL))
bp->wol |= MACB_WOL_HAS_MAGIC_PACKET;
-   device_init_wakeup(>dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET);
+   device_set_wakeup_capable(>dev, bp->wol & 
MACB_WOL_HAS_MAGIC_PACKET);
 
spin_lock_init(>lock);
 
-- 
2.27.0



[PATCH v5 4/5] net: macb: fix macb_suspend() by removing call to netif_carrier_off()

2020-07-10 Thread nicolas.ferre
From: Nicolas Ferre 

As we now use the phylink call to phylink_stop() in the non-WoL path,
there is no need for this call to netif_carrier_off() anymore. It can
disturb the underlying phylink FSM.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Antoine Tenart 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
Changes in v2:
- new in v2 serries

 drivers/net/ethernet/cadence/macb_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 79c2fe054303..548815255e22 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4604,7 +4604,6 @@ static int __maybe_unused macb_suspend(struct device *dev)
bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT);
}
 
-   netif_carrier_off(netdev);
if (bp->ptp_info)
bp->ptp_info->ptp_remove(netdev);
pm_runtime_force_suspend(dev);
-- 
2.27.0



[PATCH v5 3/5] net: macb: fix macb_get/set_wol() when moving to phylink

2020-07-10 Thread nicolas.ferre
From: Nicolas Ferre 

Keep previous function goals and integrate phylink actions to them.

phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver
supports Wake-on-Lan.
Initialization of "supported" and "wolopts" members is done in phylink
function, no need to keep them in calling function.

phylink_ethtool_set_wol() return value is considered and determines
if the MAC has to handle WoL or not. The case where the PHY doesn't
implement WoL leads to the MAC configuring it to provide this feature.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Antoine Tenart 
Cc: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
Changes in v5:
- Addressed the error code returned by phylink_ethtool_set_wol() as suggested
  by Russell.
  If PHY handles WoL, MAC doesn't stay in the way.
- Removed Florian's tag

 drivers/net/ethernet/cadence/macb_main.c | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 4cafe343c0a2..79c2fe054303 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2821,11 +2821,13 @@ static void macb_get_wol(struct net_device *netdev, 
struct ethtool_wolinfo *wol)
 {
struct macb *bp = netdev_priv(netdev);
 
-   wol->supported = 0;
-   wol->wolopts = 0;
-
-   if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET)
+   if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) {
phylink_ethtool_get_wol(bp->phylink, wol);
+   wol->supported |= WAKE_MAGIC;
+
+   if (bp->wol & MACB_WOL_ENABLED)
+   wol->wolopts |= WAKE_MAGIC;
+   }
 }
 
 static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
@@ -2833,9 +2835,13 @@ static int macb_set_wol(struct net_device *netdev, 
struct ethtool_wolinfo *wol)
struct macb *bp = netdev_priv(netdev);
int ret;
 
+   /* Pass the order to phylink layer */
ret = phylink_ethtool_set_wol(bp->phylink, wol);
-   if (!ret)
-   return 0;
+   /* Don't manage WoL on MAC if handled by the PHY
+* or if there's a failure in talking to the PHY
+*/
+   if (!ret || ret != -EOPNOTSUPP)
+   return ret;
 
if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ||
(wol->wolopts & ~WAKE_MAGIC))
-- 
2.27.0



[PATCH v5 0/5] net: macb: Wake-on-Lan magic packet fixes and GEM handling

2020-07-10 Thread nicolas.ferre
From: Nicolas Ferre 

Hi,
Here is a split series to fix WoL magic-packet on the current macb driver. Only
fixes in this one based on current net/master.

Best regards,
  Nicolas

Changes in v5:
- Addressed the error code returned by phylink_ethtool_set_wol() as suggested
  by Russell.
  If PHY handles WoL, MAC doesn't stay in the way.
- Removed Florian's tag on 3/5 because of the above changes.
- Correct the "Fixes" tag on 1/5.

Changes in v4:
- Pure bug fix series for 'net'. GEM addition and MACB update removed: will be
  sent later.

Changes in v3:
- Revert some of the v2 changes done in macb_resume(). Now the resume function
  supports in-depth re-configuration of the controller in order to deal with
  deeper sleep states. Basically as it was before changes introduced by this
  series
- Tested for non-regression with our deeper Power Management mode which cuts
  power to the controller completely

Changes in v2:
- Add patch 4/7 ("net: macb: fix macb_suspend() by removing call to 
netif_carrier_off()")
  needed for keeping phy state consistent
- Add patch 5/7 ("net: macb: fix call to pm_runtime in the suspend/resume 
functions") that prevent
  putting the macb in runtime pm suspend mode when WoL is used
- Collect review tags on 3 first patches from Florian: Thanks!
- Review of macb_resume() function
- Addition of pm_wakeup_event() in both MACB and GEM WoL IRQ handlers


Nicolas Ferre (5):
  net: macb: fix wakeup test in runtime suspend/resume routines
  net: macb: mark device wake capable when "magic-packet" property
present
  net: macb: fix macb_get/set_wol() when moving to phylink
  net: macb: fix macb_suspend() by removing call to netif_carrier_off()
  net: macb: fix call to pm_runtime in the suspend/resume functions

 drivers/net/ethernet/cadence/macb_main.c | 31 +++-
 1 file changed, 19 insertions(+), 12 deletions(-)

-- 
2.27.0



[PATCH v5 1/5] net: macb: fix wakeup test in runtime suspend/resume routines

2020-07-10 Thread nicolas.ferre
From: Nicolas Ferre 

Use the proper struct device pointer to check if the wakeup flag
and wakeup source are positioned.
Use the one passed by function call which is equivalent to
>dev->dev.parent.

It's preventing the trigger of a spurious interrupt in case the
Wake-on-Lan feature is used.

Fixes: d54f89af6cc4 ("net: macb: Add pm runtime support")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
 drivers/net/ethernet/cadence/macb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 52582e8ed90e..55e680f35022 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4654,7 +4654,7 @@ static int __maybe_unused macb_runtime_suspend(struct 
device *dev)
struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);
 
-   if (!(device_may_wakeup(>dev->dev))) {
+   if (!(device_may_wakeup(dev))) {
clk_disable_unprepare(bp->tx_clk);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
@@ -4670,7 +4670,7 @@ static int __maybe_unused macb_runtime_resume(struct 
device *dev)
struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);
 
-   if (!(device_may_wakeup(>dev->dev))) {
+   if (!(device_may_wakeup(dev))) {
clk_prepare_enable(bp->pclk);
clk_prepare_enable(bp->hclk);
clk_prepare_enable(bp->tx_clk);
-- 
2.27.0



[PATCH] MAINTAINERS: Change Maintainer for some at91 drivers

2020-07-02 Thread nicolas.ferre
From: Nicolas Ferre 

I hand over the maintenance of these drivers to my colleagues. Claudiu,
Codrin and Tudor already have experience with these controllers and
sub-systems.

Signed-off-by: Nicolas Ferre 
---
Mark, Sebastian,

I kept these entries together as it may generate conflicts if handled
separately. I suggest that Mark take the chunk as maintainer of SPI and
Audio sub-systems.
Anyway, don't hesitate to tell me if I should handle this change
differently or at another time during the development cycle.

Best regards,
  Nicolas

 MAINTAINERS | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 496fd4eafb68..1c1527a34d99 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11333,17 +11333,17 @@ F:drivers/iio/adc/at91-sama5d2_adc.c
 F: include/dt-bindings/iio/adc/at91-sama5d2_adc.h
 
 MICROCHIP SAMA5D2-COMPATIBLE SHUTDOWN CONTROLLER
-M: Nicolas Ferre 
+M: Claudiu Beznea 
 S: Supported
 F: drivers/power/reset/at91-sama5d2_shdwc.c
 
 MICROCHIP SPI DRIVER
-M: Nicolas Ferre 
+M: Tudor Ambarus 
 S: Supported
 F: drivers/spi/spi-atmel.*
 
 MICROCHIP SSC DRIVER
-M: Nicolas Ferre 
+M: Codrin Ciubotariu 
 L: linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
 S: Supported
 F: drivers/misc/atmel-ssc.c
-- 
2.27.0



[PATCH] MAINTAINERS: net: macb: add Claudiu as co-maintainer

2020-07-02 Thread nicolas.ferre
From: Nicolas Ferre 

I would like that Claudiu becomes co-maintainer of the Cadence macb
driver. He's already participating to lots of reviews and enhancements
to this driver and knows the different versions of this controller.

Signed-off-by: Nicolas Ferre 
---
 MAINTAINERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 63c4cc4a04d6..5f14938a5985 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -2929,6 +2929,7 @@ F:include/uapi/linux/atm*
 
 ATMEL MACB ETHERNET DRIVER
 M: Nicolas Ferre 
+M: Claudiu Beznea 
 S: Supported
 F: drivers/net/ethernet/cadence/
 
-- 
2.27.0



Re: [PATCH] staging/wilc1000: let wilc_mac_xmit() to NETDEV_TX_OK

2020-06-29 Thread Nicolas.Ferre
Luc,

Thanks for your patch...

On 28/06/2020 at 20:32, Luc Van Oostenryck wrote:
> The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
> which is a typedef for an enum type defining 'NETDEV_TX_OK' but this
> driver returns '0' instead of 'NETDEV_TX_OK'.
> 
> Fix this by returning ''NETDEV_TX_OK' instead of 0.
> 
> Signed-off-by: Luc Van Oostenryck 
> ---
>   drivers/staging/wilc1000/netdev.c | 6 +++---

... would it be possible that you re-spin it so that it applies to the 
new location of this driver:
drivers/net/wireless/microchip/wilc1000/netdev.c

You can rebase your patch on the wireless-driver-next tree with 
wilc1000-move-out-of-staging branch:

tree: 
git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next.git
branch: wilc1000-move-out-of-staging

(Then you can also review the subject line of your patch, BTW)

Thanks for your help. Best regards,
   Nicolas

>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/wilc1000/netdev.c 
> b/drivers/staging/wilc1000/netdev.c
> index fda0ab97b02c..be3ae5486f44 100644
> --- a/drivers/staging/wilc1000/netdev.c
> +++ b/drivers/staging/wilc1000/netdev.c
> @@ -678,14 +678,14 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct 
> net_device *ndev)
> 
>  if (skb->dev != ndev) {
>  netdev_err(ndev, "Packet not destined to this device\n");
> -   return 0;
> +   return NETDEV_TX_OK;
>  }
> 
>  tx_data = kmalloc(sizeof(*tx_data), GFP_ATOMIC);
>  if (!tx_data) {
>  dev_kfree_skb(skb);
>  netif_wake_queue(ndev);
> -   return 0;
> +   return NETDEV_TX_OK;
>  }
> 
>  tx_data->buff = skb->data;
> @@ -710,7 +710,7 @@ netdev_tx_t wilc_mac_xmit(struct sk_buff *skb, struct 
> net_device *ndev)
>  srcu_read_unlock(>srcu, srcu_idx);
>  }
> 
> -   return 0;
> +   return NETDEV_TX_OK;
>   }
> 
>   static int wilc_mac_close(struct net_device *ndev)
> --
> 2.27.0
> 


-- 
Nicolas Ferre


[PATCH v4 3/5] net: macb: fix macb_get/set_wol() when moving to phylink

2020-05-06 Thread nicolas.ferre
From: Nicolas Ferre 

Keep previous function goals and integrate phylink actions to them.

phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver
supports Wake-on-Lan.
Initialization of "supported" and "wolopts" members is done in phylink
function, no need to keep them in calling function.

phylink_ethtool_set_wol() return value is not enough to determine
if WoL is enabled for the calling Ethernet driver. Call it first
but don't rely on its return value as most of simple PHY drivers
don't implement a set_wol() function.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Signed-off-by: Nicolas Ferre 
Reviewed-by: Florian Fainelli 
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Antoine Tenart 
---
 drivers/net/ethernet/cadence/macb_main.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 53e81ab048ae..24c044dc7fa0 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2817,21 +2817,23 @@ static void macb_get_wol(struct net_device *netdev, 
struct ethtool_wolinfo *wol)
 {
struct macb *bp = netdev_priv(netdev);
 
-   wol->supported = 0;
-   wol->wolopts = 0;
-
-   if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET)
+   if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) {
phylink_ethtool_get_wol(bp->phylink, wol);
+   wol->supported |= WAKE_MAGIC;
+
+   if (bp->wol & MACB_WOL_ENABLED)
+   wol->wolopts |= WAKE_MAGIC;
+   }
 }
 
 static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
struct macb *bp = netdev_priv(netdev);
-   int ret;
 
-   ret = phylink_ethtool_set_wol(bp->phylink, wol);
-   if (!ret)
-   return 0;
+   /* Pass the order to phylink layer.
+* Don't test return value as set_wol() is often not supported.
+*/
+   phylink_ethtool_set_wol(bp->phylink, wol);
 
if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ||
(wol->wolopts & ~WAKE_MAGIC))
-- 
2.26.2



[PATCH v4 2/5] net: macb: mark device wake capable when "magic-packet" property present

2020-05-06 Thread nicolas.ferre
From: Nicolas Ferre 

Change the way the "magic-packet" DT property is handled in the
macb_probe() function, matching DT binding documentation.
Now we mark the device as "wakeup capable" instead of calling the
device_init_wakeup() function that would enable the wakeup source.

For Ethernet WoL, enabling the wakeup_source is done by
using ethtool and associated macb_set_wol() function that
already calls device_set_wakeup_enable() for this purpose.

That would reduce power consumption by cutting more clocks if
"magic-packet" property is set but WoL is not configured by ethtool.

Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Signed-off-by: Nicolas Ferre 
Reviewed-by: Florian Fainelli 
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Sergio Prado 
---
 drivers/net/ethernet/cadence/macb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index d11fae37d46b..53e81ab048ae 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4384,7 +4384,7 @@ static int macb_probe(struct platform_device *pdev)
bp->wol = 0;
if (of_get_property(np, "magic-packet", NULL))
bp->wol |= MACB_WOL_HAS_MAGIC_PACKET;
-   device_init_wakeup(>dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET);
+   device_set_wakeup_capable(>dev, bp->wol & 
MACB_WOL_HAS_MAGIC_PACKET);
 
spin_lock_init(>lock);
 
-- 
2.26.2



[PATCH v4 5/5] net: macb: fix call to pm_runtime in the suspend/resume functions

2020-05-06 Thread nicolas.ferre
From: Nicolas Ferre 

The calls to pm_runtime_force_suspend/resume() functions are only
relevant if the device is not configured to act as a WoL wakeup source.
Add the device_may_wakeup() test before calling them.

Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Signed-off-by: Nicolas Ferre 
Reviewed-by: Florian Fainelli 
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Sergio Prado 
---
Changes in v3:
 - remove the parenthesis around device_may_wakeup()
Changes in v2:
- new in v2 serries

 drivers/net/ethernet/cadence/macb_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index ebc57cd5d286..f01b9831b219 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4564,7 +4564,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
 
if (bp->ptp_info)
bp->ptp_info->ptp_remove(netdev);
-   pm_runtime_force_suspend(dev);
+   if (!device_may_wakeup(dev))
+   pm_runtime_force_suspend(dev);
 
return 0;
 }
@@ -4579,7 +4580,8 @@ static int __maybe_unused macb_resume(struct device *dev)
if (!netif_running(netdev))
return 0;
 
-   pm_runtime_force_resume(dev);
+   if (!device_may_wakeup(dev))
+   pm_runtime_force_resume(dev);
 
if (bp->wol & MACB_WOL_ENABLED) {
macb_writel(bp, IDR, MACB_BIT(WOL));
-- 
2.26.2



[PATCH v4 4/5] net: macb: fix macb_suspend() by removing call to netif_carrier_off()

2020-05-06 Thread nicolas.ferre
From: Nicolas Ferre 

As we now use the phylink call to phylink_stop() in the non-WoL path,
there is no need for this call to netif_carrier_off() anymore. It can
disturb the underlying phylink FSM.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Signed-off-by: Nicolas Ferre 
Reviewed-by: Florian Fainelli 
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Antoine Tenart 
---
Changes in v2:
- new in v2 serries

 drivers/net/ethernet/cadence/macb_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 24c044dc7fa0..ebc57cd5d286 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4562,7 +4562,6 @@ static int __maybe_unused macb_suspend(struct device *dev)
bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT);
}
 
-   netif_carrier_off(netdev);
if (bp->ptp_info)
bp->ptp_info->ptp_remove(netdev);
pm_runtime_force_suspend(dev);
-- 
2.26.2



[PATCH v4 0/5] net: macb: Wake-on-Lan magic packet fixes and GEM handling

2020-05-06 Thread nicolas.ferre
From: Nicolas Ferre 

Hi,
Here is a split series to fix WoL magic-packet on the current macb driver. Only
fixes in this one based on current net/master.

Best regards,
  Nicolas

Changes in v4:
- Pure bug fix series for 'net'. GEM addition and MACB update removed: will be
  sent later.

Changes in v3:
- Revert some of the v2 changes done in macb_resume(). Now the resume function
  supports in-depth re-configuration of the controller in order to deal with
  deeper sleep states. Basically as it was before changes introduced by this
  series
- Tested for non-regression with our deeper Power Management mode which cuts
  power to the controller completely

Changes in v2:
- Add patch 4/7 ("net: macb: fix macb_suspend() by removing call to 
netif_carrier_off()")
  needed for keeping phy state consistent
- Add patch 5/7 ("net: macb: fix call to pm_runtime in the suspend/resume 
functions") that prevent
  putting the macb in runtime pm suspend mode when WoL is used
- Collect review tags on 3 first patches from Florian: Thanks!
- Review of macb_resume() function
- Addition of pm_wakeup_event() in both MACB and GEM WoL IRQ handlers


Nicolas Ferre (5):
  net: macb: fix wakeup test in runtime suspend/resume routines
  net: macb: mark device wake capable when "magic-packet" property
present
  net: macb: fix macb_get/set_wol() when moving to phylink
  net: macb: fix macb_suspend() by removing call to netif_carrier_off()
  net: macb: fix call to pm_runtime in the suspend/resume functions

 drivers/net/ethernet/cadence/macb_main.c | 31 +---
 1 file changed, 17 insertions(+), 14 deletions(-)

-- 
2.26.2



[PATCH v4 1/5] net: macb: fix wakeup test in runtime suspend/resume routines

2020-05-06 Thread nicolas.ferre
From: Nicolas Ferre 

Use the proper struct device pointer to check if the wakeup flag
and wakeup source are positioned.
Use the one passed by function call which is equivalent to
>dev->dev.parent.

It's preventing the trigger of a spurious interrupt in case the
Wake-on-Lan feature is used.

Fixes: bc1109d04c39 ("net: macb: Add pm runtime support")
Signed-off-by: Nicolas Ferre 
Reviewed-by: Florian Fainelli 
Cc: Claudiu Beznea 
Cc: Harini Katakam 
---
 drivers/net/ethernet/cadence/macb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 36290a8e2a84..d11fae37d46b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4616,7 +4616,7 @@ static int __maybe_unused macb_runtime_suspend(struct 
device *dev)
struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);
 
-   if (!(device_may_wakeup(>dev->dev))) {
+   if (!(device_may_wakeup(dev))) {
clk_disable_unprepare(bp->tx_clk);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
@@ -4632,7 +4632,7 @@ static int __maybe_unused macb_runtime_resume(struct 
device *dev)
struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);
 
-   if (!(device_may_wakeup(>dev->dev))) {
+   if (!(device_may_wakeup(dev))) {
clk_prepare_enable(bp->pclk);
clk_prepare_enable(bp->hclk);
clk_prepare_enable(bp->tx_clk);
-- 
2.26.2



[PATCH v3 5/7] net: macb: fix call to pm_runtime in the suspend/resume functions

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

The calls to pm_runtime_force_suspend/resume() functions are only
relevant if the device is not configured to act as a WoL wakeup source.
Add the device_may_wakeup() test before calling them.

Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Sergio Prado 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
Changes in v3:
 - remove the parenthesis around device_may_wakeup()
Changes in v2:
- new in v2 serries

 drivers/net/ethernet/cadence/macb_main.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 72b8983a763a..b42831966ffa 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4564,7 +4564,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
 
if (bp->ptp_info)
bp->ptp_info->ptp_remove(netdev);
-   pm_runtime_force_suspend(dev);
+   if (!device_may_wakeup(dev))
+   pm_runtime_force_suspend(dev);
 
return 0;
 }
@@ -4579,7 +4580,8 @@ static int __maybe_unused macb_resume(struct device *dev)
if (!netif_running(netdev))
return 0;
 
-   pm_runtime_force_resume(dev);
+   if (!device_may_wakeup(dev))
+   pm_runtime_force_resume(dev);
 
if (bp->wol & MACB_WOL_ENABLED) {
macb_writel(bp, IDR, MACB_BIT(WOL));
-- 
2.26.2



[PATCH v3 1/7] net: macb: fix wakeup test in runtime suspend/resume routines

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

Use the proper struct device pointer to check if the wakeup flag
and wakeup source are positioned.
Use the one passed by function call which is equivalent to
>dev->dev.parent.

It's preventing the trigger of a spurious interrupt in case the
Wake-on-Lan feature is used.

Fixes: bc1109d04c39 ("net: macb: Add pm runtime support")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
 drivers/net/ethernet/cadence/macb_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index a0e8c5bbabc0..d1b4d6b6d7c8 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4616,7 +4616,7 @@ static int __maybe_unused macb_runtime_suspend(struct 
device *dev)
struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);
 
-   if (!(device_may_wakeup(>dev->dev))) {
+   if (!(device_may_wakeup(dev))) {
clk_disable_unprepare(bp->tx_clk);
clk_disable_unprepare(bp->hclk);
clk_disable_unprepare(bp->pclk);
@@ -4632,7 +4632,7 @@ static int __maybe_unused macb_runtime_resume(struct 
device *dev)
struct net_device *netdev = dev_get_drvdata(dev);
struct macb *bp = netdev_priv(netdev);
 
-   if (!(device_may_wakeup(>dev->dev))) {
+   if (!(device_may_wakeup(dev))) {
clk_prepare_enable(bp->pclk);
clk_prepare_enable(bp->hclk);
clk_prepare_enable(bp->tx_clk);
-- 
2.26.2



[PATCH v3 7/7] net: macb: Add WoL interrupt support for MACB type of Ethernet controller

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

Handle the Wake-on-Lan interrupt for the Cadence MACB Ethernet
controller.
As we do for the GEM version, we handle of WoL interrupt in a
specialized interrupt handler for MACB version that is positionned
just between suspend() and resume() calls.

Cc: Claudiu Beznea 
Cc: Harini Katakam 
Signed-off-by: Nicolas Ferre 
---
Changes in v2:
- Addition of pm_wakeup_event() in WoL IRQ

 drivers/net/ethernet/cadence/macb_main.c | 39 +++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index be8454a8535b..f8dc3c1b807b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1513,6 +1513,35 @@ static void macb_tx_restart(struct macb_queue *queue)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
 }
 
+static irqreturn_t macb_wol_interrupt(int irq, void *dev_id)
+{
+   struct macb_queue *queue = dev_id;
+   struct macb *bp = queue->bp;
+   u32 status;
+
+   status = queue_readl(queue, ISR);
+
+   if (unlikely(!status))
+   return IRQ_NONE;
+
+   spin_lock(>lock);
+
+   if (status & MACB_BIT(WOL)) {
+   queue_writel(queue, IDR, MACB_BIT(WOL));
+   macb_writel(bp, WOL, 0);
+   netdev_vdbg(bp->dev, "MACB WoL: queue = %u, isr = 0x%08lx\n",
+   (unsigned int)(queue - bp->queues),
+   (unsigned long)status);
+   if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
+   queue_writel(queue, ISR, MACB_BIT(WOL));
+   pm_wakeup_event(>pdev->dev, 0);
+   }
+
+   spin_unlock(>lock);
+
+   return IRQ_HANDLED;
+}
+
 static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
 {
struct macb_queue *queue = dev_id;
@@ -4586,8 +4615,8 @@ static int __maybe_unused macb_suspend(struct device *dev)
/* Change interrupt handler and
 * Enable WoL IRQ on queue 0
 */
+   devm_free_irq(dev, bp->queues[0].irq, bp->queues);
if (macb_is_gem(bp)) {
-   devm_free_irq(dev, bp->queues[0].irq, bp->queues);
err = devm_request_irq(dev, bp->queues[0].irq, 
gem_wol_interrupt,
   IRQF_SHARED, netdev->name, 
bp->queues);
if (err) {
@@ -4599,6 +4628,14 @@ static int __maybe_unused macb_suspend(struct device 
*dev)
queue_writel(bp->queues, IER, GEM_BIT(WOL));
gem_writel(bp, WOL, MACB_BIT(MAG));
} else {
+   err = devm_request_irq(dev, bp->queues[0].irq, 
macb_wol_interrupt,
+  IRQF_SHARED, netdev->name, 
bp->queues);
+   if (err) {
+   dev_err(dev,
+   "Unable to request IRQ %d (error %d)\n",
+   bp->queues[0].irq, err);
+   return err;
+   }
queue_writel(bp->queues, IER, MACB_BIT(WOL));
macb_writel(bp, WOL, MACB_BIT(MAG));
}
-- 
2.26.2



[PATCH v3 6/7] net: macb: WoL support for GEM type of Ethernet controller

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

Adapt the Wake-on-Lan feature to the Cadence GEM Ethernet controller.
This controller has different register layout and cannot be handled by
previous code.
We disable completely interrupts on all the queues but the queue 0.
Handling of WoL interrupt is done in another interrupt handler
positioned depending on the controller version used, just between
suspend() and resume() calls.
It allows to lower pressure on the generic interrupt hot path by
removing the need to handle 2 tests for each IRQ: the first figuring out
the controller revision, the second for actually knowing if the WoL bit
is set.

Queue management in suspend()/resume() functions inspired from RFC patch
by Harini Katakam , thanks!

Cc: Claudiu Beznea 
Cc: Harini Katakam 
Signed-off-by: Nicolas Ferre 
---
Changes in v3:
- In macb_resume(), move to a more in-depth re-configuration of the controller
  even on the non-WoL path in order to accept deeper sleep states.
- this ends up having a phylink_stop()/phylink_start() for each of the
  WoL/!WoL paths
- In macb_resume(), keep setting the MPE bit in NCR register which is needed in
  case of deep power saving mode used
- Tests done in "standby" as well as our deeper Power Management mode:
  Backup Self-Refresh (BSR)

Changes in v2:
- Addition of pm_wakeup_event() in WoL IRQ
- In macb_resume(), removal of setting the MPE bit in NCR register which is not
  needed in any case: IP is reset on the usual path and kept alive if WoL is 
used
- In macb_resume(), complete reset of the controller is kept only for non-WoL
  case. For the WoL case, we only replace the usual IRQ handler.


 drivers/net/ethernet/cadence/macb.h  |   3 +
 drivers/net/ethernet/cadence/macb_main.c | 141 +++
 2 files changed, 122 insertions(+), 22 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb.h 
b/drivers/net/ethernet/cadence/macb.h
index ab827fb4b6b9..4f1b41569260 100644
--- a/drivers/net/ethernet/cadence/macb.h
+++ b/drivers/net/ethernet/cadence/macb.h
@@ -90,6 +90,7 @@
 #define GEM_SA3T   0x009C /* Specific3 Top */
 #define GEM_SA4B   0x00A0 /* Specific4 Bottom */
 #define GEM_SA4T   0x00A4 /* Specific4 Top */
+#define GEM_WOL0x00b8 /* Wake on LAN */
 #define GEM_EFTSH  0x00e8 /* PTP Event Frame Transmitted Seconds 
Register 47:32 */
 #define GEM_EFRSH  0x00ec /* PTP Event Frame Received Seconds 
Register 47:32 */
 #define GEM_PEFTSH 0x00f0 /* PTP Peer Event Frame Transmitted 
Seconds Register 47:32 */
@@ -396,6 +397,8 @@
 #define MACB_PDRSFT_SIZE   1
 #define MACB_SRI_OFFSET26 /* TSU Seconds Register Increment */
 #define MACB_SRI_SIZE  1
+#define GEM_WOL_OFFSET 28 /* Enable wake-on-lan interrupt */
+#define GEM_WOL_SIZE   1
 
 /* Timer increment fields */
 #define MACB_TI_CNS_OFFSET 0
diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index b42831966ffa..be8454a8535b 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -1513,6 +1513,35 @@ static void macb_tx_restart(struct macb_queue *queue)
macb_writel(bp, NCR, macb_readl(bp, NCR) | MACB_BIT(TSTART));
 }
 
+static irqreturn_t gem_wol_interrupt(int irq, void *dev_id)
+{
+   struct macb_queue *queue = dev_id;
+   struct macb *bp = queue->bp;
+   u32 status;
+
+   status = queue_readl(queue, ISR);
+
+   if (unlikely(!status))
+   return IRQ_NONE;
+
+   spin_lock(>lock);
+
+   if (status & GEM_BIT(WOL)) {
+   queue_writel(queue, IDR, GEM_BIT(WOL));
+   gem_writel(bp, WOL, 0);
+   netdev_vdbg(bp->dev, "GEM WoL: queue = %u, isr = 0x%08lx\n",
+   (unsigned int)(queue - bp->queues),
+   (unsigned long)status);
+   if (bp->caps & MACB_CAPS_ISR_CLEAR_ON_WRITE)
+   queue_writel(queue, ISR, GEM_BIT(WOL));
+   pm_wakeup_event(>pdev->dev, 0);
+   }
+
+   spin_unlock(>lock);
+
+   return IRQ_HANDLED;
+}
+
 static irqreturn_t macb_interrupt(int irq, void *dev_id)
 {
struct macb_queue *queue = dev_id;
@@ -3306,6 +3335,8 @@ static const struct ethtool_ops macb_ethtool_ops = {
 static const struct ethtool_ops gem_ethtool_ops = {
.get_regs_len   = macb_get_regs_len,
.get_regs   = macb_get_regs,
+   .get_wol= macb_get_wol,
+   .set_wol= macb_set_wol,
.get_link   = ethtool_op_get_link,
.get_ts_info= macb_get_ts_info,
.get_ethtool_stats  = gem_get_ethtool_stats,
@@ -4534,20 +4565,54 @@ static int __maybe_unused macb_suspend(struct device 
*dev)
struct macb_queue *queue = bp->queues;
unsigned long flags;
unsigned int q;
+   int err;
 
if 

[PATCH v3 4/7] net: macb: fix macb_suspend() by removing call to netif_carrier_off()

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

As we now use the phylink call to phylink_stop() in the non-WoL path,
there is no need for this call to netif_carrier_off() anymore. It can
disturb the underlying phylink FSM.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Antoine Tenart 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
Changes in v2:
- new in v2 serries

 drivers/net/ethernet/cadence/macb_main.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index b17a33c60cd4..72b8983a763a 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4562,7 +4562,6 @@ static int __maybe_unused macb_suspend(struct device *dev)
bp->pm_data.scrt2 = gem_readl_n(bp, ETHT, SCRT2_ETHT);
}
 
-   netif_carrier_off(netdev);
if (bp->ptp_info)
bp->ptp_info->ptp_remove(netdev);
pm_runtime_force_suspend(dev);
-- 
2.26.2



[PATCH v3 0/7] net: macb: Wake-on-Lan magic packet fixes and GEM handling

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

Hi,
Here is the 3rd series to fix WoL magic-packet on the current macb driver.
I also add, in the second part of this series the feature to GEM types of IPs.
Please tell me if they should be separated; but the two last patches cannot go
without the 5 fixes first ones.

MACB and GEM code must co-exist and as they don't share exactly the same
register layout, I had to specialize a bit the suspend/resume paths and plug a
specific IRQ handler in order to avoid overloading the "normal" IRQ hot path.

The use of dumb buffers for RX that Harini implemented in [1] might
need to be considered for a follow-up patch series in order to address
lower-power modes on some of the platforms.
For instance, I didn't have to implement dumb buffers for some of the simpler
ARM9 platforms using MACB+FIFO types of controllers.

Please give feedback. Best regards,
  Nicolas

[1]:
https://github.com/Xilinx/linux-xlnx/commit/e9648006e8d9132db2594e50e700af362b3c9226#diff-41909d180431659ccc1229aa30fd4e5a
https://github.com/Xilinx/linux-xlnx/commit/60a21c686f7e4e50489ae04b9bb1980b145e52ef

Changes in v3:
- Revert some of the v2 changes done in macb_resume(). Now the resume function
  supports in-depth re-configuration of the controller in order to deal with
  deeper sleep states. Basically as it was before changes introduced by this
  series
- Tested for non-regression with our deeper Power Management mode which cuts
  power to the controller completely

Changes in v2:
- Add patch 4/7 ("net: macb: fix macb_suspend() by removing call to 
netif_carrier_off()")
  needed for keeping phy state consistent
- Add patch 5/7 ("net: macb: fix call to pm_runtime in the suspend/resume 
functions") that prevent
  putting the macb in runtime pm suspend mode when WoL is used
- Collect review tags on 3 first patches from Florian: Thanks!
- Review of macb_resume() function
- Addition of pm_wakeup_event() in both MACB and GEM WoL IRQ handlers

Nicolas Ferre (7):
  net: macb: fix wakeup test in runtime suspend/resume routines
  net: macb: mark device wake capable when "magic-packet" property
present
  net: macb: fix macb_get/set_wol() when moving to phylink
  net: macb: fix macb_suspend() by removing call to netif_carrier_off()
  net: macb: fix call to pm_runtime in the suspend/resume functions
  net: macb: WoL support for GEM type of Ethernet controller
  net: macb: Add WoL interrupt support for MACB type of Ethernet
controller

 drivers/net/ethernet/cadence/macb.h  |   3 +
 drivers/net/ethernet/cadence/macb_main.c | 209 +++
 2 files changed, 176 insertions(+), 36 deletions(-)

-- 
2.26.2



[PATCH v3 3/7] net: macb: fix macb_get/set_wol() when moving to phylink

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

Keep previous function goals and integrate phylink actions to them.

phylink_ethtool_get_wol() is not enough to figure out if Ethernet driver
supports Wake-on-Lan.
Initialization of "supported" and "wolopts" members is done in phylink
function, no need to keep them in calling function.

phylink_ethtool_set_wol() return value is not enough to determine
if WoL is enabled for the calling Ethernet driver. Call it first
but don't rely on its return value as most of simple PHY drivers
don't implement a set_wol() function.

Fixes: 7897b071ac3b ("net: macb: convert to phylink")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Antoine Tenart 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
 drivers/net/ethernet/cadence/macb_main.c | 18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index 629660d9f17e..b17a33c60cd4 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -2813,21 +2813,23 @@ static void macb_get_wol(struct net_device *netdev, 
struct ethtool_wolinfo *wol)
 {
struct macb *bp = netdev_priv(netdev);
 
-   wol->supported = 0;
-   wol->wolopts = 0;
-
-   if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET)
+   if (bp->wol & MACB_WOL_HAS_MAGIC_PACKET) {
phylink_ethtool_get_wol(bp->phylink, wol);
+   wol->supported |= WAKE_MAGIC;
+
+   if (bp->wol & MACB_WOL_ENABLED)
+   wol->wolopts |= WAKE_MAGIC;
+   }
 }
 
 static int macb_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
struct macb *bp = netdev_priv(netdev);
-   int ret;
 
-   ret = phylink_ethtool_set_wol(bp->phylink, wol);
-   if (!ret)
-   return 0;
+   /* Pass the order to phylink layer.
+* Don't test return value as set_wol() is often not supported.
+*/
+   phylink_ethtool_set_wol(bp->phylink, wol);
 
if (!(bp->wol & MACB_WOL_HAS_MAGIC_PACKET) ||
(wol->wolopts & ~WAKE_MAGIC))
-- 
2.26.2



[PATCH v3 2/7] net: macb: mark device wake capable when "magic-packet" property present

2020-05-04 Thread nicolas.ferre
From: Nicolas Ferre 

Change the way the "magic-packet" DT property is handled in the
macb_probe() function, matching DT binding documentation.
Now we mark the device as "wakeup capable" instead of calling the
device_init_wakeup() function that would enable the wakeup source.

For Ethernet WoL, enabling the wakeup_source is done by
using ethtool and associated macb_set_wol() function that
already calls device_set_wakeup_enable() for this purpose.

That would reduce power consumption by cutting more clocks if
"magic-packet" property is set but WoL is not configured by ethtool.

Fixes: 3e2a5e153906 ("net: macb: add wake-on-lan support via magic packet")
Cc: Claudiu Beznea 
Cc: Harini Katakam 
Cc: Sergio Prado 
Reviewed-by: Florian Fainelli 
Signed-off-by: Nicolas Ferre 
---
 drivers/net/ethernet/cadence/macb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c 
b/drivers/net/ethernet/cadence/macb_main.c
index d1b4d6b6d7c8..629660d9f17e 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4384,7 +4384,7 @@ static int macb_probe(struct platform_device *pdev)
bp->wol = 0;
if (of_get_property(np, "magic-packet", NULL))
bp->wol |= MACB_WOL_HAS_MAGIC_PACKET;
-   device_init_wakeup(>dev, bp->wol & MACB_WOL_HAS_MAGIC_PACKET);
+   device_set_wakeup_capable(>dev, bp->wol & 
MACB_WOL_HAS_MAGIC_PACKET);
 
spin_lock_init(>lock);
 
-- 
2.26.2



Re: [PATCH net v3] net: macb: fix an issue about leak related system resources

2020-05-03 Thread Nicolas.Ferre
On 03/05/2020 at 14:32, Dejin Zheng wrote:
> A call of the function macb_init() can fail in the function
> fu540_c000_init. The related system resources were not released
> then. use devm_platform_ioremap_resource() to replace ioremap()
> to fix it.
> 
> Fixes: c218ad559020ff9 ("macb: Add support for SiFive FU540-C000")
> Cc: Andy Shevchenko 
> Reviewed-by: Yash Shah 
> Suggested-by: Nicolas Ferre 

Acked-by: Nicolas Ferre 

> Suggested-by: Andy Shevchenko 
> Signed-off-by: Dejin Zheng 
> ---
> v2 -> v3:
>  - use IS_ERR() and PTR_ERR() for error handling by Nicolas's
>suggestion. Thanks Nicolas!
> v1 -> v2:
>  - Nicolas and Andy suggest use devm_platform_ioremap_resource()
>to repalce devm_ioremap() to fix this issue. Thanks Nicolas
>and Andy.
>  - Yash help me to review this patch, Thanks Yash!
> 
>   drivers/net/ethernet/cadence/macb_main.c | 12 +++-
>   1 file changed, 3 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
> b/drivers/net/ethernet/cadence/macb_main.c
> index a0e8c5bbabc0..f040a36d6e54 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4172,15 +4172,9 @@ static int fu540_c000_clk_init(struct platform_device 
> *pdev, struct clk **pclk,
> 
>   static int fu540_c000_init(struct platform_device *pdev)
>   {
> -   struct resource *res;
> -
> -   res = platform_get_resource(pdev, IORESOURCE_MEM, 1);
> -   if (!res)
> -   return -ENODEV;
> -
> -   mgmt->reg = ioremap(res->start, resource_size(res));
> -   if (!mgmt->reg)
> -   return -ENOMEM;
> +   mgmt->reg = devm_platform_ioremap_resource(pdev, 1);
> +   if (IS_ERR(mgmt->reg))
> +   return PTR_ERR(mgmt->reg);
> 
>  return macb_init(pdev);
>   }
> --
> 2.25.0
> 


-- 
Nicolas Ferre


Re: [PATCH] USB: host: ohci-at91: Remove unused variable regs in at91_stop_hc

2019-10-14 Thread Nicolas.Ferre
On 11/10/2019 at 20:59, Nathan Chancellor wrote:
> drivers/usb/host/ohci-at91.c:118:28: warning: unused variable 'regs'
> [-Wunused-variable]
>  struct ohci_regs __iomem *regs = hcd->regs;
>^
> 1 warning generated.
> 
> Fixes: 9c4567fa0a44 ("USB: host: ohci-at91: completely shutdown the 
> controller in at91_stop_hc()")
> Signed-off-by: Nathan Chancellor 

Acked-by: Nicolas Ferre 

> ---
>   drivers/usb/host/ohci-at91.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ohci-at91.c b/drivers/usb/host/ohci-at91.c
> index 513e48397743..b635c6a1b1a9 100644
> --- a/drivers/usb/host/ohci-at91.c
> +++ b/drivers/usb/host/ohci-at91.c
> @@ -115,7 +115,6 @@ static void at91_start_hc(struct platform_device *pdev)
>   static void at91_stop_hc(struct platform_device *pdev)
>   {
>   struct usb_hcd *hcd = platform_get_drvdata(pdev);
> - struct ohci_regs __iomem *regs = hcd->regs;
>   struct ohci_at91_priv *ohci_at91 = hcd_to_ohci_at91_priv(hcd);
>   
>   dev_dbg(>dev, "stop\n");
> 


-- 
Nicolas Ferre


Re: [PATCH] ARM: configs: at91: unselect PIT

2019-10-10 Thread Nicolas.Ferre
On 09/10/2019 at 21:48, Alexandre Belloni wrote:

> The PIT is not required anymore to successfully boot and may actually harm
> in case preempt-rt is used because the PIT interrupt is shared.
> Disable it so the TCB clocksource is used.
> 
> Signed-off-by: Alexandre Belloni 

Acked-by: Nicolas Ferre 

> ---
>   arch/arm/configs/at91_dt_defconfig | 1 +
>   arch/arm/configs/sama5_defconfig   | 1 +
>   2 files changed, 2 insertions(+)
> 
> diff --git a/arch/arm/configs/at91_dt_defconfig 
> b/arch/arm/configs/at91_dt_defconfig
> index 63d09e61b6dc..7e5ffdab47da 100644
> --- a/arch/arm/configs/at91_dt_defconfig
> +++ b/arch/arm/configs/at91_dt_defconfig
> @@ -18,6 +18,7 @@ CONFIG_ARCH_MULTI_V5=y
>   CONFIG_ARCH_AT91=y
>   CONFIG_SOC_AT91RM9200=y
>   CONFIG_SOC_AT91SAM9=y
> +# CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
>   CONFIG_AEABI=y
>   CONFIG_UACCESS_WITH_MEMCPY=y
>   CONFIG_ZBOOT_ROM_TEXT=0x0
> diff --git a/arch/arm/configs/sama5_defconfig 
> b/arch/arm/configs/sama5_defconfig
> index 7255709d46ea..ee7db6cedaa6 100644
> --- a/arch/arm/configs/sama5_defconfig
> +++ b/arch/arm/configs/sama5_defconfig
> @@ -20,6 +20,7 @@ CONFIG_ARCH_AT91=y
>   CONFIG_SOC_SAMA5D2=y
>   CONFIG_SOC_SAMA5D3=y
>   CONFIG_SOC_SAMA5D4=y
> +# CONFIG_ATMEL_CLOCKSOURCE_PIT is not set
>   CONFIG_AEABI=y
>   CONFIG_UACCESS_WITH_MEMCPY=y
>   CONFIG_ZBOOT_ROM_TEXT=0x0
> 


-- 
Nicolas Ferre


Re: [PATCH] clk: at91: sam9x60: fix programmable clock

2019-09-24 Thread Nicolas.Ferre
On 24/09/2019 at 12:39, Eugen Hristev - M18282 wrote:
> From: Eugen Hristev 
> 
> The prescaler mask for sam9x60 must be 0xff (8 bits).
> Being set to 0, means that we cannot set any prescaler, thus the
> programmable clocks do not work (except the case with prescaler 0)
> Set the mask accordingly in layout struct.
> 
> Fixes: 01e2113de9a5 ("clk: at91: add sam9x60 pmc driver")
> Signed-off-by: Eugen Hristev 

Acked-by: Nicolas Ferre 

Thanks Eugen. Best regards,
   Nicolas

> ---
>   drivers/clk/at91/sam9x60.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/clk/at91/sam9x60.c b/drivers/clk/at91/sam9x60.c
> index 9790ddf..86238d5 100644
> --- a/drivers/clk/at91/sam9x60.c
> +++ b/drivers/clk/at91/sam9x60.c
> @@ -43,6 +43,7 @@ static const struct clk_pll_characteristics 
> upll_characteristics = {
>   };
>   
>   static const struct clk_programmable_layout sam9x60_programmable_layout = {
> + .pres_mask = 0xff,
>   .pres_shift = 8,
>   .css_mask = 0x1f,
>   .have_slck_mck = 0,
> 


-- 
Nicolas Ferre


Re: [PATCH] clk: at91: allow 24 Mhz clock as input for PLL

2019-09-11 Thread Nicolas.Ferre
On 11/09/2019 at 08:39, Eugen Hristev - M18282 wrote:
> From: Eugen Hristev 
> 
> The PLL input range needs to be able to allow 24 Mhz crystal as input
> Update the range accordingly in plla characteristics struct
> 
> Signed-off-by: Eugen Hristev 

Acked-by: Nicolas Ferre 
Thanks Eugen!

Best regards,
   Nicolas

> ---
>   drivers/clk/at91/sama5d2.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/at91/sama5d2.c b/drivers/clk/at91/sama5d2.c
> index 6509d09..0de1108 100644
> --- a/drivers/clk/at91/sama5d2.c
> +++ b/drivers/clk/at91/sama5d2.c
> @@ -21,7 +21,7 @@ static const struct clk_range plla_outputs[] = {
>   };
>   
>   static const struct clk_pll_characteristics plla_characteristics = {
> - .input = { .min = 1200, .max = 1200 },
> + .input = { .min = 1200, .max = 2400 },
>   .num_output = ARRAY_SIZE(plla_outputs),
>   .output = plla_outputs,
>   .icpll = plla_icpll,
> 


-- 
Nicolas Ferre


Re: Status of Subsystems - MICROCHIP SAMA5D2-COMPATIBLE PIOBU GPIO

2019-08-23 Thread Nicolas.Ferre
Sebastian,

On 20/08/2019 at 15:27, Sebastian Duda wrote:
> Hello Andrei,
> 
> in my master thesis, I'm using the association of subsystems to
> maintainers/reviewers and its status given in the MAINTAINERS file.
> During the research I noticed that there are several subsystems without
> a status in the maintainers file. One of them is the subsystem
> `MICROCHIP SAMA5D2-COMPATIBLE PIOBU GPIO` where you're mentioned as
> maintainer.
> 
> Is it intended not to mention a status for your subsystems?
> What is the current status of your subsystem?

I've just removed this entry and merged it with other gpio/pinctrl 
driver's entry:
https://lore.kernel.org/linux-arm-kernel/20190823083158.2649-1-nicolas.fe...@microchip.com/

Best regards,
-- 
Nicolas Ferre


Re: [PATCH] MAINTAINERS: Update path to tcb_clksrc.c

2019-08-23 Thread Nicolas.Ferre
On 14/08/2019 at 11:08, Alexandre Belloni wrote:
> External E-Mail
> 
> 
> On 13/08/2019 08:11:23+, Nicolas Ferre wrote:
>> On 13/08/2019 at 08:10, Denis Efremov wrote:
>>> Update MAINTAINERS record to reflect the filename change
>>> from tcb_clksrc.c to timer-atmel-tcb.c
>>>
>>> Cc: Nicolas Ferre 
>>
>> Acked-by: Nicolas Ferre 
>> But, while you're at it, I would add another line: see below...
>>
>>> Cc: Alexandre Belloni 
>>> Cc: linux-arm-ker...@lists.infradead.org
>>> Fixes: a7aae768166e ("clocksource/drivers/tcb_clksrc: Rename the file for 
>>> consistency")
>>> Signed-off-by: Denis Efremov 
>>> ---
>>>MAINTAINERS | 2 +-
>>>1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/MAINTAINERS b/MAINTAINERS
>>> index c9ad38a9414f..3ec8154e4630 100644
>>> --- a/MAINTAINERS
>>> +++ b/MAINTAINERS
>>> @@ -10637,7 +10637,7 @@ M:  Nicolas Ferre 
>>
>> +M:  Alexandre Belloni 
>>
>> But Alexandre have to agree, of course.
>>
>>>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
>>> +F: drivers/clocksource/timer-atmel-tcb.c
>>>
>>>MICROCHIP USBA UDC DRIVER
>>>M:   Cristian Birsan 
>>
>> We could also remove this entry and mix it with:
>> "ARM/Microchip (AT91) SoC support"
>>
>> But I prefer to keep it separated like this for various reasons.
>>
> 
> I would simply remove this entry because all the files are already
> matching the SoC entry (it has N: atmel) and atmel_tclib will go away (I
> have a series to do that).

All right: let's remove it.

Thanks Denis for the heads-up!

Best regards,
   Nicolas

> If you want to keep a separate entry, maybe we should then add the
> system timer and pit drivers.
> 
> 


-- 
Nicolas Ferre


Re: [PATCH 2/3] macb: Update compatibility string for SiFive FU540-C000

2019-08-20 Thread Nicolas.Ferre
On 20/08/2019 at 11:10, Andreas Schwab wrote:
> External E-Mail
> 
> 
> On Aug 13 2019, Paul Walmsley  wrote:
> 
>> Dave, Nicolas,
>>
>> On Mon, 22 Jul 2019, Yash Shah wrote:
>>
>>> On Fri, Jul 19, 2019 at 5:36 PM  wrote:

 On 19/07/2019 at 13:10, Yash Shah wrote:
> Update the compatibility string for SiFive FU540-C000 as per the new
> string updated in the binding doc.
> Reference: https://lkml.org/lkml/2019/7/17/200

 Maybe referring to lore.kernel.org is better:
 https://lore.kernel.org/netdev/caj2_jofevzqat0yprg4hem4jrrqkb72fkseqj4p8p5ka-+r...@mail.gmail.com/
>>>
>>> Sure. Will keep that in mind for future reference.
>>>

> Signed-off-by: Yash Shah 

 Acked-by: Nicolas Ferre 
>>>
>>> Thanks.
>>
>> Am assuming you'll pick this up for the -net tree for v5.4-rc1 or earlier.
>> If not, please let us know.
> 
> This is still missing in v5.4-rc5, which means that networking is broken.

Andreas, Paul,

The patchwork state for the 2 first patches of this series is "Changes 
Requested". It's probably due to my advice of using lore.kernel.org (or 
something else).

I'm perfectly fine in accepting the patches are they are today but can't 
change their patchwork state myself. We would need Dave or Jakub to take 
them.

Dave, Jakub,

All tags are collected in patchwork and all should be fine on DT (Rob) 
side as well.
Please tell me if you're waiting some sign from me.

Best regards,
-- 
Nicolas Ferre


Re: [PATCH] MAINTAINERS: Update path to tcb_clksrc.c

2019-08-13 Thread Nicolas.Ferre
On 13/08/2019 at 08:10, Denis Efremov wrote:
> Update MAINTAINERS record to reflect the filename change
> from tcb_clksrc.c to timer-atmel-tcb.c
> 
> Cc: Nicolas Ferre 

Acked-by: Nicolas Ferre 
But, while you're at it, I would add another line: see below...

> Cc: Alexandre Belloni 
> Cc: linux-arm-ker...@lists.infradead.org
> Fixes: a7aae768166e ("clocksource/drivers/tcb_clksrc: Rename the file for 
> consistency")
> Signed-off-by: Denis Efremov 
> ---
>   MAINTAINERS | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index c9ad38a9414f..3ec8154e4630 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10637,7 +10637,7 @@ M:Nicolas Ferre 

+M:  Alexandre Belloni 

But Alexandre have to agree, of course.

>   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
> +F:   drivers/clocksource/timer-atmel-tcb.c
>   
>   MICROCHIP USBA UDC DRIVER
>   M:  Cristian Birsan 

We could also remove this entry and mix it with:
"ARM/Microchip (AT91) SoC support"

But I prefer to keep it separated like this for various reasons.

Best regards,
-- 
Nicolas Ferre


Re: [PATCH 2/3] macb: Update compatibility string for SiFive FU540-C000

2019-07-19 Thread Nicolas.Ferre
On 19/07/2019 at 13:10, Yash Shah wrote:
> Update the compatibility string for SiFive FU540-C000 as per the new
> string updated in the binding doc.
> Reference: https://lkml.org/lkml/2019/7/17/200

Maybe referring to lore.kernel.org is better:
https://lore.kernel.org/netdev/caj2_jofevzqat0yprg4hem4jrrqkb72fkseqj4p8p5ka-+r...@mail.gmail.com/

> Signed-off-by: Yash Shah 

Acked-by: Nicolas Ferre 

Thanks, best regards,
   Nicolas

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
> b/drivers/net/ethernet/cadence/macb_main.c
> index 15d0737..305371c 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4112,7 +4112,7 @@ static int fu540_c000_init(struct platform_device *pdev)
>   { .compatible = "cdns,emac", .data = _config },
>   { .compatible = "cdns,zynqmp-gem", .data = _config},
>   { .compatible = "cdns,zynq-gem", .data = _config },
> - { .compatible = "sifive,fu540-macb", .data = _c000_config },
> + { .compatible = "sifive,fu540-c000-gem", .data = _c000_config },
>   { /* sentinel */ }
>   };
>   MODULE_DEVICE_TABLE(of, macb_dt_ids);
> 


-- 
Nicolas Ferre


Re: [PATCH 1/3] macb: bindings doc: update sifive fu540-c000 binding

2019-07-19 Thread Nicolas.Ferre
On 19/07/2019 at 13:10, Yash Shah wrote:
> As per the discussion with Nicolas Ferre, rename the compatible property
> to a more appropriate and specific string.
> LINK: https://lkml.org/lkml/2019/7/17/200
> 
> Signed-off-by: Yash Shah 

Acked-by: Nicolas Ferre 

> ---
>   Documentation/devicetree/bindings/net/macb.txt | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/net/macb.txt 
> b/Documentation/devicetree/bindings/net/macb.txt
> index 63c73fa..0b61a90 100644
> --- a/Documentation/devicetree/bindings/net/macb.txt
> +++ b/Documentation/devicetree/bindings/net/macb.txt
> @@ -15,10 +15,10 @@ Required properties:
> Use "atmel,sama5d4-gem" for the GEM IP (10/100) available on Atmel 
> sama5d4 SoCs.
> Use "cdns,zynq-gem" Xilinx Zynq-7xxx SoC.
> Use "cdns,zynqmp-gem" for Zynq Ultrascale+ MPSoC.
> -  Use "sifive,fu540-macb" for SiFive FU540-C000 SoC.
> +  Use "sifive,fu540-c000-gem" for SiFive FU540-C000 SoC.
> Or the generic form: "cdns,emac".
>   - reg: Address and length of the register set for the device
> - For "sifive,fu540-macb", second range is required to specify the
> + For "sifive,fu540-c000-gem", second range is required to specify the
>   address and length of the registers for GEMGXL Management block.
>   - interrupts: Should contain macb interrupt
>   - phy-mode: See ethernet.txt file in the same directory.
> 


-- 
Nicolas Ferre


Re: [RESEND][PATCH] clk: at91: generated: Truncate divisor to GENERATED_MAX_DIV + 1

2019-07-03 Thread Nicolas.Ferre
On 25/06/2019 at 11:10, Codrin Ciubotariu wrote:
> In clk_generated_determine_rate(), if the divisor is greater than
> GENERATED_MAX_DIV + 1, then the wrong best_rate will be returned.
> If clk_generated_set_rate() will be called later with this wrong
> rate, it will return -EINVAL, so the generated clock won't change
> its value. Do no let the divisor be greater than GENERATED_MAX_DIV + 1.
> 
> Fixes: 8c7aa6328947 ("clk: at91: clk-generated: remove useless divisor loop")
> Signed-off-by: Codrin Ciubotariu 
> Acked-by: Nicolas Ferre 
> Acked-by: Ludovic Desroches 
> ---
> 
> - The email-server was converting my patches to base64, so I resend it
>using another server;
> - Added acked-bys from Nicolas and Ludovic;

Stephen,

I don't see this patch in linux-next and we're already late in the 
development cycle: aka ping...

Best regards,
   Nicolas

> 
>   drivers/clk/at91/clk-generated.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/at91/clk-generated.c 
> b/drivers/clk/at91/clk-generated.c
> index 5f18847965c1..290cffe35deb 100644
> --- a/drivers/clk/at91/clk-generated.c
> +++ b/drivers/clk/at91/clk-generated.c
> @@ -146,6 +146,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
>   continue;
>   
>   div = DIV_ROUND_CLOSEST(parent_rate, req->rate);
> + if (div > GENERATED_MAX_DIV + 1)
> + div = GENERATED_MAX_DIV + 1;
>   
>   clk_generated_best_diff(req, parent, parent_rate, div,
>   _diff, _rate);
> 


-- 
Nicolas Ferre


Re: [PATCH v2 2/2] net: macb: Kconfig: Rename Atmel to Cadence

2019-06-25 Thread Nicolas.Ferre
On 25/06/2019 at 10:48, Palmer Dabbelt wrote:
> The help text makes it look like NET_VENDOR_CADENCE enables support for
> Atmel devices, when in reality it's a driver written by Atmel that
> supports Cadence devices.  This may confuse users that have this device
> on a non-Atmel SoC.
> 
> The fix is just s/Atmel/Cadence/, but I did go and re-wrap the Kconfig
> help text as that change caused it to go over 80 characters.
> 
> Signed-off-by: Palmer Dabbelt 

Acked-by: Nicolas Ferre 

> ---
>   drivers/net/ethernet/cadence/Kconfig | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/Kconfig 
> b/drivers/net/ethernet/cadence/Kconfig
> index 64d8d6ee7739..f4b3bd85dfe3 100644
> --- a/drivers/net/ethernet/cadence/Kconfig
> +++ b/drivers/net/ethernet/cadence/Kconfig
> @@ -1,6 +1,6 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   #
> -# Atmel device configuration
> +# Cadence device configuration
>   #
>   
>   config NET_VENDOR_CADENCE
> @@ -13,8 +13,8 @@ config NET_VENDOR_CADENCE
> If unsure, say Y.
>   
> Note that the answer to this question doesn't directly affect the
> -   kernel: saying N will just cause the configurator to skip all
> -   the remaining Atmel network card questions. If you say Y, you will be
> +   kernel: saying N will just cause the configurator to skip all the
> +   remaining Cadence network card questions. If you say Y, you will be
> asked for your specific card in the following questions.
>   
>   if NET_VENDOR_CADENCE
> 


-- 
Nicolas Ferre


Re: [PATCH v2 1/2] net: macb: Kconfig: Make MACB depend on COMMON_CLK

2019-06-25 Thread Nicolas.Ferre
On 25/06/2019 at 10:48, Palmer Dabbelt wrote:
> commit c218ad559020 ("macb: Add support for SiFive FU540-C000") added a
> dependency on the common clock framework to the macb driver, but didn't
> express that dependency in Kconfig.  As a result macb now fails to
> compile on systems without COMMON_CLK, which specifically causes a build
> failure on powerpc allyesconfig.
> 
> This patch adds the dependency, which results in the macb driver no
> longer being selectable on systems without the common clock framework.
> All known systems that have this device already support the common clock
> framework, so this should not cause trouble for any uses.  Supporting
> both the FU540-C000 and systems without COMMON_CLK is quite ugly.
> 
> I've build tested this on powerpc allyesconfig and RISC-V defconfig
> (which selects MACB), but I have not even booted the resulting kernels.
> 
> Fixes: c218ad559020 ("macb: Add support for SiFive FU540-C000")
> Signed-off-by: Palmer Dabbelt 

Acked-by: Nicolas Ferre 

Thanks!

> ---
>   drivers/net/ethernet/cadence/Kconfig | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/Kconfig 
> b/drivers/net/ethernet/cadence/Kconfig
> index 1766697c9c5a..64d8d6ee7739 100644
> --- a/drivers/net/ethernet/cadence/Kconfig
> +++ b/drivers/net/ethernet/cadence/Kconfig
> @@ -21,7 +21,7 @@ if NET_VENDOR_CADENCE
>   
>   config MACB
>   tristate "Cadence MACB/GEM support"
> - depends on HAS_DMA
> + depends on HAS_DMA && COMMON_CLK
>   select PHYLIB
>   ---help---
> The Cadence MACB ethernet interface is found on many Atmel AT32 and
> @@ -42,7 +42,7 @@ config MACB_USE_HWSTAMP
>   
>   config MACB_PCI
>   tristate "Cadence PCI MACB/GEM support"
> - depends on MACB && PCI && COMMON_CLK
> + depends on MACB && PCI
>   ---help---
> This is PCI wrapper for MACB driver.
>   
> 


-- 
Nicolas Ferre


Re: [PATCH net-next] net: macb: use NAPI_POLL_WEIGHT

2019-06-24 Thread Nicolas.Ferre
On 21/06/2019 at 17:28, Antoine Tenart wrote:
> Use NAPI_POLL_WEIGHT, the default NAPI poll() weight instead of
> redefining our own value (which turns out to be 64 as well).
> 
> Signed-off-by: Antoine Tenart 

Acked-by: Nicolas Ferre 

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
> b/drivers/net/ethernet/cadence/macb_main.c
> index 163deba244ab..1cd1f2c36d6f 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -3490,7 +3490,7 @@ static int macb_init(struct platform_device *pdev)
>   
>   queue = >queues[q];
>   queue->bp = bp;
> - netif_napi_add(dev, >napi, macb_poll, 64);
> + netif_napi_add(dev, >napi, macb_poll, NAPI_POLL_WEIGHT);
>   if (hw_q) {
>   queue->ISR  = GEM_ISR(hw_q - 1);
>   queue->IER  = GEM_IER(hw_q - 1);
> 


-- 
Nicolas Ferre


Re: [PATCH net] net: macb: do not copy the mac address if NULL

2019-06-24 Thread Nicolas.Ferre
On 21/06/2019 at 17:26, Antoine Tenart wrote:
> This patch fixes the MAC address setup in the probe. The MAC address
> retrieved using of_get_mac_address was checked for not containing an
> error, but it may also be NULL which wasn't tested. Fix it by replacing
> IS_ERR with IS_ERR_OR_NULL.
> 
> Fixes: 541ddc66d665 ("net: macb: support of_get_mac_address new ERR_PTR 
> error")
> Signed-off-by: Antoine Tenart 

Acked-by: Nicolas Ferre 

It could be good to have this fix for 5.2-final...

Thanks!

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
> b/drivers/net/ethernet/cadence/macb_main.c
> index 1241a2a73438..1cd1f2c36d6f 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4304,7 +4304,7 @@ static int macb_probe(struct platform_device *pdev)
>   if (PTR_ERR(mac) == -EPROBE_DEFER) {
>   err = -EPROBE_DEFER;
>   goto err_out_free_netdev;
> - } else if (!IS_ERR(mac)) {
> + } else if (!IS_ERR_OR_NULL(mac)) {
>   ether_addr_copy(bp->dev->dev_addr, mac);
>   } else {
>   macb_get_hwaddr(bp);
> 


-- 
Nicolas Ferre


Re: [PATCH 2/2] net: macb: Kconfig: Rename Atmel to Cadence

2019-06-24 Thread Nicolas.Ferre
On 24/06/2019 at 11:57, Palmer Dabbelt wrote:
> External E-Mail
> 
> 
> On Mon, 24 Jun 2019 02:49:16 PDT (-0700), nicolas.fe...@microchip.com wrote:
>> On 24/06/2019 at 08:16, Palmer Dabbelt wrote:
>>> External E-Mail
>>>
>>>
>>> When touching the Kconfig for this driver I noticed that both the
>>> Kconfig help text and a comment referred to this being an Atmel driver.
>>> As far as I know, this is a Cadence driver.  The fix is just
>>
>> Indeed: was written and then maintained by Atmel (now Microchip) for
>> years... So I would say that more than a "Cadence driver" it's a driver
>> that applies to a Cadence peripheral.
>>
>> I won't hold the patch just for this as the patch makes perfect sense,
>> but would love that it's been highlighted...
> 
> OK, I don't mind changing it.  Does this look OK?  I have to submit a v2 
> anyway
> for the first patch.

Yep, nice!

Thanks,
   Nicolas

> 
> Author: Palmer Dabbelt 
> Date:   Sun Jun 23 23:04:14 2019 -0700
> 
>  net: macb: Kconfig: Rename Atmel to Cadence
> 
>  The help text makes it look like NET_VENDOR_CADENCE enables support for
>  Atmel devices, when in reality it's a driver written by Atmel that
>  supports Cadence devices.  This may confuse users that have this device
>  on a non-Atmel SoC.
> 
>  The fix is just s/Atmel/Cadence/, but I did go and re-wrap the Kconfig
>  help text as that change caused it to go over 80 characters.
> 
>  Signed-off-by: Palmer Dabbelt 
> 
> diff --git a/drivers/net/ethernet/cadence/Kconfig 
> b/drivers/net/ethernet/cadence/Kconfig
> index 74ee2bfd2369..29b6132b418e 100644
> --- a/drivers/net/ethernet/cadence/Kconfig
> +++ b/drivers/net/ethernet/cadence/Kconfig
> @@ -1,6 +1,6 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   #
> -# Atmel device configuration
> +# Cadence device configuration
>   #
> 
>   config NET_VENDOR_CADENCE
> @@ -13,8 +13,8 @@ config NET_VENDOR_CADENCE
>If unsure, say Y.
> 
>Note that the answer to this question doesn't directly affect the
> - kernel: saying N will just cause the configurator to skip all
> - the remaining Atmel network card questions. If you say Y, you will 
> be
> + kernel: saying N will just cause the configurator to skip all the
> + remaining Cadence network card questions. If you say Y, you will be
>asked for your specific card in the following questions.
> 
>   if NET_VENDOR_CADENCE
> 
>>
>>> s/Atmel/Cadence/, but I did go and re-wrap the Kconfig help text as that
>>> change caused it to go over 80 characters.
>>>
>>> Signed-off-by: Palmer Dabbelt 
>>> ---
>>>drivers/net/ethernet/cadence/Kconfig | 6 +++---
>>>1 file changed, 3 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/net/ethernet/cadence/Kconfig 
>>> b/drivers/net/ethernet/cadence/Kconfig
>>> index 74ee2bfd2369..29b6132b418e 100644
>>> --- a/drivers/net/ethernet/cadence/Kconfig
>>> +++ b/drivers/net/ethernet/cadence/Kconfig
>>> @@ -1,6 +1,6 @@
>>># SPDX-License-Identifier: GPL-2.0-only
>>>#
>>> -# Atmel device configuration
>>> +# Cadence device configuration
>>>#
>>>
>>>config NET_VENDOR_CADENCE
>>> @@ -13,8 +13,8 @@ config NET_VENDOR_CADENCE
>>>   If unsure, say Y.
>>>
>>>   Note that the answer to this question doesn't directly affect the
>>> - kernel: saying N will just cause the configurator to skip all
>>> - the remaining Atmel network card questions. If you say Y, you will be
>>> + kernel: saying N will just cause the configurator to skip all the
>>> + remaining Cadence network card questions. If you say Y, you will be
>>>   asked for your specific card in the following questions.
>>>
>>>if NET_VENDOR_CADENCE
>>>
>>
>>
>> -- 
>> Nicolas Ferre


-- 
Nicolas Ferre


Re: [PATCH 1/2] net/macb: bindings doc: add sifive fu540-c000 binding

2019-06-24 Thread Nicolas.Ferre
On 23/05/2019 at 22:50, Rob Herring wrote:
> On Thu, May 23, 2019 at 6:46 AM Yash Shah  wrote:
>>
>> Add the compatibility string documentation for SiFive FU540-C
>> interface.
>> On the FU540, this driver also needs to read and write registers in a
>> management IP block that monitors or drives boundary signals for the
>> GEMGXL IP block that are not directly mapped to GEMGXL registers.
>> Therefore, add additional range to "reg" property for SiFive GEMGXL
>> management IP registers.
>>
>> Signed-off-by: Yash Shah 
>> ---
>>   Documentation/devicetree/bindings/net/macb.txt | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/net/macb.txt 
>> b/Documentation/devicetree/bindings/net/macb.txt
>> index 9c5e944..91a2a66 100644
>> --- a/Documentation/devicetree/bindings/net/macb.txt
>> +++ b/Documentation/devicetree/bindings/net/macb.txt
>> @@ -4,6 +4,7 @@ Required properties:
>>   - compatible: Should be "cdns,[-]{macb|gem}"
>> Use "cdns,at91rm9200-emac" Atmel at91rm9200 SoC.
>> Use "cdns,at91sam9260-macb" for Atmel at91sam9 SoCs.
>> +  Use "cdns,fu540-macb" for SiFive FU540-C000 SoC.
> 
> This pattern that Atmel started isn't really correct. The vendor
> prefix here should be sifive. 'cdns' would be appropriate for a
> fallback.

Ok, we missed this for the sam9x60 SoC that we added recently then.

Anyway a little too late, coming back to this machine, and talking to 
Yash, isn't "sifive,fu540-c000-macb" more specific and a better match 
for being future proof? I would advice for the most specific possible 
with other compatible strings on the same line in the DT, like:

"sifive,fu540-c000-macb", "sifive,fu540-macb"

Moreover, is it really a "macb" or a "gem" type of interface from 
Cadence? Not a big deal, but just to discuss the topic to the bone...

Note that I'm fine if you consider that what you have in net-next new is 
correct.

Regards,
   Nicolas

>> Use "cdns,sam9x60-macb" for Microchip sam9x60 SoC.
>> Use "cdns,np4-macb" for NP4 SoC devices.
>> Use "cdns,at32ap7000-macb" for other 10/100 usage or use the generic 
>> form: "cdns,macb".
>> @@ -17,6 +18,8 @@ Required properties:
>> Use "cdns,zynqmp-gem" for Zynq Ultrascale+ MPSoC.
>> Or the generic form: "cdns,emac".
>>   - reg: Address and length of the register set for the device
>> +   For "cdns,fu540-macb", second range is required to specify the
>> +   address and length of the registers for GEMGXL Management block.
>>   - interrupts: Should contain macb interrupt
>>   - phy-mode: See ethernet.txt file in the same directory.
>>   - clock-names: Tuple listing input clock names.
>> --
>> 1.9.1
>>
> 


-- 
Nicolas Ferre


Re: [PATCH 1/2] net: macb: Fix compilation on systems without COMMON_CLK

2019-06-24 Thread Nicolas.Ferre
On 24/06/2019 at 11:57, Palmer Dabbelt wrote:
> External E-Mail
> 
> 
> On Mon, 24 Jun 2019 02:40:21 PDT (-0700), nicolas.fe...@microchip.com wrote:
>> On 24/06/2019 at 08:16, Palmer Dabbelt wrote:
>>> External E-Mail
>>>
>>>
>>> The patch to add support for the FU540-C000 added a dependency on
>>> COMMON_CLK, but didn't express that via Kconfig.  This fixes the build
>>> failure by adding CONFIG_MACB_FU540, which depends on COMMON_CLK and
>>> conditionally enables the FU540-C000 support.
>>
>> Let's try to limit the use of  #ifdef's throughout the code. We are
>> using them in this driver but only for the hot paths and things that
>> have an impact on performance. I don't think it's the case here: so
>> please find another option => NACK.
> 
> OK.  Would you accept adding a Kconfig dependency of the generic MACB driver 
> on
> COMMON_CLK, as suggested in the cover letter?

Yes: all users of this peripheral have COMMON_CLK set.
You can remove it from the PCI wrapper then.

Best regards,
   Nicolas

>>> I've built this with a powerpc allyesconfig (which pointed out the bug)
>>> and on RISC-V, manually checking to ensure the code was built.  I
>>> haven't even booted the resulting kernels.
>>>
>>> Fixes: c218ad559020 ("macb: Add support for SiFive FU540-C000")
>>> Signed-off-by: Palmer Dabbelt 
>>> ---
>>>drivers/net/ethernet/cadence/Kconfig | 11 +++
>>>drivers/net/ethernet/cadence/macb_main.c | 12 
>>>2 files changed, 23 insertions(+)
>>>
>>> diff --git a/drivers/net/ethernet/cadence/Kconfig 
>>> b/drivers/net/ethernet/cadence/Kconfig
>>> index 1766697c9c5a..74ee2bfd2369 100644
>>> --- a/drivers/net/ethernet/cadence/Kconfig
>>> +++ b/drivers/net/ethernet/cadence/Kconfig
>>> @@ -40,6 +40,17 @@ config MACB_USE_HWSTAMP
>>> ---help---
>>>   Enable IEEE 1588 Precision Time Protocol (PTP) support for MACB.
>>>
>>> +config MACB_FU540
>>> +   bool "Enable support for the SiFive FU540 clock controller"
>>> +   depends on MACB && COMMON_CLK
>>> +   default y
>>> +   ---help---
>>> + Enable support for the MACB/GEM clock controller on the SiFive
>>> + FU540-C000.  This device is necessary for switching between 10/100
>>> + and gigabit modes on the FU540-C000 SoC, without which it is only
>>> + possible to bring up the Ethernet link in whatever mode the
>>> + bootloader probed.
>>> +
>>>config MACB_PCI
>>> tristate "Cadence PCI MACB/GEM support"
>>> depends on MACB && PCI && COMMON_CLK
>>> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
>>> b/drivers/net/ethernet/cadence/macb_main.c
>>> index c545c5b435d8..a903dfdd4183 100644
>>> --- a/drivers/net/ethernet/cadence/macb_main.c
>>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>>> @@ -41,6 +41,7 @@
>>>#include 
>>>#include "macb.h"
>>>
>>> +#ifdef CONFIG_MACB_FU540
>>>/* This structure is only used for MACB on SiFive FU540 devices */
>>>struct sifive_fu540_macb_mgmt {
>>> void __iomem *reg;
>>> @@ -49,6 +50,7 @@ struct sifive_fu540_macb_mgmt {
>>>};
>>>
>>>static struct sifive_fu540_macb_mgmt *mgmt;
>>> +#endif
>>>
>>>#define MACB_RX_BUFFER_SIZE  128
>>>#define RX_BUFFER_MULTIPLE   64  /* bytes */
>>> @@ -3956,6 +3958,7 @@ static int at91ether_init(struct platform_device 
>>> *pdev)
>>> return 0;
>>>}
>>>
>>> +#ifdef CONFIG_MACB_FU540
>>>static unsigned long fu540_macb_tx_recalc_rate(struct clk_hw *hw,
>>>unsigned long parent_rate)
>>>{
>>> @@ -4056,7 +4059,9 @@ static int fu540_c000_init(struct platform_device 
>>> *pdev)
>>>
>>> return macb_init(pdev);
>>>}
>>> +#endif
>>>
>>> +#ifdef CONFIG_MACB_FU540
>>>static const struct macb_config fu540_c000_config = {
>>> .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO |
>>> MACB_CAPS_GEM_HAS_PTP,
>>> @@ -4065,6 +4070,7 @@ static const struct macb_config fu540_c000_config = {
>>> .init = fu540_c000_init,
>>> .jumbo_max_len = 10240,
>>>};
>>> +#endif
>>>
>>>static const struct macb_config at91sam9260_config = {
>>> .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
>>> @@ -4155,7 +4161,9 @@ static const struct of_device_id macb_dt_ids[] = {
>>> { .compatible = "cdns,emac", .data = _config },
>>> { .compatible = "cdns,zynqmp-gem", .data = _config},
>>> { .compatible = "cdns,zynq-gem", .data = _config },
>>> +#ifdef CONFIG_MACB_FU540
>>> { .compatible = "sifive,fu540-macb", .data = _c000_config },
>>> +#endif
>>> { /* sentinel */ }
>>>};
>>>MODULE_DEVICE_TABLE(of, macb_dt_ids);
>>> @@ -4363,7 +4371,9 @@ static int macb_probe(struct platform_device *pdev)
>>>
>>>err_disable_clocks:
>>> clk_disable_unprepare(tx_clk);
>>> +#ifdef CONFIG_MACB_FU540
>>> clk_unregister(tx_clk);
>>> +#endif
>>> clk_disable_unprepare(hclk);
>>> clk_disable_unprepare(pclk);
>>> 

Re: [PATCH 2/2] net: macb: Kconfig: Rename Atmel to Cadence

2019-06-24 Thread Nicolas.Ferre
On 24/06/2019 at 08:16, Palmer Dabbelt wrote:
> External E-Mail
> 
> 
> When touching the Kconfig for this driver I noticed that both the
> Kconfig help text and a comment referred to this being an Atmel driver.
> As far as I know, this is a Cadence driver.  The fix is just

Indeed: was written and then maintained by Atmel (now Microchip) for 
years... So I would say that more than a "Cadence driver" it's a driver 
that applies to a Cadence peripheral.

I won't hold the patch just for this as the patch makes perfect sense, 
but would love that it's been highlighted...

> s/Atmel/Cadence/, but I did go and re-wrap the Kconfig help text as that
> change caused it to go over 80 characters.
> 
> Signed-off-by: Palmer Dabbelt 
> ---
>   drivers/net/ethernet/cadence/Kconfig | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/Kconfig 
> b/drivers/net/ethernet/cadence/Kconfig
> index 74ee2bfd2369..29b6132b418e 100644
> --- a/drivers/net/ethernet/cadence/Kconfig
> +++ b/drivers/net/ethernet/cadence/Kconfig
> @@ -1,6 +1,6 @@
>   # SPDX-License-Identifier: GPL-2.0-only
>   #
> -# Atmel device configuration
> +# Cadence device configuration
>   #
>   
>   config NET_VENDOR_CADENCE
> @@ -13,8 +13,8 @@ config NET_VENDOR_CADENCE
> If unsure, say Y.
>   
> Note that the answer to this question doesn't directly affect the
> -   kernel: saying N will just cause the configurator to skip all
> -   the remaining Atmel network card questions. If you say Y, you will be
> +   kernel: saying N will just cause the configurator to skip all the
> +   remaining Cadence network card questions. If you say Y, you will be
> asked for your specific card in the following questions.
>   
>   if NET_VENDOR_CADENCE
> 


-- 
Nicolas Ferre


Re: [PATCH 1/2] net: macb: Fix compilation on systems without COMMON_CLK

2019-06-24 Thread Nicolas.Ferre
On 24/06/2019 at 08:16, Palmer Dabbelt wrote:
> External E-Mail
> 
> 
> The patch to add support for the FU540-C000 added a dependency on
> COMMON_CLK, but didn't express that via Kconfig.  This fixes the build
> failure by adding CONFIG_MACB_FU540, which depends on COMMON_CLK and
> conditionally enables the FU540-C000 support.

Let's try to limit the use of  #ifdef's throughout the code. We are 
using them in this driver but only for the hot paths and things that 
have an impact on performance. I don't think it's the case here: so 
please find another option => NACK.

> I've built this with a powerpc allyesconfig (which pointed out the bug)
> and on RISC-V, manually checking to ensure the code was built.  I
> haven't even booted the resulting kernels.
> 
> Fixes: c218ad559020 ("macb: Add support for SiFive FU540-C000")
> Signed-off-by: Palmer Dabbelt 
> ---
>   drivers/net/ethernet/cadence/Kconfig | 11 +++
>   drivers/net/ethernet/cadence/macb_main.c | 12 
>   2 files changed, 23 insertions(+)
> 
> diff --git a/drivers/net/ethernet/cadence/Kconfig 
> b/drivers/net/ethernet/cadence/Kconfig
> index 1766697c9c5a..74ee2bfd2369 100644
> --- a/drivers/net/ethernet/cadence/Kconfig
> +++ b/drivers/net/ethernet/cadence/Kconfig
> @@ -40,6 +40,17 @@ config MACB_USE_HWSTAMP
>   ---help---
> Enable IEEE 1588 Precision Time Protocol (PTP) support for MACB.
>   
> +config MACB_FU540
> + bool "Enable support for the SiFive FU540 clock controller"
> + depends on MACB && COMMON_CLK
> + default y
> + ---help---
> +   Enable support for the MACB/GEM clock controller on the SiFive
> +   FU540-C000.  This device is necessary for switching between 10/100
> +   and gigabit modes on the FU540-C000 SoC, without which it is only
> +   possible to bring up the Ethernet link in whatever mode the
> +   bootloader probed.
> +
>   config MACB_PCI
>   tristate "Cadence PCI MACB/GEM support"
>   depends on MACB && PCI && COMMON_CLK
> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
> b/drivers/net/ethernet/cadence/macb_main.c
> index c545c5b435d8..a903dfdd4183 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -41,6 +41,7 @@
>   #include 
>   #include "macb.h"
>   
> +#ifdef CONFIG_MACB_FU540
>   /* This structure is only used for MACB on SiFive FU540 devices */
>   struct sifive_fu540_macb_mgmt {
>   void __iomem *reg;
> @@ -49,6 +50,7 @@ struct sifive_fu540_macb_mgmt {
>   };
>   
>   static struct sifive_fu540_macb_mgmt *mgmt;
> +#endif
>   
>   #define MACB_RX_BUFFER_SIZE 128
>   #define RX_BUFFER_MULTIPLE  64  /* bytes */
> @@ -3956,6 +3958,7 @@ static int at91ether_init(struct platform_device *pdev)
>   return 0;
>   }
>   
> +#ifdef CONFIG_MACB_FU540
>   static unsigned long fu540_macb_tx_recalc_rate(struct clk_hw *hw,
>  unsigned long parent_rate)
>   {
> @@ -4056,7 +4059,9 @@ static int fu540_c000_init(struct platform_device *pdev)
>   
>   return macb_init(pdev);
>   }
> +#endif
>   
> +#ifdef CONFIG_MACB_FU540
>   static const struct macb_config fu540_c000_config = {
>   .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE | MACB_CAPS_JUMBO |
>   MACB_CAPS_GEM_HAS_PTP,
> @@ -4065,6 +4070,7 @@ static const struct macb_config fu540_c000_config = {
>   .init = fu540_c000_init,
>   .jumbo_max_len = 10240,
>   };
> +#endif
>   
>   static const struct macb_config at91sam9260_config = {
>   .caps = MACB_CAPS_USRIO_HAS_CLKEN | MACB_CAPS_USRIO_DEFAULT_IS_MII_GMII,
> @@ -4155,7 +4161,9 @@ static const struct of_device_id macb_dt_ids[] = {
>   { .compatible = "cdns,emac", .data = _config },
>   { .compatible = "cdns,zynqmp-gem", .data = _config},
>   { .compatible = "cdns,zynq-gem", .data = _config },
> +#ifdef CONFIG_MACB_FU540
>   { .compatible = "sifive,fu540-macb", .data = _c000_config },
> +#endif
>   { /* sentinel */ }
>   };
>   MODULE_DEVICE_TABLE(of, macb_dt_ids);
> @@ -4363,7 +4371,9 @@ static int macb_probe(struct platform_device *pdev)
>   
>   err_disable_clocks:
>   clk_disable_unprepare(tx_clk);
> +#ifdef CONFIG_MACB_FU540
>   clk_unregister(tx_clk);
> +#endif
>   clk_disable_unprepare(hclk);
>   clk_disable_unprepare(pclk);
>   clk_disable_unprepare(rx_clk);
> @@ -4398,7 +4408,9 @@ static int macb_remove(struct platform_device *pdev)
>   pm_runtime_dont_use_autosuspend(>dev);
>   if (!pm_runtime_suspended(>dev)) {
>   clk_disable_unprepare(bp->tx_clk);
> +#ifdef CONFIG_MACB_FU540
>   clk_unregister(bp->tx_clk);
> +#endif
>   clk_disable_unprepare(bp->hclk);
>   clk_disable_unprepare(bp->pclk);
>   clk_disable_unprepare(bp->rx_clk);
> 


-- 
Nicolas Ferre


Re: [PATCH] clk: at91: generated: Truncate divisor to GENERATED_MAX_DIV + 1

2019-06-12 Thread Nicolas.Ferre
On 10/06/2019 at 17:20, Codrin Ciubotariu - M19940 wrote:
> From: Codrin Ciubotariu 
> 
> In clk_generated_determine_rate(), if the divisor is greater than
> GENERATED_MAX_DIV + 1, then the wrong best_rate will be returned.
> If clk_generated_set_rate() will be called later with this wrong
> rate, it will return -EINVAL, so the generated clock won't change
> its value. Do no let the divisor be greater than GENERATED_MAX_DIV + 1.
> 
> Fixes: 8c7aa6328947 ("clk: at91: clk-generated: remove useless divisor loop")
> Signed-off-by: Codrin Ciubotariu 

Yes:
Acked-by: Nicolas Ferre 

Thanks for having fixed this Codrin. Best regards,
   Nicolas

> ---
>   drivers/clk/at91/clk-generated.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/clk/at91/clk-generated.c 
> b/drivers/clk/at91/clk-generated.c
> index 5f18847965c1..290cffe35deb 100644
> --- a/drivers/clk/at91/clk-generated.c
> +++ b/drivers/clk/at91/clk-generated.c
> @@ -146,6 +146,8 @@ static int clk_generated_determine_rate(struct clk_hw *hw,
>   continue;
>   
>   div = DIV_ROUND_CLOSEST(parent_rate, req->rate);
> + if (div > GENERATED_MAX_DIV + 1)
> + div = GENERATED_MAX_DIV + 1;
>   
>   clk_generated_best_diff(req, parent, parent_rate, div,
>   _diff, _rate);
> 


-- 
Nicolas Ferre


Re: [PATCH][next] video: fbdev: atmel_lcdfb: remove redundant initialization to variable ret

2019-06-12 Thread Nicolas.Ferre
On 11/06/2019 at 19:09, Colin King wrote:
> External E-Mail
> 
> 
> From: Colin Ian King 
> 
> Currently variable ret is being initialized with -ENOENT however that
> value is never read and ret is being re-assigned later on. Hence this
> assignment is redundant and can be removed.
> 
> Addresses-Coverity: ("Unused value")
> Signed-off-by: Colin Ian King 

Indeed:
Acked-by: Nicolas Ferre 

Thanks, best regards,
   Nicolas


> ---
>   drivers/video/fbdev/atmel_lcdfb.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/video/fbdev/atmel_lcdfb.c 
> b/drivers/video/fbdev/atmel_lcdfb.c
> index fb117ccbeab3..930cc3f92e01 100644
> --- a/drivers/video/fbdev/atmel_lcdfb.c
> +++ b/drivers/video/fbdev/atmel_lcdfb.c
> @@ -950,7 +950,7 @@ static int atmel_lcdfb_of_init(struct atmel_lcdfb_info 
> *sinfo)
>   struct fb_videomode fb_vm;
>   struct gpio_desc *gpiod;
>   struct videomode vm;
> - int ret = -ENOENT;
> + int ret;
>   int i;
>   
>   sinfo->config = (struct atmel_lcdfb_config*)
> 


-- 
Nicolas Ferre


Re: [PATCH v2] ARM: configs: Remove useless UEVENT_HELPER_PATH

2019-06-06 Thread Nicolas.Ferre
On 04/06/2019 at 10:14, Krzysztof Kozlowski wrote:
> Remove the CONFIG_UEVENT_HELPER_PATH because:
> 1. It is disabled since commit 1be01d4a5714 ("driver: base: Disable
> CONFIG_UEVENT_HELPER by default") as its dependency (UEVENT_HELPER) was
> made default to 'n',
> 2. It is not recommended (help message: "This should not be used today
> [...] creates a high system load") and was kept only for ancient
> userland,
> 3. Certain userland specifically requests it to be disabled (systemd
> README: "Legacy hotplug slows down the system and confuses udev").
> 
> Signed-off-by: Krzysztof Kozlowski 
> Acked-by: Geert Uytterhoeven 
> 
> ---
> 
> Changes since v2:
> 1. Remove unrelated files.
> 2. Add Geert's ack.
> ---
>   arch/arm/configs/acs5k_defconfig  | 1 -
>   arch/arm/configs/acs5k_tiny_defconfig | 1 -
>   arch/arm/configs/am200epdkit_defconfig| 1 -
>   arch/arm/configs/aspeed_g4_defconfig  | 1 -
>   arch/arm/configs/aspeed_g5_defconfig  | 1 -
>   arch/arm/configs/at91_dt_defconfig| 1 -

[..]

>   arch/arm/configs/sama5_defconfig  | 1 -

for at91 (at91_dt_defconfig & sama5_defconfig):
Acked-by: Nicolas Ferre 

>   arch/arm/configs/socfpga_defconfig| 1 -
>   arch/arm/configs/spear13xx_defconfig  | 1 -
>   arch/arm/configs/spear3xx_defconfig   | 1 -
>   arch/arm/configs/spear6xx_defconfig   | 1 -
>   arch/arm/configs/spitz_defconfig  | 1 -
>   arch/arm/configs/tango4_defconfig | 1 -
>   arch/arm/configs/tct_hammer_defconfig | 1 -
>   arch/arm/configs/u300_defconfig   | 1 -
>   arch/arm/configs/u8500_defconfig  | 1 -
>   arch/arm/configs/vexpress_defconfig   | 1 -
>   arch/arm/configs/viper_defconfig  | 1 -
>   arch/arm/configs/xcep_defconfig   | 1 -
>   arch/arm/configs/zeus_defconfig   | 1 -
>   arch/arm/configs/zx_defconfig | 1 -
>   69 files changed, 69 deletions(-)
[..]
-- 
Nicolas Ferre


Re: [PATCH] net: macb: Change interrupt and napi enable order in open

2019-05-07 Thread Nicolas.Ferre
On 07/05/2019 at 16:29, Harini Katakam wrote:
> External E-Mail
> 
> 
> Current order in open:
> -> Enable interrupts (macb_init_hw)
> -> Enable NAPI
> -> Start PHY
> 
> Sequence of RX handling:
> -> RX interrupt occurs
> -> Interrupt is cleared and interrupt bits disabled in handler
> -> NAPI is scheduled
> -> In NAPI, RX budget is processed and RX interrupts are re-enabled
> 
> With the above, on QEMU or fixed link setups (where PHY state doesn't
> matter), there's a chance macb RX interrupt occurs before NAPI is
> enabled. This will result in NAPI being scheduled before it is enabled.
> Fix this macb open by changing the order.
> 
> Fixes: ae1f2a56d273 ("net: macb: Added support for many RX queues")
> Signed-off-by: Harini Katakam 

it looks okay to me:
Acked-by: Nicolas Ferre 

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c 
> b/drivers/net/ethernet/cadence/macb_main.c
> index 5d5c9d7..c049410 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -2427,12 +2427,12 @@ static int macb_open(struct net_device *dev)
>   goto pm_exit;
>   }
>   
> - bp->macbgem_ops.mog_init_rings(bp);
> - macb_init_hw(bp);
> -
>   for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue)
>   napi_enable(>napi);
>   
> + bp->macbgem_ops.mog_init_rings(bp);
> + macb_init_hw(bp);
> +
>   /* schedule a link state check */
>   phy_start(dev->phydev);
>   
> 


-- 
Nicolas Ferre


Re: [PATCH v2 1/4] ARM: dts: sama5d{2,4}: use SPDX-License-Identifier

2019-04-04 Thread Nicolas.Ferre
On 03/04/2019 at 22:52, Alexandre Belloni wrote:
> External E-Mail
> 
> 
> The X11 license text [1] is explicitly for the X Consortium and has a
> couple of extra clauses. The MIT license text [2] is actually what the
> current DT files claim.
> 
> [1] https://spdx.org/licenses/X11.html
> [2] https://spdx.org/licenses/MIT.html
> 
> Signed-off-by: Alexandre Belloni 

whole series:
Acked-by: Nicolas Ferre 

> ---
>   arch/arm/boot/dts/sama5d2.dtsi | 39 +-
>   arch/arm/boot/dts/sama5d4.dtsi | 39 +-
>   2 files changed, 2 insertions(+), 76 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index d159ee42ef29..26ae6b34e329 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1,46 +1,9 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>   /*
>* sama5d2.dtsi - Device Tree Include file for SAMA5D2 family SoC
>*
>*  Copyright (C) 2015 Atmel,
>*2015 Ludovic Desroches 
> - *
> - * This file is dual-licensed: you can use it either under the terms
> - * of the GPL or the X11 license, at your option. Note that this dual
> - * licensing only applies to this file, and not this project as a
> - * whole.
> - *
> - *  a) This file is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of the
> - * License, or (at your option) any later version.
> - *
> - * This file is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * Or, alternatively,
> - *
> - *  b) Permission is hereby granted, free of charge, to any person
> - * obtaining a copy of this software and associated documentation
> - * files (the "Software"), to deal in the Software without
> - * restriction, including without limitation the rights to use,
> - * copy, modify, merge, publish, distribute, sublicense, and/or
> - * sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following
> - * conditions:
> - *
> - * The above copyright notice and this permission notice shall be
> - * included in all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> - * OTHER DEALINGS IN THE SOFTWARE.
>*/
>   
>   #include 
> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
> index 6c1e41f94549..6ab27a7b388d 100644
> --- a/arch/arm/boot/dts/sama5d4.dtsi
> +++ b/arch/arm/boot/dts/sama5d4.dtsi
> @@ -1,46 +1,9 @@
> +// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
>   /*
>* sama5d4.dtsi - Device Tree Include file for SAMA5D4 family SoC
>*
>*  Copyright (C) 2014 Atmel,
>*2014 Nicolas Ferre 
> - *
> - * This file is dual-licensed: you can use it either under the terms
> - * of the GPL or the X11 license, at your option. Note that this dual
> - * licensing only applies to this file, and not this project as a
> - * whole.
> - *
> - *  a) This file is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of the
> - * License, or (at your option) any later version.
> - *
> - * This file is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * Or, alternatively,
> - *
> - *  b) Permission is hereby granted, free of charge, to any person
> - * obtaining a copy of this software and associated documentation
> - * files (the "Software"), to deal in the Software without
> - * restriction, including without limitation the rights to use,
> - * copy, modify, merge, publish, distribute, sublicense, and/or
> - * sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following
> - * conditions:
> - *
> - * The above copyright notice and this permission notice shall be
> - * included in all 

Re: [PATCH 1/4] ARM: dts: sama5d{2,4}: use SPDX-License-Identifier

2019-04-03 Thread Nicolas.Ferre
On 03/04/2019 at 18:22, Alexandre Belloni wrote:
> The X11 license text [1] is explicitly for the X Consortium and has a
> couple of extra clauses. The MIT license text [2] is actually what the
> current DT files claim.
> 
> [1] https://spdx.org/licenses/X11.html
> [2] https://spdx.org/licenses/MIT.html
> 
> Signed-off-by: Alexandre Belloni 

For whole series:
Acked-by: Nicolas Ferre 

> ---
>   arch/arm/boot/dts/sama5d2.dtsi | 39 +-
>   arch/arm/boot/dts/sama5d4.dtsi | 39 +-
>   2 files changed, 2 insertions(+), 76 deletions(-)
> 
> diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi
> index d159ee42ef29..a5bd4df37921 100644
> --- a/arch/arm/boot/dts/sama5d2.dtsi
> +++ b/arch/arm/boot/dts/sama5d2.dtsi
> @@ -1,46 +1,9 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
>   /*
>* sama5d2.dtsi - Device Tree Include file for SAMA5D2 family SoC
>*
>*  Copyright (C) 2015 Atmel,
>*2015 Ludovic Desroches 
> - *
> - * This file is dual-licensed: you can use it either under the terms
> - * of the GPL or the X11 license, at your option. Note that this dual
> - * licensing only applies to this file, and not this project as a
> - * whole.
> - *
> - *  a) This file is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of the
> - * License, or (at your option) any later version.
> - *
> - * This file is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * Or, alternatively,
> - *
> - *  b) Permission is hereby granted, free of charge, to any person
> - * obtaining a copy of this software and associated documentation
> - * files (the "Software"), to deal in the Software without
> - * restriction, including without limitation the rights to use,
> - * copy, modify, merge, publish, distribute, sublicense, and/or
> - * sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following
> - * conditions:
> - *
> - * The above copyright notice and this permission notice shall be
> - * included in all copies or substantial portions of the Software.
> - *
> - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
> - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
> - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
> - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
> - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
> - * OTHER DEALINGS IN THE SOFTWARE.
>*/
>   
>   #include 
> diff --git a/arch/arm/boot/dts/sama5d4.dtsi b/arch/arm/boot/dts/sama5d4.dtsi
> index 6c1e41f94549..f4fe9c67723d 100644
> --- a/arch/arm/boot/dts/sama5d4.dtsi
> +++ b/arch/arm/boot/dts/sama5d4.dtsi
> @@ -1,46 +1,9 @@
> +// SPDX-License-Identifier: (GPL-2.0 OR MIT)
>   /*
>* sama5d4.dtsi - Device Tree Include file for SAMA5D4 family SoC
>*
>*  Copyright (C) 2014 Atmel,
>*2014 Nicolas Ferre 
> - *
> - * This file is dual-licensed: you can use it either under the terms
> - * of the GPL or the X11 license, at your option. Note that this dual
> - * licensing only applies to this file, and not this project as a
> - * whole.
> - *
> - *  a) This file is free software; you can redistribute it and/or
> - * modify it under the terms of the GNU General Public License as
> - * published by the Free Software Foundation; either version 2 of the
> - * License, or (at your option) any later version.
> - *
> - * This file is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * Or, alternatively,
> - *
> - *  b) Permission is hereby granted, free of charge, to any person
> - * obtaining a copy of this software and associated documentation
> - * files (the "Software"), to deal in the Software without
> - * restriction, including without limitation the rights to use,
> - * copy, modify, merge, publish, distribute, sublicense, and/or
> - * sell copies of the Software, and to permit persons to whom the
> - * Software is furnished to do so, subject to the following
> - * conditions:
> - *
> - * The above copyright notice and this permission notice shall be
> - * included in all copies or substantial 

Re: [PATCH v2 1/3] dmaengine: at_xdmac: remove BUG_ON macro in tasklet

2019-04-03 Thread Nicolas.Ferre
Vinod,

Please disregard this series: I'm sending a v3 right now. Sorry for the 
noise.

Best regards,
   Nicolas

On 03/04/2019 at 12:09, Nicolas Ferre wrote:
> Even if this case shouldn't happen when controller is properly programmed,
> it's still better to avoid dumping a kernel Oops for this.
> As the sequence may happen only for debugging purposes, log the error and
> just finish the tasklet call.
> 
> Signed-off-by: Nicolas Ferre 
> Acked-by: Ludovic Desroches 
> ---
> v2: added Ludovic's tag
> 
>   drivers/dma/at_xdmac.c | 6 +-
>   1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
> index fe69dccfa0c0..37a269420435 100644
> --- a/drivers/dma/at_xdmac.c
> +++ b/drivers/dma/at_xdmac.c
> @@ -1606,7 +1606,11 @@ static void at_xdmac_tasklet(unsigned long data)
>   struct at_xdmac_desc,
>   xfer_node);
>   dev_vdbg(chan2dev(>chan), "%s: desc 0x%p\n", __func__, 
> desc);
> - BUG_ON(!desc->active_xfer);
> + if (!desc->active_xfer) {
> + dev_err(chan2dev(>chan), "Xfer not active: 
> exiting");
> + spin_unlock_bh(>lock);
> + return;
> + }
>   
>   txd = >tx_dma_desc;
>   
> 


-- 
Nicolas Ferre


Re: [PATCH 2/3] dmaengine: at_xdmac: enhance channel errors handling in tasklet

2019-04-03 Thread Nicolas.Ferre
Vinod,

Thanks for your review, I'm preparing v2.

On 11/02/2019 at 12:58, Vinod Koul wrote:
> On 05-02-19, 12:03, Nicolas Ferre wrote:
>> Complement the identification of errors with stoping the channel and
>> dumping the descriptor that led to the error case.
>>
>> Signed-off-by: Nicolas Ferre 
>> ---
>>   drivers/dma/at_xdmac.c | 43 --
>>   1 file changed, 37 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/dma/at_xdmac.c b/drivers/dma/at_xdmac.c
>> index 37a269420435..ec7a29d8e448 100644
>> --- a/drivers/dma/at_xdmac.c
>> +++ b/drivers/dma/at_xdmac.c
>> @@ -1575,6 +1575,41 @@ static void at_xdmac_handle_cyclic(struct 
>> at_xdmac_chan *atchan)
>>  dmaengine_desc_get_callback_invoke(txd, NULL);
>>   }
>>   
>> +static void at_xdmac_handle_error(struct at_xdmac_chan *atchan)
>> +{
>> +struct at_xdmac *atxdmac = to_at_xdmac(atchan->chan.device);
>> +struct at_xdmac_desc*bad_desc;
>> +
>> +/*
>> + * The descriptor currently at the head of the active list is
>> + * broked. Since we don't have any way to report errors, we'll
> 
> You meant borked or broken...

Broken

> 
>> + * just have to scream loudly and try to carry on.
> 
> should we carry on or abort..?

Changed in:

  * just have to scream loudly and try to continue with other
  * descriptors queued (if any).

>> + */
>> +if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
>> +dev_err(chan2dev(>chan), "read bus error!!!");
>> +if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
>> +dev_err(chan2dev(>chan), "write bus error!!!");
>> +if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
>> +dev_err(chan2dev(>chan), "request overflow error!!!");
>> +
>> +spin_lock_bh(>lock);
>> +/* Channel must be disabled first as it's not done automatically */
>> +at_xdmac_write(atxdmac, AT_XDMAC_GD, atchan->mask);
>> +while (at_xdmac_read(atxdmac, AT_XDMAC_GS) & atchan->mask)
>> +cpu_relax();
>> +bad_desc = list_first_entry(>xfers_list,
>> +struct at_xdmac_desc,
>> +xfer_node);
>> +spin_unlock_bh(>lock);
>> +/* Print bad descriptor's details if needed */
> 
> Well this is not great to look and read at, please do consider adding
> empty line before comments or logical blocks..

True, indeed.

>> +dev_dbg(chan2dev(>chan),
>> + "%s: lld: mbr_sa=%pad, mbr_da=%pad, mbr_ubc=0x%08x\n",
>> + __func__, _desc->lld.mbr_sa, _desc->lld.mbr_da,
>> + bad_desc->lld.mbr_ubc);
> 
> not dev_err?

Well, we have the dev_err at the beginning of the function, I think it's 
enough: this is really debugging information that needs to be activated 
to track the DMA configuration bug: it's not meant for production.

>> +
>> +/* Then continue with usual descriptor management */
>> +}
>> +
>>   static void at_xdmac_tasklet(unsigned long data)
>>   {
>>  struct at_xdmac_chan*atchan = (struct at_xdmac_chan *)data;
>> @@ -1594,12 +1629,8 @@ static void at_xdmac_tasklet(unsigned long data)
>> || (atchan->irq_status & error_mask)) {
>>  struct dma_async_tx_descriptor  *txd;
>>   
>> -if (atchan->irq_status & AT_XDMAC_CIS_RBEIS)
>> -dev_err(chan2dev(>chan), "read bus error!!!");
>> -if (atchan->irq_status & AT_XDMAC_CIS_WBEIS)
>> -dev_err(chan2dev(>chan), "write bus error!!!");
>> -if (atchan->irq_status & AT_XDMAC_CIS_ROIS)
>> -dev_err(chan2dev(>chan), "request overflow 
>> error!!!");
>> +if (atchan->irq_status & error_mask)
>> +at_xdmac_handle_error(atchan);
>>   
>>  spin_lock(>lock);
>>  desc = list_first_entry(>xfers_list,
>> -- 
>> 2.17.1
> 


-- 
Nicolas Ferre


Re: [PATCH 3/5] MAINTAINERS: change section name to be more generic

2019-04-01 Thread Nicolas.Ferre
On 14/03/2019 at 17:26, Claudiu Beznea - M18063 wrote:
> From: Claudiu Beznea 
> 
> Change Microchip timers section name to be more generic.
> 
> Signed-off-by: Claudiu Beznea 

Acked-by: Nicolas Ferre 

> ---
>   MAINTAINERS | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 4d04cebb4a71..0948d6592ea5 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10016,7 +10016,7 @@ S:Supported
>   F:  drivers/misc/atmel-ssc.c
>   F:  include/linux/atmel-ssc.h
>   
> -MICROCHIP TIMER COUNTER (TC) AND CLOCKSOURCE DRIVERS
> +MICROCHIP TIMERS AND CLOCKSOURCE DRIVERS
>   M:  Nicolas Ferre 
>   L:  linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
>   S:  Supported
> 


-- 
Nicolas Ferre


Re: [PATCH 5/5] MAINTAINERS: add timer-microchip-pit64c.c

2019-04-01 Thread Nicolas.Ferre
On 14/03/2019 at 17:26, Claudiu Beznea - M18063 wrote:
> From: Claudiu Beznea 
> 
> Add timer-microchip-pit64b.c as maintained file.
> 
> Signed-off-by: Claudiu Beznea 

Acked-by: Nicolas Ferre 

> ---
>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 85bc819867da..5af947c9f350 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10023,6 +10023,7 @@ 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
> +F:   drivers/clocksource/timer-microchip-pit64b.c
>   
>   MICROCHIP USBA UDC DRIVER
>   M:  Cristian Birsan 
> 


-- 
Nicolas Ferre


Re: [PATCH 4/5] MAINTAINERS: add myself as maintainer

2019-04-01 Thread Nicolas.Ferre
On 14/03/2019 at 17:26, Claudiu Beznea - M18063 wrote:
> From: Claudiu Beznea 
> 
> Add myself as maintainer for Microchip timers and clocksource
> drivers.
> 
> Signed-off-by: Claudiu Beznea 

Acked-by: Nicolas Ferre 

Thanks Claudiu!

> ---
>   MAINTAINERS | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 0948d6592ea5..85bc819867da 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -10018,6 +10018,7 @@ F:include/linux/atmel-ssc.h
>   
>   MICROCHIP TIMERS AND CLOCKSOURCE DRIVERS
>   M:  Nicolas Ferre 
> +M:   Claudiu Beznea 
>   L:  linux-arm-ker...@lists.infradead.org (moderated for non-subscribers)
>   S:  Supported
>   F:  drivers/misc/atmel_tclib.c
> 


-- 
Nicolas Ferre


Re: [PATCH 2/5] clocksource/drivers/timer-microchip-pit64b: add Microchip PIT64B support

2019-04-01 Thread Nicolas.Ferre
On 14/03/2019 at 17:26, Claudiu Beznea - M18063 wrote:
> From: Claudiu Beznea 
> 
> Add driver for Microchip PIT64B timer. Timer could be used in continuous
> mode or oneshot mode. The hardware has 2x32 bit registers for period
> emulating a 64 bit timer. The LSB_PR and MSB_PR registers are used to set
> the period value (compare value). TLSB and TMSB keeps the current value
> of the counter. After a compare the TLSB and TMSB register resets. Apart
> from this the hardware has SMOD bit in mode register that allow to
> reconfigure the timer without reset and start commands (start command
> while timer is active is ignored).
> The driver uses PIT64B timer as clocksource or clockevent. First requested
> timer would be registered as clockevent, second one would be registered as
> clocksource. Individual PIT64B hardware resources were used for clocksource
> and clockevent to be able to support high resolution timers with this
> hardware implementation.
> 
> Signed-off-by: Claudiu Beznea 

Look good to me:
Acked-by: Nicolas Ferre 


> ---
>   drivers/clocksource/Kconfig  |   6 +
>   drivers/clocksource/Makefile |   1 +
>   drivers/clocksource/timer-microchip-pit64b.c | 464 
> +++
>   3 files changed, 471 insertions(+)
>   create mode 100644 drivers/clocksource/timer-microchip-pit64b.c
> 
> diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
> index 5d93e580e5dc..2ad6f881a0bb 100644
> --- a/drivers/clocksource/Kconfig
> +++ b/drivers/clocksource/Kconfig
> @@ -448,6 +448,12 @@ config OXNAS_RPS_TIMER
>   config SYS_SUPPORTS_SH_CMT
>   bool
>   
> +config MICROCHIP_PIT64B
> + bool "Microchip PIT64B support"
> + depends on OF || COMPILE_TEST
> + help
> +   This option enables Microchip PIT64B timer.
> +
>   config MTK_TIMER
>   bool "Mediatek timer driver" if COMPILE_TEST
>   depends on HAS_IOMEM
> diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
> index c4a8e9ef932a..c53fa12b9b94 100644
> --- a/drivers/clocksource/Makefile
> +++ b/drivers/clocksource/Makefile
> @@ -35,6 +35,7 @@ obj-$(CONFIG_U300_TIMER)+= timer-u300.o
>   obj-$(CONFIG_SUN4I_TIMER)   += timer-sun4i.o
>   obj-$(CONFIG_SUN5I_HSTIMER) += timer-sun5i.o
>   obj-$(CONFIG_MESON6_TIMER)  += timer-meson6.o
> +obj-$(CONFIG_MICROCHIP_PIT64B)   += timer-microchip-pit64b.o
>   obj-$(CONFIG_TEGRA_TIMER)   += timer-tegra20.o
>   obj-$(CONFIG_VT8500_TIMER)  += timer-vt8500.o
>   obj-$(CONFIG_NSPIRE_TIMER)  += timer-zevio.o
> diff --git a/drivers/clocksource/timer-microchip-pit64b.c 
> b/drivers/clocksource/timer-microchip-pit64b.c
> new file mode 100644
> index ..6787aa98ef01
> --- /dev/null
> +++ b/drivers/clocksource/timer-microchip-pit64b.c
> @@ -0,0 +1,464 @@
> +// SPDX-License-Identifier: GPL-2.0
> +//
> +// Copyright (C) 2019 Microchip Technology Inc.
> +// Copyright (C) 2019 Claudiu Beznea (claudiu.bez...@microchip.com)
> +
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +#include 
> +
> +#define MCHP_PIT64B_CR   0x00/* Control Register */
> +#define MCHP_PIT64B_CR_START BIT(0)
> +#define MCHP_PIT64B_CR_SWRST BIT(8)
> +
> +#define MCHP_PIT64B_MR   0x04/* Mode Register */
> +#define MCHP_PIT64B_MR_CONT  BIT(0)
> +#define MCHP_PIT64B_MR_SGCLK BIT(3)
> +#define MCHP_PIT64B_MR_SMOD  BIT(4)
> +#define MCHP_PIT64B_MR_PRES  GENMASK(11, 8)
> +
> +#define MCHP_PIT64B_LSB_PR   0x08/* LSB Period Register */
> +
> +#define MCHP_PIT64B_MSB_PR   0x0C/* MSB Period Register */
> +
> +#define MCHP_PIT64B_IER  0x10/* Interrupt Enable Register */
> +#define MCHP_PIT64B_IER_PERIOD   BIT(0)
> +
> +#define MCHP_PIT64B_ISR  0x1C/* Interrupt Status Register */
> +#define MCHP_PIT64B_ISR_PERIOD   BIT(0)
> +
> +#define MCHP_PIT64B_TLSBR0x20/* Timer LSB Register */
> +
> +#define MCHP_PIT64B_TMSBR0x24/* Timer MSB Register */
> +
> +#define MCHP_PIT64B_PRES_MAX 0x10
> +#define MCHP_PIT64B_DEF_FREQ 250UL   /* 2.5 MHz */
> +#define MCHP_PIT64B_LSBMASK  GENMASK_ULL(31, 0)
> +#define MCHP_PIT64B_PRESCALER(p) (MCHP_PIT64B_MR_PRES & ((p) << 8))
> +
> +#define MCHP_PIT64B_NAME "pit64b"
> +
> +struct mchp_pit64b_common_data {
> + void __iomem *base;
> + struct clk *pclk;
> + struct clk *gclk;
> + u64 cycles;
> + u8 pres;
> +};
> +
> +struct mchp_pit64b_clksrc_data {
> + struct clocksource *clksrc;
> + struct mchp_pit64b_common_data *cd;
> +};
> +
> +struct mchp_pit64b_clkevt_data {
> + struct clock_event_device *clkevt;
> + struct mchp_pit64b_common_data *cd;
> +};
> +
> +static struct mchp_pit64b_data {
> + struct mchp_pit64b_clksrc_data *csd;
> + struct mchp_pit64b_clkevt_data *ced;
> +} data;
> +
> +static inline u32 mchp_pit64b_read(void __iomem *base, u32 offset)
> +{
> + return readl_relaxed(base + offset);
> +}
> +
> +static inline void 

  1   2   >