Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 50fd8b1f authored by Michael Welling's avatar Michael Welling Committed by Greg Kroah-Hartman
Browse files

STAGING: cxt1e1: Indentation fixes



Indentation fixes using Lindent.

Signed-off-by: default avatarMichael Welling <mwelling@ieee.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 9200b4da
Loading
Loading
Loading
Loading
+217 −264
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@
#define EE_FIRST    0x28	/* Index to start testing at */
#define EE_LIMIT    128		/* Index to end testing at */


/*  Bit Ordering for Instructions
**
**  A0, A1, A2, A3, A4, A5, A6, OP0, OP1, SB   (lsb, or 1st bit out)
@@ -69,14 +68,12 @@
#define LC46A_MAX_OPS   10	/* Number of bits in Instruction */
#define NUM_OF_BITS     8	/* Number of bits in data */


/* EEPROM signal bits */
#define EPROM_ACTIVE_OUT_BIT    0x0001	/* Out data bit */
#define EPROM_ACTIVE_IN_BIT     0x0002	/* In data bit */
#define ACTIVE_IN_BIT_SHIFT     0x0001	/* Shift In data bit to LSB */
#define EPROM_ENCS              0x0004	/* Set EEPROM CS during operation */


/*------------------------------------------------------------------------
 *      The ByteReverse table is used to reverses the 8 bits within a byte
 *------------------------------------------------------------------------
@@ -85,14 +82,12 @@
static unsigned char ByteReverse[256];
static int ByteReverseBuilt = FALSE;


/*------------------------------------------------------------------------
 *      mfg_template - initial serial EEPROM data structure
 *------------------------------------------------------------------------
 */

static u8 mfg_template[sizeof(FLD_TYPE2)] =
{
static u8 mfg_template[sizeof(FLD_TYPE2)] = {
	PROM_FORMAT_TYPE2,	/* type; */
	0x00, 0x1A,		/* length[2]; */
	0x00, 0x00, 0x00, 0x00,	/* Crc32[4]; */
@@ -105,7 +100,6 @@ static u8 mfg_template[sizeof(FLD_TYPE2)] =
	0x00, 0x00, 0x00, 0x00,	/* HeatRunErrors[4]; */
};


/*------------------------------------------------------------------------
 *      BuildByteReverse - build the 8-bit reverse table
 *------------------------------------------------------------------------
@@ -114,8 +108,7 @@ static u8 mfg_template[sizeof(FLD_TYPE2)] =
 *      (the MSB becomes the LSB etc.).
 */

static void
BuildByteReverse (void)
static void BuildByteReverse(void)
{
	long half;		/* Used to build by powers to 2 */
	int i;
@@ -124,29 +117,26 @@ BuildByteReverse (void)

	for (half = 1; half < sizeof(ByteReverse); half <<= 1)
		for (i = 0; i < half; i++)
            ByteReverse[half + i] = (char) (ByteReverse[i] | (0x80 / half));
			ByteReverse[half + i] =
			    (char)(ByteReverse[i] | (0x80 / half));

	ByteReverseBuilt = TRUE;
}


/*------------------------------------------------------------------------
 *      eeprom_delay - small delay for EEPROM timing
 *------------------------------------------------------------------------
 */

static void
eeprom_delay (void)
static void eeprom_delay(void)
{
	int timeout;

    for (timeout = 20; timeout; --timeout)
    {
	for (timeout = 20; timeout; --timeout) {
		OS_uwait_dummy();
	}
}


/*------------------------------------------------------------------------
 *      eeprom_put_byte - Send a byte to the EEPROM serially
 *------------------------------------------------------------------------
@@ -155,13 +145,11 @@ eeprom_delay (void)
 *      the data to the EEPROM.
 */

static void
eeprom_put_byte (long addr, long data, int count)
static void eeprom_put_byte(long addr, long data, int count)
{
	u_int32_t output;

    while (--count >= 0)
    {
	while (--count >= 0) {
		output = (data & EPROM_ACTIVE_OUT_BIT) ? 1 : 0;	/* Get next data bit */
		output |= EPROM_ENCS;	/* Add Chip Select */
		data >>= 1;
@@ -171,7 +159,6 @@ eeprom_put_byte (long addr, long data, int count)
	}
}


/*------------------------------------------------------------------------
 *      eeprom_get_byte - Receive a byte from the EEPROM serially
 *------------------------------------------------------------------------
@@ -180,8 +167,7 @@ eeprom_put_byte (long addr, long data, int count)
 *      from the  EEPROM.
 */

static u_int32_t
eeprom_get_byte (long addr)
static u_int32_t eeprom_get_byte(long addr)
{
	u_int32_t input;
	u_int32_t data;
@@ -197,8 +183,7 @@ eeprom_get_byte (long addr)

	data = 0;
	count = NUM_OF_BITS;
    while (--count >= 0)
    {
	while (--count >= 0) {
		eeprom_delay();
		input = pci_read_32((u_int32_t *) addr);

@@ -210,7 +195,6 @@ eeprom_get_byte (long addr)
	return data;
}


/*------------------------------------------------------------------------
 *      disable_pmc_eeprom - Disable writes to the EEPROM
 *------------------------------------------------------------------------
@@ -218,8 +202,7 @@ eeprom_get_byte (long addr)
 *      Issue the EEPROM command to disable writes.
 */

static void
disable_pmc_eeprom (long addr)
static void disable_pmc_eeprom(long addr)
{
	eeprom_put_byte(addr, EPROM_EWDS, SIZE_ADDR_OP);

@@ -227,7 +210,6 @@ disable_pmc_eeprom (long addr)
						 * from EEPROM */
}


/*------------------------------------------------------------------------
 *      enable_pmc_eeprom - Enable writes to the EEPROM
 *------------------------------------------------------------------------
@@ -235,8 +217,7 @@ disable_pmc_eeprom (long addr)
 *      Issue the EEPROM command to enable writes.
 */

static void
enable_pmc_eeprom (long addr)
static void enable_pmc_eeprom(long addr)
{
	eeprom_put_byte(addr, EPROM_EWEN, SIZE_ADDR_OP);

@@ -244,7 +225,6 @@ enable_pmc_eeprom (long addr)
						 * from EEPROM */
}


/*------------------------------------------------------------------------
 *      pmc_eeprom_read - EEPROM location read
 *------------------------------------------------------------------------
@@ -253,8 +233,7 @@ enable_pmc_eeprom (long addr)
 *      the contents of the specified location to the calling routine.
 */

static u_int32_t
pmc_eeprom_read (long addr, long mem_offset)
static u_int32_t pmc_eeprom_read(long addr, long mem_offset)
{
	u_int32_t data;		/* Data from chip */

@@ -281,7 +260,6 @@ pmc_eeprom_read (long addr, long mem_offset)
	return (data & 0x000000FF);
}


/*------------------------------------------------------------------------
 *      pmc_eeprom_write - EEPROM location write
 *------------------------------------------------------------------------
@@ -293,8 +271,7 @@ pmc_eeprom_read (long addr, long mem_offset)
 *      operation succeeded.
 */

static int
pmc_eeprom_write (long addr, long mem_offset, u_int32_t data)
static int pmc_eeprom_write(long addr, long mem_offset, u_int32_t data)
{
	volatile u_int32_t temp;
	int count;
@@ -329,19 +306,16 @@ pmc_eeprom_write (long addr, long mem_offset, u_int32_t data)
	pci_write_32((u_int32_t *) addr, EPROM_ENCS);	/* Re-enable Chip Select */
	temp = pci_read_32((u_int32_t *) addr);	/* discard first read */
	temp = pci_read_32((u_int32_t *) addr);
    if (temp & EPROM_ACTIVE_IN_BIT)
    {
	if (temp & EPROM_ACTIVE_IN_BIT) {
		temp = pci_read_32((u_int32_t *) addr);
        if (temp & EPROM_ACTIVE_IN_BIT)
        {
		if (temp & EPROM_ACTIVE_IN_BIT) {
			pci_write_32((u_int32_t *) addr, 0);	/* Remove Chip Select
								 * from EEPROM */
			return (1);
		}
	}
	count = 1000;
    while (count--)
    {
	while (count--) {
		for (temp = 0; temp < 0x10; temp++)
			OS_uwait_dummy();

@@ -355,20 +329,17 @@ pmc_eeprom_write (long addr, long mem_offset, u_int32_t data)
	return (0);
}


/*------------------------------------------------------------------------
 *      pmcGetBuffValue - read the specified value from buffer
 *------------------------------------------------------------------------
 */

static long
pmcGetBuffValue (char *ptr, int size)
static long pmcGetBuffValue(char *ptr, int size)
{
	long value = 0;
	int index;

    for (index = 0; index < size; ++index)
    {
	for (index = 0; index < size; ++index) {
		value <<= 8;
		value |= ptr[index] & 0xFF;
	}
@@ -376,25 +347,21 @@ pmcGetBuffValue (char *ptr, int size)
	return value;
}


/*------------------------------------------------------------------------
 *      pmcSetBuffValue - save the specified value to buffer
 *------------------------------------------------------------------------
 */

static void
pmcSetBuffValue (char *ptr, long value, int size)
static void pmcSetBuffValue(char *ptr, long value, int size)
{
	int index = size;

    while (--index >= 0)
    {
	while (--index >= 0) {
		ptr[index] = (char)(value & 0xFF);
		value >>= 8;
	}
}


/*------------------------------------------------------------------------
 *      pmc_eeprom_read_buffer - read EEPROM data into specified buffer
 *------------------------------------------------------------------------
@@ -407,7 +374,6 @@ pmc_eeprom_read_buffer (long addr, long mem_offset, char *dest_ptr, int size)
		*dest_ptr++ = (char)pmc_eeprom_read(addr, mem_offset++);
}


/*------------------------------------------------------------------------
 *      pmc_eeprom_write_buffer - write EEPROM data from specified buffer
 *------------------------------------------------------------------------
@@ -424,24 +390,20 @@ pmc_eeprom_write_buffer (long addr, long mem_offset, char *dest_ptr, int size)
	disable_pmc_eeprom(addr);
}


/*------------------------------------------------------------------------
 *      pmcCalcCrc - calculate the CRC for the serial EEPROM structure
 *------------------------------------------------------------------------
 */

static u_int32_t
pmcCalcCrc_T01 (void *bufp)
static u_int32_t pmcCalcCrc_T01(void *bufp)
{
	FLD_TYPE2 *buf = bufp;
	u_int32_t crc;		/* CRC of the structure */

	/* Calc CRC for type and length fields */
    sbeCrc (
            (u_int8_t *) &buf->type,
	sbeCrc((u_int8_t *) & buf->type,
	       (u_int32_t) STRUCT_OFFSET(FLD_TYPE1, Crc32),
            (u_int32_t) 0,
            (u_int32_t *) &crc);
	       (u_int32_t) 0, (u_int32_t *) & crc);

#ifdef EEPROM_TYPE_DEBUG
	pr_info("sbeCrc: crc 1 calculated as %08x\n", crc);	/* RLD DEBUG */
@@ -449,25 +411,20 @@ pmcCalcCrc_T01 (void *bufp)
	return ~crc;
}

static u_int32_t
pmcCalcCrc_T02 (void *bufp)
static u_int32_t pmcCalcCrc_T02(void *bufp)
{
	FLD_TYPE2 *buf = bufp;
	u_int32_t crc;		/* CRC of the structure */

	/* Calc CRC for type and length fields */
    sbeCrc (
            (u_int8_t *) &buf->type,
	sbeCrc((u_int8_t *) & buf->type,
	       (u_int32_t) STRUCT_OFFSET(FLD_TYPE2, Crc32),
            (u_int32_t) 0,
            (u_int32_t *) &crc);
	       (u_int32_t) 0, (u_int32_t *) & crc);

	/* Calc CRC for remaining fields */
    sbeCrc (
            (u_int8_t *) &buf->Id[0],
	sbeCrc((u_int8_t *) & buf->Id[0],
	       (u_int32_t) (sizeof(FLD_TYPE2) - STRUCT_OFFSET(FLD_TYPE2, Id)),
            (u_int32_t) crc,
            (u_int32_t *) &crc);
	       (u_int32_t) crc, (u_int32_t *) & crc);

#ifdef EEPROM_TYPE_DEBUG
	pr_info("sbeCrc: crc 2 calculated as %08x\n", crc);	/* RLD DEBUG */
@@ -475,7 +432,6 @@ pmcCalcCrc_T02 (void *bufp)
	return crc;
}


/*------------------------------------------------------------------------
 *      pmc_init_seeprom - initialize the serial EEPROM structure
 *------------------------------------------------------------------------
@@ -486,8 +442,7 @@ pmcCalcCrc_T02 (void *bufp)
 *      serial number field.
 */

void
pmc_init_seeprom (u_int32_t addr, u_int32_t serialNum)
void pmc_init_seeprom(u_int32_t addr, u_int32_t serialNum)
{
	PROMFORMAT buffer;	/* Memory image of structure */
	u_int32_t crc;		/* CRC of structure */
@@ -514,12 +469,11 @@ pmc_init_seeprom (u_int32_t addr, u_int32_t serialNum)
#endif

	/* Write structure to serial EEPROM */
    pmc_eeprom_write_buffer (addr, EE_MFG, (char *) &buffer, sizeof (FLD_TYPE2));
	pmc_eeprom_write_buffer(addr, EE_MFG, (char *)&buffer,
				sizeof(FLD_TYPE2));
}


char
pmc_verify_cksum (void *bufp)
char pmc_verify_cksum(void *bufp)
{
	FLD_TYPE1 *buf1 = bufp;
	FLD_TYPE2 *buf2 = bufp;
@@ -545,5 +499,4 @@ pmc_verify_cksum (void *bufp)
	return PROM_FORMAT_Unk;	/* failed to validate */
}


/*** End-of-File ***/