Add driver for ICS954309 clock generator
authorSven Schnelle <svens@stackframe.org>
Sun, 23 Oct 2011 13:53:47 +0000 (15:53 +0200)
committerSven Schnelle <svens@stackframe.org>
Tue, 25 Oct 2011 17:22:22 +0000 (19:22 +0200)
Change-Id: Iac7e91cdd995dad1954eaa2d4dd52bffa293fc95
Signed-off-by: Sven Schnelle <svens@stackframe.org>
Reviewed-on: http://review.coreboot.org/327
Tested-by: build bot (Jenkins)
src/drivers/Kconfig
src/drivers/Makefile.inc
src/drivers/ics/954309/Kconfig [new file with mode: 0644]
src/drivers/ics/954309/Makefile.inc [new file with mode: 0644]
src/drivers/ics/954309/chip.h [new file with mode: 0644]
src/drivers/ics/954309/ics954309.c [new file with mode: 0644]
src/drivers/ics/Kconfig [new file with mode: 0644]
src/drivers/ics/Makefile.inc [new file with mode: 0644]

index 98f2079eea05986d7aef6d8d2a2e9a987e7bc374..259bc290a6d9d933437e14a91336cb4e7d249e13 100644 (file)
@@ -25,4 +25,4 @@ source src/drivers/i2c/Kconfig
 source src/drivers/oxford/Kconfig
 source src/drivers/sil/Kconfig
 source src/drivers/trident/Kconfig
-
+source src/drivers/ics/Kconfig
index ae7a0989df47b99be84a5c6ab21a943e89c5d615..21a698a3978bf1ea489a30bafd2e365f1370c767 100644 (file)
@@ -25,4 +25,4 @@ subdirs-y += i2c
 subdirs-y += oxford
 subdirs-y += sil
 subdirs-y += trident
-
+subdirs-y += ics
diff --git a/src/drivers/ics/954309/Kconfig b/src/drivers/ics/954309/Kconfig
new file mode 100644 (file)
index 0000000..43840a3
--- /dev/null
@@ -0,0 +1,2 @@
+config DRIVERS_ICS_954309
+       bool
diff --git a/src/drivers/ics/954309/Makefile.inc b/src/drivers/ics/954309/Makefile.inc
new file mode 100644 (file)
index 0000000..ede9639
--- /dev/null
@@ -0,0 +1 @@
+driver-$(CONFIG_DRIVERS_ICS_954309) += ics954309.c
diff --git a/src/drivers/ics/954309/chip.h b/src/drivers/ics/954309/chip.h
new file mode 100644 (file)
index 0000000..8dfc3e0
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
+ *
+ * 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
+ */
+
+extern struct chip_operations drivers_ics_954309_ops;
+
+struct drivers_ics_954309_config {
+       u8 reg0;
+       u8 reg1;
+       u8 reg2;
+       u8 reg3;
+       u8 reg4;
+       u8 reg5;
+       u8 reg6;
+       u8 reg7;
+       u8 reg8;
+       u8 reg9;
+       u8 reg10;
+       u8 reg11;
+};
diff --git a/src/drivers/ics/954309/ics954309.c b/src/drivers/ics/954309/ics954309.c
new file mode 100644 (file)
index 0000000..ef62879
--- /dev/null
@@ -0,0 +1,77 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (C) 2011 Sven Schnelle <svens@stackframe.org>
+ *
+ * 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 <console/console.h>
+#include <device/device.h>
+#include <device/smbus.h>
+#include <device/pci.h>
+#include <device/pci_ids.h>
+#include <device/pci_ops.h>
+#include <cpu/x86/msr.h>
+#include "chip.h"
+#include <string.h>
+
+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,
+};
diff --git a/src/drivers/ics/Kconfig b/src/drivers/ics/Kconfig
new file mode 100644 (file)
index 0000000..0a0ba66
--- /dev/null
@@ -0,0 +1 @@
+source src/drivers/ics/954309/Kconfig
diff --git a/src/drivers/ics/Makefile.inc b/src/drivers/ics/Makefile.inc
new file mode 100644 (file)
index 0000000..39cc90b
--- /dev/null
@@ -0,0 +1 @@
+subdirs-$(CONFIG_DRIVERS_ICS_954309) += 954309