Module Name: src Committed By: snj Date: Thu Apr 16 06:10:43 UTC 2015
Modified Files: src/sys/dev/pci [netbsd-7]: if_wm.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #694): sys/dev/pci/if_wm.c: revision 1.314 Fix a bug that wm_sgmii_writereg() function doesn't pass the "val" argument to the I2CCMD register. Reported by Bernard Merindol in PR#49789. To generate a diff of this commit: cvs rdiff -u -r1.289.2.4 -r1.289.2.5 src/sys/dev/pci/if_wm.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/pci/if_wm.c diff -u src/sys/dev/pci/if_wm.c:1.289.2.4 src/sys/dev/pci/if_wm.c:1.289.2.5 --- src/sys/dev/pci/if_wm.c:1.289.2.4 Wed Mar 18 04:39:15 2015 +++ src/sys/dev/pci/if_wm.c Thu Apr 16 06:10:43 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: if_wm.c,v 1.289.2.4 2015/03/18 04:39:15 snj Exp $ */ +/* $NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $ */ /* * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc. @@ -81,7 +81,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.4 2015/03/18 04:39:15 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.289.2.5 2015/04/16 06:10:43 snj Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -7390,16 +7390,18 @@ wm_sgmii_writereg(device_t self, int phy struct wm_softc *sc = device_private(self); uint32_t i2ccmd; int i; + int val_swapped; if (wm_get_swfw_semaphore(sc, swfwphysem[sc->sc_funcid])) { aprint_error_dev(sc->sc_dev, "%s: failed to get semaphore\n", __func__); return; } - + /* Swap the data bytes for the I2C interface */ + val_swapped = ((val >> 8) & 0x00FF) | ((val << 8) & 0xFF00); i2ccmd = (reg << I2CCMD_REG_ADDR_SHIFT) | (phy << I2CCMD_PHY_ADDR_SHIFT) - | I2CCMD_OPCODE_WRITE; + | I2CCMD_OPCODE_WRITE | val_swapped; CSR_WRITE(sc, WMREG_I2CCMD, i2ccmd); /* Poll the ready bit */