Merge branch 'master' of git://git.denx.de/u-boot-mmc
diff --git a/common/env_mmc.c b/common/env_mmc.c
index a5d14d4..45d95a1 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 @@
 #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)
+{
+	const char *propname = "u-boot,mmc-env-offset";
+	s64 defvalue = CONFIG_ENV_OFFSET;
+
+#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;
+	s64 offset = CONFIG_ENV_OFFSET;
 
-	offset = CONFIG_ENV_OFFSET;
-#ifdef CONFIG_ENV_OFFSET_REDUND
+#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 d4bc1df..fe0e04a 100644
--- a/doc/device-tree-bindings/config.txt
+++ b/doc/device-tree-bindings/config.txt
@@ -21,6 +21,18 @@
 
 	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 8e28ab7..2dda1b7 100644
--- a/drivers/mmc/meson_gx_mmc.c
+++ b/drivers/mmc/meson_gx_mmc.c
@@ -244,7 +244,7 @@
 			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 f32fa40..c5e768a 100644
--- a/drivers/power/pmic/pmic_tps65218.c
+++ b/drivers/power/pmic/pmic_tps65218.c
@@ -101,7 +101,7 @@
 
 	/* 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 7479af7..5e5815f 100644
--- a/drivers/power/regulator/max77686.c
+++ b/drivers/power/regulator/max77686.c
@@ -71,8 +71,8 @@
 
 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_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 @@
 
 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_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_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 8346b0e..6a0ea0a 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -430,7 +430,7 @@
 	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 4d68faa..e3538e2 100644
--- a/include/power/tps65218.h
+++ b/include/power/tps65218.h
@@ -56,6 +56,8 @@
 
 #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