2020-11-12 11:55:28

by Łukasz Stelmach

[permalink] [raw]
Subject: [PATCH v6 0/5] AX88796C SPI Ethernet Adapter

This is a driver for AX88796C Ethernet Adapter connected in SPI mode as
found on ARTIK5 evaluation board. The driver has been ported from a
v3.10.9 vendor kernel for ARTIK5 board.

Changes in v6:
- fixed typos in Kconfig
- checked argument value in ax88796c_set_tunable
- updated tags in commit messages

Changes in v5:
- coding style (local variable declarations)
- added spi0 node in the DT binding example and removed
interrupt-parent
- removed comp module parameter
- added CONFIG_SPI_AX88796C_COMPRESSION option to set the initial
state of SPI compression
- introduced new ethtool tunable "spi-compression" to controll SPI
transfer compression
- removed unused fields in struct ax88796c_device
- switched from using buffers allocated on stack for SPI transfers
to DMA safe ones embedded in struct ax_spi and allocated with
kmalloc()

Changes in v4:
- fixed compilation problems in asix,ax88796c.yaml and in
ax88796c_main.c introduced in v3

Changes in v3:
- modify vendor-prefixes.yaml in a separate patch
- fix several problems in the dt binding
- removed unnecessary descriptions and properties
- changed the order of entries
- fixed problems with missing defines in the example
- change (1 << N) to BIT(N), left a few (0 << N)
- replace ax88796c_get_link(), ax88796c_get_link_ksettings(),
ax88796c_set_link_ksettings(), ax88796c_nway_reset(),
ax88796c_set_mac_address() with appropriate kernel functions.
- disable PHY auto-polling in MAC and use PHYLIB to track the state
of PHY and configure MAC
- propagate return values instead of returning constants in several
places
- add WARN_ON() for unlocked mutex
- remove local work queue and use the system_wq
- replace phy_connect_direct() with phy_connect() and move
devm_register_netdev() to the end of ax88796c_probe()
(Unlike phy_connect_direct() phy_connect() does not crash if the
network device isn't registered yet.)
- remove error messages on ENOMEM
- move free_irq() to the end of ax88796c_close() to avoid race
condition
- implement flow-control

Changes in v2:
- use phylib
- added DT bindings
- moved #includes to *.c files
- used mutex instead of a semaphore for locking
- renamed some constants
- added error propagation for several functions
- used ethtool for dumping registers
- added control over checksum offloading
- remove vendor specific PM
- removed macaddr module parameter and added support for reading a MAC
address from platform data (e.g. DT)
- removed dependency on SPI from NET_VENDOR_ASIX
- added an entry in the MAINTAINERS file
- simplified logging with appropriate netif_* and netdev_* helpers
- lots of style fixes

Łukasz Stelmach (5):
dt-bindings: vendor-prefixes: Add asix prefix
dt-bindings: net: Add bindings for AX88796C SPI Ethernet Adapter
net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver
ARM: dts: exynos: Add Ethernet to Artik 5 board
ARM: defconfig: Enable ax88796c driver

.../bindings/net/asix,ax88796c.yaml | 73 ++
.../devicetree/bindings/vendor-prefixes.yaml | 2 +
MAINTAINERS | 6 +
arch/arm/boot/dts/exynos3250-artik5-eval.dts | 29 +
arch/arm/configs/exynos_defconfig | 2 +
arch/arm/configs/multi_v7_defconfig | 2 +
drivers/net/ethernet/Kconfig | 1 +
drivers/net/ethernet/Makefile | 1 +
drivers/net/ethernet/asix/Kconfig | 35 +
drivers/net/ethernet/asix/Makefile | 6 +
drivers/net/ethernet/asix/ax88796c_ioctl.c | 237 ++++
drivers/net/ethernet/asix/ax88796c_ioctl.h | 26 +
drivers/net/ethernet/asix/ax88796c_main.c | 1132 +++++++++++++++++
drivers/net/ethernet/asix/ax88796c_main.h | 561 ++++++++
drivers/net/ethernet/asix/ax88796c_spi.c | 109 ++
drivers/net/ethernet/asix/ax88796c_spi.h | 70 +
include/uapi/linux/ethtool.h | 1 +
net/ethtool/common.c | 1 +
18 files changed, 2294 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/asix,ax88796c.yaml
create mode 100644 drivers/net/ethernet/asix/Kconfig
create mode 100644 drivers/net/ethernet/asix/Makefile
create mode 100644 drivers/net/ethernet/asix/ax88796c_ioctl.c
create mode 100644 drivers/net/ethernet/asix/ax88796c_ioctl.h
create mode 100644 drivers/net/ethernet/asix/ax88796c_main.c
create mode 100644 drivers/net/ethernet/asix/ax88796c_main.h
create mode 100644 drivers/net/ethernet/asix/ax88796c_spi.c
create mode 100644 drivers/net/ethernet/asix/ax88796c_spi.h

--
2.26.2


2020-11-12 11:56:03

by Łukasz Stelmach

[permalink] [raw]
Subject: [PATCH v6 2/5] dt-bindings: net: Add bindings for AX88796C SPI Ethernet Adapter

Add bindings for AX88796C SPI Ethernet Adapter.

Signed-off-by: Łukasz Stelmach <[email protected]>
Reviewed-by: Rob Herring <[email protected]>
Acked-by: Krzysztof Kozlowski <[email protected]>
---
.../bindings/net/asix,ax88796c.yaml | 73 +++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/asix,ax88796c.yaml

diff --git a/Documentation/devicetree/bindings/net/asix,ax88796c.yaml b/Documentation/devicetree/bindings/net/asix,ax88796c.yaml
new file mode 100644
index 000000000000..699ebf452479
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/asix,ax88796c.yaml
@@ -0,0 +1,73 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/net/asix,ax88796c.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ASIX AX88796C SPI Ethernet Adapter
+
+maintainers:
+ - Łukasz Stelmach <[email protected]>
+
+description: |
+ ASIX AX88796C is an Ethernet controller with a built in PHY. This
+ describes SPI mode of the chip.
+
+ The node for this driver must be a child node of an SPI controller,
+ hence all mandatory properties described in
+ ../spi/spi-controller.yaml must be specified.
+
+allOf:
+ - $ref: ethernet-controller.yaml#
+
+properties:
+ compatible:
+ const: asix,ax88796c
+
+ reg:
+ maxItems: 1
+
+ spi-max-frequency:
+ maximum: 40000000
+
+ interrupts:
+ maxItems: 1
+
+ reset-gpios:
+ description:
+ A GPIO line handling reset of the chip. As the line is active low,
+ it should be marked GPIO_ACTIVE_LOW.
+ maxItems: 1
+
+ local-mac-address: true
+
+ mac-address: true
+
+required:
+ - compatible
+ - reg
+ - spi-max-frequency
+ - interrupts
+ - reset-gpios
+
+additionalProperties: false
+
+examples:
+ # Artik5 eval board
+ - |
+ #include <dt-bindings/interrupt-controller/irq.h>
+ #include <dt-bindings/gpio/gpio.h>
+ spi0 {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ ethernet@0 {
+ compatible = "asix,ax88796c";
+ reg = <0x0>;
+ local-mac-address = [00 00 00 00 00 00]; /* Filled in by a bootloader */
+ interrupt-parent = <&gpx2>;
+ interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
+ spi-max-frequency = <40000000>;
+ reset-gpios = <&gpe0 2 GPIO_ACTIVE_LOW>;
+ };
+ };
--
2.26.2

2020-11-12 11:56:31

by Łukasz Stelmach

[permalink] [raw]
Subject: [PATCH v6 5/5] ARM: defconfig: Enable ax88796c driver

Enable ax88796c driver for the ethernet chip on Exynos3250-based
ARTIK5 boards.

Signed-off-by: Łukasz Stelmach <[email protected]>
---
arch/arm/configs/exynos_defconfig | 2 ++
arch/arm/configs/multi_v7_defconfig | 2 ++
2 files changed, 4 insertions(+)

diff --git a/arch/arm/configs/exynos_defconfig b/arch/arm/configs/exynos_defconfig
index cf82c9d23a08..1ee902d01eef 100644
--- a/arch/arm/configs/exynos_defconfig
+++ b/arch/arm/configs/exynos_defconfig
@@ -107,6 +107,8 @@ CONFIG_MD=y
CONFIG_BLK_DEV_DM=y
CONFIG_DM_CRYPT=m
CONFIG_NETDEVICES=y
+CONFIG_NET_VENDOR_ASIX=y
+CONFIG_SPI_AX88796C=y
CONFIG_SMSC911X=y
CONFIG_USB_RTL8150=m
CONFIG_USB_RTL8152=y
diff --git a/arch/arm/configs/multi_v7_defconfig b/arch/arm/configs/multi_v7_defconfig
index e731cdf7c88c..dad53846f58f 100644
--- a/arch/arm/configs/multi_v7_defconfig
+++ b/arch/arm/configs/multi_v7_defconfig
@@ -243,6 +243,8 @@ CONFIG_SATA_HIGHBANK=y
CONFIG_SATA_MV=y
CONFIG_SATA_RCAR=y
CONFIG_NETDEVICES=y
+CONFIG_NET_VENDOR_ASIX=y
+CONFIG_SPI_AX88796C=m
CONFIG_VIRTIO_NET=y
CONFIG_B53_SPI_DRIVER=m
CONFIG_B53_MDIO_DRIVER=m
--
2.26.2

2020-11-12 11:56:32

by Łukasz Stelmach

[permalink] [raw]
Subject: [PATCH v6 1/5] dt-bindings: vendor-prefixes: Add asix prefix

Add the prefix for ASIX Electronics Corporation.

Signed-off-by: Łukasz Stelmach <[email protected]>
Reviewed-by: Krzysztof Kozlowski <[email protected]>
Acked-by: Rob Herring <[email protected]>
---
Documentation/devicetree/bindings/vendor-prefixes.yaml | 2 ++
1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/vendor-prefixes.yaml b/Documentation/devicetree/bindings/vendor-prefixes.yaml
index 2735be1a8470..ce3b3f6c9728 100644
--- a/Documentation/devicetree/bindings/vendor-prefixes.yaml
+++ b/Documentation/devicetree/bindings/vendor-prefixes.yaml
@@ -117,6 +117,8 @@ patternProperties:
description: Asahi Kasei Corp.
"^asc,.*":
description: All Sensors Corporation
+ "^asix,.*":
+ description: ASIX Electronics Corporation
"^aspeed,.*":
description: ASPEED Technology Inc.
"^asus,.*":
--
2.26.2

2020-11-12 11:57:46

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH v6 0/5] AX88796C SPI Ethernet Adapter

On Thu, 12 Nov 2020 at 12:51, Łukasz Stelmach <[email protected]> wrote:
>
> This is a driver for AX88796C Ethernet Adapter connected in SPI mode as
> found on ARTIK5 evaluation board. The driver has been ported from a
> v3.10.9 vendor kernel for ARTIK5 board.
>
> Changes in v6:
> - fixed typos in Kconfig
> - checked argument value in ax88796c_set_tunable
> - updated tags in commit messages
>
> Changes in v5:
> - coding style (local variable declarations)
> - added spi0 node in the DT binding example and removed
> interrupt-parent
> - removed comp module parameter
> - added CONFIG_SPI_AX88796C_COMPRESSION option to set the initial
> state of SPI compression
> - introduced new ethtool tunable "spi-compression" to controll SPI
> transfer compression
> - removed unused fields in struct ax88796c_device
> - switched from using buffers allocated on stack for SPI transfers
> to DMA safe ones embedded in struct ax_spi and allocated with
> kmalloc()
>
> Changes in v4:
> - fixed compilation problems in asix,ax88796c.yaml and in
> ax88796c_main.c introduced in v3
>
> Changes in v3:
> - modify vendor-prefixes.yaml in a separate patch
> - fix several problems in the dt binding
> - removed unnecessary descriptions and properties
> - changed the order of entries
> - fixed problems with missing defines in the example
> - change (1 << N) to BIT(N), left a few (0 << N)
> - replace ax88796c_get_link(), ax88796c_get_link_ksettings(),
> ax88796c_set_link_ksettings(), ax88796c_nway_reset(),
> ax88796c_set_mac_address() with appropriate kernel functions.
> - disable PHY auto-polling in MAC and use PHYLIB to track the state
> of PHY and configure MAC
> - propagate return values instead of returning constants in several
> places
> - add WARN_ON() for unlocked mutex
> - remove local work queue and use the system_wq
> - replace phy_connect_direct() with phy_connect() and move
> devm_register_netdev() to the end of ax88796c_probe()
> (Unlike phy_connect_direct() phy_connect() does not crash if the
> network device isn't registered yet.)
> - remove error messages on ENOMEM
> - move free_irq() to the end of ax88796c_close() to avoid race
> condition
> - implement flow-control
>
> Changes in v2:
> - use phylib
> - added DT bindings
> - moved #includes to *.c files
> - used mutex instead of a semaphore for locking
> - renamed some constants
> - added error propagation for several functions
> - used ethtool for dumping registers
> - added control over checksum offloading
> - remove vendor specific PM
> - removed macaddr module parameter and added support for reading a MAC
> address from platform data (e.g. DT)
> - removed dependency on SPI from NET_VENDOR_ASIX
> - added an entry in the MAINTAINERS file
> - simplified logging with appropriate netif_* and netdev_* helpers
> - lots of style fixes
>
> Łukasz Stelmach (5):
> dt-bindings: vendor-prefixes: Add asix prefix
> dt-bindings: net: Add bindings for AX88796C SPI Ethernet Adapter
> net: ax88796c: ASIX AX88796C SPI Ethernet Adapter Driver
> ARM: dts: exynos: Add Ethernet to Artik 5 board
> ARM: defconfig: Enable ax88796c driver

Please don't send patches which were applied. It confuses everyone and
could cause double-applying through different tree.

Best regards,
Krzysztof