forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'for-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/gi…
…t/sre/linux-power-supply Pull power supply and reset updates from Sebastian Reichel: - Microsemi Ocelot reset support - Spreadtrum SC27xx reset support - generic gpio charger: lot's of cleanups - axp20x fuel gauge: add AXP813 support - misc fixes, including one devicetree change for the Nokia N900, that has been Acked-by Tony Lindgren * tag 'for-v4.17' of git://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply: (27 commits) power: reset: at91-reset: Switch from the pr_*() to the dev_*() logging functions power: reset: at91-poweroff: Remove redundant dev_err call in at91_poweroff_probe() power: reset: at91-poweroff: Switch from the pr_*() to the dev_*() logging functions power: reset: make function sc27xx_poweroff_shutdown static power: supply: da9150-fg: remove VLA usage ARM: dts: omap3-n900: Add link between battery and charger power: supply: bq2415x: add DT referencing support power: supply: bq27xxx: support missing supplier device max17042: propagate of_node to power supply device power: supply: axp288_fuel_gauge: Fix full status reporting power: supply: axp288_fuel_gauge: Do not register FG on ECS EF20EA power: reset: gpio-poweroff: Support for timeout from device property dt-bindings: power: reset: gpio-poweroff: Add 'timeout-ms' property power: reset: Add Spreadtrum SC27xx PMIC power off support power: supply: axp20x_battery: add support for AXP813 dt-bindings: power: supply: axp20x: add AXP813 battery DT binding power: supply: axp20x_battery: use data struct for variant specific code power: supply: gpio-charger: Remove pdata from gpio_charger power: supply: gpio-charger: Use GPIOF_ACTIVE_LOW for legacy setup power: supply: gpio-charger: Remove redundant dev_err call in probe function ...
- Loading branch information
Showing
20 changed files
with
500 additions
and
201 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Documentation/devicetree/bindings/power/reset/ocelot-reset.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Microsemi Ocelot reset controller | ||
|
||
The DEVCPU_GCB:CHIP_REGS have a SOFT_RST register that can be used to reset the | ||
SoC MIPS core. | ||
|
||
Required Properties: | ||
- compatible: "mscc,ocelot-chip-reset" | ||
|
||
Example: | ||
reset@1070008 { | ||
compatible = "mscc,ocelot-chip-reset"; | ||
reg = <0x1070008 0x4>; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
// SPDX-License-Identifier: (GPL-2.0 OR MIT) | ||
/* | ||
* Microsemi MIPS SoC reset driver | ||
* | ||
* License: Dual MIT/GPL | ||
* Copyright (c) 2017 Microsemi Corporation | ||
*/ | ||
#include <linux/delay.h> | ||
#include <linux/io.h> | ||
#include <linux/notifier.h> | ||
#include <linux/mfd/syscon.h> | ||
#include <linux/of_address.h> | ||
#include <linux/of_device.h> | ||
#include <linux/platform_device.h> | ||
#include <linux/reboot.h> | ||
#include <linux/regmap.h> | ||
|
||
struct ocelot_reset_context { | ||
void __iomem *base; | ||
struct regmap *cpu_ctrl; | ||
struct notifier_block restart_handler; | ||
}; | ||
|
||
#define ICPU_CFG_CPU_SYSTEM_CTRL_RESET 0x20 | ||
#define CORE_RST_PROTECT BIT(2) | ||
|
||
#define SOFT_CHIP_RST BIT(0) | ||
|
||
static int ocelot_restart_handle(struct notifier_block *this, | ||
unsigned long mode, void *cmd) | ||
{ | ||
struct ocelot_reset_context *ctx = container_of(this, struct | ||
ocelot_reset_context, | ||
restart_handler); | ||
|
||
/* Make sure the core is not protected from reset */ | ||
regmap_update_bits(ctx->cpu_ctrl, ICPU_CFG_CPU_SYSTEM_CTRL_RESET, | ||
CORE_RST_PROTECT, 0); | ||
|
||
writel(SOFT_CHIP_RST, ctx->base); | ||
|
||
pr_emerg("Unable to restart system\n"); | ||
return NOTIFY_DONE; | ||
} | ||
|
||
static int ocelot_reset_probe(struct platform_device *pdev) | ||
{ | ||
struct ocelot_reset_context *ctx; | ||
struct resource *res; | ||
|
||
struct device *dev = &pdev->dev; | ||
int err; | ||
|
||
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); | ||
if (!ctx) | ||
return -ENOMEM; | ||
|
||
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
ctx->base = devm_ioremap_resource(dev, res); | ||
if (IS_ERR(ctx->base)) | ||
return PTR_ERR(ctx->base); | ||
|
||
ctx->cpu_ctrl = syscon_regmap_lookup_by_compatible("mscc,ocelot-cpu-syscon"); | ||
if (IS_ERR(ctx->cpu_ctrl)) | ||
return PTR_ERR(ctx->cpu_ctrl); | ||
|
||
ctx->restart_handler.notifier_call = ocelot_restart_handle; | ||
ctx->restart_handler.priority = 192; | ||
err = register_restart_handler(&ctx->restart_handler); | ||
if (err) | ||
dev_err(dev, "can't register restart notifier (err=%d)\n", err); | ||
|
||
return err; | ||
} | ||
|
||
static const struct of_device_id ocelot_reset_of_match[] = { | ||
{ .compatible = "mscc,ocelot-chip-reset" }, | ||
{} | ||
}; | ||
|
||
static struct platform_driver ocelot_reset_driver = { | ||
.probe = ocelot_reset_probe, | ||
.driver = { | ||
.name = "ocelot-chip-reset", | ||
.of_match_table = ocelot_reset_of_match, | ||
}, | ||
}; | ||
builtin_platform_driver(ocelot_reset_driver); |
Oops, something went wrong.