Skip to contentSkip to conversation

Enable LCD display on snow

PATCH Superseded Simon Glass 3 participants 16 messages May 20, 2014 – May 29, 2014

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Enable LCD display on snow

This series adds a driver for TPS65090 and plumbs it in to get the LCD working correctly on snow.

The display driver is already present, but needs information about the display to be provided in the device tree.

The backlight also needs to be enabled - it is controlled by a FET on the TPS65090. Note that the TPS65090 is controlled by the device tree so will only be present if the board's device tree file specifies it. At present this is only the case for snow, but other exynos5 boards will use it (e.g. pit).

Note: the TPS65090 driver was sent to the list around the middle of last year but was never applied.

Changes in v3:
- Add new patch to correct EC interrupt GPIO
- Rebase on samsung/master
- Remove extra blank lines in two places
- Use !! style instead ternary operator
- Change the ptn3460 comment to indicate a TODO for device tree GPIOs
- Rename MAX_TRIES to lower case
- Rename onoff to on
- Use generic GPIO API
- Drop patch "exynos: dts: Disable cros_ec interrupts due to broken GPIOs"

Changes in v2:
- Add new patch to drop smdk5250.c file
- Add new patch to rename CHARGER_EN/DISABLE
- Removed non-device-tree operation
- Use errno.h for error return codes everywhere
- Plumb into pmic charging framework
- Fix style nit
- Use correct license header
- Use new Linux device tree bindings
- Add partial battery charging support
- Update patch name to exynos5-dt instead of smdk5250
- Move code to exynos5-dt.c
- Fix comment style
- Add #ifdef around tps65090 code
- Add a device tree node for the snow EDP bridge chip
- Only set up the EDP bridge for snow
- Add a device tree compatibility string for the EDP bridge
- Check for EDP failure and print an error in that case
- Return immediately in exynos_backlight_on() if needed
- Rebase to samsung/master

Aaron Durbin (3):
exynos5: Enable tps65090 on exynos5-dt
power: Explicitly select pmic device's bus
exynos5: support tps65090 pmic

Simon Glass (8):
exynos: dts: Correct EC interrupt GPIO
exynos: Drop old smdk5250.c file
power: Rename CONFIG_PMIC_... to CONFIG_POWER_...
power: Add PMIC_ prefix to CHARGER_EN/DISABLE
exynos: Enable PSHOLD in SPL
exynos: dts: Enable LCD for snow
exynos: Enable the LCD backlight for snow
initcall: Improve debugging support

Tom Wai-Hong Tam (1):
power: Add support for TPS65090 PMU chip.

 arch/arm/cpu/armv7/exynos/lowlevel_init.c       |   2 +
 arch/arm/dts/exynos5250-snow.dts                |  61 +++-
 board/samsung/smdk5250/Makefile                 |   4 -
 board/samsung/smdk5250/exynos5-dt.c             | 238 +++++++++++++++-
 board/samsung/smdk5250/smdk5250.c               | 363 ------------------------
 doc/device-tree-bindings/power/tps65090.txt     |  17 ++
 doc/device-tree-bindings/regulator/tps65090.txt | 122 ++++++++
 drivers/power/battery/bat_trats.c               |   4 +-
 drivers/power/battery/bat_trats2.c              |   2 +-
 drivers/power/mfd/pmic_max77693.c               |   2 +-
 drivers/power/pmic/Makefile                     |   1 +
 drivers/power/pmic/pmic_max8997.c               |   2 +-
 drivers/power/pmic/pmic_tps65090.c              | 310 ++++++++++++++++++++
 drivers/power/power_fsl.c                       |   6 +-
 drivers/power/power_i2c.c                       |   4 +
 include/configs/arndale.h                       |   4 +-
 include/configs/exynos5-dt.h                    |   1 +
 include/configs/exynos5250-dt.h                 |   2 +-
 include/configs/mx25pdk.h                       |   2 +-
 include/configs/mx35pdk.h                       |   2 +-
 include/configs/mx53evk.h                       |   2 +-
 include/configs/mx53loco.h                      |   2 +-
 include/configs/woodburn_common.h               |   2 +-
 include/fdtdec.h                                |   2 +
 include/initcall.h                              |   2 +-
 include/power/max77693_pmic.h                   |   2 -
 include/power/max8997_pmic.h                    |   1 -
 include/power/pmic.h                            |   5 +
 include/power/tps65090_pmic.h                   |  73 +++++
 lib/fdtdec.c                                    |   2 +
 lib/initcall.c                                  |  17 +-
 31 files changed, 864 insertions(+), 395 deletions(-)
 delete mode 100644 board/samsung/smdk5250/smdk5250.c
 create mode 100644 doc/device-tree-bindings/power/tps65090.txt
 create mode 100644 doc/device-tree-bindings/regulator/tps65090.txt
 create mode 100644 drivers/power/pmic/pmic_tps65090.c
 create mode 100644 include/power/tps65090_pmic.h
Signature · 1 line
1.9.1.423.g4596e3a
#1 lore raw

PATCH v3 1/12 exynos: dts: Correct EC interrupt GPIO

Now that the GPIO numbering series has been applied, we can use the correct GPIO for the EC interrupt.

---

Changes in v3:
- Add new patch to correct EC interrupt GPIO

Changes in v2: None

 arch/arm/dts/exynos5250-snow.dts | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/dts/exynos5250-snow.dts +2 -2
index 9b48a0c..c584172 100644
@@ -44,7 +44,7 @@
 			reg = <0x1e>;
 			compatible = "google,cros-ec";
 			i2c-max-frequency = <100000>;
-			ec-interrupt = <&gpio 782 1>;
+			ec-interrupt = <&gpio 182 1>;
 		};
 
 		power-regulator at 48 {
@@ -60,7 +60,7 @@
 			reg = <0>;
 			compatible = "google,cros-ec";
 			spi-max-frequency = <5000000>;
-			ec-interrupt = <&gpio 782 1>;
+			ec-interrupt = <&gpio 182 1>;
 			optimise-flash-write;
 			status = "disabled";
 		};
Signature · 1 line
1.9.1.423.g4596e3a
#2 lore raw

PATCH v3 2/12 exynos: Drop old smdk5250.c file

In reply to Simon Glass

This is not used by any boards now. Drop it to avoid confusion.

---

Changes in v3:
- Rebase on samsung/master

Changes in v2:
- Add new patch to drop smdk5250.c file

 board/samsung/smdk5250/Makefile     |   4 -
 board/samsung/smdk5250/exynos5-dt.c | 125 +++++++++++++
 board/samsung/smdk5250/smdk5250.c   | 363 ------------------------------------
 3 files changed, 125 insertions(+), 367 deletions(-)
 delete mode 100644 board/samsung/smdk5250/smdk5250.c
board/samsung/smdk5250/Makefile +0 -4
index 6a58655..3d96b07 100644
@@ -7,9 +7,5 @@
 obj-y	+= smdk5250_spl.o
 
 ifndef CONFIG_SPL_BUILD
-ifdef CONFIG_OF_CONTROL
 obj-y	+= exynos5-dt.o
-else
-obj-y	+= smdk5250.o
-endif
 endif
board/samsung/smdk5250/exynos5-dt.c +125 -0

131 lines not on this page · raw message

board/samsung/smdk5250/smdk5250.c deleted +0 -363

363 lines not on this page · raw message

Signature · 1 line
1.9.1.423.g4596e3a
#3 lore raw

PATCH v3 3/12 power: Rename CONFIG_PMIC_... to CONFIG_POWER_...

In reply to Simon Glass

Commit be3b51aa did this mostly, but several have been added since. Do the job again.

---

Changes in v3: None
Changes in v2: None

 drivers/power/power_fsl.c         | 6 +++---
 include/configs/arndale.h         | 4 ++--
 include/configs/exynos5250-dt.h   | 2 +-
 include/configs/mx25pdk.h         | 2 +-
 include/configs/mx35pdk.h         | 2 +-
 include/configs/mx53evk.h         | 2 +-
 include/configs/mx53loco.h        | 2 +-
 include/configs/woodburn_common.h | 2 +-
 8 files changed, 11 insertions(+), 11 deletions(-)
drivers/power/power_fsl.c +3 -3
index ac0b541..a64161b 100644
@@ -11,9 +11,9 @@
 #include <fsl_pmic.h>
 #include <errno.h>
 
-#if defined(CONFIG_PMIC_FSL_MC13892)
+#if defined(CONFIG_POWER_FSL_MC13892)
 #define FSL_PMIC_I2C_LENGTH	3
-#elif defined(CONFIG_PMIC_FSL_MC34704)
+#elif defined(CONFIG_POWER_FSL_MC34704)
 #define FSL_PMIC_I2C_LENGTH	1
 #endif
 
@@ -51,7 +51,7 @@ int pmic_init(unsigned char bus)
 	p->hw.i2c.addr = CONFIG_SYS_FSL_PMIC_I2C_ADDR;
 	p->hw.i2c.tx_num = FSL_PMIC_I2C_LENGTH;
 #else
-#error "You must select CONFIG_POWER_SPI or CONFIG_PMIC_I2C"
+#error "You must select CONFIG_POWER_SPI or CONFIG_POWER_I2C"
 #endif
 
 	return 0;
include/configs/arndale.h +2 -2
index 515facf..30ecd45 100644
@@ -224,8 +224,8 @@
 
 /* PMIC */
 #define CONFIG_PMIC
-#define CONFIG_PMIC_I2C
-#define CONFIG_PMIC_MAX77686
+#define CONFIG_POWER_I2C
+#define CONFIG_POWER_MAX77686
 
 #define CONFIG_DEFAULT_DEVICE_TREE	exynos5250-arndale
 
include/configs/exynos5250-dt.h +1 -1
index b7ff472..9d1d56a 100644
@@ -45,7 +45,7 @@
 #define CONFIG_SYS_INIT_SP_ADDR	CONFIG_IRAM_STACK
 
 /* PMIC */
-#define CONFIG_PMIC_MAX77686
+#define CONFIG_POWER_MAX77686
 
 /* Sound */
 #define CONFIG_CMD_SOUND
include/configs/mx25pdk.h +1 -1
index aff2419..d464ad9 100644
@@ -107,7 +107,7 @@
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_FSL
-#define CONFIG_PMIC_FSL_MC34704
+#define CONFIG_POWER_FSL_MC34704
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x54
 
 #define CONFIG_DOS_PARTITION
include/configs/mx35pdk.h +1 -1
index 0a46f4c..ab48144 100644
@@ -52,7 +52,7 @@
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_FSL
-#define CONFIG_PMIC_FSL_MC13892
+#define CONFIG_POWER_FSL_MC13892
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x08
 #define CONFIG_RTC_MC13XXX
 
include/configs/mx53evk.h +1 -1
index 3f0d80a..042cdd0 100644
@@ -45,7 +45,7 @@
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_FSL
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR    8
-#define CONFIG_PMIC_FSL_MC13892
+#define CONFIG_POWER_FSL_MC13892
 #define CONFIG_RTC_MC13XXX
 
 /* MMC Configs */
include/configs/mx53loco.h +1 -1
index 5859f36..c7f54d4 100644
@@ -80,7 +80,7 @@
 #define CONFIG_POWER_I2C
 #define CONFIG_DIALOG_POWER
 #define CONFIG_POWER_FSL
-#define CONFIG_PMIC_FSL_MC13892
+#define CONFIG_POWER_FSL_MC13892
 #define CONFIG_SYS_DIALOG_PMIC_I2C_ADDR	0x48
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x8
 
include/configs/woodburn_common.h +1 -1
index 695bc23..259205e 100644
@@ -55,7 +55,7 @@
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
 #define CONFIG_POWER_FSL
-#define CONFIG_PMIC_FSL_MC13892
+#define CONFIG_POWER_FSL_MC13892
 #define CONFIG_SYS_FSL_PMIC_I2C_ADDR	0x8
 #define CONFIG_RTC_MC13XXX
 
Signature · 1 line
1.9.1.423.g4596e3a
#4 lore raw

PATCH v3 4/12 power: Add PMIC_ prefix to CHARGER_EN/DISABLE

In reply to Simon Glass

This enum should be common across all PMICs rather than having it independently defined with the same name in multiple places.

---

Changes in v3: None
Changes in v2:
- Add new patch to rename CHARGER_EN/DISABLE

 drivers/power/battery/bat_trats.c  | 4 ++--
 drivers/power/battery/bat_trats2.c | 2 +-
 drivers/power/mfd/pmic_max77693.c  | 2 +-
 drivers/power/pmic/pmic_max8997.c  | 2 +-
 include/power/max77693_pmic.h      | 2 --
 include/power/max8997_pmic.h       | 1 -
 include/power/pmic.h               | 5 +++++
 7 files changed, 10 insertions(+), 8 deletions(-)
drivers/power/battery/bat_trats.c +2 -2
index 41b179f..bfde692 100644
@@ -19,7 +19,7 @@ static int power_battery_charge(struct pmic *bat)
 	struct battery *battery = p_bat->bat;
 	int k;
 
-	if (bat->chrg->chrg_state(p_bat->chrg, CHARGER_ENABLE, 450))
+	if (bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_ENABLE, 450))
 		return -1;
 
 	for (k = 0; bat->chrg->chrg_bat_present(p_bat->chrg) &&
@@ -42,7 +42,7 @@ static int power_battery_charge(struct pmic *bat)
 		}
 	}
  exit:
-	bat->chrg->chrg_state(p_bat->chrg, CHARGER_DISABLE, 0);
+	bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_DISABLE, 0);
 
 	return 0;
 }
drivers/power/battery/bat_trats2.c +1 -1
index 94015aa..57221ad 100644
@@ -17,7 +17,7 @@ static int power_battery_charge(struct pmic *bat)
 {
 	struct power_battery *p_bat = bat->pbat;
 
-	if (bat->chrg->chrg_state(p_bat->chrg, CHARGER_ENABLE, 450))
+	if (bat->chrg->chrg_state(p_bat->chrg, PMIC_CHARGER_ENABLE, 450))
 		return -1;
 
 	return 0;
drivers/power/mfd/pmic_max77693.c +1 -1
index 1a4416b..6b28e28 100644
@@ -22,7 +22,7 @@ static int max77693_charger_state(struct pmic *p, int state, int current)
 	val = MAX77693_CHG_UNLOCK;
 	pmic_reg_write(p, MAX77693_CHG_CNFG_06, val);
 
-	if (state == CHARGER_DISABLE) {
+	if (state == PMIC_CHARGER_DISABLE) {
 		puts("Disable the charger.\n");
 		pmic_reg_read(p, MAX77693_CHG_CNFG_00, &val);
 		val &= ~0x01;
drivers/power/pmic/pmic_max8997.c +1 -1
index ba01692..a36a9a0 100644
@@ -35,7 +35,7 @@ static int pmic_charger_state(struct pmic *p, int state, int current)
 	if (pmic_probe(p))
 		return -1;
 
-	if (state == CHARGER_DISABLE) {
+	if (state == PMIC_CHARGER_DISABLE) {
 		puts("Disable the charger.\n");
 		pmic_reg_read(p, MAX8997_REG_MBCCTRL2, &val);
 		val &= ~(MBCHOSTEN | VCHGR_FC);
include/power/max77693_pmic.h +0 -2
index 616d051..3d59e59 100644
@@ -10,8 +10,6 @@
 
 #include <power/power_chrg.h>
 
-enum {CHARGER_ENABLE, CHARGER_DISABLE};
-
 #define CHARGER_MIN_CURRENT 200
 #define CHARGER_MAX_CURRENT 2000
 
include/power/max8997_pmic.h +0 -1
index 74c5d54..728d60a 100644
@@ -170,7 +170,6 @@ enum {
 #define SAFEOUT_3_30V 0x03
 
 /* Charger */
-enum {CHARGER_ENABLE, CHARGER_DISABLE};
 #define DETBAT                  (1 << 2)
 #define MBCICHFCSET             (1 << 4)
 #define MBCHOSTEN               (1 << 6)
include/power/pmic.h +5 -0
index 8f282dd..a62e6c9 100644
@@ -17,6 +17,11 @@ enum { I2C_PMIC, I2C_NUM, };
 enum { PMIC_READ, PMIC_WRITE, };
 enum { PMIC_SENSOR_BYTE_ORDER_LITTLE, PMIC_SENSOR_BYTE_ORDER_BIG, };
 
+enum {
+	PMIC_CHARGER_DISABLE,
+	PMIC_CHARGER_ENABLE,
+};
+
 struct p_i2c {
 	unsigned char addr;
 	unsigned char *buf;
Signature · 1 line
1.9.1.423.g4596e3a
#5 lore raw

PATCH v3 5/12 power: Add support for TPS65090 PMU chip.

In reply to Simon Glass

From: Tom Wai-Hong Tam <[email protected]>

This adds driver support for the TPS65090 PMU. Support includes hooking into the pmic infrastructure so that the pmic commands can be used on the console. The TPS65090 supports the following functionality:

- fet enable/disable/querying
- getting and setting of charge state

Even though it is connected to the pmic infrastructure it does not hook into the pmic charging charging infrastructure.

The device tree binding is from Linux, but only a small subset of functionality is supported.

---

Changes in v3:
- Remove extra blank lines in two places
- Use !! style instead ternary operator

Changes in v2:
- Removed non-device-tree operation
- Use errno.h for error return codes everywhere
- Plumb into pmic charging framework
- Fix style nit
- Use correct license header
- Use new Linux device tree bindings
- Add partial battery charging support

 doc/device-tree-bindings/power/tps65090.txt     |  17 ++
 doc/device-tree-bindings/regulator/tps65090.txt | 122 ++++++++++
 drivers/power/pmic/Makefile                     |   1 +
 drivers/power/pmic/pmic_tps65090.c              | 310 ++++++++++++++++++++++++
 include/fdtdec.h                                |   1 +
 include/power/tps65090_pmic.h                   |  73 ++++++
 lib/fdtdec.c                                    |   1 +
 7 files changed, 525 insertions(+)
 create mode 100644 doc/device-tree-bindings/power/tps65090.txt
 create mode 100644 doc/device-tree-bindings/regulator/tps65090.txt
 create mode 100644 drivers/power/pmic/pmic_tps65090.c
 create mode 100644 include/power/tps65090_pmic.h
doc/device-tree-bindings/power/tps65090.txt new file +17 -0
new file mode 100644
index 0000000..8e5e0d3
@@ -0,0 +1,17 @@
+TPS65090 Frontend PMU with Switchmode Charger
+
+Required Properties:
+-compatible: "ti,tps65090-charger"
+
+Optional Properties:
+-ti,enable-low-current-chrg: Enables charging when a low current is detected
+ while the default logic is to stop charging.
+
+This node is a subnode of the tps65090 PMIC.
+
+Example:
+
+	tps65090-charger {
+		compatible = "ti,tps65090-charger";
+		ti,enable-low-current-chrg;
+	};
doc/device-tree-bindings/regulator/tps65090.txt new file +122 -0

122 lines not on this page · raw message

drivers/power/pmic/Makefile +1 -0
index 4129bda..3244f69 100644
@@ -10,5 +10,6 @@ obj-$(CONFIG_POWER_MAX8997) += pmic_max8997.o
 obj-$(CONFIG_POWER_MUIC_MAX8997) += muic_max8997.o
 obj-$(CONFIG_POWER_MAX77686) += pmic_max77686.o
 obj-$(CONFIG_POWER_PFUZE100) += pmic_pfuze100.o
+obj-$(CONFIG_POWER_TPS65090) += pmic_tps65090.o
 obj-$(CONFIG_POWER_TPS65217) += pmic_tps65217.o
 obj-$(CONFIG_POWER_TPS65910) += pmic_tps65910.o
drivers/power/pmic/pmic_tps65090.c new file +310 -0

310 lines not on this page · raw message

include/fdtdec.h +1 -0
index 3196cf6..669ab90 100644
@@ -92,6 +92,7 @@ enum fdt_compat_id {
 	COMPAT_SAMSUNG_EXYNOS5_I2C,	/* Exynos5 High Speed I2C Controller */
 	COMPAT_SANDBOX_HOST_EMULATION,	/* Sandbox emulation of a function */
 	COMPAT_SANDBOX_LCD_SDL,		/* Sandbox LCD emulation with SDL */
+	COMPAT_TI_TPS65090,		/* Texas Instrument TPS65090 */
 
 	COMPAT_COUNT,
 };
include/power/tps65090_pmic.h new file +73 -0

73 lines not on this page · raw message

lib/fdtdec.c +1 -0
index 8ecb80f..b389d4e 100644
@@ -66,6 +66,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(SAMSUNG_EXYNOS5_I2C, "samsung,exynos5-hsi2c"),
 	COMPAT(SANDBOX_HOST_EMULATION, "sandbox,host-emulation"),
 	COMPAT(SANDBOX_LCD_SDL, "sandbox,lcd-sdl"),
+	COMPAT(TI_TPS65090, "ti,tps65090"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
Signature · 1 line
1.9.1.423.g4596e3a
#6 lore raw

PATCH v3 6/12 exynos5: Enable tps65090 on exynos5-dt

In reply to Simon Glass

From: Aaron Durbin <[email protected]>

The TPS65090 pmic chip can be on exynos5250 boards. Therefore, select the appropriate config option for TPS65090 devices.

This commit should really use exynos5-dt.c, when it is available.

---

Changes in v3: None
Changes in v2:
- Update patch name to exynos5-dt instead of smdk5250

 include/configs/exynos5-dt.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/exynos5-dt.h +1 -0
index 5a9b1b4..b830495 100644
@@ -259,6 +259,7 @@
 /* PMIC */
 #define CONFIG_POWER
 #define CONFIG_POWER_I2C
+#define CONFIG_POWER_TPS65090
 
 /* Ethernet Controllor Driver */
 #ifdef CONFIG_CMD_NET
Signature · 1 line
1.9.1.423.g4596e3a
#7 lore raw

PATCH v3 7/12 power: Explicitly select pmic device's bus

In reply to Simon Glass

From: Aaron Durbin <[email protected]>

The current pmic i2c code assumes the current i2c bus is the same as the pmic device's bus. There is nothing ensuring that to be true. Therefore, select the proper bus before performing a transaction.

---

Changes in v3: None
Changes in v2: None

 drivers/power/power_i2c.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/power/power_i2c.c +4 -0
index ac76870..594cd11 100644
@@ -23,6 +23,8 @@ int pmic_reg_write(struct pmic *p, u32 reg, u32 val)
 	if (check_reg(p, reg))
 		return -1;
 
+	I2C_SET_BUS(p->bus);
+
 	switch (pmic_i2c_tx_num) {
 	case 3:
 		if (p->sensor_byte_order == PMIC_SENSOR_BYTE_ORDER_BIG) {
@@ -66,6 +68,8 @@ int pmic_reg_read(struct pmic *p, u32 reg, u32 *val)
 	if (check_reg(p, reg))
 		return -1;
 
+	I2C_SET_BUS(p->bus);
+
 	if (i2c_read(pmic_i2c_addr, reg, 1, buf, pmic_i2c_tx_num))
 		return -1;
 
Signature · 1 line
1.9.1.423.g4596e3a
#8 lore raw

PATCH v3 8/12 exynos5: support tps65090 pmic

In reply to Simon Glass

From: Aaron Durbin <[email protected]>

The TSP65090 is a PMIC on some exynos5 boards. The init function is called for the TPS65090 pmic. If that device is not a part of the device tree (returns -ENODEV) then continue. Otherwise return a failure.

---

Changes in v3: None
Changes in v2:
- Move code to exynos5-dt.c
- Fix comment style
- Add #ifdef around tps65090 code

 board/samsung/smdk5250/exynos5-dt.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
board/samsung/smdk5250/exynos5-dt.c +13 -0
index fbf5850..bce7583 100644
@@ -20,6 +20,7 @@
 #include <asm/arch/sromc.h>
 #include <power/pmic.h>
 #include <power/max77686_pmic.h>
+#include <power/tps65090_pmic.h>
 #include <tmu.h>
 
 DECLARE_GLOBAL_DATA_PTR;
@@ -161,7 +162,19 @@ int exynos_power_init(void)
 
 #ifdef CONFIG_POWER_MAX77686
 	ret = max77686_init();
+	if (ret)
+		return ret;
 #endif
+#ifdef CONFIG_POWER_TPS65090
+	/*
+	 * The TPS65090 may not be in the device tree. If so, it is not
+	 * an error.
+	 */
+	ret = tps65090_init();
+	if (ret == 0 || ret == -ENODEV)
+		return 0;
+#endif
+
 	return ret;
 }
 #endif	/* CONFIG_POWER */
Signature · 1 line
1.9.1.423.g4596e3a
#9 lore raw

PATCH v3 9/12 exynos: Enable PSHOLD in SPL

In reply to Simon Glass

There is quite a tight deadline in enabling PSHOLD, less than a second. In some cases (e.g. with USB download), U-Boot takes longer than that to load, so the board powers off before U-Boot starts.

Add a call in SPL to enable PSHOLD.

---

Changes in v3: None
Changes in v2: None

 arch/arm/cpu/armv7/exynos/lowlevel_init.c | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/cpu/armv7/exynos/lowlevel_init.c +2 -0
index 11fe5b8..48b5511 100644
@@ -48,6 +48,8 @@ int do_lowlevel_init(void)
 
 	arch_cpu_init();
 
+	set_ps_hold_ctrl();
+
 	reset_status = get_reset_status();
 
 	switch (reset_status) {
Signature · 1 line
1.9.1.423.g4596e3a
#10 lore raw

PATCH v3 10/12 exynos: dts: Enable LCD for snow

In reply to Simon Glass

Enable LCD for snow. This is a 1366 x 768 panel.

---

Changes in v3:
- Change the ptn3460 comment to indicate a TODO for device tree GPIOs

Changes in v2:
- Add a device tree node for the snow EDP bridge chip

 arch/arm/dts/exynos5250-snow.dts | 57 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
arch/arm/dts/exynos5250-snow.dts +57 -0
index c584172..ab4f2f8 100644
@@ -80,6 +80,19 @@
 			reg = <0x22>;
 			compatible = "maxim,max98095-codec";
 		};
+
+		ptn3460-bridge at 20 {
+			compatible = "nxp,ptn3460";
+			reg = <0x20>;
+			/*
+			 * TODO(sjg at chromium.org): Use GPIOs here
+			 * powerdown-gpio = <&gpy2 5 0>;
+			 * reset-gpio = <&gpx1 5 0>;
+			 * edid-emulation = <5>;
+			 * pinctrl-names = "default";
+			 * pinctrl-0 = <&ptn3460_gpios>;
+			 */
+		};
 	};
 
 	i2c at 12c60000 {
@@ -184,4 +197,48 @@
 			/* UP      LEFT    */
 			0x070b0067 0x070c0069>;
 	};
+
+	fimd at 14400000 {
+		samsung,vl-freq = <60>;
+		samsung,vl-col = <1366>;
+		samsung,vl-row = <768>;
+		samsung,vl-width = <1366>;
+		samsung,vl-height = <768>;
+
+		samsung,vl-clkp;
+		samsung,vl-dp;
+		samsung,vl-hsp;
+		samsung,vl-vsp;
+
+		samsung,vl-bpix = <4>;
+
+		samsung,vl-hspw = <32>;
+		samsung,vl-hbpd = <80>;
+		samsung,vl-hfpd = <48>;
+		samsung,vl-vspw = <5>;
+		samsung,vl-vbpd = <14>;
+		samsung,vl-vfpd = <3>;
+		samsung,vl-cmd-allow-len = <0xf>;
+
+		samsung,winid = <0>;
+		samsung,interface-mode = <1>;
+		samsung,dp-enabled = <1>;
+		samsung,dual-lcd-enabled = <0>;
+	};
+
+	dp at 145b0000 {
+		samsung,lt-status = <0>;
+
+		samsung,master-mode = <0>;
+		samsung,bist-mode = <0>;
+		samsung,bist-pattern = <0>;
+		samsung,h-sync-polarity = <0>;
+		samsung,v-sync-polarity = <0>;
+		samsung,interlaced = <0>;
+		samsung,color-space = <0>;
+		samsung,dynamic-range = <0>;
+		samsung,ycbcr-coeff = <0>;
+		samsung,color-depth = <1>;
+	};
+
 };
Signature · 1 line
1.9.1.423.g4596e3a
#11 lore raw

PATCH v3 11/12 exynos: Enable the LCD backlight for snow

In reply to Simon Glass

The backlight uses FETs on the TPS65090. Enable this so that the display is visible.

---

Changes in v3:
- Rename MAX_TRIES to lower case
- Rename onoff to on
- Use generic GPIO API

Changes in v2:
- Only set up the EDP bridge for snow
- Add a device tree compatibility string for the EDP bridge
- Check for EDP failure and print an error in that case
- Return immediately in exynos_backlight_on() if needed

 board/samsung/smdk5250/exynos5-dt.c | 100 +++++++++++++++++++++++++++++++++++-
 include/fdtdec.h                    |   1 +
 lib/fdtdec.c                        |   1 +
 3 files changed, 101 insertions(+), 1 deletion(-)
board/samsung/smdk5250/exynos5-dt.c +99 -1
index bce7583..d6ce133 100644
@@ -11,9 +11,9 @@
 #include <i2c.h>
 #include <netdev.h>
 #include <spi.h>
+#include <asm/gpio.h>
 #include <asm/arch/cpu.h>
 #include <asm/arch/dwmmc.h>
-#include <asm/arch/gpio.h>
 #include <asm/arch/mmc.h>
 #include <asm/arch/pinmux.h>
 #include <asm/arch/power.h>
@@ -180,6 +180,59 @@ int exynos_power_init(void)
 #endif	/* CONFIG_POWER */
 
 #ifdef CONFIG_LCD
+static int board_dp_bridge_setup(void)
+{
+	const int max_tries = 10;
+	int num_tries, node;
+
+	/*
+	 * TODO(sjg): Use device tree for GPIOs when exynos GPIO
+	 * numbering patch is in mainline.
+	 */
+	debug("%s\n", __func__);
+	node = fdtdec_next_compatible(gd->fdt_blob, 0, COMPAT_NXP_PTN3460);
+	if (node < 0) {
+		debug("%s: No node for DP bridge in device tree\n", __func__);
+		return -ENODEV;
+	}
+
+	/* Setup the GPIOs */
+
+	/* PD is ACTIVE_LOW, and initially de-asserted */
+	gpio_set_pull(EXYNOS5_GPIO_Y25, S5P_GPIO_PULL_NONE);
+	gpio_direction_output(EXYNOS5_GPIO_Y25, 1);
+
+	/* Reset is ACTIVE_LOW */
+	gpio_set_pull(EXYNOS5_GPIO_X15, S5P_GPIO_PULL_NONE);
+	gpio_direction_output(EXYNOS5_GPIO_X15, 0);
+
+	udelay(10);
+	gpio_set_value(EXYNOS5_GPIO_X15, 1);
+
+	gpio_direction_input(EXYNOS5_GPIO_X07);
+
+	/*
+	 * We need to wait for 90ms after bringing up the bridge since there
+	 * is a phantom "high" on the HPD chip during its bootup.  The phantom
+	 * high comes within 7ms of de-asserting PD and persists for@least
+	 * 15ms.  The real high comes roughly 50ms after PD is de-asserted. The
+	 * phantom high makes it hard for us to know when the NXP chip is up.
+	 */
+	mdelay(90);
+
+	for (num_tries = 0; num_tries < max_tries; num_tries++) {
+		/* Check HPD.  If it's high, we're all good. */
+		if (gpio_get_value(EXYNOS5_GPIO_X07))
+				return 0;
+
+		debug("%s: eDP bridge failed to come up; try %d of %d\n",
+		      __func__, num_tries, max_tries);
+	}
+
+	/* Immediately go into bridge reset if the hp line is not high */
+	return -ENODEV;
+}
+
 void exynos_cfg_lcd_gpio(void)
 {
 	/* For Backlight */
@@ -198,4 +251,49 @@ void exynos_set_dp_phy(unsigned int onoff)
 {
 	set_dp_phy_ctrl(onoff);
 }
+
+void exynos_backlight_on(unsigned int on)
+{
+	debug("%s(%u)\n", __func__, on);
+
+	if (!on)
+		return;
+
+#ifdef CONFIG_POWER_TPS65090
+	int ret;
+
+	ret = tps65090_fet_enable(1); /* Enable FET1, backlight */
+	if (ret)
+		return;
+
+	/* T5 in the LCD timing spec (defined as > 10ms) */
+	mdelay(10);
+
+	/* board_dp_backlight_pwm */
+	gpio_direction_output(EXYNOS5_GPIO_B20, 1);
+
+	/* T6 in the LCD timing spec (defined as > 10ms) */
+	mdelay(10);
+
+	/* board_dp_backlight_en */
+	gpio_direction_output(EXYNOS5_GPIO_X30, 1);
+#endif
+}
+
+void exynos_lcd_power_on(void)
+{
+	int ret;
+
+	debug("%s\n", __func__);
+
+#ifdef CONFIG_POWER_TPS65090
+	/* board_dp_lcd_vdd */
+	tps65090_fet_enable(6); /* Enable FET6, lcd panel */
+#endif
+
+	ret = board_dp_bridge_setup();
+	if (ret && ret != -ENODEV)
+		printf("LCD bridge failed to enable: %d\n", ret);
+}
+
 #endif
include/fdtdec.h +1 -0
index 669ab90..ea50d75 100644
@@ -93,6 +93,7 @@ enum fdt_compat_id {
 	COMPAT_SANDBOX_HOST_EMULATION,	/* Sandbox emulation of a function */
 	COMPAT_SANDBOX_LCD_SDL,		/* Sandbox LCD emulation with SDL */
 	COMPAT_TI_TPS65090,		/* Texas Instrument TPS65090 */
+	COMPAT_NXP_PTN3460,		/* NXP PTN3460 DP/LVDS bridge */
 
 	COMPAT_COUNT,
 };
lib/fdtdec.c +1 -0
index b389d4e..fbab678 100644
@@ -67,6 +67,7 @@ static const char * const compat_names[COMPAT_COUNT] = {
 	COMPAT(SANDBOX_HOST_EMULATION, "sandbox,host-emulation"),
 	COMPAT(SANDBOX_LCD_SDL, "sandbox,lcd-sdl"),
 	COMPAT(TI_TPS65090, "ti,tps65090"),
+	COMPAT(COMPAT_NXP_PTN3460, "nxp,ptn3460"),
 };
 
 const char *fdtdec_get_compatible(enum fdt_compat_id id)
Signature · 1 line
1.9.1.423.g4596e3a
#12 lore raw

PATCH v3 12/12 initcall: Improve debugging support

In reply to Simon Glass

Add the ability to display the code offset of an initcall even after it is relocated. This makes it much easier to relate initcalls back to the U-Boot System.map file.

---

Changes in v3:
- Drop patch "exynos: dts: Disable cros_ec interrupts due to broken GPIOs"

Changes in v2:
- Rebase to samsung/master

 include/initcall.h |  2 +-
 lib/initcall.c     | 17 ++++++++++++-----
 2 files changed, 13 insertions(+), 6 deletions(-)
include/initcall.h +1 -1
index 2378077..65f67dc 100644
@@ -6,4 +6,4 @@
 
 typedef int (*init_fnc_t)(void);
 
-int initcall_run_list(init_fnc_t init_sequence[]);
+int initcall_run_list(const init_fnc_t init_sequence[]);
lib/initcall.c +12 -5
index fa76dd7..7597bad 100644
@@ -7,15 +7,22 @@
 #include <common.h>
 #include <initcall.h>
 
-int initcall_run_list(init_fnc_t init_sequence[])
+DECLARE_GLOBAL_DATA_PTR;
+
+int initcall_run_list(const init_fnc_t init_sequence[])
 {
-	init_fnc_t *init_fnc_ptr;
+	const init_fnc_t *init_fnc_ptr;
 
 	for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
-		debug("initcall: %p\n", *init_fnc_ptr);
+		unsigned long reloc_ofs = 0;
+
+		if (gd->flags & GD_FLG_RELOC)
+			reloc_ofs = gd->reloc_off;
+		debug("initcall: %p\n", (char *)*init_fnc_ptr - reloc_ofs);
 		if ((*init_fnc_ptr)()) {
-			debug("initcall sequence %p failed at call %p\n",
-			      init_sequence, *init_fnc_ptr);
+			printf("initcall sequence %p failed at call %p\n",
+			       init_sequence,
+			       (char *)*init_fnc_ptr - reloc_ofs);
 			return -1;
 		}
 	}
Signature · 1 line
1.9.1.423.g4596e3a
#13 lore raw

v3 cover Enable LCD display on snow

In reply to Simon Glass
Quoted 6 lines · Simon Glass

This series adds a driver for TPS65090 and plumbs it in to get the LCD working correctly on snow.

The display driver is already present, but needs information about the display to be provided in the device tree.

Quoted 8 lines

The backlight also needs to be enabled - it is controlled by a FET on the TPS65090. Note that the TPS65090 is controlled by the device tree so will only be present if the board's device tree file specifies it. At present this is only the case for snow, but other exynos5 boards will use it (e.g. pit).

Note: the TPS65090 driver was sent to the list around the middle of last year but was never applied.

Looks fine to me, I would expect all of this to come via the samsung tree then arm. Thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20140522/4bc5bdf5/attachment.pgp>
#14 lore raw

v3 cover Enable LCD display on snow

+Minkyu

Hi Tom,

Quoted 14 lines · Tom Rini
Quoted 12 lines · Simon Glass

This series adds a driver for TPS65090 and plumbs it in to get the LCD working correctly on snow.

The display driver is already present, but needs information about the display to be provided in the device tree.

The backlight also needs to be enabled - it is controlled by a FET on the TPS65090. Note that the TPS65090 is controlled by the device tree so will only be present if the board's device tree file specifies it. At present this is only the case for snow, but other exynos5 boards will use it (e.g. pit).

Quoted 5 lines
Quoted 2 lines

Note: the TPS65090 driver was sent to the list around the middle of last year but was never applied.

Looks fine to me, I would expect all of this to come via the samsung tree then arm. Thanks!

OK understood, that will include the power and initcall tweaks also.

Regards,
Simon

#15 lore raw

v3 cover Enable LCD display on snow

In reply to Simon Glass
Quoted 94 lines · Simon Glass

This series adds a driver for TPS65090 and plumbs it in to get the LCD working correctly on snow.

The display driver is already present, but needs information about the display to be provided in the device tree.

The backlight also needs to be enabled - it is controlled by a FET on the TPS65090. Note that the TPS65090 is controlled by the device tree so will only be present if the board's device tree file specifies it. At present this is only the case for snow, but other exynos5 boards will use it (e.g. pit).

Note: the TPS65090 driver was sent to the list around the middle of last year but was never applied.

Changes in v3:
- Add new patch to correct EC interrupt GPIO
- Rebase on samsung/master
- Remove extra blank lines in two places
- Use !! style instead ternary operator
- Change the ptn3460 comment to indicate a TODO for device tree GPIOs
- Rename MAX_TRIES to lower case
- Rename onoff to on
- Use generic GPIO API
- Drop patch "exynos: dts: Disable cros_ec interrupts due to broken GPIOs"

Changes in v2:
- Add new patch to drop smdk5250.c file
- Add new patch to rename CHARGER_EN/DISABLE
- Removed non-device-tree operation
- Use errno.h for error return codes everywhere
- Plumb into pmic charging framework
- Fix style nit
- Use correct license header
- Use new Linux device tree bindings
- Add partial battery charging support
- Update patch name to exynos5-dt instead of smdk5250
- Move code to exynos5-dt.c
- Fix comment style
- Add #ifdef around tps65090 code
- Add a device tree node for the snow EDP bridge chip
- Only set up the EDP bridge for snow
- Add a device tree compatibility string for the EDP bridge
- Check for EDP failure and print an error in that case
- Return immediately in exynos_backlight_on() if needed
- Rebase to samsung/master

Aaron Durbin (3):
exynos5: Enable tps65090 on exynos5-dt
power: Explicitly select pmic device's bus
exynos5: support tps65090 pmic

Simon Glass (8):
exynos: dts: Correct EC interrupt GPIO
exynos: Drop old smdk5250.c file
power: Rename CONFIG_PMIC_... to CONFIG_POWER_...
power: Add PMIC_ prefix to CHARGER_EN/DISABLE
exynos: Enable PSHOLD in SPL
exynos: dts: Enable LCD for snow
exynos: Enable the LCD backlight for snow
initcall: Improve debugging support

Tom Wai-Hong Tam (1):
power: Add support for TPS65090 PMU chip.

 arch/arm/cpu/armv7/exynos/lowlevel_init.c       |   2 +
 arch/arm/dts/exynos5250-snow.dts                |  61 +++-
 board/samsung/smdk5250/Makefile                 |   4 -
 board/samsung/smdk5250/exynos5-dt.c             | 238 +++++++++++++++-
 board/samsung/smdk5250/smdk5250.c               | 363 ------------------------
 doc/device-tree-bindings/power/tps65090.txt     |  17 ++
 doc/device-tree-bindings/regulator/tps65090.txt | 122 ++++++++
 drivers/power/battery/bat_trats.c               |   4 +-
 drivers/power/battery/bat_trats2.c              |   2 +-
 drivers/power/mfd/pmic_max77693.c               |   2 +-
 drivers/power/pmic/Makefile                     |   1 +
 drivers/power/pmic/pmic_max8997.c               |   2 +-
 drivers/power/pmic/pmic_tps65090.c              | 310 ++++++++++++++++++++
 drivers/power/power_fsl.c                       |   6 +-
 drivers/power/power_i2c.c                       |   4 +
 include/configs/arndale.h                       |   4 +-
 include/configs/exynos5-dt.h                    |   1 +
 include/configs/exynos5250-dt.h                 |   2 +-
 include/configs/mx25pdk.h                       |   2 +-
 include/configs/mx35pdk.h                       |   2 +-
 include/configs/mx53evk.h                       |   2 +-
 include/configs/mx53loco.h                      |   2 +-
 include/configs/woodburn_common.h               |   2 +-
 include/fdtdec.h                                |   2 +
 include/initcall.h                              |   2 +-
 include/power/max77693_pmic.h                   |   2 -
 include/power/max8997_pmic.h                    |   1 -
 include/power/pmic.h                            |   5 +
 include/power/tps65090_pmic.h                   |  73 +++++
Quoted 9 lines
 lib/fdtdec.c                                    |   2 +
 lib/initcall.c                                  |  17 +-
 31 files changed, 864 insertions(+), 395 deletions(-)
 delete mode 100644 board/samsung/smdk5250/smdk5250.c
 create mode 100644 doc/device-tree-bindings/power/tps65090.txt
 create mode 100644 doc/device-tree-bindings/regulator/tps65090.txt
 create mode 100644 drivers/power/pmic/pmic_tps65090.c
 create mode 100644 include/power/tps65090_pmic.h

applied to u-boot-samsung

Thanks,
Minkyu Kang.