[U-Boot] [PATCH v2 1/2] rtc: pl031: convert the driver to driver model

Simon Glass sjg at chromium.org
Tue Jul 10 20:49:29 UTC 2018


Hi,

On 8 July 2018 at 18:50, AKASHI Takahiro <takahiro.akashi at linaro.org> wrote:
> On Thu, Jul 05, 2018 at 04:12:59PM +0900, AKASHI Takahiro wrote:
>> On Wed, Jul 04, 2018 at 02:35:19PM +0300, Tuomas Tynkkynen wrote:
>> > Hi Akashi,
>> >
>> > Thank you for the DM conversion.
>> >
>> > On 07/04/2018 10:36 AM, AKASHI Takahiro wrote:
>> > <..snip..>
>> > >diff --git a/include/dm/platform_data/rtc_pl031.h b/include/dm/platform_data/rtc_pl031.h
>> > >new file mode 100644
>> > >index 0000000000..8e4ba1ce69
>> > >--- /dev/null
>> > >+++ b/include/dm/platform_data/rtc_pl031.h
>> > >@@ -0,0 +1,12 @@
>> > >+/* SPDX-License-Identifier: GPL-2.0+ */
>> > >+
>> > >+#ifndef __rtc_pl031_h
>> > >+#define __rtc_pl031_h
>> > >+
>> > >+#include <asm/types.h>
>> > >+
>> > >+struct pl031_rtc_platdata {
>> > >+  phys_addr_t base;
>> > >+};
>> > >+
>> > >+#endif
>> > >
>> >
>> > I think this file won't be necessary, the structure can stay private to pl031.c.
>> > PL031 is an ARM IP block and U-Boot on ARM uses the device tree to locate devices.
>>
>> I think that you are suggesting we would use udevice.priv instead of
>> udevice.platdata, right? That will be fine with device-tree based devices.
>> But don't we have to take care of no-device-tree (probably legacy)
>> devices here?
>
> Does anybody have a comment on this?
> I will be able to go either with priv or platdata once agreed.

There is no need to support legacy (non-DM) options unless there is a
board that doesn't build without it. Even then, the hour is late and
DM conversions should be well underway, so just removing that driver
from the board is probably acceptable until the maintainer gets around
to it.

You should really use platdata to hold info read from the device tree,
so to me what you have looks correct, except that I think the struct
can be private to your driver.

Instead of devfdt_get_addr(), please use dev_read_addr() which is the
livetree version.

Regards,
Simon


More information about the U-Boot mailing list