diff options
author | Giuseppe Cavallaro <peppe.cavallaro@st.com> | 2013-11-19 07:02:06 +0100 |
---|---|---|
committer | Peter Griffin <peter.griffin@linaro.org> | 2014-06-26 13:06:27 +0100 |
commit | 28fefd622450c4e735f129046c694309f290aa14 (patch) | |
tree | dd403be180ccb1bff7677951edfa921b529cd847 | |
parent | 3389076b2e83ca64604ed77d2c9cdb18ae08b146 (diff) |
drivers: reset: stih407: add powerdown/softreset controllers
this patch adds the powerdown/softreset controllers for the
STiH407 SoC.
v2: remove the STIH407_RESET Koption.
Signed-off-by: Giuseppe Cavallaro <peppe.cavallaro@st.com>
-rw-r--r-- | drivers/reset/sti/Kconfig | 4 | ||||
-rw-r--r-- | drivers/reset/sti/Makefile | 1 | ||||
-rw-r--r-- | drivers/reset/sti/reset-stih407.c | 110 | ||||
-rw-r--r-- | include/dt-bindings/reset-controller/stih407-resets.h | 30 |
4 files changed, 145 insertions, 0 deletions
diff --git a/drivers/reset/sti/Kconfig b/drivers/reset/sti/Kconfig index 88d2d0316613..f8c15a37fb35 100644 --- a/drivers/reset/sti/Kconfig +++ b/drivers/reset/sti/Kconfig @@ -12,4 +12,8 @@ config STIH416_RESET bool select STI_RESET_SYSCFG +config STIH407_RESET + bool + select STI_RESET_SYSCFG + endif diff --git a/drivers/reset/sti/Makefile b/drivers/reset/sti/Makefile index be1c97647871..dc85dfbe56a9 100644 --- a/drivers/reset/sti/Makefile +++ b/drivers/reset/sti/Makefile @@ -2,3 +2,4 @@ obj-$(CONFIG_STI_RESET_SYSCFG) += reset-syscfg.o obj-$(CONFIG_STIH415_RESET) += reset-stih415.o obj-$(CONFIG_STIH416_RESET) += reset-stih416.o +obj-$(CONFIG_STIH407_RESET) += reset-stih407.o diff --git a/drivers/reset/sti/reset-stih407.c b/drivers/reset/sti/reset-stih407.c new file mode 100644 index 000000000000..4a57742f4db6 --- /dev/null +++ b/drivers/reset/sti/reset-stih407.c @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2013 STMicroelectronics (R&D) Limited + * Author: Giuseppe Cavallaro <peppe.cavallaro@st.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. + */ +#include <linux/module.h> +#include <linux/of.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> + +#include <dt-bindings/reset-controller/stih407-resets.h> + +#include "reset-syscfg.h" + +/* + * STiH407 Peripheral powerdown definitions. + */ +static const char stih407_core[] = "st,stih407-core-syscfg"; +static const char stih407_sbc_reg[] = "st,stih407-sbc-reg-syscfg"; +static const char stih407_lpm[] = "st,stih407-lpm-syscfg"; + +#define STIH407_PDN_0(_bit) \ + _SYSCFG_RST_CH(stih407_core, SYSCFG_5000, _bit, SYSSTAT_5500, _bit) +#define STIH407_PDN_1(_bit) \ + _SYSCFG_RST_CH(stih407_core, SYSCFG_5001, _bit, SYSSTAT_5501, _bit) +#define STIH407_PDN_ETH(_bit, _stat) \ + _SYSCFG_RST_CH(stih407_sbc_reg, SYSCFG_4032, _bit, SYSSTAT_4520, _stat) + +/* Powerdown requests control 0 */ +#define SYSCFG_5000 0x0 +#define SYSSTAT_5500 0x7d0 +/* Powerdown requests control 1 (High Speed Links) */ +#define SYSCFG_5001 0x4 +#define SYSSTAT_5501 0x7d4 + +/* Ethernet powerdown/status/reset */ +#define SYSCFG_4032 0x80 +#define SYSSTAT_4520 0x820 + +#define SYSCFG_4002 0x8 + +static const struct syscfg_reset_channel_data stih407_powerdowns[] = { + [STIH407_EMISS_POWERDOWN] = STIH407_PDN_0(1), + [STIH407_NAND_POWERDOWN] = STIH407_PDN_0(0), + [STIH407_USB3_POWERDOWN] = STIH407_PDN_1(6), + [STIH407_USB2_PORT1_POWERDOWN] = STIH407_PDN_1(5), + [STIH407_USB2_PORT0_POWERDOWN] = STIH407_PDN_1(4), + [STIH407_PCIE1_POWERDOWN] = STIH407_PDN_1(3), + [STIH407_PCIE0_POWERDOWN] = STIH407_PDN_1(2), + [STIH407_SATA1_POWERDOWN] = STIH407_PDN_1(1), + [STIH407_SATA0_POWERDOWN] = STIH407_PDN_1(0), + [STIH407_ETH1_POWERDOWN] = STIH407_PDN_ETH(0, 2), +}; + +/* Reset Generator control 0/1 */ +#define SYSCFG_5131 0x20c +#define SYSCFG_5132 0x210 + +#define LPM_SYSCFG_1 0x4 /* Softreset IRB & SBC UART */ + +static const struct syscfg_reset_channel_data stih407_softresets[] = { + [STIH407_ETH1_SOFTRESET] = SYSCFG_SRST(stih407_sbc_reg, SYSCFG_4002, 4), + [STIH407_MMC1_SOFTRESET] = SYSCFG_SRST(stih407_core, SYSCFG_5132, 3), + [STIH407_USB3_MIPHY2_SOFTRESET] = SYSCFG_SRST(stih407_core, SYSCFG_5132, + 22), + [STIH407_PICOPHY_SOFTRESET] = SYSCFG_SRST(stih407_core, SYSCFG_5132, + 30), + [STIH407_IRB_SOFTRESET] = SYSCFG_SRST(stih407_lpm, LPM_SYSCFG_1, 6), +}; + +static struct syscfg_reset_controller_data stih407_powerdown_controller = { + .wait_for_ack = true, + .nr_channels = ARRAY_SIZE(stih407_powerdowns), + .channels = stih407_powerdowns, +}; + +static struct syscfg_reset_controller_data stih407_softreset_controller = { + .wait_for_ack = false, + .active_low = true, + .nr_channels = ARRAY_SIZE(stih407_softresets), + .channels = stih407_softresets, +}; + +static struct of_device_id stih407_reset_match[] = { + {.compatible = "st,stih407-powerdown", + .data = &stih407_powerdown_controller,}, + {.compatible = "st,stih407-softreset", + .data = &stih407_softreset_controller,}, + {}, +}; + +static struct platform_driver stih407_reset_driver = { + .probe = syscfg_reset_probe, + .driver = { + .name = "reset-stih407", + .owner = THIS_MODULE, + .of_match_table = stih407_reset_match, + }, +}; + +static int __init stih407_reset_init(void) +{ + return platform_driver_register(&stih407_reset_driver); +} + +arch_initcall(stih407_reset_init); diff --git a/include/dt-bindings/reset-controller/stih407-resets.h b/include/dt-bindings/reset-controller/stih407-resets.h new file mode 100644 index 000000000000..d68650b3bca5 --- /dev/null +++ b/include/dt-bindings/reset-controller/stih407-resets.h @@ -0,0 +1,30 @@ +/* + * This header provides constants for the reset controller + * based peripheral powerdown requests on the STMicroelectronics + * STiH407 SoC. + */ +#ifndef _DT_BINDINGS_RESET_CONTROLLER_STIH407 +#define _DT_BINDINGS_RESET_CONTROLLER_STIH407 + +/* Powerdown requests control 0 */ +#define STIH407_EMISS_POWERDOWN 0 +#define STIH407_NAND_POWERDOWN 1 + +/* Synp GMAC PowerDown */ +#define STIH407_ETH1_POWERDOWN 2 +/* Powerdown requests control 1 */ +#define STIH407_USB3_POWERDOWN 3 +#define STIH407_USB2_PORT1_POWERDOWN 4 +#define STIH407_USB2_PORT0_POWERDOWN 5 +#define STIH407_PCIE1_POWERDOWN 6 +#define STIH407_PCIE0_POWERDOWN 7 +#define STIH407_SATA1_POWERDOWN 8 +#define STIH407_SATA0_POWERDOWN 9 + +/* Reset defines */ +#define STIH407_ETH1_SOFTRESET 0 +#define STIH407_MMC1_SOFTRESET 1 +#define STIH407_USB3_MIPHY2_SOFTRESET 2 +#define STIH407_PICOPHY_SOFTRESET 3 +#define STIH407_IRB_SOFTRESET 4 +#endif /* _DT_BINDINGS_RESET_CONTROLLER_STIH407 */ |