Skip to content

Commit

Permalink
Merge tag 'litex-6.13-rc1' of https://github.com/litex-hub/linux into…
Browse files Browse the repository at this point in the history
… soc/drivers

LiteX updates for next

Remaining LiteX updates from 2024, reviewed and
successfully tested against v6.13-rc1.

Signed-off-by: Gabriel Somlo <gsomlo@gmail.com>

* tag 'litex-6.13-rc1' of https://github.com/litex-hub/linux:
  drivers/soc/litex: Use devm_register_restart_handler()

Link: https://lore.kernel.org/r/Z41PgCffqPUTyxkE@errol.ini.cmu.edu
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
  • Loading branch information
Arnd Bergmann committed Jan 22, 2025
2 parents f51df26 + c734586 commit 9ec8002
Showing 1 changed file with 5 additions and 18 deletions.
23 changes: 5 additions & 18 deletions drivers/soc/litex/litex_soc_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,11 @@ static int litex_check_csr_access(void __iomem *reg_addr)

struct litex_soc_ctrl_device {
void __iomem *base;
struct notifier_block reset_nb;
};

static int litex_reset_handler(struct notifier_block *this, unsigned long mode,
void *cmd)
static int litex_reset_handler(struct sys_off_data *data)
{
struct litex_soc_ctrl_device *soc_ctrl_dev =
container_of(this, struct litex_soc_ctrl_device, reset_nb);
struct litex_soc_ctrl_device *soc_ctrl_dev = data->cb_data;

litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE);
return NOTIFY_DONE;
Expand Down Expand Up @@ -105,11 +102,9 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev)
if (error)
return error;

platform_set_drvdata(pdev, soc_ctrl_dev);

soc_ctrl_dev->reset_nb.notifier_call = litex_reset_handler;
soc_ctrl_dev->reset_nb.priority = 128;
error = register_restart_handler(&soc_ctrl_dev->reset_nb);
error = devm_register_restart_handler(&pdev->dev,
litex_reset_handler,
soc_ctrl_dev);
if (error) {
dev_warn(&pdev->dev, "cannot register restart handler: %d\n",
error);
Expand All @@ -118,20 +113,12 @@ static int litex_soc_ctrl_probe(struct platform_device *pdev)
return 0;
}

static void litex_soc_ctrl_remove(struct platform_device *pdev)
{
struct litex_soc_ctrl_device *soc_ctrl_dev = platform_get_drvdata(pdev);

unregister_restart_handler(&soc_ctrl_dev->reset_nb);
}

static struct platform_driver litex_soc_ctrl_driver = {
.driver = {
.name = "litex-soc-controller",
.of_match_table = litex_soc_ctrl_of_match,
},
.probe = litex_soc_ctrl_probe,
.remove = litex_soc_ctrl_remove,
};

module_platform_driver(litex_soc_ctrl_driver);
Expand Down

0 comments on commit 9ec8002

Please sign in to comment.