Skip to content

Commit

Permalink
Merge branch 'master' of git://git.denx.de/u-boot-mmc
Browse files Browse the repository at this point in the history
  • Loading branch information
trini committed May 30, 2017
2 parents 380e86f + de59d10 commit ccbbada
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 15 deletions.
31 changes: 27 additions & 4 deletions common/env_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include <command.h>
#include <environment.h>
#include <fdtdec.h>
#include <linux/stddef.h>
#include <malloc.h>
#include <memalign.h>
Expand All @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions doc/device-tree-bindings/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion drivers/mmc/meson_gx_mmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion drivers/power/pmic/pmic_tps65218.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
16 changes: 8 additions & 8 deletions drivers/power/regulator/max77686.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -140,7 +140,7 @@ static int max77686_buck_hex2volt(int buck, int hex)

static int max77686_ldo_volt2hex(int ldo, int uV)
{
unsigned int hex = 0;
int hex = 0;

switch (ldo) {
case 1:
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion include/mmc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions include/power/tps65218.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ccbbada

Please sign in to comment.