* Re: [PATCH v3 3/3] ARM: socfpga: dtsi: add dw-wdt reset lines
From: Trent Piepho @ 2016-10-26 20:12 UTC (permalink / raw)
To: Steffen Trumtrar; +Cc: barebox@lists.infradead.org
In-Reply-To: <20161017075052.30802-3-s.trumtrar@pengutronix.de>
On Mon, 2016-10-17 at 09:50 +0200, Steffen Trumtrar wrote:
> Signed-off-by: Steffen Trumtrar <s.trumtrar@pengutronix.de>
> ---
> arch/arm/dts/socfpga.dtsi | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/arch/arm/dts/socfpga.dtsi b/arch/arm/dts/socfpga.dtsi
> index d16758fdab46..66d7f21dc6a3 100644
> --- a/arch/arm/dts/socfpga.dtsi
> +++ b/arch/arm/dts/socfpga.dtsi
> @@ -49,3 +49,13 @@
> &f2s_sdram_ref_clk {
> clock-frequency = <0>;
> };
> +
> +&watchdog0 {
> + resets = <&rst L4WD0_RESET>;
> + reset-names = "dw-wdt";
This is the official binding? The reset-names property is supposed to
be the name of the reset from the perspective of the device being
described, e.g. the watchdog. Not the name from the perspective of the
reset controller. Rather than "dw-wdt", the name should something like
"reset", which clearly doesn't add much information, which is why the
reset-names property is supposed to be optional.
> +};
> +
> +&watchdog1 {
> + resets = <&rst L4WD1_RESET>;
> + reset-names = "dw-wdt";
> +};
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 4/4] mci: add MBR write and read function to block devices
From: Michael Grzeschik @ 2016-10-26 9:40 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20161026090933.qdzlqhv4blwx5idq@pengutronix.de>
On Wed, Oct 26, 2016 at 11:09:33AM +0200, Michael Grzeschik wrote:
> On Tue, Oct 18, 2016 at 08:23:22AM +0200, Sascha Hauer wrote:
> > On Mon, Oct 17, 2016 at 03:29:23PM +0200, Michael Grzeschik wrote:
> > > With this patch it is possible to write an mbr partition table to the
> > > mci block device. By setting the device property "dos_partitions" of the
> > > mmc device node, it is possible to write back the new partition layout
> > > in the common cmdlinepart notation. The property can also be read back.
> > >
> > > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > > ---
> > > drivers/mci/mci-core.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++
> > > 1 file changed, 122 insertions(+)
> > >
> > > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > > index 4e176f7..c0013a1 100644
> > > --- a/drivers/mci/mci-core.c
> > > +++ b/drivers/mci/mci-core.c
> > > @@ -33,9 +33,11 @@
> > > #include <asm-generic/div64.h>
> > > #include <asm/byteorder.h>
> > > #include <block.h>
> > > +#include <fcntl.h>
> > > #include <disks.h>
> > > #include <of.h>
> > > #include <linux/err.h>
> > > +#include <cmdlinepart.h>
> > >
> > > #define MAX_BUFFER_NUMBER 0xffffffff
> > >
> > > @@ -1527,6 +1529,122 @@ static void mci_info(struct device_d *dev)
> > > extract_mtd_year(mci));
> > > }
> > >
> > > +static char *print_size(uint64_t s)
> > > +{
> > > + if (!(s & ((1 << 20) - 1)))
> > > + return basprintf("%lldM", s >> 20);
> > > + if (!(s & ((1 << 10) - 1)))
> > > + return basprintf("%lldk", s >> 10);
> > > + return basprintf("0x%lld", s);
> >
> > s/lld/llx/
>
> Why that? This will break the typical layout compared
> to all other users of the kernelcmdline syntax.
As I now realize you only ment the last line, this sure makes
sense. I will fix it. But the mtd layer I copied this from
has the same issue. Will fix that aswell.
Thanks,
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 3/4] partitions/dos: add function to write partition table
From: Michael Grzeschik @ 2016-10-26 9:12 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20161018060712.kqtkwxx73to6m434@pengutronix.de>
On Tue, Oct 18, 2016 at 08:07:12AM +0200, Sascha Hauer wrote:
> Hi Michael,
>
> On Mon, Oct 17, 2016 at 03:29:22PM +0200, Michael Grzeschik wrote:
> > The function can be used to write an partition layout to the block device
> > based on its cdev layout. Only cdevs with flag DEVFS_PARTITION_IN_PT set
> > get written. The function also adds an static offset of 0x200000 to
> > ensure the mbr and bootloader will not be overwritten.
> >
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> > common/partitions/dos.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++
> > include/disks.h | 1 +
> > 2 files changed, 72 insertions(+)
> >
> > diff --git a/common/partitions/dos.c b/common/partitions/dos.c
> > index 5f08e25..d7fa538 100644
> > --- a/common/partitions/dos.c
> > +++ b/common/partitions/dos.c
> > @@ -256,6 +256,77 @@ static void dos_partition(void *buf, struct block_device *blk,
> > &dsp->signature, "%08x", dsp);
> > }
> >
> > +static inline void hdimage_setup_chs(unsigned int lba, unsigned char *chs)
> > +{
> > + const unsigned int hpc = 255;
> > + const unsigned int spt = 63;
> > + unsigned int s, c;
> > +
> > + chs[0] = (lba/spt)%hpc;
>
> Please run checkpatch over this. There are some stylistic flaws like
> missing whitespaces left and right of operators.
Thanks. I forgot to do that. It was an badly formatet template I used
here for reference. Will fix it.
> > + c = (lba/(spt * hpc));
> > + s = (lba > 0) ?(lba%spt + 1) : 0;
> > + chs[1] = ((c & 0x300) >> 2) | (s & 0xff);
> > + chs[2] = (c & 0xff);
> > +}
> > +
> > +int write_dos_partition_table(struct block_device *blk, struct list_head *cdevs)
> > +{
> > + char part_table[6+4*sizeof(struct partition_entry)+2];
> > + struct cdev *cdev, *ct;
> > + void *buf;
> > + int ret;
> > + int n = 0;
> > + char *ptr;
> > +
> > + /* prepare partition table entry */
> > + ptr = part_table;
> > + memset(ptr, 0, sizeof(part_table));
> > +
> > + /* skip disk signature */
> > + ptr += 6;
>
> It's even more important to skip this in the output buffer. This code
> should not change the disk signature.
>
> > + list_for_each_entry_safe(cdev, ct, cdevs, devices_list) {
>
> Why _safe? You do not remove entries, do you?
No elements get changed in the iteration. I will change it.
> > + if ((cdev->flags & DEVFS_IS_PARTITION) &&
> > + (cdev->flags & DEVFS_PARTITION_IN_PT)) {
>
> In a multiline if clause the second line should either start directly
> under the opening brace or indented with at least two more tabs than the
> opening if(), but using the same indention level as the conditional code
> makes it hard to read.
Will be changed.
>
> > + struct partition_entry *entry;
>
> Instead of the silent test below, do a:
>
> if (n == 4) {
> pr_warn("Only 4 partitions written to MBR\n");
> break;
> }
>
Good thought. Will change.
> > + entry = (struct partition_entry *)
> > + (ptr + n * sizeof(struct partition_entry));
> > +
> > + /* add static offset to skip the mbr and bootloader */
> > + cdev->offset += 4096 * SECTOR_SIZE;
> > +
> > + entry->type = 0x83;
> > + entry->partition_start = cdev->offset / SECTOR_SIZE;
> > + entry->partition_size = cdev->size / SECTOR_SIZE;
>
> We should have a test if offset and/or size exceed the 32bit limit.
>
Good point. Will add in v2.
> > +
> > + hdimage_setup_chs(entry->partition_start,
> > + entry->chs_begin);
> > + hdimage_setup_chs(entry->partition_start +
> > + entry->partition_size - 1,
> > + entry->chs_end);
> > + n++;
> > + }
> > + if (n == 4)
> > + break;
> > + }
> > +
> > + ptr += 4 * sizeof(struct partition_entry);
> > + ptr[0] = 0x55;
> > + ptr[1] = 0xaa;
> > +
> > + buf = read_mbr(blk);
> > + if (!buf)
> > + return -EIO;
>
> You could move this to the top of the function and directly manipulate
> the input buffer.
Already prepared for v2.
Thanks,
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 4/4] mci: add MBR write and read function to block devices
From: Michael Grzeschik @ 2016-10-26 9:09 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20161018062322.wje6gucvkt42v7oa@pengutronix.de>
On Tue, Oct 18, 2016 at 08:23:22AM +0200, Sascha Hauer wrote:
> On Mon, Oct 17, 2016 at 03:29:23PM +0200, Michael Grzeschik wrote:
> > With this patch it is possible to write an mbr partition table to the
> > mci block device. By setting the device property "dos_partitions" of the
> > mmc device node, it is possible to write back the new partition layout
> > in the common cmdlinepart notation. The property can also be read back.
> >
> > Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> > ---
> > drivers/mci/mci-core.c | 122 +++++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 122 insertions(+)
> >
> > diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
> > index 4e176f7..c0013a1 100644
> > --- a/drivers/mci/mci-core.c
> > +++ b/drivers/mci/mci-core.c
> > @@ -33,9 +33,11 @@
> > #include <asm-generic/div64.h>
> > #include <asm/byteorder.h>
> > #include <block.h>
> > +#include <fcntl.h>
> > #include <disks.h>
> > #include <of.h>
> > #include <linux/err.h>
> > +#include <cmdlinepart.h>
> >
> > #define MAX_BUFFER_NUMBER 0xffffffff
> >
> > @@ -1527,6 +1529,122 @@ static void mci_info(struct device_d *dev)
> > extract_mtd_year(mci));
> > }
> >
> > +static char *print_size(uint64_t s)
> > +{
> > + if (!(s & ((1 << 20) - 1)))
> > + return basprintf("%lldM", s >> 20);
> > + if (!(s & ((1 << 10) - 1)))
> > + return basprintf("%lldk", s >> 10);
> > + return basprintf("0x%lld", s);
>
> s/lld/llx/
Why that? This will break the typical layout compared
to all other users of the kernelcmdline syntax.
> > +}
> > +
> > +static int print_part(char *buf, int bufsize, struct cdev *cdev, int is_last)
> > +{
> > + char *size = print_size(cdev->size);
> > + int ret;
> > +
> > + if (!size) {
> > + ret = -ENOMEM;
> > + goto out;
> > + }
> > +
> > + ret = snprintf(buf, bufsize, "%s(%s)%s", size,
> > + cdev->partname,
> > + is_last ? "" : ",");
> > +out:
> > + free(size);
> > +
> > + return ret;
> > +}
> > +
> > +static int print_parts(char *buf, int bufsize, struct mci *mci)
> > +{
> > + struct cdev *cdev, *ct;
> > + int ret = 0;
> > +
> > + list_for_each_entry_safe(cdev, ct, &mci->dev.cdevs, devices_list) {
>
> safe_?
Sure. We don't change the list.
> > + if ((cdev->flags & DEVFS_IS_PARTITION) &&
> > + (cdev->flags & DEVFS_PARTITION_IN_PT)) {
> > + int now;
> > + int is_last = 0;
> > + struct list_head *nh = (cdev)->devices_list.next;
> > + struct cdev *next = container_of(nh, typeof(*(cdev)), devices_list);
> > +
> > + if (list_is_last(&cdev->devices_list, &mci->dev.cdevs) ||
> > + !(next->flags & DEVFS_PARTITION_IN_PT))
> > + is_last = 1;
>
> Is this test safe? What if the next partition does not have the
> DEVFS_PARTITION_IN_PT flag set, but the one after that has? Maybe you
> have to count the number of partitions in a first pass.
Yes. That's a good point. Will fix that.
> > +
> > + now = print_part(buf, bufsize, cdev, is_last);
> > + if (now < 0)
> > + return now;
> > +
> > + if (buf && bufsize) {
> > + buf += now;
> > + bufsize -= now;
> > + }
> > + ret += now;
> > + }
> > + }
> > +
> > + return ret;
> > +}
> > +
> > +static const char *mci_partition_get(struct device_d *dev, struct param_d *p)
> > +{
> > + struct mci *mci = container_of(dev, struct mci, dev);
> > + int len = 0;
> > +
> > + free(p->value);
> > +
> > + len = print_parts(NULL, 0, mci);
> > + p->value = xzalloc(len + 1);
> > + print_parts(p->value, len + 1, mci);
> > +
> > + return p->value;
> > +}
> > +
> > +#ifdef CONFIG_BLOCK_WRITE
> > +static int mci_partition_set(struct device_d *dev, struct param_d *p, const char *val)
> > +{
> > + struct mci *mci = container_of(dev, struct mci, dev);
> > + struct cdev *cdev, *ct;
> > + int ret;
> > +
> > + if (!val)
> > + return -EINVAL;
> > +
> > + /* remove all partition cdevs with DEVFS_IS_PARTITION set */
> > + list_for_each_entry_safe(cdev, ct, &mci->dev.cdevs, devices_list) {
> > + if ((cdev->flags & DEVFS_IS_PARTITION) &&
> > + (cdev->flags & DEVFS_PARTITION_IN_PT))
> > + ret = devfs_del_partition(cdev->name);
> > + if (ret)
> > + return ret;
> > + }
> > +
> > + /* read back the prepared partition layot from dos_partitions param */
>
> s/layot/layout/
>
Jupp.
> > + ret = cmdlinepart_do_parse(mci->cdevname, val, mci->capacity,
> > + CMDLINEPART_ADD_DEVNAME | CMDLINEPART_ADD_TO_PT);
> > + if (ret)
> > + return ret;
> > +
> > + /* write the MBR partition layout based on cdevs with DEVFS_IS_PARTITION set */
> > + for (int i = 0; i < mci->nr_parts; i++) {
> > + struct mci_part *part = &mci->part[i];
> > + if (part->area_type == MMC_BLK_DATA_AREA_MAIN) {
> > + ret = write_dos_partition_table(&part->blk,
> > + &mci->dev.cdevs);
> > + if (ret != 0) {
> > + dev_warn(&mci->dev, "Could not write partition table\n");
> > + return ret;
> > + }
> > + }
> > + }
> > +
> > + return ret;
> > +}
> > +#endif
> > +
> > /**
> > * Check if the MCI card is already probed
> > * @param mci MCI device instance
> > @@ -1786,6 +1904,10 @@ int mci_register(struct mci_host *host)
> > mci->param_probe = dev_add_param_bool(&mci->dev, "probe",
> > mci_set_probe, NULL, &mci->probe, mci);
> >
> > +#ifdef CONFIG_BLOCK_WRITE
> > + dev_add_param(&mci->dev, "dos_partitions", mci_partition_set, mci_partition_get, 0);
> > +#endif
>
> Use IS_ENABLED()
>
> Other than that this code should be attached to parse_partition_table()
> rather than making this mci specific.
> We probably can safely write a dos partition table to an unpartitioned
> device, but should refuse to create/manipulate a dos partition table
> when a EFI partition table exists.
I will have that fixed in v2, until I figured out how to integrate that properly.
Thanks,
Michael
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 1/2] nand: imx6: Changed default NAND clock
From: Sascha Hauer @ 2016-10-25 6:21 UTC (permalink / raw)
To: Christian Hemp; +Cc: barebox, Daniel Schultz
In-Reply-To: <1476970807-43811-1-git-send-email-c.hemp@phytec.de>
On Thu, Oct 20, 2016 at 03:40:06PM +0200, Christian Hemp wrote:
> From: Daniel Schultz <d.schultz@phytec.de>
>
> The Barebox recognized false bad erase blocks while booting from a
> Spansion NAND (1). This error occurred due a to high clock. The
> Kernel sets the default NAND clock to 22Mhz. So, to fix this error and
> to be more identical with the Kernel, the Barebox should be too.
>
> 1: nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
> S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
Applied both, thanks
Sascha
>
> Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> Tested-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> ---
> drivers/mtd/nand/nand_mxs.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
> index 01aa063..fe955e8 100644
> --- a/drivers/mtd/nand/nand_mxs.c
> +++ b/drivers/mtd/nand/nand_mxs.c
> @@ -2145,7 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev)
>
> if (mxs_nand_is_imx6(nand_info)) {
> clk_disable(nand_info->clk);
> - clk_set_rate(nand_info->clk, 96000000);
> + clk_set_rate(nand_info->clk, 22000000);
> clk_enable(nand_info->clk);
> nand_info->dma_channel_base = 0;
> } else {
> --
> 1.9.1
>
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 1/2] nand: imx6: Changed default NAND clock
From: Stefan Lengfeld @ 2016-10-24 9:20 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Daniel Schultz
In-Reply-To: <20161021071147.iacxwcdqz7sx7gs2@pengutronix.de>
Hi Sascha,
On Fri, Oct 21, 2016 at 09:11:47AM +0200, Sascha Hauer wrote:
> On Thu, Oct 20, 2016 at 03:40:06PM +0200, Christian Hemp wrote:
> > From: Daniel Schultz <d.schultz@phytec.de>
> >
> > The Barebox recognized false bad erase blocks while booting from a
> > Spansion NAND (1). This error occurred due a to high clock. The
> > Kernel sets the default NAND clock to 22Mhz. So, to fix this error and
> > to be more identical with the Kernel, the Barebox should be too.
>
> The timing is changed afterwards to a faster mode and the clock is
> changed again. Does that work for you properly?
>
> Sascha
Yes, if the NAND chip supports EDO mode, the clock is changed to 80/100Mhz
correctly. Here is the driver output with additional debug messages:
nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64
mxs_nand_setup_timing: mode 5
mxs_nand_setup_timing: mxs_nand_compute_edo_timing
mxs_nand_setup_timing: clock is 96000000
The patch fixes the case, when the NAND chip does not support EDO mode.
Instead of function 'mxs_nand_compute_edo_timing' the function
'mxs_nand_compute_hardware_timing' is called here.
mode = mxs_nand_enable_edo_mode(info);
if (mode >= 0)
mxs_nand_compute_edo_timing(info, &hw, mode);
else
mxs_nand_compute_hardware_timing(info, &hw);
Since 'mxs_nand_compute_hardware_timing' does not change the clock, the clock
is too fast for the NAND chip.
Here is the output of two different NAND chips without EDO mode. The patch to
set the clock to 22Mhz was already applied:
nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
mxs_nand_setup_timing: mode -22
mxs_nand_setup_timing: mxs_nand_compute_hardware_timing
mxs_nand_setup_timing: clock is 21818181
nand: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit), 1024MiB, page size: 2048, OOB size: 64
mxs_nand_setup_timing: mode -2
mxs_nand_setup_timing: mxs_nand_compute_hardware_timing
mxs_nand_setup_timing: clock is 21818181
Mit freundlichen Grüßen / Kind regards,
Stefan Lengfeld
>
> >
> > 1: nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
> > S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
> >
> > Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
> > Tested-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> > Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> > ---
> > drivers/mtd/nand/nand_mxs.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
> > index 01aa063..fe955e8 100644
> > --- a/drivers/mtd/nand/nand_mxs.c
> > +++ b/drivers/mtd/nand/nand_mxs.c
> > @@ -2145,7 +2145,7 @@ static int mxs_nand_probe(struct device_d *dev)
> >
> > if (mxs_nand_is_imx6(nand_info)) {
> > clk_disable(nand_info->clk);
> > - clk_set_rate(nand_info->clk, 96000000);
> > + clk_set_rate(nand_info->clk, 22000000);
> > clk_enable(nand_info->clk);
> > nand_info->dma_channel_base = 0;
> > } else {
> > --
> > 1.9.1
> >
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 2/2] mtd: nand: nand_mxs: Fix readtotal calculation
From: Stefan Lengfeld @ 2016-10-24 8:51 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20161021071808.ygaw53zjn3x5ns6f@pengutronix.de>
Hi Sascha,
On Fri, Oct 21, 2016 at 09:18:08AM +0200, Sascha Hauer wrote:
> On Thu, Oct 20, 2016 at 03:40:07PM +0200, Christian Hemp wrote:
> > The calculation of readtotal must be bit alligend. If not the bch core
> > finds bit flips in every page, because readtotal is too small.
> > This bug was mostly introduced since commit "51061a9 mtd: nand: nand_mxs:
> > Add subpage read support".
>
> Is this somehow related to:
>
> http://lists.infradead.org/pipermail/linux-mtd/2016-June/068243.html
>
> Or is this another topic?
>
> Sascha
Yes, this patch fixes the same wrong assumption as in the patch above. In the
above patch on the kernel list the assumption is that every block of
chunk+eccbits is byte aligned on the flash. So if the eccbits are not divisible
by 8, there are unused bits in the last byte of every block of chunk+eccbits.
That's not the case. In fact the second, third,... chunk will not be byte
aligned on the flash anymore. The blocks are bit shifted.
AFAIR, the GPMI/ECC engine operates at the bit level (which is a pain
to deal with BTW), and is only requiring a byte alignment on the total
number of ECC bits. So here, DIV_ROUND_UP(18 * 13 * 4, 8) = 117, which
fits in the 118 bytes (128 bytes - 10 bytes of 'metadata').
[Source: http://lists.infradead.org/pipermail/linux-mtd/2016-June/068244.html]
In the patch below the line
> > - ecc_parity_size = 13 * eccstrength / 8;
is the culprit. If the eccbits per chunk are not divisible by 8, a rounding
error occurs. Since C integer division truncates the fractional part, the byte
size in 'ecc_parity_size' underestimates the real size of the eccbits on the
flash.
The correct solution is to calculate all sizes in bits and then round up to the
next byte. So the code only overestimates the required read size.
I can only agree to Boris statement:
AFAIR, the GPMI/ECC engine operates at the bit level (which is a pain
to deal with BTW),
Dealing with bit aligned stuff is really awful.
Mit freundlichen Grüßen / Kind regards,
Stefan Lengfeld
>
> >
> > Tested with:
> > nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
> > S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
> >
> > nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron
> > MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64
> >
> > nand: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND
> > 1GiB 3,3V 8-bit), 1024MiB, page size: 2048, OOB size: 64
> >
> > Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> > Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> > ---
> > drivers/mtd/nand/nand_mxs.c | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
> > index fe955e8..cba0bee 100644
> > --- a/drivers/mtd/nand/nand_mxs.c
> > +++ b/drivers/mtd/nand/nand_mxs.c
> > @@ -728,15 +728,15 @@ static int __mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand
> > uint32_t corrected = 0, failed = 0;
> > uint8_t *status;
> > unsigned int max_bitflips = 0;
> > - int i, ret, readtotal, nchunks, eccstrength, ecc_parity_size;
> > + int i, ret, readtotal, nchunks, eccstrength;
> >
> > eccstrength = mxs_nand_get_ecc_strength(mtd->writesize, mtd->oobsize);
> >
> > readlen = roundup(readlen, MXS_NAND_CHUNK_DATA_CHUNK_SIZE);
> > nchunks = mxs_nand_ecc_chunk_cnt(readlen);
> > - ecc_parity_size = 13 * eccstrength / 8;
> > - readtotal = MXS_NAND_METADATA_SIZE +
> > - (MXS_NAND_CHUNK_DATA_CHUNK_SIZE + ecc_parity_size) * nchunks;
> > + readtotal = MXS_NAND_METADATA_SIZE;
> > + readtotal += MXS_NAND_CHUNK_DATA_CHUNK_SIZE * nchunks;
> > + readtotal += DIV_ROUND_UP(13 * eccstrength * nchunks, 8);
> >
> > mxs_nand_config_bch(mtd, readtotal);
> >
> > --
> > 1.9.1
> >
> >
> > _______________________________________________
> > barebox mailing list
> > barebox@lists.infradead.org
> > http://lists.infradead.org/mailman/listinfo/barebox
> >
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* [PATCH v2] ARM: dts: am33xx.dtsi: Add spi aliases
From: Teresa Remmet @ 2016-10-24 8:36 UTC (permalink / raw)
To: barebox
We need to add the spi aliases to set the bus number correct in
the driver.
Delete the spi1 alias again in the am33xx-strip.dtsi for MLO as
the node is deleted there also.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
Changes in v2:
- Removed the first patch completly
- Delete now spi1 alias in strip file
- Updated commit message
arch/arm/dts/am33xx-strip.dtsi | 1 +
arch/arm/dts/am33xx.dtsi | 2 ++
2 files changed, 3 insertions(+)
diff --git a/arch/arm/dts/am33xx-strip.dtsi b/arch/arm/dts/am33xx-strip.dtsi
index 2943fd1..83d23a8 100644
--- a/arch/arm/dts/am33xx-strip.dtsi
+++ b/arch/arm/dts/am33xx-strip.dtsi
@@ -14,6 +14,7 @@
/delete-property/ mmc2;
/delete-property/ d_can0;
/delete-property/ d_can1;
+ /delete-property/ spi1;
};
};
diff --git a/arch/arm/dts/am33xx.dtsi b/arch/arm/dts/am33xx.dtsi
index 7ba0a0b..f1ee7b3 100644
--- a/arch/arm/dts/am33xx.dtsi
+++ b/arch/arm/dts/am33xx.dtsi
@@ -18,5 +18,7 @@
mmc0 = &mmc1;
mmc1 = &mmc2;
mmc2 = &mmc3;
+ spi0 = &spi0;
+ spi1 = &spi1;
};
};
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 2/6] fs: squashfs: port lz4 compression support from kernel
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161024062843.2796-1-s.hauer@pengutronix.de>
From: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/squashfs/Kconfig | 10 ++++
fs/squashfs/Makefile | 1 +
fs/squashfs/lz4_wrapper.c | 140 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 151 insertions(+)
create mode 100644 fs/squashfs/lz4_wrapper.c
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 239682d..928e3bb 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -17,6 +17,16 @@ menuconfig FS_SQUASHFS
embedded systems where low overhead is needed. Further information
and tools are available from http://squashfs.sourceforge.net.
+config SQUASHFS_LZ4
+ bool
+ depends on FS_SQUASHFS
+ depends on LZ4_DECOMPRESS
+ default y
+
+if !SQUASHFS_LZ4
+ comment "LZ4 support disabled"
+endif
+
config SQUASHFS_LZO
bool
depends on FS_SQUASHFS
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 447e15e..8590b09 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -12,3 +12,4 @@ obj-y += namei.o
obj-y += super.o
obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o
obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
+obj-$(CONFIG_SQUASHFS_LZ4) += lz4_wrapper.o
diff --git a/fs/squashfs/lz4_wrapper.c b/fs/squashfs/lz4_wrapper.c
new file mode 100644
index 0000000..6ca6a32
--- /dev/null
+++ b/fs/squashfs/lz4_wrapper.c
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2013, 2014
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2. See
+ * the COPYING file in the top-level directory.
+ */
+
+#include <types.h>
+#include <linux/mutex.h>
+#include <linux/lz4.h>
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs.h"
+#include "decompressor.h"
+#include "page_actor.h"
+
+#define LZ4_LEGACY 1
+
+struct lz4_comp_opts {
+ __le32 version;
+ __le32 flags;
+};
+
+struct squashfs_lz4 {
+ void *input;
+ void *output;
+};
+
+
+static void *lz4_comp_opts(struct squashfs_sb_info *msblk,
+ void *buff, int len)
+{
+ struct lz4_comp_opts *comp_opts = buff;
+
+ /* LZ4 compressed filesystems always have compression options */
+ if (comp_opts == NULL || len < sizeof(*comp_opts))
+ return ERR_PTR(-EIO);
+
+ if (le32_to_cpu(comp_opts->version) != LZ4_LEGACY) {
+ /* LZ4 format currently used by the kernel is the 'legacy'
+ * format */
+ ERROR("Unknown LZ4 version\n");
+ return ERR_PTR(-EINVAL);
+ }
+
+ return NULL;
+}
+
+
+static void *lz4_init(struct squashfs_sb_info *msblk, void *buff)
+{
+ int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE);
+ struct squashfs_lz4 *stream;
+
+ stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ if (stream == NULL)
+ goto failed;
+ stream->input = vmalloc(block_size);
+ if (stream->input == NULL)
+ goto failed2;
+ stream->output = vmalloc(block_size);
+ if (stream->output == NULL)
+ goto failed3;
+
+ return stream;
+
+failed3:
+ vfree(stream->input);
+failed2:
+ kfree(stream);
+failed:
+ ERROR("Failed to initialise LZ4 decompressor\n");
+ return ERR_PTR(-ENOMEM);
+}
+
+
+static void lz4_free(void *strm)
+{
+ struct squashfs_lz4 *stream = strm;
+
+ if (stream) {
+ vfree(stream->input);
+ vfree(stream->output);
+ }
+ kfree(stream);
+}
+
+
+static int lz4_uncompress(struct squashfs_sb_info *msblk, void *strm,
+ char **bh, int b, int offset, int length,
+ struct squashfs_page_actor *output)
+{
+ struct squashfs_lz4 *stream = strm;
+ void *buff = stream->input, *data;
+ int avail, i, bytes = length, res;
+ size_t dest_len = output->length;
+
+ for (i = 0; i < b; i++) {
+ avail = min(bytes, msblk->devblksize - offset);
+ memcpy(buff, bh[i] + offset, avail);
+ buff += avail;
+ bytes -= avail;
+ offset = 0;
+ kfree(bh[i]);
+ }
+
+ res = lz4_decompress_unknownoutputsize(stream->input, length,
+ stream->output, &dest_len);
+ if (res)
+ return -EIO;
+
+ bytes = dest_len;
+ data = squashfs_first_page(output);
+ buff = stream->output;
+ while (data) {
+ if (bytes <= PAGE_CACHE_SIZE) {
+ memcpy(data, buff, bytes);
+ break;
+ }
+ memcpy(data, buff, PAGE_CACHE_SIZE);
+ buff += PAGE_CACHE_SIZE;
+ bytes -= PAGE_CACHE_SIZE;
+ data = squashfs_next_page(output);
+ }
+ squashfs_finish_page(output);
+
+ return dest_len;
+}
+
+const struct squashfs_decompressor squashfs_lz4_comp_ops = {
+ .init = lz4_init,
+ .comp_opts = lz4_comp_opts,
+ .free = lz4_free,
+ .decompress = lz4_uncompress,
+ .id = LZ4_COMPRESSION,
+ .name = "lz4",
+ .supported = 1
+};
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 3/6] fs: squashfs: port zlib compression support from kernel
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161024062843.2796-1-s.hauer@pengutronix.de>
From: Enrico Jorns <ejo@pengutronix.de>
As this is the default compression method for squashfs, make this the
default in kconfig selection, too
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/squashfs/Kconfig | 10 ++++
fs/squashfs/Makefile | 1 +
fs/squashfs/zlib_wrapper.c | 132 +++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 143 insertions(+)
create mode 100644 fs/squashfs/zlib_wrapper.c
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 928e3bb..085bfb6 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -17,6 +17,16 @@ menuconfig FS_SQUASHFS
embedded systems where low overhead is needed. Further information
and tools are available from http://squashfs.sourceforge.net.
+config SQUASHFS_ZLIB
+ bool
+ depends on FS_SQUASHFS
+ depends on ZLIB
+ default y
+
+if !SQUASHFS_ZLIB
+ comment "ZLIB support disabled"
+endif
+
config SQUASHFS_LZ4
bool
depends on FS_SQUASHFS
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index 8590b09..7976e3f 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -13,3 +13,4 @@ obj-y += super.o
obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o
obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
obj-$(CONFIG_SQUASHFS_LZ4) += lz4_wrapper.o
+obj-$(CONFIG_SQUASHFS_ZLIB) += zlib_wrapper.o
diff --git a/fs/squashfs/zlib_wrapper.c b/fs/squashfs/zlib_wrapper.c
new file mode 100644
index 0000000..f422515
--- /dev/null
+++ b/fs/squashfs/zlib_wrapper.c
@@ -0,0 +1,132 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
+ * Phillip Lougher <phillip@squashfs.org.uk>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * zlib_wrapper.c
+ */
+
+
+#include <linux/mutex.h>
+#include <linux/zlib.h>
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs.h"
+#include "decompressor.h"
+#include "page_actor.h"
+
+static void *zlib_init(struct squashfs_sb_info *dummy, void *buff)
+{
+ z_stream *stream = kmalloc(sizeof(z_stream), GFP_KERNEL);
+ if (stream == NULL)
+ goto failed;
+ stream->workspace = vmalloc(zlib_inflate_workspacesize());
+ if (stream->workspace == NULL)
+ goto failed;
+
+ return stream;
+
+failed:
+ ERROR("Failed to allocate zlib workspace\n");
+ kfree(stream);
+ return ERR_PTR(-ENOMEM);
+}
+
+
+static void zlib_free(void *strm)
+{
+ z_stream *stream = strm;
+
+ if (stream)
+ vfree(stream->workspace);
+ kfree(stream);
+}
+
+
+static int zlib_uncompress(struct squashfs_sb_info *msblk, void *strm,
+ char **bh, int b, int offset, int length,
+ struct squashfs_page_actor *output)
+{
+ int zlib_err, zlib_init = 0, k = 0;
+ z_stream *stream = strm;
+
+ stream->avail_out = PAGE_CACHE_SIZE;
+ stream->next_out = squashfs_first_page(output);
+ stream->avail_in = 0;
+
+ do {
+ if (stream->avail_in == 0 && k < b) {
+ int avail = min(length, msblk->devblksize - offset);
+ length -= avail;
+ stream->next_in = bh[k] + offset;
+ stream->avail_in = avail;
+ offset = 0;
+ }
+
+ if (stream->avail_out == 0) {
+ stream->next_out = squashfs_next_page(output);
+ if (stream->next_out != NULL)
+ stream->avail_out = PAGE_CACHE_SIZE;
+ }
+
+ if (!zlib_init) {
+ zlib_err = zlib_inflateInit(stream);
+ if (zlib_err != Z_OK) {
+ squashfs_finish_page(output);
+ goto out;
+ }
+ zlib_init = 1;
+ }
+
+ zlib_err = zlib_inflate(stream, Z_SYNC_FLUSH);
+
+ if (stream->avail_in == 0 && k < b)
+ kfree(bh[k++]);
+ } while (zlib_err == Z_OK);
+
+ squashfs_finish_page(output);
+
+ if (zlib_err != Z_STREAM_END)
+ goto out;
+
+ zlib_err = zlib_inflateEnd(stream);
+ if (zlib_err != Z_OK)
+ goto out;
+
+ if (k < b)
+ goto out;
+
+ return stream->total_out;
+
+out:
+ for (; k < b; k++)
+ kfree(bh[k]);
+
+ return -EIO;
+}
+
+const struct squashfs_decompressor squashfs_zlib_comp_ops = {
+ .init = zlib_init,
+ .free = zlib_free,
+ .decompress = zlib_uncompress,
+ .id = ZLIB_COMPRESSION,
+ .name = "zlib",
+ .supported = 1
+};
+
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 5/6] fs: squashfs: append linux rootarg for ubi volume
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161024062843.2796-1-s.hauer@pengutronix.de>
From: Enrico Jorns <ejo@pengutronix.de>
If squashfs runs from an ubi volume, append appropriate root kernel
options.
Note that ubiblock support is required in the kernel for that.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/squashfs/squashfs.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index 6d04681..c4d0bac 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -9,12 +9,16 @@
#include <linux/fs.h>
#include <linux/stat.h>
#include <linux/pagemap.h>
+#include <linux/mtd/ubi.h>
+#include <linux/mtd/mtd.h>
#include "squashfs_fs.h"
#include "squashfs_fs_sb.h"
#include "squashfs_fs_i.h"
#include "squashfs.h"
+struct ubi_volume_desc;
+
char *squashfs_devread(struct squashfs_sb_info *fs, int byte_offset,
int byte_len)
{
@@ -108,6 +112,31 @@ static struct inode *squashfs_findfile(struct super_block *sb,
return NULL;
}
+void squashfs_set_rootarg(struct squashfs_priv *priv, struct fs_device_d *fsdev)
+{
+ struct ubi_volume_desc *ubi_vol;
+ struct ubi_volume_info vi = {};
+ struct ubi_device_info di = {};
+ struct mtd_info *mtd;
+ char *str;
+
+ ubi_vol = ubi_open_volume_cdev(fsdev->cdev, UBI_READONLY);
+
+ if (IS_ERR(ubi_vol))
+ return;
+
+ ubi_get_volume_info(ubi_vol, &vi);
+ ubi_get_device_info(vi.ubi_num, &di);
+ mtd = di.mtd;
+
+ str = basprintf("root=/dev/ubiblock%d_%d ubi.mtd=%s ubi.block=%d,%d rootfstype=squashfs",
+ vi.ubi_num, vi.vol_id, mtd->cdev.partname, vi.ubi_num, vi.vol_id);
+
+ fsdev_set_linux_rootarg(fsdev, str);
+
+ free(str);
+}
+
static int squashfs_probe(struct device_d *dev)
{
struct fs_device_d *fsdev;
@@ -130,6 +159,8 @@ static int squashfs_probe(struct device_d *dev)
goto err_out;
}
+ squashfs_set_rootarg(priv, fsdev);
+
return 0;
err_out:
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 1/6] fs: squashfs: port lzo compression support from kernel
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161024062843.2796-1-s.hauer@pengutronix.de>
From: Enrico Jorns <ejo@pengutronix.de>
This ports lzo_wrapper from kernel code and adds some minimal adaptions
to make squashfs lzo compression work in barebox.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Tested-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/squashfs/Kconfig | 10 ++++
fs/squashfs/Makefile | 1 +
fs/squashfs/lzo_wrapper.c | 129 ++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 140 insertions(+)
create mode 100644 fs/squashfs/lzo_wrapper.c
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index dc25d93..239682d 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -17,6 +17,16 @@ menuconfig FS_SQUASHFS
embedded systems where low overhead is needed. Further information
and tools are available from http://squashfs.sourceforge.net.
+config SQUASHFS_LZO
+ bool
+ depends on FS_SQUASHFS
+ depends on LZO_DECOMPRESS
+ default y
+
+if !SQUASHFS_LZO
+ comment "LZO support disabled"
+endif
+
config SQUASHFS_XZ
bool "Include support for XZ compressed file systems"
default y
diff --git a/fs/squashfs/Makefile b/fs/squashfs/Makefile
index c0d024c..447e15e 100644
--- a/fs/squashfs/Makefile
+++ b/fs/squashfs/Makefile
@@ -11,3 +11,4 @@ obj-y += inode.o
obj-y += namei.o
obj-y += super.o
obj-$(CONFIG_SQUASHFS_XZ) += xz_wrapper.o
+obj-$(CONFIG_SQUASHFS_LZO) += lzo_wrapper.o
diff --git a/fs/squashfs/lzo_wrapper.c b/fs/squashfs/lzo_wrapper.c
new file mode 100644
index 0000000..834ee29
--- /dev/null
+++ b/fs/squashfs/lzo_wrapper.c
@@ -0,0 +1,129 @@
+/*
+ * Squashfs - a compressed read only filesystem for Linux
+ *
+ * Copyright (c) 2010 LG Electronics
+ * Chan Jeong <chan.jeong@lge.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2,
+ * or (at your option) any later version.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * lzo_wrapper.c
+ */
+
+#include <common.h>
+#include <linux/mutex.h>
+#include <lzo.h>
+#include <types.h>
+
+#include "squashfs_fs.h"
+#include "squashfs_fs_sb.h"
+#include "squashfs.h"
+#include "decompressor.h"
+#include "page_actor.h"
+
+struct squashfs_lzo {
+ void *input;
+ void *output;
+};
+
+static void *lzo_init(struct squashfs_sb_info *msblk, void *buff)
+{
+ int block_size = max_t(int, msblk->block_size, SQUASHFS_METADATA_SIZE);
+
+ struct squashfs_lzo *stream = kzalloc(sizeof(*stream), GFP_KERNEL);
+ if (stream == NULL)
+ goto failed;
+ stream->input = vmalloc(block_size);
+ if (stream->input == NULL)
+ goto failed;
+ stream->output = vmalloc(block_size);
+ if (stream->output == NULL)
+ goto failed2;
+
+ return stream;
+
+failed2:
+ vfree(stream->input);
+failed:
+ ERROR("Failed to allocate lzo workspace\n");
+ kfree(stream);
+ return ERR_PTR(-ENOMEM);
+}
+
+
+static void lzo_free(void *strm)
+{
+ struct squashfs_lzo *stream = strm;
+
+ if (stream) {
+ vfree(stream->input);
+ vfree(stream->output);
+ }
+ kfree(stream);
+}
+
+
+static int lzo_uncompress(struct squashfs_sb_info *msblk, void *strm,
+ char **bh, int b, int offset, int length,
+ struct squashfs_page_actor *output)
+{
+ struct squashfs_lzo *stream = strm;
+ void *buff = stream->input, *data;
+ int avail, i, bytes = length, res;
+ size_t out_len = output->length;
+
+ for (i = 0; i < b; i++) {
+ avail = min(bytes, msblk->devblksize - offset);
+ memcpy(buff, bh[i] + offset, avail);
+ buff += avail;
+ bytes -= avail;
+ offset = 0;
+ kfree(bh[i]);
+ }
+
+ res = lzo1x_decompress_safe(stream->input, (size_t)length,
+ stream->output, &out_len);
+ if (res != LZO_E_OK)
+ goto failed;
+
+ res = bytes = (int)out_len;
+ data = squashfs_first_page(output);
+ buff = stream->output;
+ while (data) {
+ if (bytes <= PAGE_CACHE_SIZE) {
+ memcpy(data, buff, bytes);
+ break;
+ } else {
+ memcpy(data, buff, PAGE_CACHE_SIZE);
+ buff += PAGE_CACHE_SIZE;
+ bytes -= PAGE_CACHE_SIZE;
+ data = squashfs_next_page(output);
+ }
+ }
+ squashfs_finish_page(output);
+
+ return res;
+
+failed:
+ return -EIO;
+}
+
+const struct squashfs_decompressor squashfs_lzo_comp_ops = {
+ .init = lzo_init,
+ .free = lzo_free,
+ .decompress = lzo_uncompress,
+ .id = LZO_COMPRESSION,
+ .name = "lzo",
+ .supported = 1
+};
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 4/6] Add filetype and detection for squashfs images
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List; +Cc: Enrico Jorns
In-Reply-To: <20161024062843.2796-1-s.hauer@pengutronix.de>
From: Enrico Jorns <ejo@pengutronix.de>
This adds `filetype_squashfs` to the list of known filetypes and adds a
detection for squashfs files to file_detect_type(). This currently
matches on the `hsqs` start sequence of an image file.
Additionally, the newly introduced filetype is registered as the type of
the squashfs_driver which allows, for example, to mount squashfs without
the need to specify a type parameter.
This changes enable booting a squashfs with the simple `boot` command
pointing to the location (device) that holds the squashfs.
Note that booting with blspec is limited as the current squashfs driver
is not capable of handling symbolic links.
Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
common/filetype.c | 4 ++++
fs/squashfs/squashfs.c | 1 +
include/filetype.h | 1 +
3 files changed, 6 insertions(+)
diff --git a/common/filetype.c b/common/filetype.c
index 4728f87..8d72933 100644
--- a/common/filetype.c
+++ b/common/filetype.c
@@ -40,6 +40,7 @@ static const struct filetype_str filetype_str[] = {
[filetype_uimage] = { "U-Boot uImage", "u-boot" },
[filetype_ubi] = { "UBI image", "ubi" },
[filetype_jffs2] = { "JFFS2 image", "jffs2" },
+ [filetype_squashfs] = { "Squashfs image", "squashfs" },
[filetype_gzip] = { "GZIP compressed", "gzip" },
[filetype_bzip2] = { "BZIP2 compressed", "bzip2" },
[filetype_oftree] = { "open firmware Device Tree flattened Binary", "dtb" },
@@ -278,6 +279,9 @@ enum filetype file_detect_type(const void *_buf, size_t bufsize)
if (buf8[0] == 0xfd && buf8[1] == 0x37 && buf8[2] == 0x7a &&
buf8[3] == 0x58 && buf8[4] == 0x5a && buf8[5] == 0x00)
return filetype_xz_compressed;
+ if (buf8[0] == 'h' && buf8[1] == 's' && buf8[2] == 'q' &&
+ buf8[3] == 's')
+ return filetype_squashfs;
if (buf[0] == be32_to_cpu(0xd00dfeed))
return filetype_oftree;
if (strncmp(buf8, "ANDROID!", 8) == 0)
diff --git a/fs/squashfs/squashfs.c b/fs/squashfs/squashfs.c
index d00dee6..6d04681 100644
--- a/fs/squashfs/squashfs.c
+++ b/fs/squashfs/squashfs.c
@@ -353,6 +353,7 @@ static struct fs_driver_d squashfs_driver = {
.readdir = squashfs_readdir,
.closedir = squashfs_closedir,
.stat = squashfs_stat,
+ .type = filetype_squashfs,
.drv = {
.probe = squashfs_probe,
.remove = squashfs_remove,
diff --git a/include/filetype.h b/include/filetype.h
index cde73c1..65bd6ef 100644
--- a/include/filetype.h
+++ b/include/filetype.h
@@ -16,6 +16,7 @@ enum filetype {
filetype_uimage,
filetype_ubi,
filetype_jffs2,
+ filetype_squashfs,
filetype_gzip,
filetype_bzip2,
filetype_oftree,
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 6/6] fs: squashfs: Enable squashfs XZ support when XZ is enabled
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List
In-Reply-To: <20161024062843.2796-1-s.hauer@pengutronix.de>
XZ support itself is much more expensive than the squashfs XZ wrapper,
so it makes sense to just compile XZ support into barebox when XZ
support is available. No need to ask the user for it.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
fs/squashfs/Kconfig | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
index 085bfb6..2362ba1 100644
--- a/fs/squashfs/Kconfig
+++ b/fs/squashfs/Kconfig
@@ -48,15 +48,12 @@ if !SQUASHFS_LZO
endif
config SQUASHFS_XZ
- bool "Include support for XZ compressed file systems"
- default y
+ bool
depends on FS_SQUASHFS
- select XZ_DECOMPRESS
- help
- Saying Y here includes support for reading Squashfs file systems
- compressed with XZ compression. XZ gives better compression than
- the default zlib compression, at the expense of greater CPU and
- memory overhead.
+ depends on XZ_DECOMPRESS
+ default y
+
+if !SQUASHFS_XZ
+ comment "XZ support disabled"
+endif
- XZ is not the standard compression used in Squashfs and so most
- file systems will be readable without selecting this option.
--
2.9.3
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH v2] squashfs additional decompressors
From: Sascha Hauer @ 2016-10-24 6:28 UTC (permalink / raw)
To: Barebox List
This series enables additional decompressors for squashfs.
Changes since v1:
- Enable the squashfs decompression wrapper for a decompression method
always when the corresponding decompression library is enabled. The
rationale is that the wrapper is cheap compared to the decompression
library, so when the library is enabled we can also enable the wrapper.
----------------------------------------------------------------
Enrico Jorns (5):
fs: squashfs: port lzo compression support from kernel
fs: squashfs: port lz4 compression support from kernel
fs: squashfs: port zlib compression support from kernel
Add filetype and detection for squashfs images
fs: squashfs: append linux rootarg for ubi volume
Sascha Hauer (1):
fs: squashfs: Enable squashfs XZ support when XZ is enabled
common/filetype.c | 4 ++
fs/squashfs/Kconfig | 47 +++++++++++----
fs/squashfs/Makefile | 3 +
fs/squashfs/lz4_wrapper.c | 140 +++++++++++++++++++++++++++++++++++++++++++++
fs/squashfs/lzo_wrapper.c | 129 +++++++++++++++++++++++++++++++++++++++++
fs/squashfs/squashfs.c | 32 +++++++++++
fs/squashfs/zlib_wrapper.c | 132 ++++++++++++++++++++++++++++++++++++++++++
include/filetype.h | 1 +
8 files changed, 478 insertions(+), 10 deletions(-)
create mode 100644 fs/squashfs/lz4_wrapper.c
create mode 100644 fs/squashfs/lzo_wrapper.c
create mode 100644 fs/squashfs/zlib_wrapper.c
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 1/2] ARM: dts: am33xx: Make am33xx-strip.dtsi independent
From: Teresa Remmet @ 2016-10-24 6:07 UTC (permalink / raw)
To: barebox
In-Reply-To: <1477043141-27884-1-git-send-email-t.remmet@phytec.de>
Please forget about this one. There is a far more easier way to go.
I will send a new patch.
Teresa
Am Freitag, den 21.10.2016, 11:45 +0200 schrieb Teresa Remmet:
> am33xx-strip.dtsi was used to remove unused nodes in the MLO device tree.
> It always required the am33xx.dtsi include. But if we add aliases to the
> am33xx.dtsi, where the nodes are beeing deleted in the am33xx-strip.dtsi
> we get compile errors. So made am33xx-strip.dtsi independent from am33xx.dtsi
> and renamed it to am33xx-mlo.dtsi.
>
> Also added spi0 alias to am33xx-mlo.dtsi.
>
> Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
> ---
> arch/arm/dts/am335x-bone-common.dts | 3 +--
> arch/arm/dts/am335x-phytec-phycard-som-mlo.dts | 3 +--
> arch/arm/dts/am335x-phytec-phycore-som-mlo.dts | 3 +--
> arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts | 3 +--
> arch/arm/dts/{am33xx-strip.dtsi => am33xx-mlo.dtsi} | 9 ++++++++-
> 5 files changed, 12 insertions(+), 9 deletions(-)
> rename arch/arm/dts/{am33xx-strip.dtsi => am33xx-mlo.dtsi} (87%)
>
> diff --git a/arch/arm/dts/am335x-bone-common.dts b/arch/arm/dts/am335x-bone-common.dts
> index 0488cbe..63962df 100644
> --- a/arch/arm/dts/am335x-bone-common.dts
> +++ b/arch/arm/dts/am335x-bone-common.dts
> @@ -7,8 +7,7 @@
> * all we need for the MLO
> */
>
> -#include "am33xx.dtsi"
> -#include "am33xx-strip.dtsi"
> +#include "am33xx-mlo.dtsi"
> #include "am33xx-clocks-strip.dtsi"
> #include "am335x-bone-common.dtsi"
>
> diff --git a/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts b/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts
> index a1755fd..817093b 100644
> --- a/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts
> +++ b/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts
> @@ -7,9 +7,8 @@
> */
> /dts-v1/;
>
> -#include "am33xx.dtsi"
> +#include "am33xx-mlo.dtsi"
> #include "am335x-phytec-phycard-som.dtsi"
> -#include "am33xx-strip.dtsi"
> #include "am33xx-clocks-strip.dtsi"
>
> / {
> diff --git a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
> index f7bc462..817b672 100644
> --- a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
> +++ b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
> @@ -7,9 +7,8 @@
> */
> /dts-v1/;
>
> -#include "am33xx.dtsi"
> +#include "am33xx-mlo.dtsi"
> #include "am335x-phytec-phycore-som.dtsi"
> -#include "am33xx-strip.dtsi"
> #include "am33xx-clocks-strip.dtsi"
>
> / {
> diff --git a/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts b/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts
> index e848a29..cf36c4c 100644
> --- a/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts
> +++ b/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts
> @@ -7,9 +7,8 @@
> */
> /dts-v1/;
>
> -#include "am33xx.dtsi"
> +#include "am33xx-mlo.dtsi"
> #include "am335x-phytec-phyflex-som.dtsi"
> -#include "am33xx-strip.dtsi"
> #include "am33xx-clocks-strip.dtsi"
>
> / {
> diff --git a/arch/arm/dts/am33xx-strip.dtsi b/arch/arm/dts/am33xx-mlo.dtsi
> similarity index 87%
> rename from arch/arm/dts/am33xx-strip.dtsi
> rename to arch/arm/dts/am33xx-mlo.dtsi
> index 2943fd1..36f137b 100644
> --- a/arch/arm/dts/am33xx-strip.dtsi
> +++ b/arch/arm/dts/am33xx-mlo.dtsi
> @@ -6,12 +6,19 @@
> * it under the terms of the GNU General Public License version 2 as
> * published by the Free Software Foundation.
> */
> +#include <arm/am33xx.dtsi>
>
> / {
> aliases {
> + gpio0 = &gpio0;
> + gpio1 = &gpio1;
> + gpio2 = &gpio2;
> + gpio3 = &gpio3;
> + mmc0 = &mmc1;
> + mmc1 = &mmc2;
> + spi0 = &spi0;
> /delete-property/ i2c1;
> /delete-property/ i2c2;
> - /delete-property/ mmc2;
> /delete-property/ d_can0;
> /delete-property/ d_can1;
> };
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: Compressed DTB - builtin DTB
From: Sascha Hauer @ 2016-10-24 5:51 UTC (permalink / raw)
To: Daniel Krüger; +Cc: barebox
In-Reply-To: <d6c5169f-788e-ff34-1953-fb9014822a72@systec-electronic.com>
On Fri, Oct 21, 2016 at 10:16:53AM +0200, Daniel Krüger wrote:
> Hi Sascha,
>
> Am 14.10.2016 um 11:52 schrieb Sascha Hauer:
> >
> > No, indeed that's not intended. Could you test the appended patch? It
> > should solve this.
>
> Thanks. The patch works for me.
Ok, applied that with your tested-by.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: [PATCH 6/6] fs: squashfs: Do not default on xz
From: Sascha Hauer @ 2016-10-21 9:48 UTC (permalink / raw)
To: Daniel Krüger; +Cc: Barebox List
In-Reply-To: <fa561303-8330-208b-3588-bf9f4807d8cd@systec-electronic.com>
On Fri, Oct 21, 2016 at 10:23:55AM +0200, Daniel Krüger wrote:
> Hi Sascha,
>
> I tried this patch series, because I need Squashfs zlib support.
>
> I get the following output during configuration/build:
> >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> scripts/kconfig/conf --silentoldconfig Kconfig
> lib/lzo/Kconfig:1:error: recursive dependency detected!
> lib/lzo/Kconfig:1: symbol LZO_DECOMPRESS is selected by SQUASHFS_LZO
> fs/squashfs/Kconfig:49: symbol SQUASHFS_LZO depends on LZO_DECOMPRESS
> lib/Kconfig:21:error: recursive dependency detected!
> lib/Kconfig:21: symbol XZ_DECOMPRESS is selected by SQUASHFS_XZ
> fs/squashfs/Kconfig:63: symbol SQUASHFS_XZ depends on XZ_DECOMPRESS
> lib/Kconfig:9:error: recursive dependency detected!
> lib/Kconfig:9: symbol ZLIB is selected by SQUASHFS_ZLIB
> fs/squashfs/Kconfig:24: symbol SQUASHFS_ZLIB depends on ZLIB
> lib/Kconfig:17:error: recursive dependency detected!
> lib/Kconfig:17: symbol LZ4_DECOMPRESS is selected by SQUASHFS_LZ4
> fs/squashfs/Kconfig:35: symbol SQUASHFS_LZ4 depends on LZ4_DECOMPRESS
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
What a pity, then this does not work like this. I'll rework it.
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* [PATCH 1/2] ARM: dts: am33xx: Make am33xx-strip.dtsi independent
From: Teresa Remmet @ 2016-10-21 9:45 UTC (permalink / raw)
To: barebox
am33xx-strip.dtsi was used to remove unused nodes in the MLO device tree.
It always required the am33xx.dtsi include. But if we add aliases to the
am33xx.dtsi, where the nodes are beeing deleted in the am33xx-strip.dtsi
we get compile errors. So made am33xx-strip.dtsi independent from am33xx.dtsi
and renamed it to am33xx-mlo.dtsi.
Also added spi0 alias to am33xx-mlo.dtsi.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
arch/arm/dts/am335x-bone-common.dts | 3 +--
arch/arm/dts/am335x-phytec-phycard-som-mlo.dts | 3 +--
arch/arm/dts/am335x-phytec-phycore-som-mlo.dts | 3 +--
arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts | 3 +--
arch/arm/dts/{am33xx-strip.dtsi => am33xx-mlo.dtsi} | 9 ++++++++-
5 files changed, 12 insertions(+), 9 deletions(-)
rename arch/arm/dts/{am33xx-strip.dtsi => am33xx-mlo.dtsi} (87%)
diff --git a/arch/arm/dts/am335x-bone-common.dts b/arch/arm/dts/am335x-bone-common.dts
index 0488cbe..63962df 100644
--- a/arch/arm/dts/am335x-bone-common.dts
+++ b/arch/arm/dts/am335x-bone-common.dts
@@ -7,8 +7,7 @@
* all we need for the MLO
*/
-#include "am33xx.dtsi"
-#include "am33xx-strip.dtsi"
+#include "am33xx-mlo.dtsi"
#include "am33xx-clocks-strip.dtsi"
#include "am335x-bone-common.dtsi"
diff --git a/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts b/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts
index a1755fd..817093b 100644
--- a/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts
+++ b/arch/arm/dts/am335x-phytec-phycard-som-mlo.dts
@@ -7,9 +7,8 @@
*/
/dts-v1/;
-#include "am33xx.dtsi"
+#include "am33xx-mlo.dtsi"
#include "am335x-phytec-phycard-som.dtsi"
-#include "am33xx-strip.dtsi"
#include "am33xx-clocks-strip.dtsi"
/ {
diff --git a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
index f7bc462..817b672 100644
--- a/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
+++ b/arch/arm/dts/am335x-phytec-phycore-som-mlo.dts
@@ -7,9 +7,8 @@
*/
/dts-v1/;
-#include "am33xx.dtsi"
+#include "am33xx-mlo.dtsi"
#include "am335x-phytec-phycore-som.dtsi"
-#include "am33xx-strip.dtsi"
#include "am33xx-clocks-strip.dtsi"
/ {
diff --git a/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts b/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts
index e848a29..cf36c4c 100644
--- a/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts
+++ b/arch/arm/dts/am335x-phytec-phyflex-som-mlo.dts
@@ -7,9 +7,8 @@
*/
/dts-v1/;
-#include "am33xx.dtsi"
+#include "am33xx-mlo.dtsi"
#include "am335x-phytec-phyflex-som.dtsi"
-#include "am33xx-strip.dtsi"
#include "am33xx-clocks-strip.dtsi"
/ {
diff --git a/arch/arm/dts/am33xx-strip.dtsi b/arch/arm/dts/am33xx-mlo.dtsi
similarity index 87%
rename from arch/arm/dts/am33xx-strip.dtsi
rename to arch/arm/dts/am33xx-mlo.dtsi
index 2943fd1..36f137b 100644
--- a/arch/arm/dts/am33xx-strip.dtsi
+++ b/arch/arm/dts/am33xx-mlo.dtsi
@@ -6,12 +6,19 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
+#include <arm/am33xx.dtsi>
/ {
aliases {
+ gpio0 = &gpio0;
+ gpio1 = &gpio1;
+ gpio2 = &gpio2;
+ gpio3 = &gpio3;
+ mmc0 = &mmc1;
+ mmc1 = &mmc2;
+ spi0 = &spi0;
/delete-property/ i2c1;
/delete-property/ i2c2;
- /delete-property/ mmc2;
/delete-property/ d_can0;
/delete-property/ d_can1;
};
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* [PATCH 2/2] ARM: dts: am33xx.dtsi: Add spi aliases
From: Teresa Remmet @ 2016-10-21 9:45 UTC (permalink / raw)
To: barebox
In-Reply-To: <1477043141-27884-1-git-send-email-t.remmet@phytec.de>
We need to add the spi aliases to set the bus number correct in
the driver.
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
---
arch/arm/dts/am33xx.dtsi | 2 ++
1 file changed, 2 insertions(+)
diff --git a/arch/arm/dts/am33xx.dtsi b/arch/arm/dts/am33xx.dtsi
index 7ba0a0b..f1ee7b3 100644
--- a/arch/arm/dts/am33xx.dtsi
+++ b/arch/arm/dts/am33xx.dtsi
@@ -18,5 +18,7 @@
mmc0 = &mmc1;
mmc1 = &mmc2;
mmc2 = &mmc3;
+ spi0 = &spi0;
+ spi1 = &spi1;
};
};
--
1.9.1
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply related
* Re: [PATCH 6/6] fs: squashfs: Do not default on xz
From: Daniel Krüger @ 2016-10-21 8:23 UTC (permalink / raw)
To: Sascha Hauer, Barebox List
In-Reply-To: <20161021065124.7328-6-s.hauer@pengutronix.de>
Hi Sascha,
I tried this patch series, because I need Squashfs zlib support.
I get the following output during configuration/build:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
scripts/kconfig/conf --silentoldconfig Kconfig
lib/lzo/Kconfig:1:error: recursive dependency detected!
lib/lzo/Kconfig:1: symbol LZO_DECOMPRESS is selected by SQUASHFS_LZO
fs/squashfs/Kconfig:49: symbol SQUASHFS_LZO depends on LZO_DECOMPRESS
lib/Kconfig:21:error: recursive dependency detected!
lib/Kconfig:21: symbol XZ_DECOMPRESS is selected by SQUASHFS_XZ
fs/squashfs/Kconfig:63: symbol SQUASHFS_XZ depends on XZ_DECOMPRESS
lib/Kconfig:9:error: recursive dependency detected!
lib/Kconfig:9: symbol ZLIB is selected by SQUASHFS_ZLIB
fs/squashfs/Kconfig:24: symbol SQUASHFS_ZLIB depends on ZLIB
lib/Kconfig:17:error: recursive dependency detected!
lib/Kconfig:17: symbol LZ4_DECOMPRESS is selected by SQUASHFS_LZ4
fs/squashfs/Kconfig:35: symbol SQUASHFS_LZ4 depends on LZ4_DECOMPRESS
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
cu,
Daniel
Am 21.10.2016 um 08:51 schrieb Sascha Hauer:
> The default compression algorithm for squashfs is zlib, so only
> do a 'default y' there. For xz change to 'default y if the algorithm
> is enabled anyway' likke the other compression algorithms do.
>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> fs/squashfs/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/squashfs/Kconfig b/fs/squashfs/Kconfig
> index 2e28e90..b84ef75 100644
> --- a/fs/squashfs/Kconfig
> +++ b/fs/squashfs/Kconfig
> @@ -60,7 +60,7 @@ config SQUASHFS_LZO
>
> config SQUASHFS_XZ
> bool "Include support for XZ compressed file systems"
> - default y
> + default y if XZ_DECOMPRESS
> depends on FS_SQUASHFS
> select XZ_DECOMPRESS
> help
>
--
SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Telefon : +49 (0) 3765 38600-0
Fax : +49 (0) 3765 38600-4100
Email : daniel.krueger@systec-electronic.com
Website : http://www.systec-electronic.com
Managing Directors :
Dipl.-Phys. Siegmar Schmidt, Dipl. Ing. (FH) Armin von Collrepp
Commercial registry : Amtsgericht Chemnitz, HRB 28082
USt.-Id Nr. : DE150534010
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: Compressed DTB - builtin DTB
From: Daniel Krüger @ 2016-10-21 8:16 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox
In-Reply-To: <20161014095219.6qsyhajp2bffsc64@pengutronix.de>
Hi Sascha,
Am 14.10.2016 um 11:52 schrieb Sascha Hauer:
>
> No, indeed that's not intended. Could you test the appended patch? It
> should solve this.
Thanks. The patch works for me.
>> Just using the compressed DTB would be really good. Because it makes the
>> image much smaller. However, how should that be done? The extract code might
>> be simple. But I don't have an idea how to let the linker select the right
>> version.
>
> If you are using uncompressed binary you should switch to PBL support to
> get a compressed binary. Then, if you are using PBL the dtb is
> compressed already as part of the whole binary.
I will try that.
Best regards,
Daniel
--
SYS TEC electronic GmbH
Am Windrad 2
08468 Heinsdorfergrund
Telefon : +49 (0) 3765 38600-0
Fax : +49 (0) 3765 38600-4100
Email : daniel.krueger@systec-electronic.com
Website : http://www.systec-electronic.com
Managing Directors :
Dipl.-Phys. Siegmar Schmidt, Dipl. Ing. (FH) Armin von Collrepp
Commercial registry : Amtsgericht Chemnitz, HRB 28082
USt.-Id Nr. : DE150534010
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: Loading kernel issues
From: Javier Fileiv @ 2016-10-21 8:11 UTC (permalink / raw)
To: Sascha Hauer; +Cc: barebox, Juergen Borleis
In-Reply-To: <20161021080728.4i3bulijw7wtxdqs@pengutronix.de>
I thought that, by default, the NOR bootloader was setting it's config
files in NOR as well. But it seems that both bootloader are getting
the same config file.
I will switch to NOR, short the two right data lines, short them,
start the mini board. And at that point I will change back the
/env/config file. After that will re build barebox with that lines you
told me, commented out. And re flash barebox to NOR!
Thank you very much guys, will tell you my advance.
2016-10-21 10:07 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>:
> On Fri, Oct 21, 2016 at 09:53:45AM +0200, Juergen Borleis wrote:
>> Hi Javier,
>>
>> On Friday 21 October 2016 09:41:15 Javier Fileiv wrote:
>> > I was looking to buy an ARM9 Jtag because it's what I
>> > though... I would need a JTAG.
>> >
>> > Regarding shorting the data lines... do you know exactly what would I
>> > need to do?
>>
>> Reading the datasheet of the used NAND device, find its datalines, find them on
>> the Mini2440, configure the board to boot from NOR, short two of the eight
>> datalines and power the board.
>
> The best would be to find two which are exactly next to each other so
> you can short circuit them with a knitting needle or similar.
>
> When you flash a new barebox to NOR flash make sure you flash one that
> doesn't get its environment from NAND, so comment out the following
> lines in the board file:
>
> devfs_del_partition("env_raw");
> devfs_add_partition("nand0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env_raw");
> dev_add_bb_dev("env_raw", "env0");
>
> Sascha
>
> --
> Pengutronix e.K. | |
> Industrial Linux Solutions | http://www.pengutronix.de/ |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
> Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: Loading kernel issues
From: Sascha Hauer @ 2016-10-21 8:07 UTC (permalink / raw)
To: Juergen Borleis; +Cc: barebox, Javier Fileiv
In-Reply-To: <201610210953.45417.jbe@pengutronix.de>
On Fri, Oct 21, 2016 at 09:53:45AM +0200, Juergen Borleis wrote:
> Hi Javier,
>
> On Friday 21 October 2016 09:41:15 Javier Fileiv wrote:
> > I was looking to buy an ARM9 Jtag because it's what I
> > though... I would need a JTAG.
> >
> > Regarding shorting the data lines... do you know exactly what would I
> > need to do?
>
> Reading the datasheet of the used NAND device, find its datalines, find them on
> the Mini2440, configure the board to boot from NOR, short two of the eight
> datalines and power the board.
The best would be to find two which are exactly next to each other so
you can short circuit them with a knitting needle or similar.
When you flash a new barebox to NOR flash make sure you flash one that
doesn't get its environment from NAND, so comment out the following
lines in the board file:
devfs_del_partition("env_raw");
devfs_add_partition("nand0", 0x40000, 0x20000, DEVFS_PARTITION_FIXED, "env_raw");
dev_add_bb_dev("env_raw", "env0");
Sascha
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
* Re: Loading kernel issues
From: Juergen Borleis @ 2016-10-21 8:05 UTC (permalink / raw)
To: Javier Fileiv; +Cc: barebox
In-Reply-To: <CABvwO2A6_mU3DzbWp9p=9NcvWeZGpni8GPL7x0qaLT2K1vXaog@mail.gmail.com>
Hi Javier,
On Friday 21 October 2016 09:54:04 Javier Fileiv wrote:
> shoul I short them between them, short them to GND or
> short them to VDD?
"short two of them" means between them. D2 and D3 for example...
Cheers,
Juergen
--
Pengutronix e.K. | Juergen Borleis |
Industrial Linux Solutions | http://www.pengutronix.de/ |
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox