Skip to content

Commit f93ac08

Browse files
committed
Merge branch 'reset/simple' of git://git.pengutronix.de/git/pza/linux into clk-bcm
Pull immutable reset branch to get reset-simple header. * 'reset/simple' of git://git.pengutronix.de/git/pza/linux: reset: simple: Add reset callback reset: Move reset-simple header out of drivers/reset
2 parents e244d20 + a970137 commit f93ac08

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

drivers/reset/reset-simple.c

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,17 @@
1111
* Maxime Ripard <[email protected]>
1212
*/
1313

14+
#include <linux/delay.h>
1415
#include <linux/device.h>
1516
#include <linux/err.h>
1617
#include <linux/io.h>
1718
#include <linux/of.h>
1819
#include <linux/of_device.h>
1920
#include <linux/platform_device.h>
2021
#include <linux/reset-controller.h>
22+
#include <linux/reset/reset-simple.h>
2123
#include <linux/spinlock.h>
2224

23-
#include "reset-simple.h"
24-
2525
static inline struct reset_simple_data *
2626
to_reset_simple_data(struct reset_controller_dev *rcdev)
2727
{
@@ -64,6 +64,24 @@ static int reset_simple_deassert(struct reset_controller_dev *rcdev,
6464
return reset_simple_update(rcdev, id, false);
6565
}
6666

67+
static int reset_simple_reset(struct reset_controller_dev *rcdev,
68+
unsigned long id)
69+
{
70+
struct reset_simple_data *data = to_reset_simple_data(rcdev);
71+
int ret;
72+
73+
if (!data->reset_us)
74+
return -ENOTSUPP;
75+
76+
ret = reset_simple_assert(rcdev, id);
77+
if (ret)
78+
return ret;
79+
80+
usleep_range(data->reset_us, data->reset_us * 2);
81+
82+
return reset_simple_deassert(rcdev, id);
83+
}
84+
6785
static int reset_simple_status(struct reset_controller_dev *rcdev,
6886
unsigned long id)
6987
{
@@ -81,6 +99,7 @@ static int reset_simple_status(struct reset_controller_dev *rcdev,
8199
const struct reset_control_ops reset_simple_ops = {
82100
.assert = reset_simple_assert,
83101
.deassert = reset_simple_deassert,
102+
.reset = reset_simple_reset,
84103
.status = reset_simple_status,
85104
};
86105
EXPORT_SYMBOL_GPL(reset_simple_ops);

drivers/reset/reset-socfpga.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,12 @@
1111
#include <linux/of_address.h>
1212
#include <linux/platform_device.h>
1313
#include <linux/reset-controller.h>
14+
#include <linux/reset/reset-simple.h>
1415
#include <linux/reset/socfpga.h>
1516
#include <linux/slab.h>
1617
#include <linux/spinlock.h>
1718
#include <linux/types.h>
1819

19-
#include "reset-simple.h"
20-
2120
#define SOCFPGA_NR_BANKS 8
2221

2322
static int a10_reset_init(struct device_node *np)

drivers/reset/reset-sunxi.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@
1414
#include <linux/of_address.h>
1515
#include <linux/platform_device.h>
1616
#include <linux/reset-controller.h>
17+
#include <linux/reset/reset-simple.h>
1718
#include <linux/reset/sunxi.h>
1819
#include <linux/slab.h>
1920
#include <linux/spinlock.h>
2021
#include <linux/types.h>
2122

22-
#include "reset-simple.h"
23-
2423
static int sunxi_reset_init(struct device_node *np)
2524
{
2625
struct reset_simple_data *data;

drivers/reset/reset-uniphier-glue.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
#include <linux/of_device.h>
1010
#include <linux/platform_device.h>
1111
#include <linux/reset.h>
12-
13-
#include "reset-simple.h"
12+
#include <linux/reset/reset-simple.h>
1413

1514
#define MAX_CLKS 2
1615
#define MAX_RSTS 2

drivers/reset/reset-simple.h renamed to include/linux/reset/reset-simple.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,20 @@
2727
* @status_active_low: if true, bits read back as cleared while the reset is
2828
* asserted. Otherwise, bits read back as set while the
2929
* reset is asserted.
30+
* @reset_us: Minimum delay in microseconds needed that needs to be
31+
* waited for between an assert and a deassert to reset the
32+
* device. If multiple consumers with different delay
33+
* requirements are connected to this controller, it must
34+
* be the largest minimum delay. 0 means that such a delay is
35+
* unknown and the reset operation is unsupported.
3036
*/
3137
struct reset_simple_data {
3238
spinlock_t lock;
3339
void __iomem *membase;
3440
struct reset_controller_dev rcdev;
3541
bool active_low;
3642
bool status_active_low;
43+
unsigned int reset_us;
3744
};
3845

3946
extern const struct reset_control_ops reset_simple_ops;

0 commit comments

Comments
 (0)