From: Michael Opdenacker <[email protected]>
This adds initial support for the Milk-V Duo S board
(https://milkv.io/duo-s), enabling the serial port and
read-only SD card support, allowing to boot Linux to the
command line.
Signed-off-by: Michael Opdenacker <[email protected]>
---
Tested with linux-next as of Apr 9, 2024,
using the risc-v "defconfig" configuration.
---
arch/riscv/boot/dts/sophgo/Makefile | 1 +
.../boot/dts/sophgo/sg2000-milkv-duos.dts | 38 +++++++++++++++++++
2 files changed, 39 insertions(+)
create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
diff --git a/arch/riscv/boot/dts/sophgo/Makefile b/arch/riscv/boot/dts/sophgo/Makefile
index 57ad82a61ea6..e008acb5240f 100644
--- a/arch/riscv/boot/dts/sophgo/Makefile
+++ b/arch/riscv/boot/dts/sophgo/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
dtb-$(CONFIG_ARCH_SOPHGO) += cv1800b-milkv-duo.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += cv1812h-huashan-pi.dtb
+dtb-$(CONFIG_ARCH_SOPHGO) += sg2000-milkv-duos.dtb
dtb-$(CONFIG_ARCH_SOPHGO) += sg2042-milkv-pioneer.dtb
diff --git a/arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
new file mode 100644
index 000000000000..cf2cec3cc369
--- /dev/null
+++ b/arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: (GPL-2.0 OR MIT)
+/*
+ * Copyright (C) 2024 Michael Opdenacker <[email protected]>
+ */
+
+/dts-v1/;
+
+#include "cv1800b.dtsi"
+
+/ {
+ model = "Milk-V Duo S";
+ compatible = "milkv,duos", "sophgo,sg2000";
+
+ aliases {
+ serial0 = &uart0;
+ };
+
+ chosen {
+ stdout-path = "serial0:115200n8";
+ };
+
+ memory@80000000 {
+ device_type = "memory";
+ reg = <0x80000000 0x20000000>;
+ };
+};
+
+&osc {
+ clock-frequency = <25000000>;
+};
+
+&sdhci0 {
+ status = "okay";
+};
+
+&uart0 {
+ status = "okay";
+};
--
2.34.1
On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
> From: Michael Opdenacker <[email protected]>
>
> This adds initial support for the Milk-V Duo S board
> (https://milkv.io/duo-s), enabling the serial port and
> read-only SD card support, allowing to boot Linux to the
> command line.
>
Hi Michael,
I think your patch losts the board binding and have wrong compatiable.
Also, the SD can have rw support with proper property. See link [1]
(need 'disable-wp').
I suggest you resubmitting this patch after applying clk patchs.
This could reduce some unnecessary change. For now, you can just
use the dts for huashan-pi (with changed memory size).
[1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/
Hi Inochi
Thanks for the review and tips!
On 4/9/24 at 09:17, Inochi Amaoto wrote:
> On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
>> From: Michael Opdenacker <[email protected]>
>>
>> This adds initial support for the Milk-V Duo S board
>> (https://milkv.io/duo-s), enabling the serial port and
>> read-only SD card support, allowing to boot Linux to the
>> command line.
>>
> Hi Michael,
>
> I think your patch losts the board binding and have wrong compatiable.
> Also, the SD can have rw support with proper property. See link [1]
> (need 'disable-wp').
Right, ""sophgo,sg2000" doesn't exist yet, so it will be indeed cleaner
to use "sophgo,cv1812h" instead.
>
> I suggest you resubmitting this patch after applying clk patchs.
> This could reduce some unnecessary change. For now, you can just
> use the dts for huashan-pi (with changed memory size).
>
> [1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/
Good to know. That was next on my list.
I'll submit a V2 in the next days.
Thanks again
Cheers
Michael.
--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
On 09/04/2024 08:45, [email protected] wrote:
> From: Michael Opdenacker <[email protected]>
>
> This adds initial support for the Milk-V Duo S board
> (https://milkv.io/duo-s), enabling the serial port and
> read-only SD card support, allowing to boot Linux to the
> command line.
>
> Signed-off-by: Michael Opdenacker <[email protected]>
>
> ---
>
> Tested with linux-next as of Apr 9, 2024,
> using the risc-v "defconfig" configuration.
Please include in your tests what submitting patches and your maintainer
profile asks you. checkpatch and testing of DTS.
Please run scripts/checkpatch.pl and fix reported warnings. Then please
run `scripts/checkpatch.pl --strict` and (probably) fix more warnings.
Some warnings can be ignored, especially from --strict run, but the code
here looks like it needs a fix. Feel free to get in touch if the warning
is not clear.
Best regards,
Krzysztof
On Tue, Apr 09, 2024 at 03:17:35PM +0800, Inochi Amaoto wrote:
> On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
> > From: Michael Opdenacker <[email protected]>
> >
> > This adds initial support for the Milk-V Duo S board
> > (https://milkv.io/duo-s), enabling the serial port and
> > read-only SD card support, allowing to boot Linux to the
> > command line.
> >
>
> Hi Michael,
>
> I think your patch losts the board binding and have wrong compatiable.
> Also, the SD can have rw support with proper property. See link [1]
> (need 'disable-wp').
[1] doesn't go anywhere useful.
> I suggest you resubmitting this patch after applying clk patchs.
> This could reduce some unnecessary change. For now, you can just
> use the dts for huashan-pi (with changed memory size).
Why would using patched huashan-pi dts be more suitable than carrying
a local patch for duo-s devicetree? What am I missing?
Cheers,
Conor.
>
> [1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/
On Tue, Apr 09, 2024 at 01:13:32PM +0100, Conor Dooley wrote:
> On Tue, Apr 09, 2024 at 03:17:35PM +0800, Inochi Amaoto wrote:
> > On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
> > > From: Michael Opdenacker <[email protected]>
> > >
> > > This adds initial support for the Milk-V Duo S board
> > > (https://milkv.io/duo-s), enabling the serial port and
> > > read-only SD card support, allowing to boot Linux to the
> > > command line.
> > >
> >
> > Hi Michael,
> >
> > I think your patch losts the board binding and have wrong compatiable.
> > Also, the SD can have rw support with proper property. See link [1]
> > (need 'disable-wp').
>
> [1] doesn't go anywhere useful.
>
This is my fault, I copied the wrong url. The right patch is
https://lore.kernel.org/r/[email protected].
> > I suggest you resubmitting this patch after applying clk patchs.
> > This could reduce some unnecessary change. For now, you can just
> > use the dts for huashan-pi (with changed memory size).
>
> Why would using patched huashan-pi dts be more suitable than carrying
> a local patch for duo-s devicetree? What am I missing?
>
> Cheers,
> Conor.
>
> >
> > [1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/
I think you miss nothing. Using huashan-pi dts as a temporary
solution is just because they are both CV181X series. Since
only a few peripherals are supported, it is also OK to use duo
dts with local change. They're not significantly different.
This is also the reason I did not prepare any patch for the
new board. (such as lichee RV NANO, duo 256).
On Tue, Apr 09, 2024 at 08:27:59PM +0800, Inochi Amaoto wrote:
> On Tue, Apr 09, 2024 at 01:13:32PM +0100, Conor Dooley wrote:
> > On Tue, Apr 09, 2024 at 03:17:35PM +0800, Inochi Amaoto wrote:
> > > On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
> > > > From: Michael Opdenacker <[email protected]>
> > > >
> > > > This adds initial support for the Milk-V Duo S board
> > > > (https://milkv.io/duo-s), enabling the serial port and
> > > > read-only SD card support, allowing to boot Linux to the
> > > > command line.
> > > >
> > >
> > > Hi Michael,
> > >
> > > I think your patch losts the board binding and have wrong compatiable.
> > > Also, the SD can have rw support with proper property. See link [1]
> > > (need 'disable-wp').
> >
> > [1] doesn't go anywhere useful.
> >
>
> This is my fault, I copied the wrong url. The right patch is
> https://lore.kernel.org/r/[email protected].
>
FYI, Michael. This is the right url for sdhci dts. The previous
is wrong.
> > > I suggest you resubmitting this patch after applying clk patchs.
> > > This could reduce some unnecessary change. For now, you can just
> > > use the dts for huashan-pi (with changed memory size).
> >
> > Why would using patched huashan-pi dts be more suitable than carrying
> > a local patch for duo-s devicetree? What am I missing?
> >
> > Cheers,
> > Conor.
> >
> > >
> > > [1]: https://lore.kernel.org/linux-riscv/IA1PR20MB4953B158F6F575840F3D4267BB7D2@IA1PR20MB4953.namprd20.prod.outlook.com/
>
> I think you miss nothing. Using huashan-pi dts as a temporary
> solution is just because they are both CV181X series. Since
> only a few peripherals are supported, it is also OK to use duo
> dts with local change. They're not significantly different.
> This is also the reason I did not prepare any patch for the
> new board. (such as lichee RV NANO, duo 256).
Hi Inochi
On 4/9/24 at 14:27, Inochi Amaoto wrote:
> On Tue, Apr 09, 2024 at 01:13:32PM +0100, Conor Dooley wrote:
>> On Tue, Apr 09, 2024 at 03:17:35PM +0800, Inochi Amaoto wrote:
>>> On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
>>>> From: Michael Opdenacker <[email protected]>
>>>>
>>>> This adds initial support for the Milk-V Duo S board
>>>> (https://milkv.io/duo-s), enabling the serial port and
>>>> read-only SD card support, allowing to boot Linux to the
>>>> command line.
>>>>
>>> Hi Michael,
>>>
>>> I think your patch losts the board binding and have wrong compatiable.
>>> Also, the SD can have rw support with proper property. See link [1]
>>> (need 'disable-wp').
>> [1] doesn't go anywhere useful.
>>
> This is my fault, I copied the wrong url. The right patch is
> https://lore.kernel.org/r/[email protected].
No problem, I found out.
I confirm that using the "disable-wp;" property does the trick to make
the MMC writable.
However, it wasn't mentioned in the above URL...
By the way, do I really need those under &sdhci0?
+ bus-width = <4>; + no-1-8-v; + no-mmc; + no-sdio;
My board looks happy so far without them ;-)
Thanks again for your help
Cheers
Michael.
--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
On Tue, 09 Apr 2024 08:45:04 +0200, [email protected] wrote:
> From: Michael Opdenacker <[email protected]>
>
> This adds initial support for the Milk-V Duo S board
> (https://milkv.io/duo-s), enabling the serial port and
> read-only SD card support, allowing to boot Linux to the
> command line.
>
> Signed-off-by: Michael Opdenacker <[email protected]>
>
> ---
>
> Tested with linux-next as of Apr 9, 2024,
> using the risc-v "defconfig" configuration.
> ---
> arch/riscv/boot/dts/sophgo/Makefile | 1 +
> .../boot/dts/sophgo/sg2000-milkv-duos.dts | 38 +++++++++++++++++++
> 2 files changed, 39 insertions(+)
> create mode 100644 arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts
>
My bot found new DTB warnings on the .dts files added or changed in this
series.
Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings
are fixed by another series. Ultimately, it is up to the platform
maintainer whether these warnings are acceptable or not. No need to reply
unless the platform maintainer has comments.
If you already ran DT checks and didn't see these error(s), then
make sure dt-schema is up to date:
pip3 install dtschema --upgrade
New warnings running 'make CHECK_DTBS=y sophgo/sg2000-milkv-duos.dtb' for [email protected]:
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dtb: /: failed to match any schema with compatible: ['milkv,duos', 'sophgo,sg2000']
arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dtb: /: failed to match any schema with compatible: ['milkv,duos', 'sophgo,sg2000']
On Tue, Apr 09, 2024 at 03:08:17PM +0200, Michael Opdenacker wrote:
> Hi Inochi
>
> On 4/9/24 at 14:27, Inochi Amaoto wrote:
> > On Tue, Apr 09, 2024 at 01:13:32PM +0100, Conor Dooley wrote:
> > > On Tue, Apr 09, 2024 at 03:17:35PM +0800, Inochi Amaoto wrote:
> > > > On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
> > > > > From: Michael Opdenacker <[email protected]>
> > > > >
> > > > > This adds initial support for the Milk-V Duo S board
> > > > > (https://milkv.io/duo-s), enabling the serial port and
> > > > > read-only SD card support, allowing to boot Linux to the
> > > > > command line.
> > > > >
> > > > Hi Michael,
> > > >
> > > > I think your patch losts the board binding and have wrong compatiable.
> > > > Also, the SD can have rw support with proper property. See link [1]
> > > > (need 'disable-wp').
> > > [1] doesn't go anywhere useful.
> > >
> > This is my fault, I copied the wrong url. The right patch is
> > https://lore.kernel.org/r/[email protected].
>
>
> No problem, I found out.
> I confirm that using the "disable-wp;" property does the trick to make the
> MMC writable.
>
> However, it wasn't mentioned in the above URL...
>
> By the way, do I really need those under &sdhci0?
>
> + bus-width = <4>; + no-1-8-v; + no-mmc; + no-sdio;
>
> My board looks happy so far without them ;-)
FYI, Jisheng. Could you share some suggestions?
> Thanks again for your help
> Cheers
> Michael.
>
> --
> Michael Opdenacker, Bootlin
> Embedded Linux and Kernel engineering
> https://bootlin.com
>
On Wed, Apr 10, 2024 at 09:24:40AM +0800, Inochi Amaoto wrote:
> On Tue, Apr 09, 2024 at 03:08:17PM +0200, Michael Opdenacker wrote:
> > Hi Inochi
> >
> > On 4/9/24 at 14:27, Inochi Amaoto wrote:
> > > On Tue, Apr 09, 2024 at 01:13:32PM +0100, Conor Dooley wrote:
> > > > On Tue, Apr 09, 2024 at 03:17:35PM +0800, Inochi Amaoto wrote:
> > > > > On Tue, Apr 09, 2024 at 08:45:04AM +0200, [email protected] wrote:
> > > > > > From: Michael Opdenacker <[email protected]>
> > > > > >
> > > > > > This adds initial support for the Milk-V Duo S board
> > > > > > (https://milkv.io/duo-s), enabling the serial port and
> > > > > > read-only SD card support, allowing to boot Linux to the
> > > > > > command line.
> > > > > >
> > > > > Hi Michael,
> > > > >
> > > > > I think your patch losts the board binding and have wrong compatiable.
> > > > > Also, the SD can have rw support with proper property. See link [1]
> > > > > (need 'disable-wp').
> > > > [1] doesn't go anywhere useful.
> > > >
> > > This is my fault, I copied the wrong url. The right patch is
> > > https://lore.kernel.org/r/[email protected].
> >
> >
> > No problem, I found out.
> > I confirm that using the "disable-wp;" property does the trick to make the
> > MMC writable.
> >
> > However, it wasn't mentioned in the above URL...
> >
> > By the way, do I really need those under &sdhci0?
> >
> > + bus-width = <4>; + no-1-8-v; + no-mmc; + no-sdio;
> >
> > My board looks happy so far without them ;-)
setting the correct bus-width is necessary for better performance
no-1-8-v can be removed, but it doesn't harm anything because
the board doesn't supply 1.8v
no-mmc and no-sdio to make the probe a bit quicker
>
> FYI, Jisheng. Could you share some suggestions?
>
> > Thanks again for your help
> > Cheers
> > Michael.
> >
> > --
> > Michael Opdenacker, Bootlin
> > Embedded Linux and Kernel engineering
> > https://bootlin.com
> >
Hi Jisheng,
On 4/10/24 at 12:24, Jisheng Zhang wrote:
> setting the correct bus-width is necessary for better performance
> no-1-8-v can be removed, but it doesn't harm anything because
> the board doesn't supply 1.8v
>
> no-mmc and no-sdio to make the probe a bit quicker
Many thanks for your advice!
However, whether I apply these changes or not,
git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git is now broken
for me:
Error: arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts:32.1-8 Label or
path sdhci0 not found
I was previously testing with linux-next, but it's now broken too,
though in a different way:
[ 1.306811] /dev/root: Can't open blockdev
[ 1.311200] VFS: Cannot open root device "/dev/mmcblk0p2" or
unknown-block(0,0): error -6
Shall I submit my updates anyway?
Cheers
Michael.
--
Michael Opdenacker, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
On Thu, Apr 11, 2024 at 10:35:55AM +0200, Michael Opdenacker wrote:
> Hi Jisheng,
>
> On 4/10/24 at 12:24, Jisheng Zhang wrote:
> > setting the correct bus-width is necessary for better performance
> > no-1-8-v can be removed, but it doesn't harm anything because
> > the board doesn't supply 1.8v
> >
> > no-mmc and no-sdio to make the probe a bit quicker
>
> Many thanks for your advice!
>
> However, whether I apply these changes or not,
> git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git is now broken for
> me:
> Error: arch/riscv/boot/dts/sophgo/sg2000-milkv-duos.dts:32.1-8 Label or path
> sdhci0 not found
This is probably just because you need to use the for-next branch of
https://github.com/sophgo/linux.git as your base. Palmer doesn't apply
dts patchs to the riscv repo. Usually working on linux-next is fine for
these kinds of activities.
> I was previously testing with linux-next, but it's now broken too, though in
> a different way:
> [??? 1.306811] /dev/root: Can't open blockdev
> [??? 1.311200] VFS: Cannot open root device "/dev/mmcblk0p2" or
> unknown-block(0,0): error -6
>
> Shall I submit my updates anyway?
This is probably worth investigating by someone, providing a longer log
would help if you don't wanna do so yourself. Did you rebase on a more
recent linux-next and this cropped up?