<feed xmlns='http://www.w3.org/2005/Atom'>
<title>starfive-tech/u-boot.git/env/sf.c, branch master</title>
<subtitle>StarFive Tech U-Boot for VisionFive (JH7110) boards (mirror)</subtitle>
<id>https://git.radix-linux.su/starfive-tech/u-boot.git/atom?h=master</id>
<link rel='self' href='https://git.radix-linux.su/starfive-tech/u-boot.git/atom?h=master'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/'/>
<updated>2021-10-31T18:26:44+00:00</updated>
<entry>
<title>env: sf: Put ENV_INVALID into gd-&gt;env_valid on CRC failure</title>
<updated>2021-10-31T18:26:44+00:00</updated>
<author>
<name>Marek Behún</name>
<email>marek.behun@nic.cz</email>
</author>
<published>2021-10-22T13:47:14+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=af8149e9ac40dbb596fb2f5b72b82feb54476f68'/>
<id>urn:sha1:af8149e9ac40dbb596fb2f5b72b82feb54476f68</id>
<content type='text'>
env_sf_init_addr() says the environment is valid even if it is assigning
default environment due to CRC failure. Change this to ENV_INVALID and
let the generic env_init() function, which calls this initializer,
assign the default environment.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
</entry>
<entry>
<title>env: sf: Use ENV_VALID enum names instead of literals</title>
<updated>2021-10-31T18:26:44+00:00</updated>
<author>
<name>Marek Behún</name>
<email>marek.behun@nic.cz</email>
</author>
<published>2021-10-22T13:47:13+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=87221bd66c2646671450ca8eb97007f2d6e01c5c'/>
<id>urn:sha1:87221bd66c2646671450ca8eb97007f2d6e01c5c</id>
<content type='text'>
The function env_sf_init_addr() assigns number literals (1) instead of
ENV_VALID to gd-&gt;env_valid. Fix this.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
</entry>
<entry>
<title>env: sf: Cosmetic fix in env_sf_init_addr()</title>
<updated>2021-10-31T18:26:44+00:00</updated>
<author>
<name>Marek Behún</name>
<email>marek.behun@nic.cz</email>
</author>
<published>2021-10-22T13:47:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=9ab30d2bafa0ee98e9048afcb575b6013f933f3c'/>
<id>urn:sha1:9ab30d2bafa0ee98e9048afcb575b6013f933f3c</id>
<content type='text'>
In the if clause we use tabs and in the else clause spaces. Let's use
spaces in the if clause too.

Signed-off-by: Marek Behún &lt;marek.behun@nic.cz&gt;
Reviewed-by: Simon Glass &lt;sjg@chromium.org&gt;
</content>
</entry>
<entry>
<title>env: sf: remove the static env_flash variable</title>
<updated>2021-04-16T21:33:33+00:00</updated>
<author>
<name>Patrick Delaunay</name>
<email>patrick.delaunay@foss.st.com</email>
</author>
<published>2021-02-24T10:52:36+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=ecf154423258cb4f0d7ee1ff29d26b0f69f67ac4'/>
<id>urn:sha1:ecf154423258cb4f0d7ee1ff29d26b0f69f67ac4</id>
<content type='text'>
As the the SPI flash is probed and is released in each ENV sf function
the env_flash no more need to be static.

This patch move this device handle as local variable of each function and
simplify the associated code (env_flash is never == NULL when
setup_flash_device is called).

Signed-off-by: Patrick Delaunay &lt;patrick.delaunay@foss.st.com&gt;
</content>
</entry>
<entry>
<title>env: sf: add missing spi_flash_free</title>
<updated>2021-04-16T21:33:09+00:00</updated>
<author>
<name>Patrick Delaunay</name>
<email>patrick.delaunay@foss.st.com</email>
</author>
<published>2021-02-24T10:52:35+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=c2d00364c1d638eaa85d5f1384170f610b3c4beb'/>
<id>urn:sha1:c2d00364c1d638eaa85d5f1384170f610b3c4beb</id>
<content type='text'>
Free the SPI resources by calling spi_flash_free() in each env sf
function to avoid issue for other SPI users.

Signed-off-by: Patrick Delaunay &lt;patrick.delaunay@foss.st.com&gt;
</content>
</entry>
<entry>
<title>env: sf: add support of command env erase</title>
<updated>2021-04-16T21:32:52+00:00</updated>
<author>
<name>Patrick Delaunay</name>
<email>patrick.delaunay@foss.st.com</email>
</author>
<published>2021-02-09T10:48:52+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=25d90ad45ab336bab6a21f0668b8c98a2939ff32'/>
<id>urn:sha1:25d90ad45ab336bab6a21f0668b8c98a2939ff32</id>
<content type='text'>
Add support of opts erase for env in SPI flash;
this opts is used by command 'env erase'.

This command only fills the env offset by 0x0 (bit flip to 0) and
the saved environment becomes invalid (with bad CRC).

It doesn't erase the sector here to avoid issue when the sector
is larger than the env (i.e. embedded when
CONFIG_ENV_SECT_SIZE &gt; CONFIG_ENV_SIZE).

The needed sector erase will be managed in the next "env save" command,
using the opt ".save", before to update the environment in SPI flash.

Signed-off-by: Patrick Delaunay &lt;patrick.delaunay@foss.st.com&gt;
</content>
</entry>
<entry>
<title>env: sf: update the use of macro ENV_SAVE_PTR</title>
<updated>2021-04-16T21:32:34+00:00</updated>
<author>
<name>Patrick Delaunay</name>
<email>patrick.delaunay@foss.st.com</email>
</author>
<published>2021-02-09T10:48:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=e41f55b32e0ac38da77d8f86792164faac5ef7c5'/>
<id>urn:sha1:e41f55b32e0ac38da77d8f86792164faac5ef7c5</id>
<content type='text'>
Remove CONFIG_IS_ENABLED(SAVEENV) as it is already tested in
the ENV_SAVE_PTR macro.

Signed-off-by: Patrick Delaunay &lt;patrick.delaunay@foss.st.com&gt;
</content>
</entry>
<entry>
<title>env: increment redund flag on read fail</title>
<updated>2021-04-16T15:55:55+00:00</updated>
<author>
<name>Brandon Maier</name>
<email>brandon.maier@rockwellcollins.com</email>
</author>
<published>2020-12-17T23:19:18+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=b9c3052fbb25bff26702e6c16abfd0a5ec92040c'/>
<id>urn:sha1:b9c3052fbb25bff26702e6c16abfd0a5ec92040c</id>
<content type='text'>
If one of the reads fails when importing redundant environments (a
single read failure), the env_flags wouldn't get initialized in
env_import_redund(). If a user then calls saveenv, the new environment
will have the wrong flags value. So on the next load the new environment
will be ignored.

While debugging this, I also noticed that env/sf.c was not correctly
handling a single read failure, as it would not check the crc before
assigning it to gd-&gt;env_addr.

Having a special error path for when there is a single read failure
seems unnecessary and may lead to future bugs. Instead collapse the
'single read failure' error to be the same as a 'single crc failure'.
That way env_check_redund() either passes or fails, and if it passes we
are guaranteed to have checked the CRC.

Signed-off-by: Brandon Maier &lt;brandon.maier@rockwellcollins.com&gt;
CC: Joe Hershberger &lt;joe.hershberger@ni.com&gt;
CC: Wolfgang Denk &lt;wd@denx.de&gt;
CC: Heiko Schocher &lt;hs@denx.de&gt;
Reviewed-by: Tom Rini &lt;trini@konsulko.com&gt;
</content>
</entry>
<entry>
<title>env: add CONFIG_ENV_SECT_SIZE_AUTO</title>
<updated>2021-04-16T15:55:55+00:00</updated>
<author>
<name>Rasmus Villemoes</name>
<email>rasmus.villemoes@prevas.dk</email>
</author>
<published>2021-04-14T18:51:43+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=bcb44f62b21e88cc74bc26939eb1dac95d2f430b'/>
<id>urn:sha1:bcb44f62b21e88cc74bc26939eb1dac95d2f430b</id>
<content type='text'>
This is roughly the U-Boot side equivalent to commit
e282c422e0 (tools: fw_env: use erasesize from MEMGETINFO ioctl). The
motivation is the case where one has a board with several revisions,
where the SPI flashes have different erase sizes.

In our case, we have an 8K environment, and the flashes have erase
sizes of 4K (newer boards) and 64K (older boards). Currently, we must
set CONFIG_ENV_SECT_SIZE to 64K to make the code work on the older
boards, but for the newer ones, that ends up wasting quite a bit of
time reading/erasing/restoring the last 56K.

At first, I wanted to allow setting CONFIG_ENV_SECT_SIZE to 0 to mean
"use the erase size the chip reports", but that config
option is used in a number of preprocessor conditionals, and shared
between ENV_IS_IN_FLASH and ENV_IS_IN_SPI_FLASH.

So instead, introduce a new boolean config option, which for now can
only be used with ENV_IS_IN_SPI_FLASH. If left off, there's no change
in behaviour.

The only slightly annoying detail is that, when selected, the compiler
is apparently not smart enough to see that the the saved_size and
saved_offset variables are only used under the same "if (sect_size &gt;
CONFIG_ENV_SIZE)" condition as where they are computed, so we need to
initialize them to 0 to avoid "may be used uninitialized" warnings.

On our newer boards with the 4K erase size, saving the environment now
takes 0.080 seconds instead of 0.53 seconds, which directly translates
to that much faster boot time since our logic always causes the
environment to be written during boot.

Signed-off-by: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
</content>
</entry>
<entry>
<title>env/sf.c: use a variable to hold the sector size</title>
<updated>2021-04-16T15:55:55+00:00</updated>
<author>
<name>Rasmus Villemoes</name>
<email>rasmus.villemoes@prevas.dk</email>
</author>
<published>2021-04-14T18:51:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/starfive-tech/u-boot.git/commit/?id=4da7347d85aa4409945201279d71ae501cd5c164'/>
<id>urn:sha1:4da7347d85aa4409945201279d71ae501cd5c164</id>
<content type='text'>
As preparation for the next patch, use a local variable to represent
the sector size. No functional change.

Signed-off-by: Rasmus Villemoes &lt;rasmus.villemoes@prevas.dk&gt;
</content>
</entry>
</feed>
