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