GSC_SC_RST_CAUSE_MAX = 10,
};
+#include <dm/device.h>
static struct udevice *gsc_get_dev(int busno, int slave)
{
- static const char * const i2c[] = { "i2c@30a20000", "i2c@30a30000" };
struct udevice *dev, *bus;
int ret;
- ret = uclass_get_device_by_name(UCLASS_I2C, i2c[busno - 1], &bus);
+ ret = uclass_get_device_by_seq(UCLASS_I2C, busno, &bus);
if (ret) {
printf("GSC : failed I2C%d probe: %d\n", busno, ret);
return NULL;
return node;
/* probe device */
- dev = gsc_get_dev(1, GSC_HWMON_ADDR);
+ dev = gsc_get_dev(GSC_BUSNO, GSC_HWMON_ADDR);
if (!dev) {
puts("ERROR: Failed to probe GSC HWMON\n");
return -ENODEV;
{
int ret;
- ret = gsc_read_eeprom(1, GSC_EEPROM_ADDR, 1, &som_info);
+ ret = gsc_read_eeprom(GSC_BUSNO, GSC_EEPROM_ADDR, 1, &som_info);
if (ret) {
memset(&som_info, 0, sizeof(som_info));
return ret;
}
/* read optional baseboard EEPROM */
- return gsc_read_eeprom(2, 0x52, 2, &base_info);
+ return gsc_read_eeprom(BASEBOARD_EEPROM_BUSNO, BASEBOARD_EEPROM_ADDR,
+ 2, &base_info);
}
static int gsc_info(int verbose)
/* Display RTC */
puts("RTC : ");
- dev = gsc_get_dev(1, GSC_RTC_ADDR);
+ dev = gsc_get_dev(GSC_BUSNO, GSC_RTC_ADDR);
if (!dev) {
puts("Failed to probe GSC RTC\n");
} else {
*/
while (1) {
/* probe device */
- dev = gsc_get_dev(1, GSC_SC_ADDR);
+ dev = gsc_get_dev(GSC_BUSNO, GSC_SC_ADDR);
if (dev)
break;
mdelay(1);
int ret;
/* probe device */
- dev = gsc_get_dev(1, GSC_SC_ADDR);
+ dev = gsc_get_dev(GSC_BUSNO, GSC_SC_ADDR);
if (!dev)
return -ENODEV;
int ret;
/* probe device */
- dev = gsc_get_dev(1, GSC_SC_ADDR);
+ dev = gsc_get_dev(GSC_BUSNO, GSC_SC_ADDR);
if (!dev)
return -ENODEV;
#ifndef _GSC_H_
#define _GSC_H_
+/* I2C bus numbers */
+#define GSC_BUSNO 0
+#define BASEBOARD_EEPROM_BUSNO 1
+
/* I2C slave addresses */
#define GSC_SC_ADDR 0x20
#define GSC_RTC_ADDR 0x68
#define GSC_HWMON_ADDR 0x29
#define GSC_EEPROM_ADDR 0x51
+#define BASEBOARD_EEPROM_ADDR 0x52
struct venice_board_info {
u8 mac[6]; /* 0x00: MAC base */
if ((!strncmp(model, "GW71", 4)) ||
(!strncmp(model, "GW72", 4)) ||
(!strncmp(model, "GW73", 4))) {
- ret = uclass_get_device_by_name(UCLASS_I2C, "i2c@30a20000", &bus);
+ ret = uclass_get_device_by_seq(UCLASS_I2C, 0, &bus);
if (ret) {
printf("PMIC : failed I2C1 probe: %d\n", ret);
return ret;
}
else if (!strncmp(model, "GW7901", 6)) {
- ret = uclass_get_device_by_name(UCLASS_I2C, "i2c@30a30000", &bus);
+ ret = uclass_get_device_by_seq(UCLASS_I2C, 1, &bus);
if (ret) {
printf("PMIC : failed I2C2 probe: %d\n", ret);
return ret;