All of lore.kernel.org
 help / color / mirror / Atom feed
* [meta-processor-sdk] [PATCH] linux: cmem: add support for am574x
@ 2017-11-28 21:11 Hongmei Gou
  2017-11-28 21:14 ` Denys Dmytriyenko
  0 siblings, 1 reply; 3+ messages in thread
From: Hongmei Gou @ 2017-11-28 21:11 UTC (permalink / raw)
  To: meta-arago; +Cc: Hongmei Gou

Signed-off-by: Hongmei Gou <a0271529@ti.com>
---
 recipes-kernel/linux/cmem.inc | 83 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 83 insertions(+)
 create mode 100644 recipes-kernel/linux/cmem.inc

diff --git a/recipes-kernel/linux/cmem.inc b/recipes-kernel/linux/cmem.inc
new file mode 100644
index 0000000..64d3264
--- /dev/null
+++ b/recipes-kernel/linux/cmem.inc
@@ -0,0 +1,83 @@
+# Add concept of machine variants to split DTBs into subsets
+#
+# Use these for temporary overrides
+CMEM_MACHINE = "${MACHINE}"
+CMEM_MACHINE_am57xx-evm = "am571x am572x am574x"
+CMEM_MACHINE_am57xx-hs-evm = "am571x am572x"
+CMEM_MACHINE_dra7xx-evm = "dra71x dra72x dra74x"
+CMEM_MACHINE_dra7xx-hs-evm = "dra71x dra72x dra74x"
+
+# Set cmem.dtsi per machine or machine variant
+CMEM_DTSI = "cmem.dtsi"
+CMEM_DTSI_am571x = "cmem-am571x.dtsi"
+CMEM_DTSI_dra71x = "cmem-dra71x.dtsi"
+CMEM_DTSI_dra72x = "cmem-dra72x.dtsi"
+
+# Split device trees between variants
+CMEM_DEVICETREE = "${KERNEL_DEVICETREE}"
+CMEM_DEVICETREE_am571x = "am571x-idk.dtb am571x-idk-lcd-osd101t2045.dtb am571x-idk-lcd-osd101t2587.dtb"
+CMEM_DEVICETREE_am572x = "am57xx-beagle-x15.dtb am57xx-beagle-x15-revb1.dtb \
+                          am57xx-evm.dtb am57xx-evm-cam-mt9t111.dtb am57xx-evm-cam-ov10635.dtb \
+                          am57xx-evm-reva3.dtb am57xx-evm-reva3-cam-mt9t111.dtb am57xx-evm-reva3-cam-ov10635.dtb \
+                          am572x-idk.dtb am572x-idk-lcd-osd101t2045.dtb am572x-idk-lcd-osd101t2587.dtb"
+CMEM_DEVICETREE_am574x = "am574x-idk.dtb am574x-idk-lcd-osd101t2587.dtb"
+CMEM_DEVICETREE_dra71x = "dra71-evm.dtb dra71-evm-lcd-auo-g101evn01.0.dtb"
+CMEM_DEVICETREE_dra72x = "dra72-evm.dtb dra72-evm-lcd-lg.dtb dra72-evm-lcd-osd101t2045.dtb dra72-evm-lcd-osd101t2587.dtb \
+                          dra72-evm-revc.dtb dra72-evm-revc-lcd-osd101t2045.dtb dra72-evm-revc-lcd-osd101t2587.dtb"
+CMEM_DEVICETREE_dra74x = "dra7-evm.dtb dra7-evm-lcd-lg.dtb dra7-evm-lcd-osd101t2045.dtb dra7-evm-lcd-osd101t2587.dtb"
+
+# Flag to enable CMEM injection
+RESERVE_CMEM ?= "0"
+
+# Add correct cmem.dtsi to SRC_URI for each variant for a given machine
+python do_unpack() {
+    old_overrides = d.getVar('OVERRIDES', False)
+
+    # Initialize with empty string to simplify logic to append to SRC_URI
+    cmem_dtsi = set([''])
+
+    for cmem_machine in (d.getVar('CMEM_MACHINE', True) or '').split():
+        # Create copy of data for additional override
+        localdata = bb.data.createCopy(d)
+        localdata.setVar('OVERRIDES', '%s:%s' % (cmem_machine, old_overrides))
+        bb.data.update_data(localdata)
+
+        cmem_dtsi.add(localdata.getVar('CMEM_DTSI', True))
+
+    d.appendVar('SRC_URI', ' file://'.join(cmem_dtsi))
+    bb.build.exec_func('base_do_unpack', d)
+}
+
+python do_setup_cmem() {
+    import shutil
+
+    old_overrides = d.getVar('OVERRIDES', False)
+
+    if d.getVar('RESERVE_CMEM', True) is '1':
+        for cmem_machine in (d.getVar('CMEM_MACHINE', True) or '').split():
+            # Create copy of data for additional override
+            localdata = bb.data.createCopy(d)
+            localdata.setVar('OVERRIDES', '%s:%s' % (cmem_machine, old_overrides))
+            bb.data.update_data(localdata)
+
+            # Get source directory and dtsi filename
+            src_dir  = localdata.getVar('WORKDIR', True)
+            src_dtsi = localdata.getVar('CMEM_DTSI', True)
+
+            # Get destination directory and destination dtsi filename which adds
+            #   the MACHINE prefix.
+            dst_dir  = os.path.join(localdata.getVar('S', True), 'arch/arm/boot/dts')
+            dst_dtsi = localdata.expand('${MACHINE}-${CMEM_DTSI}')
+
+            # Copy cmem.dtsi into source tree
+            shutil.copy(os.path.join(src_dir,src_dtsi), os.path.join(dst_dir,dst_dtsi))
+
+            # Inject dtsi into each dts in list
+            for dtb in (localdata.getVar('CMEM_DEVICETREE', True) or '').split():
+                dts = dtb[:-4] + '.dts'
+
+                with open(os.path.join(dst_dir,dts), 'a') as dts_file:
+                    dts_file.write('\n#include "%s"\n' % dst_dtsi)
+}
+
+do_patch[postfuncs] += "do_setup_cmem"
-- 
1.9.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [meta-processor-sdk] [PATCH] linux: cmem: add support for am574x
  2017-11-28 21:11 [meta-processor-sdk] [PATCH] linux: cmem: add support for am574x Hongmei Gou
@ 2017-11-28 21:14 ` Denys Dmytriyenko
  2017-11-28 21:19   ` Gou, Hongmei
  0 siblings, 1 reply; 3+ messages in thread
From: Denys Dmytriyenko @ 2017-11-28 21:14 UTC (permalink / raw)
  To: Hongmei Gou; +Cc: meta-arago

Would it be easier/cleaner to just add necessary few variables to kernel 
bbappend instead of copying entire .inc file?


On Tue, Nov 28, 2017 at 04:11:52PM -0500, Hongmei Gou wrote:
> Signed-off-by: Hongmei Gou <a0271529@ti.com>
> ---
>  recipes-kernel/linux/cmem.inc | 83 +++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 83 insertions(+)
>  create mode 100644 recipes-kernel/linux/cmem.inc
> 
> diff --git a/recipes-kernel/linux/cmem.inc b/recipes-kernel/linux/cmem.inc
> new file mode 100644
> index 0000000..64d3264
> --- /dev/null
> +++ b/recipes-kernel/linux/cmem.inc
> @@ -0,0 +1,83 @@
> +# Add concept of machine variants to split DTBs into subsets
> +#
> +# Use these for temporary overrides
> +CMEM_MACHINE = "${MACHINE}"
> +CMEM_MACHINE_am57xx-evm = "am571x am572x am574x"
> +CMEM_MACHINE_am57xx-hs-evm = "am571x am572x"
> +CMEM_MACHINE_dra7xx-evm = "dra71x dra72x dra74x"
> +CMEM_MACHINE_dra7xx-hs-evm = "dra71x dra72x dra74x"
> +
> +# Set cmem.dtsi per machine or machine variant
> +CMEM_DTSI = "cmem.dtsi"
> +CMEM_DTSI_am571x = "cmem-am571x.dtsi"
> +CMEM_DTSI_dra71x = "cmem-dra71x.dtsi"
> +CMEM_DTSI_dra72x = "cmem-dra72x.dtsi"
> +
> +# Split device trees between variants
> +CMEM_DEVICETREE = "${KERNEL_DEVICETREE}"
> +CMEM_DEVICETREE_am571x = "am571x-idk.dtb am571x-idk-lcd-osd101t2045.dtb am571x-idk-lcd-osd101t2587.dtb"
> +CMEM_DEVICETREE_am572x = "am57xx-beagle-x15.dtb am57xx-beagle-x15-revb1.dtb \
> +                          am57xx-evm.dtb am57xx-evm-cam-mt9t111.dtb am57xx-evm-cam-ov10635.dtb \
> +                          am57xx-evm-reva3.dtb am57xx-evm-reva3-cam-mt9t111.dtb am57xx-evm-reva3-cam-ov10635.dtb \
> +                          am572x-idk.dtb am572x-idk-lcd-osd101t2045.dtb am572x-idk-lcd-osd101t2587.dtb"
> +CMEM_DEVICETREE_am574x = "am574x-idk.dtb am574x-idk-lcd-osd101t2587.dtb"
> +CMEM_DEVICETREE_dra71x = "dra71-evm.dtb dra71-evm-lcd-auo-g101evn01.0.dtb"
> +CMEM_DEVICETREE_dra72x = "dra72-evm.dtb dra72-evm-lcd-lg.dtb dra72-evm-lcd-osd101t2045.dtb dra72-evm-lcd-osd101t2587.dtb \
> +                          dra72-evm-revc.dtb dra72-evm-revc-lcd-osd101t2045.dtb dra72-evm-revc-lcd-osd101t2587.dtb"
> +CMEM_DEVICETREE_dra74x = "dra7-evm.dtb dra7-evm-lcd-lg.dtb dra7-evm-lcd-osd101t2045.dtb dra7-evm-lcd-osd101t2587.dtb"
> +
> +# Flag to enable CMEM injection
> +RESERVE_CMEM ?= "0"
> +
> +# Add correct cmem.dtsi to SRC_URI for each variant for a given machine
> +python do_unpack() {
> +    old_overrides = d.getVar('OVERRIDES', False)
> +
> +    # Initialize with empty string to simplify logic to append to SRC_URI
> +    cmem_dtsi = set([''])
> +
> +    for cmem_machine in (d.getVar('CMEM_MACHINE', True) or '').split():
> +        # Create copy of data for additional override
> +        localdata = bb.data.createCopy(d)
> +        localdata.setVar('OVERRIDES', '%s:%s' % (cmem_machine, old_overrides))
> +        bb.data.update_data(localdata)
> +
> +        cmem_dtsi.add(localdata.getVar('CMEM_DTSI', True))
> +
> +    d.appendVar('SRC_URI', ' file://'.join(cmem_dtsi))
> +    bb.build.exec_func('base_do_unpack', d)
> +}
> +
> +python do_setup_cmem() {
> +    import shutil
> +
> +    old_overrides = d.getVar('OVERRIDES', False)
> +
> +    if d.getVar('RESERVE_CMEM', True) is '1':
> +        for cmem_machine in (d.getVar('CMEM_MACHINE', True) or '').split():
> +            # Create copy of data for additional override
> +            localdata = bb.data.createCopy(d)
> +            localdata.setVar('OVERRIDES', '%s:%s' % (cmem_machine, old_overrides))
> +            bb.data.update_data(localdata)
> +
> +            # Get source directory and dtsi filename
> +            src_dir  = localdata.getVar('WORKDIR', True)
> +            src_dtsi = localdata.getVar('CMEM_DTSI', True)
> +
> +            # Get destination directory and destination dtsi filename which adds
> +            #   the MACHINE prefix.
> +            dst_dir  = os.path.join(localdata.getVar('S', True), 'arch/arm/boot/dts')
> +            dst_dtsi = localdata.expand('${MACHINE}-${CMEM_DTSI}')
> +
> +            # Copy cmem.dtsi into source tree
> +            shutil.copy(os.path.join(src_dir,src_dtsi), os.path.join(dst_dir,dst_dtsi))
> +
> +            # Inject dtsi into each dts in list
> +            for dtb in (localdata.getVar('CMEM_DEVICETREE', True) or '').split():
> +                dts = dtb[:-4] + '.dts'
> +
> +                with open(os.path.join(dst_dir,dts), 'a') as dts_file:
> +                    dts_file.write('\n#include "%s"\n' % dst_dtsi)
> +}
> +
> +do_patch[postfuncs] += "do_setup_cmem"
> -- 
> 1.9.1
> 
> _______________________________________________
> meta-arago mailing list
> meta-arago@arago-project.org
> http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [meta-processor-sdk] [PATCH] linux: cmem: add support for am574x
  2017-11-28 21:14 ` Denys Dmytriyenko
@ 2017-11-28 21:19   ` Gou, Hongmei
  0 siblings, 0 replies; 3+ messages in thread
From: Gou, Hongmei @ 2017-11-28 21:19 UTC (permalink / raw)
  To: Dmytriyenko, Denys; +Cc: meta-arago@arago-project.org

Thanks Denys for the suggestion. Will submit v2 patch to add the variables to kernel bbappend.

> -----Original Message-----
> From: Dmytriyenko, Denys
> Sent: Tuesday, November 28, 2017 4:14 PM
> To: Gou, Hongmei
> Cc: meta-arago@arago-project.org
> Subject: Re: [meta-arago] [meta-processor-sdk] [PATCH] linux: cmem: add
> support for am574x
> 
> Would it be easier/cleaner to just add necessary few variables to kernel
> bbappend instead of copying entire .inc file?
> 
> 
> On Tue, Nov 28, 2017 at 04:11:52PM -0500, Hongmei Gou wrote:
> > Signed-off-by: Hongmei Gou <a0271529@ti.com>
> > ---
> >  recipes-kernel/linux/cmem.inc | 83
> +++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 83 insertions(+)
> >  create mode 100644 recipes-kernel/linux/cmem.inc
> >
> > diff --git a/recipes-kernel/linux/cmem.inc b/recipes-kernel/linux/cmem.inc
> > new file mode 100644
> > index 0000000..64d3264
> > --- /dev/null
> > +++ b/recipes-kernel/linux/cmem.inc
> > @@ -0,0 +1,83 @@
> > +# Add concept of machine variants to split DTBs into subsets
> > +#
> > +# Use these for temporary overrides
> > +CMEM_MACHINE = "${MACHINE}"
> > +CMEM_MACHINE_am57xx-evm = "am571x am572x am574x"
> > +CMEM_MACHINE_am57xx-hs-evm = "am571x am572x"
> > +CMEM_MACHINE_dra7xx-evm = "dra71x dra72x dra74x"
> > +CMEM_MACHINE_dra7xx-hs-evm = "dra71x dra72x dra74x"
> > +
> > +# Set cmem.dtsi per machine or machine variant
> > +CMEM_DTSI = "cmem.dtsi"
> > +CMEM_DTSI_am571x = "cmem-am571x.dtsi"
> > +CMEM_DTSI_dra71x = "cmem-dra71x.dtsi"
> > +CMEM_DTSI_dra72x = "cmem-dra72x.dtsi"
> > +
> > +# Split device trees between variants
> > +CMEM_DEVICETREE = "${KERNEL_DEVICETREE}"
> > +CMEM_DEVICETREE_am571x = "am571x-idk.dtb am571x-idk-lcd-
> osd101t2045.dtb am571x-idk-lcd-osd101t2587.dtb"
> > +CMEM_DEVICETREE_am572x = "am57xx-beagle-x15.dtb am57xx-beagle-
> x15-revb1.dtb \
> > +                          am57xx-evm.dtb am57xx-evm-cam-mt9t111.dtb am57xx-
> evm-cam-ov10635.dtb \
> > +                          am57xx-evm-reva3.dtb am57xx-evm-reva3-cam-
> mt9t111.dtb am57xx-evm-reva3-cam-ov10635.dtb \
> > +                          am572x-idk.dtb am572x-idk-lcd-osd101t2045.dtb am572x-
> idk-lcd-osd101t2587.dtb"
> > +CMEM_DEVICETREE_am574x = "am574x-idk.dtb am574x-idk-lcd-
> osd101t2587.dtb"
> > +CMEM_DEVICETREE_dra71x = "dra71-evm.dtb dra71-evm-lcd-auo-
> g101evn01.0.dtb"
> > +CMEM_DEVICETREE_dra72x = "dra72-evm.dtb dra72-evm-lcd-lg.dtb
> dra72-evm-lcd-osd101t2045.dtb dra72-evm-lcd-osd101t2587.dtb \
> > +                          dra72-evm-revc.dtb dra72-evm-revc-lcd-osd101t2045.dtb
> dra72-evm-revc-lcd-osd101t2587.dtb"
> > +CMEM_DEVICETREE_dra74x = "dra7-evm.dtb dra7-evm-lcd-lg.dtb dra7-
> evm-lcd-osd101t2045.dtb dra7-evm-lcd-osd101t2587.dtb"
> > +
> > +# Flag to enable CMEM injection
> > +RESERVE_CMEM ?= "0"
> > +
> > +# Add correct cmem.dtsi to SRC_URI for each variant for a given machine
> > +python do_unpack() {
> > +    old_overrides = d.getVar('OVERRIDES', False)
> > +
> > +    # Initialize with empty string to simplify logic to append to SRC_URI
> > +    cmem_dtsi = set([''])
> > +
> > +    for cmem_machine in (d.getVar('CMEM_MACHINE', True) or '').split():
> > +        # Create copy of data for additional override
> > +        localdata = bb.data.createCopy(d)
> > +        localdata.setVar('OVERRIDES', '%s:%s' % (cmem_machine,
> old_overrides))
> > +        bb.data.update_data(localdata)
> > +
> > +        cmem_dtsi.add(localdata.getVar('CMEM_DTSI', True))
> > +
> > +    d.appendVar('SRC_URI', ' file://'.join(cmem_dtsi))
> > +    bb.build.exec_func('base_do_unpack', d)
> > +}
> > +
> > +python do_setup_cmem() {
> > +    import shutil
> > +
> > +    old_overrides = d.getVar('OVERRIDES', False)
> > +
> > +    if d.getVar('RESERVE_CMEM', True) is '1':
> > +        for cmem_machine in (d.getVar('CMEM_MACHINE', True) or '').split():
> > +            # Create copy of data for additional override
> > +            localdata = bb.data.createCopy(d)
> > +            localdata.setVar('OVERRIDES', '%s:%s' % (cmem_machine,
> old_overrides))
> > +            bb.data.update_data(localdata)
> > +
> > +            # Get source directory and dtsi filename
> > +            src_dir  = localdata.getVar('WORKDIR', True)
> > +            src_dtsi = localdata.getVar('CMEM_DTSI', True)
> > +
> > +            # Get destination directory and destination dtsi filename which adds
> > +            #   the MACHINE prefix.
> > +            dst_dir  = os.path.join(localdata.getVar('S', True),
> 'arch/arm/boot/dts')
> > +            dst_dtsi = localdata.expand('${MACHINE}-${CMEM_DTSI}')
> > +
> > +            # Copy cmem.dtsi into source tree
> > +            shutil.copy(os.path.join(src_dir,src_dtsi),
> os.path.join(dst_dir,dst_dtsi))
> > +
> > +            # Inject dtsi into each dts in list
> > +            for dtb in (localdata.getVar('CMEM_DEVICETREE', True) or '').split():
> > +                dts = dtb[:-4] + '.dts'
> > +
> > +                with open(os.path.join(dst_dir,dts), 'a') as dts_file:
> > +                    dts_file.write('\n#include "%s"\n' % dst_dtsi)
> > +}
> > +
> > +do_patch[postfuncs] += "do_setup_cmem"
> > --
> > 1.9.1
> >
> > _______________________________________________
> > meta-arago mailing list
> > meta-arago@arago-project.org
> > http://arago-project.org/cgi-bin/mailman/listinfo/meta-arago


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-11-28 21:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-28 21:11 [meta-processor-sdk] [PATCH] linux: cmem: add support for am574x Hongmei Gou
2017-11-28 21:14 ` Denys Dmytriyenko
2017-11-28 21:19   ` Gou, Hongmei

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.