aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/masters
Commit message (Collapse)AuthorAgeFilesLines
* w1: ds1wm: add a reset recovery parameterJean-François Dagenais2011-07-081-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes a regression in 3.0 reported by Paul Parsons regarding the removal of the msleep(1) in the ds1wm_reset() function: : 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 : ... : : 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. 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. [akpm@linux-foundation.org: coding-style fixes] Reported-by: Paul Parsons <lost.distance@yahoo.com> Tested-by: Paul Parsons <lost.distance@yahoo.com> Signed-off-by: Jean-François Dagenais <dagenaisj@sonatest.com> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: W1_MASTER_DS1WM should depend on GENERIC_HARDIRQSGeert Uytterhoeven2011-06-151-1/+1
| | | | | | | | | | | | | | On m68k (which doesn't support generic hardirqs yet): drivers/w1/masters/ds1wm.c: In function `ds1wm_probe': drivers/w1/masters/ds1wm.c: error: implicit declaration of function `irq_set_irq_type' Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Cc: Jean-Franois Dagenais <dagenaisj@sonatest.com> Cc: Matt Reimer <mreimer@vpop.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: complete the 1-wire (w1) ds1wm driver search algorithmJean-François Dagenais2011-05-262-103/+220
| | | | | | | | | | | | | This adds multi-slave support of the w1 bus for the ds1wm Synthesizable 1-Wire Bus Master. Also many fixes and tweaks based on the rev3 of the datasheet http://datasheets.maxim-ic.com/en/ds/DS1WM.pdf Signed-off-by: Jean-François Dagenais <dagenaisj@sonatest.com> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Cc: Szabolcs Gyurko <szabolcs.gyurko@tlt.hu> Cc: Matt Reimer <mreimer@vpop.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: Use device platform_data to retrieve ds1wm platform bitsSamuel Ortiz2011-05-261-2/+10
| | | | | | | | | | With the addition of the platform device mfd_cell pointer, we can now cleanly pass the sub device drivers platform data pointers through the regular device platform_data one, and get rid of mfd_get_data(). Cc: Matt Reimer <mreimer@vpop.net> Cc: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* Fix common misspellingsLucas De Marchi2011-03-311-1/+1
| | | | | | Fixes generated by 'codespell' and manually reviewed. Signed-off-by: Lucas De Marchi <lucas.demarchi@profusion.mobi>
* drivers: Final irq namespace conversionThomas Gleixner2011-03-291-2/+2
| | | | | | Scripted with coccinelle. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* w1: Silence ds1wm warnings related to mfd_get_cell changesAndres Salomon2011-03-231-7/+2
| | | | | | | | | | | mfd_get_cell returns a const, so change the ds1wm client to store a const mfd cell. This silences type mismatch warnings. Since we're guaranteed to have the mfd_cell, we can also simplify the code a bit to get rid of a temporary variable and NULL check. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* w1: Use mfd_data instead of driver_data for dsw1wm.cAndres Salomon2011-03-231-2/+2
| | | | | | | | | | | | | | | | Use mfd_data for passing information from mfd drivers to mfd clients. The mfd_cell's driver_data field is being phased out. Clients that were using driver_data now access .mfd_data via mfd_get_data(). This changes ds1wm only; mfd drivers with other cells are not modified, with the exception of led_cell. The led_cell.driver_data line is dropped from htc-pasic3.c in this patch as well. It's not used in mainline (there's no leds-pasic3 platform driver), so it should be safe to take care of that here. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
* mfd: mfd_cell is now implicitly available to asic3 driversAndres Salomon2011-03-231-1/+1
| | | | | | | | | | No need to explicitly set the cell's platform_data/data_size. Modify clients to use mfd_get_cell helper function instead of accessing platform_data directly. Signed-off-by: Andres Salomon <dilinger@queued.net> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
*-. Merge branches 'devel-cleanup', 'devel-board', 'devel-early-init' and ↵Tony Lindgren2011-02-161-1/+1
|\ \ | | | | | | | | | 'devel-ti816x' into omap-for-linus
| * | omap: Start using CONFIG_SOC_OMAPTony Lindgren2011-01-271-1/+1
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We want to have just CONFIG_ARCH_OMAP2, 3 and 4. The rest are nowadays just subcategories of these. Search and replace the following: ARCH_OMAP2420 SOC_OMAP2420 ARCH_OMAP2430 SOC_OMAP2430 ARCH_OMAP3430 SOC_OMAP3430 No functional changes. Signed-off-by: Tony Lindgren <tony@atomide.com> Signed-off-by: Thomas Weber <weber@corscience.de> Acked-by: Sourav Poddar <sourav.poddar@ti.com>
* | drivers/w1/masters/omap_hdq.c: add missing clk_putJulia Lawall2011-02-111-14/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This code makes two calls to clk_get, then test both return values and fails if either failed. The problem is that in the first inner if, where the first call to clk_get has failed, it don't know if the second call has failed as well. So it don't know whether clk_get should be called on the result of the second call. Of course, it would be possible to test that value again. A simpler solution is just to test the result of calling clk_get directly after each call. The semantic match that finds this problem is as follows: (http://coccinelle.lip6.fr/) // <smpl> @r@ position p1,p2; expression e; statement S; @@ e = clk_get@p1(...) ... if@p2 (IS_ERR(e)) S @@ expression e; statement S; identifier l; position r.p1, p2 != r.p2; @@ *e = clk_get@p1(...) ... when != clk_put(e) *if@p2 (...) { ... when != clk_put(e) * return ...; }// </smpl> Signed-off-by: Julia Lawall <julia@diku.dk> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Amit Kucheria <amit.kucheria@canonical.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: fix omap 1-wire driver compilationAmit Kucheria2010-04-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | Fixes the following error: drivers/w1/masters/omap_hdq.c: In function 'hdq_wait_for_flag': drivers/w1/masters/omap_hdq.c:137: error: implicit declaration of function 'schedule_timeout_uninterruptible' drivers/w1/masters/omap_hdq.c: In function 'hdq_write_byte': drivers/w1/masters/omap_hdq.c:177: error: 'TASK_UNINTERRUPTIBLE' undeclared (first use in this function) drivers/w1/masters/omap_hdq.c:177: error: (Each undeclared identifier is reported only once drivers/w1/masters/omap_hdq.c:177: error: for each function it appears in.) drivers/w1/masters/omap_hdq.c:177: error: implicit declaration of function 'schedule_timeout' drivers/w1/masters/omap_hdq.c: In function 'hdq_isr': drivers/w1/masters/omap_hdq.c:221: error: 'TASK_NORMAL' undeclared (first use in this function) drivers/w1/masters/omap_hdq.c: In function 'omap_hdq_break': drivers/w1/masters/omap_hdq.c:316: error: 'TASK_UNINTERRUPTIBLE' undeclared (first use in this function) Signed-off-by: Amit Kucheria <amit.kucheria@canonical.com> Acked-by: Tony Lindgren <tony@atomide.com> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-305-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implicit slab.h inclusion from percpu.h percpu.h is included by sched.h and module.h and thus ends up being included when building most .c files. percpu.h includes slab.h which in turn includes gfp.h making everything defined by the two files universally available and complicating inclusion dependencies. percpu.h -> slab.h dependency is about to be removed. Prepare for this change by updating users of gfp and slab facilities include those headers directly instead of assuming availability. As this conversion needs to touch large number of source files, the following script is used as the basis of conversion. http://userweb.kernel.org/~tj/misc/slabh-sweep.py The script does the followings. * Scan files for gfp and slab usages and update includes such that only the necessary includes are there. ie. if only gfp is used, gfp.h, if slab is used, slab.h. * When the script inserts a new include, it looks at the include blocks and try to put the new include such that its order conforms to its surrounding. It's put in the include block which contains core kernel includes, in the same order that the rest are ordered - alphabetical, Christmas tree, rev-Xmas-tree or at the end if there doesn't seem to be any matching order. * If the script can't find a place to put a new include (mostly because the file doesn't have fitting include block), it prints out an error message indicating which .h file needs to be added to the file. The conversion was done in the following steps. 1. The initial automatic conversion of all .c files updated slightly over 4000 files, deleting around 700 includes and adding ~480 gfp.h and ~3000 slab.h inclusions. The script emitted errors for ~400 files. 2. Each error was manually checked. Some didn't need the inclusion, some needed manual addition while adding it to implementation .h or embedding .c file was more appropriate for others. This step added inclusions to around 150 files. 3. The script was run again and the output was compared to the edits from #2 to make sure no file was left behind. 4. Several build tests were done and a couple of problems were fixed. e.g. lib/decompress_*.c used malloc/free() wrappers around slab APIs requiring slab.h to be added manually. 5. The script was run on all .h files but without automatically editing them as sprinkling gfp.h and slab.h inclusions around .h files could easily lead to inclusion dependency hell. Most gfp.h inclusion directives were ignored as stuff from gfp.h was usually wildly available and often used in preprocessor macros. Each slab.h inclusion directive was examined and added manually as necessary. 6. percpu.h was updated not to include slab.h. 7. Build test were done on the following configurations and failures were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my distributed build env didn't work with gcov compiles) and a few more options had to be turned off depending on archs to make things build (like ipr on powerpc/64 which failed due to missing writeq). * x86 and x86_64 UP and SMP allmodconfig and a custom test config. * powerpc and powerpc64 SMP allmodconfig * sparc and sparc64 SMP allmodconfig * ia64 SMP allmodconfig * s390 SMP allmodconfig * alpha SMP allmodconfig * um on x86_64 SMP allmodconfig 8. percpu.h modifications were reverted so that it could be applied as a separate patch and serve as bisection point. Given the fact that I had only a couple of failures from tests on step 6, I'm fairly confident about the coverage of this conversion patch. If there is a breakage, it's likely to be something in one of the arch headers which should be easily discoverable easily on most builds of the specific arch. Signed-off-by: Tejun Heo <tj@kernel.org> Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org> Cc: Ingo Molnar <mingo@redhat.com> Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>
* w1: mxc_w1: move probe() and remove() to the dev* text areaAlberto Panizzo2010-03-121-2/+2
| | | | | | | | | | This fixes the section mismatch warning for mxc_w1_probe() Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Cc: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: fix test in ds2482_wait_1wire_idle()Roel Kluin2010-03-121-1/+1
| | | | | | | | | | With `while (++retries < DS2482_WAIT_IDLE_TIMEOUT)' retries reaches DS2482_WAIT_IDLE_TIMEOUT after the loop Signed-off-by: Roel Kluin <roel.kluin@gmail.com> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: move omap_hdq's probe function to .devinit.textUwe Kleine-König2010-03-071-2/+2
| | | | | | | | | | | | | | | | | | | | | A pointer to omap_hdq_probe is passed to the core via platform_driver_register and so the function must not disappear when the .init sections are discarded. Otherwise (if also having HOTPLUG=y) unbinding and binding a device to the driver via sysfs will result in an oops as does a device being registered late. An alternative to this patch is using platform_driver_probe instead of platform_driver_register plus removing the pointer to the probe function from the struct platform_driver. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Cc: Stanley.Miao <stanley.miao@windriver.com> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Madhusudhan Chikkature <madhu.cr@ti.com> Cc: Felipe Balbi <felipe.balbi@nokia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
* omap3: Replace ARCH_OMAP34XX with ARCH_OMAP3Tony Lindgren2010-02-151-1/+1
| | | | | | Replace ARCH_OMAP34XX with ARCH_OMAP3 Signed-off-by: Tony Lindgren <tony@atomide.com>
* ds2482: Discard obsolete detect methodJean Delvare2009-10-041-30/+5
| | | | | | | | | | | | | There is no point in implementing a detect callback for the DS2482, as this device can't be detected. It was there solely to handle "force" module parameters to instantiate devices, but now we have a better sysfs interface that can do the same. So we can get rid of the ugly module parameters and the detect callback. This shrinks the binary module size by 21%. Signed-off-by: Jean Delvare <khali@linux-fr.org> Acked-by: Ben Gardner <gardner.ben@gmail.com>
* drivers/w1/masters/omap_hdq.c: fix missing mutex unlockStoyan Gaydarov2009-08-071-0/+1
| | | | | | | | | | This was found using a semantic patch, more info can be found at: http://www.emn.fr/x-info/coccinelle/ Signed-off-by: Stoyan Gaydarov <sgayda2@uiuc.edu> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1-gpio: add external pull-up enable callbackDaniel Mack2009-06-181-0/+35
| | | | | | | | | | | | | | | | | | | On embedded devices, sleep mode conditions can be tricky to handle, Especially when processors tend to pull-down the w1 bus during sleep. Bus slaves (such as the ds2760) may interpret this as a reason for power-down conditions and entirely switch off the device. This patch adds a callback function pointer to let users switch on and off the external pull-up resistor. This lets the outside world know whether the processor is currently actively driving the bus or not. When this callback is not provided, the code behaviour won't change. Signed-off-by: Daniel Mack <daniel@caiaq.de> Acked-by: Ville Syrjala <syrjala@sci.fi> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* trivial: Kconfig: .ko is normally not included in module namesPavel Machek2009-06-121-3/+3
| | | | | | | .ko is normally not included in Kconfig help, make it consistent. Signed-off-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
* mfd: remove DS1WM clock handlingPhilipp Zabel2009-04-051-20/+7
| | | | | | | | | | | | | This driver requests a clock that usually is supplied by the MFD in which the DS1WM is contained. Currently, it is impossible for a MFD to register their clocks with the generic clock API due to different implementations across architectures. For now, this patch removes the clock handling from DS1WM altogether, trusting that the MFD enable/disable functions will switch the clock if needed. The clock rate is obtained from a new parameter in driver_data. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
* mfd: convert DS1WM to use MFD corePhilipp Zabel2009-04-051-11/+20
| | | | | | | | This patch converts the DS1WM driver into an MFD cell. It also calculates the bus_shift parameter from the memory resource size. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Signed-off-by: Samuel Ortiz <sameo@openedhand.com>
* Merge branch 'for-next' of ↵Russell King2009-03-251-1/+1
|\ | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap-2.6 into devel
| * drivers/w1/masters/w1-gpio.c: fix read_bit()Daniel Mack2009-03-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | W1 master implementations are expected to return 0 or 1 from their read_bit() function. However, not all platforms do return these values from gpio_get_value() - namely PXAs won't. Hence the w1 gpio-master needs to break the result down to 0 or 1 itself. Signed-off-by: Daniel Mack <daniel@caiaq.de> Cc: Ville Syrjala <syrjala@sci.fi> Cc: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Cc: David Brownell <david-b@pacbell.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* | Merge branch 'omap-clks3' into develRussell King2009-03-191-2/+2
|\ \ | | | | | | | | | | | | | | | Conflicts: arch/arm/mach-omap2/clock.c
| * | [ARM] omap: w1: convert omap HDQ clocks to match by devid and conidRussell King2009-02-081-2/+2
| |/ | | | | | | Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
* | [ARM] MXC: remove _clk suffix from clock namesSascha Hauer2009-03-131-1/+1
|/ | | | | | | | | The context makes it clear already that these are clocks, so there's no need for such a suffix. This patch only changes the clocks actually used in the tree. The remaining clocks are renamed in the subsequent architecture specific patches. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* w1: add 1-wire master driver for i.MX27 / i.MX31Sascha Hauer2009-01-083-0/+219
| | | | | | | | | | | | This patch adds support for the 1-wire master interface for i.MX27 and i.MX31. Signed-off-by: Luotao Fu <l.fu@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net> Cc: Russell King <rmk@arm.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1_MASTER_DS1WM should depend on HAVE_CLKAl Viro2008-11-301-1/+1
| | | | | | | | Uses clk_...() a lot Acked-by: rmk+kernel@arm.linux.org.uk Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1 OMAP: Fix OMAP LDP boot crashStanley.Miao2008-11-191-5/+5
| | | | | | | | | | OMAP LDP boot crash. This is because w1 subsystem changed the search interface, so update omap_hdq's search interface to follow the change. Signed-off-by: Stanley.Miao <stanley.miao@windriver.com> Signed-off-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* hdq driver for OMAP2430/3430Madhusudhan Chikkature2008-11-123-0/+733
| | | | | | | | | | | | | | | | The HDQ/1-Wire module of TI OMAP2430/3430 platforms implement the hardware protocol of the master functions of the Benchmark HDQ and the Dallas Semiconductor 1-Wire protocols. These protocols use a single wire for communication between the master (HDQ/1-Wire controller) and the slave (HDQ/1-Wire external compliant device). This patch provides the HDQ driver to suppport TI OMAP2430/3430 platforms. Signed-off-by: Madhusudhan Chikkature<madhu.cr@ti.com> Acked-by: Felipe Balbi <felipe.balbi@nokia.com> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c optimize ds_set_pullupDavid Fries2008-10-161-19/+45
| | | | | | | | | | | | | | | | Optimize the ds_set_pullup function. For a strong pullup to be sent the ds2490 has to have both the strong pullup mode enabled, and the specific write operation has to have the SPU bit enabled. Previously the write always had the SPU bit enabled and both the duration and model was set when a strong pullup was requested. Now the strong pullup mode is enabled at initialization time, the delay is updated only when the value changes, and the write SPU bit is set only when a strong pullup is required. This removes two or three bus transactions per strong pullup request. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c ds_write_block remove extra ds_wait_statusDavid Fries2008-10-161-2/+0
| | | | | | | | | Drop the extra ds_wait_status() in ds_write_block(). Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c magic number workDavid Fries2008-10-161-4/+12
| | | | | | | | | This replaces some magic numbers with marcos and corrects one marco. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c reset ds2490 in initDavid Fries2008-10-161-0/+21
| | | | | | | | | | | | | | | Reset the device in init as it can be in a bad state. This is necessary because a block write will wait for data to be placed in the output buffer and block any later commands which will keep accumulating and the device will not be idle. Another case is removing the ds2490 module while a bus search is in progress, somehow a few commands get through, but the input transfers fail leaving data in the input buffer. This will cause the next read to fail see the note in ds_recv_data. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c ds_reset remove ds_wait_statusDavid Fries2008-10-161-13/+2
| | | | | | | | | | ds_reset no longer calls ds_wait_status, the result wasn't used and it would only delay the following data operations. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c ds_dump_status reworkDavid Fries2008-10-161-50/+84
| | | | | | | | | | | | | | | | | | | - add result register #defines - rename ds_dump_status to ds_print_msg - rename ds_recv_status to ds_dump_status - ds_dump_status prints the requested status and no longer reads the status, this is because the second status read can return different data for example the result register - the result register will be printed, though limited to detecting a new device, detecting other values such as a short would require additional reporting methods - ST_EPOF was moved to ds_wait_status to clear the error condition sooner Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c simplify and fix ds_touch_bitDavid Fries2008-10-161-17/+4
| | | | | | | | | | | | | | | | | | | | | | Simplify and fix ds_touch_bit. If a device is attached in the middle of a bus search the status register will return more than the default 16 bytes. The additional bytes indicate that it has detected a new device. The way ds_wait_status is coded, if it doesn't read 16 status bytes it returns an error value. ds_touch_bit then will detect that error and return an error. In that case it doesn't read the input buffer and returns uninitialized data. It doesn't stop there. The next transaction will not expect the extra byte in the input buffer and the short read will cause an error and clear out both the old byte and new data in the input buffer. Just ignore the value of ds_wait_status. It is still required to wait until ds2490 is again idle and there is data to read when ds_recv_data is called. This also removes the while loop. None of the other commands wait and verify that the issued command is in the status register. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c disable bit read and writeDavid Fries2008-10-161-7/+18
| | | | | | | | | | | | | Don't export read and write bit operations, they didn't work, they weren't used, and they can't be made to work. The one wire low level bit operations expect to set high or low levels, the ds2490 hardware only supports complete read or write time slots, better to just comment them out. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c ds_write_bit, grouping error, disable readbackDavid Fries2008-10-161-1/+6
| | | | | | | | | | | | ds_write_bit doesn't read the input buffer, so add COMM_ICP and a comment that it will no longer generate a read back data byte. If there is an extra data byte later on then it will cause an error and discard what data was there. Corrected operator ordering for ds_send_control. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c add support for strong pullupDavid Fries2008-10-161-38/+38
| | | | | | | | | | | | | | | | Add strong pullup support for ds2490 driver, also drop mdelay(750), which busy waits, usage in favour of msleep for long delays. Now with msleep only being called when the strong pullup is active, one wire bus operations are only taking minimal system overhead. The new set_pullup will only enable the strong pullup when requested, which is expected to be the only write operation that will benefit from a strong pullup. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds2490.c correct print messageDavid Fries2008-10-161-1/+2
| | | | | | | | | | | Corrected print message, it was writing not reading, this also prints the endpoint used for the write instead of hardcoding it. Failed to write 1-wire data to ep0x%x: err=%d. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: ds1wm.c msleep for resetDavid Fries2008-10-161-1/+3
| | | | | | | | | | | | | | | | | | | Like the previous w1_io.c reset coments and msleep patch, I don't have the hardware to verify the change, but I think it is safe. It also helps to see a comment like this in the code. "We'll wait a bit longer just to be sure." If they are going to calculate delaying 324.9us, but actually delay 500us, why not just give up the CPU and sleep? This is designed for a battery powered ARM system, avoiding busywaiting has to be good for battery life. I sent a request for testers March 7, 2008 to the Linux kernel mailing list and two developers who have patches for ds1wm.c, but I didn't get any respons. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* W1: fix deadlocks and remove w1_control_threadDavid Fries2008-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | | | w1_control_thread was removed which would wake up every second and process newly registered family codes and complete some final cleanup for a removed master. Those routines were moved to the threads that were previously requesting those operations. A new function w1_reconnect_slaves takes care of reconnecting existing slave devices when a new family code is registered or removed. The removal case was missing and would cause a deadlock waiting for the family code reference count to decrease, which will now happen. A problem with registering a family code was fixed. A slave device would be unattached if it wasn't yet claimed, then attached at the end of the list, two unclaimed slaves would cause an infinite loop. The struct w1_bus_master.search now takes a pointer to the struct w1_master device to avoid searching for it, which would have caused a lock ordering deadlock with the removal of w1_control_thread. Signed-off-by: David Fries <david@fries.net> Signed-off-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1/ds2482: Convert to a new-style driverJean Delvare2008-07-161-60/+44
| | | | | | | | The new-style ds2482 driver implements the optional detect() callback to cover the use cases of the legacy driver. I'm curious if anyone really needs this though, so it might be removed in the feature. Signed-off-by: Jean Delvare <khali@linux-fr.org>
* ds1wm: report bus reset errorAnton Vorontsov2008-03-041-9/+9
| | | | | | | | | | | | | | | The patch replaces dev_dbg() by dev_err(), so the user could actually see the error, instead of wondering why w1 doesn't work. The root cause of the bus reset error isn't yet debugged though, but this sometimes happens on iPaq H5555. And while I'm at it, some cosmetic cleanups also made (few lines were using spaces instead of tabs). Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* ds1wm: should check for IS_ERR(clk) instead of NULLAnton Vorontsov2008-03-041-2/+3
| | | | | | | | | | | | | | On the error condition clk_get() returns ERR_PTR(..), so checking for NULL doesn't work. ds1wm module causes a kernel oops when ds1wm clock isn't registered. This patch converts NULL check to IS_ERR(), plus uses PTR_ERR() for the return code. Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* DS1WM: decouple host IRQ and INTR active state settingsPhilipp Zabel2008-02-071-4/+5
| | | | | | | | | | | | | The DS1WM driver incorrectly infers the IAS bit (1-wire interrupt active high) from IRQ settings. There are devices that have IAS=0 but still need the IRQ to trigger on a rising edge. With this patch, machines with DS1WM that need IAS=1 have to set .active_high=1 in the ds1wm_platform_data. Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com> Acked-by: Evgeniy Polyakov <johnpol@2ka.mipt.ru> Acked-by: Matt Reimer <mreimer@vpop.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>