2 * Copyright (C) 2012 Linaro Limited
3 * Mathieu Poirier <mathieu.poirier@linaro.org>
5 * Based on original code from Joakim Axelsson at ST-Ericsson
6 * (C) Copyright 2010 ST-Ericsson
8 * See file CREDITS for list of people who contributed to this
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
29 #include <asm/arch/prcmu.h>
30 #include <asm/arch/clock.h>
31 #include <asm/arch/hardware.h>
33 #include <asm/arch/hardware.h>
35 #define CPUID_DB8500V1 0x411fc091
36 #define ASICID_DB8500V11 0x008500A1
38 static unsigned int read_asicid(void)
40 unsigned int *address = (void *)U8500_BOOTROM_BASE
41 + U8500_BOOTROM_ASIC_ID_OFFSET;
42 return readl(address);
45 static int cpu_is_u8500v11(void)
47 return read_asicid() == ASICID_DB8500V11;
50 #ifdef CONFIG_ARCH_CPU_INIT
52 * SOC specific cpu init
54 int arch_cpu_init(void)
61 #endif /* CONFIG_ARCH_CPU_INIT */
65 #define LDO_VAUX3_MASK 0x3
66 #define LDO_VAUX3_ENABLE 0x1
67 #define VAUX3_VOLTAGE_2_9V 0xd
69 #define AB8500_REGU_CTRL2 0x4
70 #define AB8500_REGU_VRF1VAUX3_REGU_REG 0x040A
71 #define AB8500_REGU_VRF1VAUX3_SEL_REG 0x0421
73 int u8500_mmc_power_init(void)
78 if (!cpu_is_u8500v11())
82 * On v1.1 HREF boards (HREF+), Vaux3 needs to be enabled for the SD
83 * card to work. This is done by enabling the regulators in the AB8500
84 * via PRCMU I2C transactions.
86 * This code is derived from the handling of AB8500_LDO_VAUX3 in
87 * ab8500_ldo_enable() and ab8500_ldo_disable() in Linux.
89 * Turn off and delay is required to have it work across soft reboots.
92 ret = prcmu_i2c_read(AB8500_REGU_CTRL2, AB8500_REGU_VRF1VAUX3_REGU_REG);
99 ret = prcmu_i2c_write(AB8500_REGU_CTRL2, AB8500_REGU_VRF1VAUX3_REGU_REG,
100 val & ~LDO_VAUX3_MASK);
106 /* Set the voltage to 2.9V */
107 ret = prcmu_i2c_write(AB8500_REGU_CTRL2,
108 AB8500_REGU_VRF1VAUX3_SEL_REG,
113 val = val & ~LDO_VAUX3_MASK;
114 val = val | LDO_VAUX3_ENABLE;
116 /* Turn on the supply */
117 ret = prcmu_i2c_write(AB8500_REGU_CTRL2,
118 AB8500_REGU_VRF1VAUX3_REGU_REG, val);
123 #endif /* CONFIG_MMC */