arm64: mvebu: Armada-8K family patches
Subsystems (4)
v2 cover arm64: mvebu: Armada-8K family patches
From: Konstantin Porotchkin <[email protected]>
This set of patches is adding more features for bards based on new Marvell MoChi platforms - Armada-70x0 and Armada-80x0.
The patches were applied on top of Stefan's mvebu-related patch set v2 with the last patch named
"dm: core: Add dev_get_addr_size_index() to retrieve addr and size".
The test was done on Armada-70x0 and Armada-80x0 development boards equipped with SoC release A1.
Since the SPI and I2C channels mapping between A0 and A1 releases were changed, the execution of added features on A0 boards will fail.
Currently 2 major features were added:
- BUBT command support
- Pin controller driver for A8K family
Changes for v2:
- 7040-db: remove i2c0 and spi0 entries from AP (MPPs are reserved for SDIO)
- Add "bubt" documentation
- Fix code syntax
- Fix the pin controller driver code following Simon's review
- Added MPP functions documentation for CP110 and APN806
- Remove Gerrit Change ID from all patches
- Fix wrong pin function values in A8K DTS files
- Add missing cpm_i2c0 node to armada-7040-db.dts
Konstantin Porotchkin (6):
arm64: mvebu: Modify the A8K SPI and I2C config in DTS
arm64: mvebu: Add bubt command for flash image burn
arm64: mvebu: pinctrl: Add pin control driver for A8K family
arm64: mvebu: Add pin control nodes to A8K family DTS files
arm64: mvebu: Enable BUBT command support in A8K default config
arm64: mvebu: Enable pin control support in A8K default config
arch/arm/dts/armada-7040-db.dts | 64 +- arch/arm/dts/armada-8040-db.dts | 114 +++- arch/arm/dts/armada-ap806.dtsi | 18 + arch/arm/dts/armada-cp110-master.dtsi | 32 + arch/arm/dts/armada-cp110-slave.dtsi | 19 + arch/arm/include/asm/arch-armada8k/soc-info.h | 17 + arch/arm/mach-mvebu/Kconfig | 34 + cmd/Kconfig | 3 + cmd/Makefile | 2 + cmd/mvebu/Kconfig | 10 + cmd/mvebu/Makefile | 8 + cmd/mvebu/bubt.c | 726 +++++++++++++++++++++ configs/mvebu_db-88f7040_defconfig | 2 + configs/mvebu_db-88f8040_defconfig | 2 + .../pinctrl/marvell,armada-apn806-pinctrl.txt | 25 + .../pinctrl/marvell,armada-cp110-pinctrl.txt | 270 ++++++++ .../pinctrl/marvell,mvebu-pinctrl.txt | 113 ++++ doc/mvebu/cmd/bubt.txt | 64 ++ drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/mvebu/Kconfig | 7 + drivers/pinctrl/mvebu/Makefile | 7 + drivers/pinctrl/mvebu/pinctrl-mvebu.c | 179 +++++ drivers/pinctrl/mvebu/pinctrl-mvebu.h | 31 + 24 files changed, 1685 insertions(+), 64 deletions(-) create mode 100644 arch/arm/include/asm/arch-armada8k/soc-info.h create mode 100644 cmd/mvebu/Kconfig create mode 100644 cmd/mvebu/Makefile create mode 100644 cmd/mvebu/bubt.c create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-apn806-pinctrl.txt create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-cp110-pinctrl.txt create mode 100644 doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt create mode 100644 doc/mvebu/cmd/bubt.txt create mode 100644 drivers/pinctrl/mvebu/Kconfig create mode 100644 drivers/pinctrl/mvebu/Makefile create mode 100644 drivers/pinctrl/mvebu/pinctrl-mvebu.c create mode 100644 drivers/pinctrl/mvebu/pinctrl-mvebu.h
Signature · 1 line
2.7.4
PATCH v2 1/6 arm64: mvebu: Modify the A8K SPI and I2C config in DTS
From: Konstantin Porotchkin <[email protected]>
Align the Armada-8040-db and Armada-7040-db SPI and I2C DTS settings with latest DB settings:
- 8040-db: disable i2c0 and spi0 on AP (MPPs are reserved for SDIO)
- 8040-db: disable cps_i2c0 on CP1
- 8040-db: enable spi1 on CP1 (the new location of the boot flash) The spi1 on CP1 is aliased as spi0 since this is the way the driver enumerates it.
Changes for v2:
- 7040-db: remove i2c0 and spi0 entries from AP (MPPs are reserved for SDIO)
--- arch/arm/dts/armada-7040-db.dts | 32 ---------------------- arch/arm/dts/armada-8040-db.dts | 60 +++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 67 deletions(-)
arch/arm/dts/armada-7040-db.dts +0 -32
@@ -66,38 +66,6 @@ }; }; -&i2c0 { - status = "okay"; - clock-frequency = <100000>; -}; - -&spi0 { - status = "okay"; - - spi-flash at 0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition at 0 { - label = "U-Boot"; - reg = <0 0x200000>; - }; - partition at 400000 { - label = "Filesystem"; - reg = <0x200000 0xce0000>; - }; - }; - }; -}; - &uart0 { status = "okay"; };
arch/arm/dts/armada-8040-db.dts +25 -35
79 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 1/6 arm64: mvebu: Modify the A8K SPI and I2C config in DTS
Hi Kosta,
Quoted 21 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Align the Armada-8040-db and Armada-7040-db SPI and I2C DTS settings with latest DB settings:
- 8040-db: disable i2c0 and spi0 on AP (MPPs are reserved for SDIO)
- 8040-db: disablecps_i2c0on CP1
- 8040-db: enable spi1 on CP1 (the new location of the boot flash) The spi1 on CP1 is aliased as spi0 since this is the way the driver enumerates it.Changes for v2:
- 7040-db: remove i2c0 and spi0 entries from AP (MPPs are reserved for SDIO)Signed-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>
Quoted 1 line
---
Please move the patch version history below this "---" line. By doing this, the history will not be added to the git repository (where it does not really belong). Please do this generally for all your patches please.
Other than this:
Quoted 124 lines
arch/arm/dts/armada-7040-db.dts | 32 ---------------------- arch/arm/dts/armada-8040-db.dts | 60 +++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 67 deletions(-)arch/arm/dts/armada-7040-db.dts +0
-32@@ -66,38 +66,6 @@ }; }; -&i2c0 { - status = "okay"; - clock-frequency = <100000>; -}; - -&spi0 { - status = "okay"; - - spi-flash at 0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition at 0 { - label = "U-Boot"; - reg = <0 0x200000>; - }; - partition at 400000 { - label = "Filesystem"; - reg = <0x200000 0xce0000>; - }; - }; - }; -}; - &uart0 { status = "okay"; };arch/arm/dts/armada-8040-db.dts +18
-35@@ -57,7 +57,7 @@ aliases { i2c0 = &cpm_i2c0; - spi0 = &spi0; + spi0 = &cps_spi1; }; memory at 00000000 {@@ -66,38 +66,6 @@ }; }; -&i2c0 { - status = "okay"; - clock-frequency = <100000>; -}; - -&spi0 { - status = "okay"; - - spi-flash at 0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition at 0 { - label = "U-Boot"; - reg = <0 0x200000>; - }; - partition at 400000 { - label = "Filesystem"; - reg = <0x200000 0xce0000>; - }; - }; - }; -}; - /* Accessible over the mini-USB CON9 connector on the main board */ &uart0 { status = "okay";@@ -134,9 +102,31 @@ status = "okay"; }; -&cps_i2c0 { +&cps_spi1 { status = "okay"; - clock-frequency = <100000>; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition at 0 { + label = "U-Boot"; + reg = <0 0x200000>;
arch/arm/dts/armada-8040-db.dts line 132
Quoted 10 lines
arch/arm/dts/armada-8040-db.dts +7
-0+ }; + partition at 400000 { + label = "Filesystem"; + reg = <0x200000 0xce0000>; + }; + }; + }; }; /* CON4 on CP1 expansion */
Thanks,
Stefan
PATCH v2 1/6 arm64: mvebu: Modify the A8K SPI and I2C config in DTS
Hi, Stefan,
Quoted 36 lines
-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de]
Sent: Tuesday, December 06, 2016 08:13
To: Kostya Porotchkin; u-boot at lists.denx.de
Cc: Nadav Haklai; Neta Zur Hershkovits; Omri Itach; Igal Liberman; Haim Boot; Hanna Hawa
Subject: Re: [PATCH v2 1/6] arm64: mvebu: Modify the A8K SPI and I2C config in DTSHi Kosta,
Quoted 22 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Align the Armada-8040-db and Armada-7040-db SPI and I2C DTS settings with latest DB settings:
- 8040-db: disable i2c0 and spi0 on AP (MPPs are reserved for SDIO)
- 8040-db: disablecps_i2c0on CP1
- 8040-db: enable spi1 on CP1 (the new location of the boot flash) The spi1 on CP1 is aliased as spi0 since this is the way the driver enumerates it.Changes for v2:
- 7040-db: remove i2c0 and spi0 entries from AP (MPPs are reserved for SDIO)Signed-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>Quoted 1 line
---
Quoted 4 lines
Please move the patch version history below this "---" line. By doing this, the history will not be added to the git repository (where it does not really belong). Please do this generally for all your patches please.
[Konstantin Porotchkin]
As far as I understand the only way to do so is to edit the output patch file produced by "git format-patch".
If I put the change log into my commit message, it always added before the comment line. Is it the right way of handling this kind of comments?
Quoted 143 lines
Other than this:
Reviewed-by Stefan Roese <[email protected]>Quoted 125 lines
arch/arm/dts/armada-7040-db.dts | 32 ---------------------- arch/arm/dts/armada-8040-db.dts | 60 +++++++++++++++++------------------------ 2 files changed, 25 insertions(+), 67 deletions(-)(quoted diff) +0
-0
b/arch/arm/dts/armada-7040-db.dtsindex b8fe5a9..1e4d676 100644arch/arm/dts/armada-7040-db.dts +0
-32@@ -66,38 +66,6 @@ }; }; -&i2c0 { - status = "okay"; - clock-frequency = <100000>; -}; - -&spi0 { - status = "okay"; - - spi-flash at 0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition at 0 { - label = "U-Boot"; - reg = <0 0x200000>; - }; - partition at 400000 { - label = "Filesystem"; - reg = <0x200000 0xce0000>; - }; - }; - }; -}; - &uart0 { status = "okay"; };(quoted diff) +0
-0
b/arch/arm/dts/armada-8040-db.dtsindex 7fb674b..86666a1 100644arch/arm/dts/armada-8040-db.dts +18
-35@@ -57,7 +57,7 @@ aliases { i2c0 = &cpm_i2c0; - spi0 = &spi0; + spi0 = &cps_spi1; }; memory at 00000000 {@@ -66,38 +66,6 @@ }; }; -&i2c0 { - status = "okay"; - clock-frequency = <100000>; -}; - -&spi0 { - status = "okay"; - - spi-flash at 0 { - #address-cells = <1>; - #size-cells = <1>; - compatible = "jedec,spi-nor"; - reg = <0>; - spi-max-frequency = <10000000>; - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - partition at 0 { - label = "U-Boot"; - reg = <0 0x200000>; - }; - partition at 400000 { - label = "Filesystem"; - reg = <0x200000 0xce0000>; - }; - }; - }; -}; - /* Accessible over the mini-USB CON9 connector on the main board */ &uart0 { status = "okay";@@ -134,9 +102,31 @@ status = "okay"; }; -&cps_i2c0 { +&cps_spi1 { status = "okay"; - clock-frequency = <100000>; + + spi-flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "jedec,spi-nor"; + reg = <0>; + spi-max-frequency = <10000000>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + partition at 0 { + label = "U-Boot"; + reg = <0 0x200000>;arch/arm/dts/armada-8040-db.dts line 132
Quoted 10 lines
arch/arm/dts/armada-8040-db.dts +7
-0+ }; + partition at 400000 { + label = "Filesystem"; + reg = <0x200000 0xce0000>; + }; + }; + }; }; /* CON4 on CP1 expansion */Thanks,
Stefan
PATCH v2 1/6 arm64: mvebu: Modify the A8K SPI and I2C config in DTS
Hi Kosta,
Quoted 40 lines · Kostya Porotchkin
Quoted 36 lines
-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de]
Sent: Tuesday, December 06, 2016 08:13
To: Kostya Porotchkin; u-boot at lists.denx.de
Cc: Nadav Haklai; Neta Zur Hershkovits; Omri Itach; Igal Liberman; Haim Boot; Hanna Hawa
Subject: Re: [PATCH v2 1/6] arm64: mvebu: Modify the A8K SPI and I2C config in DTSHi Kosta,
Quoted 22 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Align the Armada-8040-db and Armada-7040-db SPI and I2C DTS settings with latest DB settings:
- 8040-db: disable i2c0 and spi0 on AP (MPPs are reserved for SDIO)
- 8040-db: disablecps_i2c0on CP1
- 8040-db: enable spi1 on CP1 (the new location of the boot flash) The spi1 on CP1 is aliased as spi0 since this is the way the driver enumerates it.Changes for v2:
- 7040-db: remove i2c0 and spi0 entries from AP (MPPs are reserved for SDIO)Signed-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>Quoted 1 line
---
Quoted 4 lines
Please move the patch version history below this "---" line. By doing this, the history will not be added to the git repository (where it does not really belong). Please do this generally for all your patches please.
Quoted 5 lines
[Konstantin Porotchkin]
As far as I understand the only way to do so is to edit the output patch file produced by "git format-patch".
If I put the change log into my commit message, it always added before the comment line. Is it the right way of handling this kind of comments?
Yes, this is one way of handling this. You can also use the patman tool (tools/patman/*) to handle your patches. Its especially helpful when you have to deal with bigger patchsets that likely will undergo multiple versions. I suggest you take a look at the README here as well:
tools/patman/README
But for now (this current patchset) I suggest to manually edit the patches.
Thanks,
Stefan
PATCH v2 2/6 arm64: mvebu: Add bubt command for flash image burn
In reply to kostap at marvell.comFrom: Konstantin Porotchkin <[email protected]>
Add support for mvebu bubt command for flash image load, check and burn on boot device.
Changes for v2:
- Add "bubt" documentation
- Fix code syntax
--- arch/arm/mach-mvebu/Kconfig | 34 +++ cmd/Kconfig | 3 + cmd/Makefile | 2 + cmd/mvebu/Kconfig | 10 + cmd/mvebu/Makefile | 8 + cmd/mvebu/bubt.c | 726 ++++++++++++++++++++++++++++++++++++++++++++ doc/mvebu/cmd/bubt.txt | 64 ++++ 7 files changed, 847 insertions(+) create mode 100644 cmd/mvebu/Kconfig create mode 100644 cmd/mvebu/Makefile create mode 100644 cmd/mvebu/bubt.c create mode 100644 doc/mvebu/cmd/bubt.txt
arch/arm/mach-mvebu/Kconfig +34 -0
@@ -99,6 +99,40 @@ config TARGET_THEADORABLE endchoice +choice + prompt "Flash for image" + default MVEBU_SPI_BOOT + +config MVEBU_NAND_BOOT + bool "NAND flash boot" + depends on NAND_PXA3XX + help + Enable boot from NAND flash. + Use NAND flash as a target for "bubt" command + +config MVEBU_SPI_BOOT + bool "SPI flash boot" + depends on SPI_FLASH + help + Enable boot from SPI flash. + Use SPI flash as a target for "bubt" command + +config MVEBU_MMC_BOOT + bool "eMMC flash boot" + depends on MVEBU_MMC + help + Enable boot from eMMC boot partition + Use eMMC/SD device as a target for "bubt" command + +endchoice + +config MVEBU_UBOOT_DFLT_NAME + string "Default image name for bubt command" + default "flash-image.bin" + help + This option should contain a default file name to be used with + MVEBU "bubt" command if the source file name is omitted + config SYS_BOARD default "clearfog" if TARGET_CLEARFOG default "mvebu_db-88f3720" if TARGET_MVEBU_DB_88F3720
cmd/Kconfig +3 -0
@@ -632,6 +632,9 @@ config CMD_QFW This provides access to the QEMU firmware interface. The main feature is to allow easy loading of files passed to qemu-system via -kernel / -initrd + +source "cmd/mvebu/Kconfig" + endmenu config CMD_BOOTSTAGE
cmd/Makefile +2 -0
@@ -163,3 +163,5 @@ obj-$(CONFIG_CMD_BLOB) += blob.o # core command obj-y += nvedit.o + +obj-$(CONFIG_ARCH_MVEBU) += mvebu/
cmd/mvebu/Kconfig new file +10 -0
@@ -0,0 +1,10 @@ +menu "MVEBU commands" +depends on ARCH_MVEBU + +config CMD_MVEBU_BUBT + bool "bubt" + default n + help + bubt - Burn a u-boot image to flash + +endmenu
cmd/mvebu/Makefile new file +8 -0
@@ -0,0 +1,8 @@ +# +# Copyright (C) 2016 Marvell International Ltd. +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses + + +obj-$(CONFIG_CMD_MVEBU_BUBT) += bubt.o
cmd/mvebu/bubt.c new file +726 -0
726 lines not on this page · raw message
doc/mvebu/cmd/bubt.txt new file +64 -0
64 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 2/6 arm64: mvebu: Add bubt command for flash image burn
Quoted 17 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Add support for mvebu bubt command for flash image load, check and burn on boot device.
Changes for v2:
- Add "bubt" documentation
- Fix code syntaxSigned-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>
Quoted 1 line
---
Again, please move the patch version history.
It seems that you missed to address most of my last review comments. I've added them again below. Please either address them or give me a short notice why not. Thanks.
Quoted 45 lines
arch/arm/mach-mvebu/Kconfig | 34 +++ cmd/Kconfig | 3 + cmd/Makefile | 2 + cmd/mvebu/Kconfig | 10 + cmd/mvebu/Makefile | 8 + cmd/mvebu/bubt.c | 726 ++++++++++++++++++++++++++++++++++++++++++++ doc/mvebu/cmd/bubt.txt | 64 ++++ 7 files changed, 847 insertions(+) create mode 100644 cmd/mvebu/Kconfig create mode 100644 cmd/mvebu/Makefile create mode 100644 cmd/mvebu/bubt.c create mode 100644 doc/mvebu/cmd/bubt.txtarch/arm/mach-mvebu/Kconfig +24
-0@@ -99,6 +99,40 @@ config TARGET_THEADORABLE endchoice +choice + prompt "Flash for image" + default MVEBU_SPI_BOOT + +config MVEBU_NAND_BOOT + bool "NAND flash boot" + depends on NAND_PXA3XX + help + Enable boot from NAND flash. + Use NAND flash as a target for "bubt" command + +config MVEBU_SPI_BOOT + bool "SPI flash boot" + depends on SPI_FLASH + help + Enable boot from SPI flash. + Use SPI flash as a target for "bubt" command + +config MVEBU_MMC_BOOT + bool "eMMC flash boot" + depends on MVEBU_MMC + help + Enable boot from eMMC boot partition + Use eMMC/SD device as a target for "bubt" command
arch/arm/mach-mvebu/Kconfig config TARGET_THEADORABLE · line 135
Quoted 10 lines
arch/arm/mach-mvebu/Kconfig +10
-0+ +endchoice + +config MVEBU_UBOOT_DFLT_NAME + string "Default image name for bubt command" + default "flash-image.bin" + help + This option should contain a default file name to be used with + MVEBU "bubt" command if the source file name is omitted +
Again my question on this location of these Kconfig options. Wouldn't it be better, to move all Kconfig option into cmd/mvebu/Kconfig instead of having most of them in the mach-mvebu file?
Quoted 77 lines
arch/arm/mach-mvebu/Kconfig +0
-0config SYS_BOARD default "clearfog" if TARGET_CLEARFOG default "mvebu_db-88f3720" if TARGET_MVEBU_DB_88F3720cmd/Kconfig +3
-0@@ -632,6 +632,9 @@ config CMD_QFW This provides access to the QEMU firmware interface. The main feature is to allow easy loading of files passed to qemu-system via -kernel / -initrd + +source "cmd/mvebu/Kconfig" + endmenu config CMD_BOOTSTAGEcmd/Makefile +2
-0@@ -163,3 +163,5 @@ obj-$(CONFIG_CMD_BLOB) += blob.o # core command obj-y += nvedit.o + +obj-$(CONFIG_ARCH_MVEBU) += mvebu/cmd/mvebu/Kconfig new file +10
-0@@ -0,0 +1,10 @@ +menu "MVEBU commands" +depends on ARCH_MVEBU + +config CMD_MVEBU_BUBT + bool "bubt" + default n + help + bubt - Burn a u-boot image to flash + +endmenucmd/mvebu/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2016 Marvell International Ltd. +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses + + +obj-$(CONFIG_CMD_MVEBU_BUBT) += bubt.ocmd/mvebu/bubt.c new file +14
-0@@ -0,0 +1,726 @@ +/* +* Copyright (C) 2016 Marvell International Ltd. +* +* SPDX-License-Identifier: GPL-2.0 +* https://spdx.org/licenses +*/ + +#include <config.h> +#include <common.h> +#include <command.h> +#include <vsprintf.h> +#include <errno.h> +#include <dm.h> +
cmd/mvebu/bubt.c line 24
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+#include <spi_flash.h> +#include <spi.h> +#include <nand.h> +#include <usb.h> +#include <fs.h> +#include <mmc.h> +#include <u-boot/sha1.h> +#include <u-boot/sha256.h> + +#if defined(CONFIG_TARGET_MVEBU_ARMADA_8K )
Please use CONFIG_ARMADA_8K instead. So below...
Quoted 14 lines
cmd/mvebu/bubt.c new file +14
-0+#define MAIN_HDR_MAGIC 0xB105B002 + +struct mvebu_image_header { +u32 magic;/* 0-3 */ +u32 prolog_size;/* 4-7 */ +u32 prolog_checksum;/* 8-11 */ +u32 boot_image_size;/* 12-15 */ +u32 boot_image_checksum;/* 16-19 */ +u32 rsrvd0;/* 20-23 */ +u32 load_addr;/* 24-27 */ +u32 exec_addr;/* 28-31 */ +u8 uart_cfg;/* 32 */ +u8 baudrate;/* 33 */ +u8 ext_count;/* 34 */
cmd/mvebu/bubt.c line 48
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+u8 aux_flags;/* 35 */ +u32 io_arg_0;/* 36-39 */ +u32 io_arg_1;/* 40-43 */ +u32 io_arg_2;/* 43-47 */ +u32 io_arg_3;/* 48-51 */ +u32 rsrvd1;/* 52-55 */ +u32 rsrvd2;/* 56-59 */ + u32 rsrvd3; /* 60-63 */ +}; +#elif defined(CONFIG_TARGET_MVEBU_DB_88F3720)/* A3700 */
Please use CONFIG_ARMADA_3700 as this is most likely not board specific but platform (SoC) specific.
Quoted 60 lines
cmd/mvebu/bubt.c new file +60
-0+#define HASH_SUM_LEN 16 +#define IMAGE_VERSION_3_6_0 0x030600 +#define IMAGE_VERSION_3_5_0 0x030500 + +struct common_tim_data { +u32 version; +u32 identifier; +u32 trusted; +u32 issue_date; +u32 oem_unique_id; +u32 reserved[5 ];/* Reserve 20 bytes */ +u32 boot_flash_sign; +u32 num_images; +u32 num_keys; +u32 size_of_reserved; +}; + +struct mvebu_image_info { +u32 image_id; +u32 next_image_id; +u32 flash_entry_addr; +u32 load_addr; +u32 image_size; +u32 image_size_to_hash; +u32 hash_algorithm_id; +u32 hash[HASH_SUM_LEN ];/* Reserve 512 bits for the hash */ +u32 partition_number; +u32 enc_algorithm_id; +u32 encrypt_start_offset; +u32 encrypt_size; +}; +#endif + +struct bubt_dev { +char name[8 ]; +size_t (*read)(const char *file_name); +int (*write)(size_t image_size); +int (*active)(void ); +}; + +static ulong get_load_addr (void ) +{ +const char *addr_str; +unsigned long addr; + + addr_str =getenv ("loadaddr" ); +if (addr_str) + addr =simple_strtoul (addr_str,NULL ,16 ); +else + addr =CONFIG_SYS_LOAD_ADDR ; + +return addr; +} + +/******************************************************************** +* eMMC services +********************************************************************/ +#ifdef CONFIG_DM_MMC +static int mmc_burn_image (size_t image_size) +{
cmd/mvebu/bubt.c line 118
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+struct mmc *mmc; +lbaint_t start_lba; +lbaint_t blk_count; +ulong blk_written; +int err; +#ifdef CONFIG_SYS_MMC_ENV_DEV +const u8 mmc_dev_num =CONFIG_SYS_MMC_ENV_DEV ; +#else +const u8 mmc_dev_num =0 ; +#endif
I suggest to move this one up in this file to make the code look a bit "cleaner", like this:
#ifndef CONFIG_SYS_MMC_ENV_DEV
#define CONFIG_SYS_MMC_ENV_DEV 0
#endif
Then you can remove the #ifdef from the code here.
Quoted 49 lines
cmd/mvebu/bubt.c new file +49
-0+ + mmc =find_mmc_device (mmc_dev_num); +if (!mmc) { +printf ("No SD/MMC/eMMC card found\n" ); +return -ENOMEDIUM ; + } + + err =mmc_init (mmc); +if (err) { +printf ("%s(%d) init failed\n" ,IS_SD (mmc) ?"SD" :"MMC" , + mmc_dev_num); +return err; + } + +#ifdef CONFIG_SYS_MMC_ENV_PART +if (mmc->part_num !=CONFIG_SYS_MMC_ENV_PART ) { + err =mmc_switch_part (mmc_dev_num,CONFIG_SYS_MMC_ENV_PART ); +if (err) { +printf ("MMC partition switch failed\n" ); +return err; + } + } +#endif + +/* SD reserves LBA-0 for MBR and boots from LBA-1, +* MMC/eMMC boots from LBA-0 +*/ + start_lba =IS_SD (mmc) ?1 :0 ; + blk_count = image_size / mmc->block_dev.blksz; +if (image_size % mmc->block_dev.blksz) + blk_count +=1 ; + + blk_written = mmc->block_dev.block_write (mmc_dev_num, + start_lba, blk_count, + (void *)get_load_addr ()); +if (blk_written != blk_count) { +printf ("Error - written %#lx blocks\n" , blk_written); +return -ENOSPC ; + } +printf ("Done!\n" ); + +#ifdef CONFIG_SYS_MMC_ENV_PART +if (mmc->part_num !=CONFIG_SYS_MMC_ENV_PART ) +mmc_switch_part (mmc_dev_num, mmc->part_num); +#endif + +return 0 ; +} +
cmd/mvebu/bubt.c line 177
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+static size_t mmc_read_file (const char *file_name) +{ +loff_t act_read =0 ; +int rc; +struct mmc *mmc; +#ifdef CONFIG_SYS_MMC_ENV_DEV +const u8 mmc_dev_num =CONFIG_SYS_MMC_ENV_DEV ; +#else +const u8 mmc_dev_num =0 ; +#endif
Same comment here.
Quoted 26 lines
cmd/mvebu/bubt.c new file +26
-0+ + mmc =find_mmc_device (mmc_dev_num); +if (!mmc) { +printf ("No SD/MMC/eMMC card found\n" ); +return 0 ; + } + +if (mmc_init (mmc)) { +printf ("%s(%d) init failed\n" ,IS_SD (mmc) ?"SD" :"MMC" , + mmc_dev_num); +return 0 ; + } + +/* Load from data partition (0) */ +if (fs_set_blk_dev ("mmc" ,"0" ,FS_TYPE_ANY )) { +printf ("Error: MMC 0 not found\n" ); +return 0 ; + } + +/* Perfrom file read */ + rc =fs_read (file_name,get_load_addr (),0 ,0 , &act_read); +if (rc) +return 0 ; + +return act_read; +}
cmd/mvebu/bubt.c line 213
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+ +int is_mmc_active (void ) +{ +return 1 ; +} +#else /* CONFIG_DM_MMC */ +#define mmc_burn_image 0 +#define mmc_read_file 0 +#define is_mmc_active 0 +#endif /* CONFIG_DM_MMC */
Please use empty functions instead.
Quoted 47 lines
cmd/mvebu/bubt.c new file +47
-0+ +/******************************************************************** +* SPI services +********************************************************************/ +#ifdef CONFIG_SPI_FLASH +static int spi_burn_image (size_t image_size) +{ +int ret; +struct spi_flash *flash; +u32 erase_bytes; + +/* Probe the SPI bus to get the flash device */ + flash =spi_flash_probe (CONFIG_ENV_SPI_BUS , +CONFIG_ENV_SPI_CS , +CONFIG_SF_DEFAULT_SPEED , +CONFIG_SF_DEFAULT_MODE ); +if (!flash) { +printf ("Failed to probe SPI Flash\n" ); +return -ENOMEDIUM ; + } + +#ifdef CONFIG_SPI_FLASH_PROTECTION +spi_flash_protect (flash,0 ); +#endif + erase_bytes = image_size + + (flash->erase_size - image_size % flash->erase_size); +printf ("Erasing %d bytes (%d blocks) at offset 0 ..." , + erase_bytes, erase_bytes / flash->erase_size); + ret =spi_flash_erase (flash,0 , erase_bytes); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +printf ("Writing %d bytes from 0x%lx to offset 0 ..." , + (int )image_size,get_load_addr ()); + ret =spi_flash_write (flash,0 , image_size, (void *)get_load_addr ()); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +#ifdef CONFIG_SPI_FLASH_PROTECTION +spi_flash_protect (flash,1 ); +#endif + +return ret;
cmd/mvebu/bubt.c line 270
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+} + +int is_spi_active (void ) +{ +return 1 ; +} +#else /* CONFIG_SPI_FLASH */ +#define spi_burn_image 0 +#define is_spi_active 0 +#endif /* CONFIG_SPI_FLASH */
Empty functions please.
Quoted 42 lines
cmd/mvebu/bubt.c new file +42
-0+ +/******************************************************************** +* NAND services +********************************************************************/ +#ifdef CONFIG_CMD_NAND +static int nand_burn_image (size_t image_size) +{ +int ret, block_size; +nand_info_t *nand; +int dev = nand_curr_device; + +if ((dev <0 ) || (dev >=CONFIG_SYS_MAX_NAND_DEVICE ) || + (!nand_info[dev].name)) { +puts ("\nno devices available\n" ); +return -ENOMEDIUM ; + } + nand = &nand_info[dev]; + block_size = nand->erasesize; + +/* Align U-Boot size to currently used blocksize */ + image_size = ((image_size + (block_size -1 )) & (~(block_size -1 ))); + +/* Erase the U-BOOT image space */ +printf ("Erasing 0x%x - 0x%x:..." ,0 , (int )image_size); + ret =nand_erase (nand,0 , image_size); +if (ret) { +printf ("Error!\n" ); + goto error; + } +printf ("Done!\n" ); + +/* Write the image to flash */ +printf ("Writing image:..." ); +printf ("&image_size = 0x%p\n" , (void *)&image_size); + ret =nand_write (nand,0 , &image_size, (void *)get_load_addr ()); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +error: +return ret;
cmd/mvebu/bubt.c line 322
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+} + +int is_nand_active (void ) +{ +return 1 ; +} +#else /* CONFIG_CMD_NAND */ +#define nand_burn_image 0 +#define is_nand_active 0 +#endif /* CONFIG_CMD_NAND */
Empty functions please.
Quoted 189 lines
cmd/mvebu/bubt.c new file +189
-0+ +/******************************************************************** +* USB services +********************************************************************/ +#if defined(CONFIG_USB_STORAGE ) && defined(CONFIG_BLK ) +static size_t usb_read_file (const char *file_name) +{ +loff_t act_read =0 ; +struct udevice *dev; +int rc; + +usb_stop (); + +if (usb_init () <0 ) { +printf ("Error: usb_init failed\n" ); +return 0 ; + } + +/* Try to recognize storage devices immediately */ +blk_first_device (IF_TYPE_USB , &dev); +if (!dev) { +printf ("Error: USB storage device not found\n" ); +return 0 ; + } + +/* Always load from usb 0 */ +if (fs_set_blk_dev ("usb" ,"0" ,FS_TYPE_ANY )) { +printf ("Error: USB 0 not found\n" ); +return 0 ; + } + +/* Perfrom file read */ + rc =fs_read (file_name,get_load_addr (),0 ,0 , &act_read); +if (rc) +return 0 ; + +return act_read; +} + +int is_usb_active (void ) +{ +return 1 ; +} +#else /* defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */ +#define usb_read_file 0 +#define is_usb_active 0 +#endif /* defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */ + +/******************************************************************** +* Network services +********************************************************************/ +#ifdef CONFIG_CMD_NET +static size_t tftp_read_file (const char *file_name) +{ +/* update global variable load_addr before tftp file from network */ + load_addr =get_load_addr (); +return net_loop (TFTPGET ); +} + +int is_tftp_active (void ) +{ +return 1 ; +} +#else +#define tftp_read_file 0 +#define is_tftp_active 0 +#endif /* CONFIG_CMD_NET */ + +enum bubt_devices { +BUBT_DEV_NET =0 , +BUBT_DEV_USB , +BUBT_DEV_MMC , +BUBT_DEV_SPI , +BUBT_DEV_NAND , + +BUBT_MAX_DEV +}; + +struct bubt_dev bubt_devs[BUBT_MAX_DEV ] = { + {"tftp" , tftp_read_file,NULL , is_tftp_active}, + {"usb" , usb_read_file,NULL , is_usb_active}, + {"mmc" , mmc_read_file, mmc_burn_image, is_mmc_active}, + {"spi" ,NULL , spi_burn_image, is_spi_active}, + {"nand" ,NULL , nand_burn_image, is_nand_active}, +}; + +static int bubt_write_file (struct bubt_dev *dst,size_t image_size) +{ +if (!dst->write) { +printf ("Error: Write not supported on device %s\n" , dst->name); +return -ENOTSUPP ; + } + +return dst->write (image_size); +} + +#if defined(CONFIG_TARGET_MVEBU_ARMADA_8K ) +u32 do_checksum32 (u32 *start,int32_t len) +{ +u32 sum =0 ; +u32 *startp = start; + +do { + sum += *startp; + startp++; + len -=4 ; + }while (len >0 ); + +return sum; +} + +static int check_image_header (void ) +{ +struct mvebu_image_header *hdr = + (struct mvebu_image_header *)get_load_addr (); +u32 header_len = hdr->prolog_size; +u32 checksum; +u32 checksum_ref = hdr->prolog_checksum; + +/* +* For now compare checksum, and magic. Later we can +* verify more stuff on the header like interface type, etc +*/ +if (hdr->magic !=MAIN_HDR_MAGIC ) { +printf ("ERROR: Bad MAGIC 0x%08x != 0x%08x\n" , + hdr->magic,MAIN_HDR_MAGIC ); +return -ENOEXEC ; + } + +/* The checksum value is discarded from checksum calculation */ + hdr->prolog_checksum =0 ; + + checksum =do_checksum32 ((u32 *)hdr, header_len); +if (checksum != checksum_ref) { +printf ("Error: Bad Image checksum. 0x%x != 0x%x\n" , + checksum, checksum_ref); +return -ENOEXEC ; + } + +/* Restore the checksum before writing */ + hdr->prolog_checksum = checksum_ref; +printf ("Image checksum...OK!\n" ); + +return 0 ; +} +#elif defined(CONFIG_TARGET_MVEBU_DB_88F3720 )/* Armada 3700 */ +static int check_image_header (void ) +{ +struct common_tim_data *hdr = (struct common_tim_data *)get_load_addr (); +int image_num; +u8 hash_160_output[SHA1_SUM_LEN ]; +u8 hash_256_output[SHA256_SUM_LEN ]; +sha1_context hash1_text; +sha256_context hash256_text; +u8 *hash_output; +u32 hash_algorithm_id; +u32 image_size_to_hash; +u32 flash_entry_addr; +u32 *hash_value; +u32 internal_hash[HASH_SUM_LEN ]; +const u8 *buff; +u32 num_of_image = hdr->num_images; +u32 version = hdr->version; +u32 trusted = hdr->trusted; + +/* bubt checksum validation only supports nontrusted images */ +if (trusted ==1 ) { +printf ("bypass image validation, " ); +printf ("only untrusted image is supported now\n" ); +return 0 ; + } +/* only supports image version 3.5 and 3.6 */ +if (version !=IMAGE_VERSION_3_5_0 && version !=IMAGE_VERSION_3_6_0 ) { +printf ("Error: Unsupported Image version = 0x%08x\n" , version); +return -ENOEXEC ; + } +/* validate images hash value */ +for (image_num =0 ; image_num < num_of_image; image_num++) { +struct mvebu_image_info *info = + (struct mvebu_image_info *)(get_load_addr () + +sizeof (struct common_tim_data ) + + image_num *sizeof (struct mvebu_image_info )); + hash_algorithm_id = info->hash_algorithm_id; + image_size_to_hash = info->image_size_to_hash; + flash_entry_addr = info->flash_entry_addr; + hash_value = info->hash; + buff = (const u8 *)(get_load_addr () + flash_entry_addr); + +if (image_num ==0 ) {
cmd/mvebu/bubt.c line 521
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+/* The first image includes hash values in its content. +* For hash calculation, we need to save the original +* hash values to a local variable that will be +* copied back for comparsion and set all zeros to +* the orignal hash values for calculating new value. +* First image original format : +* x...x (datum1) x...x(orig. hash values) x...x(datum2) +* Replaced first image format : +* x...x (datum1) 0...0(hash values) x...x(datum2) +*/
Multicomment style is:
/*
*
*/
Quoted 266 lines
cmd/mvebu/bubt.c new file +205
-0+memcpy (internal_hash, hash_value, +sizeof (internal_hash)); +memset (hash_value,0 ,sizeof (internal_hash)); + } +if (image_size_to_hash ==0 ) { +printf ("Warning: Image_%d hash checksum is disabled, " , + image_num); +printf ("skip the image validation.\n" ); +continue ; + } +switch (hash_algorithm_id) { +case SHA1_SUM_LEN : +sha1_starts (&hash1_text); +sha1_update (&hash1_text, buff, image_size_to_hash); +sha1_finish (&hash1_text, hash_160_output); + hash_output = hash_160_output; +break ; +case SHA256_SUM_LEN : +sha256_starts (&hash256_text); +sha256_update (&hash256_text, buff, image_size_to_hash); +sha256_finish (&hash256_text, hash_256_output); + hash_output = hash_256_output; +break ; +default : +printf ("Error: Unsupported hash_algorithm_id = %d\n" , + hash_algorithm_id); +return -ENOEXEC ; + } +if (image_num ==0 ) +memcpy (hash_value, internal_hash, +sizeof (internal_hash)); +if (memcmp (hash_value, hash_output, hash_algorithm_id) !=0 ) { +printf ("Error: Image_%d checksum is not correct\n" , + image_num); +return -ENOEXEC ; + } + } +printf ("Image checksum...OK!\n" ); + +return 0 ; +} +#else +static int check_image_header (void ) +{ +printf ("bubt cmd does not support this SoC device or family!\n" ); +return -ENOEXEC ; +} +#endif + +static int bubt_verify (size_t image_size) +{ +int err; + +/* Check a correct image header exists */ + err =check_image_header (); +if (err) { +printf ("Error: Image header verification failed\n" ); +return err; + } + +return 0 ; +} + +static int bubt_read_file (struct bubt_dev *src) +{ +size_t image_size; + +if (!src->read) { +printf ("Error: Read not supported on device \"%s\"\n" , + src->name); +return 0 ; + } + + image_size = src->read (net_boot_file_name); +if (image_size <=0 ) { +printf ("Error: Failed to read file %s from %s\n" , + net_boot_file_name, src->name); +return 0 ; + } + +return image_size; +} + +static int bubt_is_dev_active (struct bubt_dev *dev) +{ +if (!dev->active) { +printf ("Device \"%s\" not supported by U-BOOT image\n" , + dev->name); +return 0 ; + } + +if (!dev->active ()) { +printf ("Device \"%s\" is inactive\n" , dev->name); +return 0 ; + } + +return 1 ; +} + +struct bubt_dev *find_bubt_dev (char *dev_name) +{ +int dev; + +for (dev =0 ; dev <BUBT_MAX_DEV ; dev++) { +if (strcmp (bubt_devs[dev].name, dev_name) ==0 ) +return &bubt_devs[dev]; + } + +return 0 ; +} + +#define DEFAULT_BUBT_SRC "tftp" + +#ifndef DEFAULT_BUBT_DST +#ifdef CONFIG_MVEBU_SPI_BOOT +#define DEFAULT_BUBT_DST "spi" +#elif defined(CONFIG_MVEBU_NAND_BOOT ) +#define DEFAULT_BUBT_DST "nand" +#elif defined(CONFIG_MVEBU_MMC_BOOT ) +#define DEFAULT_BUBT_DST "mmc" +else +#define DEFAULT_BUBT_DST "error" +#endif +#endif /* DEFAULT_BUBT_DST */ + +int do_bubt_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) +{ +struct bubt_dev *src, *dst; +size_t image_size; +char src_dev_name[8 ]; +char dst_dev_name[8 ]; +char *name; +int err; + +if (argc <2 ) +copy_filename (net_boot_file_name, +CONFIG_MVEBU_UBOOT_DFLT_NAME , +sizeof (net_boot_file_name)); +else +copy_filename (net_boot_file_name, argv[1 ], +sizeof (net_boot_file_name)); + +if (argc >=3 ) { +strncpy (dst_dev_name, argv[2 ],8 ); + }else { + name =DEFAULT_BUBT_DST ; +strncpy (dst_dev_name, name,8 ); + } + +if (argc >=4 ) +strncpy (src_dev_name, argv[3 ],8 ); +else +strncpy (src_dev_name,DEFAULT_BUBT_SRC ,8 ); + +/* Figure out the destination device */ + dst =find_bubt_dev (dst_dev_name); +if (!dst) { +printf ("Error: Unknown destination \"%s\"\n" , dst_dev_name); +return -EINVAL ; + } + +if (!bubt_is_dev_active (dst)) +return -ENODEV ; + +/* Figure out the source device */ + src =find_bubt_dev (src_dev_name); +if (!src) { +printf ("Error: Unknown source \"%s\"\n" , src_dev_name); +return 1 ; + } + +if (!bubt_is_dev_active (src)) +return -ENODEV ; + +printf ("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n" , + net_boot_file_name, src->name, dst->name); + + image_size =bubt_read_file (src); +if (!image_size) +return -EIO ; + + err =bubt_verify (image_size); +if (err) +return err; + + err =bubt_write_file (dst, image_size); +if (err) +return err; + +return 0 ; +} + +U_BOOT_CMD ( + bubt,4 ,0 , do_bubt_cmd, +"Burn a u-boot image to flash" , +"[file-name] [destination [source]]\n" +"\t-file-name The image file name to burn. Default = flash-image.bin\n" +"\t-destination Flash to burn to [spi, nand, mmc]. Default = active boot device\n" +"\t-source The source to load image from [tftp, usb, mmc]. Default = tftp\n" +"Examples:\n" +"\tbubt - Burn flash-image.bin from tftp to active boot device\n" +"\tbubt flash-image-new.bin nand - Burn flash-image-new.bin from tftp to NAND flash\n" +"\tbubt backup-flash-image.bin mmc usb - Burn backup-flash-image.bin from usb to MMC\n" + +);doc/mvebu/cmd/bubt.txt new file +54
-0@@ -0,0 +1,64 @@ +BUBT (Burn ATF) command +-------------------------- +Bubt command is used to burn a new ATF image to flash device. + +The bubt command gets the following parameters: ATF file name, destination device and source device. +bubt [file-name] [destination [source]] + - file-name Image file name to burn. default = flash-image.bin + - destination Flash to burn to [spi, nand, mmc]. default = active flash + - source Source to load image from [tftp, usb]. default = tftp + +Examples: + bubt - Burn flash-image.bin from tftp to active flash + bubt latest-spi.bin nand - Burn latest-spi.bin from tftp to NAND flash + +Notes: +- For the TFTP interface set serverip and ipaddr. +- To burn image to SD/eMMC device, the target is defined + by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART. + +Bubt command details (burn image step by-step) +---------------------------------------------- +This section describes bubt command flow: + +1. Fetch the requested ATF image from an available interface (USB/SD/SATA/XDB, etc.) + into the DRAM, and place it at <load_address> + Example: when using the FAT file system on USB flash device: + # usb reset + # fatls usb 0 (see files in device) + # fatload usb 0 <load_address> <file_name> + +2. Erase the target device: + - NAND: # nand erase 0 100000 + - SPI: # sf probe 0 + # sf erase 0 100000 + - SD/eMMC: # mmc dev <dev_id> <boot_partition> + +Notes: +- The eMMC has 2 boot partitions (BOOT0 and BOOT1) and a user data partition (DATA). + The boot partitions are numbered as partition 1 and 2 in MMC driver. + Number 0 is used for user data partition and should not be utilized for storing + boot images and U-Boot environment in RAW mode since it will break file system + structures usually located here. + The default boot partition is BOOT0. It is selected by the following parameter: + CONFIG_SYS_MMC_ENV_PART=1 + Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1. + Please never use partition number 0 here! + The eMMC has 2 boot partitions (BOOT0 and BOOT1) and a user data partition (DATA). + The boot partitions are numbered as partition 1 and 2 in MMC driver. + Number 0 is used for user data partition and should not be utilized for storing + boot images and U-Boot environment in RAW mode since it will break file system + structures usually located here. + The default boot partition is BOOT0. It is selected by the following parameter: + CONFIG_SYS_MMC_ENV_PART=1 + Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1.
doc/mvebu/cmd/bubt.txt line 64
Quoted 10 lines
doc/mvebu/cmd/bubt.txt new file +10
-0+ Please never use partition number 0 here! +- The partition number is ignored if the target device is SD card. +- The boot image offset starts at block 0 for eMMC and block 1 for SD devices. + The block 0 on SD devices is left for MBR storage. + +3. Write the ATF image: + - NAND: # nand write <load_address> 0 <ATF Size> + - SPI: # sf write <load_address> 0 <ATF Size> + - SD/eMMC: # mmc write <load_address> [0|1] <ATF Size>/<block_size> +
Thanks,
Stefan
PATCH v2 2/6 arm64: mvebu: Add bubt command for flash image burn
Hi, Stefan,
Thank you for review and sorry for missing your earlier notes. It was not intentional.
I will prepare a new patch version with all the fixes.
Regards
Kosta
-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de]
Sent: Tuesday, December 06, 2016 08:22
To: Kostya Porotchkin; u-boot at lists.denx.de
Cc: Nadav Haklai; Neta Zur Hershkovits; Omri Itach; Igal Liberman; Haim Boot; Hanna Hawa
Subject: Re: [PATCH v2 2/6] arm64: mvebu: Add bubt command for flash image burn
Quoted 17 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Add support for mvebu bubt command for flash image load, check and burn on boot device.
Changes for v2:
- Add "bubt" documentation
- Fix code syntaxSigned-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>
Quoted 1 line
---
Again, please move the patch version history.
It seems that you missed to address most of my last review comments.
I've added them again below. Please either address them or give me a short notice why not. Thanks.
Quoted 44 lines
arch/arm/mach-mvebu/Kconfig | 34 +++ cmd/Kconfig | 3 + cmd/Makefile | 2 + cmd/mvebu/Kconfig | 10 + cmd/mvebu/Makefile | 8 + cmd/mvebu/bubt.c | 726 ++++++++++++++++++++++++++++++++++++++++++++ doc/mvebu/cmd/bubt.txt | 64 ++++ 7 files changed, 847 insertions(+) create mode 100644 cmd/mvebu/Kconfig create mode 100644 cmd/mvebu/Makefile create mode 100644
cmd/mvebu/bubt.ccreate mode 100644doc/mvebu/cmd/bubt.txtarch/arm/mach-mvebu/Kconfig +24
-0@@ -99,6 +99,40 @@ config TARGET_THEADORABLE endchoice +choice + prompt "Flash for image" + default MVEBU_SPI_BOOT + +config MVEBU_NAND_BOOT + bool "NAND flash boot" + depends on NAND_PXA3XX + help + Enable boot from NAND flash. + Use NAND flash as a target for "bubt" command + +config MVEBU_SPI_BOOT + bool "SPI flash boot" + depends on SPI_FLASH + help + Enable boot from SPI flash. + Use SPI flash as a target for "bubt" command + +config MVEBU_MMC_BOOT + bool "eMMC flash boot" + depends on MVEBU_MMC + help + Enable boot from eMMC boot partition + Use eMMC/SD device as a target for "bubt" command
arch/arm/mach-mvebu/Kconfig config TARGET_THEADORABLE · line 135
Quoted 10 lines
arch/arm/mach-mvebu/Kconfig +10
-0+ +endchoice + +config MVEBU_UBOOT_DFLT_NAME + string "Default image name for bubt command" + default "flash-image.bin" + help + This option should contain a default file name to be used with + MVEBU "bubt" command if the source file name is omitted +
Again my question on this location of these Kconfig options. Wouldn't it be better, to move all Kconfig option into cmd/mvebu/Kconfig instead of having most of them in the mach-mvebu file?
Quoted 72 lines
arch/arm/mach-mvebu/Kconfig +0
-0config SYS_BOARD default "clearfog" if TARGET_CLEARFOG default "mvebu_db-88f3720" if TARGET_MVEBU_DB_88F3720 diff --gita/cmd/Kconfig b/cmd/Kconfig index b16c603..b38d285 100644
cmd/Kconfig +3
-0@@ -632,6 +632,9 @@ config CMD_QFW This provides access to the QEMU firmware interface. The main feature is to allow easy loading of files passed to qemu-system via -kernel / -initrd + +source "cmd/mvebu/Kconfig" + endmenu config CMD_BOOTSTAGEcmd/Makefile +2
-0@@ -163,3 +163,5 @@ obj-$(CONFIG_CMD_BLOB) += blob.o # core command obj-y += nvedit.o + +obj-$(CONFIG_ARCH_MVEBU) += mvebu/cmd/mvebu/Kconfig new file mode renamed from cmd/mvebu/Kconfig +0
-0100644 index 0000000..e7fbd20
cmd/mvebu/Kconfig new file +10
-0@@ -0,0 +1,10 @@ +menu "MVEBU commands" +depends on ARCH_MVEBU + +config CMD_MVEBU_BUBT + bool "bubt" + default n + help + bubt - Burn a u-boot image to flash + +endmenucmd/mvebu/Makefile new file mode renamed from cmd/mvebu/Makefile +0
-0100644 index 0000000..03de53e
cmd/mvebu/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2016 Marvell International Ltd. +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses + + +obj-$(CONFIG_CMD_MVEBU_BUBT) += bubt.ocmd/mvebu/bubt.c new file +14
-0@@ -0,0 +1,726 @@ +/* +* Copyright (C) 2016 Marvell International Ltd. +* +* SPDX-License-Identifier: GPL-2.0 +* https://spdx.org/licenses +*/ + +#include <config.h> +#include <common.h> +#include <command.h> +#include <vsprintf.h> +#include <errno.h> +#include <dm.h> +
cmd/mvebu/bubt.c line 24
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+#include <spi_flash.h> +#include <spi.h> +#include <nand.h> +#include <usb.h> +#include <fs.h> +#include <mmc.h> +#include <u-boot/sha1.h> +#include <u-boot/sha256.h> + +#if defined(CONFIG_TARGET_MVEBU_ARMADA_8K )
Please use CONFIG_ARMADA_8K instead. So below...
Quoted 14 lines
cmd/mvebu/bubt.c new file +14
-0+#define MAIN_HDR_MAGIC 0xB105B002 + +struct mvebu_image_header { +u32 magic;/* 0-3 */ +u32 prolog_size;/* 4-7 */ +u32 prolog_checksum;/* 8-11 */ +u32 boot_image_size;/* 12-15 */ +u32 boot_image_checksum;/* 16-19 */ +u32 rsrvd0;/* 20-23 */ +u32 load_addr;/* 24-27 */ +u32 exec_addr;/* 28-31 */ +u8 uart_cfg;/* 32 */ +u8 baudrate;/* 33 */ +u8 ext_count;/* 34 */
cmd/mvebu/bubt.c line 48
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+u8 aux_flags;/* 35 */ +u32 io_arg_0;/* 36-39 */ +u32 io_arg_1;/* 40-43 */ +u32 io_arg_2;/* 43-47 */ +u32 io_arg_3;/* 48-51 */ +u32 rsrvd1;/* 52-55 */ +u32 rsrvd2;/* 56-59 */ + u32 rsrvd3; /* 60-63 */ +}; +#elif defined(CONFIG_TARGET_MVEBU_DB_88F3720)/* A3700 */
Please use CONFIG_ARMADA_3700 as this is most likely not board specific but platform (SoC) specific.
Quoted 60 lines
cmd/mvebu/bubt.c new file +60
-0+#define HASH_SUM_LEN 16 +#define IMAGE_VERSION_3_6_0 0x030600 +#define IMAGE_VERSION_3_5_0 0x030500 + +struct common_tim_data { +u32 version; +u32 identifier; +u32 trusted; +u32 issue_date; +u32 oem_unique_id; +u32 reserved[5 ];/* Reserve 20 bytes */ +u32 boot_flash_sign; +u32 num_images; +u32 num_keys; +u32 size_of_reserved; +}; + +struct mvebu_image_info { +u32 image_id; +u32 next_image_id; +u32 flash_entry_addr; +u32 load_addr; +u32 image_size; +u32 image_size_to_hash; +u32 hash_algorithm_id; +u32 hash[HASH_SUM_LEN ];/* Reserve 512 bits for the hash */ +u32 partition_number; +u32 enc_algorithm_id; +u32 encrypt_start_offset; +u32 encrypt_size; +}; +#endif + +struct bubt_dev { +char name[8 ]; +size_t (*read)(const char *file_name); +int (*write)(size_t image_size); +int (*active)(void ); +}; + +static ulong get_load_addr (void ) +{ +const char *addr_str; +unsigned long addr; + + addr_str =getenv ("loadaddr" ); +if (addr_str) + addr =simple_strtoul (addr_str,NULL ,16 ); +else + addr =CONFIG_SYS_LOAD_ADDR ; + +return addr; +} + +/******************************************************************** +* eMMC services ++ ********************************************************************/ +#ifdef CONFIG_DM_MMC +static int mmc_burn_image (size_t image_size) {
cmd/mvebu/bubt.c line 177
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+struct mmc *mmc; +lbaint_t start_lba; +lbaint_t blk_count; +ulong blk_written; +int err; +#ifdef CONFIG_SYS_MMC_ENV_DEV +const u8 mmc_dev_num =CONFIG_SYS_MMC_ENV_DEV ; +#else +const u8 mmc_dev_num =0 ; +#endif
I suggest to move this one up in this file to make the code look a bit "cleaner", like this:
#ifndef CONFIG_SYS_MMC_ENV_DEV
#define CONFIG_SYS_MMC_ENV_DEV 0
#endif
Then you can remove the #ifdef from the code here.
Quoted 47 lines
cmd/mvebu/bubt.c new file +47
-0+ + mmc =find_mmc_device (mmc_dev_num); +if (!mmc) { +printf ("No SD/MMC/eMMC card found\n" ); +return -ENOMEDIUM ; + } + + err =mmc_init (mmc); +if (err) { +printf ("%s(%d) init failed\n" ,IS_SD (mmc) ?"SD" :"MMC" , + mmc_dev_num); +return err; + } + +#ifdef CONFIG_SYS_MMC_ENV_PART +if (mmc->part_num !=CONFIG_SYS_MMC_ENV_PART ) { + err =mmc_switch_part (mmc_dev_num,CONFIG_SYS_MMC_ENV_PART ); +if (err) { +printf ("MMC partition switch failed\n" ); +return err; + } + } +#endif + +/* SD reserves LBA-0 for MBR and boots from LBA-1, +* MMC/eMMC boots from LBA-0 +*/ + start_lba =IS_SD (mmc) ?1 :0 ; + blk_count = image_size / mmc->block_dev.blksz; +if (image_size % mmc->block_dev.blksz) + blk_count +=1 ; + + blk_written = mmc->block_dev.block_write (mmc_dev_num, + start_lba, blk_count, + (void *)get_load_addr ()); +if (blk_written != blk_count) { +printf ("Error - written %#lx blocks\n" , blk_written); +return -ENOSPC ; + } +printf ("Done!\n" ); + +#ifdef CONFIG_SYS_MMC_ENV_PART +if (mmc->part_num !=CONFIG_SYS_MMC_ENV_PART ) +mmc_switch_part (mmc_dev_num, mmc->part_num);#endif + +return 0 ; +}
cmd/mvebu/bubt.c line 177
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+ +static size_t mmc_read_file (const char *file_name) { +loff_t act_read =0 ; +int rc; +struct mmc *mmc; +#ifdef CONFIG_SYS_MMC_ENV_DEV +const u8 mmc_dev_num =CONFIG_SYS_MMC_ENV_DEV ; +#else +const u8 mmc_dev_num =0 ; +#endif
Same comment here.
Quoted 26 lines
cmd/mvebu/bubt.c new file +26
-0+ + mmc =find_mmc_device (mmc_dev_num); +if (!mmc) { +printf ("No SD/MMC/eMMC card found\n" ); +return 0 ; + } + +if (mmc_init (mmc)) { +printf ("%s(%d) init failed\n" ,IS_SD (mmc) ?"SD" :"MMC" , + mmc_dev_num); +return 0 ; + } + +/* Load from data partition (0) */ +if (fs_set_blk_dev ("mmc" ,"0" ,FS_TYPE_ANY )) { +printf ("Error: MMC 0 not found\n" ); +return 0 ; + } + +/* Perfrom file read */ + rc =fs_read (file_name,get_load_addr (),0 ,0 , &act_read); +if (rc) +return 0 ; + +return act_read; +}
cmd/mvebu/bubt.c line 213
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+ +int is_mmc_active (void ) +{ +return 1 ; +} +#else /* CONFIG_DM_MMC */ +#define mmc_burn_image 0 +#define mmc_read_file 0 +#define is_mmc_active 0 +#endif /* CONFIG_DM_MMC */
Please use empty functions instead.
Quoted 47 lines
cmd/mvebu/bubt.c new file +47
-0+ +/******************************************************************** +* SPI services ++ ********************************************************************/ +#ifdef CONFIG_SPI_FLASH +static int spi_burn_image (size_t image_size) { +int ret; +struct spi_flash *flash; +u32 erase_bytes; + +/* Probe the SPI bus to get the flash device */ + flash =spi_flash_probe (CONFIG_ENV_SPI_BUS , +CONFIG_ENV_SPI_CS , +CONFIG_SF_DEFAULT_SPEED , +CONFIG_SF_DEFAULT_MODE ); +if (!flash) { +printf ("Failed to probe SPI Flash\n" ); +return -ENOMEDIUM ; + } + +#ifdef CONFIG_SPI_FLASH_PROTECTION +spi_flash_protect (flash,0 ); +#endif + erase_bytes = image_size + + (flash->erase_size - image_size % flash->erase_size); +printf ("Erasing %d bytes (%d blocks) at offset 0 ..." , + erase_bytes, erase_bytes / flash->erase_size); + ret =spi_flash_erase (flash,0 , erase_bytes); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +printf ("Writing %d bytes from 0x%lx to offset 0 ..." , + (int )image_size,get_load_addr ()); + ret =spi_flash_write (flash,0 , image_size, (void *)get_load_addr ()); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +#ifdef CONFIG_SPI_FLASH_PROTECTION +spi_flash_protect (flash,1 ); +#endif + +return ret;
cmd/mvebu/bubt.c line 270
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+} + +int is_spi_active (void ) +{ +return 1 ; +} +#else /* CONFIG_SPI_FLASH */ +#define spi_burn_image 0 +#define is_spi_active 0 +#endif /* CONFIG_SPI_FLASH */
Empty functions please.
Quoted 43 lines
cmd/mvebu/bubt.c new file +43
-0+ +/******************************************************************** +* NAND services ++ ********************************************************************/ +#ifdef CONFIG_CMD_NAND +static int nand_burn_image (size_t image_size) { +int ret, block_size; +nand_info_t *nand; +int dev = nand_curr_device; + +if ((dev <0 ) || (dev >=CONFIG_SYS_MAX_NAND_DEVICE ) || + (!nand_info[dev].name)) { +puts ("\nno devices available\n" ); +return -ENOMEDIUM ; + } + nand = &nand_info[dev]; + block_size = nand->erasesize; + +/* Align U-Boot size to currently used blocksize */ + image_size = ((image_size + (block_size -1 )) & (~(block_size - +1 ))); + +/* Erase the U-BOOT image space */ +printf ("Erasing 0x%x - 0x%x:..." ,0 , (int )image_size); + ret =nand_erase (nand,0 , image_size); +if (ret) { +printf ("Error!\n" ); + goto error; + } +printf ("Done!\n" ); + +/* Write the image to flash */ +printf ("Writing image:..." ); +printf ("&image_size = 0x%p\n" , (void *)&image_size); + ret =nand_write (nand,0 , &image_size, (void *)get_load_addr ()); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +error: +return ret;
cmd/mvebu/bubt.c line 322
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+} + +int is_nand_active (void ) +{ +return 1 ; +} +#else /* CONFIG_CMD_NAND */ +#define nand_burn_image 0 +#define is_nand_active 0 +#endif /* CONFIG_CMD_NAND */
Empty functions please.
Quoted 184 lines
cmd/mvebu/bubt.c new file +184
-0+ +/******************************************************************** +* USB services ++ ********************************************************************/ +#if defined(CONFIG_USB_STORAGE) && defined(CONFIG_BLK) static size_t +usb_read_file (const char *file_name) { +loff_t act_read =0 ; +struct udevice *dev; +int rc; + +usb_stop (); + +if (usb_init () <0 ) { +printf ("Error: usb_init failed\n" ); +return 0 ; + } + +/* Try to recognize storage devices immediately */ +blk_first_device (IF_TYPE_USB , &dev); +if (!dev) { +printf ("Error: USB storage device not found\n" ); +return 0 ; + } + +/* Always load from usb 0 */ +if (fs_set_blk_dev ("usb" ,"0" ,FS_TYPE_ANY )) { +printf ("Error: USB 0 not found\n" ); +return 0 ; + } + +/* Perfrom file read */ + rc =fs_read (file_name,get_load_addr (),0 ,0 , &act_read); +if (rc) +return 0 ; + +return act_read; +} + +int is_usb_active (void ) +{ +return 1 ; +} +#else /* defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */ +#define usb_read_file 0 #define is_usb_active 0 #endif/* +defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */ + +/******************************************************************** +* Network services ++ ********************************************************************/ +#ifdef CONFIG_CMD_NET +static size_t tftp_read_file (const char *file_name) { +/* update global variable load_addr before tftp file from network */ + load_addr =get_load_addr (); +return net_loop (TFTPGET ); +} + +int is_tftp_active (void ) +{ +return 1 ; +} +#else +#define tftp_read_file 0 +#define is_tftp_active 0 +#endif /* CONFIG_CMD_NET */ + +enum bubt_devices { +BUBT_DEV_NET =0 , +BUBT_DEV_USB , +BUBT_DEV_MMC , +BUBT_DEV_SPI , +BUBT_DEV_NAND , + +BUBT_MAX_DEV +}; + +struct bubt_dev bubt_devs[BUBT_MAX_DEV ] = { + {"tftp" , tftp_read_file,NULL , is_tftp_active}, + {"usb" , usb_read_file,NULL , is_usb_active}, + {"mmc" , mmc_read_file, mmc_burn_image, is_mmc_active}, + {"spi" ,NULL , spi_burn_image, is_spi_active}, + {"nand" ,NULL , nand_burn_image, is_nand_active}, }; + +static int bubt_write_file (struct bubt_dev *dst,size_t image_size) { +if (!dst->write) { +printf ("Error: Write not supported on device %s\n" , dst->name); +return -ENOTSUPP ; + } + +return dst->write (image_size); +} + +#if defined(CONFIG_TARGET_MVEBU_ARMADA_8K ) +u32 do_checksum32 (u32 *start,int32_t len) { +u32 sum =0 ; +u32 *startp = start; + +do { + sum += *startp; + startp++; + len -=4 ; + }while (len >0 ); + +return sum; +} + +static int check_image_header (void ) +{ +struct mvebu_image_header *hdr = + (struct mvebu_image_header *)get_load_addr (); +u32 header_len = hdr->prolog_size; +u32 checksum; +u32 checksum_ref = hdr->prolog_checksum; + +/* +* For now compare checksum, and magic. Later we can +* verify more stuff on the header like interface type, etc +*/ +if (hdr->magic !=MAIN_HDR_MAGIC ) { +printf ("ERROR: Bad MAGIC 0x%08x != 0x%08x\n" , + hdr->magic,MAIN_HDR_MAGIC ); +return -ENOEXEC ; + } + +/* The checksum value is discarded from checksum calculation */ + hdr->prolog_checksum =0 ; + + checksum =do_checksum32 ((u32 *)hdr, header_len); +if (checksum != checksum_ref) { +printf ("Error: Bad Image checksum. 0x%x != 0x%x\n" , + checksum, checksum_ref); +return -ENOEXEC ; + } + +/* Restore the checksum before writing */ + hdr->prolog_checksum = checksum_ref; +printf ("Image checksum...OK!\n" ); + +return 0 ; +} +#elif defined(CONFIG_TARGET_MVEBU_DB_88F3720 )/* Armada 3700 */ +static int check_image_header (void ) { +struct common_tim_data *hdr = (struct common_tim_data *)get_load_addr (); +int image_num; +u8 hash_160_output[SHA1_SUM_LEN ]; +u8 hash_256_output[SHA256_SUM_LEN ]; +sha1_context hash1_text; +sha256_context hash256_text; +u8 *hash_output; +u32 hash_algorithm_id; +u32 image_size_to_hash; +u32 flash_entry_addr; +u32 *hash_value; +u32 internal_hash[HASH_SUM_LEN ]; +const u8 *buff; +u32 num_of_image = hdr->num_images; +u32 version = hdr->version; +u32 trusted = hdr->trusted; + +/* bubt checksum validation only supports nontrusted images */ +if (trusted ==1 ) { +printf ("bypass image validation, " ); +printf ("only untrusted image is supported now\n" ); +return 0 ; + } +/* only supports image version 3.5 and 3.6 */ +if (version !=IMAGE_VERSION_3_5_0 && version !=IMAGE_VERSION_3_6_0 ) { +printf ("Error: Unsupported Image version = 0x%08x\n" , version); +return -ENOEXEC ; + } +/* validate images hash value */ +for (image_num =0 ; image_num < num_of_image; image_num++) { +struct mvebu_image_info *info = + (struct mvebu_image_info *)(get_load_addr () + +sizeof (struct common_tim_data ) + + image_num *sizeof (struct mvebu_image_info )); + hash_algorithm_id = info->hash_algorithm_id; + image_size_to_hash = info->image_size_to_hash; + flash_entry_addr = info->flash_entry_addr; + hash_value = info->hash; + buff = (const u8 *)(get_load_addr () + flash_entry_addr); + +if (image_num ==0 ) {
cmd/mvebu/bubt.c line 515
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+/* The first image includes hash values in its content. +* For hash calculation, we need to save the original +* hash values to a local variable that will be +* copied back for comparsion and set all zeros to +* the orignal hash values for calculating new value. +* First image original format : +* x...x (datum1) x...x(orig. hash values) x...x(datum2) +* Replaced first image format : +* x...x (datum1) 0...0(hash values) x...x(datum2) +*/
Multicomment style is:
/*
*
*/
Quoted 264 lines
cmd/mvebu/bubt.c new file +200
-0+memcpy (internal_hash, hash_value, +sizeof (internal_hash)); +memset (hash_value,0 ,sizeof (internal_hash)); + } +if (image_size_to_hash ==0 ) { +printf ("Warning: Image_%d hash checksum is disabled, " , + image_num); +printf ("skip the image validation.\n" ); +continue ; + } +switch (hash_algorithm_id) { +case SHA1_SUM_LEN : +sha1_starts (&hash1_text); +sha1_update (&hash1_text, buff, image_size_to_hash); +sha1_finish (&hash1_text, hash_160_output); + hash_output = hash_160_output; +break ; +case SHA256_SUM_LEN : +sha256_starts (&hash256_text); +sha256_update (&hash256_text, buff, image_size_to_hash); +sha256_finish (&hash256_text, hash_256_output); + hash_output = hash_256_output; +break ; +default : +printf ("Error: Unsupported hash_algorithm_id = %d\n" , + hash_algorithm_id); +return -ENOEXEC ; + } +if (image_num ==0 ) +memcpy (hash_value, internal_hash, +sizeof (internal_hash)); +if (memcmp (hash_value, hash_output, hash_algorithm_id) !=0 ) { +printf ("Error: Image_%d checksum is not correct\n" , + image_num); +return -ENOEXEC ; + } + } +printf ("Image checksum...OK!\n" ); + +return 0 ; +} +#else +static int check_image_header (void ) +{ +printf ("bubt cmd does not support this SoC device or family!\n" ); +return -ENOEXEC ; +} +#endif + +static int bubt_verify (size_t image_size) { +int err; + +/* Check a correct image header exists */ + err =check_image_header (); +if (err) { +printf ("Error: Image header verification failed\n" ); +return err; + } + +return 0 ; +} + +static int bubt_read_file (struct bubt_dev *src) { +size_t image_size; + +if (!src->read) { +printf ("Error: Read not supported on device \"%s\"\n" , + src->name); +return 0 ; + } + + image_size = src->read (net_boot_file_name); +if (image_size <=0 ) { +printf ("Error: Failed to read file %s from %s\n" , + net_boot_file_name, src->name); +return 0 ; + } + +return image_size; +} + +static int bubt_is_dev_active (struct bubt_dev *dev) { +if (!dev->active) { +printf ("Device \"%s\" not supported by U-BOOT image\n" , + dev->name); +return 0 ; + } + +if (!dev->active ()) { +printf ("Device \"%s\" is inactive\n" , dev->name); +return 0 ; + } + +return 1 ; +} + +struct bubt_dev *find_bubt_dev (char *dev_name) { +int dev; + +for (dev =0 ; dev <BUBT_MAX_DEV ; dev++) { +if (strcmp (bubt_devs[dev].name, dev_name) ==0 ) +return &bubt_devs[dev]; + } + +return 0 ; +} + +#define DEFAULT_BUBT_SRC "tftp" + +#ifndef DEFAULT_BUBT_DST +#ifdef CONFIG_MVEBU_SPI_BOOT +#define DEFAULT_BUBT_DST "spi" +#elif defined(CONFIG_MVEBU_NAND_BOOT) #define DEFAULT_BUBT_DST "nand" +#elif defined(CONFIG_MVEBU_MMC_BOOT ) +#define DEFAULT_BUBT_DST "mmc" +else +#define DEFAULT_BUBT_DST "error" +#endif +#endif /* DEFAULT_BUBT_DST */ + +int do_bubt_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const +argv[]) { +struct bubt_dev *src, *dst; +size_t image_size; +char src_dev_name[8 ]; +char dst_dev_name[8 ]; +char *name; +int err; + +if (argc <2 ) +copy_filename (net_boot_file_name, +CONFIG_MVEBU_UBOOT_DFLT_NAME , +sizeof (net_boot_file_name)); +else +copy_filename (net_boot_file_name, argv[1 ], +sizeof (net_boot_file_name)); + +if (argc >=3 ) { +strncpy (dst_dev_name, argv[2 ],8 ); + }else { + name =DEFAULT_BUBT_DST ; +strncpy (dst_dev_name, name,8 ); + } + +if (argc >=4 ) +strncpy (src_dev_name, argv[3 ],8 ); +else +strncpy (src_dev_name,DEFAULT_BUBT_SRC ,8 ); + +/* Figure out the destination device */ + dst =find_bubt_dev (dst_dev_name); +if (!dst) { +printf ("Error: Unknown destination \"%s\"\n" , dst_dev_name); +return -EINVAL ; + } + +if (!bubt_is_dev_active (dst)) +return -ENODEV ; + +/* Figure out the source device */ + src =find_bubt_dev (src_dev_name); +if (!src) { +printf ("Error: Unknown source \"%s\"\n" , src_dev_name); +return 1 ; + } + +if (!bubt_is_dev_active (src)) +return -ENODEV ; + +printf ("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n" , + net_boot_file_name, src->name, dst->name); + + image_size =bubt_read_file (src); +if (!image_size) +return -EIO ; + + err =bubt_verify (image_size); +if (err) +return err; + + err =bubt_write_file (dst, image_size); +if (err) +return err; + +return 0 ; +} + +U_BOOT_CMD ( + bubt,4 ,0 , do_bubt_cmd, +"Burn a u-boot image to flash" , +"[file-name] [destination [source]]\n" +"\t-file-name The image file name to burn. Default = flash-image.bin\n" +"\t-destination Flash to burn to [spi, nand, mmc]. Default = active boot device\n" +"\t-source The source to load image from [tftp, usb, mmc]. Default = tftp\n" +"Examples:\n" +"\tbubt - Burn flash-image.bin from tftp to active boot device\n" +"\tbubt flash-image-new.bin nand - Burn flash-image-new.bin from tftp to NAND flash\n" +"\tbubt backup-flash-image.bin mmc usb - Burn backup-flash-image.bin from usb to MMC\n" + +);doc/mvebu/cmd/bubt.txt new file renamed from doc/mvebu/cmd/bubt.txt +0
-0mode 100644 index 0000000..6f9f525
doc/mvebu/cmd/bubt.txt new file +58
-0@@ -0,0 +1,64 @@ +BUBT (Burn ATF) command +-------------------------- +Bubt command is used to burn a new ATF image to flash device. + +The bubt command gets the following parameters: ATF file name, destination device and source device. +bubt [file-name] [destination [source]] + - file-name Image file name to burn. default = flash-image.bin + - destination Flash to burn to [spi, nand, mmc]. default = active flash + - source Source to load image from [tftp, usb]. default = tftp + +Examples: + bubt - Burn flash-image.bin from tftp to active flash + bubt latest-spi.bin nand - Burn latest-spi.bin from tftp to NAND flash + +Notes: +- For the TFTP interface set serverip and ipaddr. +- To burn image to SD/eMMC device, the target is defined + by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART. + +Bubt command details (burn image step by-step) +---------------------------------------------- +This section describes bubt command flow: + +1. Fetch the requested ATF image from an available interface (USB/SD/SATA/XDB, etc.) + into the DRAM, and place it at <load_address> + Example: when using the FAT file system on USB flash device: + # usb reset + # fatls usb 0 (see files in device) + # fatload usb 0 <load_address> <file_name> + +2. Erase the target device: + - NAND: # nand erase 0 100000 + - SPI: # sf probe 0 + # sf erase 0 100000 + - SD/eMMC: # mmc dev <dev_id> <boot_partition> + +Notes: +- The eMMC has 2 boot partitions (BOOT0 and BOOT1) and a user data partition (DATA). + The boot partitions are numbered as partition 1 and 2 in MMC driver. + Number 0 is used for user data partition and should not be utilized +for storing + boot images and U-Boot environment in RAW mode since it will break +file system + structures usually located here. + The default boot partition is BOOT0. It is selected by the following parameter: + CONFIG_SYS_MMC_ENV_PART=1 + Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1. + Please never use partition number 0 here! + The eMMC has 2 boot partitions (BOOT0 and BOOT1) and a user data partition (DATA). + The boot partitions are numbered as partition 1 and 2 in MMC driver. + Number 0 is used for user data partition and should not be utilized +for storing + boot images and U-Boot environment in RAW mode since it will break +file system + structures usually located here. + The default boot partition is BOOT0. It is selected by the following parameter: + CONFIG_SYS_MMC_ENV_PART=1 + Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1.
doc/mvebu/cmd/bubt.txt line 64
Quoted 10 lines
doc/mvebu/cmd/bubt.txt new file +10
-0+ Please never use partition number 0 here! +- The partition number is ignored if the target device is SD card. +- The boot image offset starts at block 0 for eMMC and block 1 for SD devices. + The block 0 on SD devices is left for MBR storage. + +3. Write the ATF image: + - NAND: # nand write <load_address> 0 <ATF Size> + - SPI: # sf write <load_address> 0 <ATF Size> + - SD/eMMC: # mmc write <load_address> [0|1] <ATF Size>/<block_size> +
Thanks,
Stefan
PATCH v2 2/6 arm64: mvebu: Add bubt command for flash image burn
In reply to Stefan RoeseHi, Stefan,
Quoted 378 lines
-----Original Message-----
From: Stefan Roese [mailto:sr at denx.de]
Sent: Tuesday, December 06, 2016 08:22
To: Kostya Porotchkin; u-boot at lists.denx.de
Cc: Nadav Haklai; Neta Zur Hershkovits; Omri Itach; Igal Liberman; Haim Boot; Hanna Hawa
Subject: Re: [PATCH v2 2/6] arm64: mvebu: Add bubt command for flash image burnQuoted 17 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Add support for mvebu bubt command for flash image load, check and burn on boot device.
Changes for v2:
- Add "bubt" documentation
- Fix code syntaxSigned-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>Quoted 1 line
---
Again, please move the patch version history.
It seems that you missed to address most of my last review comments. I've added them again below. Please either address them or give me a short notice why not. Thanks.
Quoted 6 lines
arch/arm/mach-mvebu/Kconfig | 34 +++ cmd/Kconfig | 3 + cmd/Makefile | 2 + cmd/mvebu/Kconfig | 10 + cmd/mvebu/Makefile | 8 + cmd/mvebu/bubt.c | 726++++++++++++++++++++++++++++++++++++++++++++
Quoted 38 lines
doc/mvebu/cmd/bubt.txt | 64 ++++ 7 files changed, 847 insertions(+) create mode 100644 cmd/mvebu/Kconfig create mode 100644 cmd/mvebu/Makefile create mode 100644
cmd/mvebu/bubt.ccreate mode 100644doc/mvebu/cmd/bubt.txtarch/arm/mach-mvebu/Kconfig +24
-0@@ -99,6 +99,40 @@ config TARGET_THEADORABLE endchoice +choice + prompt "Flash for image" + default MVEBU_SPI_BOOT + +config MVEBU_NAND_BOOT + bool "NAND flash boot" + depends on NAND_PXA3XX + help + Enable boot from NAND flash. + Use NAND flash as a target for "bubt" command + +config MVEBU_SPI_BOOT + bool "SPI flash boot" + depends on SPI_FLASH + help + Enable boot from SPI flash. + Use SPI flash as a target for "bubt" command + +config MVEBU_MMC_BOOT + bool "eMMC flash boot" + depends on MVEBU_MMC + help + Enable boot from eMMC boot partition + Use eMMC/SD device as a target for "bubt" commandarch/arm/mach-mvebu/Kconfig config TARGET_THEADORABLE · line 135
Quoted 10 lines
arch/arm/mach-mvebu/Kconfig +10
-0+ +endchoice + +config MVEBU_UBOOT_DFLT_NAME + string "Default image name for bubt command" + default "flash-image.bin" + help + This option should contain a default file name to be used with + MVEBU "bubt" command if the source file name is omitted +Again my question on this location of these
Kconfigoptions. Wouldn't it be better, to move allKconfigoption into cmd/mvebu/Kconfig instead of having most of them in the mach-mvebu file?Quoted 72 lines
arch/arm/mach-mvebu/Kconfig +0
-0config SYS_BOARD default "clearfog" if TARGET_CLEARFOG default "mvebu_db-88f3720" if TARGET_MVEBU_DB_88F3720 diff --gita/cmd/Kconfig b/cmd/Kconfig index b16c603..b38d285 100644
cmd/Kconfig +3
-0@@ -632,6 +632,9 @@ config CMD_QFW This provides access to the QEMU firmware interface. The main feature is to allow easy loading of files passed to qemu-system via -kernel / -initrd + +source "cmd/mvebu/Kconfig" + endmenu config CMD_BOOTSTAGEcmd/Makefile +2
-0@@ -163,3 +163,5 @@ obj-$(CONFIG_CMD_BLOB) += blob.o # core command obj-y += nvedit.o + +obj-$(CONFIG_ARCH_MVEBU) += mvebu/cmd/mvebu/Kconfig new file mode renamed from cmd/mvebu/Kconfig +0
-0100644 index 0000000..e7fbd20
cmd/mvebu/Kconfig new file +10
-0@@ -0,0 +1,10 @@ +menu "MVEBU commands" +depends on ARCH_MVEBU + +config CMD_MVEBU_BUBT + bool "bubt" + default n + help + bubt - Burn a u-boot image to flash + +endmenucmd/mvebu/Makefile new file mode renamed from cmd/mvebu/Makefile +0
-0100644 index 0000000..03de53e
cmd/mvebu/Makefile new file +8
-0@@ -0,0 +1,8 @@ +# +# Copyright (C) 2016 Marvell International Ltd. +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses + + +obj-$(CONFIG_CMD_MVEBU_BUBT) += bubt.ocmd/mvebu/bubt.c new file +14
-0@@ -0,0 +1,726 @@ +/* +* Copyright (C) 2016 Marvell International Ltd. +* +* SPDX-License-Identifier: GPL-2.0 +* https://spdx.org/licenses +*/ + +#include <config.h> +#include <common.h> +#include <command.h> +#include <vsprintf.h> +#include <errno.h> +#include <dm.h> +cmd/mvebu/bubt.c line 24
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+#include <spi_flash.h> +#include <spi.h> +#include <nand.h> +#include <usb.h> +#include <fs.h> +#include <mmc.h> +#include <u-boot/sha1.h> +#include <u-boot/sha256.h> + +#if defined(CONFIG_TARGET_MVEBU_ARMADA_8K )Please use
CONFIG_ARMADA_8Kinstead. So below...Quoted 14 lines
cmd/mvebu/bubt.c new file +14
-0+#define MAIN_HDR_MAGIC 0xB105B002 + +struct mvebu_image_header { +u32 magic;/* 0-3 */ +u32 prolog_size;/* 4-7 */ +u32 prolog_checksum;/* 8-11 */ +u32 boot_image_size;/* 12-15 */ +u32 boot_image_checksum;/* 16-19 */ +u32 rsrvd0;/* 20-23 */ +u32 load_addr;/* 24-27 */ +u32 exec_addr;/* 28-31 */ +u8 uart_cfg;/* 32 */ +u8 baudrate;/* 33 */ +u8 ext_count;/* 34 */ cmd/mvebu/bubt.c line 48
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+u8 aux_flags;/* 35 */ +u32 io_arg_0;/* 36-39 */ +u32 io_arg_1;/* 40-43 */ +u32 io_arg_2;/* 43-47 */ +u32 io_arg_3;/* 48-51 */ +u32 rsrvd1;/* 52-55 */ +u32 rsrvd2;/* 56-59 */ + u32 rsrvd3; /* 60-63 */ +}; +#elif defined(CONFIG_TARGET_MVEBU_DB_88F3720)/* A3700 */ Please use
CONFIG_ARMADA_3700as this is most likely not board specific but platform (SoC) specific.Quoted 60 lines
cmd/mvebu/bubt.c new file +60
-0+#define HASH_SUM_LEN 16 +#define IMAGE_VERSION_3_6_0 0x030600 +#define IMAGE_VERSION_3_5_0 0x030500 + +struct common_tim_data { +u32 version; +u32 identifier; +u32 trusted; +u32 issue_date; +u32 oem_unique_id; +u32 reserved[5 ];/* Reserve 20 bytes */ +u32 boot_flash_sign; +u32 num_images; +u32 num_keys; +u32 size_of_reserved; +}; + +struct mvebu_image_info { +u32 image_id; +u32 next_image_id; +u32 flash_entry_addr; +u32 load_addr; +u32 image_size; +u32 image_size_to_hash; +u32 hash_algorithm_id; +u32 hash[HASH_SUM_LEN ];/* Reserve 512 bits for the hash */ +u32 partition_number; +u32 enc_algorithm_id; +u32 encrypt_start_offset; +u32 encrypt_size; +}; +#endif + +struct bubt_dev { +char name[8 ]; +size_t (*read)(const char *file_name); +int (*write)(size_t image_size); +int (*active)(void ); +}; + +static ulong get_load_addr (void ) +{ +const char *addr_str; +unsigned long addr; + + addr_str =getenv ("loadaddr" ); +if (addr_str) + addr =simple_strtoul (addr_str,NULL ,16 ); +else + addr =CONFIG_SYS_LOAD_ADDR ; + +return addr; +} + +/******************************************************************** +* eMMC services + +********************************************************************/ +#ifdef CONFIG_DM_MMC +static int mmc_burn_image (size_t image_size) {cmd/mvebu/bubt.c line 177
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+struct mmc *mmc; +lbaint_t start_lba; +lbaint_t blk_count; +ulong blk_written; +int err; +#ifdef CONFIG_SYS_MMC_ENV_DEV +const u8 mmc_dev_num =CONFIG_SYS_MMC_ENV_DEV ; +#else +const u8 mmc_dev_num =0 ; +#endif I suggest to move this one up in this file to make the code look a bit "cleaner", like this:
#ifndef
CONFIG_SYS_MMC_ENV_DEV
#defineCONFIG_SYS_MMC_ENV_DEV0
#endifThen you can remove the #ifdef from the code here.
Quoted 47 lines
cmd/mvebu/bubt.c new file +47
-0+ + mmc =find_mmc_device (mmc_dev_num); +if (!mmc) { +printf ("No SD/MMC/eMMC card found\n" ); +return -ENOMEDIUM ; + } + + err =mmc_init (mmc); +if (err) { +printf ("%s(%d) init failed\n" ,IS_SD (mmc) ?"SD" :"MMC" , + mmc_dev_num); +return err; + } + +#ifdef CONFIG_SYS_MMC_ENV_PART +if (mmc->part_num !=CONFIG_SYS_MMC_ENV_PART ) { + err =mmc_switch_part (mmc_dev_num,CONFIG_SYS_MMC_ENV_PART ); +if (err) { +printf ("MMC partition switch failed\n" ); +return err; + } + } +#endif + +/* SD reserves LBA-0 for MBR and boots from LBA-1, +* MMC/eMMC boots from LBA-0 +*/ + start_lba =IS_SD (mmc) ?1 :0 ; + blk_count = image_size / mmc->block_dev.blksz; +if (image_size % mmc->block_dev.blksz) + blk_count +=1 ; + + blk_written = mmc->block_dev.block_write (mmc_dev_num, + start_lba, blk_count, + (void *)get_load_addr ()); +if (blk_written != blk_count) { +printf ("Error - written %#lx blocks\n" , blk_written); +return -ENOSPC ; + } +printf ("Done!\n" ); + +#ifdef CONFIG_SYS_MMC_ENV_PART +if (mmc->part_num !=CONFIG_SYS_MMC_ENV_PART ) +mmc_switch_part (mmc_dev_num, mmc->part_num);#endif + +return 0 ; +}cmd/mvebu/bubt.c line 177
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+ +static size_t mmc_read_file (const char *file_name) { +loff_t act_read =0 ; +int rc; +struct mmc *mmc; +#ifdef CONFIG_SYS_MMC_ENV_DEV +const u8 mmc_dev_num =CONFIG_SYS_MMC_ENV_DEV ; +#else +const u8 mmc_dev_num =0 ; +#endif Same comment here.
Quoted 30 lines
cmd/mvebu/bubt.c new file +30
-0+ + mmc =find_mmc_device (mmc_dev_num); +if (!mmc) { +printf ("No SD/MMC/eMMC card found\n" ); +return 0 ; + } + +if (mmc_init (mmc)) { +printf ("%s(%d) init failed\n" ,IS_SD (mmc) ?"SD" :"MMC" , + mmc_dev_num); +return 0 ; + } + +/* Load from data partition (0) */ +if (fs_set_blk_dev ("mmc" ,"0" ,FS_TYPE_ANY )) { +printf ("Error: MMC 0 not found\n" ); +return 0 ; + } + +/* Perfrom file read */ + rc =fs_read (file_name,get_load_addr (),0 ,0 , &act_read); +if (rc) +return 0 ; + +return act_read; +} + +int is_mmc_active (void ) +{ +return 1 ;
Quoted 8 lines
cmd/mvebu/bubt.c line 213
Quoted 6 lines
cmd/mvebu/bubt.c new file +6
-0+} +#else /* CONFIG_DM_MMC */ +#define mmc_burn_image 0 +#define mmc_read_file 0 +#define is_mmc_active 0 +#endif /* CONFIG_DM_MMC */ Please use empty functions instead.
[Konstantin Porotchkin]
Do you mean defining it in this way?
#define mmc_burn_image(a) 0
Or like below?
int mmc_burn_image(size_t image_size)
{
return -1;
}Thanks
Kosta
Quoted 620 lines
Quoted 28 lines
cmd/mvebu/bubt.c new file +27
-0+ +/******************************************************************** +* SPI services + +********************************************************************/ +#ifdef CONFIG_SPI_FLASH +static int spi_burn_image (size_t image_size) { +int ret; +struct spi_flash *flash; +u32 erase_bytes; + +/* Probe the SPI bus to get the flash device */ + flash =spi_flash_probe (CONFIG_ENV_SPI_BUS , +CONFIG_ENV_SPI_CS , +CONFIG_SF_DEFAULT_SPEED , +CONFIG_SF_DEFAULT_MODE ); +if (!flash) { +printf ("Failed to probe SPI Flash\n" ); +return -ENOMEDIUM ; + } + +#ifdef CONFIG_SPI_FLASH_PROTECTION +spi_flash_protect (flash,0 ); +#endif + erase_bytes = image_size + + (flash->erase_size - image_size % flash->erase_size); + printf("Erasing %d bytes (%d blocks) at offset 0 ...",cmd/mvebu/bubt.c
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+ erase_bytes, erase_bytes / flash->erase_size); + ret =spi_flash_erase (flash,0 , erase_bytes); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +printf ("Writing %d bytes from 0x%lx to offset 0 ..." , + (int )image_size,get_load_addr ()); + ret = spi_flash_write(flash, 0, image_size, (void*)get_load_addr());
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +#ifdef CONFIG_SPI_FLASH_PROTECTION +spi_flash_protect (flash,1 ); +#endif + +return ret;cmd/mvebu/bubt.c line 270
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+} + +int is_spi_active (void ) +{ +return 1 ; +} +#else /* CONFIG_SPI_FLASH */ +#define spi_burn_image 0 +#define is_spi_active 0 +#endif /* CONFIG_SPI_FLASH */ Empty functions please.
Quoted 43 lines
cmd/mvebu/bubt.c new file +43
-0+ +/******************************************************************** +* NAND services + +********************************************************************/ +#ifdef CONFIG_CMD_NAND +static int nand_burn_image (size_t image_size) { +int ret, block_size; +nand_info_t *nand; +int dev = nand_curr_device; + +if ((dev <0 ) || (dev >=CONFIG_SYS_MAX_NAND_DEVICE ) || + (!nand_info[dev].name)) { +puts ("\nno devices available\n" ); +return -ENOMEDIUM ; + } + nand = &nand_info[dev]; + block_size = nand->erasesize; + +/* Align U-Boot size to currently used blocksize */ + image_size = ((image_size + (block_size -1 )) & (~(block_size - +1 ))); + +/* Erase the U-BOOT image space */ +printf ("Erasing 0x%x - 0x%x:..." ,0 , (int )image_size); + ret =nand_erase (nand,0 , image_size); +if (ret) { +printf ("Error!\n" ); + goto error; + } +printf ("Done!\n" ); + +/* Write the image to flash */ +printf ("Writing image:..." ); +printf ("&image_size = 0x%p\n" , (void *)&image_size); + ret =nand_write (nand,0 , &image_size, (void *)get_load_addr ()); +if (ret) +printf ("Error!\n" ); +else +printf ("Done!\n" ); + +error: +return ret;cmd/mvebu/bubt.c line 322
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+} + +int is_nand_active (void ) +{ +return 1 ; +} +#else /* CONFIG_CMD_NAND */ +#define nand_burn_image 0 +#define is_nand_active 0 +#endif /* CONFIG_CMD_NAND */ Empty functions please.
Quoted 44 lines
cmd/mvebu/bubt.c new file +44
-0+ +/******************************************************************** +* USB services + +********************************************************************/ +#if defined(CONFIG_USB_STORAGE) && defined(CONFIG_BLK) static size_t +usb_read_file (const char *file_name) { +loff_t act_read =0 ; +struct udevice *dev; +int rc; + +usb_stop (); + +if (usb_init () <0 ) { +printf ("Error: usb_init failed\n" ); +return 0 ; + } + +/* Try to recognize storage devices immediately */ +blk_first_device (IF_TYPE_USB , &dev); +if (!dev) { +printf ("Error: USB storage device not found\n" ); +return 0 ; + } + +/* Always load from usb 0 */ +if (fs_set_blk_dev ("usb" ,"0" ,FS_TYPE_ANY )) { +printf ("Error: USB 0 not found\n" ); +return 0 ; + } + +/* Perfrom file read */ + rc =fs_read (file_name,get_load_addr (),0 ,0 , &act_read); +if (rc) +return 0 ; + +return act_read; +} + +int is_usb_active (void ) +{ +return 1 ; +} +#else /* defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */ cmd/mvebu/bubt.c
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+#define usb_read_file 0 #define is_usb_active 0 #endif/* +defined(CONFIG_USB_STORAGE) && defined (CONFIG_BLK) */ + +/******************************************************************** +* Network services + +********************************************************************/ +#ifdef CONFIG_CMD_NET +static size_t tftp_read_file (const char *file_name) { +/* update global variable load_addr before tftp file from network */
Quoted 81 lines
cmd/mvebu/bubt.c new file +33
-0+ load_addr =get_load_addr (); +return net_loop (TFTPGET ); +} + +int is_tftp_active (void ) +{ +return 1 ; +} +#else +#define tftp_read_file 0 +#define is_tftp_active 0 +#endif /* CONFIG_CMD_NET */ + +enum bubt_devices { +BUBT_DEV_NET =0 , +BUBT_DEV_USB , +BUBT_DEV_MMC , +BUBT_DEV_SPI , +BUBT_DEV_NAND , + +BUBT_MAX_DEV +}; + +struct bubt_dev bubt_devs[BUBT_MAX_DEV ] = { + {"tftp" , tftp_read_file,NULL , is_tftp_active}, + {"usb" , usb_read_file,NULL , is_usb_active}, + {"mmc" , mmc_read_file, mmc_burn_image, is_mmc_active}, + {"spi" ,NULL , spi_burn_image, is_spi_active}, + {"nand" ,NULL , nand_burn_image, is_nand_active}, }; + +static int bubt_write_file (struct bubt_dev *dst,size_t image_size) { +if (!dst->write) { + printf("Error: Write not supported on device %s\n", dst-name);
cmd/mvebu/bubt.c new file +47
-0+return -ENOTSUPP ; + } + +return dst->write (image_size); +} + +#if defined(CONFIG_TARGET_MVEBU_ARMADA_8K ) +u32 do_checksum32 (u32 *start,int32_t len) { +u32 sum =0 ; +u32 *startp = start; + +do { + sum += *startp; + startp++; + len -=4 ; + }while (len >0 ); + +return sum; +} + +static int check_image_header (void ) +{ +struct mvebu_image_header *hdr = + (struct mvebu_image_header *)get_load_addr (); +u32 header_len = hdr->prolog_size; +u32 checksum; +u32 checksum_ref = hdr->prolog_checksum; + +/* +* For now compare checksum, and magic. Later we can +* verify more stuff on the header like interface type, etc +*/ +if (hdr->magic !=MAIN_HDR_MAGIC ) { +printf ("ERROR: Bad MAGIC 0x%08x != 0x%08x\n" , + hdr->magic,MAIN_HDR_MAGIC ); +return -ENOEXEC ; + } + +/* The checksum value is discarded from checksum calculation */ + hdr->prolog_checksum =0 ; + + checksum =do_checksum32 ((u32 *)hdr, header_len); +if (checksum != checksum_ref) { +printf ("Error: Bad Image checksum. 0x%x != 0x%x\n" , + checksum, checksum_ref); +return -ENOEXEC ; + }cmd/mvebu/bubt.c
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+ +/* Restore the checksum before writing */ + hdr->prolog_checksum = checksum_ref; +printf ("Image checksum...OK!\n" ); + +return 0 ; +} +#elif defined(CONFIG_TARGET_MVEBU_DB_88F3720 )/* Armada 3700 */ +static int check_image_header (void ) { + struct common_tim_data *hdr = (struct common_tim_data*)get_load_addr();
Quoted 14 lines
cmd/mvebu/bubt.c new file +14
-0+int image_num; +u8 hash_160_output[SHA1_SUM_LEN ]; +u8 hash_256_output[SHA256_SUM_LEN ]; +sha1_context hash1_text; +sha256_context hash256_text; +u8 *hash_output; +u32 hash_algorithm_id; +u32 image_size_to_hash; +u32 flash_entry_addr; +u32 *hash_value; +u32 internal_hash[HASH_SUM_LEN ]; +const u8 *buff; +u32 num_of_image = hdr->num_images; +u32 version = hdr->version;cmd/mvebu/bubt.c
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+u32 trusted = hdr->trusted; + +/* bubt checksum validation only supports nontrusted images */ +if (trusted ==1 ) { +printf ("bypass image validation, " ); +printf ("only untrusted image is supported now\n" ); +return 0 ; + } +/* only supports image version 3.5 and 3.6 */ + if (version != IMAGE_VERSION_3_5_0 && version !=
IMAGE_VERSION_3_6_0) {cmd/mvebu/bubt.c
Quoted 1 line
cmd/mvebu/bubt.c new file +1
-0+ printf("Error: Unsupported Image version = 0x%08x\n",version);
Quoted 15 lines
cmd/mvebu/bubt.c new file +15
-0+return -ENOEXEC ; + } +/* validate images hash value */ +for (image_num =0 ; image_num < num_of_image; image_num++) { +struct mvebu_image_info *info = + (struct mvebu_image_info *)(get_load_addr () + +sizeof (struct common_tim_data ) + + image_num *sizeof (struct mvebu_image_info )); + hash_algorithm_id = info->hash_algorithm_id; + image_size_to_hash = info->image_size_to_hash; + flash_entry_addr = info->flash_entry_addr; + hash_value = info->hash; + buff = (const u8 *)(get_load_addr () + flash_entry_addr); + +if (image_num ==0 ) {cmd/mvebu/bubt.c line 521
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+/* The first image includes hash values in its content. +* For hash calculation, we need to save the original +* hash values to a local variable that will be +* copied back for comparsion and set all zeros to +* the orignal hash values for calculating new value. +* First image original format : +* x...x (datum1) x...x(orig. hash values) x...x(datum2) +* Replaced first image format : +* x...x (datum1) 0...0(hash values) x...x(datum2) +*/ Multicomment style is:
/*
*
*/Quoted 182 lines
cmd/mvebu/bubt.c new file +182
-0+memcpy (internal_hash, hash_value, +sizeof (internal_hash)); +memset (hash_value,0 ,sizeof (internal_hash)); + } +if (image_size_to_hash ==0 ) { +printf ("Warning: Image_%d hash checksum is disabled, " , + image_num); +printf ("skip the image validation.\n" ); +continue ; + } +switch (hash_algorithm_id) { +case SHA1_SUM_LEN : +sha1_starts (&hash1_text); +sha1_update (&hash1_text, buff, image_size_to_hash); +sha1_finish (&hash1_text, hash_160_output); + hash_output = hash_160_output; +break ; +case SHA256_SUM_LEN : +sha256_starts (&hash256_text); +sha256_update (&hash256_text, buff, image_size_to_hash); +sha256_finish (&hash256_text, hash_256_output); + hash_output = hash_256_output; +break ; +default : +printf ("Error: Unsupported hash_algorithm_id = %d\n" , + hash_algorithm_id); +return -ENOEXEC ; + } +if (image_num ==0 ) +memcpy (hash_value, internal_hash, +sizeof (internal_hash)); +if (memcmp (hash_value, hash_output, hash_algorithm_id) !=0 ) { +printf ("Error: Image_%d checksum is not correct\n" , + image_num); +return -ENOEXEC ; + } + } +printf ("Image checksum...OK!\n" ); + +return 0 ; +} +#else +static int check_image_header (void ) +{ +printf ("bubt cmd does not support this SoC device or family!\n" ); +return -ENOEXEC ; +} +#endif + +static int bubt_verify (size_t image_size) { +int err; + +/* Check a correct image header exists */ + err =check_image_header (); +if (err) { +printf ("Error: Image header verification failed\n" ); +return err; + } + +return 0 ; +} + +static int bubt_read_file (struct bubt_dev *src) { +size_t image_size; + +if (!src->read) { +printf ("Error: Read not supported on device \"%s\"\n" , + src->name); +return 0 ; + } + + image_size = src->read (net_boot_file_name); +if (image_size <=0 ) { +printf ("Error: Failed to read file %s from %s\n" , + net_boot_file_name, src->name); +return 0 ; + } + +return image_size; +} + +static int bubt_is_dev_active (struct bubt_dev *dev) { +if (!dev->active) { +printf ("Device \"%s\" not supported by U-BOOT image\n" , + dev->name); +return 0 ; + } + +if (!dev->active ()) { +printf ("Device \"%s\" is inactive\n" , dev->name); +return 0 ; + } + +return 1 ; +} + +struct bubt_dev *find_bubt_dev (char *dev_name) { +int dev; + +for (dev =0 ; dev <BUBT_MAX_DEV ; dev++) { +if (strcmp (bubt_devs[dev].name, dev_name) ==0 ) +return &bubt_devs[dev]; + } + +return 0 ; +} + +#define DEFAULT_BUBT_SRC "tftp" + +#ifndef DEFAULT_BUBT_DST +#ifdef CONFIG_MVEBU_SPI_BOOT +#define DEFAULT_BUBT_DST "spi" +#elif defined(CONFIG_MVEBU_NAND_BOOT) #define DEFAULT_BUBT_DST "nand" +#elif defined(CONFIG_MVEBU_MMC_BOOT ) +#define DEFAULT_BUBT_DST "mmc" +else +#define DEFAULT_BUBT_DST "error" +#endif +#endif /* DEFAULT_BUBT_DST */ + +int do_bubt_cmd (cmd_tbl_t *cmdtp,int flag,int argc,char *const +argv[]) { +struct bubt_dev *src, *dst; +size_t image_size; +char src_dev_name[8 ]; +char dst_dev_name[8 ]; +char *name; +int err; + +if (argc <2 ) +copy_filename (net_boot_file_name, +CONFIG_MVEBU_UBOOT_DFLT_NAME , +sizeof (net_boot_file_name)); +else +copy_filename (net_boot_file_name, argv[1 ], +sizeof (net_boot_file_name)); + +if (argc >=3 ) { +strncpy (dst_dev_name, argv[2 ],8 ); + }else { + name =DEFAULT_BUBT_DST ; +strncpy (dst_dev_name, name,8 ); + } + +if (argc >=4 ) +strncpy (src_dev_name, argv[3 ],8 ); +else +strncpy (src_dev_name,DEFAULT_BUBT_SRC ,8 ); + +/* Figure out the destination device */ + dst =find_bubt_dev (dst_dev_name); +if (!dst) { +printf ("Error: Unknown destination \"%s\"\n" , dst_dev_name); +return -EINVAL ; + } + +if (!bubt_is_dev_active (dst)) +return -ENODEV ; + +/* Figure out the source device */ + src =find_bubt_dev (src_dev_name); +if (!src) { +printf ("Error: Unknown source \"%s\"\n" , src_dev_name); +return 1 ; + } + +if (!bubt_is_dev_active (src)) +return -ENODEV ; + +printf ("Burning U-BOOT image \"%s\" from \"%s\" to \"%s\"\n" , + net_boot_file_name, src->name, dst->name); + + image_size =bubt_read_file (src); +if (!image_size) +return -EIO ; + + err =bubt_verify (image_size); +if (err) +return err; + + err =bubt_write_file (dst, image_size); +if (err)cmd/mvebu/bubt.c
Quoted 10 lines
cmd/mvebu/bubt.c new file +10
-0+return err; + +return 0 ; +} + +U_BOOT_CMD ( + bubt,4 ,0 , do_bubt_cmd, +"Burn a u-boot image to flash" , +"[file-name] [destination [source]]\n" + "\t-file-name The image file name to burn. Default = flash-image.bin\n"
cmd/mvebu/bubt.c
Quoted 1 line
cmd/mvebu/bubt.c new file +1
-0+ "\t-destination Flash to burn to [spi, nand, mmc]. Default =active boot device\n"
cmd/mvebu/bubt.c
Quoted 1 line
cmd/mvebu/bubt.c new file +1
-0+ "\t-source The source to load image from [tftp, usb, mmc].Default = tftp\n"
cmd/mvebu/bubt.c
Quoted 3 lines
cmd/mvebu/bubt.c new file +3
-0+"Examples:\n" +"\tbubt - Burn flash-image.bin from tftp to active boot device\n" + "\tbubt flash-image-new.bin nand - Burn flash-image-new.bin fromtftp to NAND flash\n"
cmd/mvebu/bubt.c
Quoted 1 line
cmd/mvebu/bubt.c new file +1
-0+ "\tbubt backup-flash-image.bin mmc usb - Burn backup-flash-image.bin from usb to MMC\n"
doc/mvebu/cmd/bubt.txt line 5
Quoted 12 lines
cmd/mvebu/bubt.c new file +2
-0+ +);doc/mvebu/cmd/bubt.txt new file renamed from doc/mvebu/cmd/bubt.txt +0
-0mode 100644 index 0000000..6f9f525
doc/mvebu/cmd/bubt.txt new file +5
-0@@ -0,0 +1,64 @@ +BUBT (Burn ATF) command +-------------------------- +Bubt command is used to burn a new ATF image to flash device. + +The bubt command gets the following parameters: ATF file name,destination device and source device.
doc/mvebu/cmd/bubt.txt line 7
Quoted 2 lines
doc/mvebu/cmd/bubt.txt new file +2
-0+bubt [file-name] [destination [source]] + - file-name Image file name to burn. default = flash-image.bin
doc/mvebu/cmd/bubt.txt line 8
Quoted 1 line
doc/mvebu/cmd/bubt.txt new file +1
-0+ - destination Flash to burn to [spi, nand, mmc]. default =active flash
doc/mvebu/cmd/bubt.txt line 9
Quoted 1 line
doc/mvebu/cmd/bubt.txt new file +1
-0+ - source Source to load image from [tftp, usb]. default =tftp
doc/mvebu/cmd/bubt.txt
Quoted 3 lines
doc/mvebu/cmd/bubt.txt new file +3
-0+ +Examples: + bubt - Burn flash-image.bin from tftp to activeflash
doc/mvebu/cmd/bubt.txt line 13
Quoted 1 line
doc/mvebu/cmd/bubt.txt new file +1
-0+ bubt latest-spi.bin nand - Burn latest-spi.bin from tftp to NANDflash
doc/mvebu/cmd/bubt.txt
Quoted 11 lines
doc/mvebu/cmd/bubt.txt new file +11
-0+ +Notes: +- For the TFTP interface set serverip and ipaddr. +- To burn image to SD/eMMC device, the target is defined + by parameters CONFIG_SYS_MMC_ENV_DEV and CONFIG_SYS_MMC_ENV_PART. + +Bubt command details (burn image step by-step) +---------------------------------------------- +This section describes bubt command flow: + +1. Fetch the requested ATF image from an available interface(USB/SD/SATA/XDB, etc.)
Quoted 4 lines
doc/mvebu/cmd/bubt.txt new file +4
-0+ into the DRAM, and place it at <load_address> + Example: when using the FAT file system on USB flash device: + # usb reset + # fatls usb 0 (see files in device)doc/mvebu/cmd/bubt.txt
Quoted 10 lines
doc/mvebu/cmd/bubt.txt new file +10
-0+ # fatload usb 0 <load_address> <file_name> + +2. Erase the target device: + - NAND: # nand erase 0 100000 + - SPI: # sf probe 0 + # sf erase 0 100000 + - SD/eMMC: # mmc dev <dev_id> <boot_partition> + +Notes: +- The eMMC has 2 boot partitions (BOOT0 and BOOT1) and a user datapartition (DATA).
doc/mvebu/cmd/bubt.txt line 39
Quoted 1 line
doc/mvebu/cmd/bubt.txt new file +1
-0+ The boot partitions are numbered as partition 1 and 2 in MMCdriver.
doc/mvebu/cmd/bubt.txt line 45
Quoted 6 lines
doc/mvebu/cmd/bubt.txt new file +6
-0+ Number 0 is used for user data partition and should not be utilized +for storing + boot images and U-Boot environment in RAW mode since it will break +file system + structures usually located here. + The default boot partition is BOOT0. It is selected by thefollowing parameter:
doc/mvebu/cmd/bubt.txt
Quoted 4 lines
doc/mvebu/cmd/bubt.txt new file +4
-0+ CONFIG_SYS_MMC_ENV_PART=1 + Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1. + Please never use partition number 0 here! + The eMMC has 2 boot partitions (BOOT0 and BOOT1) and a user datapartition (DATA).
doc/mvebu/cmd/bubt.txt line 50
Quoted 1 line
doc/mvebu/cmd/bubt.txt new file +1
-0+ The boot partitions are numbered as partition 1 and 2 in MMCdriver.
doc/mvebu/cmd/bubt.txt line 56
Quoted 6 lines
doc/mvebu/cmd/bubt.txt new file +6
-0+ Number 0 is used for user data partition and should not be utilized +for storing + boot images and U-Boot environment in RAW mode since it will break +file system + structures usually located here. + The default boot partition is BOOT0. It is selected by thefollowing parameter:
doc/mvebu/cmd/bubt.txt
Quoted 5 lines
doc/mvebu/cmd/bubt.txt new file +5
-0+ CONFIG_SYS_MMC_ENV_PART=1 + Valid values for this parameter are 1 for BOOT0 and 2 for BOOT1. + Please never use partition number 0 here! +- The partition number is ignored if the target device is SD card. +- The boot image offset starts at block 0 for eMMC and block 1 for SDdevices.
doc/mvebu/cmd/bubt.txt line 64
Quoted 8 lines
doc/mvebu/cmd/bubt.txt new file +7
-0+ The block 0 on SD devices is left for MBR storage. + +3. Write the ATF image: + - NAND: # nand write <load_address> 0 <ATF Size> + - SPI: # sf write <load_address> 0 <ATF Size> + - SD/eMMC: # mmc write <load_address> [0|1] <ATF Size>/<block_size> +Thanks,
Stefan
PATCH v2 2/6 arm64: mvebu: Add bubt command for flash image burn
Hi Kosta,
On 06.12.2016 10:06, Kostya Porotchkin wrote:
<snip>
Quoted 11 lines
Quoted 11 lines
cmd/mvebu/bubt.c line 213
Quoted 9 lines
cmd/mvebu/bubt.c new file +9
-0+int is_mmc_active (void ) +{ +return 1 ; +} +#else /* CONFIG_DM_MMC */ +#define mmc_burn_image 0 +#define mmc_read_file 0 +#define is_mmc_active 0 +#endif /* CONFIG_DM_MMC */ Please use empty functions instead.
Quoted 8 lines
[Konstantin Porotchkin]
Do you mean defining it in this way?
#definemmc_burn_image(a)0
Or like below?
intmmc_burn_image(size_t image_size){ return -1; }
The latter please. Perhaps its also possible to return some decent error code in this case (ENODEV?) so that the calling code can handle this case even better or report this clearer to the user.
Thanks,
Stefan
PATCH v2 3/6 arm64: mvebu: pinctrl: Add pin control driver for A8K family
In reply to kostap at marvell.comFrom: Konstantin Porotchkin <[email protected]>
Add a DM port of Marvell pin control driver.
The A8K SoC family contains several silicone dies interconnected in a single package. Every die is normally equipped with its own pin controller unit.
There are 2 pin controllers in A70x0 SoC and 3 in A80x0 SoC.
Changes for v2:
- Fix the code following Simon's review
- Code syntax fixes
- MPP functions documentation for CP110 and APN806
--- arch/arm/include/asm/arch-armada8k/soc-info.h | 17 ++ .../pinctrl/marvell,armada-apn806-pinctrl.txt | 25 ++ .../pinctrl/marvell,armada-cp110-pinctrl.txt | 270 +++++++++++++++++++++ .../pinctrl/marvell,mvebu-pinctrl.txt | 113 +++++++++ drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/mvebu/Kconfig | 7 + drivers/pinctrl/mvebu/Makefile | 7 + drivers/pinctrl/mvebu/pinctrl-mvebu.c | 179 ++++++++++++++ drivers/pinctrl/mvebu/pinctrl-mvebu.h | 31 +++ 10 files changed, 651 insertions(+) create mode 100644 arch/arm/include/asm/arch-armada8k/soc-info.h create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-apn806-pinctrl.txt create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-cp110-pinctrl.txt create mode 100644 doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt create mode 100644 drivers/pinctrl/mvebu/Kconfig create mode 100644 drivers/pinctrl/mvebu/Makefile create mode 100644 drivers/pinctrl/mvebu/pinctrl-mvebu.c create mode 100644 drivers/pinctrl/mvebu/pinctrl-mvebu.h
arch/arm/include/asm/arch-armada8k/soc-info.h new file +17 -0
@@ -0,0 +1,17 @@ +/* +* Copyright (C) 2016 Marvell International Ltd. +* +* SPDX-License-Identifier: GPL-2.0 +* https://spdx.org/licenses +*/ + +#ifndef _SOC_INFO_H_ +#define _SOC_INFO_H_ + +/* Pin Ctrl driver definitions */ +#define BITS_PER_PIN 4 +#define PIN_FUNC_MASK ((1 << BITS_PER_PIN) - 1) +#define PIN_REG_SHIFT 3 +#define PIN_FIELD_MASK ((1 << PIN_REG_SHIFT) - 1) + +#endif /* _SOC_INFO_H_ */
doc/device-tree-bindings/pinctrl/marvell,armada-apn806-pinctrl.txt new file +25 -0
@@ -0,0 +1,25 @@ + Functions of Armada APN806 pin controller + Function 0x0 for any MPP ID activates GPIO pin mode +---------------------------------------------------------------------- +MPP# 0x1 0x2 0x3 0x4 +---------------------------------------------------------------------- +0 SDIO_CLK - SPI0_CLK - +1 SDIO_CMD - SPI0_MISO - +2 SDIO_D[0] - SPI0_MOSI - +3 SDIO_D[1] - SPI0_CS0n - +4 SDIO_D[2] - I2C0_SDA SPI0_CS1n +5 SDIO_D[3] - I2C0_SCK - +6 SDIO_DS - - - +7 SDIO_D[4] - UART1_RXD - +8 SDIO_D[5] - UART1_TXD - +9 SDIO_D[6] - SPI0_CS1n - +10 SDIO_D[7] - - - +11 - - UART0_TXD - +12 SDIO_CARD_PW_OFF SDIO_HW_RST - - +13 - - - - +14 - - - - +15 - - - - +16 - - - - +17 - - - - +18 - - - - +19 - - UART0_RXD -
doc/device-tree-bindings/pinctrl/marvell,armada-cp110-pinctrl.txt new file +270 -0
270 lines not on this page · raw message
doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt new file +113 -0
113 lines not on this page · raw message
drivers/pinctrl/Kconfig +1 -0
@@ -181,5 +181,6 @@ source "drivers/pinctrl/meson/Kconfig" source "drivers/pinctrl/nxp/Kconfig" source "drivers/pinctrl/uniphier/Kconfig" source "drivers/pinctrl/exynos/Kconfig" +source "drivers/pinctrl/mvebu/Kconfig" endmenu
drivers/pinctrl/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_PINCTRL_UNIPHIER) += uniphier/ obj-$(CONFIG_PIC32_PINCTRL) += pinctrl_pic32.o obj-$(CONFIG_PINCTRL_EXYNOS) += exynos/ obj-$(CONFIG_PINCTRL_MESON) += meson/ +obj-$(CONFIG_PINCTRL_MVEBU) += mvebu/
drivers/pinctrl/mvebu/Kconfig new file +7 -0
@@ -0,0 +1,7 @@ +config PINCTRL_MVEBU + depends on ARCH_MVEBU + bool + default y + help + Support pin multiplexing and pin configuration control on + Marvell's Armada-8K SoC.
drivers/pinctrl/mvebu/Makefile new file +7 -0
@@ -0,0 +1,7 @@ +# +# Copyright (C) 2016 Marvell International Ltd. +# +# SPDX-License-Identifier: GPL-2.0 +# https://spdx.org/licenses + +obj-$(CONFIG_PINCTRL_MVEBU) += pinctrl-mvebu.o
drivers/pinctrl/mvebu/pinctrl-mvebu.c new file +179 -0
179 lines not on this page · raw message
drivers/pinctrl/mvebu/pinctrl-mvebu.h new file +31 -0
@@ -0,0 +1,31 @@ +/* +* Copyright (C) 2016 Marvell International Ltd. +* +* SPDX-License-Identifier: GPL-2.0 +* https://spdx.org/licenses +*/ + +#ifndef __PINCTRL_MVEBU_H_ +#define __PINCTRL_MVEBU_H_ + +#define MVEBU_MAX_PINCTL_BANKS 4 +#define MVEBU_MAX_PINS_PER_BANK 100 +#define MVEBU_MAX_FUNC 0xF + +/* +* struct mvebu_pin_bank_data: mvebu-pinctrl bank data +* @base_reg: controller base address for this bank +* @pin_cnt: number of pins included in this bank +* @max_func: maximum configurable function value for pins in this bank +* @reg_direction: +* @bank_name: the pin's bank name +*/ +struct mvebu_pinctrl_priv { +void *base_reg; +uint pin_cnt; +uint max_func; +int reg_direction; +const char *bank_name; +}; + +#endif /* __PINCTRL_MVEBU_H_ */
Signature · 1 line
2.7.4
PATCH v2 3/6 arm64: mvebu: pinctrl: Add pin control driver for A8K family
Hi Kostya,
Quoted 34 lines · On 4 December 2016 at 09:12, <[email protected]> wrote:
From: Konstantin Porotchkin <[email protected]>
Add a DM port of Marvell pin control driver.
The A8K SoC family contains several silicone dies interconnected in a single package. Every die is normally equipped with its own pin controller unit.
There are 2 pin controllers in A70x0 SoC and 3 in A80x0 SoC.Changes for v2:
- Fix the code following Simon's review
- Code syntax fixes
- MPP functions documentation for CP110 and APN806Signed-off-by Konstantin Porotchkin <[email protected]>Cc Simon Glass <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>--- arch/arm/include/asm/arch-armada8k/soc-info.h | 17 ++ .../pinctrl/marvell,armada-apn806-pinctrl.txt | 25 ++ .../pinctrl/marvell,armada-cp110-pinctrl.txt | 270 +++++++++++++++++++++ .../pinctrl/marvell,mvebu-pinctrl.txt | 113 +++++++++ drivers/pinctrl/Kconfig | 1 + drivers/pinctrl/Makefile | 1 + drivers/pinctrl/mvebu/Kconfig | 7 + drivers/pinctrl/mvebu/Makefile | 7 + drivers/pinctrl/mvebu/pinctrl-mvebu.c | 179 ++++++++++++++ drivers/pinctrl/mvebu/pinctrl-mvebu.h | 31 +++ 10 files changed, 651 insertions(+)
Quoted 8 lines
create mode 100644 arch/arm/include/asm/arch-armada8k/soc-info.h create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-apn806-pinctrl.txt create mode 100644 doc/device-tree-bindings/pinctrl/marvell,armada-cp110-pinctrl.txt create mode 100644 doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt create mode 100644 drivers/pinctrl/mvebu/Kconfig create mode 100644 drivers/pinctrl/mvebu/Makefile create mode 100644 drivers/pinctrl/mvebu/pinctrl-mvebu.c create mode 100644 drivers/pinctrl/mvebu/pinctrl-mvebu.h
It would be good to have a bit more detail in the Kconfig help about what the hardware supports, and what your drive supports
- Simon
PATCH v2 4/6 arm64: mvebu: Add pin control nodes to A8K family DTS files
In reply to kostap at marvell.comFrom: Konstantin Porotchkin <[email protected]>
Add pin control nodes to APN806, CP-master, CP-slave and Armada-7040 and Armada-8040 boards DTS files
Changes for v2:
- Remove Gerrit Change ID
- Fix comments
- Fix wrong function values
- Add missing cpm_i2c0 node to armada-7040-db.dts
--- arch/arm/dts/armada-7040-db.dts | 36 ++++++++++++++ arch/arm/dts/armada-8040-db.dts | 56 ++++++++++++++++++++++ arch/arm/dts/armada-ap806.dtsi | 18 +++++++ arch/arm/dts/armada-cp110-master.dtsi | 32 +++++++++++++ arch/arm/dts/armada-cp110-slave.dtsi | 19 ++++++++ .../pinctrl/marvell,mvebu-pinctrl.txt | 44 ++++++++--------- 6 files changed, 183 insertions(+), 22 deletions(-)
arch/arm/dts/armada-7040-db.dts +36 -0
@@ -66,6 +66,16 @@ }; }; +&ap_pinctl { + /* MPP Bus: + * SDIO [0-5] + * UART0 [11,19] + */ + /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 1 1 1 1 1 1 0 0 0 0 + 0 3 0 0 0 0 0 0 0 3 >; +}; + &uart0 { status = "okay"; };
@@ -76,11 +86,37 @@ }; &cpm_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&cpm_i2c0_pins>; status = "okay"; clock-frequency = <100000>; }; +&cpm_pinctl { + /* MPP Bus: + * TDM [0-11] + * SPI [13-16] + * SATA1 [28] + * UART0 [29-30] + * SMI [32,34] + * XSMI [35-36] + * I2C [37-38] + * RGMII1[44-55] + * SD [56-62] + */ + /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 4 4 4 4 4 4 4 4 4 4 + 4 4 0 3 3 3 3 0 0 0 + 0 0 0 0 0 0 0 0 9 0xA + 0xA 0 7 0 7 7 7 2 2 0 + 0 0 0 0 1 1 1 1 1 1 + 1 1 1 1 1 1 0xE 0xE 0xE 0xE + 0xE 0xE 0xE >; +}; + &cpm_spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&cpm_spi0_pins>; status = "okay"; spi-flash at 0 {
arch/arm/dts/armada-8040-db.dts +56 -0
80 lines not on this page · raw message
arch/arm/dts/armada-ap806.dtsi +18 -0
@@ -140,6 +140,24 @@ marvell,spi-base = <128>, <136>, <144>, <152>; }; + ap_pinctl: ap-pinctl at 6F4000 { + compatible = "marvell,armada-ap806-pinctrl"; + bank-name ="apn-806"; + reg = <0x6F4000 0x10>; + pin-count = <20>; + max-func = <3>; + + ap_i2c0_pins: i2c-pins-0 { + marvell,pins = < 4 5 >; + marvell,function = <3>; + }; + ap_emmc_pins: emmc-pins-0 { + marvell,pins = < 0 1 2 3 4 5 6 7 + 8 9 10 >; + marvell,function = <1>; + }; + }; + xor at 400000 { compatible = "marvell,mv-xor-v2"; reg = <0x400000 0x1000>,
arch/arm/dts/armada-cp110-master.dtsi +32 -0
@@ -81,6 +81,38 @@ "cpm-usb3dev", "cpm-eip150", "cpm-eip197"; }; + cpm_pinctl: cpm-pinctl at 440000 { + compatible = "marvell,mvebu-pinctrl", + "marvell,a70x0-pinctrl", + "marvell,a80x0-cp0-pinctrl"; + bank-name ="cp0-110"; + reg = <0x440000 0x20>; + pin-count = <63>; + max-func = <0xf>; + + cpm_i2c0_pins: cpm-i2c-pins-0 { + marvell,pins = < 37 38 >; + marvell,function = <2>; + }; + cpm_ge2_rgmii_pins: cpm-ge-rgmii-pins-0 { + marvell,pins = < 44 45 46 47 48 49 50 51 + 52 53 54 55 >; + marvell,function = <1>; + }; + pca0_pins: cpm-pca0_pins { + marvell,pins = <62>; + marvell,function = <0>; + }; + cpm_sdhci_pins: cpm-sdhi-pins-0 { + marvell,pins = < 56 57 58 59 60 61 >; + marvell,function = <14>; + }; + cpm_spi0_pins: cpm-spi-pins-0 { + marvell,pins = < 13 14 15 16 >; + marvell,function = <3>; + }; + }; + cpm_sata0: sata at 540000 { compatible = "marvell,armada-8k-ahci"; reg = <0x540000 0x30000>;
arch/arm/dts/armada-cp110-slave.dtsi +19 -0
@@ -81,6 +81,25 @@ "cps-usb3dev", "cps-eip150", "cps-eip197"; }; + cps_pinctl: cps-pinctl at 440000 { + compatible = "marvell,mvebu-pinctrl", + "marvell,a80x0-cp1-pinctrl"; + bank-name ="cp1-110"; + reg = <0x440000 0x20>; + pin-count = <63>; + max-func = <0xf>; + + cps_ge1_rgmii_pins: cps-ge-rgmii-pins-0 { + marvell,pins = < 0 1 2 3 4 5 6 7 + 8 9 10 11 >; + marvell,function = <3>; + }; + cps_spi1_pins: cps-spi-pins-1 { + marvell,pins = < 13 14 15 16 >; + marvell,function = <3>; + }; + }; + cps_sata0: sata at 540000 { compatible = "marvell,armada-8k-ahci"; reg = <0x540000 0x30000>;
doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt +22 -22
62 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH v2 4/6 arm64: mvebu: Add pin control nodes to A8K family DTS files
Quoted 33 lines · kostap at marvell.com
From: Konstantin Porotchkin <[email protected]>
Add pin control nodes to APN806, CP-master, CP-slave and Armada-7040 and Armada-8040 boards DTS files
Changes for v2:
- Remove Gerrit Change ID
- Fix comments
- Fix wrong function values
- Add missingcpm_i2c0node toarmada-7040-db.dtsSigned-off-by Konstantin Porotchkin <[email protected]>Cc Stefan Roese <[email protected]>Cc Nadav Haklai <[email protected]>Cc Neta Zur Hershkovits <[email protected]>Cc Omri Itach <[email protected]>Cc Igal Liberman <[email protected]>Cc Haim Boot <[email protected]>Cc Hanna Hawa <[email protected]>--- arch/arm/dts/armada-7040-db.dts | 36 ++++++++++++++ arch/arm/dts/armada-8040-db.dts | 56 ++++++++++++++++++++++ arch/arm/dts/armada-ap806.dtsi | 18 +++++++ arch/arm/dts/armada-cp110-master.dtsi | 32 +++++++++++++ arch/arm/dts/armada-cp110-slave.dtsi | 19 ++++++++ .../pinctrl/marvell,mvebu-pinctrl.txt | 44 ++++++++--------- 6 files changed, 183 insertions(+), 22 deletions(-)arch/arm/dts/armada-7040-db.dts +0
-0
arch/arm/dts/armada-7040-db.dts line 73
Quoted 8 lines
arch/arm/dts/armada-7040-db.dts +5
-0@@ -66,6 +66,16 @@ }; }; +&ap_pinctl { + /* MPP Bus: + * SDIO [0-5] + * UART0 [11,19] + */
Nitpicking: Please use this multi-line comment style:
/*
* comment
* ...
*/
See chapter 8 in CodingStyle. Please do this consistently in all your patches. Thanks.
Quoted 141 lines
arch/arm/dts/armada-7040-db.dts +31
-0+ /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 1 1 1 1 1 1 0 0 0 0 + 0 3 0 0 0 0 0 0 0 3 >; +}; + &uart0 { status = "okay"; };@@ -76,11 +86,37 @@ }; &cpm_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&cpm_i2c0_pins>; status = "okay"; clock-frequency = <100000>; }; +&cpm_pinctl { + /* MPP Bus: + * TDM [0-11] + * SPI [13-16] + * SATA1 [28] + * UART0 [29-30] + * SMI [32,34] + * XSMI [35-36] + * I2C [37-38] + * RGMII1[44-55] + * SD [56-62] + */ + /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 4 4 4 4 4 4 4 4 4 4 + 4 4 0 3 3 3 3 0 0 0 + 0 0 0 0 0 0 0 0 9 0xA + 0xA 0 7 0 7 7 7 2 2 0 + 0 0 0 0 1 1 1 1 1 1 + 1 1 1 1 1 1 0xE 0xE 0xE 0xE + 0xE 0xE 0xE >; +}; + &cpm_spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&cpm_spi0_pins>; status = "okay"; spi-flash at 0 {arch/arm/dts/armada-8040-db.dts +56
-0@@ -71,6 +71,41 @@ status = "okay"; }; +&ap_pinctl { + /* MPP Bus: + * SDIO [0-10] + * UART0 [11,19] + */ + /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 1 1 1 1 1 1 1 1 1 1 + 1 3 0 0 0 0 0 0 0 3 >; +}; + +&cpm_pinctl { + /* MPP Bus: + * [0-31] = 0xff: Keep default CP0_shared_pins: + * [11] CLKOUT_MPP_11 (out) + * [23] LINK_RD_IN_CP2CP (in) + * [25] CLKOUT_MPP_25 (out) + * [29] AVS_FB_IN_CP2CP (in) + * [32,34] SMI + * [31] GPIO: push button/Wake + * [35-36] GPIO + * [37-38] I2C + * [40-41] SATA[0/1]_PRESENT_ACTIVEn + * [42-43] XSMI + * [44-55] RGMII1 + * [56-62] SD + */ + /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff + 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff + 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff + 0xff 0 7 0 7 0 0 2 2 0 + 0 0 8 8 1 1 1 1 1 1 + 1 1 1 1 1 1 0xe 0xe 0xe 0xe + 0xe 0xe 0xe >; +}; /* CON5 on CP0 expansion */ &cpm_pcie2 {@@ -78,6 +113,8 @@ }; &cpm_i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&cpm_i2c0_pins>; status = "okay"; clock-frequency = <100000>; };@@ -97,12 +134,31 @@ status = "okay"; }; +&cps_pinctl { + /* MPP Bus: + * [0-11] RGMII0 + * [13-16] SPI1 + * [27,31] GE_MDIO/MDC + * [32-62] = 0xff: Keep default CP1_shared_pins: + */ + /* 0 1 2 3 4 5 6 7 8 9 */ + pin-func = < 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 + 0x3 0x3 0xff 0x3 0x3 0x3 0x3 0xff 0xff 0xff + 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0x8 0xff 0xff + 0xff 0x8 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff + 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff + 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff + 0xff 0xff 0xff >; +}; + /* CON5 on CP1 expansion */ &cps_pcie2 { status = "okay"; }; &cps_spi1 { + pinctrl-names = "default"; + pinctrl-0 = <&cps_spi1_pins>; status = "okay"; spi-flash at 0 {arch/arm/dts/armada-ap806.dtsi +0
-0@@ -140,6 +140,24 @@ marvell,spi-base = <128>, <136>, <144>, <152>; };
arch/arm/dts/armada-ap806.dtsi line 152
Quoted 10 lines
arch/arm/dts/armada-ap806.dtsi +10
-0+ ap_pinctl: ap-pinctl at 6F4000 { + compatible = "marvell,armada-ap806-pinctrl"; + bank-name ="apn-806"; + reg = <0x6F4000 0x10>; + pin-count = <20>; + max-func = <3>; + + ap_i2c0_pins: i2c-pins-0 { + marvell,pins = < 4 5 >; + marvell,function = <3>;
Are these "marvell," properties also documented? I can't find them in you new file:
doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt
Please add the needed documentation here as well.
Quoted 144 lines
arch/arm/dts/armada-ap806.dtsi +8
-0+ }; + ap_emmc_pins: emmc-pins-0 { + marvell,pins = < 0 1 2 3 4 5 6 7 + 8 9 10 >; + marvell,function = <1>; + }; + }; + xor at 400000 { compatible = "marvell,mv-xor-v2"; reg = <0x400000 0x1000>,arch/arm/dts/armada-cp110-master.dtsi +32
-0@@ -81,6 +81,38 @@ "cpm-usb3dev", "cpm-eip150", "cpm-eip197"; }; + cpm_pinctl: cpm-pinctl at 440000 { + compatible = "marvell,mvebu-pinctrl", + "marvell,a70x0-pinctrl", + "marvell,a80x0-cp0-pinctrl"; + bank-name ="cp0-110"; + reg = <0x440000 0x20>; + pin-count = <63>; + max-func = <0xf>; + + cpm_i2c0_pins: cpm-i2c-pins-0 { + marvell,pins = < 37 38 >; + marvell,function = <2>; + }; + cpm_ge2_rgmii_pins: cpm-ge-rgmii-pins-0 { + marvell,pins = < 44 45 46 47 48 49 50 51 + 52 53 54 55 >; + marvell,function = <1>; + }; + pca0_pins: cpm-pca0_pins { + marvell,pins = <62>; + marvell,function = <0>; + }; + cpm_sdhci_pins: cpm-sdhi-pins-0 { + marvell,pins = < 56 57 58 59 60 61 >; + marvell,function = <14>; + }; + cpm_spi0_pins: cpm-spi-pins-0 { + marvell,pins = < 13 14 15 16 >; + marvell,function = <3>; + }; + }; + cpm_sata0: sata at 540000 { compatible = "marvell,armada-8k-ahci"; reg = <0x540000 0x30000>;arch/arm/dts/armada-cp110-slave.dtsi +19
-0@@ -81,6 +81,25 @@ "cps-usb3dev", "cps-eip150", "cps-eip197"; }; + cps_pinctl: cps-pinctl at 440000 { + compatible = "marvell,mvebu-pinctrl", + "marvell,a80x0-cp1-pinctrl"; + bank-name ="cp1-110"; + reg = <0x440000 0x20>; + pin-count = <63>; + max-func = <0xf>; + + cps_ge1_rgmii_pins: cps-ge-rgmii-pins-0 { + marvell,pins = < 0 1 2 3 4 5 6 7 + 8 9 10 11 >; + marvell,function = <3>; + }; + cps_spi1_pins: cps-spi-pins-1 { + marvell,pins = < 13 14 15 16 >; + marvell,function = <3>; + }; + }; + cps_sata0: sata at 540000 { compatible = "marvell,armada-8k-ahci"; reg = <0x540000 0x30000>;doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt +18
-19@@ -37,10 +37,10 @@ Example: pin-count = <20>; max-func = <3>; /* MPP Bus: - SPI0 [0-3] - I2C0 [4-5] - UART0 [11,19] - */ + * SPI0 [0-3] + * I2C0 [4-5] + * UART0 [11,19] + */ /* 0 1 2 3 4 5 6 7 8 9 */ pin-func = < 3 3 3 3 3 3 0 0 0 0 0 3 0 0 0 0 0 0 0 3>;@@ -59,20 +59,20 @@ Example: pin-count = <63>; max-func = <0xf>; /* MPP Bus: - [0-31] = 0xff: Keep default CP0_shared_pins: - [11] CLKOUT_MPP_11 (out) - [23] LINK_RD_IN_CP2CP (in) - [25] CLKOUT_MPP_25 (out) - [29] AVS_FB_IN_CP2CP (in) - [32,34] SMI - [31] GPIO: push button/Wake - [35-36] GPIO - [37-38] I2C - [40-41] SATA[0/1]_PRESENT_ACTIVEn - [42-43] XSMI - [44-55] RGMII1 - [56-62] SD - */ + * [0-31] = 0xff: Keep default CP0_shared_pins: + * [11] CLKOUT_MPP_11 (out) + * [23] LINK_RD_IN_CP2CP (in) + * [25] CLKOUT_MPP_25 (out) + * [29] AVS_FB_IN_CP2CP (in) + * [32,34] SMI + * [31] GPIO: push button/Wake + * [35-36] GPIO + * [37-38] I2C + * [40-41] SATA[0/1]_PRESENT_ACTIVEn + * [42-43] XSMI + * [44-55] RGMII1 + * [56-62] SD + */ /* 0 1 2 3 4 5 6 7 8 9 */ pin-func = < 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff@@ -95,10 +95,10 @@ Example: pin-count = <63>; max-func = <0xf>; /* MPP Bus: - [0-11] RGMII0
doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt Example: · line 104
Quoted 10 lines
doc/device-tree-bindings/pinctrl/marvell,mvebu-pinctrl.txt +4
-3- [27,31] GE_MDIO/MDC - [32-62] = 0xff: Keep default CP1_shared_pins: - */ + * [0-11] RGMII0 + * [27,31] GE_MDIO/MDC + * [32-62] = 0xff: Keep default CP1_shared_pins: + */ /* 0 1 2 3 4 5 6 7 8 9 */ pin-func = < 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0x3 0xff 0xff 0xff 0xff 0xff 0xff 0xff 0xff
Thanks,
Stefan
PATCH v2 5/6 arm64: mvebu: Enable BUBT command support in A8K default config
In reply to kostap at marvell.comFrom: Konstantin Porotchkin <[email protected]>
Enable mvebu "bubt" command support in the default configuration file for Armada-7040 and Armada-8040 development boards
Changes for v2:
- Remove Gerrit Change ID
--- configs/mvebu_db-88f7040_defconfig | 1 + configs/mvebu_db-88f8040_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/mvebu_db-88f7040_defconfig +1 -0
@@ -27,6 +27,7 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y
configs/mvebu_db-88f8040_defconfig +1 -0
@@ -27,6 +27,7 @@ CONFIG_CMD_EXT4=y CONFIG_CMD_EXT4_WRITE=y CONFIG_CMD_FAT=y CONFIG_CMD_FS_GENERIC=y +CONFIG_CMD_MVEBU_BUBT=y CONFIG_BLOCK_CACHE=y CONFIG_DM_I2C=y CONFIG_SYS_I2C_MVTWSI=y
Signature · 1 line
2.7.4
PATCH v2 6/6 arm64: mvebu: Enable pin control support in A8K default config
In reply to kostap at marvell.comFrom: Konstantin Porotchkin <[email protected]>
Enable mvebu pin control support in the default configuration files for Armada-7040 and Armada-8040 development boards
Changes for v2:
- Remove Gerrit Change ID
--- configs/mvebu_db-88f7040_defconfig | 1 + configs/mvebu_db-88f8040_defconfig | 1 + 2 files changed, 2 insertions(+)
configs/mvebu_db-88f7040_defconfig +1 -0
@@ -51,3 +51,4 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_SMBIOS_MANUFACTURER="" +CONFIG_PINCTRL=y
configs/mvebu_db-88f8040_defconfig +1 -0
@@ -54,3 +54,4 @@ CONFIG_USB_XHCI_HCD=y CONFIG_USB_EHCI_HCD=y CONFIG_USB_STORAGE=y CONFIG_SMBIOS_MANUFACTURER="" +CONFIG_PINCTRL=y
Signature · 1 line
2.7.4