All of lore.kernel.org
 help / color / mirror / Atom feed
* Platform setup via DTS
@ 2016-08-11 11:27 Anton D. Kachalov
  2016-08-11 11:39 ` Anton D. Kachalov
  2016-08-17  0:59 ` Joel Stanley
  0 siblings, 2 replies; 3+ messages in thread
From: Anton D. Kachalov @ 2016-08-11 11:27 UTC (permalink / raw)
  To: OpenBMC Maillist

I would like to start a little discussion around board setup process in arch/arm/mach-aspeed/aspeed.c.
For most cases this process is "flat": just modifying regs one-by-one. Sometimes with applying mask.
I have an idea to add an array of "instructions" to the Device Tree in the following manner
(I hope dtc's preprocess via cpp resolve ORed macro in the correct way):

==========
#include <dt-bindings/soc/aspeed.h>

/ {
    model = "Our HW";
    compatible = "aspeed,ast2400";
    board-setup = <WR, AST_BASE_LPC | 0x9c, 0x02010023, 0>,
                           <WR, AST_BASE_SCU, SCU_PASSWORD, 0>,
                           <WR, AST_BASE_SCU | 0x80, 0xcb000000, 0>,
                           ...
                            /* write(read() | 0x1000) */
                           <OR, AST_BASE_SCU | 0x2c, 0x00001000, 0>,

                           /* write((read() &~ 0x2000) | 0x1000) */
                           <OR, AST_BASE_SCU | 0x2c, 0x00001000, 0x2000>;
==========

or in less talkative way:

==========
                            /* write((read() &~ 0) | 0xcb000000) */
                           <AST_BASE_SCU | 0x80, 0xcb000000, 0>,
                           ...
                            /* write((read() &~ 0x1000) | 0x1000) */
                           <AST_BASE_SCU | 0x2c, 0x00001000, 0x1000>,
==========

to completely eliminate board-specific init functions.


-- 
Anton D. Kachalov

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Platform setup via DTS
  2016-08-11 11:27 Platform setup via DTS Anton D. Kachalov
@ 2016-08-11 11:39 ` Anton D. Kachalov
  2016-08-17  0:59 ` Joel Stanley
  1 sibling, 0 replies; 3+ messages in thread
From: Anton D. Kachalov @ 2016-08-11 11:39 UTC (permalink / raw)
  To: OpenBMC Maillist

Instead of:

>                             /* write((read() &~ 0) | 0xcb000000) */
>                            <AST_BASE_SCU | 0x80, 0xcb000000, 0>,

have to be:

                             /* write((read() &~ 0xffffffff) | 0xcb000000) */
                            <AST_BASE_SCU | 0x80, 0xcb000000, 0xffffffff>,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Platform setup via DTS
  2016-08-11 11:27 Platform setup via DTS Anton D. Kachalov
  2016-08-11 11:39 ` Anton D. Kachalov
@ 2016-08-17  0:59 ` Joel Stanley
  1 sibling, 0 replies; 3+ messages in thread
From: Joel Stanley @ 2016-08-17  0:59 UTC (permalink / raw)
  To: Anton D. Kachalov; +Cc: OpenBMC Maillist

Hey Anton,

On Thu, Aug 11, 2016 at 9:27 PM, Anton D. Kachalov <mouse@yandex-team.ru> wrote:
> I would like to start a little discussion around board setup process in arch/arm/mach-aspeed/aspeed.c.
> For most cases this process is "flat": just modifying regs one-by-one. Sometimes with applying mask.
> I have an idea to add an array of "instructions" to the Device Tree in the following manner
> (I hope dtc's preprocess via cpp resolve ORed macro in the correct way):

I agree that we need to remove the board file.

However, we will not be able to get changes upstream that use the
device tree as a scripting language :)

I think the solution is to write a driver for the different parts of
the system we require. Andrew J has done that for the multi-function
pin control registers in the SCU. I've got a work in progress driver
for the clock related registers. Next up would be a driver for the LPC
register space to properly configure that.

Cheers,

Joel

>
> ==========
> #include <dt-bindings/soc/aspeed.h>
>
> / {
>     model = "Our HW";
>     compatible = "aspeed,ast2400";
>     board-setup = <WR, AST_BASE_LPC | 0x9c, 0x02010023, 0>,
>                            <WR, AST_BASE_SCU, SCU_PASSWORD, 0>,
>                            <WR, AST_BASE_SCU | 0x80, 0xcb000000, 0>,
>                            ...
>                             /* write(read() | 0x1000) */
>                            <OR, AST_BASE_SCU | 0x2c, 0x00001000, 0>,
>
>                            /* write((read() &~ 0x2000) | 0x1000) */
>                            <OR, AST_BASE_SCU | 0x2c, 0x00001000, 0x2000>;
> ==========
>
> or in less talkative way:
>
> ==========
>                             /* write((read() &~ 0) | 0xcb000000) */
>                            <AST_BASE_SCU | 0x80, 0xcb000000, 0>,
>                            ...
>                             /* write((read() &~ 0x1000) | 0x1000) */
>                            <AST_BASE_SCU | 0x2c, 0x00001000, 0x1000>,
> ==========
>
> to completely eliminate board-specific init functions.
>
>
> --
> Anton D. Kachalov
> _______________________________________________
> openbmc mailing list
> openbmc@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/openbmc

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-17  0:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11 11:27 Platform setup via DTS Anton D. Kachalov
2016-08-11 11:39 ` Anton D. Kachalov
2016-08-17  0:59 ` Joel Stanley

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.