[U-Boot] [U-Boot,6/7] rockchip: rk322x: add sysreset driver

Dr. Philipp Tomsich philipp.tomsich at theobroma-systems.com
Fri Jun 23 09:16:54 UTC 2017


Kever,

> On 23 Jun 2017, at 10:46, Dr. Philipp Tomsich <philipp.tomsich at theobroma-systems.com> wrote:
> 
>>>> +int rk322x_sysreset_request(struct udevice *dev, enum sysreset_t type)
>>>> +{
>>>> +    struct rk322x_cru *cru = rockchip_get_cru();
>>>> +
>>>> +    if (IS_ERR(cru))
>>>> +        return PTR_ERR(cru);
>>>> +    switch (type) {
>>>> +    case SYSRESET_WARM:
>>>> +        writel(0xeca8, &cru->cru_glb_srst_snd_value);
>>> 
>>> Please make this a symbolic constant, thanks.
>> 
>> Do you mean define a MACRO and use it?
> 
> I think the way this has been done in the past for the Rockchip sub-architecture
> was to use an enum… 
> 
> Personally, I would prefer a ‘static const u32’, but let’s keep consistent and stick
> with enums.

I just took another look and see that the constant isn’t needed anywhere outside the sysrequest driver.
So you could just use a ‘const u32 [put-symbolic-name-here] = 0xeca8’ in the function itself.
The compiler will take care of handling this in an optimal way from there.

Regards,
Philipp.


More information about the U-Boot mailing list