i2c clients should be removed in reverse order compared to the probe
(actually: bind) order. This matters when several clients depend on
each other.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Build fixes for isp1301_omap; no behavior changes:
- fix incorrect probe() signature (it changed many months ago)
- provide missing functions on H3 and H4 boards
- "sparse" fixes (static, NULL-vs-0)
The H3 build bits subset some of the stuff that was previously in
the OMAP tree but never went to mainline.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
In commit e6bafba5b4, a bug was fixed that
involved converting !x & y to !(x & y). The code below shows the same
pattern, and thus should perhaps be fixed in the same way. In particular,
the result of !readl(i2c->regs + S3C2410_IICCON) & S3C2410_IICCON_IRQEN is
always 0.
The semantic patch that makes this change is as follows:
(http://www.emn.fr/x-info/coccinelle/)
// <smpl>
@@ expression E; constant C; @@
(
!E & !C
|
- !E & C
+ !(E & C)
)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Cc: Ben Dooks <ben-linux@fluff.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The scx200_i2c driver is missing the .class parameter, which means no
i2c drivers are willing to probe for devices on the bus and attach to
them.
Signed-off-by: Len Sorensen <lsorense@csclub.uwaterloo.ca>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
i2c: Add info->archdata field
i2c: Inform about deprecated chips directory
i2c: Use pci_ioremap_bar()
Schedule removal of the legacy i2c device driver binding model
i2c: Clean up <linux/i2c.h>
i2c: Update and clean up writing-clients document
i2c: Drop 2-byte address block transfer defines
i2c: Delete legacy model documentation
i2c: Constify i2c_get_clientdata's parameter
i2c: Delete outdated client porting guide
i2c: Make clear what the class field of i2c_adapter is good for
i2c-algo-pcf: Fix typo in debugging log message
i2c-algo-pcf: Add adapter hooks around xfer begin and end
i2c-algo-pcf: Pass adapter data into ->waitforpin() method
i2c-i801: Add support for Intel Ibex Peak
If present the info->archdata is copied into the dev->archdata.
Some (OpenFirmware) platforms need it.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The chips directory under drivers/i2c is deprecated. Spread the word!
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Use the newly introduced pci_ioremap_bar() function in drivers/i2c.
pci_ioremap_bar() just takes a pci device and a bar number, with the goal
of making it really hard to get wrong, while also having a central place
to stick sanity checks.
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Fix typo in debugging log message.
deteted --> detected
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Some I2C bus implementations need to synchronize with external
entities, such as system firmware, which might also be programming the
same I2C bus.
In order to facilitate this add ->xfer_begin() and ->xfer_end() hooks
which are invoked around pcf_xfer().
[JD: Make these hooks optional.]
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Similar to commit 618b26d528, also remove
automatic probing for this i2c controller. Might need updates to dts files
using it.
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Acked-by: Jochen Friedrich <jochen@scram.de>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Only accept dynids whose driver_data value matches one of the driver's
pci_driver_id entries. This prevents the user from accidentally passing
values the drivers do not expect.
Cc: Milton Miller <miltonm@bga.com>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
The driver flag dynids.use_driver_data is almost consistently not set,
and causes more problems than it solves. It was initially intended as a
flag to indicate whether a driver's usage of driver_data had been
carefully inspected and was ready for values from userspace. That audit
was never done, so most drivers just get a 0 for driver_data when new
IDs are added from userspace via sysfs. So remove the flag, allowing
drivers to see the data directly (a followon patch validates the passed
driver_data value against what the drivers expect).
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Milton Miller <miltonm@bga.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Tejun's commit 7b595756ec made sysfs
attribute->owner unnecessary. But the field was left in the structure to
ease the merge. It's been over a year since that change and it is now
time to start killing attribute->owner along with its users - one arch at
a time!
This patch is attempt #1 to get rid of attribute->owner only for
CONFIG_X86_64 or CONFIG_X86_32 . We will deal with other arches later on
as and when possible - avr32 will be the next since that is something I
can test. Compile (make allyesconfig / make allmodconfig / custom config)
and boot tested.
akpm: the idea is that we put the declaration of sttribute.owner inside
`#ifndef CONFIG_X86'. But that proved to be too ambitious for now because
new usages kept on turning up in subsystem trees.
[akpm: remove the ifdef for now]
Signed-off-by: Parag Warudkar <parag.lkml@gmail.com>
Cc: Greg KH <greg@kroah.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Tejun Heo <htejun@gmail.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jens Axboe <jens.axboe@oracle.com>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Roland Dreier <rolandd@cisco.com>
Cc: David Brownell <david-b@pacbell.net>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change i2c to use the new bcd2bin/bin2bcd functions instead of the
obsolete BCD2BIN/BIN2BCD macros.
Signed-off-by: Adrian Bunk <bunk@kernel.org>
Cc: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
The legacy i2c binding model is phasing out, so the ams driver needs
to be converted to a new-style i2c driver. Here is a naive approach of
this conversion. Basically it is moving the i2c device creation from
the ams driver to the i2c-powermac driver. This should work, but I
suspect we could come up with something cleaner by declaring the i2c
device as part of the platform setup. This could be done later by
someone more familiar with openfirmware-based platforms than I am
myself.
One nice thing brought by this conversion is that the ams driver
should be loaded automatically on systems where is is needed (at
least when the I2C interface to the chip is used) providing
coldplug-aware user-space environment.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Stelian Pop <stelian@popies.net>
Cc: Michael Hanselmann <linux-kernel@hansmi.ch>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6: (46 commits)
UIO: Fix mapping of logical and virtual memory
UIO: add automata sercos3 pci card support
UIO: Change driver name of uio_pdrv
UIO: Add alignment warnings for uio-mem
Driver core: add bus_sort_breadthfirst() function
NET: convert the phy_device file to use bus_find_device_by_name
kobject: Cleanup kobject_rename and !CONFIG_SYSFS
kobject: Fix kobject_rename and !CONFIG_SYSFS
sysfs: Make dir and name args to sysfs_notify() const
platform: add new device registration helper
sysfs: use ilookup5() instead of ilookup5_nowait()
PNP: create device attributes via default device attributes
Driver core: make bus_find_device_by_name() more robust
usb: turn dev_warn+WARN_ON combos into dev_WARN
debug: use dev_WARN() rather than WARN_ON() in device_pm_add()
debug: Introduce a dev_WARN() function
sysfs: fix deadlock
device model: Do a quickcheck for driver binding before doing an expensive check
Driver core: Fix cleanup in device_create_vargs().
Driver core: Clarify device cleanup.
...
* 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/benh/powerpc: (158 commits)
powerpc: Fix CHRP PCI config access for indirect_pci
powerpc/chrp: Fix detection of Python PCI host bridge on IBM CHRPs
powerpc: Fix 32-bit SMP boot on CHRP
powerpc: Fix link errors on 32-bit machines using legacy DMA
powerpc/pci: Improve detection of unassigned bridge resources
hvc_console: Fix free_irq in spinlocked section
powerpc: Get USE_STRICT_MM_TYPECHECKS working again
powerpc: Reflect the used arguments in machine_init() prototype
powerpc: Fix DMA offset for non-coherent DMA
powerpc: fix fsl_upm nand driver modular build
powerpc/83xx: add NAND support for the MPC8360E-RDK boards
powerpc: FPGA support for GE Fanuc SBC610
i2c: MPC8349E-mITX Power Management and GPIO expander driver
powerpc: reserve two DMA channels for audio in MPC8610 HPCD device tree
powerpc: document the "fsl,ssi-dma-channel" compatible property
powerpc: disable CHRP and PMAC support in various defconfigs
OF: add fsl,mcu-mpc8349emitx to the exception list
powerpc/83xx: add DS1374 RTC support for the MPC837xE-MDS boards
powerpc: remove support for bootmem-allocated memory for the DIU driver
powerpc: remove non-dependent load fsl_booke PTE_64BIT
...
Add support for SMBus Process Call transactions. These are combined
word write, word read transactions.
Signed-off-by: Prakash Mortha <pmortha@escient.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Restore the i2c_smbus_process_call() as one driver (for the
Micronas MAP5401) will need it soon.
[JD: Update documentation accordingly.]
Signed-off-by: Prakash Mortha <pmortha@escient.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Move I2C driver model init earlier in the boot sequence.
This avoids oopsing in statically linked systems when some
subsystems register I2C drivers in subsys_initcall() code,
but those subsystems are linked (and initialized) before I2C.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The two Tyan SMBus mux drivers (i2c-amd756-s4882 and i2c-nforce2-s4985)
are only useful on specific x86 motherboards, so there is no point in
letting them be built on other architectures.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Guard I2C against oopsing because of init sequence problems, by
verifying that i2c_init() has been called before calling any
routines that rely on that initialization. This specific test
just requires that bus_register(&i2c_bus_type) was called.
Examples of this kind of oopsing come from subystems and drivers
which register I2C drivers in their subsys_initcall code but
which are statically linked before I2C by drivers/Makefile.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
The i2c-parport-light driver isn't a real platform driver, so it
should not instantiate platform devices with resources. The resource
management system can't cope with colliding resources, and we are
likely to create such a colliding resource.
So, better just try to grab the I/O ports we need right at module
initialization time, and bail out if we can't. It has the added
benefit that the module will no longer load if it isn't going to work,
which is definitely more user-friendly.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
All the tps6501{0,1,2,3,4} chips have a signal for hooking up with
a vibrator (for non-auditory cell phone "ring") ... expose that as
one more (output-only) GPIO.
[ dbrownell@users.sourceforge.net: comments; list tps65014 too ]
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Thanks to new datasheets published on http://linux.via.com.tw we can now add
support for VX800/VX820 chipsets.
Signed-off-by: Rudolf Marek <r.marek@assembler.cz>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
This adds support for the SMBus adapter found in the various FPGAs on
the Renesas Highlander platforms. Particularly the R0P7780LC0011RL and
R0P7785LC0011RL FPGAs.
Functionality is fairly restricted, in that only byte and block data
transfers are supported. Normal/fast mode and IRQ/polling are also
supported. Primarily used for various RTCs and thermal sensors.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Grabbing ISA bus resources without anything or anyone telling us we
should can break boot on randconfig/allyesconfig builds by keeping
resources that are in fact owned by different hardware busy and does
as reported by Ingo Molnar.
Generally it's also dangerous to just poke at random I/O ports and
especially those in the range where other old easily confused ISA
hardware might live.
For this specialized I2C bus driver, insist that the user specifies
the resources before grabbing them.
The^WA user of this driver is a one time
echo "options i2c-pca-isa base=0x330 irq=10" >> /etc/modprobe.conf
away from the old behaviour.
Signed-off-by: Rene Herman <rene.herman@gmail.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Based on David Brownell's patch for tps65010 and previous work by
Felipe Balbi, this patch finishes converting isp1301_omap to a
new-style i2c driver.
There's definitely room for further drivers cleanups, but these are
out of the scope of this patch.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Tony Lindgren <tony@atomide.com>
Based on David Brownell's patch for tps65010, this patch
starts converting isp1301_omap.c to new-style i2c driver.
Signed-off-by: Felipe Balbi <me@felipebalbi.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Tony Lindgren <tony@atomide.com>
On MPC8349E-mITX, MPC8315E-RDB and MPC837x-RDB boards there is a
Freescale MC9S08QG8 (MCU) chip with the custom firmware
pre-programmed. The chip is used to power-off the board by the
software, and to control some GPIO pins.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
* 'for-linus' of master.kernel.org:/home/rmk/linux-2.6-arm: (236 commits)
[ARM] 5300/1: fixup spitz reset during boot
[ARM] 5295/1: make ZONE_DMA optional
[ARM] 5239/1: Palm Zire 72 power management support
[ARM] 5298/1: Drop desc_handle_irq()
[ARM] 5297/1: [KS8695] Fix two compile-time warnings
[ARM] 5296/1: [KS8695] Replace macro's with trailing underscores.
[ARM] pxa: allow multi-machine PCMCIA builds
[ARM] pxa: add preliminary CPUFREQ support for PXA3xx
[ARM] pxa: add missing ACCR bit definitions to pxa3xx-regs.h
[ARM] pxa: rename cpu-pxa.c to cpufreq-pxa2xx.c
[ARM] pxa/zylonite: add support for USB OHCI
[ARM] ohci-pxa27x: use ioremap() and offset for register access
[ARM] ohci-pxa27x: introduce pxa27x_clear_otgph()
[ARM] ohci-pxa27x: use platform_get_{irq,resource} for the resource
[ARM] ohci-pxa27x: move OHCI controller specific registers into the driver
[ARM] ohci-pxa27x: introduce flags to avoid direct access to OHCI registers
[ARM] pxa: move I2S register and bit definitions into pxa2xx-i2s.c
[ARM] pxa: simplify DMA register definitions
[ARM] pxa: make additional DCSR bits valid for PXA3xx
[ARM] pxa: move i2c register and bit definitions into i2c-pxa.c
...
Fixed up conflicts in
arch/arm/mach-versatile/core.c
sound/soc/pxa/pxa2xx-ac97.c
sound/soc/pxa/pxa2xx-i2s.c
manually.
This patch suppresses I2C device probing by clearing the class field
of the "struct i2c_adapter" for the MPC I2C bus adapters. Some board
configurations which rely on probing must be fixed up by adding a
proper I2C device node to the DTS file, like the TQM85xx modules.
Signed-off-by: Wolfgang Grandegger <wg@grandegger.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Add fast_mode option to i2c_pxa_platform_data and use it to set the
ICR_FM bit appropriately when i2c_pxa_reset is called. Parameter
called fast_mode rather than frequency as this driver is also used
for the i2c_pxa_pwr bus which has different normal and fast frequencies.
Signed-off-by: Jonathan Cameron <jic23@cam.ac.uk>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
We need to convert the error pointer from class_create(), else we'll return the
successful return code from register_chrdev() on failure.
Signed-off-by: Sven Wegener <sven.wegener@stealer.net>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
__devexit for i2c_powermac_probe is obviously wrong. In the definition
of struct platform_driver i2c_powermac_driver the remove function
i2c_powermac_remove is wrapped in __devexit_p, so it should be defined
using __devexit.
Signed-off-by: Uwe Kleine-Koenig <ukleinek@informatik.uni-freiburg.de>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Now that arch/ppc is dead CONFIG_PPC_MERGE is always defined for all
powerpc platforms and we want to get rid of CONFIG_PPC_MERGE use
CONFIG_PPC instead.
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>