ADD DM9051 ETHERNET DRIVER
Subsystems (3)
v20 cover ADD DM9051 ETHERNET DRIVER
DM9051 is a spi interface chip,
need cs/mosi/miso/clock with an interrupt gpio pin
Joseph CHAMG (2):
dt-bindings: net: Add Davicom dm9051 SPI ethernet controller
net: Add dm9051 driver
.../bindings/net/davicom,dm9051.yaml | 62 + drivers/net/ethernet/davicom/Kconfig | 31 + drivers/net/ethernet/davicom/Makefile | 1 + drivers/net/ethernet/davicom/dm9051.c | 1260 +++++++++++++++++ drivers/net/ethernet/davicom/dm9051.h | 162 +++ 5 files changed, 1516 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/davicom,dm9051.yaml create mode 100644 drivers/net/ethernet/davicom/dm9051.c create mode 100644 drivers/net/ethernet/davicom/dm9051.h
base-commit: 9d922f5df53844228b9f7c62f2593f4f06c0b69b
Signature · 1 line
2.20.1
PATCH v20 1/2 dt-bindings: net: Add Davicom dm9051 SPI ethernet controller
This is a new yaml base data file for configure davicom dm9051 with device tree
---
Cc: Rob Herring <[email protected]>
.../bindings/net/davicom,dm9051.yaml | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 Documentation/devicetree/bindings/net/davicom,dm9051.yaml
Documentation/devicetree/bindings/net/davicom,dm9051.yaml new file +62 -0
@@ -0,0 +1,62 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/net/davicom,dm9051.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Davicom DM9051 SPI Ethernet Controller + +maintainers: + - Joseph CHANG <[email protected]> + +description: | + The DM9051 is a fully integrated and cost-effective low pin count single + chip Fast Ethernet controller with a Serial Peripheral Interface (SPI). + +allOf: + - $ref: ethernet-controller.yaml# + +properties: + compatible: + const: davicom,dm9051 + + reg: + maxItems: 1 + + spi-max-frequency: + maximum: 45000000 + + interrupts: + maxItems: 1 + + local-mac-address: true + + mac-address: true + +required: + - compatible + - reg + - spi-max-frequency + - interrupts + +additionalProperties: false + +examples: + # Raspberry Pi platform + - | + /* for Raspberry Pi with pin control stuff for GPIO irq */ + #include <dt-bindings/interrupt-controller/irq.h> + #include <dt-bindings/gpio/gpio.h> + spi { + #address-cells = <1>; + #size-cells = <0>; + + ethernet@0 { + compatible = "davicom,dm9051"; + reg = <0>; /* spi chip select */ + local-mac-address = [00 00 00 00 00 00]; + interrupt-parent = <&gpio>; + interrupts = <26 IRQ_TYPE_LEVEL_LOW>; + spi-max-frequency = <31200000>; + }; + };
Signature · 1 line
2.20.1
PATCH v20 2/2 net: Add dm9051 driver
In reply to Joseph CHAMGAdd davicom dm9051 spi ethernet driver, The driver work for the device platform which has the spi master
---
Cc: Jakub Kicinski <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: Leon Romanovsky <[email protected]>
Cc: andy Shevchenko <[email protected]>
v1-v4
Test ok with raspberry pi 2 and pi 4
v5
swapped to phylib for phy connection tasks
v6
remove the redundant code that phylib has support
v7
read/write registers must return error code to the caller
v8
not parmanently set MAC by .ndo_set_mac_address
v9
improve the registers read/write so that error code return as far as possible up the call stack.
v10
use regmap APIs for SPI and MDIO
v11
use regmap_read_poll_timeout
use corresponding regmap APIs, i.e. SPI, MDIO
v12
use mdiobus API instead of regmap MDIO APIs
v13
Simply all regmap APIs return value checked
Clear the fifo reset report
Eliminate redundant comments
Comment that DM9051_GPR register bit 0 function for power-up the internal phy, if this bit is updated from 1 to 0, then the whole dm9051 chip registers could not be accessed within 1 ms, so that has mdelay(1) to wait 1 ms
v14
To eliminate touching PHY registers, instead take advantage of phy_start to have it
Make neat to be readable exactly
v15
Process the mac address function to be exactly right Re-arrange functions for better style
Handle to auto negotiation to be right procedure
v16
Let netif_wake_queue at the bottom of dm9051_open
Add draining tx queue in dm9051_stop
v17
Chnage from kthread_work to work_struct
v18
Clean the code with suitable macro, correctly using phy_device and to be a reasonable interrupt service routine
v19
Not to use atomic mdelay, use msleep instead
Change some to be clarity function's names
v20
Re-arrange the usage of all regmap APIs
drivers/net/ethernet/davicom/Kconfig | 31 + drivers/net/ethernet/davicom/Makefile | 1 + drivers/net/ethernet/davicom/dm9051.c | 1260 +++++++++++++++++++++++++ drivers/net/ethernet/davicom/dm9051.h | 162 ++++ 4 files changed, 1454 insertions(+) create mode 100644 drivers/net/ethernet/davicom/dm9051.c create mode 100644 drivers/net/ethernet/davicom/dm9051.h
drivers/net/ethernet/davicom/Kconfig +31 -0
@@ -3,6 +3,19 @@ # Davicom device configuration # +config NET_VENDOR_DAVICOM + bool "Davicom devices" + default y + help + If you have a network (Ethernet) card belonging to this class, 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 questions about Davicom devices. If you say Y, you will be asked + for your specific card in the following selections. + +if NET_VENDOR_DAVICOM + config DM9000 tristate "DM9000 support" depends on ARM || MIPS || COLDFIRE || NIOS2 || COMPILE_TEST
@@ -22,3 +35,21 @@ config DM9000_FORCE_SIMPLE_PHY_POLL bit to determine if the link is up or down instead of the more costly MII PHY reads. Note, this will not work if the chip is operating with an external PHY. + +config DM9051 + tristate "DM9051 SPI support" + depends on SPI + select CRC32 + select MDIO + select PHYLIB + select REGMAP_SPI + help + Support for DM9051 SPI chipset. + + To compile this driver as a module, choose M here. The module + will be called dm9051. + + The SPI mode for the host's SPI master to access DM9051 is mode + 0 on the SPI bus. + +endif # NET_VENDOR_DAVICOM
drivers/net/ethernet/davicom/Makefile +1 -0
@@ -4,3 +4,4 @@ # obj-$(CONFIG_DM9000) += dm9000.o +obj-$(CONFIG_DM9051) += dm9051.o
drivers/net/ethernet/davicom/dm9051.c new file +1260 -0
1,260 lines not on this page · raw message
drivers/net/ethernet/davicom/dm9051.h new file +162 -0
162 lines not on this page · raw message
Signature · 1 line
2.20.1
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Hello:
This series was applied to netdev/net-next.git (master) by David S. Miller <[email protected]>:
Quoted 8 lines · On Fri, 11 Feb 2022 17:27:54 +0800 you wrote:
DM9051 is a spi interface chip,
need cs/mosi/miso/clock with an interrupt gpio pinJoseph CHAMG (2):
dt-bindings: net: Add Davicom dm9051 SPI ethernet controller
net: Add dm9051 driver[...]
Here is the summary with links:
- [v20,1/2] dt-bindings: net: Add Davicom dm9051 SPI ethernet controller
https://git.kernel.org/netdev/net-next/c/759856e961e4 - [v20,2/2] net: Add dm9051 driver https://git.kernel.org/netdev/net-next/c/2dc95a4d30ed
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html