Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3015
-gerrit
commit eac336882b226b3491d4b5637e602164a82bd118
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Wed Apr 3 10:00:33 2013 +0200
inteltool: pcie.c: Use `0xffUL` instead of `0xff` to avoid shift overflow
When building inteltool with Clang, it warns about the following.
$ clang --version
Debian clang version 3.2-1~exp6 (tags/RELEASE_32/final) (based on LLVM 3.2)
Target: i386-pc-linux-gnu
Thread model: posix
$ CC=clang make
[…]
clang -O2 -g -Wall -W -c -o pcie.o pcie.c
pcie.c:297:40: warning: signed shift result (0xFF0000000) requires 37 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
pciexbar_phys = pciexbar_reg & (0xff << 28);
~~~~ ^ ~~
pcie.c:301:41: warning: signed shift result (0xFF8000000) requires 37 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
pciexbar_phys = pciexbar_reg & (0x1ff << 27);
~~~~~ ^ ~~
pcie.c:305:41: warning: signed shift result (0xFFC000000) requires 37 bits to represent, but 'int' only has 32 bits [-Wshift-overflow]
pciexbar_phys = pciexbar_reg & (0x3ff << 26);
~~~~~ ^ ~~
3 warnings generated.
[…]
Specifying the length by using a suffix `0xffUL`, fixes these issues
as now enough bits are available.
These issues were introduced in commit 1162f25a [1].
commit 1162f25a49e8f39822123d664cda10fef466b351
Author: Stefan Reinauer <stepan(a)coresystems.de>
Date: Thu Dec 4 15:18:20 2008 +0000
Patch to util/inteltool:
* PMBASE dumping now knows the registers.
* Add support for i965, i975, ICH8M
* Add support for Darwin OS using DirectIO
[1] http://review.coreboot.org/gitweb?p=coreboot.git;a=commit;h=1162f25a49e8f39…
Change-Id: I7b9a15b04ef3bcae64e06266667597d0f9f07b79
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
util/inteltool/pcie.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/util/inteltool/pcie.c b/util/inteltool/pcie.c
index 752d7b0..cf255b0 100644
--- a/util/inteltool/pcie.c
+++ b/util/inteltool/pcie.c
@@ -294,15 +294,15 @@ int print_pciexbar(struct pci_dev *nb)
switch ((pciexbar_reg >> 1) & 3) {
case 0: // 256MB
- pciexbar_phys = pciexbar_reg & (0xff << 28);
+ pciexbar_phys = pciexbar_reg & (0xffUL << 28);
max_busses = 256;
break;
case 1: // 128M
- pciexbar_phys = pciexbar_reg & (0x1ff << 27);
+ pciexbar_phys = pciexbar_reg & (0x1ffUL << 27);
max_busses = 128;
break;
case 2: // 64M
- pciexbar_phys = pciexbar_reg & (0x3ff << 26);
+ pciexbar_phys = pciexbar_reg & (0x3ffUL << 26);
max_busses = 64;
break;
default: // RSVD
Paul Menzel (paulepanter(a)users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3062
-gerrit
commit 864a1811caea4d68beb0d5a9876ed493fd2f8f81
Author: Paul Menzel <paulepanter(a)users.sourceforge.net>
Date: Wed Apr 10 11:33:37 2013 +0200
AMD RS780, SR5650: PcieTrainPort: Fix typo *i*gnoring in comment
Reading the paste of code in a message to the mailing list [1],
a typo was spotted and found in one more place.
$ git grep egnoring
src/southbridge/amd/rs780/cmn.c: * egnoring the reversal case
src/southbridge/amd/sr5650/sr5650.c: * egnoring the reversal case
These typos are there since when the code was committed and are
now corrected.
[1] http://www.coreboot.org/pipermail/coreboot/2013-April/075644.html
Change-Id: I55c65f71e4834f209b60d678f0d44bc2f4217099
Signed-off-by: Paul Menzel <paulepanter(a)users.sourceforge.net>
---
src/southbridge/amd/rs780/cmn.c | 2 +-
src/southbridge/amd/sr5650/sr5650.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/southbridge/amd/rs780/cmn.c b/src/southbridge/amd/rs780/cmn.c
index 3c6d22d..cf09b9a 100644
--- a/src/southbridge/amd/rs780/cmn.c
+++ b/src/southbridge/amd/rs780/cmn.c
@@ -301,7 +301,7 @@ u8 PcieTrainPort(device_t nb_dev, device_t dev, u32 port)
/* 4 means 7:4 and 15:12
* 3 means 7:2 and 15:10
* 2 means 7:1 and 15:9
- * egnoring the reversal case
+ * ignoring the reversal case
*/
lane_mask = (0xFF << (current_link_width - 2) * 2) & 0xFF;
reg = nbpcie_ind_read_index(nb_dev, 0x65 | gfx_gpp_sb_sel);
diff --git a/src/southbridge/amd/sr5650/sr5650.c b/src/southbridge/amd/sr5650/sr5650.c
index 0bb246e..7fdecf1 100644
--- a/src/southbridge/amd/sr5650/sr5650.c
+++ b/src/southbridge/amd/sr5650/sr5650.c
@@ -202,7 +202,7 @@ u8 PcieTrainPort(device_t nb_dev, device_t dev, u32 port)
/* 4 means 7:4 and 15:12
* 3 means 7:2 and 15:10
* 2 means 7:1 and 15:9
- * egnoring the reversal case
+ * ignoring the reversal case
*/
lane_mask = (0xFF << (current_link_width - 2) * 2) & 0xFF;
reg = nbpcie_ind_read_index(nb_dev, 0x65 | gpp_sb_sel);
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3061
-gerrit
commit cde888345ae4094af4825f6047857f058e03fd7a
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Apr 9 17:20:07 2013 -0700
[2/2] tps65090: re-factor for coreboot
This does basic re-factoring to fit the driver into coreboot.
Change-Id: Id5f8c12a73ec37ddd545d50b3e8e9b3012657db1
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/drivers/ti/tps65090/tps65090.c | 315 +++++++++++++------------------------
src/drivers/ti/tps65090/tps65090.h | 77 ++++++---
2 files changed, 166 insertions(+), 226 deletions(-)
diff --git a/src/drivers/ti/tps65090/tps65090.c b/src/drivers/ti/tps65090/tps65090.c
index 60b8ec8..653d20d 100644
--- a/src/drivers/ti/tps65090/tps65090.c
+++ b/src/drivers/ti/tps65090/tps65090.c
@@ -1,31 +1,48 @@
/*
- * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
+ * Copyright 2012, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
* Software Foundation.
*/
-#include <common.h>
-#include <fdtdec.h>
-#include <i2c.h>
-#include <tps65090.h>
-
-DECLARE_GLOBAL_DATA_PTR;
+#include <delay.h>
+#include <types.h>
+#include <console/console.h>
+#include <device/i2c.h>
+#include "tps65090.h"
/* TPS65090 register addresses */
enum {
REG_CG_CTRL0 = 4,
REG_CG_STATUS1 = 0xa,
- REG_FET1_CTRL = 0x0f,
- REG_FET2_CTRL,
- REG_FET3_CTRL,
- REG_FET4_CTRL,
- REG_FET5_CTRL,
- REG_FET6_CTRL,
- REG_FET7_CTRL,
};
enum {
@@ -42,125 +59,53 @@ enum {
FET_CTRL_ENFET = 1 << 0, /* Enable FET */
};
-static struct tps65090_config {
- int bus;
- int addr;
- int old_bus;
-} config;
-
-/**
- * Write a value to a register
- *
- * @param chip_addr i2c slave addr for max77686
- * @param reg_addr register address to write
- * @param value value to be written
- * @return 0 on success, non-0 on failure
- */
-static int tps65090_i2c_write(unsigned int reg_addr, unsigned char value)
+static int tps65090_i2c_write(unsigned int bus,
+ unsigned int reg_addr, unsigned char value)
{
int ret;
- ret = i2c_write(config.addr, reg_addr, 1, &value, 1);
- debug("%s: reg=%#x, value=%#x, ret=%d\n", __func__, reg_addr, value,
- ret);
+ ret = i2c_write(bus, TPS65090_I2C_ADDR, reg_addr, 1, &value, 1);
+ printk(BIOS_DEBUG, "%s: reg=%#x, value=%#x, ret=%d\n",
+ __func__, reg_addr, value, ret);
return ret;
}
-/**
- * Read a value from a register
- *
- * @param chip_addr i2c addr for max77686
- * @param reg_addr register address to read
- * @param value address to store the value to be read
- * @return 0 on success, non-0 on failure
- */
-static int tps65090_i2c_read(unsigned int reg_addr, unsigned char *value)
+static int tps65090_i2c_read(unsigned int bus,
+ unsigned int reg_addr, unsigned char *value)
{
int ret;
- debug("%s: reg=%#x, ", __func__, reg_addr);
- ret = i2c_read(config.addr, reg_addr, 1, value, 1);
+ printk(BIOS_DEBUG, "%s: reg=%#x, ", __func__, reg_addr);
+ ret = i2c_read(bus, TPS65090_I2C_ADDR, reg_addr, 1, value, 1);
if (ret)
- debug("fail, ret=%d\n", ret);
+ printk(BIOS_DEBUG, "fail, ret=%d\n", ret);
else
- debug("value=%#x, ret=%d\n", *value, ret);
+ printk(BIOS_DEBUG, "value=%#x, ret=%d\n", *value, ret);
return ret;
}
-static int tps65090_select(void)
-{
- int ret;
-
- config.old_bus = i2c_get_bus_num();
- if (config.old_bus != config.bus) {
- debug("%s: Select bus %d\n", __func__, config.bus);
- ret = i2c_set_bus_num(config.bus);
- if (ret) {
- debug("%s: Cannot select TPS65090, err %d\n",
- __func__, ret);
- return -1;
- }
- }
-
- return 0;
-}
-
-static int tps65090_deselect(void)
-{
- int ret;
-
- if (config.old_bus != i2c_get_bus_num()) {
- ret = i2c_set_bus_num(config.old_bus);
- debug("%s: Select bus %d\n", __func__, config.old_bus);
- if (ret) {
- debug("%s: Cannot restore i2c bus, err %d\n",
- __func__, ret);
- return -1;
- }
- }
- config.old_bus = -1;
- return 0;
-}
-
-/**
- * Checks for a valid FET number
- *
- * @param fet_id FET number to check
- * @return 0 if ok, -1 if FET value is out of range
- */
-static int tps65090_check_fet(unsigned int fet_id)
-{
- if (fet_id == 0 || fet_id > MAX_FET_NUM) {
- debug("parameter fet_id is out of range, %u not in 1 ~ %u\n",
- fet_id, MAX_FET_NUM);
- return -1;
- }
-
- return 0;
-}
-
/**
* Set the power state for a FET
*
- * @param fet_id Fet number to set (1..MAX_FET_NUM)
- * @param set 1 to power on FET, 0 to power off
+ * @fet_id Fet number to set (1..MAX_FET_NUM)
+ * @set 1 to power on FET, 0 to power off
* @return FET_ERR_COMMS if we got a comms error, FET_ERR_NOT_READY if the
* FET failed to change state. If all is ok, returns 0.
*/
-static int tps65090_fet_set(int fet_id, int set)
+static int tps65090_fet_set(unsigned int bus, enum fet_id fet_id, int set)
{
int retry, value;
- uchar reg;
+ uint8_t reg;
value = FET_CTRL_ADENFET | FET_CTRL_WAIT;
if (set)
value |= FET_CTRL_ENFET;
- if (tps65090_i2c_write(REG_FET1_CTRL + fet_id - 1, value))
+ if (tps65090_i2c_write(bus, fet_id, value))
return FET_ERR_COMMS;
/* Try reading until we get a result */
for (retry = 0; retry < MAX_CTRL_READ_TRIES; retry++) {
- if (tps65090_i2c_read(REG_FET1_CTRL + fet_id - 1, ®))
+ if (tps65090_i2c_read(bus, fet_id, ®))
return FET_ERR_COMMS;
/* Check that the fet went into the expected state */
@@ -171,27 +116,25 @@ static int tps65090_fet_set(int fet_id, int set)
if (reg & FET_CTRL_TOFET)
break;
- mdelay(1);
+ udelay(1000);
}
- debug("FET %d: Power good should have set to %d but reg=%#02x\n",
- fet_id, set, reg);
+ printk(BIOS_DEBUG, "FET %d: Power good should have set to %d but "
+ "reg=%#02x\n", fet_id, set, reg);
return FET_ERR_NOT_READY;
}
-int tps65090_fet_enable(unsigned int fet_id)
+/* FIXME(dhendrix): add timer API */
+#if 0
+int tps65090_fet_enable(unsigned int bus, enum fet_id fet_id)
{
int loops;
- ulong start;
+ unsigned long start;
int ret = 0;
- if (tps65090_check_fet(fet_id))
- return -1;
- if (tps65090_select())
- return -1;
start = get_timer(0);
for (loops = 0; ; loops++) {
- ret = tps65090_fet_set(fet_id, 1);
+ ret = tps65090_fet_set(bus, fet_id, 1);
if (!ret)
break;
@@ -199,16 +142,17 @@ int tps65090_fet_enable(unsigned int fet_id)
break;
/* Turn it off and try again until we time out */
- tps65090_fet_set(fet_id, 0);
+ tps65090_fet_set(bus, fet_id, 0);
}
- tps65090_deselect();
if (ret) {
- debug("%s: FET%d failed to power on: time=%lums, loops=%d\n",
- __func__, fet_id, get_timer(start), loops);
+ printk(BIOS_DEBUG, "%s: FET%d failed to power on: time=%lums, "
+ "loops=%d\n", __func__, fet_id,
+ get_timer(start), loops);
} else if (loops) {
- debug("%s: FET%d powered on after %lums, loops=%d\n",
- __func__, fet_id, get_timer(start), loops);
+ printk(BIOS_DEBUG, "%s: FET%d powered on after %lums, "
+ "loops=%d\n", __func__, fet_id,
+ get_timer(start), loops);
}
/*
* Unfortunately, there are some conditions where the power
@@ -221,137 +165,98 @@ int tps65090_fet_enable(unsigned int fet_id)
return ret;
}
-
-int tps65090_fet_disable(unsigned int fet_id)
+#endif
+int tps65090_fet_enable(unsigned int bus, enum fet_id fet_id)
{
- int ret;
+ int loops;
+ int ret = 0;
+
+ for (loops = 0; loops < 100; loops++) {
+ ret = tps65090_fet_set(bus, fet_id, 1);
+ if (!ret)
+ break;
+
+ /* Turn it off and try again until we time out */
+ tps65090_fet_set(bus, fet_id, 0);
+ udelay(1000);
+ }
- if (tps65090_check_fet(fet_id))
- return -1;
- if (tps65090_select())
- return -1;
- ret = tps65090_fet_set(fet_id, 0);
- tps65090_deselect();
+ if (ret) {
+ printk(BIOS_DEBUG, "%s: FET%d failed to power on\n",
+ __func__, fet_id);
+ } else if (loops) {
+ printk(BIOS_DEBUG, "%s: FET%d powered on\n",
+ __func__, fet_id);
+ }
+ /*
+ * Unfortunately, there are some conditions where the power
+ * good bit will be 0, but the fet still comes up. One such
+ * case occurs with the lcd backlight. We'll just return 0 here
+ * and assume that the fet will eventually come up.
+ */
+ if (ret == FET_ERR_NOT_READY)
+ ret = 0;
return ret;
}
-int tps65090_fet_is_enabled(unsigned int fet_id)
+int tps65090_fet_disable(unsigned int bus, enum fet_id fet_id)
+{
+ return tps65090_fet_set(bus, fet_id, 0);
+}
+
+int tps65090_fet_is_enabled(unsigned int bus, enum fet_id fet_id)
{
unsigned char reg;
int ret;
- if (tps65090_check_fet(fet_id))
- return -1;
- if (tps65090_select())
- return -1;
- ret = tps65090_i2c_read(REG_FET1_CTRL + fet_id - 1, ®);
- tps65090_deselect();
+ ret = tps65090_i2c_read(bus, fet_id, ®);
if (ret) {
- debug("fail to read FET%u_CTRL register over I2C", fet_id);
+ printk(BIOS_DEBUG, "fail to read FET%u_CTRL", fet_id);
return -2;
}
return reg & FET_CTRL_ENFET;
}
-int tps65090_get_charging(void)
+int tps65090_is_charging(unsigned int bus)
{
unsigned char val;
int ret;
- if (tps65090_select())
- return -1;
- ret = tps65090_i2c_read(REG_CG_CTRL0, &val);
- tps65090_deselect();
+ ret = tps65090_i2c_read(bus, REG_CG_CTRL0, &val);
if (ret)
return ret;
return val & CG_CTRL0_ENC_MASK ? 1 : 0;
}
-int tps65090_set_charge_enable(int enable)
+int tps65090_set_charge_enable(unsigned int bus, int enable)
{
unsigned char val;
int ret;
- if (tps65090_select())
- return -1;
- ret = tps65090_i2c_read(REG_CG_CTRL0, &val);
+ ret = tps65090_i2c_read(bus, REG_CG_CTRL0, &val);
if (!ret) {
if (enable)
val |= CG_CTRL0_ENC_MASK;
else
val &= ~CG_CTRL0_ENC_MASK;
- ret = tps65090_i2c_write(REG_CG_CTRL0, val);
+ ret = tps65090_i2c_write(bus, REG_CG_CTRL0, val);
}
- tps65090_deselect();
if (ret) {
- debug("%s: Failed to read/write register\n", __func__);
+ printk(BIOS_DEBUG, "%s: Failed to enable\n", __func__);
return ret;
}
return 0;
}
-int tps65090_get_status(void)
+int tps65090_get_status(unsigned int bus)
{
unsigned char val;
int ret;
- if (tps65090_select())
- return -1;
- ret = tps65090_i2c_read(REG_CG_STATUS1, &val);
- tps65090_deselect();
+ ret = tps65090_i2c_read(bus, REG_CG_STATUS1, &val);
if (ret)
return ret;
return val;
}
-
-static int tps65090_decode_config(struct tps65090_config *config)
-{
-#ifdef CONFIG_OF_CONTROL
- const void *blob = gd->fdt_blob;
- int node, parent;
- int i2c_bus;
-
- node = fdtdec_next_compatible(blob, 0, COMPAT_TI_TPS65090);
- if (node < 0) {
- debug("%s: Node not found\n", __func__);
- return -1;
- }
- parent = fdt_parent_offset(blob, node);
- if (parent < 0) {
- debug("%s: Cannot find node parent\n", __func__);
- return -1;
- }
- i2c_bus = i2c_get_bus_num_fdt(blob, parent);
- if (i2c_bus < 0)
- return -1;
- config->bus = i2c_bus;
- config->addr = fdtdec_get_addr(blob, node, "reg");
-#else
- config->bus = CONFIG_TPS65090_I2C_BUS;
- config->addr = TPS65090_I2C_ADDR;
-#endif
- return 0;
-}
-
-int tps65090_init(void)
-{
- int ret;
-
- if (tps65090_decode_config(&config))
- return -1;
-
- config.old_bus = -1;
-
- if (tps65090_select())
- return -1;
-
- /* Probe the chip */
- ret = i2c_probe(config.addr);
- if (ret)
- debug("%s: failed to probe TPS65090 over I2C, returned %d\n",
- __func__, ret);
-
- return ret;
-}
diff --git a/src/drivers/ti/tps65090/tps65090.h b/src/drivers/ti/tps65090/tps65090.h
index b008a55..b38db59 100644
--- a/src/drivers/ti/tps65090/tps65090.h
+++ b/src/drivers/ti/tps65090/tps65090.h
@@ -1,7 +1,32 @@
/*
- * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
+ * Copyright 2012, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, this software may be distributed under the terms of the
* GNU General Public License ("GPL") version 2 as published by the Free
@@ -14,6 +39,17 @@
/* I2C device address for TPS65090 PMU */
#define TPS65090_I2C_ADDR 0x48
+/* TPS65090 FET control registers */
+enum fet_id {
+ FET1_CTRL = 0x0f,
+ FET2_CTRL,
+ FET3_CTRL,
+ FET4_CTRL,
+ FET5_CTRL,
+ FET6_CTRL,
+ FET7_CTRL,
+};
+
enum {
/* Status register fields */
TPS65090_ST1_OTC = 1 << 0,
@@ -31,53 +67,52 @@ enum {
/**
* Enable FET
*
- * @param fet_id FET ID, value between 1 and 7
- * @return 0 on success, non-0 on failure
+ * @bus I2C bus number the TPS65090 is on
+ * @fet_id FET ID, value between 1 and 7
+ * return 0 on success, non-0 on failure
*/
-int tps65090_fet_enable(unsigned int fet_id);
+int tps65090_fet_enable(unsigned int bus, enum fet_id fet_id);
/**
* Disable FET
*
- * @param fet_id FET ID, value between 1 and 7
+ * @bus I2C bus number the TPS65090 is on
+ * @fet_id FET ID, value between 1 and 7
* @return 0 on success, non-0 on failure
*/
-int tps65090_fet_disable(unsigned int fet_id);
+int tps65090_fet_disable(unsigned int bus, enum fet_id fet_id);
/**
* Is FET enabled?
*
- * @param fet_id FET ID, value between 1 and 7
+ * @bus I2C bus number the TPS65090 is on
+ * @fet_id FET ID, value between 1 and 7
* @return 1 enabled, 0 disabled, negative value on failure
*/
-int tps65090_fet_is_enabled(unsigned int fet_id);
+int tps65090_fet_is_enabled(unsigned int bus, enum fet_id fet_id);
/**
* Enable / disable the battery charger
*
- * @param enable 0 to disable charging, non-zero to enable
+ * @bus I2C bus number the TPS65090 is on
+ * @enable 0 to disable charging, non-zero to enable
*/
-int tps65090_set_charge_enable(int enable);
+int tps65090_set_charge_enable(unsigned int bus, int enable);
/**
* Check whether we have enabled battery charging
*
+ * @bus I2C bus number the TPS65090 is on
* @return 1 if enabled, 0 if disabled
*/
-int tps65090_get_charging(void);
+int tps65090_is_charging(unsigned int bus);
/**
* Return the value of the status register
*
+ * @bus I2C bus number the TPS65090 is on
* @return status register value, or -1 on error
*/
-int tps65090_get_status(void);
-
-/**
- * Initialize the TPS65090 PMU.
- *
- * @return 0 on success, non-0 on failure
- */
-int tps65090_init(void);
+int tps65090_get_status(unsigned int bus);
#endif /* __TPS65090_H_ */
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3060
-gerrit
commit de318cc8a47ced7bf974604af07b8b96d2199ac8
Author: David Hendricks <dhendrix(a)chromium.org>
Date: Tue Apr 9 16:58:02 2013 -0700
[1/2] initial import of TI TPS65090
This imports TPS65090 PMIC from u-boot and adds/updates Makefiles
and Kconfig files. The follow-up patch will re-factor the code.
Change-Id: Ic9e43b9665ddf7f55feae8fa17fbf3d2d5f4756d
Signed-off-by: David Hendricks <dhendrix(a)chromium.org>
---
src/drivers/Kconfig | 1 +
src/drivers/Makefile.inc | 1 +
src/drivers/ti/Kconfig | 20 ++
src/drivers/ti/Makefile.inc | 20 ++
src/drivers/ti/tps65090/Kconfig | 24 +++
src/drivers/ti/tps65090/Makefile.inc | 20 ++
src/drivers/ti/tps65090/tps65090.c | 357 +++++++++++++++++++++++++++++++++++
src/drivers/ti/tps65090/tps65090.h | 83 ++++++++
8 files changed, 526 insertions(+)
diff --git a/src/drivers/Kconfig b/src/drivers/Kconfig
index 315d291..386508a 100644
--- a/src/drivers/Kconfig
+++ b/src/drivers/Kconfig
@@ -33,4 +33,5 @@ endif
source src/drivers/realtek/Kconfig
source src/drivers/sil/Kconfig
source src/drivers/spi/Kconfig
+source src/drivers/ti/Kconfig
source src/drivers/trident/Kconfig
diff --git a/src/drivers/Makefile.inc b/src/drivers/Makefile.inc
index 16d6001..f4fe146 100644
--- a/src/drivers/Makefile.inc
+++ b/src/drivers/Makefile.inc
@@ -29,6 +29,7 @@ subdirs-y += sil
subdirs-y += trident
subdirs-y += ics
subdirs-y += spi
+subdirs-y += ti
subdirs-y += ipmi
subdirs-y += elog
subdirs-$(CONFIG_ARCH_X86) += pc80
diff --git a/src/drivers/ti/Kconfig b/src/drivers/ti/Kconfig
new file mode 100644
index 0000000..b3aded8
--- /dev/null
+++ b/src/drivers/ti/Kconfig
@@ -0,0 +1,20 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2012 The Chromium OS 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
+##
+
+source src/drivers/ti/tps65090/Kconfig
diff --git a/src/drivers/ti/Makefile.inc b/src/drivers/ti/Makefile.inc
new file mode 100644
index 0000000..c0ed9c0
--- /dev/null
+++ b/src/drivers/ti/Makefile.inc
@@ -0,0 +1,20 @@
+##
+## This file is part of the coreboot project.
+##
+## Copyright (C) 2012 The Chromium OS 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
+##
+
+subdirs-$(CONFIG_DRIVER_TI_TPS65090) += tps65090/
diff --git a/src/drivers/ti/tps65090/Kconfig b/src/drivers/ti/tps65090/Kconfig
new file mode 100644
index 0000000..feae160
--- /dev/null
+++ b/src/drivers/ti/tps65090/Kconfig
@@ -0,0 +1,24 @@
+##
+## 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
+##
+
+config DRIVER_TI_TPS65090
+ bool
+ default n
+ help
+ TI TPS65090
diff --git a/src/drivers/ti/tps65090/Makefile.inc b/src/drivers/ti/tps65090/Makefile.inc
new file mode 100644
index 0000000..10b4dd9
--- /dev/null
+++ b/src/drivers/ti/tps65090/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
+##
+
+ramstage-$(CONFIG_DRIVER_TI_TPS65090) += tps65090.c
diff --git a/src/drivers/ti/tps65090/tps65090.c b/src/drivers/ti/tps65090/tps65090.c
new file mode 100644
index 0000000..60b8ec8
--- /dev/null
+++ b/src/drivers/ti/tps65090/tps65090.c
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ */
+
+#include <common.h>
+#include <fdtdec.h>
+#include <i2c.h>
+#include <tps65090.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+/* TPS65090 register addresses */
+enum {
+ REG_CG_CTRL0 = 4,
+ REG_CG_STATUS1 = 0xa,
+ REG_FET1_CTRL = 0x0f,
+ REG_FET2_CTRL,
+ REG_FET3_CTRL,
+ REG_FET4_CTRL,
+ REG_FET5_CTRL,
+ REG_FET6_CTRL,
+ REG_FET7_CTRL,
+};
+
+enum {
+ CG_CTRL0_ENC_MASK = 0x01,
+
+ MAX_FET_NUM = 7,
+ MAX_CTRL_READ_TRIES = 5,
+
+ /* TPS65090 FET_CTRL register values */
+ FET_CTRL_TOFET = 1 << 7, /* Timeout, startup, overload */
+ FET_CTRL_PGFET = 1 << 4, /* Power good for FET status */
+ FET_CTRL_WAIT = 3 << 2, /* Overcurrent timeout max */
+ FET_CTRL_ADENFET = 1 << 1, /* Enable output auto discharge */
+ FET_CTRL_ENFET = 1 << 0, /* Enable FET */
+};
+
+static struct tps65090_config {
+ int bus;
+ int addr;
+ int old_bus;
+} config;
+
+/**
+ * Write a value to a register
+ *
+ * @param chip_addr i2c slave addr for max77686
+ * @param reg_addr register address to write
+ * @param value value to be written
+ * @return 0 on success, non-0 on failure
+ */
+static int tps65090_i2c_write(unsigned int reg_addr, unsigned char value)
+{
+ int ret;
+
+ ret = i2c_write(config.addr, reg_addr, 1, &value, 1);
+ debug("%s: reg=%#x, value=%#x, ret=%d\n", __func__, reg_addr, value,
+ ret);
+ return ret;
+}
+
+/**
+ * Read a value from a register
+ *
+ * @param chip_addr i2c addr for max77686
+ * @param reg_addr register address to read
+ * @param value address to store the value to be read
+ * @return 0 on success, non-0 on failure
+ */
+static int tps65090_i2c_read(unsigned int reg_addr, unsigned char *value)
+{
+ int ret;
+
+ debug("%s: reg=%#x, ", __func__, reg_addr);
+ ret = i2c_read(config.addr, reg_addr, 1, value, 1);
+ if (ret)
+ debug("fail, ret=%d\n", ret);
+ else
+ debug("value=%#x, ret=%d\n", *value, ret);
+ return ret;
+}
+
+static int tps65090_select(void)
+{
+ int ret;
+
+ config.old_bus = i2c_get_bus_num();
+ if (config.old_bus != config.bus) {
+ debug("%s: Select bus %d\n", __func__, config.bus);
+ ret = i2c_set_bus_num(config.bus);
+ if (ret) {
+ debug("%s: Cannot select TPS65090, err %d\n",
+ __func__, ret);
+ return -1;
+ }
+ }
+
+ return 0;
+}
+
+static int tps65090_deselect(void)
+{
+ int ret;
+
+ if (config.old_bus != i2c_get_bus_num()) {
+ ret = i2c_set_bus_num(config.old_bus);
+ debug("%s: Select bus %d\n", __func__, config.old_bus);
+ if (ret) {
+ debug("%s: Cannot restore i2c bus, err %d\n",
+ __func__, ret);
+ return -1;
+ }
+ }
+ config.old_bus = -1;
+ return 0;
+}
+
+/**
+ * Checks for a valid FET number
+ *
+ * @param fet_id FET number to check
+ * @return 0 if ok, -1 if FET value is out of range
+ */
+static int tps65090_check_fet(unsigned int fet_id)
+{
+ if (fet_id == 0 || fet_id > MAX_FET_NUM) {
+ debug("parameter fet_id is out of range, %u not in 1 ~ %u\n",
+ fet_id, MAX_FET_NUM);
+ return -1;
+ }
+
+ return 0;
+}
+
+/**
+ * Set the power state for a FET
+ *
+ * @param fet_id Fet number to set (1..MAX_FET_NUM)
+ * @param set 1 to power on FET, 0 to power off
+ * @return FET_ERR_COMMS if we got a comms error, FET_ERR_NOT_READY if the
+ * FET failed to change state. If all is ok, returns 0.
+ */
+static int tps65090_fet_set(int fet_id, int set)
+{
+ int retry, value;
+ uchar reg;
+
+ value = FET_CTRL_ADENFET | FET_CTRL_WAIT;
+ if (set)
+ value |= FET_CTRL_ENFET;
+
+ if (tps65090_i2c_write(REG_FET1_CTRL + fet_id - 1, value))
+ return FET_ERR_COMMS;
+ /* Try reading until we get a result */
+ for (retry = 0; retry < MAX_CTRL_READ_TRIES; retry++) {
+ if (tps65090_i2c_read(REG_FET1_CTRL + fet_id - 1, ®))
+ return FET_ERR_COMMS;
+
+ /* Check that the fet went into the expected state */
+ if (!!(reg & FET_CTRL_PGFET) == set)
+ return 0;
+
+ /* If we got a timeout, there is no point in waiting longer */
+ if (reg & FET_CTRL_TOFET)
+ break;
+
+ mdelay(1);
+ }
+
+ debug("FET %d: Power good should have set to %d but reg=%#02x\n",
+ fet_id, set, reg);
+ return FET_ERR_NOT_READY;
+}
+
+int tps65090_fet_enable(unsigned int fet_id)
+{
+ int loops;
+ ulong start;
+ int ret = 0;
+
+ if (tps65090_check_fet(fet_id))
+ return -1;
+ if (tps65090_select())
+ return -1;
+ start = get_timer(0);
+ for (loops = 0; ; loops++) {
+ ret = tps65090_fet_set(fet_id, 1);
+ if (!ret)
+ break;
+
+ if (get_timer(start) > 100)
+ break;
+
+ /* Turn it off and try again until we time out */
+ tps65090_fet_set(fet_id, 0);
+ }
+ tps65090_deselect();
+
+ if (ret) {
+ debug("%s: FET%d failed to power on: time=%lums, loops=%d\n",
+ __func__, fet_id, get_timer(start), loops);
+ } else if (loops) {
+ debug("%s: FET%d powered on after %lums, loops=%d\n",
+ __func__, fet_id, get_timer(start), loops);
+ }
+ /*
+ * Unfortunately, there are some conditions where the power
+ * good bit will be 0, but the fet still comes up. One such
+ * case occurs with the lcd backlight. We'll just return 0 here
+ * and assume that the fet will eventually come up.
+ */
+ if (ret == FET_ERR_NOT_READY)
+ ret = 0;
+
+ return ret;
+}
+
+int tps65090_fet_disable(unsigned int fet_id)
+{
+ int ret;
+
+ if (tps65090_check_fet(fet_id))
+ return -1;
+ if (tps65090_select())
+ return -1;
+ ret = tps65090_fet_set(fet_id, 0);
+ tps65090_deselect();
+
+ return ret;
+}
+
+int tps65090_fet_is_enabled(unsigned int fet_id)
+{
+ unsigned char reg;
+ int ret;
+
+ if (tps65090_check_fet(fet_id))
+ return -1;
+ if (tps65090_select())
+ return -1;
+ ret = tps65090_i2c_read(REG_FET1_CTRL + fet_id - 1, ®);
+ tps65090_deselect();
+ if (ret) {
+ debug("fail to read FET%u_CTRL register over I2C", fet_id);
+ return -2;
+ }
+
+ return reg & FET_CTRL_ENFET;
+}
+
+int tps65090_get_charging(void)
+{
+ unsigned char val;
+ int ret;
+
+ if (tps65090_select())
+ return -1;
+ ret = tps65090_i2c_read(REG_CG_CTRL0, &val);
+ tps65090_deselect();
+ if (ret)
+ return ret;
+ return val & CG_CTRL0_ENC_MASK ? 1 : 0;
+}
+
+int tps65090_set_charge_enable(int enable)
+{
+ unsigned char val;
+ int ret;
+
+ if (tps65090_select())
+ return -1;
+ ret = tps65090_i2c_read(REG_CG_CTRL0, &val);
+ if (!ret) {
+ if (enable)
+ val |= CG_CTRL0_ENC_MASK;
+ else
+ val &= ~CG_CTRL0_ENC_MASK;
+ ret = tps65090_i2c_write(REG_CG_CTRL0, val);
+ }
+ tps65090_deselect();
+ if (ret) {
+ debug("%s: Failed to read/write register\n", __func__);
+ return ret;
+ }
+ return 0;
+}
+
+int tps65090_get_status(void)
+{
+ unsigned char val;
+ int ret;
+
+ if (tps65090_select())
+ return -1;
+ ret = tps65090_i2c_read(REG_CG_STATUS1, &val);
+ tps65090_deselect();
+ if (ret)
+ return ret;
+ return val;
+}
+
+static int tps65090_decode_config(struct tps65090_config *config)
+{
+#ifdef CONFIG_OF_CONTROL
+ const void *blob = gd->fdt_blob;
+ int node, parent;
+ int i2c_bus;
+
+ node = fdtdec_next_compatible(blob, 0, COMPAT_TI_TPS65090);
+ if (node < 0) {
+ debug("%s: Node not found\n", __func__);
+ return -1;
+ }
+ parent = fdt_parent_offset(blob, node);
+ if (parent < 0) {
+ debug("%s: Cannot find node parent\n", __func__);
+ return -1;
+ }
+ i2c_bus = i2c_get_bus_num_fdt(blob, parent);
+ if (i2c_bus < 0)
+ return -1;
+ config->bus = i2c_bus;
+ config->addr = fdtdec_get_addr(blob, node, "reg");
+#else
+ config->bus = CONFIG_TPS65090_I2C_BUS;
+ config->addr = TPS65090_I2C_ADDR;
+#endif
+ return 0;
+}
+
+int tps65090_init(void)
+{
+ int ret;
+
+ if (tps65090_decode_config(&config))
+ return -1;
+
+ config.old_bus = -1;
+
+ if (tps65090_select())
+ return -1;
+
+ /* Probe the chip */
+ ret = i2c_probe(config.addr);
+ if (ret)
+ debug("%s: failed to probe TPS65090 over I2C, returned %d\n",
+ __func__, ret);
+
+ return ret;
+}
diff --git a/src/drivers/ti/tps65090/tps65090.h b/src/drivers/ti/tps65090/tps65090.h
new file mode 100644
index 0000000..b008a55
--- /dev/null
+++ b/src/drivers/ti/tps65090/tps65090.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ *
+ * Alternatively, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") version 2 as published by the Free
+ * Software Foundation.
+ */
+
+#ifndef __TPS65090_H_
+#define __TPS65090_H_
+
+/* I2C device address for TPS65090 PMU */
+#define TPS65090_I2C_ADDR 0x48
+
+enum {
+ /* Status register fields */
+ TPS65090_ST1_OTC = 1 << 0,
+ TPS65090_ST1_OCC = 1 << 1,
+ TPS65090_ST1_STATE_SHIFT = 4,
+ TPS65090_ST1_STATE_MASK = 0xf << TPS65090_ST1_STATE_SHIFT,
+};
+
+/* FET errors */
+enum {
+ FET_ERR_COMMS = -1, /* FET comms error */
+ FET_ERR_NOT_READY = -2, /* FET is not yet ready - retry */
+};
+
+/**
+ * Enable FET
+ *
+ * @param fet_id FET ID, value between 1 and 7
+ * @return 0 on success, non-0 on failure
+ */
+int tps65090_fet_enable(unsigned int fet_id);
+
+/**
+ * Disable FET
+ *
+ * @param fet_id FET ID, value between 1 and 7
+ * @return 0 on success, non-0 on failure
+ */
+int tps65090_fet_disable(unsigned int fet_id);
+
+/**
+ * Is FET enabled?
+ *
+ * @param fet_id FET ID, value between 1 and 7
+ * @return 1 enabled, 0 disabled, negative value on failure
+ */
+int tps65090_fet_is_enabled(unsigned int fet_id);
+
+/**
+ * Enable / disable the battery charger
+ *
+ * @param enable 0 to disable charging, non-zero to enable
+ */
+int tps65090_set_charge_enable(int enable);
+
+/**
+ * Check whether we have enabled battery charging
+ *
+ * @return 1 if enabled, 0 if disabled
+ */
+int tps65090_get_charging(void);
+
+/**
+ * Return the value of the status register
+ *
+ * @return status register value, or -1 on error
+ */
+int tps65090_get_status(void);
+
+/**
+ * Initialize the TPS65090 PMU.
+ *
+ * @return 0 on success, non-0 on failure
+ */
+int tps65090_init(void);
+
+#endif /* __TPS65090_H_ */
David Hendricks (dhendrix(a)chromium.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/3053
-gerrit
commit dc907c95e606c3edcc88ce83fb038d778f19ea37
Author: Ronald G. Minnich <rminnich(a)gmail.com>
Date: Tue Apr 9 14:32:32 2013 -0700
GOOGLE/SNOW: clean up the device tree
This is a simpler device tree that is also more correct,
and has graphics settings as well.
Change-Id: I342d8be7dddb76e6992876c73f5c625c926977d3
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
---
src/mainboard/google/snow/devicetree.cb | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)
diff --git a/src/mainboard/google/snow/devicetree.cb b/src/mainboard/google/snow/devicetree.cb
index 4c88ea8..41ed45e 100644
--- a/src/mainboard/google/snow/devicetree.cb
+++ b/src/mainboard/google/snow/devicetree.cb
@@ -17,16 +17,17 @@
## Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
##
-# FIXME: this is just a stub for now
chip cpu/samsung/exynos5250
-
-device cpu_cluster 0 on
-end
-
-device domain 0 on
- chip drivers/generic/generic # I2C0 controller
- device i2c 6 on end # ?
- device i2c 9 on end # ?
- end
-end
+ device cpu_cluster 0 on end
+ register "xres" = "1366"
+ register "yres" = "768"
+ register "bpp" = "16"
+ # complex magic timing!
+ register "clkval_f" = "2"
+ register "upper_margin" = "14"
+ register "lower_margin" = "3"
+ register "vsync" = "5"
+ register "left_margin" = "80"
+ register "right_margin" = "48"
+ register "hsync" = "32"
end