提交 6d734be9 编写于 作者: P Patrice Chotard 提交者: Patrick Delaunay

reset: stm32: Fix bank and offset computation

BITS_PER_LONG is used to represent register's size which is 32.
But when compiled on arch64, BITS_PER_LONG is then equal to 64.

Fix bank and offset computation to make it work on arch32 and
arch64 and ensure that register's size is always equal to 32.
Signed-off-by: NPatrice Chotard <patrice.chotard@foss.st.com>
Signed-off-by: NPankaj Dev <pankaj.dev@st.com>
Reviewed-by: NPatrick Delaunay <patrick.delaunay@foss.st.com>
上级 a5bb384c
......@@ -40,8 +40,8 @@ static int stm32_reset_free(struct reset_ctl *reset_ctl)
static int stm32_reset_assert(struct reset_ctl *reset_ctl)
{
struct stm32_reset_priv *priv = dev_get_priv(reset_ctl->dev);
int bank = (reset_ctl->id / BITS_PER_LONG) * 4;
int offset = reset_ctl->id % BITS_PER_LONG;
int bank = (reset_ctl->id / (sizeof(u32) * BITS_PER_BYTE)) * 4;
int offset = reset_ctl->id % (sizeof(u32) * BITS_PER_BYTE);
dev_dbg(reset_ctl->dev, "reset id = %ld bank = %d offset = %d)\n",
reset_ctl->id, bank, offset);
......@@ -61,8 +61,8 @@ static int stm32_reset_assert(struct reset_ctl *reset_ctl)
static int stm32_reset_deassert(struct reset_ctl *reset_ctl)
{
struct stm32_reset_priv *priv = dev_get_priv(reset_ctl->dev);
int bank = (reset_ctl->id / BITS_PER_LONG) * 4;
int offset = reset_ctl->id % BITS_PER_LONG;
int bank = (reset_ctl->id / (sizeof(u32) * BITS_PER_BYTE)) * 4;
int offset = reset_ctl->id % (sizeof(u32) * BITS_PER_BYTE);
dev_dbg(reset_ctl->dev, "reset id = %ld bank = %d offset = %d)\n",
reset_ctl->id, bank, offset);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册