Xilinx Zynq OCM support
v4 cover Xilinx Zynq OCM support
Hi,
this is the next attepmt to add support for On Chip Memory configuration via On Chip Memory Controller.
OCM can be divided into 4 independend blocks and placed to two locations which this driver detects.
For everybody on-chip SRAM driver "mmio-sram"
is missing parity IRQ handling not sure how to write
in generic way and also the memory layout
can be changed at run time (not currently supported by this driver)
smp-sram trampoline allocation can be used from mmio-sram and size allocated via DT but currently no reason for using it.
Creating mmio-sram node with setting at run time based on current setting is possible but it won't look good.
One way how to do it is here
"ARM: mvebu: Add quirk for i2c for the OpenBlocks AX3-4 board" (sha1: 85e618a1be2b2092318178d1d66bdad49cbbeeeb)
but creating nodes at run-time or changing compact strings will be just more hacky code.
Using device-tree overlays is another option but SMP trampoline code is placed there and it will be used by PM code that's why driver should be there before user-space.
Next option is to create driver which just create platform device at run-time. This is doable but I expect sram driver has to be updated.
Thanks,
Michal
Changes in v4:
- New patch in this series
- New patch in this series
- Move only slcr.h and smp.h and keep common.h in platform which is not needed by OCMC driver
Based on Arnd request: https://lkml.org/lkml/2014/10/20/268
Not all symbols from slcr.h/smp.h will be used by OCMC driver
- no problem to remove them if it is needed
- Add record to MAINTAINERS file
- slcr.h has moved to soc/include/ folder. Move definition there too.
- Use }; instead of } ; in doc
- Use memory-controller at ... instead of ocmc at ...
- Create Kconfig entry for OCMC driver - enable GENERIC_ALLOCATOR here
- Add entry to MAINTAINERS file
- Use memory-controller at ... instead of ocmc at ...
Changes in v3:
- Move OCM to drivers/soc
- Update year
- Extract DTS node to be able to apply it out of driver
- Remove generic allocator enabling
- Extract SLCR part
- Use const in of_device_id
- OCM->OCMC
- Use ocmc-1.0 compatible string
- Extract from OCM driver
Changes in v2:
- Update pm.c added in 3.17 too - Soren pointed on it
- Change compatibility string to be in xilinx format
- Fix kernel-doc format
Michal Simek (6):
ARM: zynq: Extract smp related functions out of common.h
ARM: zynq: Extract slcr related functions out of common.h
ARM: zynq: Move slcr.h and smp.h to generic location
ARM: zynq: Extend SLCR driver to read OCM configuration
ARM: zynq: Add OCM controller driver
ARM: zynq: DT: Add OCM controller node
.../bindings/arm/zynq/xlnx,zynq-ocmc.txt | 17 ++ MAINTAINERS | 2 + arch/arm/boot/dts/zynq-7000.dtsi | 7 + arch/arm/mach-zynq/common.c | 2 + arch/arm/mach-zynq/common.h | 19 -- arch/arm/mach-zynq/platsmp.c | 3 + arch/arm/mach-zynq/slcr.c | 17 ++ drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/zynq/Kconfig | 13 ++ drivers/soc/zynq/Makefile | 1 + drivers/soc/zynq/zynq_ocmc.c | 247 +++++++++++++++++++++ include/soc/zynq/slcr.h | 30 +++ include/soc/zynq/smp.h | 30 +++ 14 files changed, 371 insertions(+), 19 deletions(-) create mode 100644 Documentation/devicetree/bindings/arm/zynq/xlnx,zynq-ocmc.txt create mode 100644 drivers/soc/zynq/Kconfig create mode 100644 drivers/soc/zynq/Makefile create mode 100644 drivers/soc/zynq/zynq_ocmc.c create mode 100644 include/soc/zynq/slcr.h create mode 100644 include/soc/zynq/smp.h
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/8d52f967/attachment-0001.sig>
PATCH v4 1/6 ARM: zynq: Extract smp related functions out of common.h
Create topic headers not to share all functions.
---
Changes in v4:
- New patch in this series
Changes in v3: None
Changes in v2: None
arch/arm/mach-zynq/common.c | 1 + arch/arm/mach-zynq/common.h | 10 ---------- arch/arm/mach-zynq/platsmp.c | 1 + arch/arm/mach-zynq/smp.h | 30 ++++++++++++++++++++++++++++++ 4 files changed, 32 insertions(+), 10 deletions(-) create mode 100644 arch/arm/mach-zynq/smp.h
arch/arm/mach-zynq/common.c +1 -0
@@ -43,6 +43,7 @@#include <asm/hardware/cache-l2x0.h> #include "common.h" +#include "smp.h" #define ZYNQ_DEVCFG_MCTRL 0x80#define ZYNQ_DEVCFG_PS_VERSION_SHIFT 28
arch/arm/mach-zynq/common.h +0 -10
@@ -17,8 +17,6 @@#ifndef __MACH_ZYNQ_COMMON_H__#define __MACH_ZYNQ_COMMON_H__ -void zynq_secondary_startup (void ); -extern int zynq_slcr_init (void );extern int zynq_early_slcr_init (void );extern void zynq_slcr_system_reset (void );
@@ -28,14 +26,6 @@ extern bool zynq_slcr_cpu_state_read(int cpu);extern void zynq_slcr_cpu_state_write (int cpu,bool die);extern u32 zynq_slcr_get_device_id (void ); -#ifdef CONFIG_SMP -extern char zynq_secondary_trampoline; -extern char zynq_secondary_trampoline_jump; -extern char zynq_secondary_trampoline_end; -extern int zynq_cpun_start (u32 address,int cpu); -extern struct smp_operations zynq_smp_ops__initdata ; -#endif -extern void __iomem *zynq_scu_base;void zynq_pm_late_init (void );
arch/arm/mach-zynq/platsmp.c +1 -0
@@ -26,6 +26,7 @@#include <asm/smp_scu.h> #include <linux/irqchip/arm-gic.h> #include "common.h" +#include "smp.h" /* * Store number of cores in the system
arch/arm/mach-zynq/smp.h new file +30 -0
@@ -0,0 +1,30 @@ +/* +* This file contains common function prototypes to avoid externs +* in the c files. +* +* Copyright (C) 2014 Xilinx +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __MACH_ZYNQ_SMP_H__ +#define __MACH_ZYNQ_SMP_H__ + +void zynq_secondary_startup (void ); + +#ifdef CONFIG_SMP +extern char zynq_secondary_trampoline; +extern char zynq_secondary_trampoline_jump; +extern char zynq_secondary_trampoline_end; +extern int zynq_cpun_start (u32 address,int cpu); +extern struct smp_operations zynq_smp_ops__initdata ; +#endif + +#endif
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/2c743115/attachment-0001.sig>
PATCH v4 2/6 ARM: zynq: Extract slcr related functions out of common.h
In reply to Michal SimekCreate topic headers not to share all functions.
---
Changes in v4:
- New patch in this series
Changes in v3: None
Changes in v2: None
arch/arm/mach-zynq/common.c | 1 + arch/arm/mach-zynq/common.h | 9 --------- arch/arm/mach-zynq/platsmp.c | 1 + arch/arm/mach-zynq/slcr.c | 1 + arch/arm/mach-zynq/slcr.h | 29 +++++++++++++++++++++++++++++ 5 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 arch/arm/mach-zynq/slcr.h
arch/arm/mach-zynq/common.c +1 -0
@@ -43,6 +43,7 @@#include <asm/hardware/cache-l2x0.h> #include "common.h" +#include "slcr.h" #include "smp.h" #define ZYNQ_DEVCFG_MCTRL 0x80
arch/arm/mach-zynq/common.h +0 -9
@@ -17,15 +17,6 @@#ifndef __MACH_ZYNQ_COMMON_H__#define __MACH_ZYNQ_COMMON_H__ -extern int zynq_slcr_init (void ); -extern int zynq_early_slcr_init (void ); -extern void zynq_slcr_system_reset (void ); -extern void zynq_slcr_cpu_stop (int cpu); -extern void zynq_slcr_cpu_start (int cpu); -extern bool zynq_slcr_cpu_state_read (int cpu); -extern void zynq_slcr_cpu_state_write (int cpu,bool die); -extern u32 zynq_slcr_get_device_id (void ); -extern void __iomem *zynq_scu_base;void zynq_pm_late_init (void );
arch/arm/mach-zynq/platsmp.c +1 -0
@@ -26,6 +26,7 @@#include <asm/smp_scu.h> #include <linux/irqchip/arm-gic.h> #include "common.h" +#include "slcr.h" #include "smp.h" /*
arch/arm/mach-zynq/slcr.c +1 -0
@@ -20,6 +20,7 @@#include <linux/regmap.h> #include <linux/clk/zynq.h> #include "common.h" +#include "slcr.h" /* register offsets */ #define SLCR_UNLOCK_OFFSET 0x8/* SCLR unlock register */
arch/arm/mach-zynq/slcr.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* This file contains common function prototypes to avoid externs +* in the c files. +* +* Copyright (C) 2014 Xilinx +* +* This software is licensed under the terms of the GNU General Public +* License version 2, as published by the Free Software Foundation, and +* may be copied, distributed, and modified under those terms. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +*/ + +#ifndef __MACH_ZYNQ_SLCR_H__ +#define __MACH_ZYNQ_SLCR_H__ + +extern int zynq_slcr_init (void ); +extern int zynq_early_slcr_init (void ); +extern void zynq_slcr_system_reset (void ); +extern void zynq_slcr_cpu_stop (int cpu); +extern void zynq_slcr_cpu_start (int cpu); +extern bool zynq_slcr_cpu_state_read (int cpu); +extern void zynq_slcr_cpu_state_write (int cpu,bool die); +extern u32 zynq_slcr_get_device_id (void ); + +#endif
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/c3236f33/attachment.sig>
PATCH v4 3/6 ARM: zynq: Move slcr.h and smp.h to generic location
In reply to Michal Simekinclude/soc/zynq/ is the right location for this header to be able to share information from this header with other drivers which require it.
---
Changes in v4:
- Move only slcr.h and smp.h and keep common.h in platform which is not needed by OCMC driver
Based on Arnd request: https://lkml.org/lkml/2014/10/20/268
Not all symbols from slcr.h/smp.h will be used by OCMC driver
- no problem to remove them if it is needed
- Add record to MAINTAINERS file
Changes in v3: None
Changes in v2:
- Update pm.c added in 3.17 too - Soren pointed on it
MAINTAINERS | 1 +
arch/arm/mach-zynq/common.c | 4 ++--
arch/arm/mach-zynq/platsmp.c | 5 +++--
arch/arm/mach-zynq/slcr.c | 3 ++-
{arch/arm/mach-zynq => include/soc/zynq}/slcr.h | 0
{arch/arm/mach-zynq => include/soc/zynq}/smp.h | 0
6 files changed, 8 insertions(+), 5 deletions(-)
rename {arch/arm/mach-zynq => include/soc/zynq}/slcr.h (100%)
rename {arch/arm/mach-zynq => include/soc/zynq}/smp.h (100%)MAINTAINERS +1 -0
@@ -1551,6 +1551,7 @@ S: Supported F: arch/arm/mach-zynq/ F: drivers/cpuidle/cpuidle-zynq.c F: drivers/block/xsysace.c +F: include/soc/zynq/ N: zynq N: xilinx F: drivers/clocksource/cadence_ttc_timer.c
arch/arm/mach-zynq/common.c +2 -2
@@ -43,8 +43,8 @@#include <asm/hardware/cache-l2x0.h> #include "common.h" -#include "slcr.h" -#include "smp.h" +#include <soc/zynq/slcr.h> +#include <soc/zynq/smp.h> #define ZYNQ_DEVCFG_MCTRL 0x80#define ZYNQ_DEVCFG_PS_VERSION_SHIFT 28
arch/arm/mach-zynq/platsmp.c +3 -2
@@ -25,9 +25,10 @@#include <asm/cacheflush.h> #include <asm/smp_scu.h> #include <linux/irqchip/arm-gic.h> +#include "common.h" -#include "slcr.h" -#include "smp.h" +#include <soc/zynq/slcr.h> +#include <soc/zynq/smp.h> /* * Store number of cores in the system
arch/arm/mach-zynq/slcr.c +2 -1
@@ -20,7 +20,8 @@#include <linux/regmap.h> #include <linux/clk/zynq.h> #include "common.h" -#include "slcr.h" +#include <soc/zynq/slcr.h> +#include <soc/zynq/smp.h> /* register offsets */ #define SLCR_UNLOCK_OFFSET 0x8/* SCLR unlock register */
include/soc/zynq/slcr.h renamed from arch/arm/mach-zynq/slcr.h +0 -0
include/soc/zynq/smp.h renamed from arch/arm/mach-zynq/smp.h +0 -0
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/97a071e8/attachment.sig>
PATCH v4 4/6 ARM: zynq: Extend SLCR driver to read OCM configuration
In reply to Michal SimekGet OCM configuration from SLCR.
---
Changes in v4:
- slcr.h has moved to soc/include/ folder. Move definition there too.
Changes in v3: None
Changes in v2: None
arch/arm/mach-zynq/slcr.c | 15 +++++++++++++++ include/soc/zynq/slcr.h | 1 + 2 files changed, 16 insertions(+)
arch/arm/mach-zynq/slcr.c +15 -0
@@ -29,6 +29,7 @@#define SLCR_A9_CPU_RST_CTRL_OFFSET 0x244/* CPU Software Reset Control */ #define SLCR_REBOOT_STATUS_OFFSET 0x258/* PS Reboot Status */ #define SLCR_PSS_IDCODE 0x530/* PS IDCODE */ +#define SLCR_OCM_CFG_OFFSET 0x910/* OCM Address Mapping */ #define SLCR_UNLOCK_MAGIC 0xDF0D#define SLCR_A9_CPU_CLKSTOP 0x10
@@ -128,6 +129,20 @@ void zynq_slcr_system_reset(void) }/** +* zynq_slcr_get_ocm_config - Get SLCR OCM config +* +* Return: OCM config bits +*/ +u32 zynq_slcr_get_ocm_config (void ) +{ +u32 val; + +zynq_slcr_read (&val,SLCR_OCM_CFG_OFFSET ); + +return val; +} + +/** * zynq_slcr_cpu_start - Start cpu * @cpu: cpu number */
include/soc/zynq/slcr.h +1 -0
@@ -25,5 +25,6 @@ extern void zynq_slcr_cpu_start(int cpu);extern bool zynq_slcr_cpu_state_read (int cpu);extern void zynq_slcr_cpu_state_write (int cpu,bool die);extern u32 zynq_slcr_get_device_id (void ); +extern u32 zynq_slcr_get_ocm_config (void );#endif
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/93b85101/attachment.sig>
Re: [PATCH v4 4/6] ARM: zynq: Extend SLCR driver to read OCM configuration
Quoted 53 lines · Michal Simek
Get OCM configuration from SLCR.
Signed-off-by Michal Simek <[email protected]>---
Changes in v4:
-slcr.hhas moved to soc/include/ folder. Move definition there too.Changes in v3: None
Changes in v2: Nonearch/arm/mach-zynq/slcr.c | 15 +++++++++++++++ include/soc/zynq/slcr.h | 1 + 2 files changed, 16 insertions(+)arch/arm/mach-zynq/slcr.c +15
-0@@ -29,6 +29,7 @@#define SLCR_A9_CPU_RST_CTRL_OFFSET 0x244/* CPU Software Reset Control */ #define SLCR_REBOOT_STATUS_OFFSET 0x258/* PS Reboot Status */ #define SLCR_PSS_IDCODE 0x530/* PS IDCODE */ +#define SLCR_OCM_CFG_OFFSET 0x910/* OCM Address Mapping */ #define SLCR_UNLOCK_MAGIC 0xDF0D#define SLCR_A9_CPU_CLKSTOP 0x10@@ -128,6 +129,20 @@ void zynq_slcr_system_reset(void) }/** +* zynq_slcr_get_ocm_config - Get SLCR OCM config +* +* Return: OCM config bits +*/ +u32 zynq_slcr_get_ocm_config (void ) +{ +u32 val; + +zynq_slcr_read (&val,SLCR_OCM_CFG_OFFSET ); + +return val; +} + +/** * zynq_slcr_cpu_start - Start cpu * @cpu: cpu number */ include/soc/zynq/slcr.h +0
-0
include/soc/zynq/slcr.h extern void zynq_slcr_cpu_start(int cpu); · line 28
Quoted 4 lines
include/soc/zynq/slcr.h +1
-0@@ -25,5 +25,6 @@ extern void zynq_slcr_cpu_start(int cpu);extern bool zynq_slcr_cpu_state_read (int cpu);extern void zynq_slcr_cpu_state_write (int cpu,bool die);extern u32 zynq_slcr_get_device_id (void ); +extern u32 zynq_slcr_get_ocm_config (void );
I still believe we should consolidate this somehow instead of adding another function for each and every register that might have to be read by something else.
Usage of syscon/regmap might be an option. Or probably something like:
enum zynq_slcr_reg {
zynq_slcr_ocm_cfg,
zynq_slcr_device_id,
...
};
u32 zyn_slcr_read(enum zynq_slcr_reg id)
{
switch (id) {
case ...
}S?ren
PATCH v4 5/6 ARM: zynq: Add OCM controller driver
In reply to Michal SimekThe driver provide memory allocator which can be used by others drivers to allocate memory inside OCM. All location for 64kB blocks are supported
and driver is trying to allocate the largest continuous block of memory.
Checking mpcore addressing filterring is not done here but could be added in future.
---
Changes in v4:
- Use }; instead of } ; in doc
- Use memory-controller at ... instead of ocmc at ...
- Create Kconfig entry for OCMC driver - enable GENERIC_ALLOCATOR here
- Add entry to MAINTAINERS file
Changes in v3:
- Move OCM to drivers/soc
- Update year
- Extract DTS node to be able to apply it out of driver
- Remove generic allocator enabling
- Extract SLCR part
- Use const in of_device_id
- OCM->OCMC
- Use ocmc-1.0 compatible string
Changes in v2:
- Change compatibility string to be in xilinx format
- Fix kernel-doc format
.../bindings/arm/zynq/xlnx,zynq-ocmc.txt | 17 ++ MAINTAINERS | 1 + drivers/soc/Kconfig | 1 + drivers/soc/Makefile | 1 + drivers/soc/zynq/Kconfig | 13 ++ drivers/soc/zynq/Makefile | 1 + drivers/soc/zynq/zynq_ocmc.c | 247 +++++++++++++++++++++ 7 files changed, 281 insertions(+) create mode 100644 Documentation/devicetree/bindings/arm/zynq/xlnx,zynq-ocmc.txt create mode 100644 drivers/soc/zynq/Kconfig create mode 100644 drivers/soc/zynq/Makefile create mode 100644 drivers/soc/zynq/zynq_ocmc.c
Documentation/devicetree/bindings/arm/zynq/xlnx,zynq-ocmc.txt new file +17 -0
@@ -0,0 +1,17 @@ +Device tree bindings for Zynq's OCM controller + +The OCM is divided to 4 64kB segments which can be separately configured +to low or high location. Location is controlled via SLCR. + +Required properties: + compatible: Compatibility string. Must be "xlnx,zynq-ocmc-1.0". + reg: Specify the base and size of the OCMC registers in the memory map. + E.g.: reg = <0xf800c000 0x1000>; + +Example: +ocmc: memory-controller at f800c000 { + compatible = "xlnx,zynq-ocmc-1.0"; + interrupt-parent = <&intc>; + interrupts = <0 3 4>; + reg = <0xf800c000 0x1000>; +};
MAINTAINERS +1 -0
@@ -1551,6 +1551,7 @@ S: Supported F: arch/arm/mach-zynq/ F: drivers/cpuidle/cpuidle-zynq.c F: drivers/block/xsysace.c +F: drivers/soc/zynq/ F: include/soc/zynq/ N: zynq N: xilinx
drivers/soc/Kconfig +1 -0
@@ -3,5 +3,6 @@ menu "SOC (System On Chip) specific Drivers" source "drivers/soc/qcom/Kconfig" source "drivers/soc/ti/Kconfig" source "drivers/soc/versatile/Kconfig" +source "drivers/soc/zynq/Kconfig" endmenu
drivers/soc/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_ARCH_QCOM) += qcom/ obj-$(CONFIG_ARCH_TEGRA) += tegra/ obj-$(CONFIG_SOC_TI) += ti/ obj-$(CONFIG_PLAT_VERSATILE) += versatile/ +obj-$(CONFIG_ARCH_ZYNQ) += zynq/
drivers/soc/zynq/Kconfig new file +13 -0
@@ -0,0 +1,13 @@ +# +# Xilnx Zynq SoC drivers +# + +if ARCH_ZYNQ + +config ZYNQ_OCMC + def_bool y + select GENERIC_ALLOCATOR + help + Xilinx Zynq On Chip Memory Controller driver + +endif
drivers/soc/zynq/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-$(CONFIG_ZYNQ_OCMC) += zynq_ocmc.o
drivers/soc/zynq/zynq_ocmc.c new file +247 -0
247 lines not on this page · raw message
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/a5ed7a1d/attachment-0001.sig>
Re: [PATCH v4 5/6] ARM: zynq: Add OCM controller driver
Quoted 3 lines · Michal Simek
The driver provide memory allocator which can be used by others drivers to allocate memory inside OCM. All location for 64kB blocks are supported
Allocation?
Quoted 2 lines
and driver is trying to allocate the largest continuous block of memory.
Isn't all genalloc allocations continuous?
(...)
drivers/soc/zynq/zynq_ocmc.c line 100
Quoted 3 lines
drivers/soc/zynq/zynq_ocmc.c new file +3
-0+ zynq_ocmc->pool =devm_gen_pool_create (&pdev->dev, +ilog2 (ZYNQ_OCMC_GRANULARITY ), +-1 );
Do this:
#include <linux/sizes.h>
zynq_ocmc->pool = devm_gen_pool_create(&pdev->dev,
ilog2(SZ_64K),
-1);And get rid of the #define for ZYNQ_OCMC_GRANULARITY
Yours,
Linus Walleij
Re: [PATCH v4 5/6] ARM: zynq: Add OCM controller driver
Quoted 6 lines · Linus Walleij
Quoted 3 lines · Michal Simek
The driver provide memory allocator which can be used by others drivers to allocate memory inside OCM. All location for 64kB blocks are supported
Quoted 6 lines
Allocation?
Quoted 2 lines
and driver is trying to allocate the largest continuous block of memory.
Isn't all genalloc allocations continuous?
I hope it is but blocks can be at different locations.
Two locations 0 or 0xfffc0000.
it means for every 64k block can be at low or high address location first block 0x0 or 0xfffc0000
second block 0x10000 or 0xfffd0000
third block 0x20000 or 0xfffe0000
four block 0x30000 or 0xffff0000
it is worth to allocate to biggest continuous memory. For example 2 blocks low and then 2 blocks high.
2 blocks with 128kB is better then 4 blocks with 64kB
Quoted 8 lines
(...)
drivers/soc/zynq/zynq_ocmc.c line 100
Quoted 3 lines
drivers/soc/zynq/zynq_ocmc.c new file +3
-0+ zynq_ocmc->pool =devm_gen_pool_create (&pdev->dev, +ilog2 (ZYNQ_OCMC_GRANULARITY ), +-1 );Do this:
Quoted 7 lines
#include <
linux/sizes.h>
zynq_ocmc->pool= devm_gen_pool_create(&pdev->dev,ilog2(SZ_64K), -1);And get rid of the #define for
ZYNQ_OCMC_GRANULARITY
ilog2 from 32 is different to ilog2 from ilog2 from 0x10000. But I will look at gen pool internals.
Do you have any opinion regarding calling zynq_slcr_get_ocm_config()?
Is it better to expose slcr this interface to drivers? Or use regmap and read this value directly?
Also I do read for CONFIG_SMP case jump trampoline size - maybe you can have better idea how this can be done.
Thanks for your input,
Michal
Re: [PATCH v4 5/6] ARM: zynq: Add OCM controller driver
Quoted 12 lines · Michal Simek
Quoted 11 lines · Linus Walleij
On Fri, Nov 14, 2014 at 11:52 AM, Michal Simek <[email protected]> wrote:
(...)
drivers/soc/zynq/zynq_ocmc.c line 100
Quoted 3 lines
drivers/soc/zynq/zynq_ocmc.c new file +3
-0+ zynq_ocmc->pool =devm_gen_pool_create (&pdev->dev, +ilog2 (ZYNQ_OCMC_GRANULARITY ), +-1 );Do this:
#include <
linux/sizes.h>
Quoted 7 lines
Quoted 5 lines
zynq_ocmc->pool= devm_gen_pool_create(&pdev->dev,ilog2(SZ_64K), -1);And get rid of the #define for
ZYNQ_OCMC_GRANULARITYilog2 from 32 is different to ilog2 from ilog2 from
0x10000.
Bah I misread the code, forget this comment.
Maybe it's more like I wanted
+#define ZYNQ_OCMC_BLOCK_SIZE 0x10000
To be replaced with SZ_64K
But it's a petty detail anyway.
Quoted 4 lines
Do you have any opinion regarding calling
zynq_slcr_get_ocm_config()?Is it better to expose slcr this interface to drivers? Or use regmap and read this value directly?
Depends on what provides that call. The pattern I usually follow is to expose the mixed-registers range as a syscon device using drivers/mfd/syscon.c and then use one of the methods from <linux/mfd/syscon.h> to look up a reference to the regmap and use it to access misc registers.
Quoted 2 lines
Also I do read for
CONFIG_SMPcase jump trampoline size - maybe you can have better idea how this can be done.
No I have no clue about that... :(
Yours,
Linus Walleij
Re: [PATCH v4 5/6] ARM: zynq: Add OCM controller driver
Quoted 23 lines · Linus Walleij
Quoted 12 lines · Michal Simek
Quoted 11 lines · Linus Walleij
On Fri, Nov 14, 2014 at 11:52 AM, Michal Simek <[email protected]> wrote:
(...)
drivers/soc/zynq/zynq_ocmc.c line 100
Quoted 3 lines
drivers/soc/zynq/zynq_ocmc.c new file +3
-0+ zynq_ocmc->pool =devm_gen_pool_create (&pdev->dev, +ilog2 (ZYNQ_OCMC_GRANULARITY ), +-1 );Do this:
#include <
linux/sizes.h>Quoted 7 lines
Quoted 5 lines
zynq_ocmc->pool= devm_gen_pool_create(&pdev->dev,ilog2(SZ_64K), -1);And get rid of the #define for
ZYNQ_OCMC_GRANULARITYilog2 from 32 is different to ilog2 from ilog2 from
0x10000.Bah I misread the code, forget this comment.
Quoted 7 lines
Maybe it's more like I wanted
+#define
ZYNQ_OCMC_BLOCK_SIZE0x10000To be replaced with
SZ_64KBut it's a petty detail anyway.
I have fixed it.
Quoted 10 lines
Quoted 4 lines
Do you have any opinion regarding calling
zynq_slcr_get_ocm_config()?Is it better to expose slcr this interface to drivers? Or use regmap and read this value directly?
Depends on what provides that call. The pattern I usually follow is to expose the mixed-registers range as a syscon device using
drivers/mfd/syscon.cand then use one of the methods from <linux/mfd/syscon.h> to look up a reference to the regmap and use it to access misc registers.
I have tried it and I can just use it without any problem. I have sent v5 with origin version but in cover letter there is a code for that.
Quoted 4 lines
Quoted 2 lines
Also I do read for
CONFIG_SMPcase jump trampoline size - maybe you can have better idea how this can be done.No I have no clue about that... :(
ok - fair enough. One option is to keep it as is. The second option is to allocate any hardcoded size or size passed via DT. But run-time detection is the best IMHO.
Thanks,
Michal
Signature · 14 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Microblaze cpu - http://www.monstr.eu/fdt/ Maintainer of Linux kernel - Xilinx Zynq ARM architecture Microblaze U-BOOT custodian and responsible for u-boot arm zynq platform -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 198 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141201/b338bd77/attachment.sig>
PATCH v4 6/6 ARM: zynq: DT: Add OCM controller node
In reply to Michal SimekAdd the on-chip-memory controller node to the Zynq devicetree.
---
Changes in v4:
- Use memory-controller at ... instead of ocmc at ...
Changes in v3:
- Extract from OCM driver
Changes in v2: None
arch/arm/boot/dts/zynq-7000.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/zynq-7000.dtsi +7 -0
@@ -150,6 +150,13 @@ reg = <0xf8006000 0x1000>; }; + ocmc: memory-controller at f800c000 { + compatible = "xlnx,zynq-ocmc-1.0"; + interrupt-parent = <&intc>; + interrupts = <0 3 4>; + reg = <0xf800c000 0x1000>; + }; + uart0: serial at e0000000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled";
--
1.8.2.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141114/85f332b2/attachment.sig>
Re: [PATCH v4 6/6] ARM: zynq: DT: Add OCM controller node
Hi Michal,
Am 14.11.2014 um 11:52 schrieb Michal Simek:
Quoted 8 lines
arch/arm/boot/dts/zynq-7000.dtsi +0
-0@@ -150,6 +150,13 @@ reg = <0xf8006000 0x1000>; };
arch/arm/boot/dts/zynq-7000.dtsi line 162
Quoted 10 lines
arch/arm/boot/dts/zynq-7000.dtsi +7
-0+ ocmc: memory-controller at f800c000 { + compatible = "xlnx,zynq-ocmc-1.0"; + interrupt-parent = <&intc>; + interrupts = <0 3 4>; + reg = <0xf800c000 0x1000>; + }; + uart0: serial at e0000000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled";
Not directly related to this patch: As one can see here, the node order is quite a mess... According to Olof, nodes should be ordered by unit address, whereas here some but not all seem ordered by node name. Would you welcome a cleanup patch, or can you fix that yourself?
Regards,
Andreas
Signature · 10 lines
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 N?rnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend?rffer; HRB 21284 AG N?rnberg -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: OpenPGP digital signature URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20141116/ca28033d/attachment.sig>
Re: [PATCH v4 6/6] ARM: zynq: DT: Add OCM controller node
Quoted 11 lines · Andreas F?rber
Hi Michal,
Am 14.11.2014 um 11:52 schrieb Michal Simek:
Quoted 8 lines
arch/arm/boot/dts/zynq-7000.dtsi +0
-0@@ -150,6 +150,13 @@ reg = <0xf8006000 0x1000>; };
Quoted 15 lines
arch/arm/boot/dts/zynq-7000.dtsi line 162
Quoted 10 lines
arch/arm/boot/dts/zynq-7000.dtsi +7
-0+ ocmc: memory-controller at f800c000 { + compatible = "xlnx,zynq-ocmc-1.0"; + interrupt-parent = <&intc>; + interrupts = <0 3 4>; + reg = <0xf800c000 0x1000>; + }; + uart0: serial at e0000000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled";Not directly related to this patch: As one can see here, the node order is quite a mess... According to Olof, nodes should be ordered by unit address, whereas here some but not all seem ordered by node name. Would you welcome a cleanup patch, or can you fix that yourself?
I wouldn't say it's a mess, just a different property to sort the nodes by. For humans reading the DT, searching for nodes, alphabetical order helps finding the right node, IMHO. What advantage would sorting by address have?
Thanks,
S?ren
Re: [PATCH v4 6/6] ARM: zynq: DT: Add OCM controller node
Quoted 28 lines · S?ren Brinkmann
Quoted 11 lines · Andreas F?rber
Hi Michal,
Am 14.11.2014 um 11:52 schrieb Michal Simek:
Quoted 8 lines
arch/arm/boot/dts/zynq-7000.dtsi +0
-0@@ -150,6 +150,13 @@ reg = <0xf8006000 0x1000>; };Quoted 15 lines
arch/arm/boot/dts/zynq-7000.dtsi line 162
Quoted 10 lines
arch/arm/boot/dts/zynq-7000.dtsi +7
-0+ ocmc: memory-controller at f800c000 { + compatible = "xlnx,zynq-ocmc-1.0"; + interrupt-parent = <&intc>; + interrupts = <0 3 4>; + reg = <0xf800c000 0x1000>; + }; + uart0: serial at e0000000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled";Not directly related to this patch: As one can see here, the node order is quite a mess... According to Olof, nodes should be ordered by unit address, whereas here some but not all seem ordered by node name. Would you welcome a cleanup patch, or can you fix that yourself?
Quoted 3 lines
I wouldn't say it's a mess, just a different property to sort the nodes by. For humans reading the DT, searching for nodes, alphabetical order helps finding the right node, IMHO.
I do generally find myself asking "whats that thing at that address" more than I find myself asking the "wheres that piece of hardware" so Andreas' sorting scheme makes more sense to me. Vertically scanning a DT to give yourself an overview of the system level address map is good too. Wheras alphabetic sorting doesn't mean to much.
Regards,
Peter
What advantage would sorting by
Quoted 9 lines
address have?
Thanks,
S?ren
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v4 6/6] ARM: zynq: DT: Add OCM controller node
Quoted 34 lines · Peter Crosthwaite
Quoted 28 lines · S?ren Brinkmann
Quoted 11 lines · Andreas F?rber
Hi Michal,
Am 14.11.2014 um 11:52 schrieb Michal Simek:
Quoted 8 lines
arch/arm/boot/dts/zynq-7000.dtsi +0
-0@@ -150,6 +150,13 @@ reg = <0xf8006000 0x1000>; };Quoted 15 lines
arch/arm/boot/dts/zynq-7000.dtsi line 162
Quoted 10 lines
arch/arm/boot/dts/zynq-7000.dtsi +7
-0+ ocmc: memory-controller at f800c000 { + compatible = "xlnx,zynq-ocmc-1.0"; + interrupt-parent = <&intc>; + interrupts = <0 3 4>; + reg = <0xf800c000 0x1000>; + }; + uart0: serial at e0000000 { compatible = "xlnx,xuartps", "cdns,uart-r1p8"; status = "disabled";Not directly related to this patch: As one can see here, the node order is quite a mess... According to Olof, nodes should be ordered by unit address, whereas here some but not all seem ordered by node name. Would you welcome a cleanup patch, or can you fix that yourself?
Quoted 3 lines
I wouldn't say it's a mess, just a different property to sort the nodes by. For humans reading the DT, searching for nodes, alphabetical order helps finding the right node, IMHO.
Quoted 5 lines
I do generally find myself asking "whats that thing at that address" more than I find myself asking the "wheres that piece of hardware" so Andreas' sorting scheme makes more sense to me. Vertically scanning a DT to give yourself an overview of the system level address map is good too. Wheras alphabetic sorting doesn't mean to much.
IMHO the reason why we have names in DT is that it is easily to read/understand them that's why name sorting seems to me more reasonable.
Something like machine code and assembler - asm is also sorted by names not by opcode.
Is this strict rule?
Thanks,
Michal