Skip to contentSkip to conversation

video: mb862xx: add support for controller's I2C bus adapter

PATCH In review Anatolij Gustschin 2 participants 3 messages May 13, 2011 – May 24, 2011 Framebuffer layer

lore
Share & tools
lore
#0 lore raw

PATCH 4/5 video: mb862xx: add support for controller's I2C bus adapter

Add adapter driver for I2C adapter in Coral-P(A)/Lime GDCs. So we can easily access devices on controller's I2C bus using i2c-dev interface.

---
 drivers/video/mb862xx/Makefile      |    2 +-
 drivers/video/mb862xx/mb862xx-i2c.c |  168 +++++++++++++++++++++++++++++++++++
 drivers/video/mb862xx/mb862xx_reg.h |   21 +++++
 drivers/video/mb862xx/mb862xxfb.c   |    2 +
 drivers/video/mb862xx/mb862xxfb.h   |    3 +
 5 files changed, 195 insertions(+), 1 deletions(-)
 create mode 100644 drivers/video/mb862xx/mb862xx-i2c.c
drivers/video/mb862xx/Makefile +1 -1
index d777771..3a36c45 100644
@@ -2,4 +2,4 @@
 # Makefile for the MB862xx framebuffer driver
 #
 
-obj-$(CONFIG_FB_MB862XX)	:= mb862xxfb.o mb862xxfb_accel.o
+obj-$(CONFIG_FB_MB862XX)	:= mb862xxfb.o mb862xxfb_accel.o mb862xx-i2c.o
drivers/video/mb862xx/mb862xx-i2c.c new file +168 -0

168 lines not on this page · raw message

drivers/video/mb862xx/mb862xx_reg.h +21 -0
index 737fc01..5784b01 100644
@@ -80,6 +80,27 @@
 
 #define GC_DISP_REFCLK_400	400
 
+/* I2C */
+#define GC_I2C_BSR		0x00000000	/* BSR */
+#define GC_I2C_BCR		0x00000004	/* BCR */
+#define GC_I2C_CCR		0x00000008	/* CCR */
+#define GC_I2C_ADR		0x0000000C	/* ADR */
+#define GC_I2C_DAR		0x00000010	/* DAR */
+
+#define I2C_DISABLE		0x00000000
+#define I2C_STOP		0x00000000
+#define I2C_START		0x00000010
+#define I2C_REPEATED_START	0x00000030
+#define I2C_CLOCK_AND_ENABLE	0x0000003f
+#define I2C_READY		0x01
+#define I2C_INT			0x01
+#define I2C_INTE		0x02
+#define I2C_ACK			0x08
+#define I2C_BER			0x80
+#define I2C_BEIE		0x40
+#define I2C_TRX			0x80
+#define I2C_LRB			0x10
+
 /* Carmine specific */
 #define MB86297_DRAW_BASE		0x00020000
 #define MB86297_DISP0_BASE		0x00100000
drivers/video/mb862xx/mb862xxfb.c +2 -0
index ffb6a2c..a9779f8 100644
@@ -772,6 +772,8 @@ static int coralp_init(struct mb862xxfb_par *par)
 	} else {
 		return -ENODEV;
 	}
+
+	mb862xx_i2c_init(par);
 	return 0;
 }
 
drivers/video/mb862xx/mb862xxfb.h +3 -0
index d7e7cb7..f0f57ea 100644
@@ -57,11 +57,14 @@ struct mb862xxfb_par {
 	unsigned int		refclk;		/* disp. reference clock */
 	struct mb862xx_gc_mode	*gc_mode;	/* GDC mode init data */
 	int			pre_init;	/* don't init display if 1 */
+	struct i2c_adapter	*adap;		/* GDC I2C bus adapter */
+	int			i2c_rs;
 
 	u32			pseudo_palette[16];
 };
 
 extern void mb862xxfb_init_accel(struct fb_info *info, int xres);
+extern int mb862xx_i2c_init(struct mb862xxfb_par *par);
 
 #if defined(CONFIG_FB_MB862XX_LIME) && defined(CONFIG_FB_MB862XX_PCI_GDC)
 #error	"Select Lime GDC or CoralP/Carmine support, but not both together"
Signature · 1 line
1.7.1
#1 lore raw
Quoted 5 lines · Anatolij Gustschin

Add adapter driver for I2C adapter in Coral-P(A)/Lime GDCs. So we can easily access devices on controller's I2C bus using i2c-dev interface.

I don't see anything in the Kconfig that prevents this from being built with CONFIG_I2C=n, have you tested this case?

#2 lore raw

Re: [PATCH 4/5] video: mb862xx: add support for controller's I2C

In reply to Anatolij Gustschin
Quoted 9 lines · On Tue, 24 May 2011 16:23:44 +0900 Paul Mundt <[email protected]> wrote:
Quoted 5 lines · Anatolij Gustschin

Add adapter driver for I2C adapter in Coral-P(A)/Lime GDCs. So we can easily access devices on controller's I2C bus using i2c-dev interface.

I don't see anything in the Kconfig that prevents this from being built with CONFIG_I2C=n, have you tested this case?

No. Thanks for pointing this out, I'll fix it.

BR,
Anatolij