From: Sean Anderson Date: Tue, 4 Feb 2020 09:23:32 -0500 Subject: [PATCH v3 11/12] riscv: Add device tree for K210 In-Reply-To: References: <8c29e4d8-430b-e232-9a0e-27642bfea219@gmail.com> Message-ID: <23ff3781-3196-ac00-e7b6-91a1d5820226@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de On 2/4/20 6:32 AM, Bin Meng wrote: > Hi Sean, > > On Mon, Feb 3, 2020 at 4:10 AM Sean Anderson wrote: >> >> Where possible, I have tried to find compatible drivers based on the layout of >> registers. However, I have not tested most of this functionality, and most >> devices should be considered descriptive at best. I would appreciate if anyone >> could help identify possibly compatible devices, especially for the timers >> and rtc. >> >> Should the size of a reg be the size of the documented registers, or the size >> of the address space which will be routed to that device? > > Perhaps we need use the size of the address space routed to that > device, in case there is some undocumented registers we need handle. Ok, I'll go with the whole address space then. >> diff --git a/arch/riscv/dts/k210.dtsi b/arch/riscv/dts/k210.dtsi >> new file mode 100644 >> index 0000000000..cc46b692e6 >> --- /dev/null >> +++ b/arch/riscv/dts/k210.dtsi >> @@ -0,0 +1,496 @@ >> +// SPDX-License-Identifier: GPL-2.0+ >> +/* >> + * Copyright (C) 2019 Sean Anderson >> + */ >> + >> +#include >> +#include >> +#include >> + >> +/ { >> + /* >> + * Although the K210 is a 64-bit CPU, the address bus is only 32-bits >> + * wide, and the upper half of all addresses is ignored. >> + */ >> + #address-cells = <1>; >> + #size-cells = <1>; >> + compatible = "kendryte,k210"; >> + >> + aliases { >> + serial0 = &uarths0; >> + serial1 = &uart1; >> + serial2 = &uart2; >> + serial3 = &uart3; >> + spi0 = &spi0; >> + spi1 = &spi1; >> + spi2 = &spi2; >> + spi3 = &spi3; >> + }; >> + >> + clocks { >> + in0: oscillator { >> + compatible = "fixed-clock"; >> + #clock-cells = <0>; >> + clock-frequency = <26000000>; >> + }; >> + }; >> + >> + cpus { >> + #address-cells = <1>; >> + #size-cells = <0>; >> + timebase-frequency = <7800000>; >> + cpu0: cpu at 0 { >> + device_type = "cpu"; >> + reg = <0>; >> + compatible = "riscv"; >> + riscv,isa = "rv64acdfimsu"; >> + mmu-type = "sv39"; >> + i-cache-size = <0x8000>; >> + d-cache-size = <0x8000>; >> + clocks = <&sysclk K210_CLK_CPU>; >> + clock-frequency = <390000000>; > > I wonder there is already clocks property, why do we have another > clock-frequency property to provide duplicated information? This is for compatibility with the existing riscv cpu driver. There is a patch [1] to move the driver over to using clocks, but I think you already expressed that it should be merged into this series (not as a separate series). [1] https://patchwork.ozlabs.org/project/uboot/list/?series=156381 --Sean