/* clock in the nvram command and the register number. For the national semiconductor nv ram chip the op code is 3 bits and the address is 6/8 bits.  */
static void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg)
/* clock in the nvram command and the register number. For the national semiconductor nv ram chip the op code is 3 bits and the address is 6/8 bits.  */
static void eeprom_cmd(unsigned int *ctrl, unsigned cmd, unsigned reg)
{
	unsigned short ser_cmd;
	int i;
	ser_cmd = cmd | (reg << (16 - BITS_IN_COMMAND));
	for (i = 0; i < BITS_IN_COMMAND; i++) {
		if (ser_cmd & (1<<15))
			__raw_writel(__raw_readl(ctrl) | EEPROM_DATO, ctrl);
		else
			__raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
		__raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
		delay();
		__raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
		delay();
		ser_cmd <<= 1;
	}
	__raw_writel(__raw_readl(ctrl) & ~EEPROM_DATO, ctrl);
}