Skip to contentSkip to conversation

Add IC Identif Module (IIM) support for ADS5121

PATCH New Martha Marx 3 participants 4 messages Oct 11, 2008 – Nov 18, 2008 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 0d08052300000c07

#1 lore raw

PATCH 1/1 Add IC Identif Module (IIM) support for ADS5121

IIM (IC Identification Module) is the fusebox for the mpc5121. Use #define CONFIG_IIM to turn on the clock for this module,
use #define CONFIG_CMD_FUSE to add fusebox commands. These are turned off by default. Fusebox commands include the ability to read the protection status, read the register cache, override the register cache, program the fuses and explicitly sense them.

---
 board/ads5121/ads5121.c      |    3 +
 cpu/mpc512x/Makefile         |    3 +
 cpu/mpc512x/iim.c            |  387 ++++++++++++++++++++++++++++++++++++++++++
 include/asm-ppc/immap_512x.h |   20 ++-
 include/configs/ads5121.h    |    6 +
 include/mpc512x.h            |   24 +++
 6 files changed, 442 insertions(+), 1 deletions(-)
 create mode 100644 cpu/mpc512x/iim.c
board/ads5121/ads5121.c +3 -0
index deaa292..4198826 100644
@@ -101,6 +101,9 @@ int board_early_init_f (void)
 	 */
 	im->clk.sccr[0] = SCCR1_CLOCKS_EN;
 	im->clk.sccr[1] = SCCR2_CLOCKS_EN;
+#if defined(CONFIG_IIM) || defined(CONFIG_CMD_FUSE)
+	im->clk.sccr[1] |= CLOCK_SCCR2_IIM_EN;
+#endif
 
 	return 0;
 }
cpu/mpc512x/Makefile +3 -0
index e8f1060..e09eb1b 100644
@@ -26,6 +26,9 @@ LIB	= $(obj)lib$(CPU).a
 
 START	= start.o
 COBJS	= traps.o cpu.o cpu_init.o speed.o interrupts.o serial.o i2c.o iopin.o
+ifdef CONFIG_IIM
+COBJS	+= iim.o
+endif 
 
 SRCS	:= $(START:.o=.S) $(SOBJS:.o=.S) $(COBJS:.o=.c)
 OBJS	:= $(addprefix $(obj),$(SOBJS) $(COBJS))
cpu/mpc512x/iim.c new file +387 -0

387 lines not on this page · raw message

include/asm-ppc/immap_512x.h +19 -1
index cd90945..222d713 100644
@@ -415,7 +415,25 @@ typedef struct ioctrl512x {
  * IIM
  */
 typedef struct iim512x {
-	u8 fixme[0x1000];
+	u32 stat;		/* IIM status register */
+	u32 statm;		/* IIM status IRQ mask */
+	u32 err;		/* IIM errors register */
+	u32 emask;		/* IIM error IRQ mask  */
+	u32 fctl;		/* IIM fuse control register */
+	u32 ua;			/* IIM upper address register */
+	u32 la;			/* IIM lower address register */
+	u32 sdat;		/* IIM explicit sense data */
+	u8 res0[0x08];
+	u32 prg_p;		/* IIM program protection register */
+	u8 res1[0x10];
+	u32 divide;		/* IIM divide factor register */
+	u8 res2[0x7c0];
+	u32 fbac0;		/* IIM fuse bank 0 protection (for Freescale use) */
+	u32 fb0w0[0x1f];	/* IIM fuse bank 0 data (for Freescale use) */
+	u8 res3[0x380];
+	u32 fbac1;		/* IIM fuse bank 1 protection */
+	u32 fb1w1[0x01f];	/* IIM fuse bank 1 data */
+	u8 res4[0x380];
 } iim512x_t;
 
 /*
include/configs/ads5121.h +6 -0
index d6f7e02..3753168 100644
@@ -294,6 +294,11 @@
 #endif
 
 /*
+ * IIM - IC Identification Module
+ */
+#undef CONFIG_IIM
+
+/*
  * EEPROM configuration
  */
 #define CFG_I2C_EEPROM_ADDR_LEN		2	/* 16-bit EEPROM address */
@@ -348,6 +353,7 @@
 #define CONFIG_CMD_REGINFO
 #define CONFIG_CMD_EEPROM
 #define CONFIG_CMD_DATE
+#undef CONFIG_CMD_FUSE
 
 #if defined(CONFIG_PCI)
 #define CONFIG_CMD_PCI
include/mpc512x.h +24 -0
index cb418d1..201782f 100644
@@ -574,6 +574,30 @@ void iopin_initialize(iopin_t *,int);
  /* Register Offset Base */
 #define MPC512X_FEC		(CFG_IMMR + 0x02800)
 
+/* IIM control */
+#define IIM_SET_UA(bk, f)	((bk << 3) | (f >> 5))
+#define IIM_SET_LA(f, bit)	(((f & 0x0000001f) << 3) | bit)
+#define IIM_STAT_BUSY		0x00000080
+#define IIM_STAT_PRGD		0x00000002
+#define IIM_STAT_SNSD		0x00000001
+#define IIM_ERR_WPE		0x00000040
+#define IIM_ERR_OPE		0x00000020
+#define IIM_ERR_RPE		0x00000010
+#define IIM_ERR_WLRE		0x00000008
+#define IIM_ERR_SNSE		0x00000004
+#define IIM_ERR_PARITYE		0x00000002
+#define IIM_PRG_P_SET		0x000000aa
+#define IIM_PRG_P_UNSET		0
+#define IIM_FCTL_PROG_PULSE	0x00000020
+#define IIM_FCTL_PROG		0x00000001
+#define IIM_FCTL_ESNS_N		0x00000008
+#define	IIM_FBAC_FBWP		0x00000080
+#define IIM_FBAC_FBOP		0x00000040
+#define IIM_FBAC_FBRP		0x00000020
+#define	IIM_FBAC_FBESP		0x00000008
+#define IIM_PROTECTION		0x000000e8
+#define IIM_FMAX			31
+
 /* Number of I2C buses */
 #define I2C_BUS_CNT	3
 
Signature · 1 line
1.5.2.4
#2 lore raw

PATCH 1/1 Add IC Identif Module (IIM) support for ADS5121

Dear John,

Quoted 8 lines · in message <[email protected]> Martha Marx…

IIM (IC Identification Module) is the fusebox for the mpc5121. Use #define CONFIG_IIM to turn on the clock for this module,
use #define CONFIG_CMD_FUSE to add fusebox commands. These are turned off by default. Fusebox commands include the ability to read the protection status, read the register cache, override the register cache, program the fuses and explicitly sense them.

Do you have some pull request for MPC512x any time soon?

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
There is a biblical analogy I'd like to draw here.   Casts are to C++
Programmers what the apple was to Eve.         - Scott Douglas Meyers
#3 lore raw

PATCH 1/1 Add IC Identif Module (IIM) support for ADS5121

Martha needed to make some style changes to this. I'll ping her.

Quoted 22 lines · Wolfgang Denk

Dear John,

Quoted 9 lines · in message <[email protected]> Martha Marx…

IIM (IC Identification Module) is the fusebox for the mpc5121. Use #define CONFIG_IIM to turn on the clock for this module,
use #define CONFIG_CMD_FUSE to add fusebox commands. These are turned off by default. Fusebox commands include the ability to read the protection status, read the register cache, override the register cache, program the fuses and explicitly sense them.

Do you have some pull request for MPC512x any time soon?

Best regards,

Wolfgang Denk

#4 lore raw

PATCH 1/1 Add IC Identif Module (IIM) support for ADS5121

Dear John,

Quoted 1 line · In message <[email protected]> you wrote:

Martha needed to make some style changes to this. I'll ping her.

Any progress with these patches?

Or any new stuff for 512x in general?

Best regards,

Wolfgang Denk

Signature · 5 lines
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: wd at denx.de
No man knows what true happiness is until he gets married.  By  then,
of course, its too late.