Qualcomm SMEM driver
cover Qualcomm SMEM driver
This patchset introduces Qualcomm's shared memory manager. In U-boot context, it will allow reading board specific information (IE. RAM address, RAM size) that was prepopulated by the SBL.
As part of the patchset a new uclass id is introduced, UCLASS_SOC. The UCLASS_SOC is a class intended for SOC specific drivers that don't fall into any other uclass catagories.
Tom: Please make sure that this only get merged after:
https://patchwork.ozlabs.org/patch/924769/ as the smem driver needs some Linux definitions that needs update in U-boot.
Ramon Fried (4):
dm: SOC (System on chip) uclass
soc: qualcomm: Add Shared Memory Manager driver
dts: db410c: added smem nodes
dts: db820c: added smem nodes
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + arch/arm/dts/dragonboard410c-uboot.dtsi | 4 + arch/arm/dts/dragonboard410c.dts | 16 + arch/arm/dts/dragonboard820c-uboot.dtsi | 4 + arch/arm/dts/dragonboard820c.dts | 16 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 2 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934 ++++++++++++++++++++++++ drivers/soc/soc-uclass.c | 8 + include/dm/uclass-id.h | 1 + 14 files changed, 1008 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.c create mode 100644 drivers/soc/soc-uclass.c
Signature · 1 line
2.17.1
PATCH 1/4 dm: SOC (System on chip) uclass
This is a simple uclass for SOC drivers.
It is intend to serve as uclass for SOC specific drivers that don't fall into any other uclass catagories. Currently, it doesn't define any special ops.
---
drivers/soc/Makefile | 1 + drivers/soc/soc-uclass.c | 8 ++++++++ include/dm/uclass-id.h | 1 + 3 files changed, 10 insertions(+) create mode 100644 drivers/soc/soc-uclass.c
drivers/soc/Makefile +1 -0
@@ -3,3 +3,4 @@ # Makefile for the U-Boot SOC specific device drivers. obj-$(CONFIG_ARCH_KEYSTONE) += keystone/ +obj-y += soc-uclass.o
drivers/soc/soc-uclass.c new file +8 -0
@@ -0,0 +1,8 @@ +// SPDX-License-Identifier: GPL-2.0+ +#include <common.h> +#include <dm.h> + +UCLASS_DRIVER (soc) = { + .id =UCLASS_SOC , + .name ="soc" , +};
include/dm/uclass-id.h +1 -0
@@ -74,6 +74,7 @@ enum uclass_id {UCLASS_RTC ,/* Real time clock device */ UCLASS_SCSI ,/* SCSI device */ UCLASS_SERIAL ,/* Serial UART */ +UCLASS_SOC ,/* SOC (System on chip) specific device */ UCLASS_SPI ,/* SPI bus */ UCLASS_SPMI ,/* System Power Management Interface bus */ UCLASS_SPI_FLASH, /* SPI flash */
Signature · 1 line
2.17.1
PATCH 1/4 dm: SOC (System on chip) uclass
Quoted 6 lines · Ramon Fried
This is a simple uclass for SOC drivers.
It is intend to serve as uclass for SOC specific drivers that don't fall into any other uclass catagories. Currently, it doesn't define any special ops.Signed-off-by Ramon Fried <[email protected]>
PATCH 1/4 dm: SOC (System on chip) uclass
In reply to Ramon FriedHi Ramon,
Quoted 8 lines · Ramon Fried
This is a simple uclass for SOC drivers.
It is intend to serve as uclass for SOC specific drivers that don't fall into any other uclass catagories. Currently, it doesn't define any special ops.Signed-off-by Ramon Fried <[email protected]>
Quoted 7 lines
---
drivers/soc/Makefile | 1 + drivers/soc/soc-uclass.c | 8 ++++++++ include/dm/uclass-id.h | 1 + 3 files changed, 10 insertions(+) create mode 100644 drivers/soc/soc-uclass.c
Please see my other email on this series. This is not the correct way to implement a driver-model uclass.
Regards,
Simon
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
In reply to Ramon FriedThe Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant
in U-boot particualar use case, which is just reading from the smem.
* adaptaion from Linux driver model to U-boot's.
---
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934 ++++++++++++++++++++++++++++++++++ 8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.c
MAINTAINERS +1 -0
@@ -187,6 +187,7 @@ ARM SNAPDRAGON M: Mateusz Kulikowski <[email protected]> S: Maintained F: arch/arm/mach-snapdragon/ +F: drivers/soc/qualcomm/ ARM STI M: Patrice Chotard <[email protected]>
arch/arm/Kconfig +1 -0
@@ -728,6 +728,7 @@ config ARCH_SNAPDRAGON select SPMI select OF_CONTROL select OF_SEPARATE + select MSM_SMEM config ARCH_SOCFPGA bool "Altera SOCFPGA family"
drivers/Kconfig +2 -0
@@ -104,6 +104,8 @@ source "drivers/video/Kconfig" source "drivers/watchdog/Kconfig" +source "drivers/soc/Kconfig" + config PHYS_TO_BUS bool "Custom physical to bus address mapping" help
drivers/soc/Kconfig new file +5 -0
@@ -0,0 +1,5 @@ +menu "SOC (System On Chip) specific Drivers" + +source "drivers/soc/qualcomm/Kconfig" + +endmenu
drivers/soc/Makefile +1 -0
@@ -3,4 +3,5 @@ # Makefile for the U-Boot SOC specific device drivers. obj-$(CONFIG_ARCH_KEYSTONE) += keystone/ +obj-$(CONFIG_ARCH_SNAPDRAGON) += qualcomm/ obj-y += soc-uclass.o
drivers/soc/qualcomm/Kconfig new file +11 -0
@@ -0,0 +1,11 @@ +menu "Qualcomm SoC drivers" + +config MSM_SMEM + bool "Qualcomm Shared Memory Manager (SMEM)" + depends on ARCH_SNAPDRAGON + help + Say y here to enable support for the Qualcomm Shared Memory Manager. + The driver provides an interface to items in a heap shared among all + processors in a Qualcomm platform. + +endmenu
drivers/soc/qualcomm/Makefile new file +3 -0
@@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0+ + +obj-$(CONFIG_MSM_SMEM) += smem.o
drivers/soc/qualcomm/smem.c new file +934 -0
934 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 5 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Please, run scripts/checkpatch on this patch an fix all errors and warnings, e.g.
WARNING: line over 80 characters
#1064: FILE: drivers/soc/qualcomm/smem.c:846:
+ smem->regions[i].virt_base = devm_ioremap(dev, r.start,fdt_resource_size(&r));
CHECK: Alignment should match open parenthesis
#1098: FILE: drivers/soc/qualcomm/smem.c:880:
+ if (num_regions > 1 && (ret = qcom_smem_map_memory(smem, dev,
+ "qcom,rpm-msg-ram", 1)))
Do not use DOS line endings.
Best regards
Heinrich Schuchardt
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 9 lines · Heinrich Schuchardt
Quoted 5 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Please, run
scripts/checkpatchon this patch an fix all errors and warnings, e.g.
Hi Heinrich,
Actually I did run it, and I also run it in Linux and got the same results. I thought it will be better to keep the driver aligned to Linux than to fix these warnings.
But if can surely fix it, what do you suggest ?
Quoted 11 lines
WARNING: line over 80 characters
#1064: FILE:drivers/soc/qualcomm/smem.c:846:
+ smem->regions[i].virt_base = devm_ioremap(dev, r.start,fdt_resource_size(&r));CHECK: Alignment should match open parenthesis
#1098: FILE:drivers/soc/qualcomm/smem.c:880:drivers/soc/qualcomm/smem.c new file +2
-0+if (num_regions >1 && (ret =qcom_smem_map_memory (smem, dev, +"qcom,rpm-msg-ram" ,1 )))
Quoted 1 line
Do not use DOS line endings.
Sure. Thanks.
Quoted 4 lines
Best regards
Heinrich Schuchardt
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 8 lines · Ramon Fried
Quoted 7 lines · Heinrich Schuchardt
Quoted 5 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Quoted 7 lines
Quoted 2 lines
Please, run
scripts/checkpatchon this patch an fix all errors and warnings, e.g.Hi Heinrich,
Actually I did run it, and I also run it in Linux and got the same results. I thought it will be better to keep the driver aligned to Linux than to fix these warnings.
But if can surely fix it, what do you suggest ?
At least add a comment in the commit message why you diverge from our coding standard.
As Mateusz will be the maintainer he should decide.
Best regards
Heinrich
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 15 lines · Heinrich Schuchardt
Quoted 1 line · Ramon Fried
On Sat, Jun 9, 2018 at 1:12 PM, Heinrich Schuchardt
Quoted 2 lines · <[email protected]> wrote:
Quoted 2 lines · Ramon Fried
Quoted 1 line
The Shared Memory Manager driver implements an interface for
allocating
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Please, run
scripts/checkpatchon this patch an fix all errors and warnings, e.g.Hi Heinrich,
Actually I did run it, and I also run it in Linux and got the same
Quoted 8 lines
results.
Quoted 3 lines
I thought it will be better to keep the driver aligned to Linux than to fix these warnings.
But if can surely fix it, what do you suggest ?At least add a comment in the commit message why you diverge from our coding standard.
I just sent checkpatch fixes to the Linux kernel list. Hopefully it will be accepted. BTW. I'm replacing Mateusz as the maintainer for arch-snapdragon, Thanks, Ramon
Quoted 5 lines
As Mateusz will be the maintainer he should decide.
Best regards
Heinrich
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
In reply to Ramon FriedQuoted 6 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Quoted 9 lines
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant
in U-boot particualar use case, which is just reading from the smem.
* adaptaion from Linux driver model to U-boot's.Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
<snip />
drivers/soc/qualcomm/smem.c line 349
Quoted 8 lines
drivers/soc/qualcomm/smem.c new file +8
-0+/* Pointer to the one and only smem handle */ +static struct qcom_smem *__smem; + +static int qcom_smem_alloc_private (struct qcom_smem *smem, +struct smem_partition_header *phdr, +unsigned item, +size_t size) +{
<snip />
drivers/soc/qualcomm/smem.c line 391
Quoted 3 lines
drivers/soc/qualcomm/smem.c new file +3
-0+*/ +dmb (); +le32_add_cpu (&phdr->offset_free_uncached, alloc_size);
drivers/soc/qualcomm/smem.c: In function ‘qcom_smem_alloc_private’:drivers/soc/qualcomm/smem.c:391:2: warning: implicit declaration of function ‘le32_add_cpu’ [-Wimplicit-function-declaration]
le32_add_cpu(&phdr->offset_free_uncached, alloc_size);
Please, add the missing definition to ./include/linux/byteorder/generic.h
or reference the prerequisite patch in the commit message.
Best regards
Heinrich
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 35 lines · Heinrich Schuchardt
Quoted 6 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Quoted 9 lines
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant
in U-boot particualar use case, which is just reading from the smem.
* adaptaion from Linux driver model to U-boot's.Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
<snip />
drivers/soc/qualcomm/smem.c line 349
Quoted 8 lines
drivers/soc/qualcomm/smem.c new file +8
-0+/* Pointer to the one and only smem handle */ +static struct qcom_smem *__smem; + +static int qcom_smem_alloc_private (struct qcom_smem *smem, +struct smem_partition_header *phdr, +unsigned item, +size_t size) +{<snip />
drivers/soc/qualcomm/smem.c line 391
Quoted 3 lines
drivers/soc/qualcomm/smem.c new file +3
-0+*/ +dmb (); +le32_add_cpu (&phdr->offset_free_uncached, alloc_size);
Quoted 8 lines
drivers/soc/qualcomm/smem.c: In function ‘qcom_smem_alloc_private’:drivers/soc/qualcomm/smem.c:391:2: warning: implicit declaration of function ‘le32_add_cpu’ [-Wimplicit-function-declaration]
le32_add_cpu(&phdr->offset_free_uncached, alloc_size);Please, add the missing definition to
./include/linux/byteorder/generic.h
or reference the prerequisite patch in the commit message.
Hi Heinrich, the prerequisite patch was mentioned in the cover letter. I thought it's good enough, I can add it also to the commit message if necessary.
Nevertheless, here it is:
https://patchwork.ozlabs.org/patch/924769/
Thanks,
Ramon.
Quoted 5 lines
Best regards
Heinrich
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
In reply to Ramon FriedHi Ramon,
Quoted 15 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant
in U-boot particualar use case, which is just reading from the smem.
* adaptaion from Linux driver model to U-boot's.Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
Quoted 13 lines
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934 ++++++++++++++++++++++++++++++++++ 8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.c
Sorry, but NAK on this.
This patch supports direct calls into a driver which is not allowed. This should be done through the driver's uclass API, not through direct calls.
The new uclass needs a sandbox driver and test, once you decide on that API
Regards,
Simon
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 32 lines · Simon Glass
Hi Ramon,
Quoted 15 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant
in U-boot particualar use case, which is just reading from the smem.
* adaptaion from Linux driver model to U-boot's.Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
Quoted 13 lines
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934 ++++++++++++++++++++++++++++++++++ 8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.c
Quoted 7 lines
Sorry, but NAK on this.
This patch supports direct calls into a driver which is not allowed. This should be done through the driver's uclass API, not through direct calls.
Hi Simon,
I see your point.
As you probably see, I was looking at the DM framework for the convenience it
gives with binding device-tree nodes and drivers.
If it's not an option I'll rewrite it as as arch-code under mach-snapdragon. Thanks,
Ramon.
The new uclass needs a sandbox driver and test, once you decide on that API
Quoted 4 lines
Regards,
Simon
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Hi Ramon,
Quoted 42 lines · Ramon Fried
Quoted 33 lines · Simon Glass
Hi Ramon,
Quoted 15 lines · Ramon Fried
The Shared Memory Manager driver implements an interface for allocating and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant
in U-boot particualar use case, which is just reading from the smem.
* adaptaion from Linux driver model to U-boot's.Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
Quoted 13 lines
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934 ++++++++++++++++++++++++++++++++++ 8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.cQuoted 6 lines
Sorry, but NAK on this.
This patch supports direct calls into a driver which is not allowed. This should be done through the driver's uclass API, not through direct calls.
Quoted 8 lines
Hi Simon,
I see your point.
As you probably see, I was looking at the DM framework for the convenience it
gives with binding device-tree nodes and drivers.
If it's not an option I'll rewrite it as as arch-code under mach-snapdragon. Thanks,
Ramon.
You are correct that you should be using driver model. It's that you need to do it fully, with a proper API. There are lots of examples.
Regards,
Simon
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 56 lines · Simon Glass
Hi Ramon,
Quoted 3 lines · Ramon Fried
On Mon, Jun 11, 2018 at 5:53 PM, Simon Glass <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Hi Ramon,
Quoted 1 line · Ramon Fried
The Shared Memory Manager driver implements an interface for
allocating
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant in U-boot particualar use case, which is just reading from thesmem.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
* adaptaion from Linux driver model to U-boot's.
Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934++++++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.cSorry, but NAK on this.
Quoted 7 lines
Quoted 4 lines
This patch supports direct calls into a driver which is not allowed. This should be done through the driver's uclass API, not through direct calls.
Hi Simon,
I see your point.
As you probably see, I was looking at the DM framework for theconvenience
Quoted 3 lines
it
gives with binding device-tree nodes and drivers. If it's not an option I'll rewrite it as as arch-code under
Quoted 7 lines
mach-snapdragon.
Quoted 2 lines
Thanks,
Ramon.You are correct that you should be using driver model. It's that you need to do it fully, with a proper API. There are lots of examples.
Doesn't it make sense to add some facility for drivers that don't export common functionalities. Like Linux platform drivers?
Quoted 2 lines
Regards,
Simon
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Hi Ramon,
Quoted 57 lines · Ramon Fried
Quoted 56 lines · Simon Glass
Hi Ramon,
Quoted 3 lines · Ramon Fried
On Mon, Jun 11, 2018 at 5:53 PM, Simon Glass <[email protected]>
Quoted 5 lines · wrote:
Quoted 5 lines
Hi Ramon,
Quoted 1 line · Ramon Fried
The Shared Memory Manager driver implements an interface for
allocating
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant in U-boot particualar use case, which is just reading from thesmem.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
* adaptaion from Linux driver model to U-boot's.
Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934++++++++++++++++++++++++++++++++++
Quoted 8 lines
Quoted 8 lines
Quoted 5 lines
8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.cSorry, but NAK on this.
Quoted 7 lines
Quoted 4 lines
This patch supports direct calls into a driver which is not allowed. This should be done through the driver's uclass API, not through direct calls.
Hi Simon,
I see your point.
As you probably see, I was looking at the DM framework for theconvenience
Quoted 3 lines
it
gives with binding device-tree nodes and drivers. If it's not an option I'll rewrite it as as arch-code under
Quoted 8 lines
Quoted 7 lines
mach-snapdragon.
Quoted 2 lines
Thanks,
Ramon.You are correct that you should be using driver model. It's that you need to do it fully, with a proper API. There are lots of examples.
Doesn't it make sense to add some facility for drivers that don't export common functionalities. Like Linux platform drivers?
Well this is how things used to work in U-Boot before driver model.
Now we are trying to move things to driver model.
It does not look like you have many calls, so it should be easy enough to move it to a uclass.
You can also add a command to access the device. People can see the tree of devices with 'dm tree', etc.
Regards,
Simon
PATCH 2/4 soc: qualcomm: Add Shared Memory Manager driver
Quoted 71 lines · Simon Glass
Hi Ramon,
Quoted 1 line · Ramon Fried
On June 11, 2018 10:38:45 PM GMT+03:00, Simon Glass
Quoted 11 lines · <[email protected]> wrote:
Quoted 11 lines
Hi Ramon,
Quoted 3 lines · Ramon Fried
On Mon, Jun 11, 2018 at 5:53 PM, Simon Glass <[email protected]>
Quoted 4 lines · wrote:
Quoted 4 lines
Hi Ramon,
On 9 June 2018 at 03:06, Ramon Fried <[email protected]>
Quoted 32 lines · wrote:
Quoted 32 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
The Shared Memory Manager driver implements an interface for
allocating
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
and accessing items in the memory area shared among all of the processors in a Qualcomm platform.
Adapted from the Linux driver (4.17)
Changes from the original Linux driver:
* Removed HW spinlock mechanism, which is irrelevant in U-boot particualar use case, which is just reading from thesmem.
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines
* adaptaion from Linux driver model to U-boot's.
Cc Bjorn Andersson <[email protected]>Signed-off-by Ramon Fried <[email protected]>---
Quoted 8 lines
Quoted 8 lines
Quoted 8 lines
MAINTAINERS | 1 + arch/arm/Kconfig | 1 + drivers/Kconfig | 2 + drivers/soc/Kconfig | 5 + drivers/soc/Makefile | 1 + drivers/soc/qualcomm/Kconfig | 11 + drivers/soc/qualcomm/Makefile | 3 + drivers/soc/qualcomm/smem.c | 934++++++++++++++++++++++++++++++++++
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
8 files changed, 958 insertions(+) create mode 100644 drivers/soc/Kconfig create mode 100644 drivers/soc/qualcomm/Kconfig create mode 100644 drivers/soc/qualcomm/Makefile create mode 100644 drivers/soc/qualcomm/smem.cQuoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Sorry, but NAK on this.
This patch supports direct calls into a driver which is not
allowed.
Quoted 10 lines
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines
This should be done through the driver's uclass API, not through direct calls.
Hi Simon,
I see your point.
As you probably see, I was looking at the DM framework for theconvenience
Quoted 3 lines
it
gives with binding device-tree nodes and drivers. If it's not an option I'll rewrite it as as arch-code underQuoted 8 lines
Quoted 7 lines
mach-snapdragon.
Quoted 2 lines
Thanks,
Ramon.You are correct that you should be using driver model. It's that you need to do it fully, with a proper API. There are lots of examples.
Doesn't it make sense to add some facility for drivers that don't
Quoted 8 lines
export common functionalities. Like Linux platform drivers?
Well this is how things used to work in U-Boot before driver model.
Now we are trying to move things to driver model.
It does not look like you have many calls, so it should be easy enough to move it to a uclass.
That's what I'll do.
Thanks.
Quoted 6 lines
You can also add a command to access the device. People can see the tree of devices with 'dm tree', etc.
Regards,
Simon
Signature · 1 line
Sent from my Android device with K-9 Mail. Please excuse my brevity.
PATCH 3/4 dts: db410c: added smem nodes
In reply to Ramon FriedAdded necessary nodes for Qualcomm smem driver.
---
arch/arm/dts/dragonboard410c-uboot.dtsi | 4 ++++ arch/arm/dts/dragonboard410c.dts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+)
arch/arm/dts/dragonboard410c-uboot.dtsi +4 -0
@@ -10,6 +10,10 @@ u-boot,mmc-env-partition = "boot"; }; + smem { + u-boot,dm-pre-reloc; + }; + soc { u-boot,dm-pre-reloc;
arch/arm/dts/dragonboard410c.dts +16 -0
@@ -27,18 +27,34 @@ #address-cells = <2>; #size-cells = <2>; ranges; + + smem_mem: smem_region at 86300000 { + reg = <0x0 0x86300000 0x0 0x100000>; + no-map; + }; }; chosen { stdout-path = "/soc/serial at 78b0000"; }; + smem { + compatible = "qcom,smem"; + memory-region = <&smem_mem>; + qcom,rpm-msg-ram = <&rpm_msg_ram>; + }; + soc { #address-cells = <0x1>; #size-cells = <0x1>; ranges = <0x0 0x0 0x0 0xffffffff>; compatible = "simple-bus"; + rpm_msg_ram: memory at 60000 { + compatible = "qcom,rpm-msg-ram"; + reg = <0x60000 0x8000>; + }; + pinctrl: qcom,tlmm at 1000000 { compatible = "qcom,tlmm-apq8016"; reg = <0x1000000 0x400000>;
Signature · 1 line
2.17.1
PATCH 4/4 dts: db820c: added smem nodes
In reply to Ramon FriedAdded necessary nodes for Qualcomm smem driver.
---
arch/arm/dts/dragonboard820c-uboot.dtsi | 4 ++++ arch/arm/dts/dragonboard820c.dts | 16 ++++++++++++++++ 2 files changed, 20 insertions(+)
arch/arm/dts/dragonboard820c-uboot.dtsi +4 -0
@@ -6,6 +6,10 @@ */ / { + smem { + u-boot,dm-pre-reloc; + }; + soc { u-boot,dm-pre-reloc;
arch/arm/dts/dragonboard820c.dts +16 -0
@@ -28,11 +28,27 @@ reg = <0 0x80000000 0 0xc0000000>; }; + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + ranges; + + smem_mem: smem_region at 86300000 { + reg = <0x0 0x86300000 0x0 0x200000>; + no-map; + }; + }; + psci { compatible = "arm,psci-1.0"; method = "smc"; }; + smem { + compatible = "qcom,smem"; + memory-region = <&smem_mem>; + }; + soc: soc { #address-cells = <1>; #size-cells = <1>;
Signature · 1 line
2.17.1