From: Sean Anderson <seanga2@gmail.com> To: Damien Le Moal <Damien.LeMoal@wdc.com>, Anup Patel <anup@brainfault.org> Cc: linux-riscv <linux-riscv@lists.infradead.org>, Anup Patel <Anup.Patel@wdc.com>, Palmer Dabbelt <palmer@dabbelt.com>, Paul Walmsley <paul.walmsley@sifive.com> Subject: Re: [PATCH 08/10] riscv: Add Kendryte K210 device tree Date: Fri, 6 Mar 2020 19:18:38 -0500 Message-ID: <c8197767-c76a-efc2-1fe2-250840bee605@gmail.com> (raw) In-Reply-To: <BYAPR04MB58160D1A2B74D22332E498C1E7E70@BYAPR04MB5816.namprd04.prod.outlook.com> On 3/2/20 12:08 AM, Damien Le Moal wrote: > On 2020/03/02 14:05, Anup Patel wrote: >> On Mon, Mar 2, 2020 at 10:21 AM Damien Le Moal <Damien.LeMoal@wdc.com> wrote: >>> >>> On 2020/03/02 13:22, Anup Patel wrote: >>>> On Mon, Mar 2, 2020 at 9:46 AM Damien Le Moal <Damien.LeMoal@wdc.com> wrote: >>>>> >>>>> On 2020/03/02 13:07, Anup Patel wrote: >>>>> [...] >>>>>>> + sram0: memory@80000000 { >>>>>>> + device_type = "memory"; >>>>>>> + reg = <0x80000000 0x400000>; >>>>>>> + }; >>>>>>> + >>>>>>> + sram1: memory@80400000 { >>>>>>> + device_type = "memory"; >>>>>>> + reg = <0x80400000 0x200000>; >>>>>>> + }; >>>>>>> + >>>>>>> + kpu_sram: memory@80600000 { >>>>>>> + device_type = "memory"; >>>>>>> + reg = <0x80600000 0x200000>; >>>>>>> + }; >>>>>> >>>>>> No need to have separate DT node for each RAM bank. This can be >>>>>> express as single DT node as follows: >>>>>> >>>>>> sram: memory@80000000 { >>>>>> device_type = "memory"; >>>>>> reg = <0x80000000 0x400000>, >>>>>> <0x80400000 0x200000>, >>>>>> <0x80600000 0x200000>; >>>>>> }; >>>>> >>>>> This is to match the U-boot device tree that Sean wrote. So I would rather keep >>>>> it like this. And strictly speaking, if one wants to add a driver for the KPU, >>>>> having the kpu memory segment for it separate makes it easy to reference it from >>>>> a kpu device entry. But granted, the two sram segments can be declared with a >>>>> single memory entry. There is no clear documentation on how to do this, so I have been mostly just trying things until they work. In U-Boot, separate memory device nodes are treated as different "banks". >>>> >>>> But, that's not the preferred way of describing memory banks on the >>>> same machine. >>>> Usually, we create multiple memory DT nodes for NUMA systems. >>>> >>>> You can also refer various ARM/ARM64 DTS files. >>> >>> Oops... Sent an answer to this to the wrong email... Here it is again: >>> >>> Yes, I understand. But in the case of the K210, that last 2MB segment is really >>> special as by default it is not usable as regular SRAM. I think it may be better >>> to reflect that in the device tree. The K210 soc_early_init() call back can >>> probe for that special entry too to see if it has to be turned on for use as >>> regular memory or not (i.e. if a kpu driver will use it). >>> >>> Since booting Linux with 6MB of memory will be even more challenging than with >>> 8, I agree that we may never see the case of a kpu driver being used. But I >>> personally like making that special case clear in the device tree. No strong >>> objection to your simplification though. So if you really object, I will go with it. >>> >> >> I understand that it is helping you to distinguish last 2MB segment but this is >> also possible using with single memory DT node as follows: >> >> sram: memory@80000000 { >> device_type = "memory"; >> reg = <0x80000000 0x400000>, >> <0x80400000 0x200000>, >> <0x80600000 0x200000>; >> reg-names = "sram0", "sram1", "kpu_sram"; >> }; > > Nice trick. I did not know about it. Will use that then ! >> >> The K210 soc_early_init() can do the following: >> 1. Find memory DT node having device_type = "memory" >> 2. Find bank number for "kpu_sram" based on "reg-names DT property >> 3. Get based address of KPU SRAM from "reg" property based on bank >> number found in step2 above. >> >> The reg-names is a standard DT property used to distinguish multiple >> memory regions of device. Same can be used to distinguish multiple >> banks of memory DT node. >> >> I am not adamant on having single memory DT node but just wanted >> to let you know that this is not a preferred way for non-NUMA system. Anup, do you have any suggestions on how to describe clocks for each bank? I think the kpu sram may need some clock manipulation to work properly. Perhaps something like sram: memory@80000000 { device_type = "memory"; reg = <0x80000000 0x400000>, <0x80400000 0x200000>, <0x80600000 0x200000>; reg-names = "sram0", "sram1", "kpu_sram"; clocks = <&sysclk K210_CLK_SRAM0>, <&sysclk K210_CLK_SRAM1>, <&sysclk K210_CLK_PLL1>; clock-names = "sram0", "sram1", "kpu"; }; --Sean
next prev parent reply index Thread overview: 89+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-02-12 10:34 [PATCH 00/10] Kendryte k210 SoC boards support Damien Le Moal 2020-02-12 10:34 ` [PATCH 01/10] riscv: Fix gitignore Damien Le Moal 2020-02-20 0:15 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 02/10] riscv: Force flat memory model with no-mmu Damien Le Moal 2020-02-14 20:18 ` Sean Anderson 2020-02-15 2:15 ` Damien Le Moal 2020-02-15 2:26 ` Sean Anderson 2020-02-15 2:40 ` Damien Le Moal 2020-03-02 3:48 ` Anup Patel 2020-03-04 18:38 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 03/10] riscv: Unaligned load/store handling for M_MODE Damien Le Moal 2020-03-02 3:57 ` Anup Patel 2020-03-04 19:28 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 04/10] riscv: Add BUILTIN_DTB support Damien Le Moal 2020-03-02 3:58 ` Anup Patel 2020-03-04 19:28 ` Palmer Dabbelt 2020-03-05 4:58 ` Anup Patel 2020-03-05 5:14 ` Damien Le Moal 2020-03-05 5:37 ` Anup Patel 2020-03-05 6:13 ` Damien Le Moal 2020-03-08 6:10 ` Anup Patel 2020-03-05 8:18 ` Atish Patra 2020-03-07 0:02 ` Sean Anderson 2020-03-07 1:51 ` Atish Patra 2020-03-07 2:08 ` Sean Anderson 2020-03-06 23:56 ` Sean Anderson 2020-02-12 10:34 ` [PATCH 05/10] riscv: Add SOC early init support Damien Le Moal 2020-03-04 19:28 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 06/10] riscv: Add Kendryte K210 SoC support Damien Le Moal 2020-02-14 20:31 ` Sean Anderson 2020-03-04 19:38 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 07/10] riscv: Select required drivers for Kendryte SOC Damien Le Moal 2020-03-02 3:59 ` Anup Patel 2020-03-04 19:44 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 08/10] riscv: Add Kendryte K210 device tree Damien Le Moal 2020-02-14 20:51 ` Sean Anderson 2020-02-15 2:34 ` Damien Le Moal 2020-02-15 2:48 ` Sean Anderson 2020-02-15 3:00 ` Damien Le Moal 2020-02-18 14:12 ` Carlos Eduardo de Paula 2020-02-18 14:18 ` Sean Anderson 2020-02-18 14:30 ` Carlos Eduardo de Paula 2020-02-18 17:48 ` Sean Anderson 2020-02-18 19:26 ` Carlos Eduardo de Paula 2020-02-19 9:06 ` Wladimir J. van der Laan 2020-02-19 22:28 ` Sean Anderson 2020-02-20 10:48 ` Wladimir J. van der Laan 2020-02-22 19:07 ` Wladimir J. van der Laan 2020-04-01 17:55 ` Drew Fustini 2020-04-02 2:24 ` Damien Le Moal 2020-02-19 8:50 ` Wladimir J. van der Laan 2020-02-27 19:43 ` Sean Anderson 2020-03-02 4:06 ` Anup Patel 2020-03-02 4:15 ` Damien Le Moal 2020-03-02 4:22 ` Anup Patel 2020-03-02 4:51 ` Damien Le Moal 2020-03-02 5:05 ` Anup Patel 2020-03-02 5:08 ` Damien Le Moal 2020-03-07 0:18 ` Sean Anderson [this message] 2020-03-07 4:11 ` Anup Patel 2020-03-04 19:44 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 09/10] riscv: Kendryte K210 default config Damien Le Moal 2020-03-02 4:07 ` Anup Patel 2020-03-04 19:44 ` Palmer Dabbelt 2020-02-12 10:34 ` [PATCH 10/10] riscv: create a loader.bin for the kendryte kflash.py tool Damien Le Moal 2020-03-02 4:08 ` Anup Patel 2020-03-04 19:44 ` Palmer Dabbelt 2020-02-14 15:05 ` [PATCH 00/10] Kendryte k210 SoC boards support Carlos Eduardo de Paula 2020-02-15 2:02 ` Damien Le Moal 2020-02-17 13:28 ` Carlos Eduardo de Paula 2020-02-26 21:31 ` Carlos Eduardo de Paula 2020-02-27 2:18 ` Damien Le Moal 2020-02-28 20:32 ` Sean Anderson 2020-03-02 3:01 ` Damien Le Moal 2020-03-02 3:53 ` Sean Anderson 2020-03-02 4:11 ` Damien Le Moal 2020-03-02 4:18 ` Sean Anderson 2020-03-02 4:54 ` Damien Le Moal 2020-03-02 4:56 ` Sean Anderson 2020-03-02 5:03 ` Damien Le Moal 2020-03-02 4:17 ` Anup Patel 2020-03-02 4:21 ` Sean Anderson 2020-03-02 4:48 ` Damien Le Moal 2020-03-02 4:51 ` Damien Le Moal 2020-03-02 5:02 ` Sean Anderson 2020-03-02 5:11 ` Damien Le Moal 2020-03-02 5:25 ` Sean Anderson 2020-03-02 5:43 ` Damien Le Moal 2020-03-04 19:44 ` Palmer Dabbelt
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=c8197767-c76a-efc2-1fe2-250840bee605@gmail.com \ --to=seanga2@gmail.com \ --cc=Anup.Patel@wdc.com \ --cc=Damien.LeMoal@wdc.com \ --cc=anup@brainfault.org \ --cc=linux-riscv@lists.infradead.org \ --cc=palmer@dabbelt.com \ --cc=paul.walmsley@sifive.com \ /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
Linux-RISC-V Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \ linux-riscv@lists.infradead.org public-inbox-index linux-riscv Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv AGPL code for this site: git clone https://public-inbox.org/public-inbox.git