Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-10 Thread Ray Jui


On 2/10/2015 12:33 AM, Wolfram Sang wrote:
 
 Thanks, Wolfram. I think I'm missing something here and would like to
 get it clarified, so I don't make the same mistake again in the future:
 I thought I've already sent these patches as a new thread, i.e., [PATCH
 v9 ...], isn't it?
 
 Yes, but In-Reply-To was set and so my MUAs (mutt and Thunderbird)
 threaded them to your first submission. Most people I know prefer to
 have this not threaded.
 
Okay I got it now. Thanks.

Ray
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-10 Thread Wolfram Sang

 Thanks, Wolfram. I think I'm missing something here and would like to
 get it clarified, so I don't make the same mistake again in the future:
 I thought I've already sent these patches as a new thread, i.e., [PATCH
 v9 ...], isn't it?

Yes, but In-Reply-To was set and so my MUAs (mutt and Thunderbird)
threaded them to your first submission. Most people I know prefer to
have this not threaded.



signature.asc
Description: Digital signature


Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-09 Thread Wolfram Sang
On Sat, Feb 07, 2015 at 09:25:25PM -0800, Ray Jui wrote:
 Add initial support to the Broadcom iProc I2C controller found in the
 iProc family of SoCs.
 
 The iProc I2C controller has separate internal TX and RX FIFOs, each has
 a size of 64 bytes. The iProc I2C controller supports two bus speeds
 including standard mode (100kHz) and fast mode (400kHz)
 
 Signed-off-by: Ray Jui r...@broadcom.com
 Reviewed-by: Scott Branden sbran...@broadcom.com
 Reviewed-by: Kevin Cernekee cerne...@chromium.org

Applied to for-next, thanks!

Next time, please send new patches as seperate threads, not as a reply
to the old series.



signature.asc
Description: Digital signature


Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-09 Thread Ray Jui


On 2/9/2015 4:10 AM, Wolfram Sang wrote:
 On Sat, Feb 07, 2015 at 09:25:25PM -0800, Ray Jui wrote:
 Add initial support to the Broadcom iProc I2C controller found in the
 iProc family of SoCs.

 The iProc I2C controller has separate internal TX and RX FIFOs, each has
 a size of 64 bytes. The iProc I2C controller supports two bus speeds
 including standard mode (100kHz) and fast mode (400kHz)

 Signed-off-by: Ray Jui r...@broadcom.com
 Reviewed-by: Scott Branden sbran...@broadcom.com
 Reviewed-by: Kevin Cernekee cerne...@chromium.org
 
 Applied to for-next, thanks!
 
 Next time, please send new patches as seperate threads, not as a reply
 to the old series.
 

Thanks, Wolfram. I think I'm missing something here and would like to
get it clarified, so I don't make the same mistake again in the future:
I thought I've already sent these patches as a new thread, i.e., [PATCH
v9 ...], isn't it?

Thanks,

Ray
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-08 Thread Ray Jui


On 2/8/2015 8:29 AM, Wolfram Sang wrote:
 On Sat, Feb 07, 2015 at 09:25:25PM -0800, Ray Jui wrote:
 Add initial support to the Broadcom iProc I2C controller found in the
 iProc family of SoCs.

 The iProc I2C controller has separate internal TX and RX FIFOs, each has
 a size of 64 bytes. The iProc I2C controller supports two bus speeds
 including standard mode (100kHz) and fast mode (400kHz)

 Signed-off-by: Ray Jui r...@broadcom.com
 Reviewed-by: Scott Branden sbran...@broadcom.com
 Reviewed-by: Kevin Cernekee cerne...@chromium.org
 
 Looks good. What kind of tests have you done with exactly this version of the
 driver (not earlier ones)?
 
I did build test and ran i2cdetect on Cygnus BCM958300K combo board with
the 3.19 rc7 kernel, and then I back ported this driver to our 3.10
version of the production kernel (where we have complete audio driver
support), to run some audio playback tests, which involves using the
wolfson codec (through i2c). The only line I added when back porting to
the 3.10 kernel is of_i2c_register_devices at the end of probe.

Thanks,

Ray
--
To unsubscribe from this list: send the line unsubscribe devicetree in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-08 Thread Wolfram Sang
On Sat, Feb 07, 2015 at 09:25:25PM -0800, Ray Jui wrote:
 Add initial support to the Broadcom iProc I2C controller found in the
 iProc family of SoCs.
 
 The iProc I2C controller has separate internal TX and RX FIFOs, each has
 a size of 64 bytes. The iProc I2C controller supports two bus speeds
 including standard mode (100kHz) and fast mode (400kHz)
 
 Signed-off-by: Ray Jui r...@broadcom.com
 Reviewed-by: Scott Branden sbran...@broadcom.com
 Reviewed-by: Kevin Cernekee cerne...@chromium.org

Looks good. What kind of tests have you done with exactly this version of the
driver (not earlier ones)?



signature.asc
Description: Digital signature


[PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver

2015-02-07 Thread Ray Jui
Add initial support to the Broadcom iProc I2C controller found in the
iProc family of SoCs.

The iProc I2C controller has separate internal TX and RX FIFOs, each has
a size of 64 bytes. The iProc I2C controller supports two bus speeds
including standard mode (100kHz) and fast mode (400kHz)

Signed-off-by: Ray Jui r...@broadcom.com
Reviewed-by: Scott Branden sbran...@broadcom.com
Reviewed-by: Kevin Cernekee cerne...@chromium.org
---
 drivers/i2c/busses/Kconfig |   10 +
 drivers/i2c/busses/Makefile|1 +
 drivers/i2c/busses/i2c-bcm-iproc.c |  461 
 3 files changed, 472 insertions(+)
 create mode 100644 drivers/i2c/busses/i2c-bcm-iproc.c

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index ab838d9..3d08731 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -372,6 +372,16 @@ config I2C_BCM2835
  This support is also available as a module.  If so, the module
  will be called i2c-bcm2835.
 
+config I2C_BCM_IPROC
+   tristate Broadcom iProc I2C controller
+   depends on ARCH_BCM_IPROC || COMPILE_TEST
+   default ARCH_BCM_IPROC
+   help
+ If you say yes to this option, support will be included for the
+ Broadcom iProc I2C controller.
+
+ If you don't know what to do here, say N.
+
 config I2C_BCM_KONA
tristate BCM Kona I2C adapter
depends on ARCH_BCM_MOBILE
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index 56388f6..d93b509 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_I2C_AT91)+= i2c-at91.o
 obj-$(CONFIG_I2C_AU1550)   += i2c-au1550.o
 obj-$(CONFIG_I2C_AXXIA)+= i2c-axxia.o
 obj-$(CONFIG_I2C_BCM2835)  += i2c-bcm2835.o
+obj-$(CONFIG_I2C_BCM_IPROC)+= i2c-bcm-iproc.o
 obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
 obj-$(CONFIG_I2C_CADENCE)  += i2c-cadence.o
 obj-$(CONFIG_I2C_CBUS_GPIO)+= i2c-cbus-gpio.o
diff --git a/drivers/i2c/busses/i2c-bcm-iproc.c 
b/drivers/i2c/busses/i2c-bcm-iproc.c
new file mode 100644
index 000..d3c8915
--- /dev/null
+++ b/drivers/i2c/busses/i2c-bcm-iproc.c
@@ -0,0 +1,461 @@
+/*
+ * Copyright (C) 2014 Broadcom Corporation
+ *
+ * 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 version 2.
+ *
+ * This program is distributed as is WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include linux/delay.h
+#include linux/i2c.h
+#include linux/interrupt.h
+#include linux/io.h
+#include linux/kernel.h
+#include linux/module.h
+#include linux/platform_device.h
+#include linux/slab.h
+
+#define CFG_OFFSET   0x00
+#define CFG_RESET_SHIFT  31
+#define CFG_EN_SHIFT 30
+#define CFG_M_RETRY_CNT_SHIFT16
+#define CFG_M_RETRY_CNT_MASK 0x0f
+
+#define TIM_CFG_OFFSET   0x04
+#define TIM_CFG_MODE_400_SHIFT   31
+
+#define M_FIFO_CTRL_OFFSET   0x0c
+#define M_FIFO_RX_FLUSH_SHIFT31
+#define M_FIFO_TX_FLUSH_SHIFT30
+#define M_FIFO_RX_CNT_SHIFT  16
+#define M_FIFO_RX_CNT_MASK   0x7f
+#define M_FIFO_RX_THLD_SHIFT 8
+#define M_FIFO_RX_THLD_MASK  0x3f
+
+#define M_CMD_OFFSET 0x30
+#define M_CMD_START_BUSY_SHIFT   31
+#define M_CMD_STATUS_SHIFT   25
+#define M_CMD_STATUS_MASK0x07
+#define M_CMD_STATUS_SUCCESS 0x0
+#define M_CMD_STATUS_LOST_ARB0x1
+#define M_CMD_STATUS_NACK_ADDR   0x2
+#define M_CMD_STATUS_NACK_DATA   0x3
+#define M_CMD_STATUS_TIMEOUT 0x4
+#define M_CMD_PROTOCOL_SHIFT 9
+#define M_CMD_PROTOCOL_MASK  0xf
+#define M_CMD_PROTOCOL_BLK_WR0x7
+#define M_CMD_PROTOCOL_BLK_RD0x8
+#define M_CMD_PEC_SHIFT  8
+#define M_CMD_RD_CNT_SHIFT   0
+#define M_CMD_RD_CNT_MASK0xff
+
+#define IE_OFFSET0x38
+#define IE_M_RX_FIFO_FULL_SHIFT  31
+#define IE_M_RX_THLD_SHIFT   30
+#define IE_M_START_BUSY_SHIFT28
+
+#define IS_OFFSET0x3c
+#define IS_M_RX_FIFO_FULL_SHIFT  31
+#define IS_M_RX_THLD_SHIFT   30
+#define IS_M_START_BUSY_SHIFT28
+
+#define M_TX_OFFSET  0x40
+#define M_TX_WR_STATUS_SHIFT 31
+#define M_TX_DATA_SHIFT  0
+#define M_TX_DATA_MASK   0xff
+
+#define M_RX_OFFSET  0x44
+#define M_RX_STATUS_SHIFT30
+#define M_RX_STATUS_MASK 0x03
+#define M_RX_PEC_ERR_SHIFT   29
+#define M_RX_DATA_SHIFT  0
+#define M_RX_DATA_MASK   0xff
+
+#define I2C_TIMEOUT_MESC