Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-28 Thread Stefan Roese
Hi Dirk,

On Wednesday 26 October 2011 08:44:56 Eibach, Dirk wrote:
  is this some v3 of the patch?  If so, where is the change
  log?  What has been changes?
 
 As you can see in http://patchwork.ozlabs.org/patch/120771/ message
 archive I did a send without v3 tag and changelog by mistake.
 The latest version with tag and changelog is
 http://patchwork.ozlabs.org/patch/120777/.

Perhaps its easiest if you could send an incremental patch, to bring the 
upstream source to the latest one. As your new PPC4xx board support depends on 
the new API.

Otherwise Wolfgang would need to revert the patch 
486cad03be46114d726df56721ee27cba52c38e3 and apply the new one.

Wolfgang, what would you prefer? Should Dirk just send an incremental patch?

Best regards,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-28 Thread Wolfgang Denk
Dear Stefan Roese,

In message 201110280825.08189...@denx.de you wrote:
 
 Wolfgang, what would you prefer? Should Dirk just send an incremental patch?

Yes, please.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
It is more rational to sacrifice one life than six.
-- Spock, The Galileo Seven, stardate 2822.3
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-26 Thread Eibach, Dirk

Dear Wolfgang, 

 In message 1319101940-780-1-git-send-email-eib...@gdsys.de 
 you wrote:
  Signed-off-by: Dirk Eibach eib...@gdsys.de
  ---
   drivers/gpio/Makefile  |1 +
   drivers/gpio/pca9698.c |  143 
 
   include/pca9698.h  |   34 +++
   3 files changed, 178 insertions(+), 0 deletions(-)  create mode 
  100644 drivers/gpio/pca9698.c  create mode 100644 include/pca9698.h
 
 is this some v3 of the patch?  If so, where is the change 
 log?  What has been changes?

As you can see in http://patchwork.ozlabs.org/patch/120771/ message
archive I did a send without v3 tag and changelog by mistake.
The latest version with tag and changelog is
http://patchwork.ozlabs.org/patch/120777/.

Cheers
Dirk


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-23 Thread Wolfgang Denk
Dear Dirk Eibach,

In message 1319101940-780-1-git-send-email-eib...@gdsys.de you wrote:
 Signed-off-by: Dirk Eibach eib...@gdsys.de
 ---
  drivers/gpio/Makefile  |1 +
  drivers/gpio/pca9698.c |  143 
 
  include/pca9698.h  |   34 +++
  3 files changed, 178 insertions(+), 0 deletions(-)
  create mode 100644 drivers/gpio/pca9698.c
  create mode 100644 include/pca9698.h

is this some v3 of the patch?  If so, where is the change log?  What
has been changes?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
There is is no reason for any individual to have a computer in  their
home.  -- Ken Olsen (President of Digital Equipment Corporation),
  Convention of the World Future Society, in Boston, 1977
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-21 Thread Wolfgang Denk
Dear eib...@gdsys.de,

In message 1317719635-2792-1-git-send-email-eib...@gdsys.de you wrote:
 From: Dirk Eibach eib...@gdsys.de
 
 Signed-off-by: Dirk Eibach eib...@gdsys.de
 ---
  drivers/gpio/Makefile  |1 +
  drivers/gpio/pca9698.c |  123 
 
  include/pca9698.h  |9 
  3 files changed, 133 insertions(+), 0 deletions(-)
  create mode 100644 drivers/gpio/pca9698.c
  create mode 100644 include/pca9698.h

Applied, thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
The reasonable man adapts himself to the world; the unreasonable  one
persists  in  trying  to  adapt  the  world to himself. Therefore all
progress depends on the unreasonable man.  - George Bernard Shaw
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-20 Thread Stefan Roese
On Thursday 20 October 2011 11:12:20 Dirk Eibach wrote:
 Signed-off-by: Dirk Eibach eib...@gdsys.de

Next time please update the patch version in the subject and add the changes 
below the --- line. Other than this:

Acked-by: Stefan Roese s...@denx.de

Thanks,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-20 Thread Eibach, Dirk


 Next time please update the patch version in the subject and 
 add the changes below the --- line. Other than this:

Oops, wrong serialization of save / git-send-email. I did a resend.

Cheers
Dirk


___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-18 Thread Stefan Roese
Hi Dirk,

On Tuesday 04 October 2011 11:13:51 eib...@gdsys.de wrote:
 From: Dirk Eibach eib...@gdsys.de

Checkpatch output:

ERROR: memset size is 3rd argument, not the second.
#239: FILE: drivers/gpio/pca9698.c:120:
+   memset(data, sizeof(data), 0);

total: 1 errors, 0 warnings, 139 lines checked

So, this now really is a good checkpatch feature. I wasn't ware, that it 
checked for such bugs as well. Nice. :)

Please fix and resubmit.

Thanks,
Stefan

--
DENX Software Engineering GmbH,  MD: Wolfgang Denk  Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-0 Fax: (+49)-8142-66989-80 Email: off...@denx.de
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] gpio: Add PCA9698 40-bit I2C I/O port

2011-10-04 Thread eibach
From: Dirk Eibach eib...@gdsys.de

Signed-off-by: Dirk Eibach eib...@gdsys.de
---
 drivers/gpio/Makefile  |1 +
 drivers/gpio/pca9698.c |  123 
 include/pca9698.h  |9 
 3 files changed, 133 insertions(+), 0 deletions(-)
 create mode 100644 drivers/gpio/pca9698.c
 create mode 100644 include/pca9698.h

diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 62ec97d..38a62c3 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -30,6 +30,7 @@ COBJS-$(CONFIG_KIRKWOOD_GPIO) += kw_gpio.o
 COBJS-$(CONFIG_MARVELL_MFP)+= mvmfp.o
 COBJS-$(CONFIG_MXC_GPIO)   += mxc_gpio.o
 COBJS-$(CONFIG_PCA953X)+= pca953x.o
+COBJS-$(CONFIG_PCA9698)+= pca9698.o
 COBJS-$(CONFIG_S5P)+= s5p_gpio.o
 COBJS-$(CONFIG_TEGRA2_GPIO)+= tegra2_gpio.o
 COBJS-$(CONFIG_DA8XX_GPIO) += da8xx_gpio.o
diff --git a/drivers/gpio/pca9698.c b/drivers/gpio/pca9698.c
new file mode 100644
index 000..b946efa
--- /dev/null
+++ b/drivers/gpio/pca9698.c
@@ -0,0 +1,123 @@
+/*
+ * (C) Copyright 2011
+ * Dirk Eibach,  Guntermann  Drunck GmbH, eib...@gdsys.de
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+/*
+ * Driver for NXP's pca9698 40 bit I2C gpio expander
+ */
+
+#include common.h
+#include i2c.h
+#include pca9698.h
+
+/*
+ * The pca9698 registers
+ */
+
+#define PCA9698_REG_INPUT  0x00
+#define PCA9698_REG_OUTPUT 0x08
+#define PCA9698_REG_POLARITY   0x10
+#define PCA9698_REG_CONFIG 0x18
+
+#define PCA9698_BUFFER_SIZE5
+
+static int pca9698_read40(u8 chip, u8 offset, u8 *buffer)
+{
+   u8 command = offset | 0x80;  /* autoincrement */
+
+   return i2c_read(chip, command, 1, buffer, PCA9698_BUFFER_SIZE);
+}
+
+static int pca9698_write40(u8 chip, u8 offset, u8 *buffer)
+{
+   u8 command = offset | 0x80;  /* autoincrement */
+
+   return i2c_write(chip, command, 1, buffer, PCA9698_BUFFER_SIZE);
+}
+
+static void pca9698_set_bit(unsigned gpio, u8 *buffer, unsigned value)
+{
+   unsigned byte = gpio / 8;
+   unsigned bit = gpio % 8;
+
+   if (value)
+   buffer[byte] |= (1  bit);
+   else
+   buffer[byte] = ~(1  bit);
+}
+
+int pca9698_direction_input(u8 chip, unsigned offset)
+{
+   u8 data[PCA9698_BUFFER_SIZE];
+   int res;
+
+   res = pca9698_read40(chip, PCA9698_REG_CONFIG, data);
+   if (res)
+   return res;
+
+   pca9698_set_bit(offset, data, 1);
+   return pca9698_write40(chip, PCA9698_REG_CONFIG, data);
+}
+
+int pca9698_direction_output(u8 chip, unsigned offset)
+{
+   u8 data[PCA9698_BUFFER_SIZE];
+   int res;
+
+   res = pca9698_read40(chip, PCA9698_REG_CONFIG, data);
+   if (res)
+   return res;
+
+   pca9698_set_bit(offset, data, 0);
+   return pca9698_write40(chip, PCA9698_REG_CONFIG, data);
+}
+
+int pca9698_get_input(u8 chip, unsigned offset)
+{
+   unsigned config_byte = offset / 8;
+   unsigned config_bit = offset % 8;
+   unsigned value;
+   u8 data[PCA9698_BUFFER_SIZE];
+   int res;
+
+   res = pca9698_read40(chip, PCA9698_REG_INPUT, data);
+   if (res)
+   return -1;
+
+   value = data[config_byte]  (1  config_bit);
+
+   return !!value;
+}
+
+int pca9698_set_output(u8 chip, unsigned offset, int value)
+{
+   u8 data[PCA9698_BUFFER_SIZE];
+   int res;
+
+   res = pca9698_read40(chip, PCA9698_REG_OUTPUT, data);
+   if (res)
+   return res;
+
+   memset(data, sizeof(data), 0);
+   pca9698_set_bit(offset, data, value);
+   return pca9698_write40(chip, PCA9698_REG_OUTPUT, data);
+}
diff --git a/include/pca9698.h b/include/pca9698.h
new file mode 100644
index 000..2506088
--- /dev/null
+++ b/include/pca9698.h
@@ -0,0 +1,9 @@
+#ifndef __PCA9698_H_
+#define __PCA9698_H_
+
+int pca9698_direction_input(u8 chip, unsigned offset);
+int pca9698_direction_output(u8 chip, unsigned offset);
+int pca9698_get_input(u8 chip, unsigned offset);
+int pca9698_set_output(u8 chip, unsigned offset, int value);
+
+#endif /* __PCA9698_H_ */
-- 
1.5.6.5