Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: sunxi-ng: Implement reset control status readback

Until now we were not providing a way to read back the status of our
reset controls. Consumers had no real way to be certain whether a
peripheral was held in reset or not.

Implement the status callback to complete the API support.

Fixes: 1d80c14248d6 ("clk: sunxi-ng: Add common infrastructure")
Signed-off-by: Chen-Yu Tsai <wens@csie.org>
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>

authored by

Chen-Yu Tsai and committed by
Maxime Ripard
5da672cf a894990a

+14
+14
drivers/clk/sunxi-ng/ccu_reset.c
··· 60 60 return 0; 61 61 } 62 62 63 + static int ccu_reset_status(struct reset_controller_dev *rcdev, 64 + unsigned long id) 65 + { 66 + struct ccu_reset *ccu = rcdev_to_ccu_reset(rcdev); 67 + const struct ccu_reset_map *map = &ccu->reset_map[id]; 68 + 69 + /* 70 + * The reset control API expects 0 if reset is not asserted, 71 + * which is the opposite of what our hardware uses. 72 + */ 73 + return !(map->bit & readl(ccu->base + map->reg)); 74 + } 75 + 63 76 const struct reset_control_ops ccu_reset_ops = { 64 77 .assert = ccu_reset_assert, 65 78 .deassert = ccu_reset_deassert, 66 79 .reset = ccu_reset_reset, 80 + .status = ccu_reset_status, 67 81 };