Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2009
-gerrit
commit bffda14bf6c5b53ac2c66924c59f12cdacc484f2
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Fri Dec 7 17:28:02 2012 -0800
Only include libgcc wrappers on x86
ARM does not need them, and they're causing trouble
Change-Id: I6c70a52c68fdcdbf211217d30c96e1c2877c7f90
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
---
src/lib/Makefile.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
index 3b16170..6b3f0d8 100644
--- a/src/lib/Makefile.inc
+++ b/src/lib/Makefile.inc
@@ -60,7 +60,7 @@ ramstage-y += cbfs.c
ramstage-y += lzma.c
#ramstage-y += lzmadecode.c
ramstage-y += stack.c
-ramstage-y += gcc.c
+ramstage-$(CONFIG_ARCH_X86) += gcc.c
ramstage-y += clog2.c
ramstage-y += cbmem.c
ramstage-$(CONFIG_CONSOLE_SERIAL8250) += uart8250.c
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2008
-gerrit
commit 647b3eaf0ea1acedb769892b60507b30680d8f77
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Fri Dec 7 17:26:41 2012 -0800
cbfs_core.h: support for ARMv7 CBFS master header
Change-Id: I59626200b4a92d90b46625f8dcc2ed28e6376e46
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
---
src/include/cbfs_core.h | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/include/cbfs_core.h b/src/include/cbfs_core.h
index 32f2670..9a21a78 100644
--- a/src/include/cbfs_core.h
+++ b/src/include/cbfs_core.h
@@ -84,6 +84,9 @@
#define CBFS_HEADER_MAGIC 0x4F524243
#if CONFIG_ARCH_X86
#define CBFS_HEADPTR_ADDR 0xFFFFFFFC
+#elif CONFIG_ARCH_ARMV7
+/* FIXME: This could also be 0xFFFF0000 with HIVECS enabled */
+#define CBFS_HEADPTR_ADDR 0x0000000C
#endif
#define VERSION1 0x31313131
#define VERSION2 0x31313132
Stefan Reinauer (stefan.reinauer(a)coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2006
-gerrit
commit b1591ba035e97c3e8292893416b230e0bc04ac4a
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Fri Dec 7 17:21:08 2012 -0800
WIP: Add support for MAXIM MAX77686 PMIC chip
This will need working I2C support on ARM
Change-Id: Iec3eaacf216d841f0d292d4b7494756e6e1532a7
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
---
src/drivers/Kconfig | 1 +
src/drivers/Makefile.inc | 1 +
src/drivers/maxim/Kconfig | 5 +
src/drivers/maxim/Makefile.inc | 20 +++
src/drivers/maxim/max77686.c | 257 +++++++++++++++++++++++++++++++++
src/include/device/i2c.h | 279 ++++++++++++++++++++++++++++++++++++
src/include/device/power/max77686.h | 134 +++++++++++++++++
7 files changed, 697 insertions(+)
diff --git a/src/drivers/Kconfig b/src/drivers/Kconfig
index ef38f34..ca94d2b 100644
--- a/src/drivers/Kconfig
+++ b/src/drivers/Kconfig
@@ -33,3 +33,4 @@ source src/drivers/realtek/Kconfig
source src/drivers/sil/Kconfig
source src/drivers/spi/Kconfig
source src/drivers/trident/Kconfig
+source src/drivers/maxim/Kconfig
diff --git a/src/drivers/Makefile.inc b/src/drivers/Makefile.inc
index a02b705..65800f0 100644
--- a/src/drivers/Makefile.inc
+++ b/src/drivers/Makefile.inc
@@ -30,4 +30,5 @@ subdirs-y += ics
subdirs-y += spi
subdirs-y += ipmi
subdirs-y += elog
+subdirs-y += maxim
subdirs-$(CONFIG_ARCH_X86) += pc80
diff --git a/src/drivers/maxim/Kconfig b/src/drivers/maxim/Kconfig
new file mode 100644
index 0000000..84ace13
--- /dev/null
+++ b/src/drivers/maxim/Kconfig
@@ -0,0 +1,5 @@
+config DRIVER_MAXIM_77686
+ bool "Maxim 77686"
+ default n
+ help
+ Maxim 77686 power regulator
diff --git a/src/drivers/maxim/Makefile.inc b/src/drivers/maxim/Makefile.inc
new file mode 100644
index 0000000..3fc7104
--- /dev/null
+++ b/src/drivers/maxim/Makefile.inc
@@ -0,0 +1,20 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2012 The ChromiumOS Authors
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; version 2 of the License.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##
+
+driver-$(CONFIG_DRIVER_MAXIM_77686) += max77686.c
diff --git a/src/drivers/maxim/max77686.c b/src/drivers/maxim/max77686.c
new file mode 100644
index 0000000..6c24240
--- /dev/null
+++ b/src/drivers/maxim/max77686.c
@@ -0,0 +1,257 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Alim Akhtar <alim.akhtar(a)samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <i2c.h>
+#include <max77686.h>
+
+/* Chip register numbers (not exported from this module) */
+enum {
+ REG_BBAT = 0x7e,
+
+ /* Bits for BBAT */
+ BBAT_BBCHOSTEN_MASK = 1 << 0,
+ BBAT_BBCVS_SHIFT = 3,
+ BBAT_BBCVS_MASK = 3 << BBAT_BBCVS_SHIFT,
+};
+
+/*
+ * Max77686 parameters values
+ * see max77686.h for parameters details
+ */
+struct max77686_para max77686_param[] = {/*{regnum, vol_addr, vol_bitpos,
+ vol_bitmask, reg_enaddr, reg_enbitpos, reg_enbitmask, reg_enbiton,
+ reg_enbitoff, vol_min, vol_div}*/
+ {PMIC_BUCK1, 0x11, 0x0, 0x3F, 0x10, 0x0, 0x3, 0x3, 0x0, 750, 50000},
+ {PMIC_BUCK2, 0x14, 0x0, 0xFF, 0x12, 0x4, 0x3, 0x1, 0x0, 600, 12500},
+ {PMIC_BUCK3, 0x1E, 0x0, 0xFF, 0x1C, 0x4, 0x3, 0x1, 0x0, 600, 12500},
+ {PMIC_BUCK4, 0x28, 0x0, 0xFF, 0x26, 0x4, 0x3, 0x1, 0x0, 600, 12500},
+ {PMIC_BUCK5, 0x31, 0x0, 0x3F, 0x30, 0x0, 0x3, 0x3, 0x0, 750, 50000},
+ {PMIC_BUCK6, 0x33, 0x0, 0x3F, 0x32, 0x0, 0x3, 0x3, 0x0, 750, 50000},
+ {PMIC_BUCK7, 0x35, 0x0, 0x3F, 0x34, 0x0, 0x3, 0x3, 0x0, 750, 50000},
+ {PMIC_BUCK8, 0x37, 0x0, 0x3F, 0x36, 0x0, 0x3, 0x3, 0x0, 750, 50000},
+ {PMIC_BUCK9, 0x39, 0x0, 0x3F, 0x38, 0x0, 0x3, 0x3, 0x0, 750, 50000},
+ {PMIC_LDO1, 0x40, 0x0, 0x3F, 0x40, 0x6, 0x3, 0x3, 0x0, 800, 25000},
+ {PMIC_LDO2, 0x41, 0x0, 0x3F, 0x41, 0x6, 0x3, 0x1, 0x0, 800, 25000},
+ {PMIC_LDO3, 0x42, 0x0, 0x3F, 0x42, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO4, 0x43, 0x0, 0x3F, 0x43, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO5, 0x44, 0x0, 0x3F, 0x44, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO6, 0x45, 0x0, 0x3F, 0x45, 0x6, 0x3, 0x1, 0x0, 800, 25000},
+ {PMIC_LDO7, 0x46, 0x0, 0x3F, 0x46, 0x6, 0x3, 0x1, 0x0, 800, 25000},
+ {PMIC_LDO8, 0x47, 0x0, 0x3F, 0x47, 0x6, 0x3, 0x1, 0x0, 800, 25000},
+ {PMIC_LDO9, 0x48, 0x0, 0x3F, 0x48, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO10, 0x49, 0x0, 0x3F, 0x49, 0x6, 0x3, 0x1, 0x0, 800, 50000},
+ {PMIC_LDO11, 0x4A, 0x0, 0x3F, 0x4A, 0x6, 0x3, 0x1, 0x0, 800, 50000},
+ {PMIC_LDO12, 0x4B, 0x0, 0x3F, 0x4B, 0x6, 0x3, 0x1, 0x0, 800, 50000},
+ {PMIC_LDO13, 0x4C, 0x0, 0x3F, 0x4C, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO14, 0x4D, 0x0, 0x3F, 0x4D, 0x6, 0x3, 0x1, 0x0, 800, 50000},
+ {PMIC_LDO15, 0x4E, 0x0, 0x3F, 0x4E, 0x6, 0x3, 0x1, 0x0, 800, 25000},
+ {PMIC_LDO16, 0x4F, 0x0, 0x3F, 0x4F, 0x6, 0x3, 0x1, 0x0, 800, 50000},
+ {PMIC_LDO17, 0x50, 0x0, 0x3F, 0x50, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO18, 0x51, 0x0, 0x3F, 0x51, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO19, 0x52, 0x0, 0x3F, 0x52, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO20, 0x53, 0x0, 0x3F, 0x53, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO21, 0x54, 0x0, 0x3F, 0x54, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO22, 0x55, 0x0, 0x3F, 0x55, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO23, 0x56, 0x0, 0x3F, 0x56, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO24, 0x57, 0x0, 0x3F, 0x57, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO25, 0x58, 0x0, 0x3F, 0x58, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_LDO26, 0x59, 0x0, 0x3F, 0x59, 0x6, 0x3, 0x3, 0x0, 800, 50000},
+ {PMIC_EN32KHZ_CP, 0x0, 0x0, 0x0, 0x7F, 0x1, 0x1, 0x1, 0x0, 0x0, 0x0},
+};
+
+/*
+ * Write a value to a register
+ *
+ * @param chip_addr i2c addr for max77686
+ * @param reg reg number to write
+ * @param val value to be written
+ *
+ */
+static inline int max77686_i2c_write(unsigned char chip_addr,
+ unsigned int reg, unsigned char val)
+{
+ return i2c_write(chip_addr, reg, 1, &val, 1);
+}
+
+/*
+ * Read a value from a register
+ *
+ * @param chip_addr i2c addr for max77686
+ * @param reg reg number to write
+ * @param val value to be written
+ *
+ */
+static inline int max77686_i2c_read(unsigned char chip_addr,
+ unsigned int reg, unsigned char *val)
+{
+ return i2c_read(chip_addr, reg, 1, val, 1);
+}
+
+/*
+ * Enable the max77686 register
+ *
+ * @param reg register number of buck/ldo to be enabled
+ * @param enable enable or disable bit
+ *
+ * REG_DISABLE = 0,
+ needed to set the buck/ldo enable bit OFF
+ * @return Return 0 if ok, else -1
+ */
+static int max77686_enablereg(enum max77686_regnum reg, int enable)
+{
+ struct max77686_para *pmic;
+ unsigned char read_data;
+ int ret;
+
+ pmic = &max77686_param[reg];
+
+ ret = max77686_i2c_read(MAX77686_I2C_ADDR, pmic->reg_enaddr,
+ &read_data);
+ if (ret != 0) {
+ debug("max77686 i2c read failed.\n");
+ return -1;
+ }
+
+ if (enable == REG_DISABLE) {
+ clrbits_8(&read_data,
+ pmic->reg_enbitmask << pmic->reg_enbitpos);
+ } else {
+ clrsetbits_8(&read_data,
+ pmic->reg_enbitmask << pmic->reg_enbitpos,
+ pmic->reg_enbiton << pmic->reg_enbitpos);
+ }
+
+ ret = max77686_i2c_write(MAX77686_I2C_ADDR,
+ pmic->reg_enaddr, read_data);
+ if (ret != 0) {
+ debug("max77686 i2c write failed.\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+static int max77686_do_volsetting(enum max77686_regnum reg, unsigned int volt,
+ int enable, int volt_units)
+{
+ struct max77686_para *pmic;
+ unsigned char read_data;
+ int vol_level = 0;
+ int ret;
+
+ pmic = &max77686_param[reg];
+
+ if (pmic->vol_addr == 0) {
+ debug("not a voltage register.\n");
+ return -1;
+ }
+
+ ret = max77686_i2c_read(MAX77686_I2C_ADDR, pmic->vol_addr, &read_data);
+ if (ret != 0) {
+ debug("max77686 i2c read failed.\n");
+ return -1;
+ }
+
+ if (volt_units == MAX77686_UV)
+ vol_level = volt - pmic->vol_min * 1000;
+ else
+ vol_level = (volt - pmic->vol_min) * 1000;
+
+ if (vol_level < 0) {
+ debug("Not a valid voltage level to set\n");
+ return -1;
+ }
+ vol_level /= pmic->vol_div;
+
+ clrsetbits_8(&read_data, pmic->vol_bitmask << pmic->vol_bitpos,
+ vol_level << pmic->vol_bitpos);
+
+ ret = max77686_i2c_write(MAX77686_I2C_ADDR, pmic->vol_addr, read_data);
+ if (ret != 0) {
+ debug("max77686 i2c write failed.\n");
+ return -1;
+ }
+
+ ret = max77686_enablereg(reg, enable);
+ if (ret != 0) {
+ debug("Failed to enable buck/ldo.\n");
+ return -1;
+ }
+
+ return 0;
+}
+
+int max77686_volsetting(enum max77686_regnum reg, unsigned int volt,
+ int enable, int volt_units)
+{
+ int old_bus = i2c_get_bus_num();
+ int ret;
+
+ i2c_set_bus_num(0);
+ ret = max77686_do_volsetting(reg, volt, enable, volt_units);
+ i2c_set_bus_num(old_bus);
+ return ret;
+}
+
+int max77686_enable_32khz_cp(void)
+{
+ i2c_set_bus_num(0);
+ return max77686_enablereg(PMIC_EN32KHZ_CP, REG_ENABLE);
+}
+
+int max77686_disable_backup_batt(void)
+{
+ unsigned char val;
+ int ret;
+
+ i2c_set_bus_num(0);
+ ret = max77686_i2c_read(MAX77686_I2C_ADDR, REG_BBAT, &val);
+ if (ret) {
+ debug("max77686 i2c read failed\n");
+ return ret;
+ }
+
+ /* If we already have the correct values, exit */
+ if ((val & (BBAT_BBCVS_MASK | BBAT_BBCHOSTEN_MASK)) ==
+ BBAT_BBCVS_MASK)
+ return 0;
+
+ /* First disable charging */
+ val &= ~BBAT_BBCHOSTEN_MASK;
+ ret = max77686_i2c_write(MAX77686_I2C_ADDR, REG_BBAT, val);
+ if (ret) {
+ debug("max77686 i2c write failed\n");
+ return -1;
+ }
+
+ /* Finally select 3.5V to minimize power consumption */
+ val |= BBAT_BBCVS_MASK;
+ ret = max77686_i2c_write(MAX77686_I2C_ADDR, REG_BBAT, val);
+ if (ret) {
+ debug("max77686 i2c write failed\n");
+ return -1;
+ }
+
+ return 0;
+}
diff --git a/src/include/device/i2c.h b/src/include/device/i2c.h
new file mode 100644
index 0000000..f1275e3
--- /dev/null
+++ b/src/include/device/i2c.h
@@ -0,0 +1,279 @@
+/*
+ * (C) Copyright 2001
+ * Gerald Van Baren, Custom IDEAS, vanbaren(a)cideas.com.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ * The original I2C interface was
+ * (C) 2000 by Paolo Scaffardi (arsenio(a)tin.it)
+ * AIRVENT SAM s.p.a - RIMINI(ITALY)
+ * but has been changed substantially.
+ */
+
+#ifndef _I2C_H_
+#define _I2C_H_
+
+/*
+ * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+ *
+ * The implementation MUST NOT use static or global variables if the
+ * I2C routines are used to read SDRAM configuration information
+ * because this is done before the memories are initialized. Limited
+ * use of stack-based variables are OK (the initial stack size is
+ * limited).
+ *
+ * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+ */
+
+/*
+ * Configuration items.
+ */
+#define I2C_RXTX_LEN 128 /* maximum tx/rx buffer length */
+
+#ifdef CONFIG_I2C_MULTI_BUS
+#define MAX_I2C_BUS 2
+#define I2C_MULTI_BUS 1
+#else
+#define MAX_I2C_BUS 1
+#define I2C_MULTI_BUS 0
+#endif
+
+#if !defined(CONFIG_SYS_MAX_I2C_BUS)
+#define CONFIG_SYS_MAX_I2C_BUS MAX_I2C_BUS
+#endif
+
+/* define the I2C bus number for RTC and DTT if not already done */
+#if !defined(CONFIG_SYS_RTC_BUS_NUM)
+#define CONFIG_SYS_RTC_BUS_NUM 0
+#endif
+#if !defined(CONFIG_SYS_DTT_BUS_NUM)
+#define CONFIG_SYS_DTT_BUS_NUM 0
+#endif
+#if !defined(CONFIG_SYS_SPD_BUS_NUM)
+#define CONFIG_SYS_SPD_BUS_NUM 0
+#endif
+
+#ifndef I2C_SOFT_DECLARATIONS
+# if defined(CONFIG_MPC8260)
+# define I2C_SOFT_DECLARATIONS volatile ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, I2C_PORT);
+# elif defined(CONFIG_8xx)
+# define I2C_SOFT_DECLARATIONS volatile immap_t *immr = (immap_t *)CONFIG_SYS_IMMR;
+
+# elif (defined(CONFIG_AT91RM9200) || \
+ defined(CONFIG_AT91SAM9260) || defined(CONFIG_AT91SAM9261) || \
+ defined(CONFIG_AT91SAM9263)) && !defined(CONFIG_AT91_LEGACY)
+# define I2C_SOFT_DECLARATIONS at91_pio_t *pio = (at91_pio_t *) ATMEL_BASE_PIOA;
+# else
+# define I2C_SOFT_DECLARATIONS
+# endif
+#endif
+
+#ifdef CONFIG_8xx
+/* Set default value for the I2C bus speed on 8xx. In the
+ * future, we'll define these in all 8xx board config files.
+ */
+#ifndef CONFIG_SYS_I2C_SPEED
+#define CONFIG_SYS_I2C_SPEED 50000
+#endif
+#endif
+
+/*
+ * Many boards/controllers/drivers don't support an I2C slave interface so
+ * provide a default slave address for them for use in common code. A real
+ * value for CONFIG_SYS_I2C_SLAVE should be defined for any board which does
+ * support a slave interface.
+ */
+#ifndef CONFIG_SYS_I2C_SLAVE
+#define CONFIG_SYS_I2C_SLAVE 0xfe
+#endif
+
+/*
+ * Initialization, must be called once on start up, may be called
+ * repeatedly to change the speed and slave addresses.
+ */
+void i2c_init(int speed, int slaveaddr);
+void i2c_init_board(void);
+#ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT
+void i2c_board_late_init(void);
+#endif
+
+#if defined(CONFIG_I2C_MUX)
+
+typedef struct _mux {
+ uchar chip;
+ uchar channel;
+ char *name;
+ struct _mux *next;
+} I2C_MUX;
+
+typedef struct _mux_device {
+ int busid;
+ I2C_MUX *mux; /* List of muxes, to reach the device */
+ struct _mux_device *next;
+} I2C_MUX_DEVICE;
+
+I2C_MUX_DEVICE *i2c_mux_search_device(int id);
+I2C_MUX_DEVICE *i2c_mux_ident_muxstring (uchar *buf);
+int i2x_mux_select_mux(int bus);
+int i2c_mux_ident_muxstring_f (uchar *buf);
+#endif
+
+/*
+ * Probe the given I2C chip address. Returns 0 if a chip responded,
+ * not 0 on failure.
+ */
+int i2c_probe(uchar chip);
+
+/*
+ * Read/Write interface:
+ * chip: I2C chip address, range 0..127
+ * addr: Memory (register) address within the chip
+ * alen: Number of bytes to use for addr (typically 1, 2 for larger
+ * memories, 0 for register type devices with only one
+ * register)
+ * buffer: Where to read/write the data
+ * len: How many bytes to read/write
+ *
+ * Returns: 0 on success, not 0 on failure
+ */
+int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len);
+int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len);
+
+/*
+ * Utility routines to read/write registers.
+ */
+static inline u8 i2c_reg_read(u8 addr, u8 reg)
+{
+ u8 buf;
+
+#ifdef CONFIG_8xx
+ /* MPC8xx needs this. Maybe one day we can get rid of it. */
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
+
+#ifdef DEBUG
+ printf("%s: addr=0x%02x, reg=0x%02x\n", __func__, addr, reg);
+#endif
+
+ i2c_read(addr, reg, 1, &buf, 1);
+
+ return buf;
+}
+
+static inline void i2c_reg_write(u8 addr, u8 reg, u8 val)
+{
+#ifdef CONFIG_8xx
+ /* MPC8xx needs this. Maybe one day we can get rid of it. */
+ i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
+#endif
+
+#ifdef DEBUG
+ printf("%s: addr=0x%02x, reg=0x%02x, val=0x%02x\n",
+ __func__, addr, reg, val);
+#endif
+
+ i2c_write(addr, reg, 1, &val, 1);
+}
+
+/*
+ * Functions for setting the current I2C bus and its speed
+ */
+
+/*
+ * i2c_set_bus_num:
+ *
+ * Change the active I2C bus. Subsequent read/write calls will
+ * go to this one.
+ *
+ * bus - bus index, zero based
+ *
+ * Returns: 0 on success, not 0 on failure
+ *
+ */
+int i2c_set_bus_num(unsigned int bus);
+
+/*
+ * i2c_get_bus_num:
+ *
+ * Returns index of currently active I2C bus. Zero-based.
+ */
+
+unsigned int i2c_get_bus_num(void);
+
+/*
+ * i2c_set_bus_speed:
+ *
+ * Change the speed of the active I2C bus
+ *
+ * speed - bus speed in Hz
+ *
+ * Returns: 0 on success, not 0 on failure
+ *
+ */
+int i2c_set_bus_speed(unsigned int);
+
+/*
+ * i2c_get_bus_speed:
+ *
+ * Returns speed of currently active I2C bus in Hz
+ */
+
+unsigned int i2c_get_bus_speed(void);
+
+/* NOTE: These two functions MUST be always_inline to avoid code growth! */
+static inline unsigned int I2C_GET_BUS(void) __attribute__((always_inline));
+static inline unsigned int I2C_GET_BUS(void)
+{
+ return I2C_MULTI_BUS ? i2c_get_bus_num() : 0;
+}
+
+static inline void I2C_SET_BUS(unsigned int bus) __attribute__((always_inline));
+static inline void I2C_SET_BUS(unsigned int bus)
+{
+ if (I2C_MULTI_BUS)
+ i2c_set_bus_num(bus);
+}
+
+/*
+ * Set an early register base for a given i2c peripheral.
+ * This is used to access a single i2c bus early on in the boot sequence.
+ *
+ * @param base: The base address of the i2c peripheral's register map
+ */
+void i2c_set_early_reg(unsigned int base);
+
+/**
+ * Find the I2C bus number by given a FDT I2C node.
+ *
+ * @param blob Device tree blbo
+ * @param node FDT I2C node to find
+ * @return the number of I2C bus (zero based), or -1 on error
+ */
+int i2c_get_bus_num_fdt(const void *blob, int node);
+
+/**
+ * Reset the I2C bus represented by the given a FDT I2C node.
+ *
+ * @param blob Device tree blbo
+ * @param node FDT I2C node to find
+ * @return 0 if port was reset, -1 if not found
+ */
+int i2c_reset_port_fdt(const void *blob, int node);
+
+#endif /* _I2C_H_ */
diff --git a/src/include/device/power/max77686.h b/src/include/device/power/max77686.h
new file mode 100644
index 0000000..345471e
--- /dev/null
+++ b/src/include/device/power/max77686.h
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2012 Samsung Electronics
+ * Alim Akhtar <alim.akhtar(a)samsung.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __MAX77686_H_
+#define __MAX77686_H_
+
+enum max77686_regnum {
+ PMIC_BUCK1 = 0,
+ PMIC_BUCK2,
+ PMIC_BUCK3,
+ PMIC_BUCK4,
+ PMIC_BUCK5,
+ PMIC_BUCK6,
+ PMIC_BUCK7,
+ PMIC_BUCK8,
+ PMIC_BUCK9,
+ PMIC_LDO1,
+ PMIC_LDO2,
+ PMIC_LDO3,
+ PMIC_LDO4,
+ PMIC_LDO5,
+ PMIC_LDO6,
+ PMIC_LDO7,
+ PMIC_LDO8,
+ PMIC_LDO9,
+ PMIC_LDO10,
+ PMIC_LDO11,
+ PMIC_LDO12,
+ PMIC_LDO13,
+ PMIC_LDO14,
+ PMIC_LDO15,
+ PMIC_LDO16,
+ PMIC_LDO17,
+ PMIC_LDO18,
+ PMIC_LDO19,
+ PMIC_LDO20,
+ PMIC_LDO21,
+ PMIC_LDO22,
+ PMIC_LDO23,
+ PMIC_LDO24,
+ PMIC_LDO25,
+ PMIC_LDO26,
+ PMIC_EN32KHZ_CP,
+};
+
+/**
+ * struct max77686_para - max77686 register parameters
+ * @param vol_addr i2c address of the given buck/ldo register
+ * @param vol_bitpos bit position to be set or clear within register
+ * @param vol_bitmask bit mask value
+ * @param reg_enaddr control register address, which enable the given
+ * given buck/ldo.
+ * @param reg_enbitpos bit position to be enabled
+ * @param reg_enbiton value to be written to buck/ldo to make it ON
+ * @param reg_enbitoff value to be written to buck/ldo to make it OFF
+ * @param vol_min minimum voltage level supported by given buck/ldo
+ * @param vol_div voltage division value of given buck/ldo
+ */
+struct max77686_para {
+ enum max77686_regnum regnum;
+ u8 vol_addr;
+ u8 vol_bitpos;
+ u8 vol_bitmask;
+ u8 reg_enaddr;
+ u8 reg_enbitpos;
+ u8 reg_enbitmask;
+ u8 reg_enbiton;
+ u8 reg_enbitoff;
+ u32 vol_min;
+ u32 vol_div;
+};
+
+/* I2C device address for pmic max77686 */
+#define MAX77686_I2C_ADDR (0x12 >> 1)
+
+enum {
+ REG_DISABLE = 0,
+ REG_ENABLE
+};
+
+enum {
+ MAX77686_MV = 0, /* mili volt */
+ MAX77686_UV /* micro volt */
+};
+
+/**
+ * This function enables the 32KHz coprocessor clock.
+ *
+ * Return 0 if ok, else -1
+ */
+int max77686_enable_32khz_cp(void);
+
+/**
+ * Set the required voltage level of pmic
+ *
+ * @param reg register number of buck/ldo to be set
+ * @param volt voltage level to be set
+ * @param enable enable or disable bit
+ * @param volt_units MAX77686_MV or MAX77686_UV, unit of the
+ * voltage parameters
+ *
+ * @return Return 0 if ok, else -1
+ */
+int max77686_volsetting(enum max77686_regnum reg, unsigned int volt,
+ int enable, int volt_units);
+
+/**
+ * Disable charging of the RTC backup battery
+ *
+ * @return Return 0 if ok, else -1
+ */
+int max77686_disable_backup_batt(void);
+
+#endif /* __MAX77686_PMIC_H_ */
the following patch was just integrated into master:
commit 2110c97a63c3122a1ae84d109cecb91b1fc7cd24
Author: Stefan Reinauer <stefan.reinauer(a)coreboot.org>
Date: Sat Dec 8 00:50:44 2012 +0100
Allow PCI option rom execution only on systems with PCI support
... on all other systems it will fail terribly ;-)
Change-Id: I7f8d10b71b2dbc798b28aee7c36872685c793fd8
Signed-off-by: Stefan Reinauer <reinauer(a)google.com>
Reviewed-on: http://review.coreboot.org/2001
Tested-by: build bot (Jenkins)
Reviewed-by: David Hendricks <dhendrix(a)chromium.org>
Build-Tested: build bot (Jenkins) at Sat Dec 8 01:28:18 2012, giving +1
See http://review.coreboot.org/2001 for details.
-gerrit