Addressing review comments version 0.1

This commit is contained in:
Sridhar Pitchai
2016-10-29 08:00:52 -07:00
parent 1c4da7ce75
commit 9955252eef
8 changed files with 39 additions and 52 deletions

View File

@@ -1,12 +0,0 @@
#ifndef __CPLDS_H__
#define __CPLDS_H__
int cpld_io_init(void);
int cpld_read(int addr);
void cpld_write(int addr, uint8_t value);
void cpld_modify(int addr, uint8_t andmask, uint8_t ormask);
int cpld_dump(aim_pvs_t* pvs, int cpldid);
#endif /* __CPLDS_H__ */

View File

@@ -10,11 +10,10 @@
#include <sys/time.h>
#include "cpld.h"
#include "i2c_dev.h"
#include "i2c_chips.h"
#include "redstone_cpld.h"
//#define PSOC_TAKE_I2C
#define PSOC_CTRL_SMBUS 0x01
static struct ts_info ts[] = {
@@ -36,36 +35,33 @@ static const struct dev_info i2c_dev[NUM_CHIPS] = {
#define FANGROUP_NUM 4
static const struct fan_config fan[FAN_NUM] = {
{0x4D, 0x4E, 0x40},//Fan 1 Front
{0x2E, 0x4E, 0x40},//Fan 1 Rear
{0x4D, 0x6E, 0x60},//Fan 2 F
{0x2e, 0x3E, 0x30},//Fan 2 R
{0x4D, 0x5E, 0x50},//Fan 3 F
{0x2E, 0x7E, 0x70},//Fan 3 R
{0x4D, 0x3E, 0x30},//Fan 4 F
{0x2E, 0x5E, 0x50},//Fan 4 R
{0x4D, 0x4E, 0x40}, //Fan 1 Front
{0x2E, 0x4E, 0x40}, //Fan 1 Rear
{0x4D, 0x6E, 0x60}, //Fan 2 F
{0x2e, 0x3E, 0x30}, //Fan 2 R
{0x4D, 0x5E, 0x50}, //Fan 3 F
{0x2E, 0x7E, 0x70}, //Fan 3 R
{0x4D, 0x3E, 0x30}, //Fan 4 F
{0x2E, 0x5E, 0x50}, //Fan 4 R
};
static struct led_gpio ledGpio[] = {
{32, 31},//4_0,3_7, gpio(x_y) = x*8+y
{30, 29},//3_6,3_5
/*{36, 35},//4_4,4_3 For smallstone*/
{38, 37},//4_6,4_5
{34, 33},//4_2,4_1
{32, 31}, //4_0,3_7, gpio(x_y) = x*8+y
{30, 29}, //3_6,3_5
{38, 37}, //4_6,4_5
{34, 33}, //4_2,4_1
};
static unsigned char airFlowGpio[] = {
16,//IO2_0 gpio = 2*8+0, gpio(x_y) = x*8+y
15,//IO1_7
/*18,//IO2_2 //For smallstone */
19,//IO2_3
17,//IO2_1
16, //IO2_0 gpio = 2*8+0, gpio(x_y) = x*8+y
15, //IO1_7
19, //IO2_3
17, //IO2_1
};
static unsigned char presentGpio[] = {
11,//IO1_3 gpio = 2*8+0, gpio(x_y) = x*8+y
10,//IO1_2
/* 13,//IO1_5 //For smallstone */
14,//IO1_6
12,//IO1_4
11, //IO1_3 gpio = 2*8+0, gpio(x_y) = x*8+y
10, //IO1_2
14, //IO1_6
12, //IO1_4
};
static int has_been_read = 0;

View File

@@ -1,5 +1,5 @@
#ifndef CPLD_H
#define CPLD_H
#ifndef _PLATFORM_REDSTONE_H_
#define _PLATFORM_REDSTONE_H_
#define FAN_COUNT 10
#define PSU_FAN 8
@@ -25,4 +25,4 @@
#define LED_PSU_1 9
#define LED_PSU_2 10
#endif
#endif /* _PLATFORM_REDSTONE_H_ */

View File

@@ -5,7 +5,7 @@
#include <x86_64_cel_redstone_xp/x86_64_cel_redstone_xp_config.h>
#include "x86_64_cel_redstone_xp_log.h"
#include "x86_64_cel_redstone_xp_int.h"
#include "cplds.h"
#include "redstone_cpld.h"
int
cpld_io_init(void)
@@ -78,7 +78,6 @@ cpld_dump(aim_pvs_t* pvs, int cpldid)
}
// EXPERIMENT
#define PORT_BANK1_START 1
#define PORT_BANK1_END 18
#define PORT_BANK2_START 19
@@ -209,9 +208,7 @@ read_sfp(int portID, char devAddr, char reg, char *data, int len)
outb(reg, ioBase + cmdbyte0);
}
}
// FIXME
return writedata * 0;
// return 0;
}
int
@@ -320,8 +317,6 @@ write_sfp(int portID, char devAddr, char reg, char *data, int len)
outb(ioBase + cmdbyte0, reg);
}
}
// FIXME
return writedata * readdata * 0;
// return 0;
}

View File

@@ -1,6 +1,8 @@
#ifndef CPLD_H
#define CPLD_H
#ifndef _REDSTONE_CPLD_H_
#define _REDSTONE_CPLD_H_
#include <stdint.h>
#include <AIM/aim_log.h>
#include <asm/ioctl.h>
#define BIT0 0x1
@@ -58,4 +60,10 @@ int write_cpld(int reg, unsigned char value);
int read_sfp(int portID, char devAddr, char reg, char *data, int len);
int write_sfp(int portID, char devAddr, char reg, char *data, int len);
#endif
int cpld_io_init(void);
int cpld_read(int addr);
void cpld_write(int addr, uint8_t value);
void cpld_modify(int addr, uint8_t andmask, uint8_t ormask);
int cpld_dump(aim_pvs_t* pvs, int cpldid);
#endif /* _REDSTONE_CPLD_H_ */

View File

@@ -6,7 +6,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include "cpld.h"
#include "redstone_cpld.h"
#include "x86_64_cel_redstone_xp_int.h"
#include "sfp_xfp.h"

View File

@@ -6,9 +6,9 @@
#include <fcntl.h>
#include "sys_eeprom.h"
#include "cpld.h"
#include "i2c_chips.h"
#include "i2c_dev.h"
#include "redstone_cpld.h"
static inline u_int8_t is_valid_tlvinfo_header(tlvinfo_header_t *hdr)
{

View File

@@ -8,8 +8,8 @@
#include "x86_64_cel_redstone_xp_log.h"
#include "platform.h"
#include "cplds.h"
#include "sys_eeprom.h"
#include "redstone_cpld.h"
const char*
onlp_sysi_platform_get(void)