2011-06-24 15:08:10

by Paul Parsons

[permalink] [raw]
Subject: w1/ds1wm regression after 2.6.39: "bus error, retrying"

The linux-3.0-rc4 DS1WM 1-wire driver is logging "bus error, retrying" error messages on an HP iPAQ hx4700 PDA (XScale-PXA270):

<snip>
Driver for 1-wire Dallas network protocol.
DS1WM w1 busmaster driver - (c) 2004 Szabolcs Gyurko
1-Wire driver for the DS2760 battery monitor chip - (c) 2004-2005, Szabolcs Gyurko
ds1wm ds1wm: pass: 1 bus error, retrying
ds1wm ds1wm: pass: 2 bus error, retrying
ds1wm ds1wm: pass: 3 bus error, retrying
ds1wm ds1wm: pass: 4 bus error, retrying
ds1wm ds1wm: pass: 5 bus error, retrying
ds1wm ds1wm: pass: 6 bus error, retrying
ds1wm ds1wm: pass: 7 bus error, retrying
ds1wm ds1wm: pass: 8 bus error, retrying
ds1wm ds1wm: pass: 9 bus error, retrying
ds1wm ds1wm: pass: 10 bus error, retrying
ds1wm ds1wm: pass: 11 bus error, retrying
ds1wm ds1wm: pass: 12 bus error, retrying
ds1wm ds1wm: pass: 13 bus error, retrying
ds1wm ds1wm: pass: 14 bus error, retrying
ds1wm ds1wm: pass: 15 bus error, retrying
ds1wm ds1wm: pass: 16 bus error, retrying
ds1wm ds1wm: pass: 17 bus error, retrying
ds1wm ds1wm: pass: 18 bus error, retrying
ds1wm ds1wm: pass: 19 bus error, retrying
ds1wm ds1wm: pass: 20 bus error, retrying
ds1wm ds1wm: pass: 21 bus error, retrying
ds1wm ds1wm: pass: 22 bus error, retrying
ds1wm ds1wm: pass: 23 bus error, retrying
ds1wm ds1wm: pass: 24 bus error, retrying
ds1wm ds1wm: pass: 25 bus error, retrying
ds1wm ds1wm: pass: 26 bus error, retrying
ds1wm ds1wm: pass: 27 bus error, retrying
ds1wm ds1wm: pass: 28 bus error, retrying
ds1wm ds1wm: pass: 29 bus error, retrying
ds1wm ds1wm: pass: 30 bus error, retrying
ds1wm ds1wm: pass: 31 bus error, retrying
ds1wm ds1wm: pass: 32 bus error, retrying
ds1wm ds1wm: pass: 33 bus error, retrying
pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0
pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 124)
scsi0 : pata_pcmcia
ata1: PATA max PIO0 cmd 0xc4820000 ctl 0xc482000e irq 124
ds1wm ds1wm: pass: 34 bus error, retrying
ds1wm ds1wm: pass: 35 bus error, retrying
ds1wm ds1wm: pass: 36 bus error, retrying
ds1wm ds1wm: pass: 37 bus error, retrying
ds1wm ds1wm: pass: 38 bus error, retrying
ds1wm ds1wm: pass: 39 bus error, retrying
ds1wm ds1wm: pass: 40 bus error, retrying
ds1wm ds1wm: pass: 41 bus error, retrying
ds1wm ds1wm: pass: 42 bus error, retrying
ds1wm ds1wm: pass: 43 bus error, retrying
ds1wm ds1wm: pass: 44 bus error, retrying
ata1.00: CFA: CF Card, Ver1.27, max PIO4
ata1.00: 2014992 sectors, multi 0: LBA
ds1wm ds1wm: pass: 45 bus error, retrying
ds1wm ds1wm: pass: 46 bus error, retrying
ata1.00: configured for PIO0
scsi 0:0:0:0: Direct-Access ATA CF Card Ver1 PQ: 0 ANSI: 5
sd 0:0:0:0: [sda] 2014992 512-byte logical blocks: (1.03 GB/983 MiB)
sd 0:0:0:0: [sda] Write Protect is off
sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
sda: sda1
sd 0:0:0:0: [sda] Attached SCSI removable disk
ds1wm ds1wm: pass: 47 bus error, retrying
APM Battery Driver
mmc0 at 0xc48d2800 irq 130
Registered led device: hx4700:amber
Registered led device: hx4700:green
Registered led device: hx4700:blue
TCP cubic registered
NET: Registered protocol family 17
XScale iWMMXt coprocessor detected.
pxa-rtc pxa-rtc: setting system clock to 2000-01-01 00:00:07 UTC (946684807)
Warning: unable to open an initial console.
VFS: Mounted root (jffs2 filesystem) readonly on device 31:2.
Freeing init memory: 104K
mmc0: new SD card at address 1234
mmcblk0: mmc0:1234 SD01G 972 MiB
mmcblk0: p1
udevd (337): /proc/337/oom_adj is deprecated, please use /proc/337/oom_score_adj instead.
g_serial gadget: Gadget Serial v2.4
g_serial gadget: g_serial ready
pxa27x-udc pxa27x-udc: USB reset
pxa27x-udc pxa27x-udc: USB reset
pxa27x-udc pxa27x-udc: USB reset
g_serial gadget: full speed config #1: Generic Serial config
ds1wm ds1wm: pass: 1 bus error, retrying
ds1wm ds1wm: pass: 2 bus error, retrying
ds1wm ds1wm: pass: 3 bus error, retrying
<snip>
ds1wm ds1wm: pass: 91 bus error, retrying
ds1wm ds1wm: pass: 92 bus error, retrying
ds1wm ds1wm: pass: 93 bus error, retrying
ds1wm ds1wm: pass: 1 bus error, retrying
ds1wm ds1wm: pass: 2 bus error, retrying
ds1wm ds1wm: pass: 3 bus error, retrying
<snip>
ds1wm ds1wm: pass: 29 bus error, retrying
ds1wm ds1wm: pass: 30 bus error, retrying
ds1wm ds1wm: pass: 31 bus error, retrying
ds1wm ds1wm: pass: 1 bus error, retrying
ds1wm ds1wm: pass: 2 bus error, retrying
ds1wm ds1wm: pass: 3 bus error, retrying
<snip>
ds1wm ds1wm: pass: 98 bus error, retrying
ds1wm ds1wm: pass: 99 bus error, retrying
ds1wm ds1wm: pass: 100 bus error, retrying
ds1wm ds1wm: pass: 1 bus error, retrying
ds1wm ds1wm: pass: 2 bus error, retrying
ds1wm ds1wm: pass: 3 bus error, retrying
<snip>
ds1wm ds1wm: pass: 92 bus error, retrying
ds1wm ds1wm: pass: 93 bus error, retrying
ds1wm ds1wm: pass: 94 bus error, retrying
ds1wm ds1wm: pass: 1 bus error, retrying
ds1wm ds1wm: pass: 2 bus error, retrying
ds1wm ds1wm: pass: 3 bus error, retrying
<snip>
ds1wm ds1wm: pass: 98 bus error, retrying
ds1wm ds1wm: pass: 99 bus error, retrying
ds1wm ds1wm: pass: 100 bus error, retrying
<snip>

The visible result is that the battery charging LED is erratic; sometimes it works, mostly it doesn't.

The linux-2.6.39 DS1WM 1-wire driver worked OK. I haven't tried 3.0-rc1, 3.0-rc2, or 3.0-rc3.

Regards.


2011-06-24 16:59:20

by Jean-Francois Dagenais

[permalink] [raw]
Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"

Hi Paul,

Sorry to hear that. 2.6.39's ds1wm driver did not support dynamically finding the slaves on the bus, it would limit it's search to 1 and exit. My modifications implement the hardware assisted search as documented by the ds1wm spec sheet.

There are a couple of ways you can workaround the problem (temporarily or permanently). You might disable the bus scanning altogether (like I explain below) and insert your slave manually (as documented in the kernel w1 docs). If only one slave is present, the bus master will usually just skip the ROM matching part of the communication by doing a "SKIP ROM" which essentially says to the slave "whoever you are, I am talking to you". You could also patch the ds1wm_search function to make it look like it was in 2.6.39, or just use the whole file if it worked fine for you.

Now, to find the real problem, could you try the following:
- to limit trace noise, disable the w1 auto probe by setting the search count to 0, either in "wire" module load ("search_count=0" in /etc/modprobe.conf or the like) or int /sys under your w1 master instance
- build the ds1wm with "#define DEBUG" at the top (before headers), this will prints lots of debug about the accelerated search algorithm progress. (you could also set the retry count to something less than 100 to also limit noise in the trace)
- once booted, trigger one search manually by writing 1 in /sys/bus/w1/devices/w1\ bus\ master/w1_master_search
dmesg will contain a nice trace (although big)

Do you have more than one slave device on the ds1wm bus?

I will try to help as much as I can.
/jfd
On Jun 24, 2011, at 11:08, Paul Parsons wrote:

> The linux-3.0-rc4 DS1WM 1-wire driver is logging "bus error, retrying" error messages on an HP iPAQ hx4700 PDA (XScale-PXA270):
>
> <snip>
> Driver for 1-wire Dallas network protocol.
> DS1WM w1 busmaster driver - (c) 2004 Szabolcs Gyurko
> 1-Wire driver for the DS2760 battery monitor chip - (c) 2004-2005, Szabolcs Gyurko
> ds1wm ds1wm: pass: 1 bus error, retrying
> ds1wm ds1wm: pass: 2 bus error, retrying
> ds1wm ds1wm: pass: 3 bus error, retrying
> ds1wm ds1wm: pass: 4 bus error, retrying
> ds1wm ds1wm: pass: 5 bus error, retrying
> ds1wm ds1wm: pass: 6 bus error, retrying
> ds1wm ds1wm: pass: 7 bus error, retrying
> ds1wm ds1wm: pass: 8 bus error, retrying
> ds1wm ds1wm: pass: 9 bus error, retrying
> ds1wm ds1wm: pass: 10 bus error, retrying
> ds1wm ds1wm: pass: 11 bus error, retrying
> ds1wm ds1wm: pass: 12 bus error, retrying
> ds1wm ds1wm: pass: 13 bus error, retrying
> ds1wm ds1wm: pass: 14 bus error, retrying
> ds1wm ds1wm: pass: 15 bus error, retrying
> ds1wm ds1wm: pass: 16 bus error, retrying
> ds1wm ds1wm: pass: 17 bus error, retrying
> ds1wm ds1wm: pass: 18 bus error, retrying
> ds1wm ds1wm: pass: 19 bus error, retrying
> ds1wm ds1wm: pass: 20 bus error, retrying
> ds1wm ds1wm: pass: 21 bus error, retrying
> ds1wm ds1wm: pass: 22 bus error, retrying
> ds1wm ds1wm: pass: 23 bus error, retrying
> ds1wm ds1wm: pass: 24 bus error, retrying
> ds1wm ds1wm: pass: 25 bus error, retrying
> ds1wm ds1wm: pass: 26 bus error, retrying
> ds1wm ds1wm: pass: 27 bus error, retrying
> ds1wm ds1wm: pass: 28 bus error, retrying
> ds1wm ds1wm: pass: 29 bus error, retrying
> ds1wm ds1wm: pass: 30 bus error, retrying
> ds1wm ds1wm: pass: 31 bus error, retrying
> ds1wm ds1wm: pass: 32 bus error, retrying
> ds1wm ds1wm: pass: 33 bus error, retrying
> pcmcia_socket pcmcia_socket0: pccard: PCMCIA card inserted into slot 0
> pcmcia 0.0: pcmcia: registering new device pcmcia0.0 (IRQ: 124)
> scsi0 : pata_pcmcia
> ata1: PATA max PIO0 cmd 0xc4820000 ctl 0xc482000e irq 124
> ds1wm ds1wm: pass: 34 bus error, retrying
> ds1wm ds1wm: pass: 35 bus error, retrying
> ds1wm ds1wm: pass: 36 bus error, retrying
> ds1wm ds1wm: pass: 37 bus error, retrying
> ds1wm ds1wm: pass: 38 bus error, retrying
> ds1wm ds1wm: pass: 39 bus error, retrying
> ds1wm ds1wm: pass: 40 bus error, retrying
> ds1wm ds1wm: pass: 41 bus error, retrying
> ds1wm ds1wm: pass: 42 bus error, retrying
> ds1wm ds1wm: pass: 43 bus error, retrying
> ds1wm ds1wm: pass: 44 bus error, retrying
> ata1.00: CFA: CF Card, Ver1.27, max PIO4
> ata1.00: 2014992 sectors, multi 0: LBA
> ds1wm ds1wm: pass: 45 bus error, retrying
> ds1wm ds1wm: pass: 46 bus error, retrying
> ata1.00: configured for PIO0
> scsi 0:0:0:0: Direct-Access ATA CF Card Ver1 PQ: 0 ANSI: 5
> sd 0:0:0:0: [sda] 2014992 512-byte logical blocks: (1.03 GB/983 MiB)
> sd 0:0:0:0: [sda] Write Protect is off
> sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
> sd 0:0:0:0: [sda] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
> sda: sda1
> sd 0:0:0:0: [sda] Attached SCSI removable disk
> ds1wm ds1wm: pass: 47 bus error, retrying
> APM Battery Driver
> mmc0 at 0xc48d2800 irq 130
> Registered led device: hx4700:amber
> Registered led device: hx4700:green
> Registered led device: hx4700:blue
> TCP cubic registered
> NET: Registered protocol family 17
> XScale iWMMXt coprocessor detected.
> pxa-rtc pxa-rtc: setting system clock to 2000-01-01 00:00:07 UTC (946684807)
> Warning: unable to open an initial console.
> VFS: Mounted root (jffs2 filesystem) readonly on device 31:2.
> Freeing init memory: 104K
> mmc0: new SD card at address 1234
> mmcblk0: mmc0:1234 SD01G 972 MiB
> mmcblk0: p1
> udevd (337): /proc/337/oom_adj is deprecated, please use /proc/337/oom_score_adj instead.
> g_serial gadget: Gadget Serial v2.4
> g_serial gadget: g_serial ready
> pxa27x-udc pxa27x-udc: USB reset
> pxa27x-udc pxa27x-udc: USB reset
> pxa27x-udc pxa27x-udc: USB reset
> g_serial gadget: full speed config #1: Generic Serial config
> ds1wm ds1wm: pass: 1 bus error, retrying
> ds1wm ds1wm: pass: 2 bus error, retrying
> ds1wm ds1wm: pass: 3 bus error, retrying
> <snip>
> ds1wm ds1wm: pass: 91 bus error, retrying
> ds1wm ds1wm: pass: 92 bus error, retrying
> ds1wm ds1wm: pass: 93 bus error, retrying
> ds1wm ds1wm: pass: 1 bus error, retrying
> ds1wm ds1wm: pass: 2 bus error, retrying
> ds1wm ds1wm: pass: 3 bus error, retrying
> <snip>
> ds1wm ds1wm: pass: 29 bus error, retrying
> ds1wm ds1wm: pass: 30 bus error, retrying
> ds1wm ds1wm: pass: 31 bus error, retrying
> ds1wm ds1wm: pass: 1 bus error, retrying
> ds1wm ds1wm: pass: 2 bus error, retrying
> ds1wm ds1wm: pass: 3 bus error, retrying
> <snip>
> ds1wm ds1wm: pass: 98 bus error, retrying
> ds1wm ds1wm: pass: 99 bus error, retrying
> ds1wm ds1wm: pass: 100 bus error, retrying
> ds1wm ds1wm: pass: 1 bus error, retrying
> ds1wm ds1wm: pass: 2 bus error, retrying
> ds1wm ds1wm: pass: 3 bus error, retrying
> <snip>
> ds1wm ds1wm: pass: 92 bus error, retrying
> ds1wm ds1wm: pass: 93 bus error, retrying
> ds1wm ds1wm: pass: 94 bus error, retrying
> ds1wm ds1wm: pass: 1 bus error, retrying
> ds1wm ds1wm: pass: 2 bus error, retrying
> ds1wm ds1wm: pass: 3 bus error, retrying
> <snip>
> ds1wm ds1wm: pass: 98 bus error, retrying
> ds1wm ds1wm: pass: 99 bus error, retrying
> ds1wm ds1wm: pass: 100 bus error, retrying
> <snip>
>
> The visible result is that the battery charging LED is erratic; sometimes it works, mostly it doesn't.
>
> The linux-2.6.39 DS1WM 1-wire driver worked OK. I haven't tried 3.0-rc1, 3.0-rc2, or 3.0-rc3.
>
> Regards.

Jean-Francois Dagenais
Software Architect - B.Sc.A


Experience the new veo phased array flaw detector at http://www.sonatestveo.com.


Sonatest AP
2900 chemin des Quatre-Bourgeois
Bureau 305
Quebec City Quebec G1V 1Y4

T| +1 (418) 683 6222 x106 F| +1 (418) 683 7032 M| W| http://www.sonatest.com



This message (and any associated files) is intended only for the use of [email protected], [email protected], [email protected] and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the above recipient(s) you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

Think green - help the environment by not printing this email.

2011-06-24 19:07:45

by Paul Parsons

[permalink] [raw]
Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"

Hi Jean-Francois,

I think I've found the problem.

On a hunch I restored the msleep() call that had been removed from ds1wm_reset() after 2.6.39:

--- clean-3.0-rc4/drivers/w1/masters/ds1wm.c 2011-06-21 04:25:46.000000000 +0100
+++ linux-3.0-rc4/drivers/w1/masters/ds1wm.c 2011-06-24 19:58:03.340701823 +0100
@@ -182,6 +182,8 @@ static int ds1wm_reset(struct ds1wm_data
return 1;
}

+ msleep(1);
+
if (!ds1wm_data->slave_present) {
dev_dbg(&ds1wm_data->pdev->dev, "reset: no devices found\n");
return 1;

This has completely eliminated the "bus error, retrying" error messages, and the hx4700 seems to be functioning normally again.

Regards,
Paul

--- On Fri, 24/6/11, Jean-Fran?ois Dagenais <[email protected]> wrote:

> From: Jean-Fran?ois Dagenais <[email protected]>
> Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"
> To: "Paul Parsons" <[email protected]>
> Cc: [email protected], [email protected]
> Date: Friday, 24 June, 2011, 17:15
> Hi Paul,
>
> Sorry to hear that. 2.6.39's ds1wm driver did not support
> dynamically finding the slaves on the bus, it would limit
> it's search to 1 and exit. My modifications implement the
> hardware assisted search as documented by the ds1wm spec
> sheet.
>
> There are a couple of ways you can workaround the problem
> (temporarily or permanently). You might disable the bus
> scanning altogether (like I explain below) and insert your
> slave manually (as documented in the kernel w1 docs). If
> only one slave is present, the bus master will usually just
> skip the ROM matching part of the communication by doing a
> "SKIP ROM" which essentially says to the slave "whoever you
> are, I am talking to you". You could also patch the
> ds1wm_search function to make it look like it was in 2.6.39,
> or just use the whole file if it worked fine for you.
>
> Now, to find the real problem, could you try the
> following:
> - to limit trace noise, disable the w1 auto probe by
> setting the search count to 0, either in "wire" module load
> ("search_count=0" in /etc/modprobe.conf or the like) or int
> /sys under your w1 master instance
> - build the ds1wm with "#define DEBUG" at the top (before
> headers), this will prints lots of debug about the
> accelerated search algorithm progress. (you could also set
> the retry count to something less than 100 to also limit
> noise in the trace)
> - once booted, trigger one search manually by writing 1 in
> /sys/bus/w1/devices/w1\ bus\ master/w1_master_search
> dmesg will contain a nice trace (although big)
>
> Do you have more than one slave device on the ds1wm bus?
>
> I will try to help as much as I can.
> /jfd

2011-06-24 19:59:40

by Jean-Francois Dagenais

[permalink] [raw]
Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"

On Jun 24, 2011, at 15:07, Paul Parsons wrote:

> Hi Jean-Francois,
>
> I think I've found the problem.
>
> On a hunch I restored the msleep() call that had been removed from ds1wm_reset() after 2.6.39:
>
> --- clean-3.0-rc4/drivers/w1/masters/ds1wm.c 2011-06-21 04:25:46.000000000 +0100
> +++ linux-3.0-rc4/drivers/w1/masters/ds1wm.c 2011-06-24 19:58:03.340701823 +0100
> @@ -182,6 +182,8 @@ static int ds1wm_reset(struct ds1wm_data
> return 1;
> }
>
> + msleep(1);
> +
> if (!ds1wm_data->slave_present) {
> dev_dbg(&ds1wm_data->pdev->dev, "reset: no devices found\n");
> return 1;
>
> This has completely eliminated the "bus error, retrying" error messages, and the hx4700 seems to be functioning normally again.
The sleep I removed there only delays the time between the reset pulse and the function exiting, it doesn't populate the "slave_present" variable with a different value. The reset pulse and the wait that the ds1wm implements (by raising an interrupt at the end of it all) is spec'ed on the 1-wire specification, and the DS1WM_TIMEOUT is a really long time. So there should be plenty of time for the slaves to acknowledge the reset and participate in further communications.

So here's my hunch. We observed this here on our circuit too. It is possible that the pull-up resistor on your circuit is too resistive which would make the slave device fail to properly come back to life after the reset pulse (bus shorted to the ground) when the drain opens, and hence not able to cope well with the search that follows. The 1ms wait basically gives the slave(s) time to charge up again (with the drain open, the voltage is high).

The weird thing is that the ds1wm_reset function returns 0, since the while loop executes more than once, so it did find a slave (slave_present obtained from the PDR status bit), so the slave is kinda there... But the search fails somehow after that. Maybe there is something in your slave's spec sheet that could help, although the ds1wm reset timings. So I still think the debug trace and knowing if you have only one slave on the bus would help me figure this out. New question: what slave(s)? is it the DS2760?

PS: there are also controls in the DS1WM_CNTRL register that has to do with strong-pull-ups which are just not used by the driver yet. refer to: http://datasheets.maxim-ic.com/en/ds/DS1WM.pdf

>
> Regards,
> Paul
>
> --- On Fri, 24/6/11, Jean-Fran?ois Dagenais <[email protected]> wrote:
>
>> From: Jean-Fran?ois Dagenais <[email protected]>
>> Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"
>> To: "Paul Parsons" <[email protected]>
>> Cc: [email protected], [email protected]
>> Date: Friday, 24 June, 2011, 17:15
>> Hi Paul,
>>
>> Sorry to hear that. 2.6.39's ds1wm driver did not support
>> dynamically finding the slaves on the bus, it would limit
>> it's search to 1 and exit. My modifications implement the
>> hardware assisted search as documented by the ds1wm spec
>> sheet.
>>
>> There are a couple of ways you can workaround the problem
>> (temporarily or permanently). You might disable the bus
>> scanning altogether (like I explain below) and insert your
>> slave manually (as documented in the kernel w1 docs). If
>> only one slave is present, the bus master will usually just
>> skip the ROM matching part of the communication by doing a
>> "SKIP ROM" which essentially says to the slave "whoever you
>> are, I am talking to you". You could also patch the
>> ds1wm_search function to make it look like it was in 2.6.39,
>> or just use the whole file if it worked fine for you.
>>
>> Now, to find the real problem, could you try the
>> following:
>> - to limit trace noise, disable the w1 auto probe by
>> setting the search count to 0, either in "wire" module load
>> ("search_count=0" in /etc/modprobe.conf or the like) or int
>> /sys under your w1 master instance
>> - build the ds1wm with "#define DEBUG" at the top (before
>> headers), this will prints lots of debug about the
>> accelerated search algorithm progress. (you could also set
>> the retry count to something less than 100 to also limit
>> noise in the trace)
>> - once booted, trigger one search manually by writing 1 in
>> /sys/bus/w1/devices/w1\ bus\ master/w1_master_search
>> dmesg will contain a nice trace (although big)
>>
>> Do you have more than one slave device on the ds1wm bus?
>>
>> I will try to help as much as I can.
>> /jfd
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

Jean-Francois Dagenais
Software Architect - B.Sc.A


Experience the new veo phased array flaw detector at http://www.sonatestveo.com.


Sonatest AP
2900 chemin des Quatre-Bourgeois
Bureau 305
Quebec City Quebec G1V 1Y4

T| +1 (418) 683 6222 x106 F| +1 (418) 683 7032 M| W| http://www.sonatest.com



This message (and any associated files) is intended only for the use of [email protected], [email protected], [email protected] and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the above recipient(s) you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

Think green - help the environment by not printing this email.

2011-06-24 21:32:07

by Paul Parsons

[permalink] [raw]
Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"

Here's the debug output from ds1wm_search():

ds1wm ds1wm: search begin
ds1wm ds1wm: pass: 1 r : 0x0000000000000000 writing SEARCH_ROM
ds1wm ds1wm: pass: 1 entering ASM
ds1wm ds1wm: pass: 1 begining nibble loop
ds1wm ds1wm: pass: 1 r': 0xd300001085da8430 d:0x0000000000000000
ds1wm ds1wm: pass: 1 nibble loop complete, exiting ASM
ds1wm ds1wm: pass: 1 resetting bus
ds1wm ds1wm: pass: 1 found 0xd300001085da8430
ds1wm ds1wm: pass: 1 complete, preparing next pass
ds1wm ds1wm: pass: 1 new d:0x0000000000000000 MS discrep bit:-1
ds1wm ds1wm: pass: 1 total: 1 search done ms d bit pos: -1

The hx4700 does indeed have a ds2760 connected to the ds1wm. I believe the ds1wm is integrated into the HTC ASIC3, but my knowledge of the hardware is almost zero.

Regards,
Paul

--- On Fri, 24/6/11, Jean-Fran?ois Dagenais <[email protected]> wrote:
> The sleep I removed there only delays the time between the
> reset pulse and the function exiting, it doesn't populate
> the "slave_present" variable with a different value. The
> reset pulse and the wait that the ds1wm implements (by
> raising an interrupt at the end of it all) is spec'ed on the
> 1-wire specification, and the DS1WM_TIMEOUT is a really long
> time. So there should be plenty of time for the slaves to
> acknowledge the reset and participate in further
> communications.
>
> So here's my hunch. We observed this here on our circuit
> too. It is possible that the pull-up resistor on your
> circuit is too resistive which would make the slave device
> fail to properly come back to life after the reset pulse
> (bus shorted to the ground) when the drain opens, and hence
> not able to cope well with the search that follows. The 1ms
> wait basically gives the slave(s) time to charge up again
> (with the drain open, the voltage is high).
>
> The weird thing is that the ds1wm_reset function returns 0,
> since the while loop executes more than once, so it did find
> a slave (slave_present obtained from the PDR status bit), so
> the slave is kinda there... But the search fails somehow
> after that. Maybe there is something in your slave's spec
> sheet that could help, although the ds1wm reset timings. So
> I still think the debug trace and knowing if you have only
> one slave on the bus would help me figure this out. New
> question: what slave(s)? is it the DS2760?
>
> PS: there are also controls in the DS1WM_CNTRL register
> that has to do with strong-pull-ups which are just not used
> by the driver yet. refer to: http://datasheets.maxim-ic.com/en/ds/DS1WM.pdf

2011-06-25 12:54:09

by Jean-Francois Dagenais

[permalink] [raw]
Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"

On 2011-06-24, at 17:32, Paul Parsons wrote:

> Here's the debug output from ds1wm_search():
>
> ds1wm ds1wm: search begin
> ds1wm ds1wm: pass: 1 r : 0x0000000000000000 writing SEARCH_ROM
> ds1wm ds1wm: pass: 1 entering ASM
> ds1wm ds1wm: pass: 1 begining nibble loop
> ds1wm ds1wm: pass: 1 r': 0xd300001085da8430 d:0x0000000000000000
> ds1wm ds1wm: pass: 1 nibble loop complete, exiting ASM
> ds1wm ds1wm: pass: 1 resetting bus
> ds1wm ds1wm: pass: 1 found 0xd300001085da8430
> ds1wm ds1wm: pass: 1 complete, preparing next pass
> ds1wm ds1wm: pass: 1 new d:0x0000000000000000 MS discrep bit:-1
> ds1wm ds1wm: pass: 1 total: 1 search done ms d bit pos: -1
>
> The hx4700 does indeed have a ds2760 connected to the ds1wm. I believe the ds1wm is integrated into the HTC ASIC3, but my knowledge of the hardware is almost zero.
>
> Regards,
> Paul
Hi again Paul,

This seems to be the output after you have restored the msleep. Could you provide it without so we can get a better idea as to what happened. If indeed this is a major regression for many devices, we'll have to submit a patch to the main branch.
/jfd
>
> --- On Fri, 24/6/11, Jean-Fran?ois Dagenais <[email protected]> wrote:
>> The sleep I removed there only delays the time between the
>> reset pulse and the function exiting, it doesn't populate
>> the "slave_present" variable with a different value. The
>> reset pulse and the wait that the ds1wm implements (by
>> raising an interrupt at the end of it all) is spec'ed on the
>> 1-wire specification, and the DS1WM_TIMEOUT is a really long
>> time. So there should be plenty of time for the slaves to
>> acknowledge the reset and participate in further
>> communications.
>>
>> So here's my hunch. We observed this here on our circuit
>> too. It is possible that the pull-up resistor on your
>> circuit is too resistive which would make the slave device
>> fail to properly come back to life after the reset pulse
>> (bus shorted to the ground) when the drain opens, and hence
>> not able to cope well with the search that follows. The 1ms
>> wait basically gives the slave(s) time to charge up again
>> (with the drain open, the voltage is high).
>>
>> The weird thing is that the ds1wm_reset function returns 0,
>> since the while loop executes more than once, so it did find
>> a slave (slave_present obtained from the PDR status bit), so
>> the slave is kinda there... But the search fails somehow
>> after that. Maybe there is something in your slave's spec
>> sheet that could help, although the ds1wm reset timings. So
>> I still think the debug trace and knowing if you have only
>> one slave on the bus would help me figure this out. New
>> question: what slave(s)? is it the DS2760?
>>
>> PS: there are also controls in the DS1WM_CNTRL register
>> that has to do with strong-pull-ups which are just not used
>> by the driver yet. refer to: http://datasheets.maxim-ic.com/en/ds/DS1WM.pdf
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/

Jean-Francois Dagenais
Software Architect - B.Sc.A


Experience the new veo phased array flaw detector at http://www.sonatestveo.com.


Sonatest AP
2900 chemin des Quatre-Bourgeois
Bureau 305
Quebec City Quebec G1V 1Y4

T| +1 (418) 683 6222 x106 F| +1 (418) 683 7032 M| W| http://www.sonatest.com



This message (and any associated files) is intended only for the use of [email protected], [email protected], [email protected] and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the above recipient(s) you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

Think green - help the environment by not printing this email.

2011-06-26 00:58:06

by Paul Parsons

[permalink] [raw]
Subject: Re: w1/ds1wm regression after 2.6.39: "bus error, retrying"

Oops, yes the msleep() had been left in. I've attached debug output from the original ds1wm.c. Not sure how the mailing list copes with bzip2 compressed attachments; hopefully it will work.

Regards,
Paul

--- On Sat, 25/6/11, Jean-Fran?ois Dagenais <[email protected]> wrote:
> This seems to be the output after you have restored the
> msleep. Could you provide it without so we can get a better
> idea as to what happened. If indeed this is a major
> regression for many devices, we'll have to submit a patch to
> the main branch.
> /jfd


Attachments:
dmesg.bz2 (6.82 kB)

2011-06-27 13:19:28

by Jean-Francois Dagenais

[permalink] [raw]
Subject: [PATCH] w1: ds1wm: add a reset recovery parameter

This follows the regression on 3.0 reported by Paul Parsons regarding
the removal of the msleep(1) in the ds1wm_reset() function. This
sleep should not be required on normal circuitry provided the
pull-ups on the bus are correctly adapted to the slaves.
Unfortunately, this is not always the case. The sleep is restored
but as a parameter to the probe function in the pdata.
---
drivers/mfd/asic3.c | 1 +
drivers/mfd/htc-pasic3.c | 1 +
drivers/w1/masters/ds1wm.c | 5 +++++
include/linux/mfd/ds1wm.h | 7 +++++++
4 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index c27fd1f..c71ae09 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -619,6 +619,7 @@ static void asic3_clk_disable(struct asic3 *asic, struct asic3_clk *clk)
/* MFD cells (SPI, PWM, LED, DS1WM, MMC) */
static struct ds1wm_driver_data ds1wm_pdata = {
.active_high = 1,
+ .reset_recover_delay = 1,
};

static struct resource ds1wm_resources[] = {
diff --git a/drivers/mfd/htc-pasic3.c b/drivers/mfd/htc-pasic3.c
index 2808bd1..04c7093 100644
--- a/drivers/mfd/htc-pasic3.c
+++ b/drivers/mfd/htc-pasic3.c
@@ -99,6 +99,7 @@ static int ds1wm_disable(struct platform_device *pdev)

static struct ds1wm_driver_data ds1wm_pdata = {
.active_high = 0,
+ .reset_recover_delay = 1,
};

static struct resource ds1wm_resources[] __initdata = {
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index ad57593..66bf82f 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -109,6 +109,7 @@ struct ds1wm_data {
/* byte to write that makes all intr disabled, */
/* considering active_state (IAS) (optimization) */
u8 int_en_reg_none;
+ unsigned int reset_recover_delay; /* see ds1wm.h */
};

static inline void ds1wm_write_register(struct ds1wm_data *ds1wm_data, u32 reg,
@@ -187,6 +188,9 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
return 1;
}

+ if(ds1wm_data->reset_recover_delay)
+ msleep(ds1wm_data->reset_recover_delay);
+
return 0;
}

@@ -490,6 +494,7 @@ static int ds1wm_probe(struct platform_device *pdev)
}
ds1wm_data->irq = res->start;
ds1wm_data->int_en_reg_none = (plat->active_high ? DS1WM_INTEN_IAS : 0);
+ ds1wm_data->reset_recover_delay = plat->reset_recover_delay;

if (res->flags & IORESOURCE_IRQ_HIGHEDGE)
irq_set_irq_type(ds1wm_data->irq, IRQ_TYPE_EDGE_RISING);
diff --git a/include/linux/mfd/ds1wm.h b/include/linux/mfd/ds1wm.h
index be469a3..068044f 100644
--- a/include/linux/mfd/ds1wm.h
+++ b/include/linux/mfd/ds1wm.h
@@ -3,4 +3,11 @@
struct ds1wm_driver_data {
int active_high;
int clock_rate;
+ /* in milliseconds, the amount of time to */
+ /* sleep following a reset pulse. Zero */
+ /* should work if your bus devices recover*/
+ /* time respects the 1-wire spec since the*/
+ /* ds1wm implements the precise timings of*/
+ /* a reset pulse/presence detect sequence.*/
+ unsigned int reset_recover_delay;
};
--
1.7.5.4

Jean-Francois Dagenais
Software Architect - B.Sc.A


Experience the new veo phased array flaw detector at http://www.sonatestveo.com.


Sonatest AP
2900 chemin des Quatre-Bourgeois
Bureau 305
Quebec City Quebec G1V 1Y4

T| +1 (418) 683 6222 x106 F| +1 (418) 683 7032 M| W| http://www.sonatest.com



This message (and any associated files) is intended only for the use of [email protected], [email protected], [email protected] and may contain information that is confidential, subject to copyright or constitutes a trade secret. If you are not the above recipient(s) you are hereby notified that any dissemination, copying or distribution of this message, or files associated with this message, is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.

Think green - help the environment by not printing this email.

2011-06-28 10:00:58

by Paul Parsons

[permalink] [raw]
Subject: Re: [PATCH] w1: ds1wm: add a reset recovery parameter

Thanks Jean-Fran?ois; that patch set has resolved the problem.

Tested-by: Paul Parsons <[email protected]>

--- On Mon, 27/6/11, Jean-Fran?ois Dagenais <[email protected]> wrote:

> From: Jean-Fran?ois Dagenais <[email protected]>
> Subject: [PATCH] w1: ds1wm: add a reset recovery parameter
> To: [email protected]
> Cc: [email protected], "Paul Parsons" <[email protected]>
> Date: Monday, 27 June, 2011, 14:17
> This follows the regression on 3.0
> reported by Paul Parsons regarding
> the removal of the msleep(1) in the ds1wm_reset() function.
> This
> sleep should not be required on normal circuitry provided
> the
> pull-ups on the bus are correctly adapted to the slaves.
> Unfortunately, this is not always the case. The sleep is
> restored
> but as a parameter to the probe function in the pdata.
> ---
> drivers/mfd/asic3.c? ? ? ? |?
> ? 1 +
> drivers/mfd/htc-pasic3.c???|? ? 1
> +
> drivers/w1/masters/ds1wm.c |? ? 5 +++++
> include/linux/mfd/ds1wm.h? |? ? 7 +++++++
> 4 files changed, 14 insertions(+), 0 deletions(-)