Skip to contentSkip to conversation

ADD DM9051 ETHERNET DRIVER

PATCH Superseded Joseph CHAMG 4 participants 6 messages Jan 5, 2022

Subsystems (3)

v10 of 20 Superseded Latest is v20 →

lore
Share & tools
lore
#0 lore raw

v10 cover ADD DM9051 ETHERNET DRIVER

DM9051 is a spi interface chip,
need cs/mosi/miso/clock with an interrupt gpio pin

Joseph CHAMG (1):
net: Add dm9051 driver

JosephCHANG (1):
yaml: Add dm9051 SPI network yaml file
net: Add dm9051 driver

 .../bindings/net/davicom,dm9051.yaml          |   62 +
 drivers/net/ethernet/davicom/Kconfig          |   29 +
 drivers/net/ethernet/davicom/Makefile         |    1 +
 drivers/net/ethernet/davicom/dm9051.c         | 1302 +++++++++++++++++
 drivers/net/ethernet/davicom/dm9051.h         |  198 +++
 5 files changed, 1592 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
#1 lore raw

PATCH v10 1/2 yaml: Add dm9051 SPI network yaml file

From: JosephCHANG <[email protected]>

This is a new yaml base data file for configure davicom dm9051 with device tree

---
 .../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
new file mode 100644
index 000000000000..52e852fef753
@@ -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
#2 lore raw

PATCH v10 2/2 net: Add dm9051 driver

In reply to Joseph CHAMG

v1-v4

Add davicom dm9051 spi ethernet driver. The driver work for the device platform with spi master

Test ok with raspberry pi 2 and pi 4, the spi configure used in my raspberry pi 4 is spi0.1, spi speed 31200000, and INT by pin 26.

v5

Work to eliminate the wrappers to be clear for read, swapped to phylib for phy connection tasks.

Tested with raspberry pi 4. Test for netwroking function, CAT5 cable unplug/plug and also ethtool detect for link state, and all are ok.

v6

remove the redundant code that phylib has support, adjust to be the reasonable sequence,
fine tune comments, add comments for pause function support

Tested with raspberry pi 4. Test for netwroking function, CAT5 cable unplug/plug and also ethtool detect for link state, and all are ok.

v7

read/write registers must return error code to the callet, add to enable pause processing

v8

not parmanently set MAC by .ndo_set_mac_address

correct rx function such as clear ISR,
inblk avoid stack buffer,
simple skb buffer process and
easy use netif_rx_ni.

simplely queue init and wake the queues, limit the start_xmit function use netif_stop_queue.

descript that schedule delay is essential
for tx_work and rxctrl_work

eliminate ____cacheline_aligned and
add static int msg_enable.

v9

use phylib, no need 'select MII' in Kconfig, make it clear in dm9051_xfer when using spi_sync, 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,
modify to correcting such as include header files
and program check styles

Cc Jakub Kicinski <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Leon Romanovsky <[email protected]>
Cc andy Shevchenko <[email protected]>
---
 drivers/net/ethernet/davicom/Kconfig  |   29 +
 drivers/net/ethernet/davicom/Makefile |    1 +
 drivers/net/ethernet/davicom/dm9051.c | 1302 +++++++++++++++++++++++++
 drivers/net/ethernet/davicom/dm9051.h |  198 ++++
 4 files changed, 1530 insertions(+)
 create mode 100644 drivers/net/ethernet/davicom/dm9051.c
 create mode 100644 drivers/net/ethernet/davicom/dm9051.h
drivers/net/ethernet/davicom/Kconfig +29 -0
index 7af86b6d4150..887fe6e56d56 100644
@@ -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,19 @@ 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"
+	select PHYLIB
+	depends on SPI
+	select CRC32
+	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
index 173c87d21076..225f85bc1f53 100644
@@ -4,3 +4,4 @@
 #
 
 obj-$(CONFIG_DM9000) += dm9000.o
+obj-$(CONFIG_DM9051) += dm9051.o
drivers/net/ethernet/davicom/dm9051.c new file +1302 -0

1,302 lines not on this page · raw message

drivers/net/ethernet/davicom/dm9051.h new file +198 -0

198 lines not on this page · raw message

Signature · 1 line
2.20.1
#3 lore raw

Re: [PATCH v10, 2/2] net: Add dm9051 driver

On Wed, Jan 5, 2022 at 10:18 AM Joseph CHAMG <[email protected]> wrote:

Missed commit message.

Quoted 57 lines

v1-v4

Add davicom dm9051 spi ethernet driver. The driver work for the device platform with spi master

Test ok with raspberry pi 2 and pi 4, the spi configure used in my raspberry pi 4 is spi0.1, spi speed 31200000, and INT by pin 26.

v5

Work to eliminate the wrappers to be clear for read, swapped to phylib for phy connection tasks.

Tested with raspberry pi 4. Test for netwroking function, CAT5 cable unplug/plug and also ethtool detect for link state, and all are ok.

v6

remove the redundant code that phylib has support, adjust to be the reasonable sequence,
fine tune comments, add comments for pause function support

Tested with raspberry pi 4. Test for netwroking function, CAT5 cable unplug/plug and also ethtool detect for link state, and all are ok.

v7

read/write registers must return error code to the callet, add to enable pause processing

v8

not parmanently set MAC by .ndo_set_mac_address

correct rx function such as clear ISR,
inblk avoid stack buffer,
simple skb buffer process and
easy use netif_rx_ni.

simplely queue init and wake the queues, limit the start_xmit function use netif_stop_queue.

descript that schedule delay is essential
for tx_work and rxctrl_work

eliminate ____cacheline_aligned and
add static int msg_enable.

v9

use phylib, no need 'select MII' in Kconfig, make it clear in dm9051_xfer when using spi_sync, improve the registers read/write so that error code return as far as possible up the call stack.

Quoted 5 lines

v10

use regmap APIs for SPI and MDIO,
modify to correcting such as include header files
and program check styles

Changelog should go after the cutter '--- ' line below...

Quoted 6 lines
Cc Jakub Kicinski <[email protected]>
Cc Andrew Lunn <[email protected]>
Cc Leon Romanovsky <[email protected]>
Cc andy Shevchenko <[email protected]>

---

...somewhere here.

...

Quoted 12 lines
drivers/net/ethernet/davicom/dm9051.c new file +12 -0
+#include <linux/etherdevice.h>
+#include <linux/ethtool.h>
+#include <linux/interrupt.h>
+#include <linux/iopoll.h>
+#include <linux/mii.h>
+#include <linux/module.h>
+#include <linux/netdevice.h>
+#include <linux/phy.h>
+#include <linux/regmap.h>
+#include <linux/skbuff.h>
+#include <linux/spinlock.h>
+#include <linux/spi/spi.h>

...

drivers/net/ethernet/davicom/dm9051.c line 73

Quoted 13 lines
drivers/net/ethernet/davicom/dm9051.c new file +9 -0
+/* spi master low level code */
+static int hw_dm9051_spi_write(void *context, u8 reg, const u8 *data, size_t count)
 
+static int hw_dm9051_spi_read(void *context, u8 reg, u8 *data, size_t count)
 
+static int regmap_dm9051_reg_write(void *context, const void *data, size_t len)
 
+static int regmap_dm9051_reg_read(void *context, const void *reg_buf, size_t reg_size,
+                                 void *val, size_t val_size)
 
+static int regmap_dm9051_reg_update_bits(void *context, unsigned int reg,
+                                        unsigned int mask,
+                                        unsigned int val)

All these are implemented by regmap SPI API. Why don't you use it?

...

Quoted 9 lines
drivers/net/ethernet/davicom/dm9051.c new file +9 -0
+static bool dm9051_regmap_readable(struct device *dev, unsigned int reg)
+{
+       return true;
+}
+
+static bool dm9051_regmap_writeable(struct device *dev, unsigned int reg)
+{
+       return true;
+}

drivers/net/ethernet/davicom/dm9051.c line 102

Quoted 10 lines
drivers/net/ethernet/davicom/dm9051.c new file +10 -0
+
+static bool dm9051_regmap_volatile(struct device *dev, unsigned int reg)
+{
+       return true; /* optional false */
+}
+
+static bool dm9051_regmap_precious(struct device *dev, unsigned int reg)
+{
+       return true; /* optional false */
+}

These stubs are redundant.

...

drivers/net/ethernet/davicom/dm9051.c line 116

Quoted 13 lines
drivers/net/ethernet/davicom/dm9051.c new file +13 -0
+static void regmap_lock_mutex(void *context)
+{
+       struct board_info *db = context;
+
+       mutex_lock(&db->regmap_mutex);
+}
+
+static void regmap_unlock_mutex(void *context)
+{
+       struct board_info *db = context;
+
+       mutex_unlock(&db->regmap_mutex);
+}

Why do you need this? Either you use lock provided by regmap, or you disable locking for regmap and provide your own locking scheme (should be justified in the commit message).

...

drivers/net/ethernet/davicom/dm9051.c line 119

Quoted 3 lines
drivers/net/ethernet/davicom/dm9051.c new file +2 -0
+static struct regmap_config regconfig = {
 
+       .name = "reg",

Do you need this?

Quoted 8 lines
drivers/net/ethernet/davicom/dm9051.c new file +7 -0
+       .reg_bits = 8,
+       .val_bits = 8,
+       .max_register = 0xff,
+       .reg_stride = 1,
+       .cache_type = REGCACHE_RBTREE,
+       .val_format_endian = REGMAP_ENDIAN_LITTLE,
 
+};

...

drivers/net/ethernet/davicom/dm9051.c line 144

Quoted 11 lines
drivers/net/ethernet/davicom/dm9051.c new file +11 -0
+static int dm9051_map_poll(struct board_info *db)
+{
+       unsigned int mval;
+       int ret;
+
+       ret = read_poll_timeout(regmap_read, ret, !ret || !(mval & EPCR_ERRE),
+                               100, 10000, true, db->regmap, DM9051_EPCR, &mval);
+       if (ret)
+               netdev_err(db->ndev, "timeout in processing for phy/eeprom accessing\n");
+       return ret;
+}

regmap has a corresponding API, i.e. regmap_read_poll_timeout().

...

drivers/net/ethernet/davicom/dm9051.c line 153

Quoted 9 lines
drivers/net/ethernet/davicom/dm9051.c new file +8 -0
+static int regmap_dm9051_phy_reg_write(void *context, unsigned int reg, unsigned int val)
+{
+       struct board_info *db = context;
+       int ret;
+
+       regmap_write(db->regmap, DM9051_EPAR, DM9051_PHY | reg);
 
+       regmap_write(db->regmap, DM9051_EPDRL, val & 0xff);
+       regmap_write(db->regmap, DM9051_EPDRH, (val >> 8) && 0xff);

Shouldn't be this a bulk write?
Ditto for all other cases where you need to write 16-bit values in sequential addresses.

Quoted 9 lines
drivers/net/ethernet/davicom/dm9051.c new file +9 -0
+       regmap_write(db->regmap, DM9051_EPCR, EPCR_EPOS | EPCR_ERPRW);
+       ret = dm9051_map_poll(db);
+       regmap_write(db->regmap, DM9051_EPCR, 0x0);
+
+       if (reg == MII_BMCR && !(val & 0x0800))
+               mdelay(1); /* need for if activate phyxcer */
+
+       return ret;
+}

...

drivers/net/ethernet/davicom/dm9051.c line 225

Quoted 12 lines
drivers/net/ethernet/davicom/dm9051.c new file +12 -0
+static int devm_regmap_init_dm9051(struct device *dev, struct board_info *db)
+{
+       mutex_init(&db->regmap_mutex);
+
+       regconfig.lock_arg = db;
+
+       db->regmap = devm_regmap_init(dev, &regmap_spi, db, &regconfig);
+       if (IS_ERR(db->regmap))
+               return PTR_ERR(db->regmap);
+       db->phymap = devm_regmap_init(dev, &phymap_mdio, db, &phyconfig);
+       if (IS_ERR(db->phymap))
+               return PTR_ERR(db->phymap);

Use corresponding regmap APIs, i.e. MDIO, SPI, etc.

Quoted 2 lines
(quoted diff) +2 -0
+       return 0;
+}

...

drivers/net/ethernet/davicom/dm9051.c line 286

Quoted 11 lines
drivers/net/ethernet/davicom/dm9051.c new file +11 -0
+{
+       int ret;
+       u8 rxb[1];
+
+       while (len--) {
+               ret = hw_dm9051_spi_read(db, DM_SPI_MRCMD, rxb, 1);
+               if (ret < 0)
+                       return ret;
+       }
+       return ret;
+}

I believe the regmap API provides this kind of read (bulk with no increment addresses or so).

I stopped here, because it's enough for now. Just take your time to see how other (recent) drivers are implemented.

Signature · 2 lines
With Best Regards,
Andy Shevchenko
#4 lore raw

Re: [PATCH v10, 2/2] net: Add dm9051 driver

In reply to Joseph CHAMG

drivers/net/ethernet/davicom/dm9051.c line 151

Quoted 6 lines
drivers/net/ethernet/davicom/dm9051.c new file +6 -0
+static int regmap_dm9051_phy_reg_write(void *context, unsigned int reg, unsigned int val)
+{
+	struct board_info *db = context;
+	int ret;
+
+	regmap_write(db->regmap, DM9051_EPAR, DM9051_PHY | reg);

regmap_write() can return an error code. You should check for it, and return it. The driver is full of code like this. Always check the return code.

drivers/net/ethernet/davicom/dm9051.c line 158

Quoted 7 lines
drivers/net/ethernet/davicom/dm9051.c new file +7 -0
+	regmap_write(db->regmap, DM9051_EPDRL, val & 0xff);
+	regmap_write(db->regmap, DM9051_EPDRH, (val >> 8) && 0xff);
+	regmap_write(db->regmap, DM9051_EPCR, EPCR_EPOS | EPCR_ERPRW);
+	ret = dm9051_map_poll(db);
+	regmap_write(db->regmap, DM9051_EPCR, 0x0);
+
+	if (reg == MII_BMCR && !(val & 0x0800))

Use the available defines, BMCR_RESET. This then makes a lot more sense.

Review

Quoted 1 line
(quoted diff) +1 -0
+		mdelay(1); /* need for if activate phyxcer */

However, the MAC driver should not be touching the PHY. The PHY driver should be resetting the PHY. If the PHY driver uses genphy_soft_reset(), phy_poll_reset() will poll until the BMCR_RESET bit is cleared by the PHY indicating it is has completed reset. Or is the PHY broken and needs longer?

drivers/net/ethernet/davicom/dm9051.c line 195

Quoted 6 lines
drivers/net/ethernet/davicom/dm9051.c new file +6 -0
+static bool dm9051_phymap_writeable(struct device *dev, unsigned int reg)
+{
+	if (reg == MII_BMSR || reg == MII_PHYSID1 || reg == MII_PHYSID2)
+		return false;
+	return true;
+}

Do bad things actually happen if you write to these registers?

drivers/net/ethernet/davicom/dm9051.c line 238

Quoted 10 lines
drivers/net/ethernet/davicom/dm9051.c new file +10 -0
+static u8 dm9051_map_read(struct board_info *db, u8 reg)
+{
+	struct net_device *ndev = db->ndev;
+	unsigned int val = 0;
+	int ret;
+
+	ret = regmap_read(db->regmap, reg, &val); /* read only one byte */
+	if (unlikely(ret))
+		netif_err(db, drv, ndev, "%s: error %d reading reg %02x\n",
+			  __func__, ret, reg);

Don't discard the error, return it to the caller.

drivers/net/ethernet/davicom/dm9051.c line 249

Quoted 11 lines
drivers/net/ethernet/davicom/dm9051.c new file +11 -0
+	return val;
+}
+
+static void dm9051_map_write(struct board_info *db, u8 reg, u16 val)
+{
+	struct net_device *ndev = db->ndev;
+	int ret = regmap_write(db->regmap, reg, val);
+
+	if (unlikely(ret))
+		netif_err(db, drv, ndev, "%s: error %d writing reg %02x=%04x\n",
+			  __func__, ret, reg, val);

Return the error to the caller.

drivers/net/ethernet/davicom/dm9051.c line 286

Quoted 12 lines
drivers/net/ethernet/davicom/dm9051.c new file +12 -0
+static int dm9051_dumpblk(struct board_info *db, unsigned int len)
+{
+	int ret;
+	u8 rxb[1];
+
+	while (len--) {
+		ret = hw_dm9051_spi_read(db, DM_SPI_MRCMD, rxb, 1);
+		if (ret < 0)
+			return ret;
+	}
+	return ret;
+}

It would be good to have a comment why this function is needed. It appears to be discarding whatever it reads. Why do you need to do that?

Quoted 23 lines
drivers/net/ethernet/davicom/dm9051.c new file +23 -0
+static int dm9051_direct_phyread(struct board_info *db, int reg, int *pvalue)
+{
+	u8 eph, epl;
+	int ret;
+
+	ret = dm9051_direct_write(db, DM9051_EPAR, DM9051_PHY | reg);
+	if (ret < 0)
+		return ret;
+	ret = dm9051_direct_write(db, DM9051_EPCR, EPCR_ERPRR | EPCR_EPOS);
+	if (ret < 0)
+		return ret;
+
+	ret = dm9051_direct_poll(db);
+	if (ret)
+		return ret;
+
+	ret = dm9051_direct_write(db, DM9051_EPCR, 0x0);
+	if (ret < 0)
+		return ret;
+
+	ret = dm9051_direct_read(db, DM9051_EPDRH, &eph);
+	if (ret < 0)
+		return ret;

drivers/net/ethernet/davicom/dm9051.c line 356

Quoted 10 lines
drivers/net/ethernet/davicom/dm9051.c new file +10 -0
+	ret = dm9051_direct_read(db, DM9051_EPDRL, &epl);
+	if (ret < 0)
+		return ret;
+
+	*pvalue = (eph << 8) | epl;
+	return ret;
+}
+
+static int dm9051_direct_phywrite(struct board_info *db, int reg, int value)
+{

It is not clear why you need this. You already setup a regmap for access to the PHY. Why are you not using it?

drivers/net/ethernet/davicom/dm9051.c line 423

Quoted 9 lines
drivers/net/ethernet/davicom/dm9051.c new file +9 -0
+static int dm9051_mdio_read(struct mii_bus *mdiobus, int phy_id, int reg)
+{
+	struct board_info *db = mdiobus->priv;
+	int val, ret;
+
+	if (phy_id == DM9051_PHY_ID) {
+		mutex_lock(&db->addr_lock);
+		ret = dm9051_direct_phyread(db, reg, &val);
+		mutex_unlock(&db->addr_lock);

At some point, the locking needs a good looking at. The MDIO layer provides a lock, so there will not be parallel MDIO operations. regmap also has a lock. So i wonder if this lock is actually required?

drivers/net/ethernet/davicom/dm9051.c line 454

Quoted 8 lines
drivers/net/ethernet/davicom/dm9051.c new file +8 -0
+static unsigned int dm9051_chipid(struct board_info *db)
+{
+	struct device *dev = &db->spidev->dev;
+	unsigned int wpidh, wpidl;
+	u16 id = 0;
+
+	regmap_read(db->regmap, DM9051_PIDH, &wpidh);
+	regmap_read(db->regmap, DM9051_PIDL, &wpidl);

I'm guessing this is one of the first accesses made to the hardware? You definitely should be looking at the error codes these return.

drivers/net/ethernet/davicom/dm9051.c line 472

Quoted 8 lines
drivers/net/ethernet/davicom/dm9051.c new file +8 -0
+static int dm9051_direct_reset_code(struct board_info *db)
+{
+	int ret;
+
+	mdelay(2); /* need before NCR_RST */
+	ret = dm9051_direct_write(db, DM9051_NCR, NCR_RST); /* NCR reset */
+	if (ret < 0)
+		return ret;

A pause before doing a reset? That is odd. What is actually happening before dm9051_direct_reset_code() is called which means this pause is required?

Andrew

#5 lore raw

Re: [PATCH v10, 2/2] net: Add dm9051 driver

In reply to Joseph CHAMG
Thank you for the patch! Perhaps something to improve:

Hi Joseph,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on 9d922f5df53844228b9f7c62f2593f4f06c0b69b]

url:    https://github.com/0day-ci/linux/commits/Joseph-CHAMG/ADD-DM9051-ETHERNET-DRIVER/20220105-162144
base:   9d922f5df53844228b9f7c62f2593f4f06c0b69b
config: hexagon-allyesconfig (https://download.01.org/0day-ci/archive/20220106/202201060738.5ZBat35r-lkp(a)intel.com/config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project d5b6e30ed3acad794dd0aec400e617daffc6cc3d)

reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4a2b192e52a57fee2e5d3452eeb1f3764ef4086c
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Joseph-CHAMG/ADD-DM9051-ETHERNET-DRIVER/20220105-162144
git checkout 4a2b192e52a57fee2e5d3452eeb1f3764ef4086c
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=hexagon SHELL=/bin/bash drivers/media/platform/atmel/ drivers/media/platform/sti/bdisp/ drivers/media/platform/sti/delta/ drivers/media/platform/sti/hva/ drivers/mmc/host/ drivers/net/ethernet/davicom/ drivers/staging/rtl8723bs/ fs/xfs/

If you fix the issue, kindly add following tag as appropriate

All warnings (new ones prefixed by >>):

>> drivers/net/ethernet/davicom/dm9051.c:153:52: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
           regmap_write(db->regmap, DM9051_EPDRH, (val >> 8) && 0xff);
                                                             ^  ~~~~
   drivers/net/ethernet/davicom/dm9051.c:153:52: note: use '&' for a bitwise operation
           regmap_write(db->regmap, DM9051_EPDRH, (val >> 8) && 0xff);
                                                             ^~
                                                             &
   drivers/net/ethernet/davicom/dm9051.c:153:52: note: remove constant to silence this warning
           regmap_write(db->regmap, DM9051_EPDRH, (val >> 8) && 0xff);
                                                            ~^~~~~~~

1 warning generated.

vim +153 drivers/net/ethernet/davicom/dm9051.c

145
146 static int regmap_dm9051_phy_reg_write(void *context, unsigned int reg, unsigned int val)
147 {
148 struct board_info *db = context;
149 int ret;
150
151 regmap_write(db->regmap, DM9051_EPAR, DM9051_PHY | reg);
152 regmap_write(db->regmap, DM9051_EPDRL, val & 0xff);

 > 153		regmap_write(db->regmap, DM9051_EPDRH, (val >> 8) && 0xff);

154 regmap_write(db->regmap, DM9051_EPCR, EPCR_EPOS | EPCR_ERPRW);
155 ret = dm9051_map_poll(db);
156 regmap_write(db->regmap, DM9051_EPCR, 0x0);
157
158 if (reg == MII_BMCR && !(val & 0x0800))
159 mdelay(1); /* need for if activate phyxcer */
160
161 return ret;
162 }
163

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org