diff options
author | Jurijs Soloveckis <jurijs.soloveckis@stericsson.com> | 2011-10-03 15:03:39 +0200 |
---|---|---|
committer | Jonas ABERG <jonas.aberg@stericsson.com> | 2011-10-05 15:52:43 +0200 |
commit | d23d24de9ea88e804018c4efad8d1f31668ebfe9 (patch) | |
tree | 9e872f0793cc1b7f40f3c3d15ae589b6faa4f05b | |
parent | 1290cc4a54cdbec7154928ae7ba4c14dea42fa8b (diff) |
ARM: u8500: STM: board depended code split
Hardware depended code for STM device is moved
to the separate file.
ST-Ericsson ID: 349677
ST-Ericsson Linux next: N/A
ST-Ericsson FOSS-OUT ID: Trivial
Change-Id: I5d3d0e069b0e8929b99fcfe9cb5e37a950caf716
Signed-off-by: Jurijs Soloveckis <jurijs.soloveckis@stericsson.com>
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/32847
Reviewed-by: Pierre PEIFFER <pierre.peiffer@stericsson.com>
Reviewed-by: Sebastian RASMUSSEN <sebastian.rasmussen@stericsson.com>
-rw-r--r-- | arch/arm/mach-ux500/Makefile | 3 | ||||
-rw-r--r-- | arch/arm/mach-ux500/board-mop500-stm.c | 203 | ||||
-rw-r--r-- | arch/arm/mach-ux500/devices-db8500.c | 189 |
3 files changed, 206 insertions, 189 deletions
diff --git a/arch/arm/mach-ux500/Makefile b/arch/arm/mach-ux500/Makefile index 3f6aa6c05a4..56ae2fe5032 100644 --- a/arch/arm/mach-ux500/Makefile +++ b/arch/arm/mach-ux500/Makefile @@ -53,3 +53,6 @@ obj-$(CONFIG_HWMEM) += hwmem-int.o obj-$(CONFIG_UX500_L2X0_PREFETCH_CTRL) += l2x0-prefetch.o obj-$(CONFIG_AB5500_BM) += board-u5500-bm.o obj-$(CONFIG_DBX500_PRCMU_DEBUG) += prcmu-debug.o +ifeq ($(CONFIG_UX500_SOC_DB8500), y) +obj-$(CONFIG_STM_TRACE) += board-mop500-stm.o +endif
\ No newline at end of file diff --git a/arch/arm/mach-ux500/board-mop500-stm.c b/arch/arm/mach-ux500/board-mop500-stm.c new file mode 100644 index 00000000000..1c4ce12901f --- /dev/null +++ b/arch/arm/mach-ux500/board-mop500-stm.c @@ -0,0 +1,203 @@ +/* + * Copyright (C) 2011 ST-Ericsson + * + * Author: Pierre Peiffer <pierre.peiffer@stericsson.com> for ST-Ericsson. + * Author: Olivier Germain <olivier.germain@stericsson.com> + * + * 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. + * + */ + +#include <linux/platform_device.h> +#include <linux/gpio.h> +#include <linux/gpio/nomadik.h> +#include <plat/pincfg.h> +#include <mach/devices.h> +#include <linux/mfd/dbx500-prcmu.h> +#include <mach/hsi.h> +#include <trace/stm.h> +#include "pins-db8500.h" + +static pin_cfg_t mop500_stm_mipi34_pins[] = { + GPIO70_STMAPE_CLK | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, + GPIO71_STMAPE_DAT3 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, + GPIO72_STMAPE_DAT2 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, + GPIO73_STMAPE_DAT1 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, + GPIO74_STMAPE_DAT0 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, + GPIO75_U2_RXD | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, + GPIO76_U2_TXD | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, +}; + +static pin_cfg_t mop500_stm_mipi60_pins[] = { + GPIO153_U2_RXD, + GPIO154_U2_TXD, + GPIO155_STMAPE_CLK, + GPIO156_STMAPE_DAT3, + GPIO157_STMAPE_DAT2, + GPIO158_STMAPE_DAT1, + GPIO159_STMAPE_DAT0, +}; + +static pin_cfg_t mop500_ske_pins[] = { + GPIO153_KP_I7 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO154_KP_I6 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO155_KP_I5 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO156_KP_I4 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO161_KP_I3 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO162_KP_I2 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO163_KP_I1 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO164_KP_I0 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, + GPIO157_KP_O7 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO158_KP_O6 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO159_KP_O5 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO160_KP_O4 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO165_KP_O3 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO166_KP_O2 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO167_KP_O1 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, + GPIO168_KP_O0 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, +}; + +static int stm_ste_disable_ape_on_mipi60(void) +{ + int retval; + + retval = nmk_config_pins_sleep(ARRAY_AND_SIZE(mop500_stm_mipi60_pins)); + if (retval) + pr_err("STM: Failed to disable MIPI60\n"); + else { + retval = nmk_config_pins(ARRAY_AND_SIZE(mop500_ske_pins)); + if (retval) + pr_err("STM: Failed to enable SKE gpio\n"); + } + return retval; +} + +/* + * Manage STM output pins connection (MIP34/MIPI60 connectors) + */ +#define PRCM_GPIOCR (_PRCMU_BASE + 0x138) +#define PRCM_GPIOCR_DBG_STM_MOD_CMD1 0x800 +#define PRCM_GPIOCR_DBG_UARTMOD_CMD0 0x1 + + +static int stm_ste_connection(enum stm_connection_type con_type) +{ + int retval = -EINVAL; + u32 gpiocr = readl(PRCM_GPIOCR); + + if (con_type != STM_DISCONNECT) { + /* Always enable MIPI34 GPIO pins */ + retval = nmk_config_pins( + ARRAY_AND_SIZE(mop500_stm_mipi34_pins)); + if (retval) { + pr_err("STM: Failed to enable MIPI34\n"); + return retval; + } + } + + switch (con_type) { + case STM_DEFAULT_CONNECTION: + case STM_STE_MODEM_ON_MIPI34_NONE_ON_MIPI60: + /* Enable altC3 on GPIO70-74 (STMMOD) & GPIO75-76 (UARTMOD) */ + gpiocr |= (PRCM_GPIOCR_DBG_STM_MOD_CMD1 + | PRCM_GPIOCR_DBG_UARTMOD_CMD0); + writel(gpiocr, PRCM_GPIOCR); + retval = stm_ste_disable_ape_on_mipi60(); + break; + + case STM_STE_APE_ON_MIPI34_NONE_ON_MIPI60: + /* Disable altC3 on GPIO70-74 (STMMOD) & GPIO75-76 (UARTMOD) */ + gpiocr &= ~(PRCM_GPIOCR_DBG_STM_MOD_CMD1 + | PRCM_GPIOCR_DBG_UARTMOD_CMD0); + writel(gpiocr, PRCM_GPIOCR); + retval = stm_ste_disable_ape_on_mipi60(); + break; + + case STM_STE_MODEM_ON_MIPI34_APE_ON_MIPI60: + /* Enable altC3 on GPIO70-74 (STMMOD) and GPIO75-76 (UARTMOD) */ + gpiocr |= (PRCM_GPIOCR_DBG_STM_MOD_CMD1 + | PRCM_GPIOCR_DBG_UARTMOD_CMD0); + writel(gpiocr, PRCM_GPIOCR); + + /* Enable APE on MIPI60 */ + retval = nmk_config_pins_sleep(ARRAY_AND_SIZE(mop500_ske_pins)); + if (retval) + pr_err("STM: Failed to disable SKE GPIO\n"); + else { + retval = nmk_config_pins( + ARRAY_AND_SIZE(mop500_stm_mipi60_pins)); + if (retval) + pr_err("STM: Failed to enable MIPI60\n"); + } + break; + + case STM_DISCONNECT: + retval = nmk_config_pins_sleep( + ARRAY_AND_SIZE(mop500_stm_mipi34_pins)); + if (retval) + pr_err("STM: Failed to disable MIPI34\n"); + + retval = stm_ste_disable_ape_on_mipi60(); + break; + + default: + pr_err("STM: bad connection type\n"); + break; + } + return retval; +} + +/* Possible STM sources (masters) on ux500 */ +enum stm_master { + STM_ARM0 = 0, + STM_ARM1 = 1, + STM_SVA = 2, + STM_SIA = 3, + STM_SIA_XP70 = 4, + STM_PRCMU = 5, + STM_MCSBAG = 9 +}; + +#define STM_ENABLE_ARM0 BIT(STM_ARM0) +#define STM_ENABLE_ARM1 BIT(STM_ARM1) +#define STM_ENABLE_SVA BIT(STM_SVA) +#define STM_ENABLE_SIA BIT(STM_SIA) +#define STM_ENABLE_SIA_XP70 BIT(STM_SIA_XP70) +#define STM_ENABLE_PRCMU BIT(STM_PRCMU) +#define STM_ENABLE_MCSBAG BIT(STM_MCSBAG) + +/* + * These are the channels used by NMF and some external softwares + * expect the NMF traces to be output on these channels + * For legacy reason, we need to reserve them. + */ +static const s16 stm_channels_reserved[] = { + 100, /* NMF MPCEE channel */ + 101, /* NMF CM channel */ + 151, /* NMF HOSTEE channel */ +}; + +/* On Ux500 we 2 consecutive STMs therefore 512 channels available */ +static struct stm_platform_data stm_pdata = { + .regs_phys_base = U8500_STM_REG_BASE, + .channels_phys_base = U8500_STM_BASE, + .id_mask = 0x000fffff, /* Ignore revisions differences */ + .channels_reserved = stm_channels_reserved, + .channels_reserved_sz = ARRAY_SIZE(stm_channels_reserved), + /* Enable all except MCSBAG */ + .masters_enabled = STM_ENABLE_ARM0 | STM_ENABLE_ARM1 | + STM_ENABLE_SVA | STM_ENABLE_PRCMU | + STM_ENABLE_SIA | STM_ENABLE_SIA_XP70, + /* Provide function for MIPI34/MIPI60 STM connection */ + .stm_connection = stm_ste_connection, +}; + +struct platform_device ux500_stm_device = { + .name = "stm", + .id = -1, + .dev = { + .platform_data = &stm_pdata, + }, +}; diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c index 266196f1810..f86ecd51ada 100644 --- a/arch/arm/mach-ux500/devices-db8500.c +++ b/arch/arm/mach-ux500/devices-db8500.c @@ -2,10 +2,6 @@ * Copyright (C) ST-Ericsson SA 2010 * * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson - * - * Author: Pierre Peiffer <pierre.peiffer@stericsson.com> for ST-Ericsson. - * for the System Trace Module part. - * * License terms: GNU General Public License (GPL) version 2 */ @@ -29,7 +25,6 @@ #include <linux/mfd/dbx500-prcmu.h> #include <mach/hsi.h> #include <mach/ste-dma40-db8500.h> -#include <trace/stm.h> #include "pins-db8500.h" @@ -440,187 +435,3 @@ struct platform_device u8500_ske_keypad_device = { .num_resources = ARRAY_SIZE(keypad_resources), .resource = keypad_resources, }; - -#ifdef CONFIG_STM_TRACE -static pin_cfg_t mop500_stm_mipi34_pins[] = { - GPIO70_STMAPE_CLK | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, - GPIO71_STMAPE_DAT3 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, - GPIO72_STMAPE_DAT2 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, - GPIO73_STMAPE_DAT1 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, - GPIO74_STMAPE_DAT0 | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, - GPIO75_U2_RXD | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, - GPIO76_U2_TXD | PIN_SLPM_USE_MUX_SETTINGS_IN_SLEEP, -}; - -static pin_cfg_t mop500_stm_mipi60_pins[] = { - GPIO153_U2_RXD, - GPIO154_U2_TXD, - GPIO155_STMAPE_CLK, - GPIO156_STMAPE_DAT3, - GPIO157_STMAPE_DAT2, - GPIO158_STMAPE_DAT1, - GPIO159_STMAPE_DAT0, -}; - -static pin_cfg_t mop500_ske_pins[] = { - GPIO153_KP_I7 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO154_KP_I6 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO155_KP_I5 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO156_KP_I4 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO161_KP_I3 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO162_KP_I2 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO163_KP_I1 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO164_KP_I0 | PIN_INPUT_PULLDOWN | PIN_SLPM_INPUT_PULLUP, - GPIO157_KP_O7 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO158_KP_O6 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO159_KP_O5 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO160_KP_O4 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO165_KP_O3 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO166_KP_O2 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO167_KP_O1 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, - GPIO168_KP_O0 | PIN_INPUT_PULLUP | PIN_SLPM_OUTPUT_LOW, -}; - -static int stm_ste_disable_ape_on_mipi60(void) -{ - int retval; - - retval = nmk_config_pins_sleep(ARRAY_AND_SIZE(mop500_stm_mipi60_pins)); - if (retval) - pr_err("STM: Failed to disable MIPI60\n"); - else { - retval = nmk_config_pins(ARRAY_AND_SIZE(mop500_ske_pins)); - if (retval) - pr_err("STM: Failed to enable SKE gpio\n"); - } - return retval; -} - -/* - * Manage STM output pins connection (MIP34/MIPI60 connectors) - */ -#define PRCM_GPIOCR (_PRCMU_BASE + 0x138) -#define PRCM_GPIOCR_DBG_STM_MOD_CMD1 0x800 -#define PRCM_GPIOCR_DBG_UARTMOD_CMD0 0x1 - - -static int stm_ste_connection(enum stm_connection_type con_type) -{ - int retval = -EINVAL; - u32 gpiocr = readl(PRCM_GPIOCR); - - if (con_type != STM_DISCONNECT) { - /* Always enable MIPI34 GPIO pins */ - retval = nmk_config_pins( - ARRAY_AND_SIZE(mop500_stm_mipi34_pins)); - if (retval) { - pr_err("STM: Failed to enable MIPI34\n"); - return retval; - } - } - - switch (con_type) { - case STM_DEFAULT_CONNECTION: - case STM_STE_MODEM_ON_MIPI34_NONE_ON_MIPI60: - /* Enable altC3 on GPIO70-74 (STMMOD) & GPIO75-76 (UARTMOD) */ - gpiocr |= (PRCM_GPIOCR_DBG_STM_MOD_CMD1 - | PRCM_GPIOCR_DBG_UARTMOD_CMD0); - writel(gpiocr, PRCM_GPIOCR); - retval = stm_ste_disable_ape_on_mipi60(); - break; - - case STM_STE_APE_ON_MIPI34_NONE_ON_MIPI60: - /* Disable altC3 on GPIO70-74 (STMMOD) & GPIO75-76 (UARTMOD) */ - gpiocr &= ~(PRCM_GPIOCR_DBG_STM_MOD_CMD1 - | PRCM_GPIOCR_DBG_UARTMOD_CMD0); - writel(gpiocr, PRCM_GPIOCR); - retval = stm_ste_disable_ape_on_mipi60(); - break; - - case STM_STE_MODEM_ON_MIPI34_APE_ON_MIPI60: - /* Enable altC3 on GPIO70-74 (STMMOD) and GPIO75-76 (UARTMOD) */ - gpiocr |= (PRCM_GPIOCR_DBG_STM_MOD_CMD1 - | PRCM_GPIOCR_DBG_UARTMOD_CMD0); - writel(gpiocr, PRCM_GPIOCR); - - /* Enable APE on MIPI60 */ - retval = nmk_config_pins_sleep(ARRAY_AND_SIZE(mop500_ske_pins)); - if (retval) - pr_err("STM: Failed to disable SKE GPIO\n"); - else { - retval = nmk_config_pins( - ARRAY_AND_SIZE(mop500_stm_mipi60_pins)); - if (retval) - pr_err("STM: Failed to enable MIPI60\n"); - } - break; - - case STM_DISCONNECT: - retval = nmk_config_pins_sleep( - ARRAY_AND_SIZE(mop500_stm_mipi34_pins)); - if (retval) - pr_err("STM: Failed to disable MIPI34\n"); - - retval = stm_ste_disable_ape_on_mipi60(); - break; - - default: - pr_err("STM: bad connection type\n"); - break; - } - return retval; -} - -/* Possible STM sources (masters) on ux500 */ -enum stm_master { - STM_ARM0 = 0, - STM_ARM1 = 1, - STM_SVA = 2, - STM_SIA = 3, - STM_SIA_XP70 = 4, - STM_PRCMU = 5, - STM_MCSBAG = 9 -}; - -#define STM_ENABLE_ARM0 BIT(STM_ARM0) -#define STM_ENABLE_ARM1 BIT(STM_ARM1) -#define STM_ENABLE_SVA BIT(STM_SVA) -#define STM_ENABLE_SIA BIT(STM_SIA) -#define STM_ENABLE_SIA_XP70 BIT(STM_SIA_XP70) -#define STM_ENABLE_PRCMU BIT(STM_PRCMU) -#define STM_ENABLE_MCSBAG BIT(STM_MCSBAG) - -/* - * These are the channels used by NMF and some external softwares - * expect the NMF traces to be output on these channels - * For legacy reason, we need to reserve them. - */ -static const s16 stm_channels_reserved[] = { - 100, /* NMF MPCEE channel */ - 101, /* NMF CM channel */ - 151, /* NMF HOSTEE channel */ -}; - -/* On Ux500 we 2 consecutive STMs therefore 512 channels available */ -static struct stm_platform_data stm_pdata = { - .regs_phys_base = U8500_STM_REG_BASE, - .channels_phys_base = U8500_STM_BASE, - .id_mask = 0x000fffff, /* Ignore revisions differences */ - .channels_reserved = stm_channels_reserved, - .channels_reserved_sz = ARRAY_SIZE(stm_channels_reserved), - /* Enable all except MCSBAG */ - .masters_enabled = STM_ENABLE_ARM0 | STM_ENABLE_ARM1 | - STM_ENABLE_SVA | STM_ENABLE_PRCMU | - STM_ENABLE_SIA | STM_ENABLE_SIA_XP70, - /* Provide function for MIPI34/MIPI60 STM connection */ - .stm_connection = stm_ste_connection, -}; - -struct platform_device ux500_stm_device = { - .name = "stm", - .id = -1, - .dev = { - .platform_data = &stm_pdata, - }, -}; -#endif /* CONFIG_UX500_STM */ |