mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-18 21:21:37 +00:00
Merge branch 'master' of https://gitlab.denx.de/u-boot/custodians/u-boot-net
- Fix phy_connect() call in two drivers - fw_setenv bugfix
This commit is contained in:
commit
1e104ac61f
3 changed files with 21 additions and 3 deletions
|
@ -50,7 +50,7 @@ static int bcm_sf2_eth_init(struct eth_device *dev)
|
|||
eth->port_num = 0;
|
||||
debug("Connecting PHY 0...\n");
|
||||
phydev = phy_connect(miiphy_get_dev_by_name(dev->name),
|
||||
0, dev, eth->phy_interface);
|
||||
-1, dev, eth->phy_interface);
|
||||
if (phydev != NULL) {
|
||||
eth->port[0] = phydev;
|
||||
eth->port_num += 1;
|
||||
|
|
|
@ -1045,7 +1045,7 @@ static int eqos_start(struct udevice *dev)
|
|||
* don't need to reconnect/reconfigure again
|
||||
*/
|
||||
if (!eqos->phy) {
|
||||
eqos->phy = phy_connect(eqos->mii, 0, dev,
|
||||
eqos->phy = phy_connect(eqos->mii, -1, dev,
|
||||
eqos->config->interface(dev));
|
||||
if (!eqos->phy) {
|
||||
pr_err("phy_connect() failed");
|
||||
|
|
20
tools/env/fw_env.c
vendored
20
tools/env/fw_env.c
vendored
|
@ -112,6 +112,7 @@ struct environment {
|
|||
unsigned char *flags;
|
||||
char *data;
|
||||
enum flag_scheme flag_scheme;
|
||||
int dirty;
|
||||
};
|
||||
|
||||
static struct environment environment = {
|
||||
|
@ -506,6 +507,9 @@ int fw_env_flush(struct env_opts *opts)
|
|||
if (!opts)
|
||||
opts = &default_opts;
|
||||
|
||||
if (!environment.dirty)
|
||||
return 0;
|
||||
|
||||
/*
|
||||
* Update CRC
|
||||
*/
|
||||
|
@ -551,7 +555,8 @@ int fw_env_write(char *name, char *value)
|
|||
|
||||
deleting = (oldval && !(value && strlen(value)));
|
||||
creating = (!oldval && (value && strlen(value)));
|
||||
overwriting = (oldval && (value && strlen(value)));
|
||||
overwriting = (oldval && (value && strlen(value) &&
|
||||
strcmp(oldval, value)));
|
||||
|
||||
/* check for permission */
|
||||
if (deleting) {
|
||||
|
@ -591,6 +596,7 @@ int fw_env_write(char *name, char *value)
|
|||
/* Nothing to do */
|
||||
return 0;
|
||||
|
||||
environment.dirty = 1;
|
||||
if (deleting || overwriting) {
|
||||
if (*++nxt == '\0') {
|
||||
*env = '\0';
|
||||
|
@ -1440,6 +1446,7 @@ int fw_env_open(struct env_opts *opts)
|
|||
"Warning: Bad CRC, using default environment\n");
|
||||
memcpy(environment.data, default_environment,
|
||||
sizeof(default_environment));
|
||||
environment.dirty = 1;
|
||||
}
|
||||
} else {
|
||||
flag0 = *environment.flags;
|
||||
|
@ -1493,6 +1500,16 @@ int fw_env_open(struct env_opts *opts)
|
|||
crc1_ok = (crc1 == redundant->crc);
|
||||
flag1 = redundant->flags;
|
||||
|
||||
/*
|
||||
* environment.data still points to ((struct
|
||||
* env_image_redundant *)addr0)->data. If the two
|
||||
* environments differ, or one has bad crc, force a
|
||||
* write-out by marking the environment dirty.
|
||||
*/
|
||||
if (memcmp(environment.data, redundant->data, ENV_SIZE) ||
|
||||
!crc0_ok || !crc1_ok)
|
||||
environment.dirty = 1;
|
||||
|
||||
if (crc0_ok && !crc1_ok) {
|
||||
dev_current = 0;
|
||||
} else if (!crc0_ok && crc1_ok) {
|
||||
|
@ -1502,6 +1519,7 @@ int fw_env_open(struct env_opts *opts)
|
|||
"Warning: Bad CRC, using default environment\n");
|
||||
memcpy(environment.data, default_environment,
|
||||
sizeof(default_environment));
|
||||
environment.dirty = 1;
|
||||
dev_current = 0;
|
||||
} else {
|
||||
switch (environment.flag_scheme) {
|
||||
|
|
Loading…
Add table
Reference in a new issue