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

TOMOYO Linux Cross Reference
Linux/arch/sparc/kernel/pmc.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
  2 /* pmc - Driver implementation for power management functions
  3  * of Power Management Controller (PMC) on SPARCstation-Voyager.
  4  *
  5  * Copyright (c) 2002 Eric Brower (ebrower@usa.net)
  6  */
  7 
  8 #include <linux/kernel.h>
  9 #include <linux/fs.h>
 10 #include <linux/errno.h>
 11 #include <linux/init.h>
 12 #include <linux/pm.h>
 13 #include <linux/of.h>
 14 #include <linux/platform_device.h>
 15 #include <linux/module.h>
 16 
 17 #include <asm/io.h>
 18 #include <asm/oplib.h>
 19 #include <linux/uaccess.h>
 20 #include <asm/auxio.h>
 21 #include <asm/processor.h>
 22 
 23 /* Debug
 24  *
 25  * #define PMC_DEBUG_LED
 26  * #define PMC_NO_IDLE
 27  */
 28 
 29 #define PMC_OBPNAME     "SUNW,pmc"
 30 #define PMC_DEVNAME     "pmc"
 31 
 32 #define PMC_IDLE_REG    0x00
 33 #define PMC_IDLE_ON     0x01
 34 
 35 static u8 __iomem *regs;
 36 
 37 #define pmc_readb(offs)         (sbus_readb(regs+offs))
 38 #define pmc_writeb(val, offs)   (sbus_writeb(val, regs+offs))
 39 
 40 /*
 41  * CPU idle callback function
 42  * See .../arch/sparc/kernel/process.c
 43  */
 44 static void pmc_swift_idle(void)
 45 {
 46 #ifdef PMC_DEBUG_LED
 47         set_auxio(0x00, AUXIO_LED);
 48 #endif
 49 
 50         pmc_writeb(pmc_readb(PMC_IDLE_REG) | PMC_IDLE_ON, PMC_IDLE_REG);
 51 
 52 #ifdef PMC_DEBUG_LED
 53         set_auxio(AUXIO_LED, 0x00);
 54 #endif
 55 }
 56 
 57 static int pmc_probe(struct platform_device *op)
 58 {
 59         regs = of_ioremap(&op->resource[0], 0,
 60                           resource_size(&op->resource[0]), PMC_OBPNAME);
 61         if (!regs) {
 62                 printk(KERN_ERR "%s: unable to map registers\n", PMC_DEVNAME);
 63                 return -ENODEV;
 64         }
 65 
 66 #ifndef PMC_NO_IDLE
 67         /* Assign power management IDLE handler */
 68         sparc_idle = pmc_swift_idle;
 69 #endif
 70 
 71         printk(KERN_INFO "%s: power management initialized\n", PMC_DEVNAME);
 72         return 0;
 73 }
 74 
 75 static const struct of_device_id pmc_match[] = {
 76         {
 77                 .name = PMC_OBPNAME,
 78         },
 79         {},
 80 };
 81 MODULE_DEVICE_TABLE(of, pmc_match);
 82 
 83 static struct platform_driver pmc_driver = {
 84         .driver = {
 85                 .name = "pmc",
 86                 .of_match_table = pmc_match,
 87         },
 88         .probe          = pmc_probe,
 89 };
 90 
 91 static int __init pmc_init(void)
 92 {
 93         return platform_driver_register(&pmc_driver);
 94 }
 95 
 96 /* This driver is not critical to the boot process
 97  * and is easiest to ioremap when SBus is already
 98  * initialized, so we install ourselves thusly:
 99  */
100 __initcall(pmc_init);
101 

~ [ 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