diff options
-rw-r--r-- | common/env_mmc.c | 31 | ||||
-rw-r--r-- | doc/device-tree-bindings/config.txt | 12 | ||||
-rw-r--r-- | drivers/mmc/meson_gx_mmc.c | 2 | ||||
-rw-r--r-- | drivers/power/pmic/pmic_tps65218.c | 2 | ||||
-rw-r--r-- | drivers/power/regulator/max77686.c | 16 | ||||
-rw-r--r-- | include/mmc.h | 2 | ||||
-rw-r--r-- | include/power/tps65218.h | 2 |
7 files changed, 52 insertions, 15 deletions
diff --git a/common/env_mmc.c b/common/env_mmc.c index a5d14d448c..45d95a1e23 100644 --- a/common/env_mmc.c +++ b/common/env_mmc.c @@ -10,6 +10,7 @@ #include <command.h> #include <environment.h> +#include <fdtdec.h> #include <linux/stddef.h> #include <malloc.h> #include <memalign.h> @@ -36,15 +37,37 @@ DECLARE_GLOBAL_DATA_PTR; #define CONFIG_ENV_OFFSET 0 #endif -__weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr) +#if CONFIG_IS_ENABLED(OF_CONTROL) +static inline s64 mmc_offset(int copy) { - s64 offset; + const char *propname = "u-boot,mmc-env-offset"; + s64 defvalue = CONFIG_ENV_OFFSET; - offset = CONFIG_ENV_OFFSET; -#ifdef CONFIG_ENV_OFFSET_REDUND +#if defined(CONFIG_ENV_OFFSET_REDUND) + if (copy) { + propname = "u-boot,mmc-env-offset-redundant"; + defvalue = CONFIG_ENV_OFFSET_REDUND; + } +#endif + + return fdtdec_get_config_int(gd->fdt_blob, propname, defvalue); +} +#else +static inline s64 mmc_offset(int copy) +{ + s64 offset = CONFIG_ENV_OFFSET; + +#if defined(CONFIG_ENV_OFFSET_REDUND) if (copy) offset = CONFIG_ENV_OFFSET_REDUND; #endif + return offset; +} +#endif + +__weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr) +{ + s64 offset = mmc_offset(copy); if (offset < 0) offset += mmc->capacity; diff --git a/doc/device-tree-bindings/config.txt b/doc/device-tree-bindings/config.txt index d4bc1df553..fe0e04af92 100644 --- a/doc/device-tree-bindings/config.txt +++ b/doc/device-tree-bindings/config.txt @@ -21,6 +21,18 @@ u-boot,efi-partition-entries-offset This setting will override any values configured via Kconfig. +u-boot,mmc-env-offset +u-boot,mmc-env-offset-redundant + If present, the values of the 'u-boot,mmc-env-offset' and/or + of the u-boot,mmc-env-offset-redundant' properties overrides + CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND, respectively, + for SD/MMC devices. + + Values are interpreted as the offset from the start of the + device, specified in bytes. It is assumed that the setting + will point at the beginning of a LBA and values that are not + LBA-aligned will be rounded up to the next LBA address. + u-boot,spl-payload-offset If present (and SPL is controlled by the device-tree), this allows to override the CONFIG_SYS_SPI_U_BOOT_OFFS setting using a value diff --git a/drivers/mmc/meson_gx_mmc.c b/drivers/mmc/meson_gx_mmc.c index 8e28ab70f5..2dda1b7064 100644 --- a/drivers/mmc/meson_gx_mmc.c +++ b/drivers/mmc/meson_gx_mmc.c @@ -244,7 +244,7 @@ static int meson_mmc_probe(struct udevice *dev) MMC_MODE_HS_52MHz | MMC_MODE_HS; cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV); cfg->f_max = 100000000; /* 100 MHz */ - cfg->b_max = 256; /* max 256 blocks */ + cfg->b_max = 511; /* max 512 - 1 blocks */ cfg->name = dev->name; mmc->priv = pdata; diff --git a/drivers/power/pmic/pmic_tps65218.c b/drivers/power/pmic/pmic_tps65218.c index f32fa40863..c5e768ae4b 100644 --- a/drivers/power/pmic/pmic_tps65218.c +++ b/drivers/power/pmic/pmic_tps65218.c @@ -101,7 +101,7 @@ int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel) /* set voltage level */ if (tps65218_reg_write(TPS65218_PROT_LEVEL_2, dc_cntrl_reg, volt_sel, - TPS65218_MASK_ALL_BITS)) + TPS65218_DCDC_VSEL_MASK)) return 1; /* set GO bit to initiate voltage transition */ diff --git a/drivers/power/regulator/max77686.c b/drivers/power/regulator/max77686.c index 7479af734a..5e5815f397 100644 --- a/drivers/power/regulator/max77686.c +++ b/drivers/power/regulator/max77686.c @@ -71,8 +71,8 @@ static const char max77686_buck_out[] = { static int max77686_buck_volt2hex(int buck, int uV) { - unsigned int hex = 0; - unsigned int hex_max = 0; + int hex = 0; + int hex_max = 0; switch (buck) { case 2: @@ -105,7 +105,7 @@ static int max77686_buck_volt2hex(int buck, int uV) static int max77686_buck_hex2volt(int buck, int hex) { unsigned uV = 0; - unsigned int hex_max = 0; + int hex_max = 0; if (hex < 0) goto bad_hex; @@ -140,7 +140,7 @@ bad_hex: static int max77686_ldo_volt2hex(int ldo, int uV) { - unsigned int hex = 0; + int hex = 0; switch (ldo) { case 1: @@ -319,9 +319,9 @@ static int max77686_ldo_modes(int ldo, struct dm_regulator_mode **modesp, static int max77686_ldo_val(struct udevice *dev, int op, int *uV) { - unsigned int hex, adr; + unsigned int adr; unsigned char val; - int ldo, ret; + int hex, ldo, ret; if (op == PMIC_OP_GET) *uV = 0; @@ -360,9 +360,9 @@ static int max77686_ldo_val(struct udevice *dev, int op, int *uV) static int max77686_buck_val(struct udevice *dev, int op, int *uV) { - unsigned int hex, mask, adr; + unsigned int mask, adr; unsigned char val; - int buck, ret; + int hex, buck, ret; buck = dev->driver_data; if (buck < 1 || buck > MAX77686_BUCK_NUM) { diff --git a/include/mmc.h b/include/mmc.h index 8346b0e19e..6a0ea0af21 100644 --- a/include/mmc.h +++ b/include/mmc.h @@ -430,7 +430,7 @@ struct mmc { u8 part_support; u8 part_attr; u8 wr_rel_set; - char part_config; + u8 part_config; uint tran_speed; uint read_bl_len; uint write_bl_len; diff --git a/include/power/tps65218.h b/include/power/tps65218.h index 4d68faacaf..e3538e21f0 100644 --- a/include/power/tps65218.h +++ b/include/power/tps65218.h @@ -56,6 +56,8 @@ enum { #define TPS65218_MASK_ALL_BITS 0xFF +#define TPS65218_DCDC_VSEL_MASK 0x3F + #define TPS65218_DCDC_VOLT_SEL_0950MV 0x0a #define TPS65218_DCDC_VOLT_SEL_1100MV 0x19 #define TPS65218_DCDC_VOLT_SEL_1200MV 0x23 |