forked from Minki/linux
d1da1052ff
This reverts following commit69125b4b94
("reset: tegra-bpmp: Revert Handle errors in BPMP response"). The Tegra194 HDA reset failure is fixed by commitd278dc9151
("ALSA: hda/tegra: Fix Tegra194 HDA reset failure"). The temporary revert of original commitc045ceb5a1
("reset: tegra-bpmp: Handle errors in BPMP response") can be removed now. Signed-off-by: Sameer Pujar <spujar@nvidia.com> Tested-by: Jon Hunter <jonathanh@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Link: https://lore.kernel.org/r/1641995806-15245-1-git-send-email-spujar@nvidia.com
76 lines
1.8 KiB
C
76 lines
1.8 KiB
C
// SPDX-License-Identifier: GPL-2.0-only
|
|
/*
|
|
* Copyright (C) 2016 NVIDIA Corporation
|
|
*/
|
|
|
|
#include <linux/reset-controller.h>
|
|
|
|
#include <soc/tegra/bpmp.h>
|
|
#include <soc/tegra/bpmp-abi.h>
|
|
|
|
static struct tegra_bpmp *to_tegra_bpmp(struct reset_controller_dev *rstc)
|
|
{
|
|
return container_of(rstc, struct tegra_bpmp, rstc);
|
|
}
|
|
|
|
static int tegra_bpmp_reset_common(struct reset_controller_dev *rstc,
|
|
enum mrq_reset_commands command,
|
|
unsigned int id)
|
|
{
|
|
struct tegra_bpmp *bpmp = to_tegra_bpmp(rstc);
|
|
struct mrq_reset_request request;
|
|
struct tegra_bpmp_message msg;
|
|
int err;
|
|
|
|
memset(&request, 0, sizeof(request));
|
|
request.cmd = command;
|
|
request.reset_id = id;
|
|
|
|
memset(&msg, 0, sizeof(msg));
|
|
msg.mrq = MRQ_RESET;
|
|
msg.tx.data = &request;
|
|
msg.tx.size = sizeof(request);
|
|
|
|
err = tegra_bpmp_transfer(bpmp, &msg);
|
|
if (err)
|
|
return err;
|
|
if (msg.rx.ret)
|
|
return -EINVAL;
|
|
|
|
return 0;
|
|
}
|
|
|
|
static int tegra_bpmp_reset_module(struct reset_controller_dev *rstc,
|
|
unsigned long id)
|
|
{
|
|
return tegra_bpmp_reset_common(rstc, CMD_RESET_MODULE, id);
|
|
}
|
|
|
|
static int tegra_bpmp_reset_assert(struct reset_controller_dev *rstc,
|
|
unsigned long id)
|
|
{
|
|
return tegra_bpmp_reset_common(rstc, CMD_RESET_ASSERT, id);
|
|
}
|
|
|
|
static int tegra_bpmp_reset_deassert(struct reset_controller_dev *rstc,
|
|
unsigned long id)
|
|
{
|
|
return tegra_bpmp_reset_common(rstc, CMD_RESET_DEASSERT, id);
|
|
}
|
|
|
|
static const struct reset_control_ops tegra_bpmp_reset_ops = {
|
|
.reset = tegra_bpmp_reset_module,
|
|
.assert = tegra_bpmp_reset_assert,
|
|
.deassert = tegra_bpmp_reset_deassert,
|
|
};
|
|
|
|
int tegra_bpmp_init_resets(struct tegra_bpmp *bpmp)
|
|
{
|
|
bpmp->rstc.ops = &tegra_bpmp_reset_ops;
|
|
bpmp->rstc.owner = THIS_MODULE;
|
|
bpmp->rstc.of_node = bpmp->dev->of_node;
|
|
bpmp->rstc.nr_resets = bpmp->soc->num_resets;
|
|
|
|
return devm_reset_controller_register(bpmp->dev, &bpmp->rstc);
|
|
}
|