mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 15:14:43 +00:00
Merge branch 'master' of git://git.denx.de/u-boot-mmc
This commit is contained in:
commit
ccbbada0a5
7 changed files with 52 additions and 15 deletions
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
#include <command.h>
|
#include <command.h>
|
||||||
#include <environment.h>
|
#include <environment.h>
|
||||||
|
#include <fdtdec.h>
|
||||||
#include <linux/stddef.h>
|
#include <linux/stddef.h>
|
||||||
#include <malloc.h>
|
#include <malloc.h>
|
||||||
#include <memalign.h>
|
#include <memalign.h>
|
||||||
|
@ -36,15 +37,37 @@ DECLARE_GLOBAL_DATA_PTR;
|
||||||
#define CONFIG_ENV_OFFSET 0
|
#define CONFIG_ENV_OFFSET 0
|
||||||
#endif
|
#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;
|
#if defined(CONFIG_ENV_OFFSET_REDUND)
|
||||||
#ifdef 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)
|
if (copy)
|
||||||
offset = CONFIG_ENV_OFFSET_REDUND;
|
offset = CONFIG_ENV_OFFSET_REDUND;
|
||||||
#endif
|
#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)
|
if (offset < 0)
|
||||||
offset += mmc->capacity;
|
offset += mmc->capacity;
|
||||||
|
|
|
@ -21,6 +21,18 @@ u-boot,efi-partition-entries-offset
|
||||||
|
|
||||||
This setting will override any values configured via Kconfig.
|
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
|
u-boot,spl-payload-offset
|
||||||
If present (and SPL is controlled by the device-tree), this allows
|
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
|
to override the CONFIG_SYS_SPI_U_BOOT_OFFS setting using a value
|
||||||
|
|
|
@ -244,7 +244,7 @@ static int meson_mmc_probe(struct udevice *dev)
|
||||||
MMC_MODE_HS_52MHz | MMC_MODE_HS;
|
MMC_MODE_HS_52MHz | MMC_MODE_HS;
|
||||||
cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
|
cfg->f_min = DIV_ROUND_UP(SD_EMMC_CLKSRC_24M, CLK_MAX_DIV);
|
||||||
cfg->f_max = 100000000; /* 100 MHz */
|
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;
|
cfg->name = dev->name;
|
||||||
|
|
||||||
mmc->priv = pdata;
|
mmc->priv = pdata;
|
||||||
|
|
|
@ -101,7 +101,7 @@ int tps65218_voltage_update(uchar dc_cntrl_reg, uchar volt_sel)
|
||||||
|
|
||||||
/* set voltage level */
|
/* set voltage level */
|
||||||
if (tps65218_reg_write(TPS65218_PROT_LEVEL_2, dc_cntrl_reg, volt_sel,
|
if (tps65218_reg_write(TPS65218_PROT_LEVEL_2, dc_cntrl_reg, volt_sel,
|
||||||
TPS65218_MASK_ALL_BITS))
|
TPS65218_DCDC_VSEL_MASK))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
/* set GO bit to initiate voltage transition */
|
/* set GO bit to initiate voltage transition */
|
||||||
|
|
|
@ -71,8 +71,8 @@ static const char max77686_buck_out[] = {
|
||||||
|
|
||||||
static int max77686_buck_volt2hex(int buck, int uV)
|
static int max77686_buck_volt2hex(int buck, int uV)
|
||||||
{
|
{
|
||||||
unsigned int hex = 0;
|
int hex = 0;
|
||||||
unsigned int hex_max = 0;
|
int hex_max = 0;
|
||||||
|
|
||||||
switch (buck) {
|
switch (buck) {
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -105,7 +105,7 @@ static int max77686_buck_volt2hex(int buck, int uV)
|
||||||
static int max77686_buck_hex2volt(int buck, int hex)
|
static int max77686_buck_hex2volt(int buck, int hex)
|
||||||
{
|
{
|
||||||
unsigned uV = 0;
|
unsigned uV = 0;
|
||||||
unsigned int hex_max = 0;
|
int hex_max = 0;
|
||||||
|
|
||||||
if (hex < 0)
|
if (hex < 0)
|
||||||
goto bad_hex;
|
goto bad_hex;
|
||||||
|
@ -140,7 +140,7 @@ bad_hex:
|
||||||
|
|
||||||
static int max77686_ldo_volt2hex(int ldo, int uV)
|
static int max77686_ldo_volt2hex(int ldo, int uV)
|
||||||
{
|
{
|
||||||
unsigned int hex = 0;
|
int hex = 0;
|
||||||
|
|
||||||
switch (ldo) {
|
switch (ldo) {
|
||||||
case 1:
|
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)
|
static int max77686_ldo_val(struct udevice *dev, int op, int *uV)
|
||||||
{
|
{
|
||||||
unsigned int hex, adr;
|
unsigned int adr;
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
int ldo, ret;
|
int hex, ldo, ret;
|
||||||
|
|
||||||
if (op == PMIC_OP_GET)
|
if (op == PMIC_OP_GET)
|
||||||
*uV = 0;
|
*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)
|
static int max77686_buck_val(struct udevice *dev, int op, int *uV)
|
||||||
{
|
{
|
||||||
unsigned int hex, mask, adr;
|
unsigned int mask, adr;
|
||||||
unsigned char val;
|
unsigned char val;
|
||||||
int buck, ret;
|
int hex, buck, ret;
|
||||||
|
|
||||||
buck = dev->driver_data;
|
buck = dev->driver_data;
|
||||||
if (buck < 1 || buck > MAX77686_BUCK_NUM) {
|
if (buck < 1 || buck > MAX77686_BUCK_NUM) {
|
||||||
|
|
|
@ -430,7 +430,7 @@ struct mmc {
|
||||||
u8 part_support;
|
u8 part_support;
|
||||||
u8 part_attr;
|
u8 part_attr;
|
||||||
u8 wr_rel_set;
|
u8 wr_rel_set;
|
||||||
char part_config;
|
u8 part_config;
|
||||||
uint tran_speed;
|
uint tran_speed;
|
||||||
uint read_bl_len;
|
uint read_bl_len;
|
||||||
uint write_bl_len;
|
uint write_bl_len;
|
||||||
|
|
|
@ -56,6 +56,8 @@ enum {
|
||||||
|
|
||||||
#define TPS65218_MASK_ALL_BITS 0xFF
|
#define TPS65218_MASK_ALL_BITS 0xFF
|
||||||
|
|
||||||
|
#define TPS65218_DCDC_VSEL_MASK 0x3F
|
||||||
|
|
||||||
#define TPS65218_DCDC_VOLT_SEL_0950MV 0x0a
|
#define TPS65218_DCDC_VOLT_SEL_0950MV 0x0a
|
||||||
#define TPS65218_DCDC_VOLT_SEL_1100MV 0x19
|
#define TPS65218_DCDC_VOLT_SEL_1100MV 0x19
|
||||||
#define TPS65218_DCDC_VOLT_SEL_1200MV 0x23
|
#define TPS65218_DCDC_VOLT_SEL_1200MV 0x23
|
||||||
|
|
Loading…
Reference in a new issue