Skip to contentSkip to conversation

Platform setup via DTS

DISCUSSION Anton D. Kachalov 2 participants 3 messages Aug 11, 2016 – Aug 17, 2016

lore
Share & tools
lore
#0 lore raw

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.

Signature · 1 line
Anton D. Kachalov
#1 lore raw

Instead of:

Quoted 2 lines

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

have to be:

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

#2 lore raw
In reply to Anton D. Kachalov

Hey Anton,

Quoted 4 lines · Anton D. Kachalov

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

Quoted 37 lines

==========
#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
[email protected]
https://lists.ozlabs.org/listinfo/openbmc