Commit ccbbada0a59fead35495409d0c2c7bcb22a40278

Authored by Tom Rini

Merge branch 'master' of git://git.denx.de/u-boot-mmc

Showing 7 changed files Side-by-side Diff

... ... @@ -10,6 +10,7 @@
10 10  
11 11 #include <command.h>
12 12 #include <environment.h>
  13 +#include <fdtdec.h>
13 14 #include <linux/stddef.h>
14 15 #include <malloc.h>
15 16 #include <memalign.h>
16 17  
17 18  
18 19  
... ... @@ -36,15 +37,37 @@
36 37 #define CONFIG_ENV_OFFSET 0
37 38 #endif
38 39  
39   -__weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
  40 +#if CONFIG_IS_ENABLED(OF_CONTROL)
  41 +static inline s64 mmc_offset(int copy)
40 42 {
41   - s64 offset;
  43 + const char *propname = "u-boot,mmc-env-offset";
  44 + s64 defvalue = CONFIG_ENV_OFFSET;
42 45  
43   - offset = CONFIG_ENV_OFFSET;
44   -#ifdef CONFIG_ENV_OFFSET_REDUND
  46 +#if defined(CONFIG_ENV_OFFSET_REDUND)
  47 + if (copy) {
  48 + propname = "u-boot,mmc-env-offset-redundant";
  49 + defvalue = CONFIG_ENV_OFFSET_REDUND;
  50 + }
  51 +#endif
  52 +
  53 + return fdtdec_get_config_int(gd->fdt_blob, propname, defvalue);
  54 +}
  55 +#else
  56 +static inline s64 mmc_offset(int copy)
  57 +{
  58 + s64 offset = CONFIG_ENV_OFFSET;
  59 +
  60 +#if defined(CONFIG_ENV_OFFSET_REDUND)
45 61 if (copy)
46 62 offset = CONFIG_ENV_OFFSET_REDUND;
47 63 #endif
  64 + return offset;
  65 +}
  66 +#endif
  67 +
  68 +__weak int mmc_get_env_addr(struct mmc *mmc, int copy, u32 *env_addr)
  69 +{
  70 + s64 offset = mmc_offset(copy);
48 71  
49 72 if (offset < 0)
50 73 offset += mmc->capacity;
doc/device-tree-bindings/config.txt
... ... @@ -21,6 +21,18 @@
21 21  
22 22 This setting will override any values configured via Kconfig.
23 23  
  24 +u-boot,mmc-env-offset
  25 +u-boot,mmc-env-offset-redundant
  26 + If present, the values of the 'u-boot,mmc-env-offset' and/or
  27 + of the u-boot,mmc-env-offset-redundant' properties overrides
  28 + CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND, respectively,
  29 + for SD/MMC devices.
  30 +
  31 + Values are interpreted as the offset from the start of the
  32 + device, specified in bytes. It is assumed that the setting
  33 + will point at the beginning of a LBA and values that are not
  34 + LBA-aligned will be rounded up to the next LBA address.
  35 +
24 36 u-boot,spl-payload-offset
25 37 If present (and SPL is controlled by the device-tree), this allows
26 38 to override the CONFIG_SYS_SPI_U_BOOT_OFFS setting using a value
drivers/mmc/meson_gx_mmc.c
... ... @@ -244,7 +244,7 @@
244 244 MMC_MODE_HS_52MHz | MMC_MODE_HS;
245 245 cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
246 246 cfg->f_max = 100000000; /* 100 MHz */
247   - cfg->b_max = 256; /* max 256 blocks */
  247 + cfg->b_max = 511; /* max 512 - 1 blocks */
248 248 cfg->name = dev->name;
249 249  
250 250 mmc->priv = pdata;
drivers/power/pmic/pmic_tps65218.c
... ... @@ -101,7 +101,7 @@
101 101  
102 102 /* set voltage level */
103 103 if (tps65218_reg_write(TPS65218_PROT_LEVEL_2, dc_cntrl_reg, volt_sel,
104   - TPS65218_MASK_ALL_BITS))
  104 + TPS65218_DCDC_VSEL_MASK))
105 105 return 1;
106 106  
107 107 /* set GO bit to initiate voltage transition */
drivers/power/regulator/max77686.c
... ... @@ -71,8 +71,8 @@
71 71  
72 72 static int max77686_buck_volt2hex(int buck, int uV)
73 73 {
74   - unsigned int hex = 0;
75   - unsigned int hex_max = 0;
  74 + int hex = 0;
  75 + int hex_max = 0;
76 76  
77 77 switch (buck) {
78 78 case 2:
... ... @@ -105,7 +105,7 @@
105 105 static int max77686_buck_hex2volt(int buck, int hex)
106 106 {
107 107 unsigned uV = 0;
108   - unsigned int hex_max = 0;
  108 + int hex_max = 0;
109 109  
110 110 if (hex < 0)
111 111 goto bad_hex;
... ... @@ -140,7 +140,7 @@
140 140  
141 141 static int max77686_ldo_volt2hex(int ldo, int uV)
142 142 {
143   - unsigned int hex = 0;
  143 + int hex = 0;
144 144  
145 145 switch (ldo) {
146 146 case 1:
147 147  
... ... @@ -319,9 +319,9 @@
319 319  
320 320 static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
321 321 {
322   - unsigned int hex, adr;
  322 + unsigned int adr;
323 323 unsigned char val;
324   - int ldo, ret;
  324 + int hex, ldo, ret;
325 325  
326 326 if (op == PMIC_OP_GET)
327 327 *uV = 0;
328 328  
... ... @@ -360,9 +360,9 @@
360 360  
361 361 static int max77686_buck_val(struct udevice *dev, int op, int *uV)
362 362 {
363   - unsigned int hex, mask, adr;
  363 + unsigned int mask, adr;
364 364 unsigned char val;
365   - int buck, ret;
  365 + int hex, buck, ret;
366 366  
367 367 buck = dev->driver_data;
368 368 if (buck < 1 || buck > MAX77686_BUCK_NUM) {
... ... @@ -430,7 +430,7 @@
430 430 u8 part_support;
431 431 u8 part_attr;
432 432 u8 wr_rel_set;
433   - char part_config;
  433 + u8 part_config;
434 434 uint tran_speed;
435 435 uint read_bl_len;
436 436 uint write_bl_len;
include/power/tps65218.h
... ... @@ -56,6 +56,8 @@
56 56  
57 57 #define TPS65218_MASK_ALL_BITS 0xFF
58 58  
  59 +#define TPS65218_DCDC_VSEL_MASK 0x3F
  60 +
59 61 #define TPS65218_DCDC_VOLT_SEL_0950MV 0x0a
60 62 #define TPS65218_DCDC_VOLT_SEL_1100MV 0x19
61 63 #define TPS65218_DCDC_VOLT_SEL_1200MV 0x23