Hi Richard,
sorry for the late reply.
> > I'm curious if there have ever been any attempts to emulate i2c devices
> > under uml in order to facilitate driver development by using stub
> > drivers.
> I know none.
> If there is a use case, why not. :-)
Thanks for your encouraging words ;)
I had a look around and found the nice CONFIG_I2C_STUB driver,
which is described in detail at
http://www.kernel.org/doc/Documentation/i2c/i2c-stub
"""This module is a very simple fake I2C/SMBus driver. It implements five
types of SMBus commands: write quick, (r/w) byte, (r/w) byte data, (r/w)
word data, and (r/w) I2C block data."""
which more or less exactly fits my need.
The only thing that was missing was general support for I2C which is dependent
on CONFIG_HAS_IOMEM which unfortunately isn't available on UML,
but I simply added a || UML to the Kconfig and was now able to build the I2C
Support, the i2c-dev module (for userspace access) and the i2c-stub driver.
If I know load the i2c_stub module I have a emulated i2c device ;)
I adapted the stub driver to my needs and was now able to create my own
emulated i2c device and start with driver and tools development for it ;)
I added the patch, in case you're interested.
Unfortunately some I2C drivers fail to build if CONFIG_HAS_IOMEM = n, but
don't have that dependency in Kconfig - I simply added it to prevent them from
inclusion.
Do you think I should try to push this mainline via the i2c subsystem?
Thanks,
Peter
From 44d8ec6fa1466c226b605baae9483749ea9de200 Mon Sep 17 00:00:00 2001
From: Peter Huewe <peterhu...@gmx.de>
Date: Sun, 9 Sep 2012 03:03:29 +0200
Subject: [PATCH] i2c: Fix/Change dependencies to make I2C available on UML
This patch overwrites the HAS_IOMEM dependency for I2C on UML, as it is not
really necessary to have HAS_IOMEM in order build the generic I2C part.
In addition to that, every I2C modules available in UML which really
needs HAS_IOMEM was given this dependency to its KConfig.
The I2C subsystem can now be used, e.g. by the i2c-stub driver, for
development of I2C device drivers.
Signed-off-by: Peter Huewe <peterhu...@gmx.de>
---
drivers/i2c/Kconfig | 2 +-
drivers/i2c/busses/Kconfig | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/i2c/Kconfig b/drivers/i2c/Kconfig
index 5a3bb3d..03ce0cb 100644
--- a/drivers/i2c/Kconfig
+++ b/drivers/i2c/Kconfig
@@ -4,7 +4,7 @@
menuconfig I2C
tristate "I2C support"
- depends on HAS_IOMEM
+ depends on HAS_IOMEM || UML
select RT_MUTEXES
---help---
I2C (pronounce: I-squared-C) is a slow serial bus protocol used in
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index b4aaa1b..1e61ad9 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -498,7 +498,7 @@ config I2C_NUC900
config I2C_OCORES
tristate "OpenCores I2C Controller"
- depends on EXPERIMENTAL
+ depends on EXPERIMENTAL && HAS_IOMEM
help
If you say yes to this option, support will be included for the
OpenCores I2C controller. For details see
@@ -525,6 +525,7 @@ config I2C_PASEMI
config I2C_PCA_PLATFORM
tristate "PCA9564/PCA9665 as platform device"
+ depends on HAS_IOMEM
select I2C_ALGOPCA
default n
help
@@ -628,6 +629,7 @@ config I2C_SH_MOBILE
config I2C_SIMTEC
tristate "Simtec Generic I2C interface"
+ depends on HAS_IOMEM
select I2C_ALGOBIT
help
If you say yes to this option, support will be included for
@@ -772,7 +774,7 @@ config I2C_PARPORT_LIGHT
config I2C_TAOS_EVM
tristate "TAOS evaluation module"
- depends on EXPERIMENTAL
+ depends on EXPERIMENTAL && HAS_IOMEM
select SERIO
select SERIO_SERPORT
default n
--
1.7.8.6
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel