mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-28 23:51:33 +00:00
Merge tag 'i2c-2022-04-rc5' of https://source.denx.de/u-boot/custodians/u-boot-i2c
i2c changes for fixes-for-2022.04 - atsha204a-i2c.c DTS and I2C fixes for Atmel ATSHA204 from Adrian - i2c: fix always-true condition in i2c_probe_chip() from Nikita - eeprom: Do not rewrite EEPROM I2C bus with DM I2C enabled from Marek - clarify bootcount documentation fix from Michael
This commit is contained in:
commit
5bc486286f
5 changed files with 29 additions and 27 deletions
|
@ -149,7 +149,7 @@ static int eeprom_rw(unsigned dev_addr, unsigned offset, uchar *buffer,
|
||||||
int rcode = 0;
|
int rcode = 0;
|
||||||
uchar addr[3];
|
uchar addr[3];
|
||||||
|
|
||||||
#if defined(CONFIG_SYS_I2C_EEPROM_BUS)
|
#if !CONFIG_IS_ENABLED(DM_I2C) && defined(CONFIG_SYS_I2C_EEPROM_BUS)
|
||||||
eeprom_init(CONFIG_SYS_I2C_EEPROM_BUS);
|
eeprom_init(CONFIG_SYS_I2C_EEPROM_BUS);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -3,14 +3,16 @@
|
||||||
Boot Count Limit
|
Boot Count Limit
|
||||||
================
|
================
|
||||||
|
|
||||||
|
This is enabled by CONFIG_BOOTCOUNT_LIMIT.
|
||||||
|
|
||||||
This allows to detect multiple failed attempts to boot Linux.
|
This allows to detect multiple failed attempts to boot Linux.
|
||||||
|
|
||||||
After a power-on reset, "bootcount" variable will be initialized with 1, and
|
After a power-on reset, the "bootcount" variable will be initialized to 1, and
|
||||||
each reboot will increment the value by 1.
|
each reboot will increment the value by 1.
|
||||||
|
|
||||||
If, after a reboot, the new value of "bootcount" exceeds the value of
|
If, after a reboot, the new value of "bootcount" exceeds the value of
|
||||||
"bootlimit", then instead of the standard boot action (executing the contents of
|
"bootlimit", then instead of the standard boot action (executing the contents of
|
||||||
"bootcmd") an alternate boot action will be performed, and the contents of
|
"bootcmd"), an alternate boot action will be performed, and the contents of
|
||||||
"altbootcmd" will be executed.
|
"altbootcmd" will be executed.
|
||||||
|
|
||||||
If the variable "bootlimit" is not defined in the environment, the Boot Count
|
If the variable "bootlimit" is not defined in the environment, the Boot Count
|
||||||
|
@ -18,18 +20,18 @@ Limit feature is disabled. If it is enabled, but "altbootcmd" is not defined,
|
||||||
then U-Boot will drop into interactive mode and remain there.
|
then U-Boot will drop into interactive mode and remain there.
|
||||||
|
|
||||||
It is the responsibility of some application code (typically a Linux
|
It is the responsibility of some application code (typically a Linux
|
||||||
application) to reset the variable "bootcount", thus allowing for more boot
|
application) to reset the variable "bootcount" to 0 when the system booted
|
||||||
cycles.
|
successfully, thus allowing for more boot cycles.
|
||||||
|
|
||||||
BOOTCOUNT_EXT
|
CONFIG_BOOTCOUNT_EXT
|
||||||
-------------
|
--------------------
|
||||||
|
|
||||||
This adds support for maintaining boot count in a file on an EXT filesystem.
|
This adds support for maintaining boot count in a file on an EXT filesystem.
|
||||||
The file to use is define by:
|
The file to use is defined by:
|
||||||
|
|
||||||
SYS_BOOTCOUNT_EXT_INTERFACE
|
CONFIG_SYS_BOOTCOUNT_EXT_INTERFACE
|
||||||
SYS_BOOTCOUNT_EXT_DEVPART
|
CONFIG_SYS_BOOTCOUNT_EXT_DEVPART
|
||||||
SYS_BOOTCOUNT_EXT_NAME
|
CONFIG_SYS_BOOTCOUNT_EXT_NAME
|
||||||
|
|
||||||
The format of the file is:
|
The format of the file is:
|
||||||
|
|
||||||
|
@ -42,10 +44,10 @@ u8 bootcount
|
||||||
u8 upgrade_available
|
u8 upgrade_available
|
||||||
==== =================
|
==== =================
|
||||||
|
|
||||||
To prevent unattended usage of "altbootcmd" the "upgrade_available" variable is
|
To prevent unattended usage of "altbootcmd", the "upgrade_available" variable is
|
||||||
used.
|
used.
|
||||||
If "upgrade_available" is 0, "bootcount" is not saved, if "upgrade_available" is
|
If "upgrade_available" is 0, "bootcount" is not saved.
|
||||||
1 "bootcount" is save.
|
If "upgrade_available" is 1, "bootcount" is saved.
|
||||||
So the Userspace Application must set the "upgrade_available" and "bootcount"
|
So a userspace application should take care of setting the "upgrade_available"
|
||||||
variables to 0, if a boot was successfully.
|
and "bootcount" variables to 0, if the system boots successfully.
|
||||||
This also prevents writes on all reboots.
|
This also avoids writing the "bootcount" information on all reboots.
|
||||||
|
|
|
@ -68,15 +68,15 @@ config BOOTCOUNT_ENV
|
||||||
"bootcount" is stored in the environment. To prevent a
|
"bootcount" is stored in the environment. To prevent a
|
||||||
saveenv on all reboots, the environment variable
|
saveenv on all reboots, the environment variable
|
||||||
"upgrade_available" is used. If "upgrade_available" is
|
"upgrade_available" is used. If "upgrade_available" is
|
||||||
0, "bootcount" is always 0, if "upgrade_available" is
|
0, "bootcount" is always 0. If "upgrade_available" is 1,
|
||||||
1 "bootcount" is incremented in the environment.
|
"bootcount" is incremented in the environment.
|
||||||
So the Userspace Application must set the "upgrade_available"
|
So the Userspace Application must set the "upgrade_available"
|
||||||
and "bootcount" variable to 0, if a boot was successfully.
|
and "bootcount" variables to 0, if the system booted successfully.
|
||||||
|
|
||||||
config BOOTCOUNT_RAM
|
config BOOTCOUNT_RAM
|
||||||
bool "Boot counter in RAM"
|
bool "Boot counter in RAM"
|
||||||
help
|
help
|
||||||
Store the bootcount in DRAM protected against against bit errors
|
Store the bootcount in DRAM protected against bit errors
|
||||||
due to short power loss or holding a system in RESET.
|
due to short power loss or holding a system in RESET.
|
||||||
|
|
||||||
config BOOTCOUNT_I2C
|
config BOOTCOUNT_I2C
|
||||||
|
@ -166,7 +166,7 @@ config BOOTCOUNT_BOOTLIMIT
|
||||||
help
|
help
|
||||||
Set the Maximum number of reboot cycles allowed without the boot
|
Set the Maximum number of reboot cycles allowed without the boot
|
||||||
counter being cleared.
|
counter being cleared.
|
||||||
If set to 0 do not set a boot limit in the environment.
|
If set to 0, do not set a boot limit in the environment.
|
||||||
|
|
||||||
config BOOTCOUNT_ALEN
|
config BOOTCOUNT_ALEN
|
||||||
int "I2C address length"
|
int "I2C address length"
|
||||||
|
|
|
@ -280,7 +280,7 @@ static int i2c_probe_chip(struct udevice *bus, uint chip_addr,
|
||||||
|
|
||||||
if (ops->probe_chip) {
|
if (ops->probe_chip) {
|
||||||
ret = ops->probe_chip(bus, chip_addr, chip_flags);
|
ret = ops->probe_chip(bus, chip_addr, chip_flags);
|
||||||
if (!ret || ret != -ENOSYS)
|
if (ret != -ENOSYS)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -240,10 +240,10 @@ int atsha204a_wakeup(struct udevice *dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
debug("success\n");
|
debug("success\n");
|
||||||
break;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return -ETIMEDOUT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int atsha204a_idle(struct udevice *dev)
|
int atsha204a_idle(struct udevice *dev)
|
||||||
|
@ -280,6 +280,7 @@ static int atsha204a_transaction(struct udevice *dev, struct atsha204a_req *req,
|
||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
udelay(ATSHA204A_EXECTIME);
|
||||||
res = atsha204a_recv_resp(dev, resp);
|
res = atsha204a_recv_resp(dev, resp);
|
||||||
if (!res || res == -EMSGSIZE || res == -EBADMSG)
|
if (!res || res == -EMSGSIZE || res == -EBADMSG)
|
||||||
break;
|
break;
|
||||||
|
@ -287,7 +288,6 @@ static int atsha204a_transaction(struct udevice *dev, struct atsha204a_req *req,
|
||||||
debug("ATSHA204A transaction polling for response "
|
debug("ATSHA204A transaction polling for response "
|
||||||
"(timeout = %d)\n", timeout);
|
"(timeout = %d)\n", timeout);
|
||||||
|
|
||||||
udelay(ATSHA204A_EXECTIME);
|
|
||||||
timeout -= ATSHA204A_EXECTIME;
|
timeout -= ATSHA204A_EXECTIME;
|
||||||
} while (timeout > 0);
|
} while (timeout > 0);
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ static int atsha204a_of_to_plat(struct udevice *dev)
|
||||||
fdt_addr_t *priv = dev_get_priv(dev);
|
fdt_addr_t *priv = dev_get_priv(dev);
|
||||||
fdt_addr_t addr;
|
fdt_addr_t addr;
|
||||||
|
|
||||||
addr = fdtdec_get_addr(gd->fdt_blob, dev_of_offset(dev), "reg");
|
addr = dev_read_addr(dev);
|
||||||
if (addr == FDT_ADDR_T_NONE) {
|
if (addr == FDT_ADDR_T_NONE) {
|
||||||
debug("Can't get ATSHA204A I2C base address\n");
|
debug("Can't get ATSHA204A I2C base address\n");
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
|
|
Loading…
Reference in a new issue