diff mbox series

[v2,4/5] lib: utils/timer: Allow ACLINT MTIMER supporting only 32-bit MMIO

Message ID 20210807133322.545675-5-anup.patel@wdc.com
State Accepted
Headers show
Series ACLINT MTIMER improvements | expand

Commit Message

Anup Patel Aug. 7, 2021, 1:33 p.m. UTC
We can have ACLINT MTIMER devices which only support 32-bit MMIO
accesses on RV64 system so this patch adds a boolean DT property
"mtimer,no-64bit-mmio" to detect this from MTIMER DT node.

Signed-off-by: Anup Patel <anup.patel@wdc.com>
---
 lib/utils/timer/fdt_timer_mtimer.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Atish Patra Aug. 11, 2021, 4:28 p.m. UTC | #1
On Sat, Aug 7, 2021 at 6:34 AM Anup Patel <anup.patel@wdc.com> wrote:
>
> We can have ACLINT MTIMER devices which only support 32-bit MMIO
> accesses on RV64 system so this patch adds a boolean DT property
> "mtimer,no-64bit-mmio" to detect this from MTIMER DT node.
>
> Signed-off-by: Anup Patel <anup.patel@wdc.com>
> ---
>  lib/utils/timer/fdt_timer_mtimer.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/lib/utils/timer/fdt_timer_mtimer.c b/lib/utils/timer/fdt_timer_mtimer.c
> index b08ed38..15a36ed 100644
> --- a/lib/utils/timer/fdt_timer_mtimer.c
> +++ b/lib/utils/timer/fdt_timer_mtimer.c
> @@ -58,6 +58,9 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff,
>                 mt->mtime_size = size[0];
>                 mt->mtimecmp_addr = addr[1];
>                 mt->mtimecmp_size = size[1];
> +               /* Parse additional ACLINT MTIMER properties */
> +               if (fdt_getprop(fdt, nodeoff, "mtimer,no-64bit-mmio", &rc))
> +                       mt->has_64bit_mmio = false;
>         }
>
>         rc = aclint_mtimer_cold_init(mt, mtmaster);
> --
> 2.25.1
>
>
> --
> opensbi mailing list
> opensbi@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/opensbi


Reviewed-by: Atish Patra <atish.patra@wdc.com>
Anup Patel Aug. 14, 2021, 3:50 a.m. UTC | #2
On Wed, Aug 11, 2021 at 9:58 PM Atish Patra <atishp@atishpatra.org> wrote:
>
> On Sat, Aug 7, 2021 at 6:34 AM Anup Patel <anup.patel@wdc.com> wrote:
> >
> > We can have ACLINT MTIMER devices which only support 32-bit MMIO
> > accesses on RV64 system so this patch adds a boolean DT property
> > "mtimer,no-64bit-mmio" to detect this from MTIMER DT node.
> >
> > Signed-off-by: Anup Patel <anup.patel@wdc.com>
> > ---
> >  lib/utils/timer/fdt_timer_mtimer.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/lib/utils/timer/fdt_timer_mtimer.c b/lib/utils/timer/fdt_timer_mtimer.c
> > index b08ed38..15a36ed 100644
> > --- a/lib/utils/timer/fdt_timer_mtimer.c
> > +++ b/lib/utils/timer/fdt_timer_mtimer.c
> > @@ -58,6 +58,9 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff,
> >                 mt->mtime_size = size[0];
> >                 mt->mtimecmp_addr = addr[1];
> >                 mt->mtimecmp_size = size[1];
> > +               /* Parse additional ACLINT MTIMER properties */
> > +               if (fdt_getprop(fdt, nodeoff, "mtimer,no-64bit-mmio", &rc))
> > +                       mt->has_64bit_mmio = false;
> >         }
> >
> >         rc = aclint_mtimer_cold_init(mt, mtmaster);
> > --
> > 2.25.1
> >
> >
> > --
> > opensbi mailing list
> > opensbi@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/opensbi
>
>
> Reviewed-by: Atish Patra <atish.patra@wdc.com>

Applied this patch to the riscv/opensbi repo.

Regards,
Anup

>
> --
> Regards,
> Atish
diff mbox series

Patch

diff --git a/lib/utils/timer/fdt_timer_mtimer.c b/lib/utils/timer/fdt_timer_mtimer.c
index b08ed38..15a36ed 100644
--- a/lib/utils/timer/fdt_timer_mtimer.c
+++ b/lib/utils/timer/fdt_timer_mtimer.c
@@ -58,6 +58,9 @@  static int timer_mtimer_cold_init(void *fdt, int nodeoff,
 		mt->mtime_size = size[0];
 		mt->mtimecmp_addr = addr[1];
 		mt->mtimecmp_size = size[1];
+		/* Parse additional ACLINT MTIMER properties */
+		if (fdt_getprop(fdt, nodeoff, "mtimer,no-64bit-mmio", &rc))
+			mt->has_64bit_mmio = false;
 	}
 
 	rc = aclint_mtimer_cold_init(mt, mtmaster);