bge(4) typo in bge_phy_addr()

2013-04-06 Thread David Imhoff

Hi,

I found a small discrepancy between the FreeBSD and OpenBSD bge driver
in the following code:

from FreeBSD if_bge.c@3289:
if (sc-bge_asicrev == BGE_ASICREV_BCM5717 ||
  sc-bge_asicrev == BGE_ASICREV_BCM5719 ||
  sc-bge_asicrev == BGE_ASICREV_BCM5720) {
if (sc-bge_chipid != BGE_CHIPID_BCM5717_A0) {
if (CSR_READ_4(sc, BGE_SGDIG_STS) 
  BGE_SGDIGSTS_IS_SERDES)
sc-bge_phy_addr = sc-bge_func_addr + 8;
else
sc-bge_phy_addr = sc-bge_func_addr + 1;
} else {
if (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) 
  BGE_CPMU_PHY_STRAP_IS_SERDES)
sc-bge_phy_addr = sc-bge_func_addr + 8;
else
sc-bge_phy_addr = sc-bge_func_addr + 1;
}
}

from OpenBSD if_bge.c@1592:
switch (BGE_ASICREV(sc-bge_chipid)) {
case BGE_ASICREV_BCM5717:
case BGE_ASICREV_BCM5719:
case BGE_ASICREV_BCM5720:
phy_addr = pa-pa_function;
if (sc-bge_chipid == BGE_CHIPID_BCM5717_A0) {
phy_addr += (CSR_READ_4(sc, BGE_SGDIG_STS) 
BGE_SGDIGSTS_IS_SERDES) ? 8 : 1;
} else {
phy_addr += (CSR_READ_4(sc, BGE_CPMU_PHY_STRAP) 
BGE_CPMU_PHY_STRAP_IS_SERDES) ? 8 : 1;
}
}

The FreeBSD code uses the BGE_SGDIG_STS register when the chip is NOT
a BCM5717_A0, the OpenBSD implementation does the opposite.

I can't tell which is correct. I tested this with a BCM5719 based card
and both path resulted in 1 being added. I have attached a patch below
in case the FreeBSD implementation is the correct one.

Kind regards,

David

--- if_bge.c.orig   2013-04-06 11:09:54.154949994 +0200
+++ if_bge.c2013-04-06 11:19:26.366933077 +0200
@@ -1594,7 +1594,7 @@ bge_phy_addr(struct bge_softc *sc)
case BGE_ASICREV_BCM5719:
case BGE_ASICREV_BCM5720:
phy_addr = pa-pa_function;
-   if (sc-bge_chipid == BGE_CHIPID_BCM5717_A0) {
+   if (sc-bge_chipid != BGE_CHIPID_BCM5717_A0) {
phy_addr += (CSR_READ_4(sc, BGE_SGDIG_STS) 
BGE_SGDIGSTS_IS_SERDES) ? 8 : 1;
} else {



Re: DVI output not detected with kms

2013-04-06 Thread Matthieu Herrb
On Mon, Apr 01, 2013 at 12:24:39PM +0200, Mark Kettenis wrote:
  Date: Mon, 1 Apr 2013 10:09:27 +0200
  From: Matthieu Herrb matthieu.he...@laas.fr
  
  On Sun, Mar 31, 2013 at 11:51:55AM +0200, Mark Kettenis wrote:
Date: Fri, 29 Mar 2013 15:22:57 +0100
   
   Ralf, Matthieu,
   
   Yesterday I committed some changes that fix some issues in the SDVO
   code.  For my setup, whhere HDMI output is provided over SDVO this
   still isn't enough to give me output.  For that I need some further
   changes.  But I'm interested to see if what's now in -current works
   for you.  Could you send me a dmesg from a kernel with DRMDEBUG enabled?
   
  
  Hi Mark,
  
  
  I've tried with intel_svdo.c 1.6 and the bitbang timing patch, my
  system still doesn't work. Below is dmesg with DRMDEBUG defined and
  Xorg.0.log. 
 
 To bad.  Perhaps the timings in the I2C bit-banging code need to be
 adjusted a bit more.  Can you play with that a bit?
 

Hi, yes adjusting timing a bit more makes my machine work. I first
doubled all values like you suggested, then tried to go back to
smaller values.

This seems to be the minimal set of value that makes my machine work:

Index: i2c_bitbang.c
===
RCS file: /cvs/OpenBSD/src/sys/dev/i2c/i2c_bitbang.c,v
retrieving revision 1.3
diff -u -p -u -r1.3 i2c_bitbang.c
--- i2c_bitbang.c   13 Jan 2006 23:56:46 -  1.3
+++ i2c_bitbang.c   6 Apr 2013 14:16:10 -
@@ -62,11 +62,11 @@ i2c_bitbang_send_start(void *v, int flag
BB_DIR(OUTPUT);
 
BB_SET(SDA | SCL);
-   delay(5);   /* bus free time (4.7 uS) */
+   delay(6);   /* bus free time (4.7 uS) */
BB_SET(  SCL);
-   delay(4);   /* start hold time (4.0 uS) */
+   delay(5);   /* start hold time (4.0 uS) */
BB_SET(0);
-   delay(5);   /* clock low time (4.7 uS) */
+   delay(6);   /* clock low time (4.7 uS) */
 
return (0);
 }
@@ -79,7 +79,7 @@ i2c_bitbang_send_stop(void *v, int flags
BB_DIR(OUTPUT);
 
BB_SET(  SCL);
-   delay(4);   /* stop setup time (4.0 uS) */
+   delay(5);   /* stop setup time (4.0 uS) */
BB_SET(SDA | SCL);
 
return (0);
@@ -115,11 +115,11 @@ i2c_bitbang_read_byte(void *v, uint8_t *
for (i = 0; i  8; i++) {
val = 1;
BB_SET(SDA | SCL);
-   delay(4);   /* clock high time (4.0 uS) */
+   delay(5);   /* clock high time (4.0 uS) */
if (BB_READ  SDA)
val |= 1;
BB_SET(SDA  );
-   delay(5);   /* clock low time (4.7 uS) */
+   delay(6);   /* clock low time (4.7 uS) */
}
 
bit = (flags  I2C_F_LAST) ? SDA : 0;
@@ -127,13 +127,13 @@ i2c_bitbang_read_byte(void *v, uint8_t *
BB_SET(bit  );
delay(1);   /* data setup time (250 nS) */
BB_SET(bit | SCL);
-   delay(4);   /* clock high time (4.0 uS) */
+   delay(5);   /* clock high time (4.0 uS) */
BB_SET(bit  );
-   delay(5);   /* clock low time (4.7 uS) */
+   delay(6);   /* clock low time (4.7 uS) */
 
BB_DIR(INPUT);
BB_SET(SDA  );
-   delay(5);
+   delay(6);
 
if ((flags  (I2C_F_STOP | I2C_F_LAST)) == (I2C_F_STOP | I2C_F_LAST))
(void) i2c_bitbang_send_stop(v, flags, ops);
@@ -157,20 +157,20 @@ i2c_bitbang_write_byte(void *v, uint8_t 
BB_SET(bit  );
delay(1);   /* data setup time (250 nS) */
BB_SET(bit | SCL);
-   delay(4);   /* clock high time (4.0 uS) */
+   delay(6);   /* clock high time (4.0 uS) */
BB_SET(bit  );
-   delay(5);   /* clock low time (4.7 uS) */
+   delay(8);   /* clock low time (4.7 uS) */
}
 
BB_DIR(INPUT);
 
BB_SET(SDA  );
-   delay(5);
+   delay(6);
BB_SET(SDA | SCL);
-   delay(4);
+   delay(5);
error = (BB_READ  SDA) ? EIO : 0;
BB_SET(SDA  );
-   delay(5);
+   delay(6);
 
if (flags  I2C_F_STOP)
(void) i2c_bitbang_send_stop(v, flags, ops);

-- 
Matthieu Herrb



Re: bge NOT work on Dell R720

2013-04-06 Thread David Gwynne
i'll try to chase this down, but its hard going by the freebsd bug report cos 
its lots of vague times and no references to specific revisions of their driver.

i have r420s and r520s with 5720s in them which work fine. i do have a r720 i 
can try, but its hard to pull out of production for this kind of testing.

i'll try to get to this soon.

cheers,
dlg

On 05/04/2013, at 10:04 PM, Robert Young yay...@gmail.com wrote:

 Dell PowerEdge R720
 Broadcom Gigabit Ethernet BCM5720
 
 Tested kernel:
 http://ftp.openbsd.org/pub/OpenBSD/snapshots/amd64/bsd.rd
 http://ftp.openbsd.org/pub/OpenBSD/snapshots/amd64/bsd.mp
 
 dmesg:
 OpenBSD 5.3-current (RAMDISK_CD) #96: Wed Apr 3 02:19:34 MDT 2013
 bge2 at pci2 dev 0 function 0 Broadcom BCM5720 rev 0x00, BCM5720 A0
 (0x572), APE firmware NCSI 1.1.7.0: apic 1 int 3, address
 90:b1:1c:3a:a8:19
 brgphy2 at bge2 phy 1: BCM5720C 10/100/1000baseT PHY, rev. 0
 
 It's OK 156 .
 ping -s 156 10.2.1.29
 164 bytes from ...
 
 NO reply =157,(not resetted,can return to normal with small packet test)
 ping -s 157 10.2.1.29
 ... 0 packets received
 
 Even larger packet, NIC resetted(wait ... return to normal after reseted)
 ping -s 275 10.2.1.29
 bge2: watchdog timeout -- resetting
 
 
 FreeBSD have encountered same issue,I tested, same issue found in:
 http://ftp.freebsd.org/pub/FreeBSD/ISO-IMAGES-amd64/9.1/FreeBSD-9.1-RELEASE-amd64-dvd1.iso
 
 This problem was fixed by FreeBSD team:
 http://www.freebsd.org/cgi/query-pr.cgi?pr=171121
 
 I tested, This version have fixed this problem:
 http://ftp.freebsd.org/pub/FreeBSD/snapshots/amd64/amd64/ISO-IMAGES/10.0/FreeBSD-10.0-CURRENT-amd64-20130323-r248655-release.iso