From: Sanjeev Premi <premi@ti.com>
To: linux-omap@vger.kernel.org
Cc: Sanjeev Premi <premi@ti.com>
Subject: [RFC 3/3] am35xx: pm: Hook-up with TPS65023
Date: Wed, 23 Feb 2011 23:28:33 +0530 [thread overview]
Message-ID: <1298483913-20344-4-git-send-email-premi@ti.com> (raw)
In-Reply-To: <1298483913-20344-1-git-send-email-premi@ti.com>
Add glue logic to hook-up AM35x processors
with TPS65023.
Signed-off-by: Sanjeev Premi <premi@ti.com>
---
arch/arm/mach-omap2/am3517_tps.c | 96 ++++++++++++++++++++++++++++++++++++++
1 files changed, 96 insertions(+), 0 deletions(-)
create mode 100644 arch/arm/mach-omap2/am3517_tps.c
diff --git a/arch/arm/mach-omap2/am3517_tps.c b/arch/arm/mach-omap2/am3517_tps.c
new file mode 100644
index 0000000..cddd7eb
--- /dev/null
+++ b/arch/arm/mach-omap2/am3517_tps.c
@@ -0,0 +1,96 @@
+/**
+ * Copyright (C) 2011 Texas Instruments Incorporated - http://www.ti.com/
+ *
+ * Based on omap_twl.c
+ *
+ * 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.
+ *
+ * This program is distributed "as is" WITHOUT ANY WARRANTY of any
+ * kind, whether express or implied; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/err.h>
+#include <linux/io.h>
+#include <linux/kernel.h>
+#include <linux/i2c/twl.h>
+
+#include <plat/voltage.h>
+
+#include "pm.h"
+
+/*
+ * TODO: Copy of OMAP3 definitions to get thru compilation.
+ * May not be needed in final implementation. Need to
+ * relook at the the need again.
+ */
+#define OMAP3_SRI2C_SLAVE_ADDR 0x12
+#define OMAP3_VDD_MPU_SR_CONTROL_REG 0x00
+#define OMAP3_VDD_CORE_SR_CONTROL_REG 0x01
+#define OMAP3_VP_CONFIG_ERROROFFSET 0x00
+#define OMAP3_VP_VSTEPMIN_VSTEPMIN 0x1
+#define OMAP3_VP_VSTEPMAX_VSTEPMAX 0x04
+#define OMAP3_VP_VLIMITTO_TIMEOUT_US 200
+
+#define OMAP3430_VP2_VLIMITTO_VDDMIN 0x18
+#define OMAP3430_VP2_VLIMITTO_VDDMAX 0x2c
+
+/**
+ * TBD: Update the formula below.
+ * Needs to be derived from a table.
+ */
+static unsigned long tps65023_vsel_to_uv(const u8 vsel)
+{
+ return (((vsel * 250) + 6000)) * 100;
+}
+
+/**
+ * TBD: Update the formula below.
+ * Needs to be derived from a table.
+ */
+static u8 tps65023_uv_to_vsel(unsigned long uv)
+{
+ return DIV_ROUND_UP(uv - 600000, 25000);
+}
+
+/**
+ * TBD: Just a copy of OMAP3 PMIC info.
+ * Many fields below don't make much sense for AM3517,
+ * but keeping them as is for now.
+ */
+static struct omap_volt_pmic_info am3517_volt_info = {
+ .slew_rate = 4000,
+ .step_size = 25000,
+ .on_volt = 1200000,
+ .onlp_volt = 1000000,
+ .ret_volt = 975000,
+ .off_volt = 600000,
+ .volt_setup_time = 0xfff,
+ .vp_erroroffset = OMAP3_VP_CONFIG_ERROROFFSET,
+ .vp_vstepmin = OMAP3_VP_VSTEPMIN_VSTEPMIN,
+ .vp_vstepmax = OMAP3_VP_VSTEPMAX_VSTEPMAX,
+ .vp_vddmin = OMAP3430_VP2_VLIMITTO_VDDMIN,
+ .vp_vddmax = OMAP3430_VP2_VLIMITTO_VDDMAX,
+ .vp_timeout_us = OMAP3_VP_VLIMITTO_TIMEOUT_US,
+ .i2c_slave_addr = OMAP3_SRI2C_SLAVE_ADDR,
+ .pmic_reg = OMAP3_VDD_CORE_SR_CONTROL_REG,
+ .vsel_to_uv = tps65023_vsel_to_uv,
+ .uv_to_vsel = tps65023_uv_to_vsel,
+};
+
+int __init am3517_tps_init(void)
+{
+ struct voltagedomain *voltdm;
+
+ if (!cpu_is_omap3505() && !cpu_is_omap3517())
+ return -ENODEV;
+
+ voltdm = omap_voltage_domain_lookup("mpu");
+ omap_voltage_register_pmic(voltdm, &am3517_volt_info);
+
+ return 0;
+}
+
--
1.7.2.2
next prev parent reply other threads:[~2011-02-23 17:58 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-23 17:58 [RFC 0/3] Support TPS65023 with AM35xx Sanjeev Premi
2011-02-23 17:58 ` [RFC 1/3] omap: voltage: Allow custom vp_init() implementation Sanjeev Premi
2011-02-23 18:36 ` Menon, Nishanth
2011-02-23 20:45 ` Premi, Sanjeev
2011-02-24 1:11 ` Nishanth Menon
2011-02-23 17:58 ` [RFC 2/3] am35xx: voltage: Add basic initialization Sanjeev Premi
2011-02-23 18:40 ` Menon, Nishanth
2011-02-23 17:58 ` Sanjeev Premi [this message]
2011-02-23 18:43 ` [RFC 3/3] am35xx: pm: Hook-up with TPS65023 Menon, Nishanth
2011-02-24 13:20 ` Premi, Sanjeev
2011-02-24 10:04 ` Vishwanath Sripathy
2011-03-07 15:20 ` Premi, Sanjeev
2011-03-07 16:31 ` Vishwanath Sripathy
2011-03-08 12:26 ` Premi, Sanjeev
2011-03-08 12:45 ` Vishwanath Sripathy
2011-03-08 13:25 ` Premi, Sanjeev
2011-03-08 12:46 ` Nishanth Menon
2011-03-08 13:18 ` Premi, Sanjeev
2011-03-08 13:27 ` Menon, Nishanth
2011-03-08 13:37 ` Premi, Sanjeev
2011-03-08 16:08 ` Kevin Hilman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1298483913-20344-4-git-send-email-premi@ti.com \
--to=premi@ti.com \
--cc=linux-omap@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox