]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
board/common: Add support for QIXIS read/write using i2c
authorPrabhakar Kushwaha <prabhakar@freescale.com>
Wed, 23 Jan 2013 17:59:37 +0000 (17:59 +0000)
committerAndy Fleming <afleming@freescale.com>
Wed, 30 Jan 2013 17:25:15 +0000 (11:25 -0600)
QIXIS FPGA is accessable via both i2c and flash controller.
Only flash controller access is supported.

Add support of i2c based access. It is quite useful in the scenario
where either flash controller path is broken or not present.

Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com>
Signed-off-by: Andy Fleming <afleming@freescale.com>
board/freescale/common/qixis.c
board/freescale/common/qixis.h

index f7d2f4640cc46f07dfe86b7448585560286819cd..2b74d0201e4bdf31c090698134f50675c8c1b86d 100644 (file)
 #include <command.h>
 #include <asm/io.h>
 #include <linux/time.h>
+#include <i2c.h>
 #include "qixis.h"
 
+#ifdef CONFIG_SYS_I2C_FPGA_ADDR
+u8 qixis_read_i2c(unsigned int reg)
+{
+       return i2c_reg_read(CONFIG_SYS_I2C_FPGA_ADDR, reg);
+}
+
+void qixis_write_i2c(unsigned int reg, u8 value)
+{
+       u8 val = value;
+       i2c_reg_write(CONFIG_SYS_I2C_FPGA_ADDR, reg, val);
+}
+#endif
+
 u8 qixis_read(unsigned int reg)
 {
        void *p = (void *)QIXIS_BASE;
index 2b8f607352844f2a194c1b4a84ee410418d15703..8d914d54859ce134eaa076b5e9173482346ff49b 100644 (file)
@@ -92,8 +92,17 @@ u16 qixis_read_minor(void);
 char *qixis_read_time(char *result);
 char *qixis_read_tag(char *buf);
 const char *byte_to_binary_mask(u8 val, u8 mask, char *buf);
+#ifdef CONFIG_SYS_I2C_FPGA_ADDR
+u8 qixis_read_i2c(unsigned int reg);
+void qixis_write_i2c(unsigned int reg, u8 value);
+#endif
 
 #define QIXIS_READ(reg) qixis_read(offsetof(struct qixis, reg))
 #define QIXIS_WRITE(reg, value) qixis_write(offsetof(struct qixis, reg), value)
+#ifdef CONFIG_SYS_I2C_FPGA_ADDR
+#define QIXIS_READ_I2C(reg) qixis_read_i2c(offsetof(struct qixis, reg))
+#define QIXIS_WRITE_I2C(reg, value) \
+                       qixis_write_i2c(offsetof(struct qixis, reg), value)
+#endif
 
 #endif