summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-07-10binman: Update 'text' entry for Python 3Simon Glass
This code reads a binary value and then uses it as a string to look up another value. Add conversions to make this work as expected on Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Update fmap code for Python 3Simon Glass
This needs special care to ensure that the bytes type is used for binary data. Add conversion code to deal with strings and bytes correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Update entry_test to support Python 3Simon Glass
The reload() function is in a different place in Python 3. Update the code to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Convert to use bytes typeSimon Glass
With Python 3 we want to use the 'bytes' type instead of 'str'. Adjust the code accordingly so that it works on both Python 2 and Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Avoid changing a dict during iterationSimon Glass
This code works OK in Python 2 but Python 3 complains. Adjust it to avoid deleting elements from a dict while iterating through it. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Allow reading files in text modeSimon Glass
While reading files in binary mode is the norm, sometimes we want to use text mode. Add an optional parameter to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Update dtb_platdata to support Python 3Simon Glass
The only change needed is to update get_value() to support the 'bytes' type correctly with Python 3. With this the dtoc unit tests pass with both Python 2 and 3: PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \ ./tools/dtoc/dtoc -t PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \ ./tools/dtoc/dtoc -t Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Update fdt_util for Python 3Simon Glass
Since we are now using the bytes type in Python 3, the conversion in fdt32_to_cpu() is not necessary, so drop it. Also use 'int' instead of 'long' to convert the integer value, since 'long' is not present in Python 3. With this, test_fdt passes with both Python 2 and 3: PYTHONPATH=/tmp/b/sandbox_spl/scripts/dtc/pylibfdt python \ ./tools/dtoc/test_fdt -t PYTHONPATH=~/cosarm/dtc/pylibfdt:tools/patman python3 \ ./tools/dtoc/test_fdt -t Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Add a unit test for BytesToValue()Simon Glass
Add a simple unit test for one of the cases of this function, so that any fault can be seen directly, rather than appearing through the failure of another test. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Test full 64-bit properties with FdtCellsToCpu()Simon Glass
At present this test does not check the upper 32 bits of the returned value. Add some additional tests to cover this. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Use binary mode for reading filesSimon Glass
The .dtb files are binary so we should open them as binary files. This allows Python 3 to use the correct 'bytes' type. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Convert the Fdt.Node class to Python 3Simon Glass
Update this class to work correctly on Python 3 and to pass its unit tests. The only required change is to deal with a difference in the behaviour of sorting with a None value. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Convert the Fdt.Prop class to Python 3Simon Glass
Update this class to work correctly on Python 3 and to pass its unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Use byte type instead of str in fdtSimon Glass
In Python 3 bytes and str are separate types. Use bytes to ensure that the code functions correctly with Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Updates BytesToValue() for Python 3Simon Glass
The difference between the bytes and str types in Python 3 requires a number of minor changes to this function. Update it to handle the input data using the 'bytes' type. Create two useful helper functions which can be used by other modules too. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Move BytesToValue() out of the Prop classSimon Glass
This method does not actually use any members of the Prop class. Move it out of the class so that it is easier to add unit tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Use GetBytes() to obtain repeating bytesSimon Glass
Use this helper function which works on both Python 2 and Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Sort platdata output from dtocSimon Glass
At present the order of struct field emitted by this tool depends on the internal workings of a Python dictionary. Sort the fields to remove this uncertainty, so that tests are deterministic. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10dtoc: Adjust code for Python 3Simon Glass
Update a few things in this tool so that they support Python 3: - print statements - iteritems() - xrange() Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Don't require Python 2Simon Glass
Update the shebang to allow either Python 2 or Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Tidy up a few more unicode conversionsSimon Glass
Use the new functions in the tools module to handle conversion. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Adjust functional tests for Python 3Simon Glass
Change the code so that it works on both Python 2 and Python 3. This works by using unicode instead of latin1 for the test input, and ensuring that the output is converted to a string rather than a unicode object on Python 2. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Avoid unicode type in settings unit testsSimon Glass
The unicode type does not exist in Python 3 and when displaying strings they do not have the 'u' prefix. Adjusts the settings unit tests to deal with this difference, by converting the comparison value to a string, thus dropping the 'u'. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Sort series output for repeatabilySimon Glass
We use sets to produce the list of To and Cc lines for a series. This does not result in stable ordering of the recipients. Sort each list to ensure that the output is repeatable. This is necessary for tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Move unicode helpers to toolsSimon Glass
Create helper functions in the tools module to deal with the differences between unicode in Python 2 (where we use the 'unicode' type) and Python 3 (where we use the 'str' type). Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Support use of stringIO in Python 3Simon Glass
With Python 3 this class has moved. Update the code to handle both cases. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Handle repeated bytes for Python 3Simon Glass
The method of multiplying a character by a number works well for creating a repeated string in Python 2. But in Python 3 we need to use bytes() instead, to avoid unicode problems, since 'bytes' is no-longer just an alias of 'str'. Create a function to handle this detail and call it from the relevant places in binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Drop an unused input fileSimon Glass
Drop this line which is not used or needed. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Use binary mode when compressing dataSimon Glass
The lz4 utility inserts binary data in its output which cannot always be converted to unicode (nor should it be). Fix this by using the new binary mode for program output. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Provide a way to get program output in binary modeSimon Glass
At present cros_subprocess and the tools library use a string to obtain stdout from a program. This works fine on Python 2. With Python 3 we end up with unicode errors in some cases. Fix this by providing a binary mode, which returns the data as bytes() instead of a string. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10tools: dtoc: Open all binary files in binary modeSimon Glass
Fix an open() statement to use binary mode, so that it works as expected with Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10tools: binman: Open all binary files in binary modeSimon Glass
At present some files are opened in text mode despite containing binary data. This works on Python 2 but not always on Python 3, due to unicode problems. BC&D are not my favourite people. Adjust the affected open() statements to use binary mode. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Use items() instead of iteritems()Simon Glass
Python 3 requires this, and Python 2 allows it. Convert the code over to ensure compatibility with Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Use items() instead of iteritems()Simon Glass
Python 3 requires this, and Python 2 allows it. Convert the code over to ensure compatibility with Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Remove use of Set()Simon Glass
A new built-in set() is used in both Python 2 and 3 now. Move it to use that instead of Set(). Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Don't show errors for failed testsSimon Glass
An unfortunate new feature in Python 3.5 causes binman to print errors for non-existent tests, when the test filter is used. Work around this by detecting the unwanted tests and removing them from the result. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10binman: Convert print statements to Python 3Simon Glass
Update all print statements to be functions, as required by Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Convert print statements to Python 3Simon Glass
Update all print statements to be functions, as required by Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10patman: Update cros_subprocess to use bytesSimon Glass
At present this function uses lists and strings. This does not work so well with Python 3, and testing against '' does not work for a bytearray. Update the code to fix these issues. Signed-off-by: Simon Glass <sjg@chromium.org>
2019-07-10Merge https://gitlab.denx.de/u-boot/custodians/u-boot-i2cTom Rini
2019-07-10Merge https://gitlab.denx.de/u-boot/custodians/u-boot-ubiTom Rini
[trini: Migrate sama5d27_som1_ek_qspiflash/sama5d2_xplained_qspiflash for CONFIG_ENV_SECT_SIZE] Signed-off-by: Tom Rini <trini@konsulko.com>
2019-07-09Merge tag 'u-boot-atmel-2019.10-a' of ↵Tom Rini
https://gitlab.denx.de/u-boot/custodians/u-boot-atmel First set of u-boot-atmel features and fixes for 2019.10 cycle This includes the Atmel QSPI driver and support for the at91 boards. This is the port of the driver from Linux, mostly done by Tudor Ambarus.
2019-07-09rtc: pcf2127: Fixed bug with rtc settings and getting error timeChuanhua Han
The previous pcf2127 RTC chip could not read and set the correct time. When reading the data of internal registers, the read address was the value of register plus 1. This is because this chip requires the host to send a stop signal after setting the register address and before reading the register data. This patch sets the register address using dm_i2c_write and reads the register data using the original dm_i2c_xfer in order to generate a stop signal after the register address is set, and fixes the bug of the original read and write time. Signed-off-by: Biwen Li <biwen.li@nxp.com> Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com> Reviewed-by: Lukasz Majewski <lukma@denx.de> Reviewed-by: Heiko Schocher <hs@denx.de>
2019-07-09configs: sama5d2_xplained: add support QSPI flash bootEugen Hristev
The spi-nor flash resides on spi bus 1. Update the CONFIG_ENV_SPI_CS and CONFIG_BOOTCOMMAND accordingly. Based on original work by Wenyou Yang. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> [tudor.ambarus@microchip.com: amend the commit message.] Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2019-07-09configs: sama5d27_som1_ek: qspi: use common memory layoutTudor Ambarus
Use the qspi memory layout defined in at91-sama5_common - it aligns with the 8 Mbyte flash (sst26vf064b-104i/sn) available in sama5d27_som1_ek. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2019-07-09configs: sama5d27_som1_ek: add qspiflash_defconfigTudor Ambarus
Add the default config file of QSPI media. The config is based on sama5d27_som1_ek_mmc_defconfig. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2019-07-09configs: sama5d2_xplained: add qspiflash_defconfigTudor Ambarus
Add the default config file of QSPI media. The config is based on sama5d2_xplained_mmc_defconfig. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
2019-07-09ARM: at91: sama5: add common environment for QSPICyrille Pitchen
Use the same memory layout as we use for the NAND boot on the other boards. QSPI flashes are present on the following boards: sama5d2_xplained RevB: 32 Mbyte flash (mx25l3273fm2i-08g) sama5d2_xplained RevC: 8 Mbyte flash (sst26vf064b-104i/sn) sama5d27_som1_ek: 8 Mbyte flash (sst26vf064b-104i/sn) sama5d2_ptc_ek: 8 Mbyte flash (sst26vf064b-104i/sn) The 8 Mbyte limit is enough to cope with the memory layout used in the NAND boot. rootfs exceeds the 8 Mbyte limit and will stay in eMMC in the sama5d2_xplained case. The final scope is to use a single memory layout for all boot medias. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com> [tudor.ambarus@microchip.com: change memory layout, add commit message] Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2019-07-09ARM: dts: at91: sama5d2_xplained: fix QSPI0 nodeCyrille Pitchen
Fix the following: - use "jedec,spi-nor" binding, we use jedec compatible flashes - set bus width to 4, we use quad capable flashes - differentiate bewteen data and clk and cs pins - drop partions as we don't use them in u-boot. Signed-off-by: Cyrille Pitchen <cyrille.pitchen@microchip.com> [tudor.ambarus@microchip.com: use "jedec,spi-nor", edit commit message] Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
2019-07-09configs: sama5d27_som1_ek: enable qspi controller and flashesTudor Ambarus
We use a sst spi-nor flash memory on sama5d27_som1_ek. Select the others for testing purposes. Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com> Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>