Commit 20d58933 authored by H. Nikolaus Schaller's avatar H. Nikolaus Schaller
Browse files

LC15EVM: fix configs, Makefile, board file

parent 359f96b7
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@ config TARGET_AM57XX_EVM
config TARGET_LETUX_CORTEX15
	bool "Letux Cortex 15 SoM"

config TARGET_LC15_EVM
	bool "Letux Cortex 15 Evaluation Motherboard"

config TARGET_PYRA_LC15
	bool "Pyra Handheld with LC15 CPU"

@@ -97,6 +100,7 @@ source "board/ti/omap5_uevm/Kconfig"
source "board/ti/dra7xx/Kconfig"
source "board/ti/am57xx/Kconfig"
source "board/goldelico/letux-cortex15/Kconfig"
source "board/goldelico/letux-lc15evm/Kconfig"
source "board/pandora/pyra+lc15/Kconfig"

endif
+2 −2
Original line number Diff line number Diff line
if TARGET_LC15EVM
if TARGET_LC15_EVM

config SYS_BOARD
	default "lc15evm"
	default "letux-lc15evm"

config SYS_VENDOR
	default "goldelico"
+29 −139
Original line number Diff line number Diff line
/*
 * basically the same as the Letux Cortex 15
 * basically the same as the Letux Cortex 15 Evaluation Motherboard
 * except that we change the UART3 pinmux because it is wired up
 * differently
 */
@@ -20,7 +20,7 @@ extern void set_muxconf_regs_inherited(void);
#undef board_init

const struct omap_sysinfo sysinfo = {
	"Board: Letux Cortex 15 Evaluation Board\n"
	"Board: Letux Cortex 15 Evaluation Motherboard\n"
};

const struct pad_conf_entry core_padconf_array_essential_pyra[] = {
@@ -67,84 +67,35 @@ void set_muxconf_regs(void)
/* U-Boot only code */
#if !defined(CONFIG_SPL_BUILD)

// FIXME: add a bq2427x driver?

/* I2C chip addresses, bq24297 */
#define BQ24297_BUS	1	/* I2C2 */
#define BQ24297_ADDR	0x6b

static inline int bq24297_i2c_write_u8(u8 reg, u8 val)
{
	int org_bus_num;
	int ret;

	org_bus_num = i2c_get_bus_num();
	i2c_set_bus_num(BQ24297_BUS);	/* select I2C2 */

	ret = i2c_write(BQ24297_ADDR, reg, 1, &val, 1);

	i2c_set_bus_num(org_bus_num);
	return ret;
}

static inline int bq24297_i2c_read_u8(u8 reg, u8 *val)
{
	int org_bus_num;
	int ret;

	org_bus_num = i2c_get_bus_num();
	i2c_set_bus_num(BQ24297_BUS);	/* select I2C2 */
	ret = i2c_read(BQ24297_ADDR, reg, 1, val, 1);

	i2c_set_bus_num(org_bus_num);
	return ret;
}

int bq2429x_battery_present(void)
{
	u8 reg;

	if (bq24297_i2c_read_u8(0x09, &reg)) {
		printf("bq24297: no response from REG9\n");
		return 0;
	}

#if 0
	printf("bq24297: r9 = %02x\n", reg);
#endif

	return !(reg & 0x03);	/* no NTC fault - assume battery is inserted */
}

/**
 * @brief tca642x_init - Pyra default values for the GPIO expander
 * @brief tca642x_init - set default values for the GPIO expander
 * input reg, output reg, polarity reg, configuration reg (0=output)
 */
#define P00_HDMI_CT_HPD	0x01
#define P01_HDMI_LS_OE	0x02
#define P02_NONE	0x04
#define P03_NONE	0x08
#define P04_VIBRA	0x10	/* n/a in Revision 5.1 and later */
#define P05_FAULT2	0x20	/* also L-RED */
#define P04_NONE	0x10
#define P05_FAULT2	0x20	/* also LED-BLUE */
#define P06_NONE	0x40
#define P07_NONE	0x80

#define P10_EN_USB	0x01
#define P11_EN_HOST1	0x02
#define P12_EN_HOST2	0x04
#define P13_CHG_INT	0x08
#define P13_NONE	0x08
#define P14_NONE	0x10
#define P15_NONE	0x20
#define P16_MICPRES	0x40	/* MIC-INT in Revision 5.1 and later */
#define P17_EN_MODEM	0x80

#define P20_SD_HS_AMP	0x01
#define P21_CHG_STAT	0x02	/* also PWR-RED */
#define P22_PWR_GREEN	0x04	/* NONE in Revision 5.1 and later */
#define P23_PWR_BLUE	0x08
#define P23_EN_OTG	0x08	/* EN_OTG in Revision 5.1 and later */
#define P24_EN_ESATA	0x10	/* NONE in Revision 5.1 and later */
#define P25_FAULT1	0x20	/* also R-RED */
#define P16_MICINT	0x40
#define P17_NONE	0x80

#define P20_NONE	0x01
#define P21_GREEN	0x02	/* LED-GREEN */
#define P22_NONE	0x04
#define P23_NONE	0x08
#define P23_NONE	0x08
#define P24_NONE	0x10
#define P25_FAULT1	0x20	/* also LED-RED */
#define P26_NONE	0x40
#define P27_NONE	0x80

@@ -156,11 +107,11 @@ struct tca642x_bank_info pyra_tca642x_init[] = {
	{ .input_reg = 0x00,
	  .output_reg = 0x00,
	  .polarity_reg = 0x00,
	  .configuration_reg = P16_MICPRES | P13_CHG_INT },	/* all others are outputs */
	  .configuration_reg = P16_MICINT },	/* all others are outputs */
	{ .input_reg = 0x00,
	  .output_reg = 0x00,
	  .polarity_reg = 0x00,
	  .configuration_reg = P20_SD_HS_AMP | P21_CHG_STAT | P22_PWR_GREEN | P23_PWR_BLUE },	/* all others are outputs */
	  .configuration_reg = 0x00 },	/* all others are outputs */
};

/*
@@ -175,14 +126,14 @@ static int get_pyra_mainboard_revision(void)
	static int revision = -1;

	static char revtable[8] = {	/* revision table defined by pull-down R1901, R1902, R1903 */
		[7] = 49 + 1,	/* some 5.0 boards have wrong version resistors so they report themselves as 4.9 */
		[6] = 50,
		[5] = 51,
		[3] = 52,
		[4] = 53,
		[2] = 54,
		[1] = 55,
		[0] = 56,
		[7] = 10,
		[6] = 11,
		[5] = 12,
		[3] = 13,
		[4] = 14,
		[2] = 15,
		[1] = 16,
		[0] = 17,
	};

	if (revision == -1) {
@@ -207,7 +158,7 @@ static int get_pyra_mainboard_revision(void)

	/* FIXME: turn off pull-up to save up ca. 50-750µA */

	printf("Found Pyra MB V%d.%d\n", revision/10, revision%10);
	printf("Found LC15EVM V%d.%d\n", revision/10, revision%10);
	return revision;
}

@@ -222,11 +173,11 @@ void CONFIG_MORE_FDT(char *devtree)
		return;	/* some error */

	/* extend by overwriting ".dtb" */
	sprintf(devtree+len-4, "+%s-v%d.%d.dtb", "pyra", rev/10, rev%10);
	sprintf(devtree+len-4, "+%s-v%d.%d.dtb", "evm", rev/10, rev%10);
}

/**
 * @brief board_init for Pyra
 * @brief board_init for LC15 EVM
 *
 * @return 0
 */
@@ -248,67 +199,6 @@ int board_init(void)
	udelay(5000);	/* 5ms should suffice */
#endif

#if 0	// contrary to the Pyra and the GTA15 this board has no bq24297

// UNDERSTAND ME: it is important that we program the bq2429x first before
// we initialize the tca6424! Why?
// What is (sometimes) turned on and draws too much energy?
// WWAN-Module? USB DC/DC?

	if (bq24297_i2c_write_u8(0x05, 0x8a))
		printf("bq24297: could not turn off 40 sec watchdog\n");

	if (!bq2429x_battery_present()) {
		u8 reg;

		printf("bq24297: no battery found\n");

		/* if we operate from no battery:
		 * assume we are powered elsewhere and not through standard USB
		 *
		 * -> increase bq24297 current limit to at least 2A
		 * -> reduce VINDPM minimum VBUS voltage to 3.88 V
		 *
		 * Otherwise we can not safely boot into Linux, especially
		 * with higher resistance of the USB cable.
		 */

		if (bq24297_i2c_read_u8(0x00, &reg))
			printf("bq24297: no response from REG0\n");
		else {
			u8 nreg = reg;
			int ilim = reg & 0x7; /* bit 0..2 are IINLIM */
#if 1
			printf("Iin_lim found: %d\n", ilim);
#endif
			if (ilim < 6) {
				ilim = 6;	/* increase to 2A */
				nreg &= ~0x7;
				nreg |= ilim;
#if 1
				printf("Iin_lim changed %d\n", nreg & 0x7);
#endif
			}
#if 1
			printf("Vin_dpm found: %d\n", (reg >> 3) & 0x0f);
#endif
			nreg &= ~0x78;	/* bits 3..6 are VINDPM */
			nreg |= (0 << 3);	/* set level 0 = 3.88V */
#if 1
			printf("Vin_dpm changed: %d\n", (nreg >> 3) & 0x0f);
#endif
			if (nreg != reg) {
				if (bq24297_i2c_write_u8(0x00, nreg))
					printf("bq24297: could not set REG0 to %02x\n", nreg);
#if 1
				else
					printf("bq24297: r0 := %02x\n", nreg);
#endif
			}
		}
	}
#endif

#if defined(CONFIG_TCA642X)
	extern int tca642x_info(uchar chip);
	tca642x_info(CONFIG_SYS_I2C_TCA642X_ADDR);
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ CONFIG_ARM=y
CONFIG_OMAP54XX=y
CONFIG_ARMV7_LPAE=y
# CONFIG_SPL_NAND_SUPPORT is not set
CONFIG_TARGET_PYRA_LC15=y
CONFIG_TARGET_LC15_EVM=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_VERSION_VARIABLE=y
CONFIG_SPL=y
@@ -38,8 +38,8 @@ CONFIG_USB_DWC3_PHY_OMAP=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_G_DNL_MANUFACTURER="OpenPandora"
CONFIG_G_DNL_PRODUCT="Dragonbox Pyra"
CONFIG_G_DNL_MANUFACTURER="Goldelico"
CONFIG_G_DNL_PRODUCT="LC15-EVM"
CONFIG_G_DNL_VENDOR_NUM=0x0403
CONFIG_G_DNL_PRODUCT_NUM=0xbd00
CONFIG_OF_LIBFDT=y
+3 −3
Original line number Diff line number Diff line
@@ -2,7 +2,7 @@ CONFIG_ARM=y
CONFIG_OMAP54XX=y
CONFIG_ARMV7_LPAE=y
# CONFIG_SPL_NAND_SUPPORT is not set
CONFIG_TARGET_PYRA_LC15=y
CONFIG_TARGET_LC15_EVM=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
CONFIG_VERSION_VARIABLE=y
CONFIG_SPL=y
@@ -38,8 +38,8 @@ CONFIG_USB_DWC3_PHY_OMAP=y
CONFIG_USB_STORAGE=y
CONFIG_USB_GADGET=y
CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_G_DNL_MANUFACTURER="OpenPandora"
CONFIG_G_DNL_PRODUCT="Dragonbox Pyra"
CONFIG_G_DNL_MANUFACTURER="Goldelico"
CONFIG_G_DNL_PRODUCT="LC15-EVM"
CONFIG_G_DNL_VENDOR_NUM=0x0403
CONFIG_G_DNL_PRODUCT_NUM=0xbd00
CONFIG_OF_LIBFDT=y
Loading