FreeBSD/sys/dev/cxgb/common/cxgb_t3_hw.c
/**
 *	sf1_write - write data to the serial flash
 *	@adapter: the adapter
 *	@byte_cnt: number of bytes to write
 *	@cont: whether another operation will be chained
 *	@val: value to write
 *
 *	Writes up to 4 bytes of data to the serial flash.  The location of
 *	the write needs to be specified prior to calling this by issuing the
 *	appropriate commands to the serial flash.
 */
write data to the serial flash
@adapter: the adapter
@byte_cnt: number of bytes to write
@cont: whether another operation will be chained
@val: value to write

Writes up to 4 bytes of data to the serial flash.  The location of
the write needs to be specified prior to calling this by issuing the
appropriate commands to the serial flash.
write data to the serial flash @adapter : the adapter @byte_cnt : number of bytes to write @cont : whether another operation will be chained @val : value to write Writes up to 4 bytes of data to the serial flash . The location of the write needs to be specified prior to calling this by issuing the appropriate commands to the serial flash .
static int sf1_write(adapter_t *adapter, unsigned int byte_cnt, int cont,
		     u32 val)
{
	if (!byte_cnt || byte_cnt > 4)
		return -EINVAL;
	if (t3_read_reg(adapter, A_SF_OP) & F_BUSY)
		return -EBUSY;
	t3_write_reg(adapter, A_SF_DATA, val);
	t3_write_reg(adapter, A_SF_OP,
		     V_CONT(cont) | V_BYTECNT(byte_cnt - 1) | V_OP(1));
	return t3_wait_op_done(adapter, A_SF_OP, F_BUSY, 0, SF_ATTEMPTS, 10);
}
static int sf1_write ( adapter_t * adapter , unsigned int byte_cnt , int cont , u32 val ) { if ( ! byte_cnt || byte_cnt > 4 ) return - EINVAL ; if ( t3_read_reg ( adapter , A_SF_OP ) & F_BUSY ) return - EBUSY ; t3_write_reg ( adapter , A_SF_DATA , val ) ; t3_write_reg ( adapter , A_SF_OP , V_CONT ( cont ) | V_BYTECNT ( byte_cnt - 1 ) | V_OP ( 1 ) ) ; return t3_wait_op_done ( adapter , A_SF_OP , F_BUSY , 0 , SF_ATTEMPTS , 10 ) ; }
sf1_write - write data to the serial flash
      @adapter: the adapter
      @byte_cnt: number of bytes to write
      @cont: whether another operation will be chained
      @val: value to write
sf1_write - write data to the serial flash @adapter : the adapter @byte_cnt : number of bytes to write @cont : whether another operation will be chained @val : value to write