From f488165a3de4da61626b27d8a1c250a0d303eee0 Mon Sep 17 00:00:00 2001 From: Sven Schnelle Date: Sun, 23 Oct 2011 15:53:47 +0200 Subject: Add driver for ICS954309 clock generator Change-Id: Iac7e91cdd995dad1954eaa2d4dd52bffa293fc95 Signed-off-by: Sven Schnelle Reviewed-on: http://review.coreboot.org/327 Tested-by: build bot (Jenkins) --- src/drivers/ics/954309/ics954309.c | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 src/drivers/ics/954309/ics954309.c (limited to 'src/drivers/ics/954309/ics954309.c') diff --git a/src/drivers/ics/954309/ics954309.c b/src/drivers/ics/954309/ics954309.c new file mode 100644 index 0000000000..ef62879e46 --- /dev/null +++ b/src/drivers/ics/954309/ics954309.c @@ -0,0 +1,77 @@ +/* + * This file is part of the coreboot project. + * + * Copyright (C) 2011 Sven Schnelle + * + * 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 + */ + +#include +#include +#include +#include +#include +#include +#include +#include "chip.h" +#include + +static void ics954309_init(device_t dev) +{ + struct drivers_ics_954309_config *config; + u8 initdata[12]; + + if (!dev->enabled || dev->path.type != DEVICE_PATH_I2C) + return; + + config = dev->chip_info; + + initdata[0] = config->reg0; + initdata[1] = config->reg1; + initdata[2] = config->reg2; + initdata[3] = config->reg3; + initdata[4] = config->reg4; + initdata[5] = config->reg5; + initdata[6] = config->reg6; + initdata[7] = config->reg7; + initdata[8] = config->reg8; + initdata[9] = config->reg9; + initdata[10] = config->reg10; + initdata[11] = config->reg11; + + smbus_block_write(dev, 0, 12, initdata); +} + +static void ics954309_noop(device_t dummy) +{ +} + +static struct device_operations ics954309_operations = { + .read_resources = ics954309_noop, + .set_resources = ics954309_noop, + .enable_resources = ics954309_noop, + .init = ics954309_init, +}; + +static void enable_dev(struct device *dev) +{ + dev->ops = &ics954309_operations; +} + +struct chip_operations drivers_ics_954309_ops = { + CHIP_NAME("ICS 954309 Clock generator") + .enable_dev = enable_dev, +}; -- cgit v1.2.3