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

clk: actions: Add Actions Semi S700 SoC Reset Management Unit support

Add Reset Management Unit (RMU) support for Actions Semi S700 SoC.

Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>

authored by

Manivannan Sadhasivam and committed by
Stephen Boyd
c4dd4a2e 09dbde01

+51
+51
drivers/clk/actions/owl-s700.c
··· 20 20 #include "owl-gate.h" 21 21 #include "owl-mux.h" 22 22 #include "owl-pll.h" 23 + #include "owl-reset.h" 23 24 24 25 #include <dt-bindings/clock/actions,s700-cmu.h> 26 + #include <dt-bindings/reset/actions,s700-reset.h> 25 27 26 28 #define CMU_COREPLL (0x0000) 27 29 #define CMU_DEVPLL (0x0004) ··· 571 569 .num = CLK_NR_CLKS, 572 570 }; 573 571 572 + static const struct owl_reset_map s700_resets[] = { 573 + [RESET_DE] = { CMU_DEVRST0, BIT(0) }, 574 + [RESET_LCD0] = { CMU_DEVRST0, BIT(1) }, 575 + [RESET_DSI] = { CMU_DEVRST0, BIT(2) }, 576 + [RESET_CSI] = { CMU_DEVRST0, BIT(13) }, 577 + [RESET_SI] = { CMU_DEVRST0, BIT(14) }, 578 + [RESET_I2C0] = { CMU_DEVRST1, BIT(0) }, 579 + [RESET_I2C1] = { CMU_DEVRST1, BIT(1) }, 580 + [RESET_I2C2] = { CMU_DEVRST1, BIT(2) }, 581 + [RESET_I2C3] = { CMU_DEVRST1, BIT(3) }, 582 + [RESET_SPI0] = { CMU_DEVRST1, BIT(4) }, 583 + [RESET_SPI1] = { CMU_DEVRST1, BIT(5) }, 584 + [RESET_SPI2] = { CMU_DEVRST1, BIT(6) }, 585 + [RESET_SPI3] = { CMU_DEVRST1, BIT(7) }, 586 + [RESET_UART0] = { CMU_DEVRST1, BIT(8) }, 587 + [RESET_UART1] = { CMU_DEVRST1, BIT(9) }, 588 + [RESET_UART2] = { CMU_DEVRST1, BIT(10) }, 589 + [RESET_UART3] = { CMU_DEVRST1, BIT(11) }, 590 + [RESET_UART4] = { CMU_DEVRST1, BIT(12) }, 591 + [RESET_UART5] = { CMU_DEVRST1, BIT(13) }, 592 + [RESET_UART6] = { CMU_DEVRST1, BIT(14) }, 593 + [RESET_KEY] = { CMU_DEVRST1, BIT(24) }, 594 + [RESET_GPIO] = { CMU_DEVRST1, BIT(25) }, 595 + [RESET_AUDIO] = { CMU_DEVRST1, BIT(29) }, 596 + }; 597 + 574 598 static struct owl_clk_desc s700_clk_desc = { 575 599 .clks = s700_clks, 576 600 .num_clks = ARRAY_SIZE(s700_clks), 577 601 578 602 .hw_clks = &s700_hw_clks, 603 + 604 + .resets = s700_resets, 605 + .num_resets = ARRAY_SIZE(s700_resets), 579 606 }; 580 607 581 608 static int s700_clk_probe(struct platform_device *pdev) 582 609 { 583 610 struct owl_clk_desc *desc; 611 + struct owl_reset *reset; 612 + int ret; 584 613 585 614 desc = &s700_clk_desc; 586 615 owl_clk_regmap_init(pdev, desc); 616 + 617 + /* 618 + * FIXME: Reset controller registration should be moved to 619 + * common code, once all SoCs of Owl family supports it. 620 + */ 621 + reset = devm_kzalloc(&pdev->dev, sizeof(*reset), GFP_KERNEL); 622 + if (!reset) 623 + return -ENOMEM; 624 + 625 + reset->rcdev.of_node = pdev->dev.of_node; 626 + reset->rcdev.ops = &owl_reset_ops; 627 + reset->rcdev.nr_resets = desc->num_resets; 628 + reset->reset_map = desc->resets; 629 + reset->regmap = desc->regmap; 630 + 631 + ret = devm_reset_controller_register(&pdev->dev, &reset->rcdev); 632 + if (ret) 633 + dev_err(&pdev->dev, "Failed to register reset controller\n"); 587 634 588 635 return owl_clk_probe(&pdev->dev, desc->hw_clks); 589 636 }