summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2017-12-14 15:46:07 -0500
committerTom Rini <trini@konsulko.com>2017-12-14 15:46:07 -0500
commit15616a0aa58173bce1efe47569bf2e10d023ae9c (patch)
tree57a9d4613a8534360816344cd0a331fd15649e80 /include
parent7ef548e6008d4225e0ae7c9af35cb76558756a62 (diff)
parent854dfbf99b89c114ba100905e1500b8ace60e0f9 (diff)
downloadu-boot-15616a0aa58173bce1efe47569bf2e10d023ae9c.tar.gz
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'include')
-rw-r--r--include/binman_sym.h93
-rw-r--r--include/power/sandbox_pmic.h5
-rw-r--r--include/power/tps65910_pmic.h130
-rw-r--r--include/spl.h11
4 files changed, 238 insertions, 1 deletions
diff --git a/include/binman_sym.h b/include/binman_sym.h
new file mode 100644
index 0000000000..87d03d5294
--- /dev/null
+++ b/include/binman_sym.h
@@ -0,0 +1,93 @@
+/*
+ * Symbol access for symbols set up by binman as part of the build.
+ *
+ * This allows C code to access the position of a particular part of the image
+ * assembled by binman.
+ *
+ * Copyright (c) 2017 Google, Inc
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __BINMAN_SYM_H
+#define __BINMAN_SYM_H
+
+#define BINMAN_SYM_MISSING (-1UL)
+
+#ifdef CONFIG_BINMAN
+
+/**
+ * binman_symname() - Internal fnuction to get a binman symbol name
+ *
+ * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
+ * @_prop_name: Property value to get from that entry (e.g. 'pos')
+ * @returns name of the symbol for that entry and property
+ */
+#define binman_symname(_entry_name, _prop_name) \
+ _binman_ ## _entry_name ## _prop_ ## _prop_name
+
+/**
+ * binman_sym_declare() - Declare a symbol that will be used at run-time
+ *
+ * @_type: Type f the symbol (e.g. unsigned long)
+ * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
+ * @_prop_name: Property value to get from that entry (e.g. 'pos')
+ */
+#define binman_sym_declare(_type, _entry_name, _prop_name) \
+ _type binman_symname(_entry_name, _prop_name) \
+ __attribute__((aligned(4), unused, section(".binman_sym")))
+
+/**
+ * binman_sym_extern() - Declare a extern symbol that will be used at run-time
+ *
+ * @_type: Type f the symbol (e.g. unsigned long)
+ * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
+ * @_prop_name: Property value to get from that entry (e.g. 'pos')
+ */
+#define binman_sym_extern(_type, _entry_name, _prop_name) \
+ extern _type binman_symname(_entry_name, _prop_name) \
+ __attribute__((aligned(4), unused, section(".binman_sym")))
+
+/**
+ * binman_sym_declare_optional() - Declare an optional symbol
+ *
+ * If this symbol cannot be provided by binman, an error will not be generated.
+ * Instead the image will be assigned the value BINMAN_SYM_MISSING.
+ *
+ * @_type: Type f the symbol (e.g. unsigned long)
+ * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
+ * @_prop_name: Property value to get from that entry (e.g. 'pos')
+ */
+#define binman_sym_declare_optional(_type, _entry_name, _prop_name) \
+ _type binman_symname(_entry_name, _prop_name) \
+ __attribute__((aligned(4), weak, unused, \
+ section(".binman_sym")))
+
+/**
+ * binman_sym() - Access a previously declared symbol
+ *
+ * This is used to get the value of a symbol. E.g.:
+ *
+ * ulong address = binman_sym(ulong, u_boot_spl, pos);
+ *
+ * @_type: Type f the symbol (e.g. unsigned long)
+ * @entry_name: Name of the entry to look for (e.g. 'u_boot_spl')
+ * @_prop_name: Property value to get from that entry (e.g. 'pos')
+ * @returns value of that property (filled in by binman)
+ */
+#define binman_sym(_type, _entry_name, _prop_name) \
+ (*(_type *)&binman_symname(_entry_name, _prop_name))
+
+#else /* !BINMAN */
+
+#define binman_sym_declare(_type, _entry_name, _prop_name)
+
+#define binman_sym_declare_optional(_type, _entry_name, _prop_name)
+
+#define binman_sym_extern(_type, _entry_name, _prop_name)
+
+#define binman_sym(_type, _entry_name, _prop_name) BINMAN_SYM_MISSING
+
+#endif /* BINMAN */
+
+#endif
diff --git a/include/power/sandbox_pmic.h b/include/power/sandbox_pmic.h
index 7fdbfb9fc6..c5e6fda2ea 100644
--- a/include/power/sandbox_pmic.h
+++ b/include/power/sandbox_pmic.h
@@ -13,7 +13,7 @@
#define SANDBOX_BUCK_DRIVER "sandbox_buck"
#define SANDBOX_OF_BUCK_PREFIX "buck"
-#define SANDBOX_BUCK_COUNT 2
+#define SANDBOX_BUCK_COUNT 3
#define SANDBOX_LDO_COUNT 2
/*
* Sandbox PMIC registers:
@@ -109,6 +109,9 @@ enum {
#define SANDBOX_BUCK1_PLATNAME "SUPPLY_1.2V"
#define SANDBOX_BUCK2_DEVNAME "buck2"
#define SANDBOX_BUCK2_PLATNAME "SUPPLY_3.3V"
+/* BUCK3: for testing fallback regulator prefix matching during bind */
+#define SANDBOX_BUCK3_DEVNAME "no_match_by_nodename"
+#define SANDBOX_BUCK3_PLATNAME "buck_SUPPLY_1.5V"
/* LDO names */
#define SANDBOX_LDO1_DEVNAME "ldo1"
#define SANDBOX_LDO1_PLATNAME "VDD_EMMC_1.8V"
diff --git a/include/power/tps65910_pmic.h b/include/power/tps65910_pmic.h
new file mode 100644
index 0000000000..e8d9ffaa9f
--- /dev/null
+++ b/include/power/tps65910_pmic.h
@@ -0,0 +1,130 @@
+/*
+ * Copyright (C) EETS GmbH, 2017, Felix Brack <f.brack@eets.ch>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __TPS65910_PMIC_H_
+#define __TPS65910_PMIC_H_
+
+#define TPS65910_I2C_SEL_MASK (0x1 << 4)
+#define TPS65910_VDD_SR_MASK (0x1 << 7)
+#define TPS65910_GAIN_SEL_MASK (0x3 << 6)
+#define TPS65910_VDD_SEL_MASK 0x7f
+#define TPS65910_VDD_SEL_MIN 3
+#define TPS65910_VDD_SEL_MAX 75
+#define TPS65910_SEL_MASK (0x3 << 2)
+#define TPS65910_SUPPLY_STATE_MASK 0x3
+#define TPS65910_SUPPLY_STATE_OFF 0x0
+#define TPS65910_SUPPLY_STATE_ON 0x1
+
+/* i2c registers */
+enum {
+ TPS65910_REG_RTC_SEC = 0x00,
+ TPS65910_REG_RTC_MIN,
+ TPS65910_REG_RTC_HOUR,
+ TPS65910_REG_RTC_DAY,
+ TPS65910_REG_RTC_MONTH,
+ TPS65910_REG_RTC_YEAR,
+ TPS65910_REG_RTC_WEEK,
+ TPS65910_REG_RTC_ALARM_SEC = 0x08,
+ TPS65910_REG_RTC_ALARM_MIN,
+ TPS65910_REG_RTC_ALARM_HOUR,
+ TPS65910_REG_RTC_ALARM_DAY,
+ TPS65910_REG_RTC_ALARM_MONTH,
+ TPS65910_REG_RTC_ALARM_YEAR,
+ TPS65910_REG_RTC_CTRL = 0x10,
+ TPS65910_REG_RTC_STAT,
+ TPS65910_REG_RTC_INT,
+ TPS65910_REG_RTC_COMP_LSB,
+ TPS65910_REG_RTC_COMP_MSB,
+ TPS65910_REG_RTC_RESISTOR_PRG,
+ TPS65910_REG_RTC_RESET_STAT,
+ TPS65910_REG_BACKUP1,
+ TPS65910_REG_BACKUP2,
+ TPS65910_REG_BACKUP3,
+ TPS65910_REG_BACKUP4,
+ TPS65910_REG_BACKUP5,
+ TPS65910_REG_PUADEN,
+ TPS65910_REG_REF,
+ TPS65910_REG_VRTC,
+ TPS65910_REG_VIO = 0x20,
+ TPS65910_REG_VDD1,
+ TPS65910_REG_VDD1_VAL,
+ TPS65910_REG_VDD1_VAL_SR,
+ TPS65910_REG_VDD2,
+ TPS65910_REG_VDD2_VAL,
+ TPS65910_REG_VDD2_VAL_SR,
+ TPS65910_REG_VDD3,
+ TPS65910_REG_VDIG1 = 0x30,
+ TPS65910_REG_VDIG2,
+ TPS65910_REG_VAUX1,
+ TPS65910_REG_VAUX2,
+ TPS65910_REG_VAUX33,
+ TPS65910_REG_VMMC,
+ TPS65910_REG_VPLL,
+ TPS65910_REG_VDAC,
+ TPS65910_REG_THERM,
+ TPS65910_REG_BATTERY_BACKUP_CHARGE,
+ TPS65910_REG_DCDC_CTRL = 0x3e,
+ TPS65910_REG_DEVICE_CTRL,
+ TPS65910_REG_DEVICE_CTRL2,
+ TPS65910_REG_SLEEP_KEEP_LDO_ON,
+ TPS65910_REG_SLEEP_KEEP_RES_ON,
+ TPS65910_REG_SLEEP_SET_LDO_OFF,
+ TPS65910_REG_SLEEP_SET_RES_OFF,
+ TPS65910_REG_EN1_LDO_ASS,
+ TPS65910_REG_EM1_SMPS_ASS,
+ TPS65910_REG_EN2_LDO_ASS,
+ TPS65910_REG_EM2_SMPS_ASS,
+ TPS65910_REG_INT_STAT = 0x50,
+ TPS65910_REG_INT_MASK,
+ TPS65910_REG_INT_STAT2,
+ TPS65910_REG_INT_MASK2,
+ TPS65910_REG_GPIO = 0x60,
+ TPS65910_REG_JTAGREVNUM = 0x80,
+ TPS65910_NUM_REGS
+};
+
+/* chip supplies */
+enum {
+ TPS65910_SUPPLY_VCCIO = 0x00,
+ TPS65910_SUPPLY_VCC1,
+ TPS65910_SUPPLY_VCC2,
+ TPS65910_SUPPLY_VCC3,
+ TPS65910_SUPPLY_VCC4,
+ TPS65910_SUPPLY_VCC5,
+ TPS65910_SUPPLY_VCC6,
+ TPS65910_SUPPLY_VCC7,
+ TPS65910_NUM_SUPPLIES
+};
+
+/* regulator unit numbers */
+enum {
+ TPS65910_UNIT_VRTC = 0x00,
+ TPS65910_UNIT_VIO,
+ TPS65910_UNIT_VDD1,
+ TPS65910_UNIT_VDD2,
+ TPS65910_UNIT_VDD3,
+ TPS65910_UNIT_VDIG1,
+ TPS65910_UNIT_VDIG2,
+ TPS65910_UNIT_VPLL,
+ TPS65910_UNIT_VDAC,
+ TPS65910_UNIT_VAUX1,
+ TPS65910_UNIT_VAUX2,
+ TPS65910_UNIT_VAUX33,
+ TPS65910_UNIT_VMMC,
+};
+
+/* platform data */
+struct tps65910_regulator_pdata {
+ u32 supply; /* regulator supply voltage in uV */
+ uint unit; /* unit-address according to DT */
+};
+
+/* driver names */
+#define TPS65910_BUCK_DRIVER "tps65910_buck"
+#define TPS65910_BOOST_DRIVER "tps65910_boost"
+#define TPS65910_LDO_DRIVER "tps65910_ldo"
+
+#endif /* __TPS65910_PMIC_H_ */
diff --git a/include/spl.h b/include/spl.h
index 308ce7b563..c14448b8fc 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -7,6 +7,8 @@
#ifndef _SPL_H_
#define _SPL_H_
+#include <binman_sym.h>
+
/* Platform-specific defines */
#include <linux/compiler.h>
#include <asm/spl.h>
@@ -51,6 +53,15 @@ struct spl_load_info {
void *buf);
};
+/*
+ * We need to know the position of U-Boot in memory so we can jump to it. We
+ * allow any U-Boot binary to be used (u-boot.bin, u-boot-nodtb.bin,
+ * u-boot.img), hence the '_any'. These is no checking here that the correct
+ * image is found. For * example if u-boot.img is used we don't check that
+ * spl_parse_image_header() can parse a valid header.
+ */
+binman_sym_extern(ulong, u_boot_any, pos);
+
/**
* spl_load_simple_fit() - Loads a fit image from a device.
* @spl_image: Image description to set up