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

TOMOYO Linux Cross Reference
Linux/arch/microblaze/kernel/reset.c

Version: ~ [ linux-5.13-rc2 ] ~ [ linux-5.12.4 ] ~ [ linux-5.11.21 ] ~ [ linux-5.10.37 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.119 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.190 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.232 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.268 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.268 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.18.140 ] ~ [ linux-3.16.85 ] ~ [ linux-3.14.79 ] ~ [ linux-3.12.74 ] ~ [ 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.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  * Copyright (C) 2009 Michal Simek <monstr@monstr.eu>
  3  * Copyright (C) 2009 PetaLogix
  4  *
  5  * This file is subject to the terms and conditions of the GNU General Public
  6  * License. See the file "COPYING" in the main directory of this archive
  7  * for more details.
  8  */
  9 
 10 #include <linux/init.h>
 11 #include <linux/of_platform.h>
 12 
 13 /* Trigger specific functions */
 14 #ifdef CONFIG_GPIOLIB
 15 
 16 #include <linux/of_gpio.h>
 17 
 18 static int handle; /* reset pin handle */
 19 static unsigned int reset_val;
 20 
 21 void of_platform_reset_gpio_probe(void)
 22 {
 23         int ret;
 24         handle = of_get_named_gpio(of_find_node_by_path("/"),
 25                                    "hard-reset-gpios", 0);
 26 
 27         if (!gpio_is_valid(handle)) {
 28                 pr_info("Skipping unavailable RESET gpio %d (%s)\n",
 29                                 handle, "reset");
 30                 return;
 31         }
 32 
 33         ret = gpio_request(handle, "reset");
 34         if (ret < 0) {
 35                 pr_info("GPIO pin is already allocated\n");
 36                 return;
 37         }
 38 
 39         /* get current setup value */
 40         reset_val = gpio_get_value(handle);
 41         /* FIXME maybe worth to perform any action */
 42         pr_debug("Reset: Gpio output state: 0x%x\n", reset_val);
 43 
 44         /* Setup GPIO as output */
 45         ret = gpio_direction_output(handle, 0);
 46         if (ret < 0)
 47                 goto err;
 48 
 49         /* Setup output direction */
 50         gpio_set_value(handle, 0);
 51 
 52         pr_info("RESET: Registered gpio device: %d, current val: %d\n",
 53                                                         handle, reset_val);
 54         return;
 55 err:
 56         gpio_free(handle);
 57         return;
 58 }
 59 
 60 
 61 static void gpio_system_reset(void)
 62 {
 63         if (gpio_is_valid(handle))
 64                 gpio_set_value(handle, 1 - reset_val);
 65         else
 66                 pr_notice("Reset GPIO unavailable - halting!\n");
 67 }
 68 #else
 69 static void gpio_system_reset(void)
 70 {
 71         pr_notice("No reset GPIO present - halting!\n");
 72 }
 73 
 74 void of_platform_reset_gpio_probe(void)
 75 {
 76         return;
 77 }
 78 #endif
 79 
 80 void machine_restart(char *cmd)
 81 {
 82         pr_notice("Machine restart...\n");
 83         gpio_system_reset();
 84         while (1)
 85                 ;
 86 }
 87 
 88 void machine_shutdown(void)
 89 {
 90         pr_notice("Machine shutdown...\n");
 91         while (1)
 92                 ;
 93 }
 94 
 95 void machine_halt(void)
 96 {
 97         pr_notice("Machine halt...\n");
 98         while (1)
 99                 ;
100 }
101 
102 void machine_power_off(void)
103 {
104         pr_notice("Machine power off...\n");
105         while (1)
106                 ;
107 }
108 

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

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | 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.

osdn.jp