summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
diff options
context:
space:
mode:
authorAlexander Aring <a.aring@phytec.de>2011-12-21 08:50:29 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-12-21 12:46:01 +0100
commit8658e6a9528c7e65bf7a3732d815f662c9c8ed11 (patch)
tree074fa865f1834a3fac62f18773d9b71610a4e268 /drivers/mfd
parent5c115f335ec06fa1fd8a28740790a622e500a304 (diff)
downloadbarebox-8658e6a9528c7e65bf7a3732d815f662c9c8ed11.tar.gz
barebox-8658e6a9528c7e65bf7a3732d815f662c9c8ed11.tar.xz
twl-core: add support for twl6030
Add support for twl6030 in twl-core driver. Signed-off-by: Alexander Aring <a.aring@phytec.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/mfd')
-rw-r--r--drivers/mfd/Kconfig4
-rw-r--r--drivers/mfd/Makefile1
-rw-r--r--drivers/mfd/twl6030.c56
3 files changed, 61 insertions, 0 deletions
diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig
index 72f87c23c3..2d42a22a0d 100644
--- a/drivers/mfd/Kconfig
+++ b/drivers/mfd/Kconfig
@@ -25,6 +25,10 @@ config I2C_TWL4030
depends on I2C_TWLCORE
bool "TWL4030 driver"
+config I2C_TWL6030
+ depends on I2C_TWLCORE
+ bool "TWL6030 driver"
+
config DRIVER_SPI_MC13783
depends on SPI
bool "MC13783 a.k.a. PMIC driver"
diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile
index b05b2cd826..1171335b28 100644
--- a/drivers/mfd/Makefile
+++ b/drivers/mfd/Makefile
@@ -4,4 +4,5 @@ obj-$(CONFIG_I2C_MC9SDZ60) += mc9sdz60.o
obj-$(CONFIG_I2C_LP3972) += lp3972.o
obj-$(CONFIG_I2C_TWLCORE) += twl-core.o
obj-$(CONFIG_I2C_TWL4030) += twl4030.o
+obj-$(CONFIG_I2C_TWL6030) += twl6030.o
obj-$(CONFIG_DRIVER_SPI_MC13783) += mc13783.o
diff --git a/drivers/mfd/twl6030.c b/drivers/mfd/twl6030.c
new file mode 100644
index 0000000000..7ecfed8062
--- /dev/null
+++ b/drivers/mfd/twl6030.c
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2011 Alexander Aring <a.aring@phytec.de>
+ *
+ * This file is released under the GPLv2
+ */
+
+#include <common.h>
+#include <init.h>
+#include <driver.h>
+#include <xfuncs.h>
+#include <errno.h>
+
+#include <i2c/i2c.h>
+#include <mfd/twl6030.h>
+
+#define DRIVERNAME "twl6030"
+
+#define to_twl6030(a) container_of(a, struct twl6030, cdev)
+
+static struct twl6030 *twl_dev;
+
+struct twl6030 *twl6030_get(void)
+{
+ return twl_dev;
+}
+EXPORT_SYMBOL(twl6030_get);
+
+static int twl_probe(struct device_d *dev)
+{
+ if (twl_dev)
+ return -EBUSY;
+
+ twl_dev = xzalloc(sizeof(struct twl6030));
+ twl_dev->core.cdev.name = DRIVERNAME;
+ twl_dev->core.client = to_i2c_client(dev);
+ twl_dev->core.cdev.size = 1024;
+ twl_dev->core.cdev.dev = dev;
+ twl_dev->core.cdev.ops = &twl_fops;
+
+ devfs_create(&(twl_dev->core.cdev));
+
+ return 0;
+}
+
+static struct driver_d twl_driver = {
+ .name = DRIVERNAME,
+ .probe = twl_probe,
+};
+
+static int twl_init(void)
+{
+ register_driver(&twl_driver);
+ return 0;
+}
+
+device_initcall(twl_init);