--- /dev/null
+/*
+ * (C) Copyright 2009
+ * Samsung Electronics, <www.samsung.com/sec>
+ * MyungJoo Ham <myungjoo.ham@samsung.com>
+ *
+ * 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; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ */
+
+#ifndef __ASM_ARM_ARCH_ADC_H_
+#define __ASM_ARM_ARCH_ADC_H_
+
+#ifndef __ASSEMBLY__
+struct s5pc210_adc {
+ unsigned int adccon; /* starts at 0x13910000 */
+ unsigned int adctsc;
+ unsigned int adcdly;
+ unsigned int adcdat0;
+ unsigned int adcdat1; /* 0x13910010 */
+ unsigned int adcupdn;
+ unsigned int adcclrint;
+ unsigned int adcmux;
+ unsigned int adcclrintpndnup;
+};
+#endif
+
+#endif /* __ASM_ARM_ARCH_ADC_H_ */
#define S5PC210_SROMC_BASE 0x12570000
#define S5PC210_USBPHY_BASE 0x125B0000
#define S5PC210_UART_BASE 0x13800000
+#define S5PC210_ADC_BASE 0x13910000
#define S5PC210_PWMTIMER_BASE 0x139D0000
#ifndef __ASSEMBLY__
#include <common.h>
#include <i2c.h>
#include <asm/arch/gpio.h>
+#include <asm/arch/adc.h>
DECLARE_GLOBAL_DATA_PTR;
/* RAMP: As Fast As Possible: Default: Do Nothing */
}
+static unsigned short get_adc_value(int channel)
+{
+ struct s5pc210_adc *adc = (struct s5pc210_adc *) S5PC210_ADC_BASE;
+ unsigned short ret = 0;
+ unsigned int reg;
+ int ldonum = 4;
+ char buf[64];
+ unsigned int loop = 0;
+
+ sprintf(buf, "pmic ldo %d on", ldonum);
+ run_command(buf, 0);
+
+ writel(channel & 0xF, &adc->adcmux);
+ writel((1 << 14) | (49 << 6), &adc->adccon);
+ writel(1000 & 0xffff, &adc->adcdly);
+ writel(readl(&adc->adccon) | (1 << 16), &adc->adccon); /* 12 bit */
+ udelay(10);
+ writel(readl(&adc->adccon) | (1 << 0), &adc->adccon); /* Enable */
+ udelay(10);
+
+ do {
+ udelay(1);
+ reg = readl(&adc->adccon);
+ } while (!(reg & (1 << 15)) && (loop++ < 1000));
+
+ ret = readl(&adc->adcdat0) & 0xFFF;
+ sprintf(buf, "pmic ldo %d off", ldonum);
+ run_command(buf, 0);
+
+ return ret;
+}
+
#ifdef CONFIG_MISC_INIT_R
int misc_init_r(void)
{
"pmic safeout num on/off - Turn on/off the SAFEOUT\n"
);
#endif
+