~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/arm/mach-mvebu/kirkwood-pm.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * Power Management driver for Marvell Kirkwood SoCs
  4  *
  5  * Copyright (C) 2013 Ezequiel Garcia <ezequiel@free-electrons.com>
  6  * Copyright (C) 2010 Simon Guinot <sguinot@lacie.com>
  7  */
  8 
  9 #include <linux/kernel.h>
 10 #include <linux/suspend.h>
 11 #include <linux/io.h>
 12 #include "kirkwood.h"
 13 #include "kirkwood-pm.h"
 14 
 15 static void __iomem *ddr_operation_base;
 16 static void __iomem *memory_pm_ctrl;
 17 
 18 static void kirkwood_low_power(void)
 19 {
 20         u32 mem_pm_ctrl;
 21 
 22         mem_pm_ctrl = readl(memory_pm_ctrl);
 23 
 24         /* Set peripherals to low-power mode */
 25         writel_relaxed(~0, memory_pm_ctrl);
 26 
 27         /* Set DDR in self-refresh */
 28         writel_relaxed(0x7, ddr_operation_base);
 29 
 30         /*
 31          * Set CPU in wait-for-interrupt state.
 32          * This disables the CPU core clocks,
 33          * the array clocks, and also the L2 controller.
 34          */
 35         cpu_do_idle();
 36 
 37         writel_relaxed(mem_pm_ctrl, memory_pm_ctrl);
 38 }
 39 
 40 static int kirkwood_suspend_enter(suspend_state_t state)
 41 {
 42         switch (state) {
 43         case PM_SUSPEND_STANDBY:
 44                 kirkwood_low_power();
 45                 break;
 46         default:
 47                 return -EINVAL;
 48         }
 49         return 0;
 50 }
 51 
 52 static int kirkwood_pm_valid_standby(suspend_state_t state)
 53 {
 54         return state == PM_SUSPEND_STANDBY;
 55 }
 56 
 57 static const struct platform_suspend_ops kirkwood_suspend_ops = {
 58         .enter = kirkwood_suspend_enter,
 59         .valid = kirkwood_pm_valid_standby,
 60 };
 61 
 62 void __init kirkwood_pm_init(void)
 63 {
 64         ddr_operation_base = ioremap(DDR_OPERATION_BASE, 4);
 65         memory_pm_ctrl = ioremap(MEMORY_PM_CTRL_PHYS, 4);
 66 
 67         suspend_set_ops(&kirkwood_suspend_ops);
 68 }
 69 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php