qcom: Add SMEM MTD parser
v3 cover qcom: Add SMEM MTD parser
QCOM platforms such as IPQ806x are using SMEM to store their flash layout. This patch set adds the DT nodes required to instanciate SMEM on IPQ806x and add an MTD parser using it.
This change is based on the SMEM driver posted here:
*https://lkml.org/lkml/2015/7/27/1125
v2:
*Release the SPI device reference after looking it up (put_device()) *Represent SMEM data as __le32 rather than u32
*Move new DT nodes in their proper respective location *Address readability concerns in MTD parser
v3:
*Address Bjorn's comments
Mathieu Olivari (3):
ARM: qcom: add SFPB nodes to IPQ806x dts
ARM: qcom: add SMEM device node to IPQ806x dts
mtd: add SMEM parser for QCOM platforms
arch/arm/boot/dts/qcom-ipq8064.dtsi | 23 +++- drivers/mtd/Kconfig | 7 ++ drivers/mtd/Makefile | 1 + drivers/mtd/qcom_smem_part.c | 224 ++++++++++++++++++++++++++++++++++++ 4 files changed, 254 insertions(+), 1 deletion(-) create mode 100644 drivers/mtd/qcom_smem_part.c
Signature · 1 line
2.1.4
PATCH v3 1/3 ARM: qcom: add SFPB nodes to IPQ806x dts
Add one new node to the ipq806x.dtsi file to declare & register the hardware spinlock devices. This mechanism is required to be used by other drivers such as SMEM.
--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm/boot/dts/qcom-ipq8064.dtsi +11 -0
@@ -329,5 +329,16 @@ #reset-cells = <1>; }; + sfpb_mutex_block: syscon at 1200600 { + compatible = "syscon"; + reg = <0x01200600 0x100>; + }; + }; + + sfpb_mutex: sfpb-mutex { + compatible = "qcom,sfpb-mutex"; + syscon = <&sfpb_mutex_block 4 4>; + + #hwlock-cells = <1>; }; };
Signature · 1 line
2.1.4
Re: [PATCH v3 1/3] ARM: qcom: add SFPB nodes to IPQ806x dts
Quoted 4 lines · Mathieu Olivari
Add one new node to the
ipq806x.dtsifile to declare & register the hardware spinlock devices. This mechanism is required to be used by other drivers such as SMEM.
Quoted 10 lines
Signed-off-by Mathieu Olivari <[email protected]>--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 11 +++++++++++ 1 file changed, 11 insertions(+)arch/arm/boot/dts/qcom-ipq8064.dtsi +0
-0
arch/arm/boot/dts/qcom-ipq8064.dtsi line 334
Quoted 6 lines
arch/arm/boot/dts/qcom-ipq8064.dtsi +3
-0@@ -329,5 +329,16 @@ #reset-cells = <1>; }; + sfpb_mutex_block: syscon at 1200600 { + compatible = "syscon"; + reg = <0x01200600 0x100>;
I have this block listed to start at 0x1200000 and used 0x604 as offset when testing this. In my docs there's nothing in those first 0x600 bytes though, so this works fine for me.
arch/arm/boot/dts/qcom-ipq8064.dtsi line 344
Quoted 10 lines
arch/arm/boot/dts/qcom-ipq8064.dtsi +8
-0+ }; + }; + + sfpb_mutex: sfpb-mutex { + compatible = "qcom,sfpb-mutex"; + syscon = <&sfpb_mutex_block 4 4>; + + #hwlock-cells = <1>; }; };
Regards,
Bjorn
PATCH v3 2/3 ARM: qcom: add SMEM device node to IPQ806x dts
In reply to Mathieu OlivariSMEM is used on IPQ806x to store various board related information such as boot device and flash partition layout. We'll declare it as a device so we can make use of it thanks to the new SMEM soc driver.
--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/boot/dts/qcom-ipq8064.dtsi +7 -1
@@ -55,7 +55,7 @@ no-map; }; - smem at 41000000 { + smem: smem at 41000000 { reg = <0x41000000 0x200000>; no-map; };
@@ -341,4 +341,10 @@ #hwlock-cells = <1>; }; + + smem { + compatible = "qcom,smem"; + memory-region = <&smem>; + hwlocks = <&sfpb_mutex 3>; + }; };
Signature · 1 line
2.1.4
Re: [PATCH v3 2/3] ARM: qcom: add SMEM device node to IPQ806x dts
Quoted 14 lines · Mathieu Olivari
SMEM is used on IPQ806x to store various board related information such as boot device and flash partition layout. We'll declare it as a device so we can make use of it thanks to the new SMEM soc driver.
Signed-off-by Mathieu Olivari <[email protected]>--- arch/arm/boot/dts/qcom-ipq8064.dtsi | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)arch/arm/boot/dts/qcom-ipq8064.dtsi +0
-0
arch/arm/boot/dts/qcom-ipq8064.dtsi line 58
Quoted 5 lines
arch/arm/boot/dts/qcom-ipq8064.dtsi +1
-1@@ -55,7 +55,7 @@ no-map; }; - smem at 41000000 { + smem: smem at 41000000 {
I would preferred if you used a name like "smem_region", although I don't think we will use the phandle name "smem" for anything else...
Quoted 4 lines
arch/arm/boot/dts/qcom-ipq8064.dtsi +0
-0reg = <0x41000000 0x200000>; no-map; };
arch/arm/boot/dts/qcom-ipq8064.dtsi line 350
Quoted 10 lines
arch/arm/boot/dts/qcom-ipq8064.dtsi +6
-0@@ -341,4 +341,10 @@ #hwlock-cells = <1>; }; + + smem { + compatible = "qcom,smem"; + memory-region = <&smem>; + hwlocks = <&sfpb_mutex 3>; + }; };
Regards,
Bjorn
PATCH v3 3/3 mtd: add SMEM parser for QCOM platforms
In reply to Mathieu OlivariOn QCOM platforms using MTD devices storage (such as IPQ806x), SMEM is used to store partition layout. This new parser can now be used to read SMEM and use it to register an MTD layout according to its content.
---
Notes:
v2:
*Release the SPI device reference after looking it up (put_device()) *Represent SMEM data as __le32 rather than u32
*Move new DT nodes in their proper respective location *Address readability concerns in MTD parser
v3:
*Redefine SMEM functions prototypes for better readability *Duplicate MTD name instead of pointing to SMEM string location in case
mtd layer tries to free it
*Rework some of the comments
drivers/mtd/Kconfig | 7 ++ drivers/mtd/Makefile | 1 + drivers/mtd/qcom_smem_part.c | 246 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 254 insertions(+) create mode 100644 drivers/mtd/qcom_smem_part.c
drivers/mtd/Kconfig +7 -0
@@ -155,6 +155,13 @@ config MTD_BCM47XX_PARTS This provides partitions parser for devices based on BCM47xx boards. +config MTD_QCOM_SMEM_PARTS + tristate "QCOM SMEM partitioning support" + depends on QCOM_SMEM + help + This provides partitions parser for QCOM devices using SMEM + such as IPQ806x. + comment "User Modules And Translation Layers" #
drivers/mtd/Makefile +1 -0
@@ -13,6 +13,7 @@ obj-$(CONFIG_MTD_AFS_PARTS) += afs.o obj-$(CONFIG_MTD_AR7_PARTS) += ar7part.o obj-$(CONFIG_MTD_BCM63XX_PARTS) += bcm63xxpart.o obj-$(CONFIG_MTD_BCM47XX_PARTS) += bcm47xxpart.o +obj-$(CONFIG_MTD_QCOM_SMEM_PARTS) += qcom_smem_part.o # 'Users' - code which presents functionality to userspace. obj-$(CONFIG_MTD_BLKDEVS) += mtd_blkdevs.o
drivers/mtd/qcom_smem_part.c new file +246 -0
246 lines not on this page · raw message
Signature · 1 line
2.1.4
Re: [PATCH v3 3/3] mtd: add SMEM parser for QCOM platforms
Quoted 3 lines · Mathieu Olivari
On QCOM platforms using MTD devices storage (such as IPQ806x), SMEM is used to store partition layout. This new parser can now be used to read SMEM and use it to register an MTD layout according to its content.
Looks good, but the license string should be "GPL v2" (lower case v). Just as a hint...I made checkpatch warn you about that a while back ;)
The rest is
[..]
drivers/mtd/qcom_smem_part.c line 244
Quoted 2 lines
drivers/mtd/qcom_smem_part.c new file +2
-0+ +MODULE_LICENSE ("GPL V2" );
Regards,
Bjorn
Hi,
Quoted 6 lines · Mathieu Olivari
QCOM platforms such as IPQ806x are using SMEM to store their flash layout. This patch set adds the DT nodes required to instanciate SMEM on IPQ806x and add an MTD parser using it.
This change is based on the SMEM driver posted here:
*https://lkml.org/lkml/2015/7/27/1125
Nice work. After testing it on AP148 I see this:
[ 2.481507] 12 qcom-smem partitions found on MTD device qcom-nandc [ 2.481540] Creating 12 MTD partitions on "qcom-nandc": [ 2.486690] 0x000000000000-0x000000040000 : "0:SBL1" [ 2.492842] 0x000000040000-0x000000180000 : "0:MIBIB" [ 2.497857] 0x000000180000-0x0000002c0000 : "0:SBL2" [ 2.502895] 0x0000002c0000-0x000000540000 : "0:SBL3" [ 2.507828] 0x000000540000-0x000000660000 : "0:DDRCONFIG" [ 2.512857] 0x000000660000-0x000000780000 : "0:SSD" [ 2.518074] 0x000000780000-0x000000a00000 : "0:TZ" [ 2.522834] 0x000000a00000-0x000000c80000 : "0:RPM" [ 2.527607] 0x000000c80000-0x000001180000 : "0:APPSBL" [ 2.532472] 0x000001180000-0x000001200000 : "0:APPSBLENV" [ 2.537586] 0x000001200000-0x000001340000 : "0:ART" [ 2.543140] 0x000001340000-0x000005340000 : "rootfs"
Are all these partition names supposed to be prefixed with "0:"? This is using the OpenWrt applied version.
Jonas
Quoted 27 lines · Jonas Gorski
Hi,
Quoted 6 lines · Mathieu Olivari
QCOM platforms such as IPQ806x are using SMEM to store their flash layout. This patch set adds the DT nodes required to instanciate SMEM on IPQ806x and add an MTD parser using it.
This change is based on the SMEM driver posted here:
*https://lkml.org/lkml/2015/7/27/1125Nice work. After testing it on AP148 I see this:
[ 2.481507] 12 qcom-smem partitions found on MTD device qcom-nandc [ 2.481540] Creating 12 MTD partitions on "qcom-nandc": [ 2.486690] 0x000000000000-0x000000040000 : "0:SBL1" [ 2.492842] 0x000000040000-0x000000180000 : "0:MIBIB" [ 2.497857] 0x000000180000-0x0000002c0000 : "0:SBL2" [ 2.502895] 0x0000002c0000-0x000000540000 : "0:SBL3" [ 2.507828] 0x000000540000-0x000000660000 : "0:DDRCONFIG" [ 2.512857] 0x000000660000-0x000000780000 : "0:SSD" [ 2.518074] 0x000000780000-0x000000a00000 : "0:TZ" [ 2.522834] 0x000000a00000-0x000000c80000 : "0:RPM" [ 2.527607] 0x000000c80000-0x000001180000 : "0:APPSBL" [ 2.532472] 0x000001180000-0x000001200000 : "0:APPSBLENV" [ 2.537586] 0x000001200000-0x000001340000 : "0:ART" [ 2.543140] 0x000001340000-0x000005340000 : "rootfs"
Quoted 2 lines
Are all these partition names supposed to be prefixed with "0:"? This is using the OpenWrt applied version.
Yes. These are the names as they are listed in SMEM. If you run the "smem" command from the U-boot prompt, you will see the same information. I'm not sure what the 0: prefix means, and where it comes from to be honest.
Quoted 3 lines
Jonas