mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
974b33586b
People are back from the holiday breaks, and it shows. Here are a bunch of fixes for a number of platforms: - A couple of small fixes for Nomadik - A larger set of changes for kirkwood/mvebu - uart driver selection, dt clocks, gpio-poweroff fixups, a few __init annotation fixes and some error handling improvement in their xor dma driver. - i.MX had a couple of minor fixes (and a critical one for flexcan2 clock setup) - MXS has a small board fix and a framebuffer bugfix - A set of fixes for Samsung Exynos, fixing default bootargs and some Exynos5440 clock issues - A set of OMAP changes including PM fixes and a few sparse warning fixups All in all a bit more positive code delta than we'd ideally want to see here, mostly from the OMAP PM changes, but nothing overly crazy. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAABAgAGBQJQ7GYhAAoJEIwa5zzehBx31HMP/jqBBdEAKBoQrVPXgCISTkGp WzpPbFnt17R9uxVZFjsmlcTgBOURSkbDwENVnyJ4ZkVFOAQHOSCriyQFrsgeBAEj WU2FK3E6/V4BHob8hSqmbCjwRUyzOM6z4+oMZQgpBS2y0sgVWFySOE3Fe7cf1IJr 11D5/mzOqRYu8fkXar2ksK752N7O5m9sZoJ4A8cJs1DBL8/a0c6ASZGkaKql0WFn hel6nFznTe/qZwGqjIOaWrFhUe9pmqRlRtTDT5hlmMzC4+O12TEBaFIrJHlq8SkZ nxSdZcD9ERAgp58zMEMzDI0ZNkdXTV3xRtkehTvaJheCpeAGq0J63fEd/Yn4T/V3 fUeNrUqNLl59dZEvFS1Xm/2dpYLrUDCkNWQoTAjLAfEmJ1v9vjcP22seXD9tzXtl XdcjEIOnAb+d3J6D3vW1EvgPiTrS0EId5Mkv/LSIAyR0OAjqJr3L/keUUG2OVH1q UW7V052KEW0P0jDQnmhxNkkl8fnZCQtLRH9ukVs2qIbH28QBaH3irdFv+S74P2l2 MWBqh21dm//PBJQqg1ujf0nl7IuCqDVaUYt6VYholGaRoyMaCSVsazJwC0/kzTNz EYVI8kAUIWQnAxXL5uN3oiqoSASKOfwtHGOJB7CB2FgdEVNWhdUpLk0xDi5ssF8o Iatq6W91y3xCkLhIP+77 =s9fE -----END PGP SIGNATURE----- Merge tag 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc Pull ARM SoC fixes from Olof Johansson: "People are back from the holiday breaks, and it shows. Here are a bunch of fixes for a number of platforms: - A couple of small fixes for Nomadik - A larger set of changes for kirkwood/mvebu - uart driver selection, dt clocks, gpio-poweroff fixups, a few __init annotation fixes and some error handling improvement in their xor dma driver. - i.MX had a couple of minor fixes (and a critical one for flexcan2 clock setup) - MXS has a small board fix and a framebuffer bugfix - A set of fixes for Samsung Exynos, fixing default bootargs and some Exynos5440 clock issues - A set of OMAP changes including PM fixes and a few sparse warning fixups All in all a bit more positive code delta than we'd ideally want to see here, mostly from the OMAP PM changes, but nothing overly crazy." * tag 'fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc: (44 commits) ARM: clps711x: Fix bad merge of clockevents setup ARM: highbank: save and restore L2 cache and GIC on suspend ARM: highbank: add a power request clear ARM: highbank: fix secondary boot and hotplug ARM: highbank: fix typos with hignbank in power request functions ARM: dts: fix highbank cpu mpidr values ARM: dts: add device_type prop to cpu nodes on Calxeda platforms ARM: mx5: Fix MX53 flexcan2 clock ARM: OMAP2+: am33xx-hwmod: Fix wrongly terminated am33xx_usbss_mpu_irqs array pinctrl: mvebu: make pdma clock on dove mandatory ARM: Dove: Add pinctrl clock to DT dma: mv_xor: fix error handling for clocks dma: mv_xor: fix error handling of mv_xor_channel_add() arm: mvebu: Add missing ; for cpu node. arm: mvebu: Armada XP MV78230 has only three Ethernet interfaces arm: mvebu: Armada XP MV78230 has two cores, not one clk: mvebu: Remove inappropriate __init tagging ARM: Kirkwood: Use fixed-regulator instead of board gpio call ARM: Kirkwood: Fix missing sdio clock ARM: Kirkwood: Switch TWSI1 of 88f6282 to DT clock providers ...
127 lines
2.9 KiB
C
127 lines
2.9 KiB
C
/*
|
|
* Toggles a GPIO pin to power down a device
|
|
*
|
|
* Jamie Lentin <jm@lentin.co.uk>
|
|
* Andrew Lunn <andrew@lunn.ch>
|
|
*
|
|
* Copyright (C) 2012 Jamie Lentin
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
*/
|
|
#include <linux/kernel.h>
|
|
#include <linux/init.h>
|
|
#include <linux/delay.h>
|
|
#include <linux/platform_device.h>
|
|
#include <linux/gpio.h>
|
|
#include <linux/of_platform.h>
|
|
#include <linux/of_gpio.h>
|
|
#include <linux/module.h>
|
|
|
|
/*
|
|
* Hold configuration here, cannot be more than one instance of the driver
|
|
* since pm_power_off itself is global.
|
|
*/
|
|
static int gpio_num = -1;
|
|
static int gpio_active_low;
|
|
|
|
static void gpio_poweroff_do_poweroff(void)
|
|
{
|
|
BUG_ON(!gpio_is_valid(gpio_num));
|
|
|
|
/* drive it active, also inactive->active edge */
|
|
gpio_direction_output(gpio_num, !gpio_active_low);
|
|
mdelay(100);
|
|
/* drive inactive, also active->inactive edge */
|
|
gpio_set_value(gpio_num, gpio_active_low);
|
|
mdelay(100);
|
|
|
|
/* drive it active, also inactive->active edge */
|
|
gpio_set_value(gpio_num, !gpio_active_low);
|
|
|
|
/* give it some time */
|
|
mdelay(3000);
|
|
|
|
WARN_ON(1);
|
|
}
|
|
|
|
static int gpio_poweroff_probe(struct platform_device *pdev)
|
|
{
|
|
enum of_gpio_flags flags;
|
|
bool input = false;
|
|
int ret;
|
|
|
|
/* If a pm_power_off function has already been added, leave it alone */
|
|
if (pm_power_off != NULL) {
|
|
pr_err("%s: pm_power_off function already registered",
|
|
__func__);
|
|
return -EBUSY;
|
|
}
|
|
|
|
gpio_num = of_get_gpio_flags(pdev->dev.of_node, 0, &flags);
|
|
if (!gpio_is_valid(gpio_num))
|
|
return gpio_num;
|
|
|
|
gpio_active_low = flags & OF_GPIO_ACTIVE_LOW;
|
|
|
|
input = of_property_read_bool(pdev->dev.of_node, "input");
|
|
|
|
ret = gpio_request(gpio_num, "poweroff-gpio");
|
|
if (ret) {
|
|
pr_err("%s: Could not get GPIO %d", __func__, gpio_num);
|
|
return ret;
|
|
}
|
|
if (input) {
|
|
if (gpio_direction_input(gpio_num)) {
|
|
pr_err("Could not set direction of GPIO %d to input",
|
|
gpio_num);
|
|
goto err;
|
|
}
|
|
} else {
|
|
if (gpio_direction_output(gpio_num, gpio_active_low)) {
|
|
pr_err("Could not set direction of GPIO %d", gpio_num);
|
|
goto err;
|
|
}
|
|
}
|
|
|
|
pm_power_off = &gpio_poweroff_do_poweroff;
|
|
return 0;
|
|
|
|
err:
|
|
gpio_free(gpio_num);
|
|
return -ENODEV;
|
|
}
|
|
|
|
static int gpio_poweroff_remove(struct platform_device *pdev)
|
|
{
|
|
gpio_free(gpio_num);
|
|
if (pm_power_off == &gpio_poweroff_do_poweroff)
|
|
pm_power_off = NULL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static const struct of_device_id of_gpio_poweroff_match[] = {
|
|
{ .compatible = "gpio-poweroff", },
|
|
{},
|
|
};
|
|
|
|
static struct platform_driver gpio_poweroff_driver = {
|
|
.probe = gpio_poweroff_probe,
|
|
.remove = gpio_poweroff_remove,
|
|
.driver = {
|
|
.name = "poweroff-gpio",
|
|
.owner = THIS_MODULE,
|
|
.of_match_table = of_gpio_poweroff_match,
|
|
},
|
|
};
|
|
|
|
module_platform_driver(gpio_poweroff_driver);
|
|
|
|
MODULE_AUTHOR("Jamie Lentin <jm@lentin.co.uk>");
|
|
MODULE_DESCRIPTION("GPIO poweroff driver");
|
|
MODULE_LICENSE("GPL v2");
|
|
MODULE_ALIAS("platform:poweroff-gpio");
|