diff mbox series

[U-Boot] watchdog: dm: Support manual relocation for watchdogs

Message ID d9a10afb93641c8d03eb784cf4d144c692aea9e1.1531320086.git.michal.simek@xilinx.com
State Accepted
Commit f238b3f0fbc9ebc3a9702ddfc5ef22dff09f35d8
Delegated to: Simon Glass
Headers show
Series [U-Boot] watchdog: dm: Support manual relocation for watchdogs | expand

Commit Message

Michal Simek July 11, 2018, 2:41 p.m. UTC
Relocate watchdog ops as was done by:
"dm: Add support for all targets which requires MANUAL_RELOC"
(sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html

---
 drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

Comments

Simon Glass July 11, 2018, 8:13 p.m. UTC | #1
On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
> Relocate watchdog ops as was done by:
> "dm: Add support for all targets which requires MANUAL_RELOC"
> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>
> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> ---
>
> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>
> ---
>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

When will the toolchain be fixed?
Michal Simek July 12, 2018, 5:47 a.m. UTC | #2
On 11.7.2018 22:13, Simon Glass wrote:
> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>> Relocate watchdog ops as was done by:
>> "dm: Add support for all targets which requires MANUAL_RELOC"
>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>>
>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> ---
>>
>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>>
>> ---
>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>>  1 file changed, 23 insertions(+)
>>
> 
> Reviewed-by: Simon Glass <sjg@chromium.org>
> 
> When will the toolchain be fixed?

It is really several years back when I have looked at it last time but I
think that toolchain is fixed for quite some time and only changes in
microblaze u-boot code are needed but really I would have to check and
start to play with it.

Thanks,
Michal
Simon Glass July 15, 2018, 9:21 p.m. UTC | #3
Hi Michal,

On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
> On 11.7.2018 22:13, Simon Glass wrote:
>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>>> Relocate watchdog ops as was done by:
>>> "dm: Add support for all targets which requires MANUAL_RELOC"
>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>>>
>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>> ---
>>>
>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>>>
>>> ---
>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>>>  1 file changed, 23 insertions(+)
>>>
>>
>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>
>> When will the toolchain be fixed?
>
> It is really several years back when I have looked at it last time but I
> think that toolchain is fixed for quite some time and only changes in
> microblaze u-boot code are needed but really I would have to check and
> start to play with it.

I think someone should sort this out. It would be good to remove this
code. Is there a toolchain group at Xilinx?

Regards,
Simon
Michal Simek July 16, 2018, 5:34 a.m. UTC | #4
On 15.7.2018 23:21, Simon Glass wrote:
> Hi Michal,
> 
> On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
>> On 11.7.2018 22:13, Simon Glass wrote:
>>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>>>> Relocate watchdog ops as was done by:
>>>> "dm: Add support for all targets which requires MANUAL_RELOC"
>>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>>>>
>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>> ---
>>>>
>>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>>>>
>>>> ---
>>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>>>>  1 file changed, 23 insertions(+)
>>>>
>>>
>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>
>>> When will the toolchain be fixed?
>>
>> It is really several years back when I have looked at it last time but I
>> think that toolchain is fixed for quite some time and only changes in
>> microblaze u-boot code are needed but really I would have to check and
>> start to play with it.
> 
> I think someone should sort this out. It would be good to remove this
> code. Is there a toolchain group at Xilinx?

Xilinx has a toolchain group. I just looked a I was playing with it in
January 2015 but didn't finish that. It is still on my long todo list.
Will see when I have a time to look at it.

Thanks,
Michal
Simon Glass July 19, 2018, 1:31 a.m. UTC | #5
Hi Michal,

On 15 July 2018 at 23:34, Michal Simek <michal.simek@xilinx.com> wrote:
> On 15.7.2018 23:21, Simon Glass wrote:
>> Hi Michal,
>>
>> On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
>>> On 11.7.2018 22:13, Simon Glass wrote:
>>>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>>>>> Relocate watchdog ops as was done by:
>>>>> "dm: Add support for all targets which requires MANUAL_RELOC"
>>>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>>>>>
>>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>>> ---
>>>>>
>>>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>>>>>
>>>>> ---
>>>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>>>>>  1 file changed, 23 insertions(+)
>>>>>
>>>>
>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>>
>>>> When will the toolchain be fixed?
>>>
>>> It is really several years back when I have looked at it last time but I
>>> think that toolchain is fixed for quite some time and only changes in
>>> microblaze u-boot code are needed but really I would have to check and
>>> start to play with it.
>>
>> I think someone should sort this out. It would be good to remove this
>> code. Is there a toolchain group at Xilinx?
>
> Xilinx has a toolchain group. I just looked a I was playing with it in
> January 2015 but didn't finish that. It is still on my long todo list.
> Will see when I have a time to look at it.

Hoe about next week? -:) I think this is pretty important.

Regards,
Simon
Michal Simek July 19, 2018, 6:52 a.m. UTC | #6
Hi Simon,

On 19.7.2018 03:31, Simon Glass wrote:
> Hi Michal,
> 
> On 15 July 2018 at 23:34, Michal Simek <michal.simek@xilinx.com> wrote:
>> On 15.7.2018 23:21, Simon Glass wrote:
>>> Hi Michal,
>>>
>>> On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
>>>> On 11.7.2018 22:13, Simon Glass wrote:
>>>>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>>>>>> Relocate watchdog ops as was done by:
>>>>>> "dm: Add support for all targets which requires MANUAL_RELOC"
>>>>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>>>>>>
>>>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>>>> ---
>>>>>>
>>>>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>>>>>>
>>>>>> ---
>>>>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>>>>>>  1 file changed, 23 insertions(+)
>>>>>>
>>>>>
>>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>>>
>>>>> When will the toolchain be fixed?
>>>>
>>>> It is really several years back when I have looked at it last time but I
>>>> think that toolchain is fixed for quite some time and only changes in
>>>> microblaze u-boot code are needed but really I would have to check and
>>>> start to play with it.
>>>
>>> I think someone should sort this out. It would be good to remove this
>>> code. Is there a toolchain group at Xilinx?
>>
>> Xilinx has a toolchain group. I just looked a I was playing with it in
>> January 2015 but didn't finish that. It is still on my long todo list.
>> Will see when I have a time to look at it.
> 
> Hoe about next week? -:) I think this is pretty important.

will see but I need to do some Linux work first. Based on grep I see
that m68k is also enabling CONFIG_NEEDS_MANUAL_RELOC.
Is m68k going to be removed soon?

Thanks,
Michal
Simon Glass July 19, 2018, 3:21 p.m. UTC | #7
+Tom

Hi Michal,

On 19 July 2018 at 00:52, Michal Simek <michal.simek@xilinx.com> wrote:
> Hi Simon,
>
> On 19.7.2018 03:31, Simon Glass wrote:
>> Hi Michal,
>>
>> On 15 July 2018 at 23:34, Michal Simek <michal.simek@xilinx.com> wrote:
>>> On 15.7.2018 23:21, Simon Glass wrote:
>>>> Hi Michal,
>>>>
>>>> On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
>>>>> On 11.7.2018 22:13, Simon Glass wrote:
>>>>>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>>>>>>> Relocate watchdog ops as was done by:
>>>>>>> "dm: Add support for all targets which requires MANUAL_RELOC"
>>>>>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>>>>>>>
>>>>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>>>>>>> ---
>>>>>>>
>>>>>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>>>>>>>
>>>>>>> ---
>>>>>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>>>>>>>  1 file changed, 23 insertions(+)
>>>>>>>
>>>>>>
>>>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>>>>>>
>>>>>> When will the toolchain be fixed?
>>>>>
>>>>> It is really several years back when I have looked at it last time but I
>>>>> think that toolchain is fixed for quite some time and only changes in
>>>>> microblaze u-boot code are needed but really I would have to check and
>>>>> start to play with it.
>>>>
>>>> I think someone should sort this out. It would be good to remove this
>>>> code. Is there a toolchain group at Xilinx?
>>>
>>> Xilinx has a toolchain group. I just looked a I was playing with it in
>>> January 2015 but didn't finish that. It is still on my long todo list.
>>> Will see when I have a time to look at it.
>>
>> Hoe about next week? -:) I think this is pretty important.
>
> will see but I need to do some Linux work first. Based on grep I see
> that m68k is also enabling CONFIG_NEEDS_MANUAL_RELOC.
> Is m68k going to be removed soon?

I am not sure about that. Tom, do you know?

Regards,
Simon
Tom Rini July 19, 2018, 3:47 p.m. UTC | #8
On Thu, Jul 19, 2018 at 09:21:39AM -0600, Simon Glass wrote:
> +Tom
> 
> Hi Michal,
> 
> On 19 July 2018 at 00:52, Michal Simek <michal.simek@xilinx.com> wrote:
> > Hi Simon,
> >
> > On 19.7.2018 03:31, Simon Glass wrote:
> >> Hi Michal,
> >>
> >> On 15 July 2018 at 23:34, Michal Simek <michal.simek@xilinx.com> wrote:
> >>> On 15.7.2018 23:21, Simon Glass wrote:
> >>>> Hi Michal,
> >>>>
> >>>> On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
> >>>>> On 11.7.2018 22:13, Simon Glass wrote:
> >>>>>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
> >>>>>>> Relocate watchdog ops as was done by:
> >>>>>>> "dm: Add support for all targets which requires MANUAL_RELOC"
> >>>>>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
> >>>>>>>
> >>>>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
> >>>>>>> ---
> >>>>>>>
> >>>>>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
> >>>>>>>
> >>>>>>> ---
> >>>>>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
> >>>>>>>  1 file changed, 23 insertions(+)
> >>>>>>>
> >>>>>>
> >>>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
> >>>>>>
> >>>>>> When will the toolchain be fixed?
> >>>>>
> >>>>> It is really several years back when I have looked at it last time but I
> >>>>> think that toolchain is fixed for quite some time and only changes in
> >>>>> microblaze u-boot code are needed but really I would have to check and
> >>>>> start to play with it.
> >>>>
> >>>> I think someone should sort this out. It would be good to remove this
> >>>> code. Is there a toolchain group at Xilinx?
> >>>
> >>> Xilinx has a toolchain group. I just looked a I was playing with it in
> >>> January 2015 but didn't finish that. It is still on my long todo list.
> >>> Will see when I have a time to look at it.
> >>
> >> Hoe about next week? -:) I think this is pretty important.
> >
> > will see but I need to do some Linux work first. Based on grep I see
> > that m68k is also enabling CONFIG_NEEDS_MANUAL_RELOC.
> > Is m68k going to be removed soon?
> 
> I am not sure about that. Tom, do you know?

m68k is still active, so no, it's not being removed and we can't drop
CONFIG_NEEDS_MANUAL_RELOC just yet.
Simon Glass July 20, 2018, 2:16 a.m. UTC | #9
Hi,

On 19 July 2018 at 09:47, Tom Rini <trini@konsulko.com> wrote:
> On Thu, Jul 19, 2018 at 09:21:39AM -0600, Simon Glass wrote:
>> +Tom
>>
>> Hi Michal,
>>
>> On 19 July 2018 at 00:52, Michal Simek <michal.simek@xilinx.com> wrote:
>> > Hi Simon,
>> >
>> > On 19.7.2018 03:31, Simon Glass wrote:
>> >> Hi Michal,
>> >>
>> >> On 15 July 2018 at 23:34, Michal Simek <michal.simek@xilinx.com> wrote:
>> >>> On 15.7.2018 23:21, Simon Glass wrote:
>> >>>> Hi Michal,
>> >>>>
>> >>>> On 11 July 2018 at 23:47, Michal Simek <michal.simek@xilinx.com> wrote:
>> >>>>> On 11.7.2018 22:13, Simon Glass wrote:
>> >>>>>> On 11 July 2018 at 08:41, Michal Simek <michal.simek@xilinx.com> wrote:
>> >>>>>>> Relocate watchdog ops as was done by:
>> >>>>>>> "dm: Add support for all targets which requires MANUAL_RELOC"
>> >>>>>>> (sha1: 484fdf5ba058b07be5ca82763aa2b72063540ef3)
>> >>>>>>>
>> >>>>>>> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
>> >>>>>>> ---
>> >>>>>>>
>> >>>>>>> based on https://lists.denx.de/pipermail/u-boot/2018-July/334227.html
>> >>>>>>>
>> >>>>>>> ---
>> >>>>>>>  drivers/watchdog/wdt-uclass.c | 23 +++++++++++++++++++++++
>> >>>>>>>  1 file changed, 23 insertions(+)
>> >>>>>>>
>> >>>>>>
>> >>>>>> Reviewed-by: Simon Glass <sjg@chromium.org>
>> >>>>>>
>> >>>>>> When will the toolchain be fixed?
>> >>>>>
>> >>>>> It is really several years back when I have looked at it last time but I
>> >>>>> think that toolchain is fixed for quite some time and only changes in
>> >>>>> microblaze u-boot code are needed but really I would have to check and
>> >>>>> start to play with it.
>> >>>>
>> >>>> I think someone should sort this out. It would be good to remove this
>> >>>> code. Is there a toolchain group at Xilinx?
>> >>>
>> >>> Xilinx has a toolchain group. I just looked a I was playing with it in
>> >>> January 2015 but didn't finish that. It is still on my long todo list.
>> >>> Will see when I have a time to look at it.
>> >>
>> >> Hoe about next week? -:) I think this is pretty important.
>> >
>> > will see but I need to do some Linux work first. Based on grep I see
>> > that m68k is also enabling CONFIG_NEEDS_MANUAL_RELOC.
>> > Is m68k going to be removed soon?
>>
>> I am not sure about that. Tom, do you know?
>
> m68k is still active, so no, it's not being removed and we can't drop
> CONFIG_NEEDS_MANUAL_RELOC just yet.

Thanks Tom.

That begs the question - how is relocation support coming along with m68k?

Regards,
Simon
diff mbox series

Patch

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index f6f2fe3739d3..23b7e3360d32 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -63,8 +63,31 @@  int wdt_expire_now(struct udevice *dev, ulong flags)
 	return ret;
 }
 
+static int wdt_post_bind(struct udevice *dev)
+{
+#if defined(CONFIG_NEEDS_MANUAL_RELOC)
+	struct wdt_ops *ops = (struct wdt_ops *)device_get_ops(dev);
+	static int reloc_done;
+
+	if (!reloc_done) {
+		if (ops->start)
+			ops->start += gd->reloc_off;
+		if (ops->stop)
+			ops->stop += gd->reloc_off;
+		if (ops->reset)
+			ops->reset += gd->reloc_off;
+		if (ops->expire_now)
+			ops->expire_now += gd->reloc_off;
+
+		reloc_done++;
+	}
+#endif
+	return 0;
+}
+
 UCLASS_DRIVER(wdt) = {
 	.id		= UCLASS_WDT,
 	.name		= "watchdog",
 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
+	.post_bind	= wdt_post_bind,
 };