Ejemplo n.º 1
0
static int fm93c56a_select(struct scsi_qla_host * ha)
{
    DEBUG5(printk(KERN_ERR "fm93c56a_select:\n"));

    ha->eeprom_cmd_data = AUBURN_EEPROM_CS_1 | 0x000f0000;
    eeprom_cmd(ha->eeprom_cmd_data, ha);
    return 1;
}
Ejemplo n.º 2
0
static int fm93c56a_datain(struct scsi_qla_host * ha, unsigned short *value)
{
    int i;
    int data = 0;
    int dataBit;

    /* Read the data bits
     * The first bit is a dummy.  Clock right over it. */
    for (i = 0; i < eeprom_no_data_bits(ha); i++) {
        eeprom_cmd(ha->eeprom_cmd_data |
                   AUBURN_EEPROM_CLK_RISE, ha);
        eeprom_cmd(ha->eeprom_cmd_data |
                   AUBURN_EEPROM_CLK_FALL, ha);

        dataBit = (readw(isp_nvram(ha)) & AUBURN_EEPROM_DI_1) ? 1 : 0;

        data = (data << 1) | dataBit;
    }

    *value = data;
    return 1;
}
Ejemplo n.º 3
0
unsigned short ip22_eeprom_read(unsigned int *ctrl, int reg)
{
	unsigned short res = 0;
	int i;

	__raw_writel(__raw_readl(ctrl) & ~EEPROM_EPROT, ctrl);
	eeprom_cs_on(ctrl);
	eeprom_cmd(ctrl, EEPROM_READ, reg);

	/* clock the data ouf of serial mem */
	for (i = 0; i < 16; i++) {
		__raw_writel(__raw_readl(ctrl) & ~EEPROM_ECLK, ctrl);
		delay();
		__raw_writel(__raw_readl(ctrl) | EEPROM_ECLK, ctrl);
		delay();
		res <<= 1;
		if (__raw_readl(ctrl) & EEPROM_DATI)
			res |= 1;
	}

	eeprom_cs_off(ctrl);

	return res;
}
Ejemplo n.º 4
0
static int fm93c56a_cmd(struct scsi_qla_host * ha, int cmd, int addr)
{
    int i;
    int mask;
    int dataBit;
    int previousBit;

    /* Clock in a zero, then do the start bit. */
    eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1, ha);

    eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
               AUBURN_EEPROM_CLK_RISE, ha);
    eeprom_cmd(ha->eeprom_cmd_data | AUBURN_EEPROM_DO_1 |
               AUBURN_EEPROM_CLK_FALL, ha);

    mask = 1 << (FM93C56A_CMD_BITS - 1);

    /* Force the previous data bit to be different. */
    previousBit = 0xffff;
    for (i = 0; i < FM93C56A_CMD_BITS; i++) {
        dataBit =
            (cmd & mask) ? AUBURN_EEPROM_DO_1 : AUBURN_EEPROM_DO_0;
        if (previousBit != dataBit) {

            /*
             * If the bit changed, then change the DO state to
             * match.
             */
            eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha);
            previousBit = dataBit;
        }
        eeprom_cmd(ha->eeprom_cmd_data | dataBit |
                   AUBURN_EEPROM_CLK_RISE, ha);
        eeprom_cmd(ha->eeprom_cmd_data | dataBit |
                   AUBURN_EEPROM_CLK_FALL, ha);

        cmd = cmd << 1;
    }
    mask = 1 << (eeprom_no_addr_bits(ha) - 1);

    /* Force the previous data bit to be different. */
    previousBit = 0xffff;
    for (i = 0; i < eeprom_no_addr_bits(ha); i++) {
        dataBit = addr & mask ? AUBURN_EEPROM_DO_1 :
                  AUBURN_EEPROM_DO_0;
        if (previousBit != dataBit) {
            /*
             * If the bit changed, then change the DO state to
             * match.
             */
            eeprom_cmd(ha->eeprom_cmd_data | dataBit, ha);

            previousBit = dataBit;
        }
        eeprom_cmd(ha->eeprom_cmd_data | dataBit |
                   AUBURN_EEPROM_CLK_RISE, ha);
        eeprom_cmd(ha->eeprom_cmd_data | dataBit |
                   AUBURN_EEPROM_CLK_FALL, ha);

        addr = addr << 1;
    }
    return 1;
}
Ejemplo n.º 5
0
static int fm93c56a_deselect(struct scsi_qla_host * ha)
{
    ha->eeprom_cmd_data = AUBURN_EEPROM_CS_0 | 0x000f0000;
    eeprom_cmd(ha->eeprom_cmd_data, ha);
    return 1;
}