All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] arm: socfpga: Convert reset manager from struct to defines
Date: Fri, 23 Aug 2019 11:22:47 +0200	[thread overview]
Message-ID: <16121554-8bbf-4c2b-a7d4-2a94a454dddb@denx.de> (raw)
In-Reply-To: <CAFiDJ5_e1M7S8fqwHWm+qCU2SY-Eyq4JgEn7ezuJYpDZ3Tty-A@mail.gmail.com>

On 8/23/19 10:57 AM, Ley Foon Tan wrote:
> On Wed, Aug 21, 2019 at 9:50 AM Ley Foon Tan <lftan.linux@gmail.com> wrote:
>>
>> On Tue, Aug 20, 2019 at 5:50 PM Marek Vasut <marex@denx.de> wrote:
>>>
>>> On 8/20/19 4:35 AM, Ley Foon Tan wrote:
>>>> Convert reset manager for Gen5, Arria 10 and Stratix 10 from struct
>>>> to defines.
>>>> No functional change.
>>>>
>>>> Signed-off-by: Ley Foon Tan <ley.foon.tan@intel.com>
>>>> ---
>>>>  .../mach-socfpga/include/mach/reset_manager.h | 12 +++++
>>>>  .../include/mach/reset_manager_arria10.h      | 41 +++-------------
>>>>  .../include/mach/reset_manager_gen5.h         | 20 +++-----
>>>>  .../include/mach/reset_manager_s10.h          | 33 ++-----------
>>>>  arch/arm/mach-socfpga/misc_gen5.c             |  6 +--
>>>>  arch/arm/mach-socfpga/reset_manager_arria10.c | 49 +++++++++----------
>>>>  arch/arm/mach-socfpga/reset_manager_gen5.c    | 26 +++++-----
>>>>  arch/arm/mach-socfpga/reset_manager_s10.c     | 35 ++++++-------
>>>>  drivers/sysreset/sysreset_socfpga.c           |  6 +--
>>>>  9 files changed, 86 insertions(+), 142 deletions(-)
>>>>
>>>> diff --git a/arch/arm/mach-socfpga/include/mach/reset_manager.h b/arch/arm/mach-socfpga/include/mach/reset_manager.h
>>>> index 6ad037e325..c460e89d22 100644
>>>> --- a/arch/arm/mach-socfpga/include/mach/reset_manager.h
>>>> +++ b/arch/arm/mach-socfpga/include/mach/reset_manager.h
>>>> @@ -6,6 +6,18 @@
>>>>  #ifndef _RESET_MANAGER_H_
>>>>  #define _RESET_MANAGER_H_
>>>>
>>>> +#define RSTMGR_READL(reg)                    \
>>>> +     readl(SOCFPGA_RSTMGR_ADDRESS + (reg))
>>>> +
>>>> +#define RSTMGR_WRITEL(data, reg)             \
>>>> +     writel(data, SOCFPGA_RSTMGR_ADDRESS + (reg))
>>>> +
>>>> +#define RSTMGR_CLRBITS(reg, mask)            \
>>>> +     clrbits_le32(SOCFPGA_RSTMGR_ADDRESS + (reg), mask)
>>>> +
>>>> +#define RSTMGR_SETBITS(reg, mask)            \
>>>> +     setbits_le32(SOCFPGA_RSTMGR_ADDRESS + (reg), mask)

btw. mask is missing parenthesis, but see below.

>>>> +
>>>
>>> No, don't introduce such macros. Use readl()/writel()/... in the driver.
>>> The address should come from DT. Besides, there is no type checking in
>>> such macros.
>> These macros call to writel() and readl() underlying, it just add base
>> address to it.

Right, it just makes the code hardware to read and understand.

>> So, it should have type checking as call writel()/readl() directly?

The functions in the macro get typechecked. But unlike function
arguments, macro arguments are not checked.

>> If want to use address from DT, we need get address every time need to
>> use the address.
>> For non-DM, it is easier to use constant address. Let me know if you
>> still prefer to use address from DT.

Surely you can cache the address or even better, convert to DM/DT ?

  reply	other threads:[~2019-08-23  9:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20  2:35 [U-Boot] [PATCH 0/3] arm: socfpga: Convert drivers from struct to defines Ley Foon Tan
2019-08-20  2:35 ` [U-Boot] [PATCH 1/3] arm: socfpga: Convert reset manager " Ley Foon Tan
2019-08-20  9:37   ` Marek Vasut
2019-08-20  9:55     ` Simon Goldschmidt
2019-08-20 10:15       ` Marek Vasut
2019-08-20 10:29         ` Simon Goldschmidt
2019-08-20 11:24           ` Marek Vasut
2019-08-21  1:51             ` Ley Foon Tan
2019-08-21  1:50     ` Ley Foon Tan
2019-08-23  8:57       ` Ley Foon Tan
2019-08-23  9:22         ` Marek Vasut [this message]
2019-08-23  9:52           ` Ley Foon Tan
2019-08-23  9:56             ` Marek Vasut
2019-08-26  7:28               ` Ley Foon Tan
2019-08-26  8:50                 ` Marek Vasut
2019-08-26 10:58                   ` Simon Goldschmidt
2019-08-28  8:13               ` Ley Foon Tan
2019-08-28 11:14                 ` Marek Vasut
2019-08-28 13:03                   ` Simon Goldschmidt
2019-08-28 13:28                   ` Ley Foon Tan
2019-08-28 13:39                     ` Marek Vasut
2019-08-28 14:07                       ` Ley Foon Tan
2019-08-20  2:35 ` [U-Boot] [PATCH 2/3] arm: socfpga: Convert system " Ley Foon Tan
2019-08-20  2:35 ` [U-Boot] [PATCH 3/3] arm: socfpga: Convert clock " Ley Foon Tan
2019-08-20  8:33 ` [U-Boot] [PATCH 0/3] arm: socfpga: Convert drivers " Simon Goldschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16121554-8bbf-4c2b-a7d4-2a94a454dddb@denx.de \
    --to=marex@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.