All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-07-12  9:57 ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown

Hello,

This series was tested on a Phytec pcm038 (mc13783 on spi) using
traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
i2c) using dt boot.

Philippe's patches are already in next, they are just included here for
those who want to test the patches. The 'mfd/mc13xxx: drop modifying
driver's id_table in probe' was already sent out yesterday and is
included here because the last patch depends on it.

Best regards
Uwe

Philippe Rétornaz (2):
  MFD: Fix mc13xxx SPI regmap
  MFD: mc13xxx workaround SPI hardware bug on i.Mx

Uwe Kleine-König (5):
  rtc/mc13xxx: use MODULE_DEVICE_TABLE instead of MODULE_ALIAS
  rtc/mc13xxx: add support for the rtc in the mc34708 pmic
  mfd/mc13xxx: drop modifying driver's id_table in probe
  mfd/mc13xxx: change probing details for mc13xxx devices
  mfd/mc13xxx: add support for mc34708

 drivers/mfd/mc13xxx-core.c |   94 ++++++++++++++++++++--------------------
 drivers/mfd/mc13xxx-i2c.c  |   28 ++++++------
 drivers/mfd/mc13xxx-spi.c  |  102 +++++++++++++++++++++++++++++++++++---------
 drivers/mfd/mc13xxx.h      |   18 +++++---
 drivers/rtc/rtc-mc13xxx.c  |    6 ++-
 5 files changed, 159 insertions(+), 89 deletions(-)

-- 
1.7.10.4


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-07-12  9:57 ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

This series was tested on a Phytec pcm038 (mc13783 on spi) using
traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
i2c) using dt boot.

Philippe's patches are already in next, they are just included here for
those who want to test the patches. The 'mfd/mc13xxx: drop modifying
driver's id_table in probe' was already sent out yesterday and is
included here because the last patch depends on it.

Best regards
Uwe

Philippe R?tornaz (2):
  MFD: Fix mc13xxx SPI regmap
  MFD: mc13xxx workaround SPI hardware bug on i.Mx

Uwe Kleine-K?nig (5):
  rtc/mc13xxx: use MODULE_DEVICE_TABLE instead of MODULE_ALIAS
  rtc/mc13xxx: add support for the rtc in the mc34708 pmic
  mfd/mc13xxx: drop modifying driver's id_table in probe
  mfd/mc13xxx: change probing details for mc13xxx devices
  mfd/mc13xxx: add support for mc34708

 drivers/mfd/mc13xxx-core.c |   94 ++++++++++++++++++++--------------------
 drivers/mfd/mc13xxx-i2c.c  |   28 ++++++------
 drivers/mfd/mc13xxx-spi.c  |  102 +++++++++++++++++++++++++++++++++++---------
 drivers/mfd/mc13xxx.h      |   18 +++++---
 drivers/rtc/rtc-mc13xxx.c  |    6 ++-
 5 files changed, 159 insertions(+), 89 deletions(-)

-- 
1.7.10.4

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 1/7] MFD: Fix mc13xxx SPI regmap
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown, Samuel Ortiz

From: Philippe Rétornaz <philippe.retornaz@epfl.ch>

This fix the SPI regmap configuration, the wrong write flag was used.
Also, bits_per_word should not be set as the regmap spi implementation
uses a 8bits transfert granularity.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Origin: next-20120712, commit:e4ecf6ea84d68aea5a9785e89f52672e1e126998
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-spi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 3fcdab3..5d1969f 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -49,6 +49,7 @@ static struct regmap_config mc13xxx_regmap_spi_config = {
 	.reg_bits = 7,
 	.pad_bits = 1,
 	.val_bits = 24,
+	.write_flag_mask = 0x80,
 
 	.max_register = MC13XXX_NUMREGS,
 
@@ -73,7 +74,6 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 
 	dev_set_drvdata(&spi->dev, mc13xxx);
 	spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
-	spi->bits_per_word = 32;
 
 	mc13xxx->dev = &spi->dev;
 	mutex_init(&mc13xxx->lock);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 1/7] MFD: Fix mc13xxx SPI regmap
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Philippe R?tornaz <philippe.retornaz@epfl.ch>

This fix the SPI regmap configuration, the wrong write flag was used.
Also, bits_per_word should not be set as the regmap spi implementation
uses a 8bits transfert granularity.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Origin: next-20120712, commit:e4ecf6ea84d68aea5a9785e89f52672e1e126998
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-spi.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 3fcdab3..5d1969f 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -49,6 +49,7 @@ static struct regmap_config mc13xxx_regmap_spi_config = {
 	.reg_bits = 7,
 	.pad_bits = 1,
 	.val_bits = 24,
+	.write_flag_mask = 0x80,
 
 	.max_register = MC13XXX_NUMREGS,
 
@@ -73,7 +74,6 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 
 	dev_set_drvdata(&spi->dev, mc13xxx);
 	spi->mode = SPI_MODE_0 | SPI_CS_HIGH;
-	spi->bits_per_word = 32;
 
 	mc13xxx->dev = &spi->dev;
 	mutex_init(&mc13xxx->lock);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 2/7] MFD: mc13xxx workaround SPI hardware bug on i.Mx
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown, Samuel Ortiz

From: Philippe Rétornaz <philippe.retornaz@epfl.ch>

The MC13xxx PMIC is mainly used on i.Mx SoC. On thoses SoC the SPI
hardware will deassert CS line as soon as the SPI FIFO is empty.
The MC13xxx hardware is very sensitive to CS line change as it
corrupts the transfert if CS is deasserted in the middle of a register
read or write.
It is not possible to use the CS line as a GPIO on some SoC, so we
need to workaround this by implementing a single SPI transfer to
access the PMIC.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Philippe Rétornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Origin: next-20120712, commit:e4ecf6ea84d68aea5a9785e89f52672e1e126998
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-spi.c |   65 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 5d1969f..03df422 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -54,6 +54,67 @@ static struct regmap_config mc13xxx_regmap_spi_config = {
 	.max_register = MC13XXX_NUMREGS,
 
 	.cache_type = REGCACHE_NONE,
+	.use_single_rw = 1,
+};
+
+static int mc13xxx_spi_read(void *context, const void *reg, size_t reg_size,
+				void *val, size_t val_size)
+{
+	unsigned char w[4] = { *((unsigned char *) reg), 0, 0, 0};
+	unsigned char r[4];
+	unsigned char *p = val;
+	struct device *dev = context;
+	struct spi_device *spi = to_spi_device(dev);
+	struct spi_transfer t = {
+		.tx_buf = w,
+		.rx_buf = r,
+		.len = 4,
+	};
+
+	struct spi_message m;
+	int ret;
+
+	if (val_size != 3 || reg_size != 1)
+		return -ENOTSUPP;
+
+	spi_message_init(&m);
+	spi_message_add_tail(&t, &m);
+	ret = spi_sync(spi, &m);
+
+	memcpy(p, &r[1], 3);
+
+	return ret;
+}
+
+static int mc13xxx_spi_write(void *context, const void *data, size_t count)
+{
+	struct device *dev = context;
+	struct spi_device *spi = to_spi_device(dev);
+
+	if (count != 4)
+		return -ENOTSUPP;
+
+	return spi_write(spi, data, count);
+}
+
+/*
+ * We cannot use regmap-spi generic bus implementation here.
+ * The MC13783 chip will get corrupted if CS signal is deasserted
+ * and on i.Mx31 SoC (the target SoC for MC13783 PMIC) the SPI controller
+ * has the following errata (DSPhl22960):
+ * "The CSPI negates SS when the FIFO becomes empty with
+ * SSCTL= 0. Software cannot guarantee that the FIFO will not
+ * drain because of higher priority interrupts and the
+ * non-realtime characteristics of the operating system. As a
+ * result, the SS will negate before all of the data has been
+ * transferred to/from the peripheral."
+ * We workaround this by accessing the SPI controller with a
+ * single transfert.
+ */
+
+static struct regmap_bus regmap_mc13xxx_bus = {
+	.write = mc13xxx_spi_write,
+	.read = mc13xxx_spi_read,
 };
 
 static int mc13xxx_spi_probe(struct spi_device *spi)
@@ -78,7 +139,9 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 	mc13xxx->dev = &spi->dev;
 	mutex_init(&mc13xxx->lock);
 
-	mc13xxx->regmap = regmap_init_spi(spi, &mc13xxx_regmap_spi_config);
+	mc13xxx->regmap = regmap_init(&spi->dev, &regmap_mc13xxx_bus, &spi->dev,
+					&mc13xxx_regmap_spi_config);
+
 	if (IS_ERR(mc13xxx->regmap)) {
 		ret = PTR_ERR(mc13xxx->regmap);
 		dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 2/7] MFD: mc13xxx workaround SPI hardware bug on i.Mx
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

From: Philippe R?tornaz <philippe.retornaz@epfl.ch>

The MC13xxx PMIC is mainly used on i.Mx SoC. On thoses SoC the SPI
hardware will deassert CS line as soon as the SPI FIFO is empty.
The MC13xxx hardware is very sensitive to CS line change as it
corrupts the transfert if CS is deasserted in the middle of a register
read or write.
It is not possible to use the CS line as a GPIO on some SoC, so we
need to workaround this by implementing a single SPI transfer to
access the PMIC.

Reviewed-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Marc Reilly <marc@cpdesign.com.au>
Signed-off-by: Philippe R?tornaz <philippe.retornaz@epfl.ch>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Origin: next-20120712, commit:e4ecf6ea84d68aea5a9785e89f52672e1e126998
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-spi.c |   65 ++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 64 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 5d1969f..03df422 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -54,6 +54,67 @@ static struct regmap_config mc13xxx_regmap_spi_config = {
 	.max_register = MC13XXX_NUMREGS,
 
 	.cache_type = REGCACHE_NONE,
+	.use_single_rw = 1,
+};
+
+static int mc13xxx_spi_read(void *context, const void *reg, size_t reg_size,
+				void *val, size_t val_size)
+{
+	unsigned char w[4] = { *((unsigned char *) reg), 0, 0, 0};
+	unsigned char r[4];
+	unsigned char *p = val;
+	struct device *dev = context;
+	struct spi_device *spi = to_spi_device(dev);
+	struct spi_transfer t = {
+		.tx_buf = w,
+		.rx_buf = r,
+		.len = 4,
+	};
+
+	struct spi_message m;
+	int ret;
+
+	if (val_size != 3 || reg_size != 1)
+		return -ENOTSUPP;
+
+	spi_message_init(&m);
+	spi_message_add_tail(&t, &m);
+	ret = spi_sync(spi, &m);
+
+	memcpy(p, &r[1], 3);
+
+	return ret;
+}
+
+static int mc13xxx_spi_write(void *context, const void *data, size_t count)
+{
+	struct device *dev = context;
+	struct spi_device *spi = to_spi_device(dev);
+
+	if (count != 4)
+		return -ENOTSUPP;
+
+	return spi_write(spi, data, count);
+}
+
+/*
+ * We cannot use regmap-spi generic bus implementation here.
+ * The MC13783 chip will get corrupted if CS signal is deasserted
+ * and on i.Mx31 SoC (the target SoC for MC13783 PMIC) the SPI controller
+ * has the following errata (DSPhl22960):
+ * "The CSPI negates SS when the FIFO becomes empty with
+ * SSCTL= 0. Software cannot guarantee that the FIFO will not
+ * drain because of higher priority interrupts and the
+ * non-realtime characteristics of the operating system. As a
+ * result, the SS will negate before all of the data has been
+ * transferred to/from the peripheral."
+ * We workaround this by accessing the SPI controller with a
+ * single transfert.
+ */
+
+static struct regmap_bus regmap_mc13xxx_bus = {
+	.write = mc13xxx_spi_write,
+	.read = mc13xxx_spi_read,
 };
 
 static int mc13xxx_spi_probe(struct spi_device *spi)
@@ -78,7 +139,9 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 	mc13xxx->dev = &spi->dev;
 	mutex_init(&mc13xxx->lock);
 
-	mc13xxx->regmap = regmap_init_spi(spi, &mc13xxx_regmap_spi_config);
+	mc13xxx->regmap = regmap_init(&spi->dev, &regmap_mc13xxx_bus, &spi->dev,
+					&mc13xxx_regmap_spi_config);
+
 	if (IS_ERR(mc13xxx->regmap)) {
 		ret = PTR_ERR(mc13xxx->regmap);
 		dev_err(mc13xxx->dev, "Failed to initialize register map: %d\n",
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 3/7] rtc/mc13xxx: use MODULE_DEVICE_TABLE instead of MODULE_ALIAS
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown,
	Alessandro Zummo, Andrew Morton, rtc-linux

This allows automatic driver loading for all supported device types.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: rtc-linux@googlegroups.com
---
 drivers/rtc/rtc-mc13xxx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 546f685..0ce0602 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -405,8 +405,9 @@ static const struct platform_device_id mc13xxx_rtc_idtable[] = {
 	}, {
 		.name = "mc13892-rtc",
 	},
-	{ }
+	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(platform, mc13xxx_rtc_idtable);
 
 static struct platform_driver mc13xxx_rtc_driver = {
 	.id_table = mc13xxx_rtc_idtable,
@@ -432,4 +433,3 @@ module_exit(mc13xxx_rtc_exit);
 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
 MODULE_DESCRIPTION("RTC driver for Freescale MC13XXX PMIC");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRIVER_NAME);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 3/7] rtc/mc13xxx: use MODULE_DEVICE_TABLE instead of MODULE_ALIAS
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

This allows automatic driver loading for all supported device types.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: rtc-linux at googlegroups.com
---
 drivers/rtc/rtc-mc13xxx.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 546f685..0ce0602 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -405,8 +405,9 @@ static const struct platform_device_id mc13xxx_rtc_idtable[] = {
 	}, {
 		.name = "mc13892-rtc",
 	},
-	{ }
+	{ /* sentinel */ }
 };
+MODULE_DEVICE_TABLE(platform, mc13xxx_rtc_idtable);
 
 static struct platform_driver mc13xxx_rtc_driver = {
 	.id_table = mc13xxx_rtc_idtable,
@@ -432,4 +433,3 @@ module_exit(mc13xxx_rtc_exit);
 MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
 MODULE_DESCRIPTION("RTC driver for Freescale MC13XXX PMIC");
 MODULE_LICENSE("GPL v2");
-MODULE_ALIAS("platform:" DRIVER_NAME);
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 4/7] rtc/mc13xxx: add support for the rtc in the mc34708 pmic
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown,
	Alessandro Zummo, Andrew Morton, rtc-linux

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: rtc-linux@googlegroups.com
---
 drivers/rtc/rtc-mc13xxx.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 0ce0602..2643d88 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -404,6 +404,8 @@ static const struct platform_device_id mc13xxx_rtc_idtable[] = {
 		.name = "mc13783-rtc",
 	}, {
 		.name = "mc13892-rtc",
+	}, {
+		.name = "mc34708-rtc",
 	},
 	{ /* sentinel */ }
 };
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 4/7] rtc/mc13xxx: add support for the rtc in the mc34708 pmic
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: rtc-linux at googlegroups.com
---
 drivers/rtc/rtc-mc13xxx.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/rtc/rtc-mc13xxx.c b/drivers/rtc/rtc-mc13xxx.c
index 0ce0602..2643d88 100644
--- a/drivers/rtc/rtc-mc13xxx.c
+++ b/drivers/rtc/rtc-mc13xxx.c
@@ -404,6 +404,8 @@ static const struct platform_device_id mc13xxx_rtc_idtable[] = {
 		.name = "mc13783-rtc",
 	}, {
 		.name = "mc13892-rtc",
+	}, {
+		.name = "mc34708-rtc",
 	},
 	{ /* sentinel */ }
 };
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 5/7] mfd/mc13xxx: drop modifying driver's id_table in probe
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown

This was introduced in commit

	876989d (mfd: Add device tree probe support for mc13xxx)

for spi and later while introducing support for i2c copied to the i2c
driver.

Modifying driver details is very strange, for example probing an
mc13892 device (instantiated via dt) removes the driver's ability to
handle (traditionally probed) mc13783 devices in this case.
I'm not aware of any problems that make this hack necessary and if
there were some, they have to be fixed in the spi/i2c core, not in
a driver.

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-i2c.c |    6 ------
 drivers/mfd/mc13xxx-spi.c |    6 ------
 2 files changed, 12 deletions(-)

diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index d22501d..e00e885 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -53,16 +53,10 @@ static struct regmap_config mc13xxx_regmap_i2c_config = {
 static int mc13xxx_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
-	const struct of_device_id *of_id;
-	struct i2c_driver *idrv = to_i2c_driver(client->dev.driver);
 	struct mc13xxx *mc13xxx;
 	struct mc13xxx_platform_data *pdata = dev_get_platdata(&client->dev);
 	int ret;
 
-	of_id = of_match_device(mc13xxx_dt_ids, &client->dev);
-	if (of_id)
-		idrv->id_table = (const struct i2c_device_id*) of_id->data;
-
 	mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
 	if (!mc13xxx)
 		return -ENOMEM;
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 03df422..b99e728 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -119,16 +119,10 @@ static struct regmap_bus regmap_mc13xxx_bus = {
 
 static int mc13xxx_spi_probe(struct spi_device *spi)
 {
-	const struct of_device_id *of_id;
-	struct spi_driver *sdrv = to_spi_driver(spi->dev.driver);
 	struct mc13xxx *mc13xxx;
 	struct mc13xxx_platform_data *pdata = dev_get_platdata(&spi->dev);
 	int ret;
 
-	of_id = of_match_device(mc13xxx_dt_ids, &spi->dev);
-	if (of_id)
-		sdrv->id_table = &mc13xxx_device_id[(enum mc13xxx_id) of_id->data];
-
 	mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
 	if (!mc13xxx)
 		return -ENOMEM;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 5/7] mfd/mc13xxx: drop modifying driver's id_table in probe
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

This was introduced in commit

	876989d (mfd: Add device tree probe support for mc13xxx)

for spi and later while introducing support for i2c copied to the i2c
driver.

Modifying driver details is very strange, for example probing an
mc13892 device (instantiated via dt) removes the driver's ability to
handle (traditionally probed) mc13783 devices in this case.
I'm not aware of any problems that make this hack necessary and if
there were some, they have to be fixed in the spi/i2c core, not in
a driver.

Acked-by: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-i2c.c |    6 ------
 drivers/mfd/mc13xxx-spi.c |    6 ------
 2 files changed, 12 deletions(-)

diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index d22501d..e00e885 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -53,16 +53,10 @@ static struct regmap_config mc13xxx_regmap_i2c_config = {
 static int mc13xxx_i2c_probe(struct i2c_client *client,
 		const struct i2c_device_id *id)
 {
-	const struct of_device_id *of_id;
-	struct i2c_driver *idrv = to_i2c_driver(client->dev.driver);
 	struct mc13xxx *mc13xxx;
 	struct mc13xxx_platform_data *pdata = dev_get_platdata(&client->dev);
 	int ret;
 
-	of_id = of_match_device(mc13xxx_dt_ids, &client->dev);
-	if (of_id)
-		idrv->id_table = (const struct i2c_device_id*) of_id->data;
-
 	mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
 	if (!mc13xxx)
 		return -ENOMEM;
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 03df422..b99e728 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -119,16 +119,10 @@ static struct regmap_bus regmap_mc13xxx_bus = {
 
 static int mc13xxx_spi_probe(struct spi_device *spi)
 {
-	const struct of_device_id *of_id;
-	struct spi_driver *sdrv = to_spi_driver(spi->dev.driver);
 	struct mc13xxx *mc13xxx;
 	struct mc13xxx_platform_data *pdata = dev_get_platdata(&spi->dev);
 	int ret;
 
-	of_id = of_match_device(mc13xxx_dt_ids, &spi->dev);
-	if (of_id)
-		sdrv->id_table = &mc13xxx_device_id[(enum mc13xxx_id) of_id->data];
-
 	mc13xxx = kzalloc(sizeof(*mc13xxx), GFP_KERNEL);
 	if (!mc13xxx)
 		return -ENOMEM;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 6/7] mfd/mc13xxx: change probing details for mc13xxx devices
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown

This removes auto-detection of which variant of mc13xxx is used because
mc34708 uses a different layout in the revision register that doesn't
allow differentiation any more.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-core.c |   77 ++++++++++++++++----------------------------
 drivers/mfd/mc13xxx-i2c.c  |   16 +++++----
 drivers/mfd/mc13xxx-spi.c  |   25 +++++++-------
 drivers/mfd/mc13xxx.h      |   17 ++++++----
 4 files changed, 60 insertions(+), 75 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index f0ea3b8..7874711 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -410,62 +410,36 @@ static irqreturn_t mc13xxx_irq_thread(int irq, void *data)
 	return IRQ_RETVAL(handled);
 }
 
-static const char *mc13xxx_chipname[] = {
-	[MC13XXX_ID_MC13783] = "mc13783",
-	[MC13XXX_ID_MC13892] = "mc13892",
-};
-
 #define maskval(reg, mask)	(((reg) & (mask)) >> __ffs(mask))
-static int mc13xxx_identify(struct mc13xxx *mc13xxx)
+static void mc13xxx_print_revision(struct mc13xxx *mc13xxx, u32 revision)
 {
-	u32 icid;
-	u32 revision;
-	int ret;
-
-	/*
-	 * Get the generation ID from register 46, as apparently some older
-	 * IC revisions only have this info at this location. Newer ICs seem to
-	 * have both.
-	 */
-	ret = mc13xxx_reg_read(mc13xxx, 46, &icid);
-	if (ret)
-		return ret;
-
-	icid = (icid >> 6) & 0x7;
-
-	switch (icid) {
-	case 2:
-		mc13xxx->ictype = MC13XXX_ID_MC13783;
-		break;
-	case 7:
-		mc13xxx->ictype = MC13XXX_ID_MC13892;
-		break;
-	default:
-		mc13xxx->ictype = MC13XXX_ID_INVALID;
-		break;
-	}
+	dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
+			"fin: %d, fab: %d, icid: %d/%d\n",
+			mc13xxx->variant->name,
+			maskval(revision, MC13XXX_REVISION_REVFULL),
+			maskval(revision, MC13XXX_REVISION_REVMETAL),
+			maskval(revision, MC13XXX_REVISION_FIN),
+			maskval(revision, MC13XXX_REVISION_FAB),
+			maskval(revision, MC13XXX_REVISION_ICID),
+			maskval(revision, MC13XXX_REVISION_ICIDCODE));
+}
 
-	if (mc13xxx->ictype == MC13XXX_ID_MC13783 ||
-			mc13xxx->ictype == MC13XXX_ID_MC13892) {
-		ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
-
-		dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
-				"fin: %d, fab: %d, icid: %d/%d\n",
-				mc13xxx_chipname[mc13xxx->ictype],
-				maskval(revision, MC13XXX_REVISION_REVFULL),
-				maskval(revision, MC13XXX_REVISION_REVMETAL),
-				maskval(revision, MC13XXX_REVISION_FIN),
-				maskval(revision, MC13XXX_REVISION_FAB),
-				maskval(revision, MC13XXX_REVISION_ICID),
-				maskval(revision, MC13XXX_REVISION_ICIDCODE));
-	}
+/* These are only exported for mc13xxx-i2c and mc13xxx-spi */
+struct mc13xxx_variant mc13xxx_variant_mc13783 = {
+	.name = "mc13783",
+	.print_revision = mc13xxx_print_revision,
+};
+EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
 
-	return (mc13xxx->ictype == MC13XXX_ID_INVALID) ? -ENODEV : 0;
-}
+struct mc13xxx_variant mc13xxx_variant_mc13892 = {
+	.name = "mc13892",
+	.print_revision = mc13xxx_print_revision,
+};
+EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
 
 static const char *mc13xxx_get_chipname(struct mc13xxx *mc13xxx)
 {
-	return mc13xxx_chipname[mc13xxx->ictype];
+	return mc13xxx->variant->name;
 }
 
 int mc13xxx_get_flags(struct mc13xxx *mc13xxx)
@@ -653,13 +627,16 @@ int mc13xxx_common_init(struct mc13xxx *mc13xxx,
 		struct mc13xxx_platform_data *pdata, int irq)
 {
 	int ret;
+	u32 revision;
 
 	mc13xxx_lock(mc13xxx);
 
-	ret = mc13xxx_identify(mc13xxx);
+	ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
 	if (ret)
 		goto err_revision;
 
+	mc13xxx_print_revision(mc13xxx, revision);
+
 	/* mask all irqs */
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK0, 0x00ffffff);
 	if (ret)
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index e00e885..6c1598c 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -24,7 +24,7 @@
 static const struct i2c_device_id mc13xxx_i2c_device_id[] = {
 	{
 		.name = "mc13892",
-		.driver_data = MC13XXX_ID_MC13892,
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
 		/* sentinel */
 	}
@@ -34,7 +34,7 @@ MODULE_DEVICE_TABLE(i2c, mc13xxx_i2c_device_id);
 static const struct of_device_id mc13xxx_dt_ids[] = {
 	{
 		.compatible = "fsl,mc13892",
-		.data = (void *) &mc13xxx_i2c_device_id[0],
+		.data = &mc13xxx_variant_mc13892,
 	}, {
 		/* sentinel */
 	}
@@ -76,11 +76,15 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
+	if (client->dev.of_node) {
+		const struct of_device_id *of_id =
+			of_match_device(mc13xxx_dt_ids, &client->dev);
+		mc13xxx->variant = of_id->data;
+	} else {
+		mc13xxx->variant = (void *)id->driver_data;
+	}
 
-	if (ret == 0 && (id->driver_data != mc13xxx->ictype))
-		dev_warn(mc13xxx->dev,
-				"device id doesn't match auto detection!\n");
+	ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
 
 	return ret;
 }
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index b99e728..75a00c4 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -28,10 +28,10 @@
 static const struct spi_device_id mc13xxx_device_id[] = {
 	{
 		.name = "mc13783",
-		.driver_data = MC13XXX_ID_MC13783,
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13783,
 	}, {
 		.name = "mc13892",
-		.driver_data = MC13XXX_ID_MC13892,
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
 		/* sentinel */
 	}
@@ -39,8 +39,8 @@ static const struct spi_device_id mc13xxx_device_id[] = {
 MODULE_DEVICE_TABLE(spi, mc13xxx_device_id);
 
 static const struct of_device_id mc13xxx_dt_ids[] = {
-	{ .compatible = "fsl,mc13783", .data = (void *) MC13XXX_ID_MC13783, },
-	{ .compatible = "fsl,mc13892", .data = (void *) MC13XXX_ID_MC13892, },
+	{ .compatible = "fsl,mc13783", .data = &mc13xxx_variant_mc13783, },
+	{ .compatible = "fsl,mc13892", .data = &mc13xxx_variant_mc13892, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);
@@ -145,19 +145,18 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	ret = mc13xxx_common_init(mc13xxx, pdata, spi->irq);
+	if (spi->dev.of_node) {
+		const struct of_device_id *of_id =
+			of_match_device(mc13xxx_dt_ids, &spi->dev);
 
-	if (ret) {
-		dev_set_drvdata(&spi->dev, NULL);
+		mc13xxx->variant = of_id->data;
 	} else {
-		const struct spi_device_id *devid =
-			spi_get_device_id(spi);
-		if (!devid || devid->driver_data != mc13xxx->ictype)
-			dev_warn(mc13xxx->dev,
-				"device id doesn't match auto detection!\n");
+		const struct spi_device_id *id_entry = spi_get_device_id(spi);
+
+		mc13xxx->variant = (void *)id_entry->driver_data;
 	}
 
-	return ret;
+	return mc13xxx_common_init(mc13xxx, pdata, spi->irq);
 }
 
 static int __devexit mc13xxx_spi_remove(struct spi_device *spi)
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index bbba06f..78bf4c3 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -13,19 +13,24 @@
 #include <linux/regmap.h>
 #include <linux/mfd/mc13xxx.h>
 
-enum mc13xxx_id {
-	MC13XXX_ID_MC13783,
-	MC13XXX_ID_MC13892,
-	MC13XXX_ID_INVALID,
+#define MC13XXX_NUMREGS 0x3f
+
+struct mc13xxx;
+
+struct mc13xxx_variant {
+	const char *name;
+	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
 };
 
-#define MC13XXX_NUMREGS 0x3f
+extern struct mc13xxx_variant
+		mc13xxx_variant_mc13783,
+		mc13xxx_variant_mc13892;
 
 struct mc13xxx {
 	struct regmap *regmap;
 
 	struct device *dev;
-	enum mc13xxx_id ictype;
+	const struct mc13xxx_variant *variant;
 
 	struct mutex lock;
 	int irq;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 6/7] mfd/mc13xxx: change probing details for mc13xxx devices
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

This removes auto-detection of which variant of mc13xxx is used because
mc34708 uses a different layout in the revision register that doesn't
allow differentiation any more.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-core.c |   77 ++++++++++++++++----------------------------
 drivers/mfd/mc13xxx-i2c.c  |   16 +++++----
 drivers/mfd/mc13xxx-spi.c  |   25 +++++++-------
 drivers/mfd/mc13xxx.h      |   17 ++++++----
 4 files changed, 60 insertions(+), 75 deletions(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index f0ea3b8..7874711 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -410,62 +410,36 @@ static irqreturn_t mc13xxx_irq_thread(int irq, void *data)
 	return IRQ_RETVAL(handled);
 }
 
-static const char *mc13xxx_chipname[] = {
-	[MC13XXX_ID_MC13783] = "mc13783",
-	[MC13XXX_ID_MC13892] = "mc13892",
-};
-
 #define maskval(reg, mask)	(((reg) & (mask)) >> __ffs(mask))
-static int mc13xxx_identify(struct mc13xxx *mc13xxx)
+static void mc13xxx_print_revision(struct mc13xxx *mc13xxx, u32 revision)
 {
-	u32 icid;
-	u32 revision;
-	int ret;
-
-	/*
-	 * Get the generation ID from register 46, as apparently some older
-	 * IC revisions only have this info at this location. Newer ICs seem to
-	 * have both.
-	 */
-	ret = mc13xxx_reg_read(mc13xxx, 46, &icid);
-	if (ret)
-		return ret;
-
-	icid = (icid >> 6) & 0x7;
-
-	switch (icid) {
-	case 2:
-		mc13xxx->ictype = MC13XXX_ID_MC13783;
-		break;
-	case 7:
-		mc13xxx->ictype = MC13XXX_ID_MC13892;
-		break;
-	default:
-		mc13xxx->ictype = MC13XXX_ID_INVALID;
-		break;
-	}
+	dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
+			"fin: %d, fab: %d, icid: %d/%d\n",
+			mc13xxx->variant->name,
+			maskval(revision, MC13XXX_REVISION_REVFULL),
+			maskval(revision, MC13XXX_REVISION_REVMETAL),
+			maskval(revision, MC13XXX_REVISION_FIN),
+			maskval(revision, MC13XXX_REVISION_FAB),
+			maskval(revision, MC13XXX_REVISION_ICID),
+			maskval(revision, MC13XXX_REVISION_ICIDCODE));
+}
 
-	if (mc13xxx->ictype == MC13XXX_ID_MC13783 ||
-			mc13xxx->ictype == MC13XXX_ID_MC13892) {
-		ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
-
-		dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
-				"fin: %d, fab: %d, icid: %d/%d\n",
-				mc13xxx_chipname[mc13xxx->ictype],
-				maskval(revision, MC13XXX_REVISION_REVFULL),
-				maskval(revision, MC13XXX_REVISION_REVMETAL),
-				maskval(revision, MC13XXX_REVISION_FIN),
-				maskval(revision, MC13XXX_REVISION_FAB),
-				maskval(revision, MC13XXX_REVISION_ICID),
-				maskval(revision, MC13XXX_REVISION_ICIDCODE));
-	}
+/* These are only exported for mc13xxx-i2c and mc13xxx-spi */
+struct mc13xxx_variant mc13xxx_variant_mc13783 = {
+	.name = "mc13783",
+	.print_revision = mc13xxx_print_revision,
+};
+EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
 
-	return (mc13xxx->ictype == MC13XXX_ID_INVALID) ? -ENODEV : 0;
-}
+struct mc13xxx_variant mc13xxx_variant_mc13892 = {
+	.name = "mc13892",
+	.print_revision = mc13xxx_print_revision,
+};
+EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
 
 static const char *mc13xxx_get_chipname(struct mc13xxx *mc13xxx)
 {
-	return mc13xxx_chipname[mc13xxx->ictype];
+	return mc13xxx->variant->name;
 }
 
 int mc13xxx_get_flags(struct mc13xxx *mc13xxx)
@@ -653,13 +627,16 @@ int mc13xxx_common_init(struct mc13xxx *mc13xxx,
 		struct mc13xxx_platform_data *pdata, int irq)
 {
 	int ret;
+	u32 revision;
 
 	mc13xxx_lock(mc13xxx);
 
-	ret = mc13xxx_identify(mc13xxx);
+	ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
 	if (ret)
 		goto err_revision;
 
+	mc13xxx_print_revision(mc13xxx, revision);
+
 	/* mask all irqs */
 	ret = mc13xxx_reg_write(mc13xxx, MC13XXX_IRQMASK0, 0x00ffffff);
 	if (ret)
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index e00e885..6c1598c 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -24,7 +24,7 @@
 static const struct i2c_device_id mc13xxx_i2c_device_id[] = {
 	{
 		.name = "mc13892",
-		.driver_data = MC13XXX_ID_MC13892,
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
 		/* sentinel */
 	}
@@ -34,7 +34,7 @@ MODULE_DEVICE_TABLE(i2c, mc13xxx_i2c_device_id);
 static const struct of_device_id mc13xxx_dt_ids[] = {
 	{
 		.compatible = "fsl,mc13892",
-		.data = (void *) &mc13xxx_i2c_device_id[0],
+		.data = &mc13xxx_variant_mc13892,
 	}, {
 		/* sentinel */
 	}
@@ -76,11 +76,15 @@ static int mc13xxx_i2c_probe(struct i2c_client *client,
 		return ret;
 	}
 
-	ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
+	if (client->dev.of_node) {
+		const struct of_device_id *of_id =
+			of_match_device(mc13xxx_dt_ids, &client->dev);
+		mc13xxx->variant = of_id->data;
+	} else {
+		mc13xxx->variant = (void *)id->driver_data;
+	}
 
-	if (ret == 0 && (id->driver_data != mc13xxx->ictype))
-		dev_warn(mc13xxx->dev,
-				"device id doesn't match auto detection!\n");
+	ret = mc13xxx_common_init(mc13xxx, pdata, client->irq);
 
 	return ret;
 }
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index b99e728..75a00c4 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -28,10 +28,10 @@
 static const struct spi_device_id mc13xxx_device_id[] = {
 	{
 		.name = "mc13783",
-		.driver_data = MC13XXX_ID_MC13783,
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13783,
 	}, {
 		.name = "mc13892",
-		.driver_data = MC13XXX_ID_MC13892,
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
 		/* sentinel */
 	}
@@ -39,8 +39,8 @@ static const struct spi_device_id mc13xxx_device_id[] = {
 MODULE_DEVICE_TABLE(spi, mc13xxx_device_id);
 
 static const struct of_device_id mc13xxx_dt_ids[] = {
-	{ .compatible = "fsl,mc13783", .data = (void *) MC13XXX_ID_MC13783, },
-	{ .compatible = "fsl,mc13892", .data = (void *) MC13XXX_ID_MC13892, },
+	{ .compatible = "fsl,mc13783", .data = &mc13xxx_variant_mc13783, },
+	{ .compatible = "fsl,mc13892", .data = &mc13xxx_variant_mc13892, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);
@@ -145,19 +145,18 @@ static int mc13xxx_spi_probe(struct spi_device *spi)
 		return ret;
 	}
 
-	ret = mc13xxx_common_init(mc13xxx, pdata, spi->irq);
+	if (spi->dev.of_node) {
+		const struct of_device_id *of_id =
+			of_match_device(mc13xxx_dt_ids, &spi->dev);
 
-	if (ret) {
-		dev_set_drvdata(&spi->dev, NULL);
+		mc13xxx->variant = of_id->data;
 	} else {
-		const struct spi_device_id *devid =
-			spi_get_device_id(spi);
-		if (!devid || devid->driver_data != mc13xxx->ictype)
-			dev_warn(mc13xxx->dev,
-				"device id doesn't match auto detection!\n");
+		const struct spi_device_id *id_entry = spi_get_device_id(spi);
+
+		mc13xxx->variant = (void *)id_entry->driver_data;
 	}
 
-	return ret;
+	return mc13xxx_common_init(mc13xxx, pdata, spi->irq);
 }
 
 static int __devexit mc13xxx_spi_remove(struct spi_device *spi)
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index bbba06f..78bf4c3 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -13,19 +13,24 @@
 #include <linux/regmap.h>
 #include <linux/mfd/mc13xxx.h>
 
-enum mc13xxx_id {
-	MC13XXX_ID_MC13783,
-	MC13XXX_ID_MC13892,
-	MC13XXX_ID_INVALID,
+#define MC13XXX_NUMREGS 0x3f
+
+struct mc13xxx;
+
+struct mc13xxx_variant {
+	const char *name;
+	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
 };
 
-#define MC13XXX_NUMREGS 0x3f
+extern struct mc13xxx_variant
+		mc13xxx_variant_mc13783,
+		mc13xxx_variant_mc13892;
 
 struct mc13xxx {
 	struct regmap *regmap;
 
 	struct device *dev;
-	enum mc13xxx_id ictype;
+	const struct mc13xxx_variant *variant;
 
 	struct mutex lock;
 	int irq;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 7/7] mfd/mc13xxx: add support for mc34708
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12  9:57   ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-core.c |   21 +++++++++++++++++++++
 drivers/mfd/mc13xxx-i2c.c  |    6 ++++++
 drivers/mfd/mc13xxx-spi.c  |    4 ++++
 drivers/mfd/mc13xxx.h      |    3 ++-
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 7874711..4ce3e1f 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -119,6 +119,11 @@
 #define MC13XXX_REVISION_FAB		(0x03 << 11)
 #define MC13XXX_REVISION_ICIDCODE	(0x3f << 13)
 
+#define MC34708_REVISION_REVMETAL	(0x07 <<  0)
+#define MC34708_REVISION_REVFULL	(0x07 <<  3)
+#define MC34708_REVISION_FIN		(0x07 <<  6)
+#define MC34708_REVISION_FAB		(0x07 <<  9)
+
 #define MC13XXX_ADC1		44
 #define MC13XXX_ADC1_ADEN		(1 << 0)
 #define MC13XXX_ADC1_RAND		(1 << 1)
@@ -424,6 +429,16 @@ static void mc13xxx_print_revision(struct mc13xxx *mc13xxx, u32 revision)
 			maskval(revision, MC13XXX_REVISION_ICIDCODE));
 }
 
+static void mc34708_print_revision(struct mc13xxx *mc13xxx, u32 revision)
+{
+	dev_info(mc13xxx->dev, "%s: rev %d.%d, fin: %d, fab: %d\n",
+			mc13xxx->variant->name,
+			maskval(revision, MC34708_REVISION_REVFULL),
+			maskval(revision, MC34708_REVISION_REVMETAL),
+			maskval(revision, MC34708_REVISION_FIN),
+			maskval(revision, MC34708_REVISION_FAB));
+}
+
 /* These are only exported for mc13xxx-i2c and mc13xxx-spi */
 struct mc13xxx_variant mc13xxx_variant_mc13783 = {
 	.name = "mc13783",
@@ -437,6 +452,12 @@ struct mc13xxx_variant mc13xxx_variant_mc13892 = {
 };
 EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
 
+struct mc13xxx_variant mc13xxx_variant_mc34708 = {
+	.name = "mc34708",
+	.print_revision = mc34708_print_revision,
+};
+EXPORT_SYMBOL_GPL(mc13xxx_variant_mc34708);
+
 static const char *mc13xxx_get_chipname(struct mc13xxx *mc13xxx)
 {
 	return mc13xxx->variant->name;
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 6c1598c..907abff 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -26,6 +26,9 @@ static const struct i2c_device_id mc13xxx_i2c_device_id[] = {
 		.name = "mc13892",
 		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
+		.name = "mc34708",
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc34708,
+	}, {
 		/* sentinel */
 	}
 };
@@ -36,6 +39,9 @@ static const struct of_device_id mc13xxx_dt_ids[] = {
 		.compatible = "fsl,mc13892",
 		.data = &mc13xxx_variant_mc13892,
 	}, {
+		.compatible = "fsl,mc34708",
+		.data = &mc13xxx_variant_mc34708,
+	}, {
 		/* sentinel */
 	}
 };
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 75a00c4..08a3bd9 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -33,6 +33,9 @@ static const struct spi_device_id mc13xxx_device_id[] = {
 		.name = "mc13892",
 		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
+		.name = "mc34708",
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc34708,
+	}, {
 		/* sentinel */
 	}
 };
@@ -41,6 +44,7 @@ MODULE_DEVICE_TABLE(spi, mc13xxx_device_id);
 static const struct of_device_id mc13xxx_dt_ids[] = {
 	{ .compatible = "fsl,mc13783", .data = &mc13xxx_variant_mc13783, },
 	{ .compatible = "fsl,mc13892", .data = &mc13xxx_variant_mc13892, },
+	{ .compatible = "fsl,mc34708", .data = &mc13xxx_variant_mc34708, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index 78bf4c3..460ec5c 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -24,7 +24,8 @@ struct mc13xxx_variant {
 
 extern struct mc13xxx_variant
 		mc13xxx_variant_mc13783,
-		mc13xxx_variant_mc13892;
+		mc13xxx_variant_mc13892,
+		mc13xxx_variant_mc34708;
 
 struct mc13xxx {
 	struct regmap *regmap;
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 37+ messages in thread

* [PATCH 7/7] mfd/mc13xxx: add support for mc34708
@ 2012-07-12  9:57   ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-12  9:57 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
 drivers/mfd/mc13xxx-core.c |   21 +++++++++++++++++++++
 drivers/mfd/mc13xxx-i2c.c  |    6 ++++++
 drivers/mfd/mc13xxx-spi.c  |    4 ++++
 drivers/mfd/mc13xxx.h      |    3 ++-
 4 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
index 7874711..4ce3e1f 100644
--- a/drivers/mfd/mc13xxx-core.c
+++ b/drivers/mfd/mc13xxx-core.c
@@ -119,6 +119,11 @@
 #define MC13XXX_REVISION_FAB		(0x03 << 11)
 #define MC13XXX_REVISION_ICIDCODE	(0x3f << 13)
 
+#define MC34708_REVISION_REVMETAL	(0x07 <<  0)
+#define MC34708_REVISION_REVFULL	(0x07 <<  3)
+#define MC34708_REVISION_FIN		(0x07 <<  6)
+#define MC34708_REVISION_FAB		(0x07 <<  9)
+
 #define MC13XXX_ADC1		44
 #define MC13XXX_ADC1_ADEN		(1 << 0)
 #define MC13XXX_ADC1_RAND		(1 << 1)
@@ -424,6 +429,16 @@ static void mc13xxx_print_revision(struct mc13xxx *mc13xxx, u32 revision)
 			maskval(revision, MC13XXX_REVISION_ICIDCODE));
 }
 
+static void mc34708_print_revision(struct mc13xxx *mc13xxx, u32 revision)
+{
+	dev_info(mc13xxx->dev, "%s: rev %d.%d, fin: %d, fab: %d\n",
+			mc13xxx->variant->name,
+			maskval(revision, MC34708_REVISION_REVFULL),
+			maskval(revision, MC34708_REVISION_REVMETAL),
+			maskval(revision, MC34708_REVISION_FIN),
+			maskval(revision, MC34708_REVISION_FAB));
+}
+
 /* These are only exported for mc13xxx-i2c and mc13xxx-spi */
 struct mc13xxx_variant mc13xxx_variant_mc13783 = {
 	.name = "mc13783",
@@ -437,6 +452,12 @@ struct mc13xxx_variant mc13xxx_variant_mc13892 = {
 };
 EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
 
+struct mc13xxx_variant mc13xxx_variant_mc34708 = {
+	.name = "mc34708",
+	.print_revision = mc34708_print_revision,
+};
+EXPORT_SYMBOL_GPL(mc13xxx_variant_mc34708);
+
 static const char *mc13xxx_get_chipname(struct mc13xxx *mc13xxx)
 {
 	return mc13xxx->variant->name;
diff --git a/drivers/mfd/mc13xxx-i2c.c b/drivers/mfd/mc13xxx-i2c.c
index 6c1598c..907abff 100644
--- a/drivers/mfd/mc13xxx-i2c.c
+++ b/drivers/mfd/mc13xxx-i2c.c
@@ -26,6 +26,9 @@ static const struct i2c_device_id mc13xxx_i2c_device_id[] = {
 		.name = "mc13892",
 		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
+		.name = "mc34708",
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc34708,
+	}, {
 		/* sentinel */
 	}
 };
@@ -36,6 +39,9 @@ static const struct of_device_id mc13xxx_dt_ids[] = {
 		.compatible = "fsl,mc13892",
 		.data = &mc13xxx_variant_mc13892,
 	}, {
+		.compatible = "fsl,mc34708",
+		.data = &mc13xxx_variant_mc34708,
+	}, {
 		/* sentinel */
 	}
 };
diff --git a/drivers/mfd/mc13xxx-spi.c b/drivers/mfd/mc13xxx-spi.c
index 75a00c4..08a3bd9 100644
--- a/drivers/mfd/mc13xxx-spi.c
+++ b/drivers/mfd/mc13xxx-spi.c
@@ -33,6 +33,9 @@ static const struct spi_device_id mc13xxx_device_id[] = {
 		.name = "mc13892",
 		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc13892,
 	}, {
+		.name = "mc34708",
+		.driver_data = (kernel_ulong_t)&mc13xxx_variant_mc34708,
+	}, {
 		/* sentinel */
 	}
 };
@@ -41,6 +44,7 @@ MODULE_DEVICE_TABLE(spi, mc13xxx_device_id);
 static const struct of_device_id mc13xxx_dt_ids[] = {
 	{ .compatible = "fsl,mc13783", .data = &mc13xxx_variant_mc13783, },
 	{ .compatible = "fsl,mc13892", .data = &mc13xxx_variant_mc13892, },
+	{ .compatible = "fsl,mc34708", .data = &mc13xxx_variant_mc34708, },
 	{ /* sentinel */ }
 };
 MODULE_DEVICE_TABLE(of, mc13xxx_dt_ids);
diff --git a/drivers/mfd/mc13xxx.h b/drivers/mfd/mc13xxx.h
index 78bf4c3..460ec5c 100644
--- a/drivers/mfd/mc13xxx.h
+++ b/drivers/mfd/mc13xxx.h
@@ -24,7 +24,8 @@ struct mc13xxx_variant {
 
 extern struct mc13xxx_variant
 		mc13xxx_variant_mc13783,
-		mc13xxx_variant_mc13892;
+		mc13xxx_variant_mc13892,
+		mc13xxx_variant_mc34708;
 
 struct mc13xxx {
 	struct regmap *regmap;
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-07-12 23:02   ` Marc Reilly
  -1 siblings, 0 replies; 37+ messages in thread
From: Marc Reilly @ 2012-07-12 23:02 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Uwe Kleine-König, Samuel Ortiz, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Philippe Rétornaz

Hi Uwe,

> This series was tested on a Phytec pcm038 (mc13783 on spi) using
> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> i2c) using dt boot.
> 
> Philippe's patches are already in next, they are just included here for
> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> driver's id_table in probe' was already sent out yesterday and is
> included here because the last patch depends on it.
> 

For all patches (that don't already have it):
Acked-by: Marc Reilly <marc@cpdesign.com.au>

If for some reason you do a V2:
- In patch 6 moves line "#define MC13XXX_NUMREGS 0x3f" around, is this 
necessary?
- Patch 4 should come last, ie after "add support for mc34708"

Cheers,
Marc

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-07-12 23:02   ` Marc Reilly
  0 siblings, 0 replies; 37+ messages in thread
From: Marc Reilly @ 2012-07-12 23:02 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Uwe,

> This series was tested on a Phytec pcm038 (mc13783 on spi) using
> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> i2c) using dt boot.
> 
> Philippe's patches are already in next, they are just included here for
> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> driver's id_table in probe' was already sent out yesterday and is
> included here because the last patch depends on it.
> 

For all patches (that don't already have it):
Acked-by: Marc Reilly <marc@cpdesign.com.au>

If for some reason you do a V2:
- In patch 6 moves line "#define MC13XXX_NUMREGS 0x3f" around, is this 
necessary?
- Patch 4 should come last, ie after "add support for mc34708"

Cheers,
Marc

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-07-12 23:02   ` Marc Reilly
@ 2012-07-13  8:48     ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-13  8:48 UTC (permalink / raw)
  To: Marc Reilly
  Cc: linux-arm-kernel, Samuel Ortiz, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Philippe Rétornaz, git

Hello,

[I added git@vger.k.o to Cc: please strip the recipents accordingly if
you reply.]

On Fri, Jul 13, 2012 at 09:02:56AM +1000, Marc Reilly wrote:
> Hi Uwe,
> 
> > This series was tested on a Phytec pcm038 (mc13783 on spi) using
> > traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> > i2c) using dt boot.
> > 
> > Philippe's patches are already in next, they are just included here for
> > those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> > driver's id_table in probe' was already sent out yesterday and is
> > included here because the last patch depends on it.
> > 
> 
> For all patches (that don't already have it):
> Acked-by: Marc Reilly <marc@cpdesign.com.au>
Thanks.

> If for some reason you do a V2:
> - In patch 6 moves line "#define MC13XXX_NUMREGS 0x3f" around, is this 
> necessary?
It doesn't move it around, that's only how it looks. I removed enum
mc13xxx_id (above MC13XXX_NUMREGS) and added struct mc13xxx_variant
(below MC13XXX_NUMREGS). Git choosed to use the closing brace of enum
mc13xxx_id and struct mc13xxx_variant respectively as context (together
with the following empty line).
(For the new readers, here is how git represented the relevant part:

 #include <linux/regmap.h>
 #include <linux/mfd/mc13xxx.h>

-enum mc13xxx_id {
-	MC13XXX_ID_MC13783,
-	MC13XXX_ID_MC13892,
-	MC13XXX_ID_INVALID,
+#define MC13XXX_NUMREGS 0x3f
+
+struct mc13xxx;
+
+struct mc13xxx_variant {
+	const char *name;
+	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
 };

-#define MC13XXX_NUMREGS 0x3f
+extern struct mc13xxx_variant
+		mc13xxx_variant_mc13783,
+		mc13xxx_variant_mc13892;

 struct mc13xxx {
 	struct regmap *regmap;
...
)

The following would be an equivalent and (for humans) easier to review
patch:

 #include <linux/regmap.h>
 #include <linux/mfd/mc13xxx.h>

-enum mc13xxx_id {
-	MC13XXX_ID_MC13783,
-	MC13XXX_ID_MC13892,
-	MC13XXX_ID_INVALID,
-};
-
 #define MC13XXX_NUMREGS 0x3f

+struct mc13xxx;
+
+struct mc13xxx_variant {
+	const char *name;
+	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
+};
+
+extern struct mc13xxx_variant
+		mc13xxx_variant_mc13783,
+		mc13xxx_variant_mc13892;
+
 struct mc13xxx {
 	struct regmap *regmap;
...

But as this touches 17 lines compared to only 15 using the way git
choosed to represent patch 6, git used the smaller representation. (I'm
not sure this is the correct reason, but at least it sounds sensible.)
Usually this metric is sane, but here it's not. I don't know if you can
do anything about it? E.g. take the number of +, - and context blocks
into account. Then it would be 5 for the patch above vs. 7 for the
way git did it.
Or weight a context line containing

	#define MC13XXX_NUMREGS 0x3f

more than two lines one of which is empty and the other only contains a
}?

> - Patch 4 should come last, ie after "add support for mc34708"
Yeah, but it doesn't break bisectibility, and as the rtc patches go in via a
different tree (in fact akpm already took them) it doesn't matter much.

Best regards and thanks for your feedback
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-07-13  8:48     ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-13  8:48 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

[I added git at vger.k.o to Cc: please strip the recipents accordingly if
you reply.]

On Fri, Jul 13, 2012 at 09:02:56AM +1000, Marc Reilly wrote:
> Hi Uwe,
> 
> > This series was tested on a Phytec pcm038 (mc13783 on spi) using
> > traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> > i2c) using dt boot.
> > 
> > Philippe's patches are already in next, they are just included here for
> > those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> > driver's id_table in probe' was already sent out yesterday and is
> > included here because the last patch depends on it.
> > 
> 
> For all patches (that don't already have it):
> Acked-by: Marc Reilly <marc@cpdesign.com.au>
Thanks.

> If for some reason you do a V2:
> - In patch 6 moves line "#define MC13XXX_NUMREGS 0x3f" around, is this 
> necessary?
It doesn't move it around, that's only how it looks. I removed enum
mc13xxx_id (above MC13XXX_NUMREGS) and added struct mc13xxx_variant
(below MC13XXX_NUMREGS). Git choosed to use the closing brace of enum
mc13xxx_id and struct mc13xxx_variant respectively as context (together
with the following empty line).
(For the new readers, here is how git represented the relevant part:

 #include <linux/regmap.h>
 #include <linux/mfd/mc13xxx.h>

-enum mc13xxx_id {
-	MC13XXX_ID_MC13783,
-	MC13XXX_ID_MC13892,
-	MC13XXX_ID_INVALID,
+#define MC13XXX_NUMREGS 0x3f
+
+struct mc13xxx;
+
+struct mc13xxx_variant {
+	const char *name;
+	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
 };

-#define MC13XXX_NUMREGS 0x3f
+extern struct mc13xxx_variant
+		mc13xxx_variant_mc13783,
+		mc13xxx_variant_mc13892;

 struct mc13xxx {
 	struct regmap *regmap;
...
)

The following would be an equivalent and (for humans) easier to review
patch:

 #include <linux/regmap.h>
 #include <linux/mfd/mc13xxx.h>

-enum mc13xxx_id {
-	MC13XXX_ID_MC13783,
-	MC13XXX_ID_MC13892,
-	MC13XXX_ID_INVALID,
-};
-
 #define MC13XXX_NUMREGS 0x3f

+struct mc13xxx;
+
+struct mc13xxx_variant {
+	const char *name;
+	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
+};
+
+extern struct mc13xxx_variant
+		mc13xxx_variant_mc13783,
+		mc13xxx_variant_mc13892;
+
 struct mc13xxx {
 	struct regmap *regmap;
...

But as this touches 17 lines compared to only 15 using the way git
choosed to represent patch 6, git used the smaller representation. (I'm
not sure this is the correct reason, but at least it sounds sensible.)
Usually this metric is sane, but here it's not. I don't know if you can
do anything about it? E.g. take the number of +, - and context blocks
into account. Then it would be 5 for the patch above vs. 7 for the
way git did it.
Or weight a context line containing

	#define MC13XXX_NUMREGS 0x3f

more than two lines one of which is empty and the other only contains a
}?

> - Patch 4 should come last, ie after "add support for mc34708"
Yeah, but it doesn't break bisectibility, and as the rtc patches go in via a
different tree (in fact akpm already took them) it doesn't matter much.

Best regards and thanks for your feedback
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 6/7] mfd/mc13xxx: change probing details for mc13xxx devices
  2012-07-12  9:57   ` Uwe Kleine-König
@ 2012-07-13 15:22     ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-13 15:22 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: kernel, linux-arm-kernel, linux-kernel, Ying-Chun Liu (PaulLiu),
	Philippe Rétornaz, Marc Reilly, Mark Brown

On Thu, Jul 12, 2012 at 11:57:52AM +0200, Uwe Kleine-König wrote:
> This removes auto-detection of which variant of mc13xxx is used because
> mc34708 uses a different layout in the revision register that doesn't
> allow differentiation any more.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/mfd/mc13xxx-core.c |   77 ++++++++++++++++----------------------------
>  drivers/mfd/mc13xxx-i2c.c  |   16 +++++----
>  drivers/mfd/mc13xxx-spi.c  |   25 +++++++-------
>  drivers/mfd/mc13xxx.h      |   17 ++++++----
>  4 files changed, 60 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index f0ea3b8..7874711 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -410,62 +410,36 @@ static irqreturn_t mc13xxx_irq_thread(int irq, void *data)
>  	return IRQ_RETVAL(handled);
>  }
>  
> -static const char *mc13xxx_chipname[] = {
> -	[MC13XXX_ID_MC13783] = "mc13783",
> -	[MC13XXX_ID_MC13892] = "mc13892",
> -};
> -
>  #define maskval(reg, mask)	(((reg) & (mask)) >> __ffs(mask))
> -static int mc13xxx_identify(struct mc13xxx *mc13xxx)
> +static void mc13xxx_print_revision(struct mc13xxx *mc13xxx, u32 revision)
>  {
> -	u32 icid;
> -	u32 revision;
> -	int ret;
> -
> -	/*
> -	 * Get the generation ID from register 46, as apparently some older
> -	 * IC revisions only have this info at this location. Newer ICs seem to
> -	 * have both.
> -	 */
> -	ret = mc13xxx_reg_read(mc13xxx, 46, &icid);
> -	if (ret)
> -		return ret;
> -
> -	icid = (icid >> 6) & 0x7;
> -
> -	switch (icid) {
> -	case 2:
> -		mc13xxx->ictype = MC13XXX_ID_MC13783;
> -		break;
> -	case 7:
> -		mc13xxx->ictype = MC13XXX_ID_MC13892;
> -		break;
> -	default:
> -		mc13xxx->ictype = MC13XXX_ID_INVALID;
> -		break;
> -	}
> +	dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
> +			"fin: %d, fab: %d, icid: %d/%d\n",
> +			mc13xxx->variant->name,
> +			maskval(revision, MC13XXX_REVISION_REVFULL),
> +			maskval(revision, MC13XXX_REVISION_REVMETAL),
> +			maskval(revision, MC13XXX_REVISION_FIN),
> +			maskval(revision, MC13XXX_REVISION_FAB),
> +			maskval(revision, MC13XXX_REVISION_ICID),
> +			maskval(revision, MC13XXX_REVISION_ICIDCODE));
> +}
>  
> -	if (mc13xxx->ictype == MC13XXX_ID_MC13783 ||
> -			mc13xxx->ictype == MC13XXX_ID_MC13892) {
> -		ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
> -
> -		dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
> -				"fin: %d, fab: %d, icid: %d/%d\n",
> -				mc13xxx_chipname[mc13xxx->ictype],
> -				maskval(revision, MC13XXX_REVISION_REVFULL),
> -				maskval(revision, MC13XXX_REVISION_REVMETAL),
> -				maskval(revision, MC13XXX_REVISION_FIN),
> -				maskval(revision, MC13XXX_REVISION_FAB),
> -				maskval(revision, MC13XXX_REVISION_ICID),
> -				maskval(revision, MC13XXX_REVISION_ICIDCODE));
> -	}
> +/* These are only exported for mc13xxx-i2c and mc13xxx-spi */
> +struct mc13xxx_variant mc13xxx_variant_mc13783 = {
> +	.name = "mc13783",
> +	.print_revision = mc13xxx_print_revision,
> +};
> +EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
>  
> -	return (mc13xxx->ictype == MC13XXX_ID_INVALID) ? -ENODEV : 0;
> -}
> +struct mc13xxx_variant mc13xxx_variant_mc13892 = {
> +	.name = "mc13892",
> +	.print_revision = mc13xxx_print_revision,
> +};
> +EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
>  
>  static const char *mc13xxx_get_chipname(struct mc13xxx *mc13xxx)
>  {
> -	return mc13xxx_chipname[mc13xxx->ictype];
> +	return mc13xxx->variant->name;
>  }
>  
>  int mc13xxx_get_flags(struct mc13xxx *mc13xxx)
> @@ -653,13 +627,16 @@ int mc13xxx_common_init(struct mc13xxx *mc13xxx,
>  		struct mc13xxx_platform_data *pdata, int irq)
>  {
>  	int ret;
> +	u32 revision;
>  
>  	mc13xxx_lock(mc13xxx);
>  
> -	ret = mc13xxx_identify(mc13xxx);
> +	ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
>  	if (ret)
>  		goto err_revision;
>  
> +	mc13xxx_print_revision(mc13xxx, revision);
This must read:

	mc13xxx->variant->print_revision(mc13xxx, revision);

I fixed that in my tree, Samuel, please tell me if I should resend or if
you can fix that up.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 6/7] mfd/mc13xxx: change probing details for mc13xxx devices
@ 2012-07-13 15:22     ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-07-13 15:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jul 12, 2012 at 11:57:52AM +0200, Uwe Kleine-K?nig wrote:
> This removes auto-detection of which variant of mc13xxx is used because
> mc34708 uses a different layout in the revision register that doesn't
> allow differentiation any more.
> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
>  drivers/mfd/mc13xxx-core.c |   77 ++++++++++++++++----------------------------
>  drivers/mfd/mc13xxx-i2c.c  |   16 +++++----
>  drivers/mfd/mc13xxx-spi.c  |   25 +++++++-------
>  drivers/mfd/mc13xxx.h      |   17 ++++++----
>  4 files changed, 60 insertions(+), 75 deletions(-)
> 
> diff --git a/drivers/mfd/mc13xxx-core.c b/drivers/mfd/mc13xxx-core.c
> index f0ea3b8..7874711 100644
> --- a/drivers/mfd/mc13xxx-core.c
> +++ b/drivers/mfd/mc13xxx-core.c
> @@ -410,62 +410,36 @@ static irqreturn_t mc13xxx_irq_thread(int irq, void *data)
>  	return IRQ_RETVAL(handled);
>  }
>  
> -static const char *mc13xxx_chipname[] = {
> -	[MC13XXX_ID_MC13783] = "mc13783",
> -	[MC13XXX_ID_MC13892] = "mc13892",
> -};
> -
>  #define maskval(reg, mask)	(((reg) & (mask)) >> __ffs(mask))
> -static int mc13xxx_identify(struct mc13xxx *mc13xxx)
> +static void mc13xxx_print_revision(struct mc13xxx *mc13xxx, u32 revision)
>  {
> -	u32 icid;
> -	u32 revision;
> -	int ret;
> -
> -	/*
> -	 * Get the generation ID from register 46, as apparently some older
> -	 * IC revisions only have this info at this location. Newer ICs seem to
> -	 * have both.
> -	 */
> -	ret = mc13xxx_reg_read(mc13xxx, 46, &icid);
> -	if (ret)
> -		return ret;
> -
> -	icid = (icid >> 6) & 0x7;
> -
> -	switch (icid) {
> -	case 2:
> -		mc13xxx->ictype = MC13XXX_ID_MC13783;
> -		break;
> -	case 7:
> -		mc13xxx->ictype = MC13XXX_ID_MC13892;
> -		break;
> -	default:
> -		mc13xxx->ictype = MC13XXX_ID_INVALID;
> -		break;
> -	}
> +	dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
> +			"fin: %d, fab: %d, icid: %d/%d\n",
> +			mc13xxx->variant->name,
> +			maskval(revision, MC13XXX_REVISION_REVFULL),
> +			maskval(revision, MC13XXX_REVISION_REVMETAL),
> +			maskval(revision, MC13XXX_REVISION_FIN),
> +			maskval(revision, MC13XXX_REVISION_FAB),
> +			maskval(revision, MC13XXX_REVISION_ICID),
> +			maskval(revision, MC13XXX_REVISION_ICIDCODE));
> +}
>  
> -	if (mc13xxx->ictype == MC13XXX_ID_MC13783 ||
> -			mc13xxx->ictype == MC13XXX_ID_MC13892) {
> -		ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
> -
> -		dev_info(mc13xxx->dev, "%s: rev: %d.%d, "
> -				"fin: %d, fab: %d, icid: %d/%d\n",
> -				mc13xxx_chipname[mc13xxx->ictype],
> -				maskval(revision, MC13XXX_REVISION_REVFULL),
> -				maskval(revision, MC13XXX_REVISION_REVMETAL),
> -				maskval(revision, MC13XXX_REVISION_FIN),
> -				maskval(revision, MC13XXX_REVISION_FAB),
> -				maskval(revision, MC13XXX_REVISION_ICID),
> -				maskval(revision, MC13XXX_REVISION_ICIDCODE));
> -	}
> +/* These are only exported for mc13xxx-i2c and mc13xxx-spi */
> +struct mc13xxx_variant mc13xxx_variant_mc13783 = {
> +	.name = "mc13783",
> +	.print_revision = mc13xxx_print_revision,
> +};
> +EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13783);
>  
> -	return (mc13xxx->ictype == MC13XXX_ID_INVALID) ? -ENODEV : 0;
> -}
> +struct mc13xxx_variant mc13xxx_variant_mc13892 = {
> +	.name = "mc13892",
> +	.print_revision = mc13xxx_print_revision,
> +};
> +EXPORT_SYMBOL_GPL(mc13xxx_variant_mc13892);
>  
>  static const char *mc13xxx_get_chipname(struct mc13xxx *mc13xxx)
>  {
> -	return mc13xxx_chipname[mc13xxx->ictype];
> +	return mc13xxx->variant->name;
>  }
>  
>  int mc13xxx_get_flags(struct mc13xxx *mc13xxx)
> @@ -653,13 +627,16 @@ int mc13xxx_common_init(struct mc13xxx *mc13xxx,
>  		struct mc13xxx_platform_data *pdata, int irq)
>  {
>  	int ret;
> +	u32 revision;
>  
>  	mc13xxx_lock(mc13xxx);
>  
> -	ret = mc13xxx_identify(mc13xxx);
> +	ret = mc13xxx_reg_read(mc13xxx, MC13XXX_REVISION, &revision);
>  	if (ret)
>  		goto err_revision;
>  
> +	mc13xxx_print_revision(mc13xxx, revision);
This must read:

	mc13xxx->variant->print_revision(mc13xxx, revision);

I fixed that in my tree, Samuel, please tell me if I should resend or if
you can fix that up.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-07-13  8:48     ` Uwe Kleine-König
  (?)
@ 2012-07-13 19:39     ` Junio C Hamano
  -1 siblings, 0 replies; 37+ messages in thread
From: Junio C Hamano @ 2012-07-13 19:39 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Marc Reilly, linux-arm-kernel, Samuel Ortiz,
	Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Philippe Rétornaz, git

Uwe Kleine-König  <u.kleine-koenig@pengutronix.de> writes:

> It doesn't move it around, that's only how it looks. I removed enum
> mc13xxx_id (above MC13XXX_NUMREGS) and added struct mc13xxx_variant
> (below MC13XXX_NUMREGS). Git choosed to use the closing brace of enum
> mc13xxx_id and struct mc13xxx_variant respectively as context (together
> with the following empty line).
> (For the new readers, here is how git represented the relevant part:
>
>  #include <linux/regmap.h>
>  #include <linux/mfd/mc13xxx.h>
>
> -enum mc13xxx_id {
> -	MC13XXX_ID_MC13783,
> -	MC13XXX_ID_MC13892,
> -	MC13XXX_ID_INVALID,
> +#define MC13XXX_NUMREGS 0x3f
> +
> +struct mc13xxx;
> +
> +struct mc13xxx_variant {
> +	const char *name;
> +	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
>  };
>
> -#define MC13XXX_NUMREGS 0x3f
> +extern struct mc13xxx_variant
> +		mc13xxx_variant_mc13783,
> +		mc13xxx_variant_mc13892;
>
>  struct mc13xxx {
>  	struct regmap *regmap;
> ...
> )
>
> The following would be an equivalent and (for humans) easier to review
> patch:
>
>  #include <linux/regmap.h>
>  #include <linux/mfd/mc13xxx.h>
>
> -enum mc13xxx_id {
> -	MC13XXX_ID_MC13783,
> -	MC13XXX_ID_MC13892,
> -	MC13XXX_ID_INVALID,
> -};
> -
>  #define MC13XXX_NUMREGS 0x3f
>
> +struct mc13xxx;
> +
> +struct mc13xxx_variant {
> +	const char *name;
> +	void (*print_revision)(struct mc13xxx *mc13xxx, u32 revision);
> +};
> +
> +extern struct mc13xxx_variant
> +		mc13xxx_variant_mc13783,
> +		mc13xxx_variant_mc13892;
> +
>  struct mc13xxx {
>  	struct regmap *regmap;
> ...
>
> But as this touches 17 lines compared to only 15 using the way git
> choosed to represent patch 6, git used the smaller representation.

Yes.  Useful information bits per line count is the primary thing
our default xdiff based output pays attention to (e.g. we coalesce
two adjacent hunks that are one missing context line apart into one
larger hunk by removing the "@@ linenum @@" line from the beginning
of the latter hunk for this reason).

> Usually this metric is sane, but here it's not. I don't know if you can
> do anything about it? E.g. take the number of +, - and context blocks
> into account. Then it would be 5 for the patch above vs. 7 for the
> way git did it.
> Or weight a context line containing
>
> 	#define MC13XXX_NUMREGS 0x3f
>
> more than two lines one of which is empty and the other only contains a
> }?

"GNU diff" gives the same output as ours, and "git diff --patience"
gives more redundant (it wasts lines by removing "};" and then later
adding "};" back) output.  I think this is because "patience" pays
more attention to key off unique lines in the range (e.g. the line
"#define MC13XXX_NUMREGS 0x3f" appears only once in the preimage and
also in the postimage, so it must pair with each other).

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-07-12  9:57 ` Uwe Kleine-König
@ 2012-08-02 15:52   ` Fabio Estevam
  -1 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-08-02 15:52 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Samuel Ortiz, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Philippe Rétornaz,
	Marc Reilly, linux-arm-kernel

Hi Uwe,

On Thu, Jul 12, 2012 at 6:57 AM, Uwe Kleine-König
<u.kleine-koenig@pengutronix.de> wrote:
> Hello,
>
> This series was tested on a Phytec pcm038 (mc13783 on spi) using
> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> i2c) using dt boot.
>
> Philippe's patches are already in next, they are just included here for
> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> driver's id_table in probe' was already sent out yesterday and is
> included here because the last patch depends on it.

Would you have a git tree with all these patches applied so that I can
easily test it on a mx53loco board?

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-08-02 15:52   ` Fabio Estevam
  0 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-08-02 15:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Uwe,

On Thu, Jul 12, 2012 at 6:57 AM, Uwe Kleine-K?nig
<u.kleine-koenig@pengutronix.de> wrote:
> Hello,
>
> This series was tested on a Phytec pcm038 (mc13783 on spi) using
> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> i2c) using dt boot.
>
> Philippe's patches are already in next, they are just included here for
> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> driver's id_table in probe' was already sent out yesterday and is
> included here because the last patch depends on it.

Would you have a git tree with all these patches applied so that I can
easily test it on a mx53loco board?

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-07-12 23:02   ` Marc Reilly
@ 2012-09-05 14:22     ` Fabio Estevam
  -1 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-09-05 14:22 UTC (permalink / raw)
  To: Marc Reilly, Samuel Ortiz
  Cc: linux-arm-kernel, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Uwe Kleine-König,
	Philippe Rétornaz

Hi Samuel,

On Thu, Jul 12, 2012 at 8:02 PM, Marc Reilly <marc@cpdesign.com.au> wrote:
> Hi Uwe,
>
>> This series was tested on a Phytec pcm038 (mc13783 on spi) using
>> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
>> i2c) using dt boot.
>>
>> Philippe's patches are already in next, they are just included here for
>> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
>> driver's id_table in probe' was already sent out yesterday and is
>> included here because the last patch depends on it.
>>
>
> For all patches (that don't already have it):
> Acked-by: Marc Reilly <marc@cpdesign.com.au>

Can this series be applied?

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-09-05 14:22     ` Fabio Estevam
  0 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-09-05 14:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Samuel,

On Thu, Jul 12, 2012 at 8:02 PM, Marc Reilly <marc@cpdesign.com.au> wrote:
> Hi Uwe,
>
>> This series was tested on a Phytec pcm038 (mc13783 on spi) using
>> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
>> i2c) using dt boot.
>>
>> Philippe's patches are already in next, they are just included here for
>> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
>> driver's id_table in probe' was already sent out yesterday and is
>> included here because the last patch depends on it.
>>
>
> For all patches (that don't already have it):
> Acked-by: Marc Reilly <marc@cpdesign.com.au>

Can this series be applied?

Regards,

Fabio Estevam

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-09-05 14:22     ` Fabio Estevam
@ 2012-10-04 13:01       ` Fabio Estevam
  -1 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-10-04 13:01 UTC (permalink / raw)
  To: Marc Reilly, Samuel Ortiz
  Cc: linux-arm-kernel, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Uwe Kleine-König,
	Philippe Rétornaz, Arnd Bergmann

Hi Samuel,

On Wed, Sep 5, 2012 at 11:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Samuel,
>
> On Thu, Jul 12, 2012 at 8:02 PM, Marc Reilly <marc@cpdesign.com.au> wrote:
>> Hi Uwe,
>>
>>> This series was tested on a Phytec pcm038 (mc13783 on spi) using
>>> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
>>> i2c) using dt boot.
>>>
>>> Philippe's patches are already in next, they are just included here for
>>> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
>>> driver's id_table in probe' was already sent out yesterday and is
>>> included here because the last patch depends on it.
>>>
>>
>> For all patches (that don't already have it):
>> Acked-by: Marc Reilly <marc@cpdesign.com.au>
>
> Can this series be applied?

Any comments on this series, please?

I want to add mc34708 support to mx53qsb and need this series to be applied.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-10-04 13:01       ` Fabio Estevam
  0 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-10-04 13:01 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Samuel,

On Wed, Sep 5, 2012 at 11:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
> Hi Samuel,
>
> On Thu, Jul 12, 2012 at 8:02 PM, Marc Reilly <marc@cpdesign.com.au> wrote:
>> Hi Uwe,
>>
>>> This series was tested on a Phytec pcm038 (mc13783 on spi) using
>>> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
>>> i2c) using dt boot.
>>>
>>> Philippe's patches are already in next, they are just included here for
>>> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
>>> driver's id_table in probe' was already sent out yesterday and is
>>> included here because the last patch depends on it.
>>>
>>
>> For all patches (that don't already have it):
>> Acked-by: Marc Reilly <marc@cpdesign.com.au>
>
> Can this series be applied?

Any comments on this series, please?

I want to add mc34708 support to mx53qsb and need this series to be applied.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-10-04 13:01       ` Fabio Estevam
@ 2012-10-04 13:51         ` Samuel Ortiz
  -1 siblings, 0 replies; 37+ messages in thread
From: Samuel Ortiz @ 2012-10-04 13:51 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Marc Reilly, linux-arm-kernel, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Uwe Kleine-König,
	Philippe Rétornaz, Arnd Bergmann

Hi Fabio,

On Thu, Oct 04, 2012 at 10:01:21AM -0300, Fabio Estevam wrote:
> Hi Samuel,
> 
> On Wed, Sep 5, 2012 at 11:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
> > Hi Samuel,
> >
> > On Thu, Jul 12, 2012 at 8:02 PM, Marc Reilly <marc@cpdesign.com.au> wrote:
> >> Hi Uwe,
> >>
> >>> This series was tested on a Phytec pcm038 (mc13783 on spi) using
> >>> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> >>> i2c) using dt boot.
> >>>
> >>> Philippe's patches are already in next, they are just included here for
> >>> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> >>> driver's id_table in probe' was already sent out yesterday and is
> >>> included here because the last patch depends on it.
> >>>
> >>
> >> For all patches (that don't already have it):
> >> Acked-by: Marc Reilly <marc@cpdesign.com.au>
> >
> > Can this series be applied?
> 
> Any comments on this series, please?
Did you send it to my samuel.ortiz@intel.com email ? I never look at it when
going through my MFD backlog, which is why it was not applied. Which is why it
won't be part of the 3.7 merge window, sorry about that.

 
> I want to add mc34708 support to mx53qsb and need this series to be applied.
I understand. I'll queue it to my for-next branch as soon as the merge window
is closed.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-10-04 13:51         ` Samuel Ortiz
  0 siblings, 0 replies; 37+ messages in thread
From: Samuel Ortiz @ 2012-10-04 13:51 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

On Thu, Oct 04, 2012 at 10:01:21AM -0300, Fabio Estevam wrote:
> Hi Samuel,
> 
> On Wed, Sep 5, 2012 at 11:22 AM, Fabio Estevam <festevam@gmail.com> wrote:
> > Hi Samuel,
> >
> > On Thu, Jul 12, 2012 at 8:02 PM, Marc Reilly <marc@cpdesign.com.au> wrote:
> >> Hi Uwe,
> >>
> >>> This series was tested on a Phytec pcm038 (mc13783 on spi) using
> >>> traditional boot (i.e. not dt) and on a i.MX53 based machine (mc34708 on
> >>> i2c) using dt boot.
> >>>
> >>> Philippe's patches are already in next, they are just included here for
> >>> those who want to test the patches. The 'mfd/mc13xxx: drop modifying
> >>> driver's id_table in probe' was already sent out yesterday and is
> >>> included here because the last patch depends on it.
> >>>
> >>
> >> For all patches (that don't already have it):
> >> Acked-by: Marc Reilly <marc@cpdesign.com.au>
> >
> > Can this series be applied?
> 
> Any comments on this series, please?
Did you send it to my samuel.ortiz at intel.com email ? I never look at it when
going through my MFD backlog, which is why it was not applied. Which is why it
won't be part of the 3.7 merge window, sorry about that.

 
> I want to add mc34708 support to mx53qsb and need this series to be applied.
I understand. I'll queue it to my for-next branch as soon as the merge window
is closed.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-10-04 13:51         ` Samuel Ortiz
@ 2012-10-04 14:11           ` Uwe Kleine-König
  -1 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-10-04 14:11 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Fabio Estevam, Marc Reilly, linux-arm-kernel,
	Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Philippe Rétornaz,
	Arnd Bergmann

Hi,

On Thu, Oct 04, 2012 at 03:51:30PM +0200, Samuel Ortiz wrote:
> Did you send it to my samuel.ortiz@intel.com email ? I never look at it when
> going through my MFD backlog, which is why it was not applied. Which is why it
> won't be part of the 3.7 merge window, sorry about that.
I don't know why I picked that one up, but probably it's because this
address shows up in several commits:

	$ git log --grep=samuel.ortiz@intel.com | grep Samuel | sort | uniq -c
	     18     Acked-by: Samuel Ortiz <samuel.ortiz@intel.com>
	     12 Author: Samuel Ortiz <sameo@linux.intel.com>
	     27 Author: Samuel Ortiz <samuel.ortiz@intel.com>
	      4     Cc: Samuel Ortiz <samuel.ortiz@intel.com>
	      1     Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
	     50     Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>

and one of these just happend to be the first I looked at.

hmm, *shrug*
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-10-04 14:11           ` Uwe Kleine-König
  0 siblings, 0 replies; 37+ messages in thread
From: Uwe Kleine-König @ 2012-10-04 14:11 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Thu, Oct 04, 2012 at 03:51:30PM +0200, Samuel Ortiz wrote:
> Did you send it to my samuel.ortiz at intel.com email ? I never look at it when
> going through my MFD backlog, which is why it was not applied. Which is why it
> won't be part of the 3.7 merge window, sorry about that.
I don't know why I picked that one up, but probably it's because this
address shows up in several commits:

	$ git log --grep=samuel.ortiz at intel.com | grep Samuel | sort | uniq -c
	     18     Acked-by: Samuel Ortiz <samuel.ortiz@intel.com>
	     12 Author: Samuel Ortiz <sameo@linux.intel.com>
	     27 Author: Samuel Ortiz <samuel.ortiz@intel.com>
	      4     Cc: Samuel Ortiz <samuel.ortiz@intel.com>
	      1     Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
	     50     Signed-off-by: Samuel Ortiz <samuel.ortiz@intel.com>

and one of these just happend to be the first I looked at.

hmm, *shrug*
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-10-04 13:51         ` Samuel Ortiz
@ 2012-10-27 19:19           ` Fabio Estevam
  -1 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-10-27 19:19 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: Marc Reilly, linux-arm-kernel, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Uwe Kleine-König,
	Philippe Rétornaz, Arnd Bergmann

Hi Samuel,

On Thu, Oct 4, 2012 at 10:51 AM, Samuel Ortiz <samuel.ortiz@intel.com> wrote:

>> I want to add mc34708 support to mx53qsb and need this series to be applied.
> I understand. I'll queue it to my for-next branch as soon as the merge window
> is closed.

Could you please queue this series? I still do not see it applied in
your 'for-next-merge' branch.

I will add mc34708 touchscreen support and need Uwe's series to be applied.

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-10-27 19:19           ` Fabio Estevam
  0 siblings, 0 replies; 37+ messages in thread
From: Fabio Estevam @ 2012-10-27 19:19 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Samuel,

On Thu, Oct 4, 2012 at 10:51 AM, Samuel Ortiz <samuel.ortiz@intel.com> wrote:

>> I want to add mc34708 support to mx53qsb and need this series to be applied.
> I understand. I'll queue it to my for-next branch as soon as the merge window
> is closed.

Could you please queue this series? I still do not see it applied in
your 'for-next-merge' branch.

I will add mc34708 touchscreen support and need Uwe's series to be applied.

Thanks,

Fabio Estevam

^ permalink raw reply	[flat|nested] 37+ messages in thread

* Re: [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
  2012-10-27 19:19           ` Fabio Estevam
@ 2012-11-06 22:24             ` Samuel Ortiz
  -1 siblings, 0 replies; 37+ messages in thread
From: Samuel Ortiz @ 2012-11-06 22:24 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Marc Reilly, linux-arm-kernel, Ying-Chun Liu (PaulLiu),
	Mark Brown, linux-kernel, kernel, Uwe Kleine-König,
	Philippe Rétornaz, Arnd Bergmann

Hi Fabio,

On Sat, Oct 27, 2012 at 05:19:11PM -0200, Fabio Estevam wrote:
> Hi Samuel,
> 
> On Thu, Oct 4, 2012 at 10:51 AM, Samuel Ortiz <samuel.ortiz@intel.com> wrote:
> 
> >> I want to add mc34708 support to mx53qsb and need this series to be applied.
> > I understand. I'll queue it to my for-next branch as soon as the merge window
> > is closed.
> 
> Could you please queue this series? I still do not see it applied in
> your 'for-next-merge' branch.
Patches 6 and 7 were not applied from this serie. I now applied them to my
for-next branch.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


^ permalink raw reply	[flat|nested] 37+ messages in thread

* [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver
@ 2012-11-06 22:24             ` Samuel Ortiz
  0 siblings, 0 replies; 37+ messages in thread
From: Samuel Ortiz @ 2012-11-06 22:24 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Fabio,

On Sat, Oct 27, 2012 at 05:19:11PM -0200, Fabio Estevam wrote:
> Hi Samuel,
> 
> On Thu, Oct 4, 2012 at 10:51 AM, Samuel Ortiz <samuel.ortiz@intel.com> wrote:
> 
> >> I want to add mc34708 support to mx53qsb and need this series to be applied.
> > I understand. I'll queue it to my for-next branch as soon as the merge window
> > is closed.
> 
> Could you please queue this series? I still do not see it applied in
> your 'for-next-merge' branch.
Patches 6 and 7 were not applied from this serie. I now applied them to my
for-next branch.

Cheers,
Samuel.

-- 
Intel Open Source Technology Centre
http://oss.intel.com/
---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

^ permalink raw reply	[flat|nested] 37+ messages in thread

end of thread, other threads:[~2012-11-06 22:24 UTC | newest]

Thread overview: 37+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12  9:57 [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver Uwe Kleine-König
2012-07-12  9:57 ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 1/7] MFD: Fix mc13xxx SPI regmap Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 2/7] MFD: mc13xxx workaround SPI hardware bug on i.Mx Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 3/7] rtc/mc13xxx: use MODULE_DEVICE_TABLE instead of MODULE_ALIAS Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 4/7] rtc/mc13xxx: add support for the rtc in the mc34708 pmic Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 5/7] mfd/mc13xxx: drop modifying driver's id_table in probe Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 6/7] mfd/mc13xxx: change probing details for mc13xxx devices Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-13 15:22   ` Uwe Kleine-König
2012-07-13 15:22     ` Uwe Kleine-König
2012-07-12  9:57 ` [PATCH 7/7] mfd/mc13xxx: add support for mc34708 Uwe Kleine-König
2012-07-12  9:57   ` Uwe Kleine-König
2012-07-12 23:02 ` [PATCH 0/7] Add support for Freescale's mc34708 to mc13xxx driver Marc Reilly
2012-07-12 23:02   ` Marc Reilly
2012-07-13  8:48   ` Uwe Kleine-König
2012-07-13  8:48     ` Uwe Kleine-König
2012-07-13 19:39     ` Junio C Hamano
2012-09-05 14:22   ` Fabio Estevam
2012-09-05 14:22     ` Fabio Estevam
2012-10-04 13:01     ` Fabio Estevam
2012-10-04 13:01       ` Fabio Estevam
2012-10-04 13:51       ` Samuel Ortiz
2012-10-04 13:51         ` Samuel Ortiz
2012-10-04 14:11         ` Uwe Kleine-König
2012-10-04 14:11           ` Uwe Kleine-König
2012-10-27 19:19         ` Fabio Estevam
2012-10-27 19:19           ` Fabio Estevam
2012-11-06 22:24           ` Samuel Ortiz
2012-11-06 22:24             ` Samuel Ortiz
2012-08-02 15:52 ` Fabio Estevam
2012-08-02 15:52   ` Fabio Estevam

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.