platform/kernel/u-boot.git
21 months agosamsung: tizen_amlogic: increase ramdisk size from 8M to 32M 43/278543/1 accepted/tizen_6.5_unified tizen_6.5 accepted/tizen/6.5/unified/20220726.012259 submit/tizen_6.5/20220725.010945
Jaehoon Chung [Wed, 20 Jul 2022 09:25:55 +0000 (18:25 +0900)]
samsung: tizen_amlogic: increase ramdisk size from 8M to 32M

Increase ramdisk size from 8M to 32M.

Change-Id: Ie36d169d0e815ce6a0a0b671de80a6616b9af73c
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
(cherry picked from commit f7bbf12c713eb0e7cb2514992d2370937b9a1d9a)

22 months agotizen: rpi: add a partition_ab bootargs 45/276245/1 accepted/tizen/6.5/unified/20220616.141740 submit/tizen_6.5/20220616.003034
Jaehoon Chung [Mon, 13 Jun 2022 09:26:05 +0000 (18:26 +0900)]
tizen: rpi: add a partition_ab bootargs

Add a partition_ab bootargs and set to "a" by default.

Change-Id: Id61ca9f3dd7950a622c5861439841cdb7deec3ac
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
22 months agotizen: bootscript: rpi4: remove mbr_check 08/276208/1
Jaehoon Chung [Mon, 13 Jun 2022 01:00:28 +0000 (10:00 +0900)]
tizen: bootscript: rpi4: remove mbr_check

Remove mbr_check to check whether the correct partition layout is used
or not. When A/B partition will be supported, the backward compatibility
will be blocked.

Change-Id: Id8fe182a4f29025a43d3e869f3ef11a874399b5b
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
23 months agoconfigs: rpi_4: disable USB_STORAGE configuration 47/275247/1 accepted/tizen/6.5/unified/20220520.140014 submit/tizen_6.5/20220519.064808
Jaehoon Chung [Thu, 19 May 2022 04:48:14 +0000 (13:48 +0900)]
configs: rpi_4: disable USB_STORAGE configuration

Disable USB_STORAGE configuration to prevent some crash.
It needs to fix original cause in future.

Change-Id: I4438720d15215b57cb41fdcf817bd8f8b11b5873
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agopci: brcmstb: Cleanup controller state before handover 55/267755/3 accepted/tizen/6.5/unified/20211213.212334 submit/tizen_6.5/20211213.042338
Nicolas Saenz Julienne [Thu, 14 Jan 2021 15:49:01 +0000 (16:49 +0100)]
pci: brcmstb: Cleanup controller state before handover

Make sure we handover the PCIe controller in a clean state. Some of the
devices hanging from the PCIe bus might need to be properly reset
through #PERST in order for Linux to be able to initialize them.

This is specially important in order to properly initialize Raspberry Pi
4 B and 400's USB chip.

Change-Id: I1650975684d3c0315dac4dfe44f58f33e78ba0ad
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Signed-off-by: Matthias Brugger <mbrugger@suse.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agovideo: arm: rpi: Add brcm,bcm2711-hdmi0 compatible 54/267754/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:31 +0000 (13:55 +0100)]
video: arm: rpi: Add brcm,bcm2711-hdmi0 compatible

The 'brcm,bcm2711-hdmi0' compatible string is used on RPi4 instead of
'brcm,bcm2835-hdmi' since the IP core was upgraded (now called VC6
instead of VC4). This has no functional change as far as u-boot driver
is concerned. So simply add the compatible string.

Change-Id: Icbcb9eaa22108bf8051628b3aa2f7bafb64e04c5
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agommc: sdhci: move the ADMA2 table handling into own module 44/267744/3
Michael Walle [Wed, 23 Sep 2020 10:42:51 +0000 (12:42 +0200)]
mmc: sdhci: move the ADMA2 table handling into own module

There are other (non-SDHCI) controllers which supports ADMA2 descriptor
tables, namely the Freescale eSDHC. Instead of copying the code, move it
into an own module.

Change-Id: Ibe27ea037e28efeeb6ae09c9a4e6e838c478473c
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agommc: Introduce mmc_phys_to_bus()/mmc_bus_to_phys() 52/267752/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:29 +0000 (13:55 +0100)]
mmc: Introduce mmc_phys_to_bus()/mmc_bus_to_phys()

This will allow us to use DM variants of phys_to_bus()/bus_to_phys()
when relevant.

Change-Id: I09330b798d379fbf1045017fac87dfc7507ebdbb
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoxhci: translate virtual addresses into the bus's address space 51/267751/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:28 +0000 (13:55 +0100)]
xhci: translate virtual addresses into the bus's address space

So far we've been content with passing physical addresses when
configuring memory addresses into XHCI controllers, but not all
platforms have buses with transparent mappings. Specifically the
Raspberry Pi 4 might introduce an offset to memory accesses incoming
from its PCIe port.

Introduce xhci_virt_to_bus() and xhci_bus_to_virt() to cater with these
limitations, and make sure we don't break non DM users.

Change-Id: Ifde02ea1633e2fb741793b95102a9ce866028921
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agousb: xhci: Fix compare to use physical addresses in xhci_bulk_tx() 74/267874/2
Stefan Roese [Fri, 15 Jan 2021 07:52:56 +0000 (08:52 +0100)]
usb: xhci: Fix compare to use physical addresses in xhci_bulk_tx()

Testing with v2021.01 on MIPS Octeon has shown, that the latest patch
for the "short packet event trb handling" did introduce a bug on
platforms with virtual address != physical address. This patch fixes
this issue by using the correct address types in the compare (both
physical in this case).

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Aaron Williams <awilliams@marvell.com>
Cc: Chandrakala Chavva <cchavva@marvell.com>
Cc: Ran Wang <ran.wang_1@nxp.com>
Cc: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Cc: Marek Vasut <marex@denx.de>
Cc: Bin Meng <bmeng.cn@gmail.com>
[backport of mainline commit cec804251d4b4765bbcaa207f4c931fef350585e]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ia5cd6ce705e4b5f330a2bdae70efa0546562df51

2 years agousb: xhci: fix lack of short packet event trb handling 73/267873/2
Ran Wang [Wed, 18 Nov 2020 07:49:02 +0000 (15:49 +0800)]
usb: xhci: fix lack of short packet event trb handling

For bulk IN transfer, the codes will set ISP flag to request event TRB
being generated by xHC for the case of short packet. So when encountering
buffer-cross-64K-boundary (which we will divide payload and enqueuqe
more than 1 transfer TRB), and the first TRB ends up with a short packet
condition it will trigger an short packet code transfer event per that
flag and cause more than 1 event TRB generated for this transfer.

However, current codes will only handle the first transfer event TRB
then mark current transfer completed, causing next transfer
failure due to event TRB mis-match.

Such issue has been observed on some Layerscape platforms (LS1028A,
LS1088A, etc) with USB ethernet device.

This patch adds a loop to make sure the event TRB for last transfer TRB
has been handled in time.

Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
[backport of mainline commit 621ed49d3a2ea3c45be1cf774bef48439bd566f3]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I96681cfacd51d94c70170f397402f5956bea0ee4

2 years agousb: xhci: avoid type conversion of void * 72/267872/2
Heinrich Schuchardt [Tue, 29 Sep 2020 20:03:01 +0000 (22:03 +0200)]
usb: xhci: avoid type conversion of void *

void * can be assigned to any pointer variable. Avoid unnecessary
conversions.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
[backport of mainline commit 3fade88686e71c9acee4cbeb3ae9706bbc845608]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I66ed937f1331ff1ea4c1df6b594a997efc26db01

2 years agoconfigs: rpi4: Enable DM_DMA across all RPi4 configurations 53/267753/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:30 +0000 (13:55 +0100)]
configs: rpi4: Enable DM_DMA across all RPi4 configurations

The DM_DMA option is needed in order to translate physical address into
bus addresses on a per-device basis.

Change-Id: Idee7f8c9f0fb0e7f95e66f3adf7ef2cceb2eca40
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agodm: Introduce dev_phys_to_bus()/dev_bus_to_phys() 50/267750/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:26 +0000 (13:55 +0100)]
dm: Introduce dev_phys_to_bus()/dev_bus_to_phys()

These functions, instead of relying on hard-coded platform-specific
address translations, make use of the DMA constraints provided by the DM
core. This allows for per-device translations.

We can't yet get rid of the legacy phys_to_bus()/bus_to_phys()
implementations as some of its users are not integrated into the
device model.

Change-Id: I4a0ecc27763855d54c13dc99b5c7fcd39a20d969
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agodm: Introduce DMA constraints into the core device model 49/267749/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:24 +0000 (13:55 +0100)]
dm: Introduce DMA constraints into the core device model

Calculating the DMA offset between a bus address space and CPU's every
time we call phys_to_bus() and bus_to_phys() isn't ideal performance
wise, as it implies traversing the device tree from the device's node up
to the root. Since this information is static and available before the
device's initialization, parse it before the probe call an provide the
DMA offset in 'struct udevice' for the address translation code to use
it.

Change-Id: Id3792aa7a31cc13a38fa44b79d9df7c8eddccaf0
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agodm: Introduce xxx_get_dma_range() 48/267748/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:22 +0000 (13:55 +0100)]
dm: Introduce xxx_get_dma_range()

Add the following functions to get a specific device's DMA ranges:
 - dev_get_dma_range()
 - ofnode_get_dma_range()
 - of_get_dma_range()
 - fdt_get_dma_range()
They are specially useful in oder to be able validate a physical address
space range into a bus's and to convert addresses from and to address
spaces.

Change-Id: Ib15b8a346390bf698dbc274f58ae646ba0fd6711
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Simon Glass <sjg@chromium.org>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agopci: pcie-brcmstb: Fix inbound window configurations 47/267747/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:21 +0000 (13:55 +0100)]
pci: pcie-brcmstb: Fix inbound window configurations

So far we've assumed a fixed configuration for inbound windows as we had
a single user for this controller. But the controller's DMA constraints
were improved starting with BCM2711's B1 revision of the SoC, notably
available in CM4 and Pi400. They allow for wider inbound windows. We can
now cover the whole address space, whereas before we where limited to
the lower 3GB.

This information is passed to us through DT's 'dma-ranges' property and
it's specially important for us to honor it since some interactions with
the board's co-processor assume we're doing so (specifically the XHCI
firmware load operation, which is handled by the co-processor after
u-boot has correctly configured the PCIe controller).

Change-Id: Ic4a66168064c67222d3d32ade482b2a76bbc0a4e
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agorpi: Add identifier for the new CM4 46/267746/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:20 +0000 (13:55 +0100)]
rpi: Add identifier for the new CM4

The Raspberry Pi Foundation released the new Compute Module 4 which we
want to detect, so we can enable Ethernet on it and know the correct
device tree file name.

Note that this sets the Ethernet option to true since the official CM4
IO board has an Ethernet port. But that might not be the case when using
custom ones.

Change-Id: If1fd357629d5e4509a2067291ffeae9251db5517
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agorpi: Add identifier for the new RPi400 45/267745/3
Nicolas Saenz Julienne [Tue, 12 Jan 2021 12:55:19 +0000 (13:55 +0100)]
rpi: Add identifier for the new RPi400

The Raspberry Pi Foundation released the new RPi400 which we want to
detect, so we can enable Ethernet on it and know the correct device tree
file name.

Change-Id: Id1b91e2c11fb8a8e7a52e33379e35a7f53588b4b
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Reviewed-by: Peter Robinson <pbrobinson@gmail.com>
Tested-by: Peter Robinson <pbrobinson@gmail.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agotizen: rpi4: use fdt already preloaded by the firmware 43/267743/3
Marek Szyprowski [Mon, 22 Nov 2021 11:29:39 +0000 (12:29 +0100)]
tizen: rpi4: use fdt already preloaded by the firmware

RPi4's firmware loads dtb and performs some fixups depending on the board
hardware revision. Simply reuse the fdt preloaded by the firmware instead
of loading it again from disk.

Change-Id: I6918f253552c5eaf3b2e2650091b9014a9d5784d
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agosamsung: tizen_rpi: change a hal partition size in mbr_check 39/262539/1 accepted/tizen/6.5/unified/20211028.120045 accepted/tizen/unified/20210817.123211 submit/tizen/20210813.054027 submit/tizen_6.5/20211028.163201 submit/tizen_6.5/20211104.014156 tizen_6.5.m2_release
Jaehoon Chung [Fri, 13 Aug 2021 04:33:44 +0000 (13:33 +0900)]
samsung: tizen_rpi: change a hal partition size in mbr_check

Change a hal partition size in mbr_check.
It doesn't affect to check a real size, but it needs to share correct
information.

Change-Id: Iaa792f38c8fde924f6ad1179ed5949f1a2de0885
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoscript: tizen: sd_fusing_rpi3: increase a hal partition size to 256M 87/262487/1
Jaehoon Chung [Thu, 12 Aug 2021 02:55:05 +0000 (11:55 +0900)]
script: tizen: sd_fusing_rpi3: increase a hal partition size to 256M

Increase a hal partition size from 64M to 256M.

Change-Id: I650f2a5f7d946a6d5b251d7c5682b78afa8dd78f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
2 years agoARM: bcm283x: change the virtual address of the XHCI PCI device base 99/259999/1 accepted/tizen/unified/20210621.123021 submit/tizen/20210621.022000
Marek Szyprowski [Thu, 17 Jun 2021 08:57:02 +0000 (10:57 +0200)]
ARM: bcm283x: change the virtual address of the XHCI PCI device base

Move the XHCI PCI device base up in the virtual address space. This fixes
initialization failure observed on newer Raspberry Pi firmware (later
than 63b1922311 ("firmware: arm_loader: Update armstubs with those from
PR 117). It looks that chosing 0xff800000 as the XHCI PCI device base
conflicts with the updated ARM/VideoCore firmware.

This also requires to reduce the size of the mapped PCI device region
from 8MiB to 4MiB to fit into 32bit address space.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ie4423bf47269492dc5a4198dadf820600980ed8e

2 years agosamsung: tizen_amlogic: fix wrong dfu_info 96/259596/1 accepted/tizen/unified/20210611.014702 submit/tizen/20210610.055703
Jaehoon Chung [Thu, 10 Jun 2021 05:50:15 +0000 (14:50 +0900)]
samsung: tizen_amlogic: fix wrong dfu_info

Fix wrong dfu_info without ";".

Change-Id: Iefbb1ffb43ee10e17977935e16618f7fc353f34d
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoscripts: tizen: sd_fusing: umount block part only when mounted 01/256401/1 accepted/tizen/unified/20210412.012052 submit/tizen/20210409.001625
Seung-Woo Kim [Fri, 2 Apr 2021 02:28:48 +0000 (11:28 +0900)]
scripts: tizen: sd_fusing: umount block part only when mounted

The umount command is used without checking the block part is
really mounted. Umount part only when mounted.

The series for cleaning up fusing script is done, so bump up
minor version instead of sub version.

Change-Id: Ic665936838be4529973d63c6123db9a2c7acc7d7
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing: Fix to check file existence 00/256400/1
Seung-Woo Kim [Fri, 2 Apr 2021 02:14:04 +0000 (11:14 +0900)]
scripts: tizen: sd_fusing: Fix to check file existence

The script can be executed with absent file. Fix to check
file existence.

Change-Id: I2409c73a5dcf4ca011e029b2e3fca9525cd6026a
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing: Fix error only with -b option 99/256399/1
Seung-Woo Kim [Fri, 2 Apr 2021 01:55:52 +0000 (10:55 +0900)]
scripts: tizen: sd_fusing: Fix error only with -b option

If there is only -b option without real binary name, there was
error. Fix the error only with -b option.

Change-Id: I4affff4ae5f567b81601727f33161251db2457c3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing: Adjust log print 48/256248/2
Seung-Woo Kim [Wed, 31 Mar 2021 07:40:22 +0000 (16:40 +0900)]
scripts: tizen: sd_fusing: Adjust log print

Show with proper tab indent for partition table when formatting
and show default behavior from warnning about format.

Change-Id: I36aac38f40780cf936a450c8f083c5ec1f207e6c
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing: Use array for partition information 70/256170/2
Seung-Woo Kim [Tue, 30 Mar 2021 07:40:27 +0000 (16:40 +0900)]
scripts: tizen: sd_fusing: Use array for partition information

Use array for partition information to remove duplication.

Change-Id: I6a8c5e3921cda24dc075321dcd5383dfda64149b
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing_rpi3.sh: Add flashing hal.img 64/256264/1
Seung-Woo Kim [Wed, 31 Mar 2021 11:31:57 +0000 (20:31 +0900)]
scripts: tizen: sd_fusing_rpi3.sh: Add flashing hal.img

As like dfu information of tizen_rpi, add flashing hal.img.

Change-Id: Ibfc26456dd6bf3a56df25573b9fb7b5f05d38dee
Ref: commit 9809b292e7c3 ("samsung: tizen_rpi: add hal.img in dfu information")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing_rpi3.sh: Change variable name properly 69/256169/1
Seung-Woo Kim [Tue, 30 Mar 2021 07:33:05 +0000 (16:33 +0900)]
scripts: tizen: sd_fusing_rpi3.sh: Change variable name properly

The variable names, COL and ROW are used crossly from meaning.
Change the variable name properly.

Change-Id: If0ea313d2a275baf2c23261b2145141d2d79c276
Ref: commit 5dacf71810d7 ("scripts: odroid-xu4: remove non-necessary FUSE struct")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoscripts: tizen: sd_fusing: Use only part type from block device for fusing 32/256132/3
Seung-Woo Kim [Tue, 30 Mar 2021 02:14:30 +0000 (11:14 +0900)]
scripts: tizen: sd_fusing: Use only part type from block device for fusing

Current block device parsing result gives both disk and part
types of block device and this can break parsing 1st partition
for "mmcblk1" case. Use only part type from block device for
fusing when flashing partition image.

Change-Id: I0ca393fd5ecd26d77939f16c9c412d00d18cb912
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agopackaging: update u-boot git repository url 77/254377/1 sandbox/songinha/upstream
Jaehoon Chung [Mon, 1 Mar 2021 22:50:05 +0000 (07:50 +0900)]
packaging: update u-boot git repository url

Update u-boot git repository URL from git.denx.de
to source.denx.de.

Change-Id: Ib9645ae340d9d0c45546baa0bc819d2ca1a1e395
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoboard: amlogic: odroid: add runtime detection of the N2/N2+/C4/HC4 variants 74/253074/4 accepted/tizen/unified/20210210.052157 submit/tizen/20210209.230141
Marek Szyprowski [Wed, 3 Feb 2021 14:36:14 +0000 (15:36 +0100)]
board: amlogic: odroid: add runtime detection of the N2/N2+/C4/HC4 variants

Use the ADC channel 1 to check the hardware revision of the board and
detect the N2 vs. N2+ and the C4 vs. HC4 variants. Each of them use
different dtb file, so adjust fdtfile environment variable to the
detected variant.

The ADC min/max values for each variant are taken from the vendor code,
adjusted to the 12-bit ADC driver operation mode (vendor code use 10-bit
mode).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I702a531c24b0fa9bdc1618defa1e0cc2b55c81c5

3 years agosamsung: tizen_amlogic: add support for optional mainline kernel boot 64/252964/2
Marek Szyprowski [Wed, 3 Feb 2021 08:35:48 +0000 (09:35 +0100)]
samsung: tizen_amlogic: add support for optional mainline kernel boot

Add support for optional mainline Linux kernel and DTBs. This requires
adjusting DTB file nameand console kernel cmdline parameters.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I977ec72596ddded6ed961ce0709ab40612682168

3 years agosamsung: tizen_amlogic: Use only meson64_odroidn2.dtb for OdroidN2 boards 20/253220/1
Marek Szyprowski [Fri, 5 Feb 2021 13:58:20 +0000 (14:58 +0100)]
samsung: tizen_amlogic: Use only meson64_odroidn2.dtb for OdroidN2 boards

Switch OdroidN2 board to use meson64_odroidn2.dtb. For Tizen, the DRM
subsystem is enabled for the all Amlogic boards, so there is no need to
have separate dtb with the DRM enabled for OdroidN2 board.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ie44445f950c8ffe1663ce8997dc5b15c7e0aaf79

3 years agotizen: amlogic: remove obsolete TIZEN_AMLOGIC_USE_VENDOR_KERNEL option 63/252963/1
Marek Szyprowski [Wed, 3 Feb 2021 07:20:23 +0000 (08:20 +0100)]
tizen: amlogic: remove obsolete TIZEN_AMLOGIC_USE_VENDOR_KERNEL option

After a fix to vendor kernel, the workaround enabled by the
TIZEN_AMLOGIC_USE_VENDOR_KERNEL option is no longer needed.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ie83030aa131779965ca09fcd8603b27b0d8fc87f

3 years agosamsung: tizen_amlogic: improve messages on boot 62/252962/1
Marek Szyprowski [Wed, 3 Feb 2021 07:11:29 +0000 (08:11 +0100)]
samsung: tizen_amlogic: improve messages on boot

Show proper button name while checking THOR download mode and change
'reboot' to 'reboot reason' to make it clear what it is being checked.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I543b020ea3a9ae3459f7a57d07db410945f45676

3 years agorpi: limit size of the RAM to the multiple of the MMU_SECTION_SIZE 06/252606/2 accepted/tizen/unified/20210207.235255 submit/tizen/20210205.105645
Marek Szyprowski [Mon, 1 Feb 2021 10:53:07 +0000 (11:53 +0100)]
rpi: limit size of the RAM to the multiple of the MMU_SECTION_SIZE

When RPi4 is booted from USB Mass Storage, the firmware reports 947MiB of
the ARM memory (948 in case of the standard SD-card boot). This value is
not MMU_SECTION_SIZE aligned, so the dram_bank_mmu_setup() skips mapping
of the last 1MiB. This later causes u-boot in ARM 32bit mode to freeze,
because it relocated itself into that unmapped memory and fails to
execute.

Fix this by limiting the size of the first bank to the multiple of
MMU_SECTION_SIZE.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I9734e7a3a2b791afff211f57eb872f99bf6f2672

3 years agorpi: use board_early_init_r to init PCI/USB and detect boot device 05/252605/1
Marek Szyprowski [Fri, 29 Jan 2021 12:03:03 +0000 (13:03 +0100)]
rpi: use board_early_init_r to init PCI/USB and detect boot device

Move initialization of the PCI and the USB subsystems from the 'preboot'
command to the board's early_init_r() function and then try to detect a
boot device by accessing the MMC0 device. If it works, then set boot
device interface to 'mmc', if not, use 'usb'.

This allows the environment variales to be loaded from the proper
storage interface.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Idf06ba827167479510206587308875c8eedce892

3 years agoenv: fat: allow to dynamically set storage interface 04/252604/1
Marek Szyprowski [Fri, 29 Jan 2021 12:01:31 +0000 (13:01 +0100)]
env: fat: allow to dynamically set storage interface

Add support for setting the FAT env storage interface dynamically by
defining board's own env_fat_get_interface() function.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I80eef53b9adff942524061c5a8be1bb583fea21f

3 years agotizen: rpi: add temporary workaround for usb boot 56/252456/2
Marek Szyprowski [Thu, 28 Jan 2021 10:08:57 +0000 (11:08 +0100)]
tizen: rpi: add temporary workaround for usb boot

rootfs on USB device requires a bit more time to initialize and it is
probed asynchronously. This might happen after the initramfs is mounted
and init started, so add 2 seconds delay in case of USB boot to let
initramfs to detect the rootfs.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If4c1f12bd556ee3811b035c403ce832cf16c940b

3 years agotizen: rpi: move MBR check to tizen-boot-rpi{3,4}.scr 55/252455/2
Marek Szyprowski [Thu, 28 Jan 2021 08:55:49 +0000 (09:55 +0100)]
tizen: rpi: move MBR check to tizen-boot-rpi{3,4}.scr

Move the MBR check to tizen-boot-rpi{3,4}.scr and adjust it to the
optional USB boot. User request is changed to 'Press ENTER to continue'
if verify fails to allow script continuation.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I45e530d63c449a21b4befbfeee0d55551d95b3c4

3 years agotizen: rpi: adjust commands to the optional usb boot 11/252411/2
Marek Szyprowski [Wed, 27 Jan 2021 22:01:15 +0000 (23:01 +0100)]
tizen: rpi: adjust commands to the optional usb boot

Properly set and use $bootdev instead of mmc to support optional usb boot
in the future.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib09bf36ade9062634f11538607768f65c2f6fc80

3 years agosamsung: tizen_amlogic: use 'reserved1' partition for HAL 11/252311/1 accepted/tizen/unified/20210201.055424 submit/tizen/20210201.023843
Marek Szyprowski [Tue, 26 Jan 2021 11:11:59 +0000 (12:11 +0100)]
samsung: tizen_amlogic: use 'reserved1' partition for HAL

Use the 'reserved1' (64M) partition for the Tizen HAL partition image and
adjust the name of the remaining reserved partitions.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ieb879e48d55e7c25b3cf29bbd522cab22162ccbf

3 years agosamsung: tizen_rpi: check MBR partition layout from preboot 07/252107/2 accepted/tizen/unified/20210126.141625 submit/tizen/20210126.025856
Marek Szyprowski [Fri, 22 Jan 2021 10:24:04 +0000 (11:24 +0100)]
samsung: tizen_rpi: check MBR partition layout from preboot

Verify if the MBR partition layout on SD card matches the one defined in
the bootloader.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I7c296a4f64e294a9dc510e0a248e83375bacf9cb

3 years agosamsung: tizen_rpi: remove support for the obsolete files 63/252063/3
Marek Szyprowski [Thu, 21 Jan 2021 15:21:11 +0000 (16:21 +0100)]
samsung: tizen_rpi: remove support for the obsolete files

Remove no longer used 'u-boot.img' and 'optee.bin' images from the 'boot'
partition and dfu_alt_info image list.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Iaecb24070f80bb8860dc7c1faebff2cf6b2d1581

3 years agosamsung: tizen_rpi: make 'dfu_alt_info' static 62/252062/3
Marek Szyprowski [Tue, 17 Nov 2020 10:16:28 +0000 (11:16 +0100)]
samsung: tizen_rpi: make 'dfu_alt_info' static

The data layout on the storage device is the same all the time for RPi3/4
boards and fully known during the compile time. Use this simple approach,
which is a bit more error proof for future changes. It also obsoletes the
custom code added to RPi boards.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I8f7211cdde50701418464419b774aeecc795efa1

3 years agosamsung: tizen_rpi: add support for the MBR command 61/252061/3
Marek Szyprowski [Thu, 21 Jan 2021 14:52:05 +0000 (15:52 +0100)]
samsung: tizen_rpi: add support for the MBR command

Enable recently added 'mbr' command and define MBR partition table layout
based on the values from the current sd_fusing_rpi3.sh script.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I25e44f10365f95624cf6b85e09962671cf0c12c0

3 years agocmd: misc: Fix return value for sleep command 06/252106/2
Marek Szyprowski [Fri, 22 Jan 2021 10:43:35 +0000 (11:43 +0100)]
cmd: misc: Fix return value for sleep command

If sleeping has been interrupted, return CMD_RET_FAILURE instead of -1
(CMD_RET_USAGE).

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ieec0d9552770aed06b405fa83fff0bc4f762285f

3 years agoscripts: tizen: sd_fusing_rpi3: rename 'RESERVED1' to 'HAL' 93/252193/1
Marek Szyprowski [Mon, 25 Jan 2021 08:48:31 +0000 (09:48 +0100)]
scripts: tizen: sd_fusing_rpi3: rename 'RESERVED1' to 'HAL'

10th partition is used for HAL partition image, so use that name instead
of the 'RESERVED1'.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I3db5acd3a16954b7af4721c28223373f6ccc5aef

3 years agoscripts: tizen: sd_fusing_rpi3: fix size of the RESERVED2 partition 92/252192/1
Marek Szyprowski [Mon, 25 Jan 2021 08:42:32 +0000 (09:42 +0100)]
scripts: tizen: sd_fusing_rpi3: fix size of the RESERVED2 partition

Older version of sd_fusing_rpi3.sh script had a bug, which results in
reduced size of the RESERVED2 partition to 125.5M instead of 128M. Adjust
the size of the RESERVED2 partition to 125M after the fixing sd_fusing
script to avoid further confusion, especially with the upcoming MBR
layout validation in the u-boot.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I41baf2e626aed0473539898b81fe809b4f7256b8

3 years agoscripts: tizen: sd_fusing_rpi3: adjust extended partition size calculation 05/252105/2
Marek Szyprowski [Fri, 22 Jan 2021 10:57:03 +0000 (11:57 +0100)]
scripts: tizen: sd_fusing_rpi3: adjust extended partition size calculation

With so many partitions defined (currently 11), the extended partition
has to be larger regardless the sfdisk tool version, otherwise, the last
partition will be smaller than the requested size.

Without this fix, fdisk from util-linux 2.33.1 creates the last partition
of 125,5M instead of 128M.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: Ib4cc3608bc6050b59ece57e803246d465185d65b

3 years agoscript: tizen: remove sd_fusing_amlogic script 46/251746/1
Jaehoon Chung [Tue, 19 Jan 2021 04:45:11 +0000 (13:45 +0900)]
script: tizen: remove sd_fusing_amlogic script

Remove sd_fusing_amlogic script.
Insteade, use 0-format.cmd file that is created from build script.
- ./tizen/build-amlogic.sh all
- It will be created tar file under output directory
- There should be amlogic_format_bootloader.tar.gz
- Use its format_bootloader.tar.gz

Change-Id: I9ef4dceb71d0830ebb2f69380f38d3ff63213bd9
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agosamsung: tizen_amlogic: increase system-data size to 1.3G 45/251745/1
Jaehoon Chung [Tue, 19 Jan 2021 04:44:09 +0000 (13:44 +0900)]
samsung: tizen_amlogic: increase system-data size to 1.3G

Increase system-data size from 512M to 1.3G.

Change-Id: I39398a900260eca7fd96d232ea95dc348a593804
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoconfigs: rpi4: disable CONFIG_USB_KEYBOARD 70/251670/1 accepted/tizen/unified/20210119.130217 submit/tizen/20210118.100507
Jaehoon Chung [Mon, 18 Jan 2021 09:18:16 +0000 (18:18 +0900)]
configs: rpi4: disable CONFIG_USB_KEYBOARD

It doesn't need to enable CONFIG_USB_KEYBOARD on Tizen.
- It needs to enable USB_KEYBOARD when grub mode is used.

Change-Id: I8c7572d6f903037a9367351422010f72306e252f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoboard: rpi: add print_archinfo to display arch information 59/251559/2
Jaehoon Chung [Fri, 15 Jan 2021 04:27:34 +0000 (13:27 +0900)]
board: rpi: add print_archinfo to display arch information

Current U-boot doesn't display a message about which architecture is
used. So Developer is difficult to know it by intuition.
This patch is displaying to CPU information with CONFIG_SYS_CPU.
- In mainline, it's used to display cpuinfo with CONFIG_DISPLAY_CPUINFO.
  But PRI4 doesn't implement print_cpuinfo(). Instead, display a cpuinfo
  in get_board_rev about RPI4 boards.

In RPI4 case,

U-Boot 2020.10-drity (Jan 15 2021 - 13:24:55 +0900)

DARM:  3.9 GiB
RPI 4 Model B (0xc03111)
CPU: armv7

Change-Id: I485194baa965065f44bac966d014ccfb31b9da60
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoamlogic: vim3: fix MAC address reading code 32/251332/1 accepted/tizen/unified/20210113.121025 submit/tizen/20210112.220723
Marek Szyprowski [Tue, 12 Jan 2021 20:03:16 +0000 (21:03 +0100)]
amlogic: vim3: fix MAC address reading code

It turned out that MAC address is stored in ASCII format in EFUSE, so fix
the code reading it to use ASCII format.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: If3723f3aa8570de04e6e753e958ada624e3482fe

3 years agosamsung: tizen_rpi: add swiotlb value to 8192 on 32bit 01/251201/2 accepted/tizen/unified/20210112.123501 submit/tizen/20210112.000219
Jaehoon Chung [Mon, 11 Jan 2021 07:36:57 +0000 (16:36 +0900)]
samsung: tizen_rpi: add swiotlb value to 8192 on 32bit

When 32bit kernel is booting, kernel is reserving memory for SWIOTLB about
64MB. It seems that doesn't need to use full size.
After set 'swiotlb=8192', SWIOTLB is reserved to 16MB.
Then it can save 48MB memory to use ZONE_DMA.

Change-Id: I1a1659cbff2120da755b14f1b373715bc10027c4
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: support recovery and fota mode 57/251057/1 accepted/tizen/unified/20210108.125921 submit/tizen/20210107.224559
Jaehoon Chung [Thu, 7 Jan 2021 07:54:47 +0000 (16:54 +0900)]
tizen: support recovery and fota mode

Support recovery and fota mode.
It will be entered to recovery or fota mode with value by passed
from reboot command.

Change-Id: Ia7d3c80de2fb28491e6cabfcfb37059e7325f259
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: bootscript: amlogic: support gpio power key for odroid-c4 95/250995/1 accepted/tizen/unified/20210107.123417 submit/tizen/20210106.231623
Seung-Woo Kim [Wed, 6 Jan 2021 10:46:42 +0000 (19:46 +0900)]
tizen: bootscript: amlogic: support gpio power key for odroid-c4

With gpio button, odroid-c4 can support gpio power. Set gpio power
key with PIN_11 from kernel boot_args.

GPIO pins are connected for ELB060675 button as like below:
    - out : PIN_11
    - vcc : PIN_9 (ground)
    - gnd : Not used.

Change-Id: I3aac017fe4a699b8576100cf3ee025a82054ee2d
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoARM: dts: meson: change from ACTIVE_HIGH to ACTIVE_LOW 94/250994/1
Jaehoon Chung [Wed, 6 Jan 2021 10:33:57 +0000 (19:33 +0900)]
ARM: dts: meson: change from ACTIVE_HIGH to ACTIVE_LOW

Whne button doesn't connect, it's always high.
So it needs to fix its case.
In our button's case,
- out : PIN_11
- vcc : GND
- gnd : Not used.

Change-Id: Ic8cf0f5853045cf181ad3c1c53e14e0fceb73b41
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agosamsung: tizen_amlogic: fix build error about not defined BUTTON_LAEBL 79/250979/2
Jaehoon Chung [Wed, 6 Jan 2021 08:20:35 +0000 (17:20 +0900)]
samsung: tizen_amlogic: fix build error about not defined BUTTON_LAEBL

Fix build error about not defined BUTTON_LABEL.

Change-Id: Ifdc916c56c82aaac129ca764d8d501f4c0edcb26
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoconfigs: odroid-c4: support a button download mode 53/250953/2 submit/tizen/20210106.061157
Jaehoon Chung [Wed, 6 Jan 2021 05:10:03 +0000 (14:10 +0900)]
configs: odroid-c4: support a button download mode

Support a button download mode.
If button is pressed, it will be entered to thor mode.

Change-Id: I1c1a4b8ff0d5d8b9b10b277876109b69ce2f02f8
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agosamsung: tizen_amlogic: add button_label variable 52/250952/2
Jaehoon Chung [Wed, 6 Jan 2021 05:08:36 +0000 (14:08 +0900)]
samsung: tizen_amlogic: add button_label variable

Add button_label variable to clarify button about each boards.
- KVIM3(L)  : Function
- Odroid-C4 : PowerKey

Change-Id: I7580cce0c580df14debbe40c48a70f5b6aa532bd
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agoARM: dts: meson: add gpio-keys node to use PowerKey 51/250951/2
Jaehoon Chung [Wed, 6 Jan 2021 05:01:03 +0000 (14:01 +0900)]
ARM: dts: meson: add gpio-keys node to use PowerKey

Add gpio-keys node to use PowerKey.
PowerKey - GPIOX_3 <PIN_11>

Change-Id: I99dae986119d4dc355c02b114a318a727134374c
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: bootscript: rpi3: fix booting issue on 32bit 57/250957/1
Seung-Woo Kim [Wed, 6 Jan 2021 05:50:04 +0000 (14:50 +0900)]
tizen: bootscript: rpi3: fix booting issue on 32bit

For 32bit, it should use bootz, but there was typo. Fix the
booting issue on 32bit.

Change-Id: I98ab0cd8cd88f1998c5dd30d649cfc7c4cf0e495
Fixes: commit 01cd50f4c3af ("tizen: rpi: move bootscripts to tizen specific directory")
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agoconfigs: enable SQUASFS configurations 90/250890/2 accepted/tizen/unified/20210106.123546 submit/tizen/20210106.015723
Jaehoon Chung [Tue, 5 Jan 2021 08:06:27 +0000 (17:06 +0900)]
configs: enable SQUASFS configurations

Enable SQUASHFS configuration about reference targets.
It will be used when checking ramdisk image.

Change-Id: I42adf176d352508836b202fecf81f83a09bafd66
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agofs/squashfs: sqfs_close/sqfs_read_sblk: set ctxt.sblk to NULL after free 89/250889/1
Richard Genoud [Tue, 24 Nov 2020 17:07:52 +0000 (18:07 +0100)]
fs/squashfs: sqfs_close/sqfs_read_sblk: set ctxt.sblk to NULL after free

This will prevent a double free error if sqfs_close() is called twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 7e932ac790b3615a67a3c24041c194aa748c0d98]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I31166f8f9d6ec6d4772e7b51b5d0bb8d20ef1a4b

3 years agofs/squashfs: implement exists() function 88/250888/1
Richard Genoud [Tue, 3 Nov 2020 11:11:26 +0000 (12:11 +0100)]
fs/squashfs: implement exists() function

This permits to find a file and use the distro_bootcmd

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit dd4866b43754b18f0c06672e341d93e16b8bf674]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Idafbcb37c30445e3731d40924f1c43499f149b1a

3 years agofs/squashfs: sqfs_read: remove buggy offset functionality 87/250887/1
Richard Genoud [Tue, 3 Nov 2020 11:11:24 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: remove buggy offset functionality

offset is the offset in the file read, not the offset in the destination
buffer.
If the offset is not null, this will lead to a memory corruption.
So, for now, we are returning an error if the offset is used.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 21b1b3bad58b50e5464b1bf016e7c96bf18ddb8d]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Ie50645e5fcb2f06a21c8f88e16da9b0d1db35cca

3 years agofs/squashfs: sqfs_read: don't write beyond buffer size 86/250886/1
Richard Genoud [Tue, 3 Nov 2020 11:11:23 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: don't write beyond buffer size

The length of the buffer wasn't taken into account when writing to the
given buffer.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit cbd5e40ede4e5c6aedce9475325bdf80b7fa839b]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I14d9af77ac0a2c0d3e52c39824f3854dbbc4d58a

3 years agofs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value 85/250885/1
Richard Genoud [Tue, 3 Nov 2020 11:11:22 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: use sqfs_decompressor_init() return value

sqfs_decompressor_init() returns a value, so it's better to use it than
to force the return value to EINVAL (it could be ENOMEM)

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 6d25bd3e9c1d317cdbd52a4c6bba11f912bb4d6a]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I7fcad9cd4d7ecb4aff6aa353aee78c7aac69a0e6

3 years agofs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error 84/250884/1
Richard Genoud [Tue, 3 Nov 2020 11:11:21 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: reset cur_dev/cur_part_info to NULL on error

Resetting the context on error will prevent some checks like:
if (!ctx.cur_dev)
To pass when the probe method has failed

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 56cf1ceee38435a0c105d40336d12d19e1db8b1d]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I998b1fa2d790bf9618d0d652663edb220a32c610

3 years agofs/squashfs: sqfs_probe: fix possible memory leak on error 83/250883/1
Richard Genoud [Tue, 3 Nov 2020 11:11:19 +0000 (12:11 +0100)]
fs/squashfs: sqfs_probe: fix possible memory leak on error

If SquashFS magic number is invalid, there's a memory leak.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit ccd4c08a452b3703ee16ba730a84b7caadcff97a]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I3be0a354f3407d13902c244580109eb0a9ff71e9

3 years agofs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes 82/250882/1
Richard Genoud [Tue, 3 Nov 2020 11:11:18 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak on finfo.blk_sizes

finfo.blk_sizes may not be freed in case of error in the for loop
Setting it to null and freeing it at the end makes prevents that from
happening.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 571b67ee1dcb989dc50575f14e87bfdef6bfd8db]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I97086373caa5a031f3ba12aa4997de3eab10c530

3 years agofs/squashfs: sqfs_get_abs_path: fix possible memory leak on error 81/250881/1
Richard Genoud [Tue, 3 Nov 2020 11:11:17 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix possible memory leak on error

if  sqfs_tokenize(rel_tokens, rc, rel); fails, the function exits
without freeing the array base_tokens.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 33686804d29e676177d408f1ce047b8c35185ddb]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I377f5aeda3ed3f6b889ce9f9c506629c21f45d3d

3 years agofs/squashfs: sqfs_get_abs_path: fix error check 80/250880/1
Richard Genoud [Tue, 3 Nov 2020 11:11:16 +0000 (12:11 +0100)]
fs/squashfs: sqfs_get_abs_path: fix error check

the return value of sqfs_tokenize(rel_tokens, rc, rel); wasn't checked.
(but "ret" value was !)
This is obviouly a typo.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 53db0e24a8f981c1e303a1c745b8f0e28544096f]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Ib9ff7ebded9de101a0d929414c8ecdf6137e8621

3 years agofs/squashfs: sqfs_frag_lookup: simplify error handling 79/250879/1
Richard Genoud [Tue, 3 Nov 2020 11:11:15 +0000 (12:11 +0100)]
fs/squashfs: sqfs_frag_lookup: simplify error handling

For consistency with other functions.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit c9b8e86f8bd238421b35ec15d88b4d3cac8a0992]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: If6a955583f876fe4399982e58ade2784c2da1b30

3 years agofs/squashfs: sqfs_read: fix another memory leak 78/250878/1
Richard Genoud [Tue, 3 Nov 2020 11:11:14 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix another memory leak

data_buffer was allocated in a loop and freed only once.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 555459e7931f7ae34a4e10d1e21ce7aada7aa59b]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I69dc9bf407d07c7af28f7c3bb1b1b2966f1ee216

3 years agofs/squashfs: sqfs_read: fix memory leak 77/250877/1
Richard Genoud [Tue, 3 Nov 2020 11:11:13 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix memory leak

sqfs_closedir() should be called to free memory allocated by
sqfs_opendir()

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 7ce9745cbeae7733a7068f19a7fc3ec8f21dc38c]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I200f764bb6ce2bb828e2217d1b0f949e1db14597

3 years agofs/squashfs: sqfs_read: remove useless sqfs_closedir() 76/250876/1
Richard Genoud [Tue, 3 Nov 2020 11:11:12 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: remove useless sqfs_closedir()

as sqfs_opendir failed, there's no need to call sqfs_closedir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit b34949fe9baaae49003b2981213495bab3afef9b]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Id61d825b7976f151a77738dadf5c99ba0613d955

3 years agofs/squashfs: sqfs_read: fix dangling pointer dirs->entry 75/250875/1
Richard Genoud [Tue, 3 Nov 2020 11:11:11 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read: fix dangling pointer dirs->entry

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit d1d8d75f69f82f7ef7c55b58a7d9e73055956f3c]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Ie76becc6bfb30341d1964a34154ebe4014def678

3 years agofs/squashfs: sqfs_size: remove useless sqfs_closedir() 74/250874/1
Richard Genoud [Tue, 3 Nov 2020 11:11:10 +0000 (12:11 +0100)]
fs/squashfs: sqfs_size: remove useless sqfs_closedir()

as sqfs_opendir failed, there's no need to call sqfs_closedir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 35475f83a107901551c31f7bc70f5266862a33e4]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I809ae83d5949f86d547b52982cf318e7202a6868

3 years agofs/squashfs: sqfs_size: fix dangling pointer dirs->entry 73/250873/1
Richard Genoud [Tue, 3 Nov 2020 11:11:09 +0000 (12:11 +0100)]
fs/squashfs: sqfs_size: fix dangling pointer dirs->entry

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 508a9dc7f694df11c7de7460f888f508e40a2046]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I9f03d0d18e49f3ad0b5b7f1ca6f48625c00e46aa

3 years agofs/squashfs: sqfs_concat_tokens: check if malloc succeeds 72/250872/1
Richard Genoud [Tue, 3 Nov 2020 11:11:08 +0000 (12:11 +0100)]
fs/squashfs: sqfs_concat_tokens: check if malloc succeeds

memory allocation should always be checked

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit dc3312c43c82ff9335b2bf4ee4f72365e824adfd]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I160a321fe56fc63476d19adbbaa62129daa03f79

3 years agofs/squashfs: sqfs_read_inode_table: fix dangling pointer 71/250871/1
Richard Genoud [Tue, 3 Nov 2020 11:11:07 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read_inode_table: fix dangling pointer

inode_table should not be left dangling as it may be freed in sqfs_opendir

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 4c83d2755776d4dd5e15a930d48db1082fc0d1cc]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I0d63396f7885f68140e78623df8e06b8b00049ac

3 years agofs/squashfs: sqfs_search_dir: fix memory leaks 70/250870/1
Richard Genoud [Tue, 3 Nov 2020 11:11:06 +0000 (12:11 +0100)]
fs/squashfs: sqfs_search_dir: fix memory leaks

path, target, res, rem and sym_tokens were not free on error nor success.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit cd54591afd42c547f43a7d509862f20e09264cde]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I9417cb0f010dc267eeef4d0ee1aa8ba45a6678bd

3 years agofs/squashfs: sqfs_search_dir: fix dangling pointer 69/250869/1
Richard Genoud [Tue, 3 Nov 2020 11:11:05 +0000 (12:11 +0100)]
fs/squashfs: sqfs_search_dir: fix dangling pointer

dirs->entry shouldn't be left dangling as it could be freed twice.

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 01e71ec61ab84bcdd4df708f8930d5acf1c2674d]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I51db60ce9c428536c10a72a9ff4a6466629b6a4a

3 years agofs/squashfs: sqfs_read_directory_table: fix memory leak 68/250868/1
Richard Genoud [Tue, 3 Nov 2020 11:11:04 +0000 (12:11 +0100)]
fs/squashfs: sqfs_read_directory_table: fix memory leak

pos_list wasn't freed on every error

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 7d23b2c5fb093142400467d8b81ba84786ed6f2c]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I152e9c306a194261b7b98e408a02000830194ba1

3 years agofs/squashfs: sqfs_split_path: fix memory leak and dangling pointers 67/250867/1
Richard Genoud [Tue, 3 Nov 2020 11:11:03 +0000 (12:11 +0100)]
fs/squashfs: sqfs_split_path: fix memory leak and dangling pointers

*file and *dir were not freed on error

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 5487477802e0ad7bfad046af25f4a04cfd98cb7a]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I185e3bb66f52d16eb02a2b2076aa723aab5cb753

3 years agofs/squashfs: sqfs_closedir: fix memory leak 66/250866/1
Richard Genoud [Tue, 3 Nov 2020 11:11:02 +0000 (12:11 +0100)]
fs/squashfs: sqfs_closedir: fix memory leak

sqfs_dirs wasn't freed anywhere.

Reviewed-by: Joao Marcos Costa <jmcosta944@gmail.com>
Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit 87d11e08e4792b3d188143972ba3a1651a52beee]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: Icd463416ec6b70ee90c912faf077d3795f055f29

3 years agofs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers 65/250865/1
Richard Genoud [Tue, 3 Nov 2020 11:11:00 +0000 (12:11 +0100)]
fs/squashfs: sqfs_opendir: fix some memory leaks and dangling pointers

When trying to load an non-existing file, the cpu hangs!

Signed-off-by: Richard Genoud <richard.genoud@posteo.net>
[jh80.chung: cherry picked from mainline commit f268768d43bbf11c7107597abef57c6b86b6b229]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I8273a22d76a36e39cf4ca0f48afd9fd409280217

3 years agofs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE 64/250864/1
Gerard Koskamp [Fri, 30 Oct 2020 13:41:58 +0000 (13:41 +0000)]
fs/squashfs: Fix index off by 1 for inode SQFS_LDIR_TYPE

I've created a squashfs file system with Yocto (it use squashfs-tools)
and u-boot command sqfsls give the error:'Error while searching inode:
unknown type.'
After some digging in the code I found that the index is off by 1.
This patch fix this issue and I can successful use the sqfsls command.
After search for the squashfs format I found a link talk about a
similar issue but this time in the documentation. The link is:
https://github.com/AgentD/squashfs-tools-ng/commit/e6588526838caece9529

Signed-off-by: Gerard Koskamp <gerard.koskamp@nedap.com>
Tested-by: Joao Marcos Costa <joaomarcos.costa@bootlin.com>
[jh80.chung: cherry picked from mainline commit c49b0eb034710f08fc68cbfa2c23811e10667ad9]
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
Change-Id: I02ba72c07ea7c57ebace7103357e2b81bcf48772

3 years agotizen: rpi: move bootscripts to tizen specific directory 76/250676/1 accepted/tizen/unified/20210105.125826 submit/tizen/20210104.215357
Jaehoon Chung [Thu, 31 Dec 2020 06:18:17 +0000 (15:18 +0900)]
tizen: rpi: move bootscripts to tizen specific directory

Move bootscripts from board/raspberrypi/rpi to tizen/bootscript/.
And combine to one script, because those are duplicated almost codes.

Change-Id: I2ee929bbcd6cb68566d441a272a1ba3d84beb100
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: bootscript: amlogic: support recovery mode 54/250454/1
Jaehoon Chung [Mon, 28 Dec 2020 02:25:16 +0000 (11:25 +0900)]
tizen: bootscript: amlogic: support recovery mode

Support recovery mode.

Change-Id: Idf6dca45c0e3636c0579b674223e4af7c59d767f
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: bootscript: amlogic: remove tizen specific kernel loading address 53/250453/1
Jaehoon Chung [Mon, 28 Dec 2020 02:00:20 +0000 (11:00 +0900)]
tizen: bootscript: amlogic: remove tizen specific kernel loading address

Remove tizen specific kernel loading address.
When it's entered to recovery mode, "Synchronous Abort" is occurred.

Change-Id: I6ff3afc52299b12714a25bb83fe114467c007573
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: bootscript: amlogic: remove voutmode in bootargs 52/250452/1
Jaehoon Chung [Mon, 28 Dec 2020 01:28:38 +0000 (10:28 +0900)]
tizen: bootscript: amlogic: remove voutmode in bootargs

Remove voutmode in bootargs.
If it's defined, it will be passed from boot_args.
- It's used in only odroid-n2/c4.

Change-Id: I112c4932c31b8e33cdb8c073712f443c5c88c1ac
Signed-off-by: Jaehoon Chung <jh80.chung@samsung.com>
3 years agotizen: script: ignore when no file in output directory 85/250185/1
Seung-Woo Kim [Tue, 22 Dec 2020 01:51:15 +0000 (10:51 +0900)]
tizen: script: ignore when no file in output directory

The build output directory can have no file. Ignore when no file
in the output directory.

Change-Id: Ia2ce4c25f7f386915c2606a36d4ea66ca46747e3
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
3 years agotizen: move Function button check to separate env script 64/250164/1 accepted/tizen/unified/20201222.122550 submit/tizen/20201222.005612
Marek Szyprowski [Mon, 21 Dec 2020 10:25:56 +0000 (11:25 +0100)]
tizen: move Function button check to separate env script

This will make CONFIG_PREBOOT a bit more readable and easier to
understand.

Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I75d0e42a6b26c7e4c5d7d4818e9e0f450151a1b2