| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2012-2015 Altera Corporation |
|---|
| 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 as published by |
|---|
| 6 | | - * the Free Software Foundation; either version 2 of the License, or |
|---|
| 7 | | - * (at your option) any later version. |
|---|
| 8 | | - * |
|---|
| 9 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 10 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 11 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 12 | | - * GNU General Public License for more details. |
|---|
| 13 | | - * |
|---|
| 14 | | - * You should have received a copy of the GNU General Public License |
|---|
| 15 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 16 | 4 | */ |
|---|
| 17 | 5 | #include <linux/irqchip.h> |
|---|
| 18 | 6 | #include <linux/of_address.h> |
|---|
| 19 | 7 | #include <linux/of_irq.h> |
|---|
| 20 | 8 | #include <linux/of_platform.h> |
|---|
| 21 | 9 | #include <linux/reboot.h> |
|---|
| 10 | +#include <linux/reset/socfpga.h> |
|---|
| 22 | 11 | |
|---|
| 23 | 12 | #include <asm/hardware/cache-l2x0.h> |
|---|
| 24 | 13 | #include <asm/mach/arch.h> |
|---|
| .. | .. |
|---|
| 32 | 21 | void __iomem *sdr_ctl_base_addr; |
|---|
| 33 | 22 | unsigned long socfpga_cpu1start_addr; |
|---|
| 34 | 23 | |
|---|
| 35 | | -void __init socfpga_sysmgr_init(void) |
|---|
| 24 | +static void __init socfpga_sysmgr_init(void) |
|---|
| 36 | 25 | { |
|---|
| 37 | 26 | struct device_node *np; |
|---|
| 38 | 27 | |
|---|
| .. | .. |
|---|
| 64 | 53 | |
|---|
| 65 | 54 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) |
|---|
| 66 | 55 | socfpga_init_ocram_ecc(); |
|---|
| 56 | + socfpga_reset_init(); |
|---|
| 67 | 57 | } |
|---|
| 68 | 58 | |
|---|
| 69 | 59 | static void __init socfpga_arria10_init_irq(void) |
|---|
| .. | .. |
|---|
| 74 | 64 | socfpga_init_arria10_l2_ecc(); |
|---|
| 75 | 65 | if (IS_ENABLED(CONFIG_EDAC_ALTERA_OCRAM)) |
|---|
| 76 | 66 | socfpga_init_arria10_ocram_ecc(); |
|---|
| 67 | + socfpga_reset_init(); |
|---|
| 77 | 68 | } |
|---|
| 78 | 69 | |
|---|
| 79 | 70 | static void socfpga_cyclone5_restart(enum reboot_mode mode, const char *cmd) |
|---|
| .. | .. |
|---|
| 82 | 73 | |
|---|
| 83 | 74 | temp = readl(rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL); |
|---|
| 84 | 75 | |
|---|
| 85 | | - if (mode == REBOOT_HARD) |
|---|
| 86 | | - temp |= RSTMGR_CTRL_SWCOLDRSTREQ; |
|---|
| 87 | | - else |
|---|
| 76 | + if (mode == REBOOT_WARM) |
|---|
| 88 | 77 | temp |= RSTMGR_CTRL_SWWARMRSTREQ; |
|---|
| 78 | + else |
|---|
| 79 | + temp |= RSTMGR_CTRL_SWCOLDRSTREQ; |
|---|
| 89 | 80 | writel(temp, rst_manager_base_addr + SOCFPGA_RSTMGR_CTRL); |
|---|
| 90 | 81 | } |
|---|
| 91 | 82 | |
|---|
| .. | .. |
|---|
| 95 | 86 | |
|---|
| 96 | 87 | temp = readl(rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL); |
|---|
| 97 | 88 | |
|---|
| 98 | | - if (mode == REBOOT_HARD) |
|---|
| 99 | | - temp |= RSTMGR_CTRL_SWCOLDRSTREQ; |
|---|
| 100 | | - else |
|---|
| 89 | + if (mode == REBOOT_WARM) |
|---|
| 101 | 90 | temp |= RSTMGR_CTRL_SWWARMRSTREQ; |
|---|
| 91 | + else |
|---|
| 92 | + temp |= RSTMGR_CTRL_SWCOLDRSTREQ; |
|---|
| 102 | 93 | writel(temp, rst_manager_base_addr + SOCFPGA_A10_RSTMGR_CTRL); |
|---|
| 103 | 94 | } |
|---|
| 104 | 95 | |
|---|