Skip to contentSkip to conversation

twl-core: add support for twl6030

PATCH Sascha Hauer 1 participant 2 messages Dec 17, 2011 3 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 66 lines · Alexander Aring

Add support for twl6030 in twl-core driver.

---
 drivers/mfd/Kconfig   |    4 +
 drivers/mfd/Makefile  |    1 +
 drivers/mfd/twl6030.c |   77 +++++++++
 include/mfd/twl6030.h |  408 +++++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 490 insertions(+), 0 deletions(-)
 create mode 100644 drivers/mfd/twl6030.c
 create mode 100644 include/mfd/twl6030.h
drivers/mfd/Kconfig +4 -0
index 72f87c2..2d42a22 100644
@@ -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"
drivers/mfd/Makefile +1 -0
index b05b2cd..1171335 100644
@@ -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
drivers/mfd/twl6030.c new file +23 -0
new file mode 100644
index 0000000..4035106
@@ -0,0 +1,77 @@
+/*
+ * Made by Alexander Aring <[email protected]>
+ *
+ * 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)
+{

drivers/mfd/twl6030.c line 33

Quoted 10 lines
drivers/mfd/twl6030.c new file +10 -0
+	return twl_dev;
+}
+EXPORT_SYMBOL(twl6030_get);
+
+inline int twl6030_reg_read(struct twl6030 *twl6030,
+		enum twl6030_reg reg, u8 *val)
+{
+	return twlcore_reg_read(&(twl6030->core), reg, val);
+}
+EXPORT_SYMBOL(twl6030_reg_read);

Please move these as static inline functions to the header file (also for the twl4030). As a side note, 'inline' in global functions is a no-op, you can skip this. Also, unnecessary braces in &(twl6030->core).

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw

Re: [PATCH 3/4] omap_hsmmc: setup mmc voltage on twl6030

Review

Quoted 10 lines · Alexander Aring

Support the setup of the mmc voltage, when booting OMAP4 with twl6030 from nand.

(quoted diff) +6 -0
+config MCI_OMAP_TWL6030_FIX
+	bool "OMAP HSMMC TWL6030 FIX"
+	depends on I2C_TWLCORE && MCI_OMAP_HSMMC && ARCH_OMAP4
+	help
+	  Enable TWL6030 support for mci device. OMAP4 Bootloader doesn't setup
+	  mmc voltage. So to setup mmc voltage you need to enable this.

We do not need a config switch for this.

Please instead of putting this into driver code just put all code in this patch into some function in arch/arm/mach-omap/omap4_twl6030_mmc.c which you then call from your board code. This may not be the cleanest way to do it but moving it into the mmc driver is not a good solution either.

Sascha

Signature · 9 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox