aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/reset
diff options
context:
space:
mode:
authorStephen Gallimore <stephen.gallimore@st.com>2013-08-07 11:57:26 -0400
committerSrinivas Kandagatla <srinivas.kandagatla@st.com>2014-03-11 06:51:40 -0400
commitd0ace0f6e5bfa1b064789cf343e42a3c808f031a (patch)
tree09fcd9527d021ca34baa1a8142530f58dac8d748 /drivers/reset
parent1f42c290c3d91b5f9f60bd503b12ba06c7f47021 (diff)
drivers: reset: Reset controller driver for STiH416
This patch adds a reset controller platform driver for the STiH416 SoC. This initial version provides a compatible driver for the "st,stih416-powerdown" device, which registers a system configuration register based reset controller that controls the powerdown state of hardware such as the on-chip USB host controllers. Signed-off-by: Stephen Gallimore <stephen.gallimore@st.com> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com> Acked-by: Philipp Zabel <p.zabel@pengutronix.de>
Diffstat (limited to 'drivers/reset')
-rw-r--r--drivers/reset/sti/Kconfig4
-rw-r--r--drivers/reset/sti/Makefile2
-rw-r--r--drivers/reset/sti/reset-stih416.c79
3 files changed, 84 insertions, 1 deletions
diff --git a/drivers/reset/sti/Kconfig b/drivers/reset/sti/Kconfig
index ef6654a7c898..88d2d0316613 100644
--- a/drivers/reset/sti/Kconfig
+++ b/drivers/reset/sti/Kconfig
@@ -8,4 +8,8 @@ config STIH415_RESET
8 bool 8 bool
9 select STI_RESET_SYSCFG 9 select STI_RESET_SYSCFG
10 10
11config STIH416_RESET
12 bool
13 select STI_RESET_SYSCFG
14
11endif 15endif
diff --git a/drivers/reset/sti/Makefile b/drivers/reset/sti/Makefile
index fce4433c609d..be1c97647871 100644
--- a/drivers/reset/sti/Makefile
+++ b/drivers/reset/sti/Makefile
@@ -1,4 +1,4 @@
1obj-$(CONFIG_STI_RESET_SYSCFG) += reset-syscfg.o 1obj-$(CONFIG_STI_RESET_SYSCFG) += reset-syscfg.o
2 2
3# SoC specific reset devices
4obj-$(CONFIG_STIH415_RESET) += reset-stih415.o 3obj-$(CONFIG_STIH415_RESET) += reset-stih415.o
4obj-$(CONFIG_STIH416_RESET) += reset-stih416.o
diff --git a/drivers/reset/sti/reset-stih416.c b/drivers/reset/sti/reset-stih416.c
new file mode 100644
index 000000000000..0becfc57ad58
--- /dev/null
+++ b/drivers/reset/sti/reset-stih416.c
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2013 STMicroelectronics (R&D) Limited
3 * Author: Stephen Gallimore <stephen.gallimore@st.com>
4 * Author: Srinivas Kandagatla <srinivas.kandagatla@st.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11#include <linux/module.h>
12#include <linux/of.h>
13#include <linux/of_platform.h>
14#include <linux/platform_device.h>
15
16#include <dt-bindings/reset-controller/stih416-resets.h>
17
18#include "reset-syscfg.h"
19
20/*
21 * STiH416 Peripheral powerdown definitions.
22 */
23static const char stih416_front[] = "st,stih416-front-syscfg";
24static const char stih416_rear[] = "st,stih416-rear-syscfg";
25static const char stih416_sbc[] = "st,stih416-sbc-syscfg";
26static const char stih416_lpm[] = "st,stih416-lpm-syscfg";
27
28#define STIH416_PDN_FRONT(_bit) \
29 _SYSCFG_RST_CH(stih416_front, SYSCFG_1500, _bit, SYSSTAT_1578, _bit)
30
31#define STIH416_PDN_REAR(_cntl, _stat) \
32 _SYSCFG_RST_CH(stih416_rear, SYSCFG_2525, _cntl, SYSSTAT_2583, _stat)
33
34#define SYSCFG_1500 0x7d0 /* Powerdown request EMI/NAND/Keyscan */
35#define SYSSTAT_1578 0x908 /* Powerdown status EMI/NAND/Keyscan */
36
37#define SYSCFG_2525 0x834 /* Powerdown request USB/SATA/PCIe */
38#define SYSSTAT_2583 0x91c /* Powerdown status USB/SATA/PCIe */
39
40static const struct syscfg_reset_channel_data stih416_powerdowns[] = {
41 [STIH416_EMISS_POWERDOWN] = STIH416_PDN_FRONT(0),
42 [STIH416_NAND_POWERDOWN] = STIH416_PDN_FRONT(1),
43 [STIH416_KEYSCAN_POWERDOWN] = STIH416_PDN_FRONT(2),
44 [STIH416_USB0_POWERDOWN] = STIH416_PDN_REAR(0, 0),
45 [STIH416_USB1_POWERDOWN] = STIH416_PDN_REAR(1, 1),
46 [STIH416_USB2_POWERDOWN] = STIH416_PDN_REAR(2, 2),
47 [STIH416_USB3_POWERDOWN] = STIH416_PDN_REAR(6, 5),
48 [STIH416_SATA0_POWERDOWN] = STIH416_PDN_REAR(3, 3),
49 [STIH416_SATA1_POWERDOWN] = STIH416_PDN_REAR(4, 4),
50 [STIH416_PCIE0_POWERDOWN] = STIH416_PDN_REAR(7, 9),
51 [STIH416_PCIE1_POWERDOWN] = STIH416_PDN_REAR(5, 8),
52};
53
54static struct syscfg_reset_controller_data stih416_powerdown_controller = {
55 .wait_for_ack = true,
56 .nr_channels = ARRAY_SIZE(stih416_powerdowns),
57 .channels = stih416_powerdowns,
58};
59
60static struct of_device_id stih416_reset_match[] = {
61 { .compatible = "st,stih416-powerdown",
62 .data = &stih416_powerdown_controller, },
63 {},
64};
65
66static struct platform_driver stih416_reset_driver = {
67 .probe = syscfg_reset_probe,
68 .driver = {
69 .name = "reset-stih416",
70 .owner = THIS_MODULE,
71 .of_match_table = stih416_reset_match,
72 },
73};
74
75static int __init stih416_reset_init(void)
76{
77 return platform_driver_register(&stih416_reset_driver);
78}
79arch_initcall(stih416_reset_init);