| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (c) 2013 Heiko Stuebner <heiko@sntech.de> |
|---|
| 3 | | - * |
|---|
| 4 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 5 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 6 | | - * published by the Free Software Foundation. |
|---|
| 7 | 4 | * |
|---|
| 8 | 5 | * Common Clock Framework support for S3C2412 and S3C2413. |
|---|
| 9 | 6 | */ |
|---|
| 10 | 7 | |
|---|
| 11 | 8 | #include <linux/clk-provider.h> |
|---|
| 9 | +#include <linux/clk/samsung.h> |
|---|
| 10 | +#include <linux/io.h> |
|---|
| 12 | 11 | #include <linux/of.h> |
|---|
| 13 | 12 | #include <linux/of_address.h> |
|---|
| 14 | | -#include <linux/syscore_ops.h> |
|---|
| 15 | 13 | #include <linux/reboot.h> |
|---|
| 16 | 14 | |
|---|
| 17 | 15 | #include <dt-bindings/clock/s3c2412.h> |
|---|
| .. | .. |
|---|
| 29 | 27 | |
|---|
| 30 | 28 | static void __iomem *reg_base; |
|---|
| 31 | 29 | |
|---|
| 32 | | -#ifdef CONFIG_PM_SLEEP |
|---|
| 33 | | -static struct samsung_clk_reg_dump *s3c2412_save; |
|---|
| 34 | | - |
|---|
| 35 | 30 | /* |
|---|
| 36 | 31 | * list of controller registers to be saved and restored during a |
|---|
| 37 | 32 | * suspend/resume cycle. |
|---|
| .. | .. |
|---|
| 44 | 39 | CLKDIVN, |
|---|
| 45 | 40 | CLKSRC, |
|---|
| 46 | 41 | }; |
|---|
| 47 | | - |
|---|
| 48 | | -static int s3c2412_clk_suspend(void) |
|---|
| 49 | | -{ |
|---|
| 50 | | - samsung_clk_save(reg_base, s3c2412_save, |
|---|
| 51 | | - ARRAY_SIZE(s3c2412_clk_regs)); |
|---|
| 52 | | - |
|---|
| 53 | | - return 0; |
|---|
| 54 | | -} |
|---|
| 55 | | - |
|---|
| 56 | | -static void s3c2412_clk_resume(void) |
|---|
| 57 | | -{ |
|---|
| 58 | | - samsung_clk_restore(reg_base, s3c2412_save, |
|---|
| 59 | | - ARRAY_SIZE(s3c2412_clk_regs)); |
|---|
| 60 | | -} |
|---|
| 61 | | - |
|---|
| 62 | | -static struct syscore_ops s3c2412_clk_syscore_ops = { |
|---|
| 63 | | - .suspend = s3c2412_clk_suspend, |
|---|
| 64 | | - .resume = s3c2412_clk_resume, |
|---|
| 65 | | -}; |
|---|
| 66 | | - |
|---|
| 67 | | -static void __init s3c2412_clk_sleep_init(void) |
|---|
| 68 | | -{ |
|---|
| 69 | | - s3c2412_save = samsung_clk_alloc_reg_dump(s3c2412_clk_regs, |
|---|
| 70 | | - ARRAY_SIZE(s3c2412_clk_regs)); |
|---|
| 71 | | - if (!s3c2412_save) { |
|---|
| 72 | | - pr_warn("%s: failed to allocate sleep save data, no sleep support!\n", |
|---|
| 73 | | - __func__); |
|---|
| 74 | | - return; |
|---|
| 75 | | - } |
|---|
| 76 | | - |
|---|
| 77 | | - register_syscore_ops(&s3c2412_clk_syscore_ops); |
|---|
| 78 | | - return; |
|---|
| 79 | | -} |
|---|
| 80 | | -#else |
|---|
| 81 | | -static void __init s3c2412_clk_sleep_init(void) {} |
|---|
| 82 | | -#endif |
|---|
| 83 | 42 | |
|---|
| 84 | 43 | static struct clk_div_table divxti_d[] = { |
|---|
| 85 | 44 | { .val = 0, .div = 1 }, |
|---|
| .. | .. |
|---|
| 278 | 237 | samsung_clk_register_alias(ctx, s3c2412_aliases, |
|---|
| 279 | 238 | ARRAY_SIZE(s3c2412_aliases)); |
|---|
| 280 | 239 | |
|---|
| 281 | | - s3c2412_clk_sleep_init(); |
|---|
| 240 | + samsung_clk_sleep_init(reg_base, s3c2412_clk_regs, |
|---|
| 241 | + ARRAY_SIZE(s3c2412_clk_regs)); |
|---|
| 282 | 242 | |
|---|
| 283 | 243 | samsung_clk_of_add_provider(np, ctx); |
|---|
| 284 | 244 | |
|---|