Skip to content

Commit 9fb961d

Browse files
cristiccbebarino
authored andcommitted
clk: actions: Add Actions S500 SoC Reset Management Unit support
Add Reset Management Unit (RMU) support for Actions Semi S500 SoC. Signed-off-by: Cristian Ciocaltea <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://lore.kernel.org/r/3fba2e6f0edfac97cb8c6ce60f95c24852578eac.1593788312.git.cristian.ciocaltea@gmail.com Signed-off-by: Stephen Boyd <[email protected]>
1 parent fac1d44 commit 9fb961d

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

drivers/clk/actions/owl-s500.c

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@
2323
#include "owl-gate.h"
2424
#include "owl-mux.h"
2525
#include "owl-pll.h"
26+
#include "owl-reset.h"
2627

2728
#include <dt-bindings/clock/actions,s500-cmu.h>
29+
#include <dt-bindings/reset/actions,s500-reset.h>
2830

2931
#define CMU_COREPLL (0x0000)
3032
#define CMU_DEVPLL (0x0004)
@@ -497,20 +499,96 @@ static struct clk_hw_onecell_data s500_hw_clks = {
497499
.num = CLK_NR_CLKS,
498500
};
499501

502+
static const struct owl_reset_map s500_resets[] = {
503+
[RESET_DMAC] = { CMU_DEVRST0, BIT(0) },
504+
[RESET_NORIF] = { CMU_DEVRST0, BIT(1) },
505+
[RESET_DDR] = { CMU_DEVRST0, BIT(2) },
506+
[RESET_NANDC] = { CMU_DEVRST0, BIT(3) },
507+
[RESET_SD0] = { CMU_DEVRST0, BIT(4) },
508+
[RESET_SD1] = { CMU_DEVRST0, BIT(5) },
509+
[RESET_PCM1] = { CMU_DEVRST0, BIT(6) },
510+
[RESET_DE] = { CMU_DEVRST0, BIT(7) },
511+
[RESET_LCD] = { CMU_DEVRST0, BIT(8) },
512+
[RESET_SD2] = { CMU_DEVRST0, BIT(9) },
513+
[RESET_DSI] = { CMU_DEVRST0, BIT(10) },
514+
[RESET_CSI] = { CMU_DEVRST0, BIT(11) },
515+
[RESET_BISP] = { CMU_DEVRST0, BIT(12) },
516+
[RESET_KEY] = { CMU_DEVRST0, BIT(14) },
517+
[RESET_GPIO] = { CMU_DEVRST0, BIT(15) },
518+
[RESET_AUDIO] = { CMU_DEVRST0, BIT(17) },
519+
[RESET_PCM0] = { CMU_DEVRST0, BIT(18) },
520+
[RESET_VDE] = { CMU_DEVRST0, BIT(19) },
521+
[RESET_VCE] = { CMU_DEVRST0, BIT(20) },
522+
[RESET_GPU3D] = { CMU_DEVRST0, BIT(22) },
523+
[RESET_NIC301] = { CMU_DEVRST0, BIT(23) },
524+
[RESET_LENS] = { CMU_DEVRST0, BIT(26) },
525+
[RESET_PERIPHRESET] = { CMU_DEVRST0, BIT(27) },
526+
[RESET_USB2_0] = { CMU_DEVRST1, BIT(0) },
527+
[RESET_TVOUT] = { CMU_DEVRST1, BIT(1) },
528+
[RESET_HDMI] = { CMU_DEVRST1, BIT(2) },
529+
[RESET_HDCP2TX] = { CMU_DEVRST1, BIT(3) },
530+
[RESET_UART6] = { CMU_DEVRST1, BIT(4) },
531+
[RESET_UART0] = { CMU_DEVRST1, BIT(5) },
532+
[RESET_UART1] = { CMU_DEVRST1, BIT(6) },
533+
[RESET_UART2] = { CMU_DEVRST1, BIT(7) },
534+
[RESET_SPI0] = { CMU_DEVRST1, BIT(8) },
535+
[RESET_SPI1] = { CMU_DEVRST1, BIT(9) },
536+
[RESET_SPI2] = { CMU_DEVRST1, BIT(10) },
537+
[RESET_SPI3] = { CMU_DEVRST1, BIT(11) },
538+
[RESET_I2C0] = { CMU_DEVRST1, BIT(12) },
539+
[RESET_I2C1] = { CMU_DEVRST1, BIT(13) },
540+
[RESET_USB3] = { CMU_DEVRST1, BIT(14) },
541+
[RESET_UART3] = { CMU_DEVRST1, BIT(15) },
542+
[RESET_UART4] = { CMU_DEVRST1, BIT(16) },
543+
[RESET_UART5] = { CMU_DEVRST1, BIT(17) },
544+
[RESET_I2C2] = { CMU_DEVRST1, BIT(18) },
545+
[RESET_I2C3] = { CMU_DEVRST1, BIT(19) },
546+
[RESET_ETHERNET] = { CMU_DEVRST1, BIT(20) },
547+
[RESET_CHIPID] = { CMU_DEVRST1, BIT(21) },
548+
[RESET_USB2_1] = { CMU_DEVRST1, BIT(22) },
549+
[RESET_WD0RESET] = { CMU_DEVRST1, BIT(24) },
550+
[RESET_WD1RESET] = { CMU_DEVRST1, BIT(25) },
551+
[RESET_WD2RESET] = { CMU_DEVRST1, BIT(26) },
552+
[RESET_WD3RESET] = { CMU_DEVRST1, BIT(27) },
553+
[RESET_DBG0RESET] = { CMU_DEVRST1, BIT(28) },
554+
[RESET_DBG1RESET] = { CMU_DEVRST1, BIT(29) },
555+
[RESET_DBG2RESET] = { CMU_DEVRST1, BIT(30) },
556+
[RESET_DBG3RESET] = { CMU_DEVRST1, BIT(31) },
557+
};
558+
500559
static struct owl_clk_desc s500_clk_desc = {
501560
.clks = s500_clks,
502561
.num_clks = ARRAY_SIZE(s500_clks),
503562

504563
.hw_clks = &s500_hw_clks,
564+
565+
.resets = s500_resets,
566+
.num_resets = ARRAY_SIZE(s500_resets),
505567
};
506568

507569
static int s500_clk_probe(struct platform_device *pdev)
508570
{
509571
struct owl_clk_desc *desc;
572+
struct owl_reset *reset;
573+
int ret;
510574

511575
desc = &s500_clk_desc;
512576
owl_clk_regmap_init(pdev, desc);
513577

578+
reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL);
579+
if (!reset)
580+
return -ENOMEM;
581+
582+
reset->rcdev.of_node = pdev->dev.of_node;
583+
reset->rcdev.ops = &owl_reset_ops;
584+
reset->rcdev.nr_resets = desc->num_resets;
585+
reset->reset_map = desc->resets;
586+
reset->regmap = desc->regmap;
587+
588+
ret = devm_reset_controller_register(&pdev->dev, &reset->rcdev);
589+
if (ret)
590+
dev_err(&pdev->dev, "Failed to register reset controller\n");
591+
514592
return owl_clk_probe(&pdev->dev, desc->hw_clks);
515593
}
516594

0 commit comments

Comments
 (0)