diff options
Diffstat (limited to 'arch/arm/include/asm/arch-u8500')
| -rw-r--r-- | arch/arm/include/asm/arch-u8500/clock.h | 5 | ||||
| -rw-r--r-- | arch/arm/include/asm/arch-u8500/db8500_gpio.h | 42 | ||||
| -rw-r--r-- | arch/arm/include/asm/arch-u8500/db8500_pincfg.h | 170 | ||||
| -rw-r--r-- | arch/arm/include/asm/arch-u8500/hardware.h | 33 | ||||
| -rw-r--r-- | arch/arm/include/asm/arch-u8500/prcmu.h | 76 | ||||
| -rw-r--r-- | arch/arm/include/asm/arch-u8500/sys_proto.h | 1 | 
6 files changed, 320 insertions, 7 deletions
| diff --git a/arch/arm/include/asm/arch-u8500/clock.h b/arch/arm/include/asm/arch-u8500/clock.h index b00ab0d21..2a1478409 100644 --- a/arch/arm/include/asm/arch-u8500/clock.h +++ b/arch/arm/include/asm/arch-u8500/clock.h @@ -64,9 +64,6 @@ struct prcmu {  extern void u8500_clock_enable(int periph, int kern, int cluster); -static inline void u8500_prcmu_enable(unsigned int *reg) -{ -	writel(readl(reg) | (1 << 8), reg); -} +void db8500_clocks_init(void);  #endif /* __ASM_ARCH_CLOCK */ diff --git a/arch/arm/include/asm/arch-u8500/db8500_gpio.h b/arch/arm/include/asm/arch-u8500/db8500_gpio.h new file mode 100644 index 000000000..7c85a8917 --- /dev/null +++ b/arch/arm/include/asm/arch-u8500/db8500_gpio.h @@ -0,0 +1,42 @@ +/* + * Structures and registers for GPIO access in the Nomadik SoC + * + * Code ported from Nomadik GPIO driver in ST-Ericsson Linux kernel code. + * The purpose is that GPIO config found in kernel should work by simply + * copy-paste it to U-boot. + * + * Ported to U-boot by: + * Copyright (C) 2010 Joakim Axelsson <joakim.axelsson AT stericsson.com> + * Copyright (C) 2008 STMicroelectronics + *     Author: Prafulla WADASKAR <prafulla.wadaskar@st.com> + * Copyright (C) 2009 Alessandro Rubini <rubini@unipv.it> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef __DB8500_GPIO_H__ +#define __DB8500_GPIO_H__ + +/* Alternate functions: function C is set in hw by setting both A and B */ +enum db8500_gpio_alt { +	DB8500_GPIO_ALT_GPIO = 0, +	DB8500_GPIO_ALT_A = 1, +	DB8500_GPIO_ALT_B = 2, +	DB8500_GPIO_ALT_C = (DB8500_GPIO_ALT_A | DB8500_GPIO_ALT_B) +}; + +enum db8500_gpio_pull { +	DB8500_GPIO_PULL_NONE, +	DB8500_GPIO_PULL_UP, +	DB8500_GPIO_PULL_DOWN +}; + +void db8500_gpio_set_pull(unsigned gpio, enum db8500_gpio_pull pull); +void db8500_gpio_make_input(unsigned gpio); +int db8500_gpio_get_input(unsigned gpio); +void db8500_gpio_make_output(unsigned gpio, int val); +void db8500_gpio_set_output(unsigned gpio, int val); + +#endif /* __DB8500_GPIO_H__ */ diff --git a/arch/arm/include/asm/arch-u8500/db8500_pincfg.h b/arch/arm/include/asm/arch-u8500/db8500_pincfg.h new file mode 100644 index 000000000..64957016c --- /dev/null +++ b/arch/arm/include/asm/arch-u8500/db8500_pincfg.h @@ -0,0 +1,170 @@ +/* + * Copyright (C) ST-Ericsson SA 2010 + * + * Code ported from Nomadik GPIO driver in ST-Ericsson Linux kernel code. + * The purpose is that GPIO config found in kernel should work by simply + * copy-paste it to U-boot. Ported 2010 to U-boot by: + * Author: Joakim Axelsson <joakim.axelsson AT stericsson.com> + * + * License terms: GNU General Public License, version 2 + * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson + * + * + * Based on arch/arm/mach-pxa/include/mach/mfp.h: + *   Copyright (C) 2007 Marvell International Ltd. + *   eric miao <eric.miao@marvell.com> + */ + +#ifndef __DB8500_PINCFG_H +#define __DB8500_PINCFG_H + +#include "db8500_gpio.h" + +/* + * U-boot info: + * SLPM (sleep mode) config will be ignored by U-boot but it is still + * possible to configure it in order to keep cut-n-paste compability + * with Linux kernel config. + * + * pin configurations are represented by 32-bit integers: + * + *	bit  0.. 8 - Pin Number (512 Pins Maximum) + *	bit  9..10 - Alternate Function Selection + *	bit 11..12 - Pull up/down state + *	bit     13 - Sleep mode behaviour (not used in U-boot) + *	bit     14 - Direction + *	bit     15 - Value (if output) + *	bit 16..18 - SLPM pull up/down state (not used in U-boot) + *	bit 19..20 - SLPM direction (not used in U-boot) + *	bit 21..22 - SLPM Value (if output) (not used in U-boot) + * + * to facilitate the definition, the following macros are provided + * + * PIN_CFG_DEFAULT - default config (0): + *		     pull up/down = disabled + *		     sleep mode = input/wakeup + *		     direction = input + *		     value = low + *		     SLPM direction = same as normal + *		     SLPM pull = same as normal + *		     SLPM value = same as normal + * + * PIN_CFG	   - default config with alternate function + * PIN_CFG_PULL	   - default config with alternate function and pull up/down + */ + +/* Sleep mode */ +enum db8500_gpio_slpm { +	DB8500_GPIO_SLPM_INPUT, +	DB8500_GPIO_SLPM_WAKEUP_ENABLE = DB8500_GPIO_SLPM_INPUT, +	DB8500_GPIO_SLPM_NOCHANGE, +	DB8500_GPIO_SLPM_WAKEUP_DISABLE = DB8500_GPIO_SLPM_NOCHANGE, +}; + +#define PIN_NUM_MASK		0x1ff +#define PIN_NUM(x)		((x) & PIN_NUM_MASK) + +#define PIN_ALT_SHIFT		9 +#define PIN_ALT_MASK		(0x3 << PIN_ALT_SHIFT) +#define PIN_ALT(x)		(((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT) +#define PIN_GPIO		(DB8500_GPIO_ALT_GPIO << PIN_ALT_SHIFT) +#define PIN_ALT_A		(DB8500_GPIO_ALT_A << PIN_ALT_SHIFT) +#define PIN_ALT_B		(DB8500_GPIO_ALT_B << PIN_ALT_SHIFT) +#define PIN_ALT_C		(DB8500_GPIO_ALT_C << PIN_ALT_SHIFT) + +#define PIN_PULL_SHIFT		11 +#define PIN_PULL_MASK		(0x3 << PIN_PULL_SHIFT) +#define PIN_PULL(x)		(((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT) +#define PIN_PULL_NONE		(DB8500_GPIO_PULL_NONE << PIN_PULL_SHIFT) +#define PIN_PULL_UP		(DB8500_GPIO_PULL_UP << PIN_PULL_SHIFT) +#define PIN_PULL_DOWN		(DB8500_GPIO_PULL_DOWN << PIN_PULL_SHIFT) + +#define PIN_SLPM_SHIFT		13 +#define PIN_SLPM_MASK		(0x1 << PIN_SLPM_SHIFT) +#define PIN_SLPM(x)		(((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT) +#define PIN_SLPM_MAKE_INPUT	(DB8500_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT) +#define PIN_SLPM_NOCHANGE	(DB8500_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT) +/* These two replace the above in DB8500v2+ */ +#define PIN_SLPM_WAKEUP_ENABLE \ +	(DB8500_GPIO_SLPM_WAKEUP_ENABLE << PIN_SLPM_SHIFT) +#define PIN_SLPM_WAKEUP_DISABLE \ +	(DB8500_GPIO_SLPM_WAKEUP_DISABLE << PIN_SLPM_SHIFT) + +#define PIN_DIR_SHIFT		14 +#define PIN_DIR_MASK		(0x1 << PIN_DIR_SHIFT) +#define PIN_DIR(x)		(((x) & PIN_DIR_MASK) >> PIN_DIR_SHIFT) +#define PIN_DIR_INPUT		(0 << PIN_DIR_SHIFT) +#define PIN_DIR_OUTPUT		(1 << PIN_DIR_SHIFT) + +#define PIN_VAL_SHIFT		15 +#define PIN_VAL_MASK		(0x1 << PIN_VAL_SHIFT) +#define PIN_VAL(x)		(((x) & PIN_VAL_MASK) >> PIN_VAL_SHIFT) +#define PIN_VAL_LOW		(0 << PIN_VAL_SHIFT) +#define PIN_VAL_HIGH		(1 << PIN_VAL_SHIFT) + +#define PIN_SLPM_PULL_SHIFT	16 +#define PIN_SLPM_PULL_MASK	(0x7 << PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL(x)	\ +	(((x) & PIN_SLPM_PULL_MASK) >> PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL_NONE	\ +	((1 + DB8500_GPIO_PULL_NONE) << PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL_UP	\ +	((1 + DB8500_GPIO_PULL_UP) << PIN_SLPM_PULL_SHIFT) +#define PIN_SLPM_PULL_DOWN	\ +	((1 + DB8500_GPIO_PULL_DOWN) << PIN_SLPM_PULL_SHIFT) + +#define PIN_SLPM_DIR_SHIFT	19 +#define PIN_SLPM_DIR_MASK	(0x3 << PIN_SLPM_DIR_SHIFT) +#define PIN_SLPM_DIR(x)		\ +	(((x) & PIN_SLPM_DIR_MASK) >> PIN_SLPM_DIR_SHIFT) +#define PIN_SLPM_DIR_INPUT	((1 + 0) << PIN_SLPM_DIR_SHIFT) +#define PIN_SLPM_DIR_OUTPUT	((1 + 1) << PIN_SLPM_DIR_SHIFT) + +#define PIN_SLPM_VAL_SHIFT	21 +#define PIN_SLPM_VAL_MASK	(0x3 << PIN_SLPM_VAL_SHIFT) +#define PIN_SLPM_VAL(x)		\ +	(((x) & PIN_SLPM_VAL_MASK) >> PIN_SLPM_VAL_SHIFT) +#define PIN_SLPM_VAL_LOW	((1 + 0) << PIN_SLPM_VAL_SHIFT) +#define PIN_SLPM_VAL_HIGH	((1 + 1) << PIN_SLPM_VAL_SHIFT) + +/* Shortcuts.  Use these instead of separate DIR, PULL, and VAL.  */ +#define PIN_INPUT_PULLDOWN	(PIN_DIR_INPUT | PIN_PULL_DOWN) +#define PIN_INPUT_PULLUP	(PIN_DIR_INPUT | PIN_PULL_UP) +#define PIN_INPUT_NOPULL	(PIN_DIR_INPUT | PIN_PULL_NONE) +#define PIN_OUTPUT_LOW		(PIN_DIR_OUTPUT | PIN_VAL_LOW) +#define PIN_OUTPUT_HIGH		(PIN_DIR_OUTPUT | PIN_VAL_HIGH) + +#define PIN_SLPM_INPUT_PULLDOWN	(PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_DOWN) +#define PIN_SLPM_INPUT_PULLUP	(PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_UP) +#define PIN_SLPM_INPUT_NOPULL	(PIN_SLPM_DIR_INPUT | PIN_SLPM_PULL_NONE) +#define PIN_SLPM_OUTPUT_LOW	(PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_LOW) +#define PIN_SLPM_OUTPUT_HIGH	(PIN_SLPM_DIR_OUTPUT | PIN_SLPM_VAL_HIGH) + +#define PIN_CFG_DEFAULT		(0) + +#define PIN_CFG(num, alt)		\ +	(PIN_CFG_DEFAULT |\ +	 (PIN_NUM(num) | PIN_##alt)) + +#define PIN_CFG_INPUT(num, alt, pull)		\ +	(PIN_CFG_DEFAULT |\ +	 (PIN_NUM(num) | PIN_##alt | PIN_INPUT_##pull)) + +#define PIN_CFG_OUTPUT(num, alt, val)		\ +	(PIN_CFG_DEFAULT |\ +	 (PIN_NUM(num) | PIN_##alt | PIN_OUTPUT_##val)) + +#define PIN_CFG_PULL(num, alt, pull)	\ +	((PIN_CFG_DEFAULT & ~PIN_PULL_MASK) |\ +	 (PIN_NUM(num) | PIN_##alt | PIN_PULL_##pull)) + +/** + * db8500_gpio_config_pins - configure several pins at once + * @cfgs: array of pin configurations + * @num: number of elments in the array + * + * Configures several GPIO pins. + */ +void db8500_gpio_config_pins(unsigned long *cfgs, size_t num); + +#endif diff --git a/arch/arm/include/asm/arch-u8500/hardware.h b/arch/arm/include/asm/arch-u8500/hardware.h index 6bb95ec07..ee0341932 100644 --- a/arch/arm/include/asm/arch-u8500/hardware.h +++ b/arch/arm/include/asm/arch-u8500/hardware.h @@ -62,7 +62,7 @@  /* Per4 */  #define U8500_PRCMU_BASE	(U8500_PER4_BASE + 0x07000) -#define U8500_PRCMU_TCDM_BASE   (U8500_PER4_BASE + 0x0f000) +#define U8500_PRCMU_TCDM_BASE   (U8500_PER4_BASE + 0x68000)  /* Per3 */  #define U8500_UART2_BASE	(U8500_PER3_BASE + 0x7000) @@ -77,7 +77,34 @@  #define U8500_CLKRST1_BASE	(U8500_PER1_BASE + 0xf000)  /* Last page of Boot ROM */ -#define U8500_BOOTROM_BASE      0x9001f000 -#define U8500_BOOTROM_ASIC_ID_OFFSET    0x0ff4 +#define U8500_BOOTROM_BASE      0x90000000 +#define U8500_ASIC_ID_LOC_ED_V1 (U8500_BOOTROM_BASE + 0x1FFF4) +#define U8500_ASIC_ID_LOC_V2    (U8500_BOOTROM_BASE + 0x1DBF4) + +/* AB8500 specifics */ + +/* address bank */ +#define AB8500_REGU_CTRL2	0x0004 +#define AB8500_MISC		0x0010 + +/* registers */ +#define AB8500_REGU_VRF1VAUX3_REGU_REG	0x040A +#define AB8500_REGU_VRF1VAUX3_SEL_REG	0x0421 +#define AB8500_REV_REG			0x1080 + +#define AB8500_GPIO_SEL2_REG	0x1001 +#define AB8500_GPIO_DIR2_REG	0x1011 +#define AB8500_GPIO_DIR4_REG	0x1013 +#define AB8500_GPIO_SEL4_REG	0x1003 +#define AB8500_GPIO_OUT2_REG	0x1021 +#define AB8500_GPIO_OUT4_REG	0x1023 + +#define LDO_VAUX3_ENABLE_MASK	0x3 +#define LDO_VAUX3_ENABLE_VAL	0x1 +#define LDO_VAUX3_SEL_MASK	0xf +#define LDO_VAUX3_SEL_2V9	0xd +#define LDO_VAUX3_V2_SEL_MASK	0x7 +#define LDO_VAUX3_V2_SEL_2V91	0x7 +  #endif /* __ASM_ARCH_HARDWARE_H */ diff --git a/arch/arm/include/asm/arch-u8500/prcmu.h b/arch/arm/include/asm/arch-u8500/prcmu.h new file mode 100644 index 000000000..e9dcc9325 --- /dev/null +++ b/arch/arm/include/asm/arch-u8500/prcmu.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2009 ST-Ericsson SA + * + * Copied from the Linux version: + * Author: Kumar Sanghvi <kumar.sanghvi@stericsson.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., 675 Mass Ave, Cambridge, MA 02139, USA. + */ +#ifndef __MACH_PRCMU_FW_V1_H +#define __MACH_PRCMU_FW_V1_H + +#define AP_EXECUTE	2 +#define I2CREAD		1 +#define I2C_WR_OK	1 +#define I2C_RD_OK	2 +#define I2CWRITE	0 + +#define PRCMU_BASE			U8500_PRCMU_BASE +#define PRCMU_BASE_TCDM			U8500_PRCMU_TCDM_BASE +#define PRCM_UARTCLK_MGT_REG		(PRCMU_BASE + 0x018) +#define PRCM_MSPCLK_MGT_REG		(PRCMU_BASE + 0x01C) +#define PRCM_I2CCLK_MGT_REG		(PRCMU_BASE + 0x020) +#define PRCM_SDMMCCLK_MGT_REG		(PRCMU_BASE + 0x024) +#define PRCM_PER1CLK_MGT_REG		(PRCMU_BASE + 0x02C) +#define PRCM_PER2CLK_MGT_REG		(PRCMU_BASE + 0x030) +#define PRCM_PER3CLK_MGT_REG		(PRCMU_BASE + 0x034) +#define PRCM_PER5CLK_MGT_REG		(PRCMU_BASE + 0x038) +#define PRCM_PER6CLK_MGT_REG		(PRCMU_BASE + 0x03C) +#define PRCM_PER7CLK_MGT_REG		(PRCMU_BASE + 0x040) +#define PRCM_MBOX_CPU_VAL		(PRCMU_BASE + 0x0FC) +#define PRCM_MBOX_CPU_SET		(PRCMU_BASE + 0x100) + +#define PRCM_ARM_IT1_CLEAR		(PRCMU_BASE + 0x48C) +#define PRCM_ARM_IT1_VAL		(PRCMU_BASE + 0x494) +#define PRCM_TCR			(PRCMU_BASE + 0x1C8) +#define PRCM_REQ_MB5			(PRCMU_BASE_TCDM + 0xE44) +#define PRCM_ACK_MB5			(PRCMU_BASE_TCDM + 0xDF4) +#define PRCM_XP70_CUR_PWR_STATE		(PRCMU_BASE_TCDM + 0xFFC) +/* Mailbox 5 Requests */ +#define PRCM_REQ_MB5_I2COPTYPE_REG	(PRCM_REQ_MB5 + 0x0) +#define PRCM_REQ_MB5_BIT_FIELDS		(PRCM_REQ_MB5 + 0x1) +#define PRCM_REQ_MB5_I2CSLAVE		(PRCM_REQ_MB5 + 0x2) +#define PRCM_REQ_MB5_I2CVAL		(PRCM_REQ_MB5 + 0x3) + +/* Mailbox 5 ACKs */ +#define PRCM_ACK_MB5_STATUS	(PRCM_ACK_MB5 + 0x1) +#define PRCM_ACK_MB5_SLAVE	(PRCM_ACK_MB5 + 0x2) +#define PRCM_ACK_MB5_VAL	(PRCM_ACK_MB5 + 0x3) + +#define LOW_POWER_WAKEUP	1 +#define EXE_WAKEUP		0 + +#define REQ_MB5			5 + +#define ab8500_read	prcmu_i2c_read +#define ab8500_write	prcmu_i2c_write + +int prcmu_i2c_read(u8 reg, u16 slave); +int prcmu_i2c_write(u8 reg, u16 slave, u8 reg_data); + +void u8500_prcmu_enable(u32 *reg); +void db8500_prcmu_init(void); + +#endif /* __MACH_PRCMU_FW_V1_H */ diff --git a/arch/arm/include/asm/arch-u8500/sys_proto.h b/arch/arm/include/asm/arch-u8500/sys_proto.h index bac5e7999..a8ef9e5f4 100644 --- a/arch/arm/include/asm/arch-u8500/sys_proto.h +++ b/arch/arm/include/asm/arch-u8500/sys_proto.h @@ -23,5 +23,6 @@  #define _SYS_PROTO_H_  void gpio_init(void); +int u8500_mmc_power_init(void);  #endif  /* _SYS_PROTO_H_ */ |