summaryrefslogtreecommitdiffstats
path: root/drivers/w1/masters/mxc_w1.c
Commit message (Collapse)AuthorAgeFilesLines
* w1: constify of_device_id arrayFabian Frederick2015-03-251-1/+1
| | | | | | | | of_device_id is always used as const. (See driver.of_match_table and open firmware functions) Signed-off-by: Fabian Frederick <fabf@skynet.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: masters: drop owner assignment from platform_driversWolfram Sang2014-10-201-1/+0Star
| | | | | | | A platform_driver does not need to set an owner, it will be populated by the driver core. Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
* w1: mxc_w1: Optimize mxc_w1_ds2_touch_bit()Alexander Shiyan2014-06-201-12/+15
| | | | | | | | | | | According to the i.MX reference manual, the read/write bit operations takes from 60 us to 120 us. This patch optimizes mxc_w1_ds2_touch_bit() function to use proper value for such delay. Nevertheless, a small margin for the timeout has been added for the case if clock frequency is inaccurate. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Perform a software reset at startupAlexander Shiyan2014-06-201-0/+5
| | | | | | | This patch adds a software reset for 1-Wire module at driver startup. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Optimize mxc_w1_ds2_reset_bus()Alexander Shiyan2014-06-201-17/+15Star
| | | | | | | | | | | | | According to the i.MX reference manual, the reset procedure and "presence" pulse takes 511 and 512 us, respectively. Measurement for i.MX27 is about 1100 us. There is no need to wait Reset+Presence more than this time. This patch optimizes mxc_w1_ds2_reset_bus() function to use proper value for delay after w1 bus reset. Nevertheless, a small margin for the timeout has been added for the case if clock frequency is inaccurate. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Fix incorrect "presence" statusAlexander Shiyan2014-06-201-1/+1
| | | | | | | | W1 reset_bus() should return zero if slave device is present. This patch fix this issue. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Enable driver compilation with COMPILE_TESTAlexander Shiyan2014-03-011-6/+6
| | | | | | | | | This helps increasing build testing coverage. To do this, __raw_{read,write}b() functions was be replaced with simple {read,write}b() variants. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Driver cleanupAlexander Shiyan2014-03-011-23/+16Star
| | | | | | | | | | | | - Remove old and currently wrong address of the FSF from license parts of the code. - Remove unused #include and sort remaining headers alphabetically. - Remove unised definitions. - Add definitions for bit-fields. - Add missing module owner field. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Fix mxc_w1_ds2_reset_bus() return valueAlexander Shiyan2014-03-011-1/+1
| | | | | | | | | This patch fix mxc_w1_ds2_reset_bus() return value. According to i.MX reference manual, "presence status" reflected in the bit 6 of control register. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Check the clk_prepare_enable() return valueAlexander Shiyan2013-12-091-6/+9
| | | | | | Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Add warning for base frequency calculationAlexander Shiyan2013-12-091-2/+12
| | | | | | | | | Base frequency should be as close as possible to 1 MHz. This patch adds warnings when clock is unreliable, according to i.MX datasheet. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Remove unused field "clkdiv" from private structureAlexander Shiyan2013-12-091-3/+3
| | | | | | | | | Private field "clkdiv" is not used outside "probe", so there are no reason to keep it in driver. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* drivers/w1/masters/mxc_w1.c: remove unnecessary platform_set_drvdata()Jingoo Han2013-09-121-2/+0Star
| | | | | | | | | | | | | The driver core clears the driver data to NULL after device_release or on probe failure. Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: Evgeniy Polyakov <zbr@ioremap.net> Cc: Greg KH <greg@kroah.com> Acked-by: Shawn Guo <shawn.guo@linaro.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
* w1: mxc_w1: Convert to devm_ioremap_resource()Fabio Estevam2013-03-131-3/+3
| | | | | | | | | According to Documentation/driver-model/devres.txt: devm_request_and_ioremap() : obsoleted by devm_ioremap_resource() Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Merge tag 'late-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-socLinus Torvalds2013-03-011-1/+8
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pull ARM SoC i.MX DT changes from Olof Johansson: "This branch contains of devicetree changes for the Freescale i.MX platform. The base patch of the branch changes the format of the dts files to a slightly different format that makes it easier to do derivative board definitions, but it also introduces a lot of churn in the process since every line of the file is touched. On top of that are a handful of the regular changes; enabling more boards as DT-based instead of legacy board files (mx25pdk), enabling another driver for devicetree and thus adding bindings (onewire), etc. I'm not happy about the churn, and will likely not take it for other platforms in the future." * tag 'late-dt' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (21 commits) ARM: dts: add dtsi for imx6q and imx6dl ARM: dts: rename imx6q.dtsi to imx6qdl.dtsi ARM: dts: i.MX6: Add regulator delay support ARM: dts: Add device tree entry for onewire master on i.MX53 ARM: i.MX53: Add clocks for i.mx53 onewire master. W1: Add device tree support to MXC onewire master. ARM: imx: enable imx6q-cpufreq support ARM: dts: Add apf51 basic support ARM i.MX6: change mxs usbphy clock usage ARM: dts: imx6q: Remove silicon version from SDMA firmware ARM i.MX53: dts: add oftree for MBa53 baseboard ARM i.MX53: add dts for the TQ tqma53 module ARM: dts: imx53: pinctrl update ARM i.MX51 babbage: Add keypad support ARM: dts: imx: Add imx51 KPP entry ARM: dts: imx25-karo-tx25: Put status entry in the end ARM: mx25pdk: Add device tree support ARM: dts: imx: use nodes label in board dts ARM: dts: add missing imx dtb targets ARM: boot: dts: Add an entry for imx27-pdk.dtb ...
| * W1: Add device tree support to MXC onewire master.Martin Fuzzey2013-02-101-1/+8
| | | | | | | | | | | | | | Signed-off-by: Martin Fuzzey <mfuzzey@parkeon.com> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
* | drivers/w1/masters/mxc_w1.c: use devm_ functionsJulia Lawall2013-01-161-39/+10Star
|/ | | | | | | | | | | | | | | | | | | | | | | | The various devm_ functions allocate memory that is released when a driver detaches. This patch uses these functions for data that is allocated in the probe function of a platform device and is only freed in the remove function. At the same time, this fixes two faults. First, mdev, the result of kzalloc, was never freed. Second, on failure of ioremap, 0 was returned. This has been replaced by -EBUSY, which was the failure value for the call to request_mem_region, with which the call to ioremap has been combined. The warning message on failure of ioremap is dropped, because devm_request_and_ioremap already gives such messages on failure. Finally, the initial call to platform_get_resource is moved closer to the call to devm_request_and_ioremap, which takes care of checking whether its result is NULL, implying that a test on the result of this call to platform_get_resource is not needed. Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* Drivers: w1: remove last __devexit_p() instanceGreg Kroah-Hartman2013-01-041-1/+1
| | | | | | | | | | | This slipped in through the merging of different trees. Remove __devexit_p() use in the mxc_w1 driver. Cc: Evgeniy Polyakov <zbr@ioremap.net> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Bill Pemberton <wfp5p@virginia.edu> Cc: Sascha Hauer <s.hauer@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: remove use of __devexitBill Pemberton2012-11-211-1/+1
| | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devexit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: remove use of __devinitBill Pemberton2012-11-211-1/+1
| | | | | | | | | CONFIG_HOTPLUG is going away as an option so __devinit is no longer needed. Signed-off-by: Bill Pemberton <wfp5p@virginia.edu> Cc: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Fix commentFabio Estevam2012-11-211-1/+1
| | | | | | | | | We are dealing with mxc_w1 registers. While at it use dev_err() instead. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Convert to platform driverFabio Estevam2012-11-211-14/+2Star
| | | | | | | Using module_platform_driver() makes the code smaller and cleaner. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1: mxc_w1: Adapt the clock name to the new clock frameworkFabio Estevam2012-11-211-3/+3
| | | | | | | | | | | | | | | | | | | | | | With the new i.mx clock framework the mxc_w1 clock is registered as: clk_register_clkdev(clk[owire_gate], NULL, "mxc_w1.0"); So we do not need to pass "owire" string and can use NULL instead. While at it, also fix the clock error handling code. Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Acked-by: Evgeniy Polyakov <zbr@ioremap.net> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> ----- Changes since v2: - Add Ack's Changes since v1: - Fix clock error handling drivers/w1/masters/mxc_w1.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* w1 i.MX: prepare/unprepare clockSascha Hauer2012-04-251-2/+2
| | | | Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* include cleanup: Update gfp.h and slab.h includes to prepare for breaking ↵Tejun Heo2010-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-131-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>
* [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-081-0/+211
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>