When a device probe fails the device is removed from the active list.
If then the device is unregistered afterwards it is removed from the
active list again resulting in a crash. To fix this initialize the
devices active list entry when removing it from the active list.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Large SPI-NOR (>2MB) chips reuire more than 40 seconds to perform
all-chip erase. This patch adapts
09b6a377687b885565339e60bc62566433a0406f from Linux kernel, which
implements simple heuristics in order to calculate appropriate wait
time (see orignal commit's description for more details of the fix)
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Using NFS in conjunction with boot spec and the feature to let Barebox
auto generate a kernel command line must keep the options the NFS filesystem
was mounted in Barebox. This patch extends the kernel command line parameter
on demand if something different than the defaults are used.
The command:
barebox:/ boot nfs://myhost//root
expands to the kernel command line:
nfsroot=myhost:/root,v3,tcp
while the command:
barebox:/ boot nfs://myhost:2049//root
expands now to the kernel command line:
nfsroot=myhost:/root,v3,tcp,mountport=2049,port=2049
Signed-off-by: Juergen Borleis <jbe@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Instead of returning an error when a locked region is read, fill
the result with 0xbadabada to indicate a locked region is read.
This way a md -s /dev/imx-ocotp does not abort when it encounters
locked regions.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Throughout our codebase the private context pointer is the first
argument to a function. Do this for the ocotp driver aswell.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Even when the control register has offset 0x0 it's still nice
to use a register define for it. Accessing priv->base directly
just looks wrong.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
All i.MX6 SoCs except the i.MX6SL have 4kbit fuses. The i.MX6SL has
2kbit fuses. Fix the device size accordingly.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This adds initial regmap support. Function prototypes are from
the Kernel, the implemention is mostly rewritten. Currently the
regmap support is limited to the bare minimum to get started.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The HABv4 functions need access a part of the ROM which is
located in the zero page. This must be done early, before the
MMU has been configured and the zero page has been set to faulting.
The HAB functions currently use cpu_is_imxxy(). At the stage where
HAB is called the i.MX CPU type variable is not yet initialized,
so this code only works when only one i.MX type is enabled and
cpu_is_imxxy() are compile time constants.
To fix HAB support when more than one i.MX type is enabled make the
HAB status function SoC specific so that we can drop the use of
cpu_is_imxxy().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This shouldn't be necessary. So far it didn't hurt either, but now
this invalidates the signature of the image, so keep the image
unmodified.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Pass the config file to cmd_imx_image as arguments to make it more
flexible. Also add the possibility for another arg containing additional
options.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
When a whole block of 4KiB in an ubifs file is zero then the block is
not stored in the filesystem. read_block() returns -ENOENT in this case,
so this return value must be treated as success.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
For USB upload we must execute the DCD table manually and
invalidate the DCD table in the uploaded image afterwards
to prevent the ROM from executing the DCD data again. Doing this
changes the image and thus also invalidates the signature. To
make HAB signed images suitable for USB upload possible we add an
option to create HAB signed images suitable for USB upload. With
this option the image is created like this:
- The image is created like usual, but with already invalidated DCD
data (DCD length is set to zero)
- This image is then signed using the CST
- After this the DCD data is made valid (Set DCD length to the real
length)
imx-usb-loader now finds valid DCD data, executes it and by invalidating
the DCD data it restores the state the image had during signing.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
We invalidate the dcd data in the uploaded image since we already
processed it manually. To do so we have set the dcd pointer to 0.
Doing it this way prevents the ROM from executing the HAB code in
debug mode. Use the dcd length instead to invalidate the dcd data.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
The imx-image tool can now generate signed images itself, so we can
switch to this mechanism:
- Move the CSF templates to header files which can be included by the
flash config files
- remove images/Makefile.imxhabv4 which is no longer necessary.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This patch allows to call CST directly from imx-image to create signed
images. CST is called whenever the config file contains the hab <str>
commands which means a CSF is generated.
Calling CST requires some quirks. First of all CST returns successfully
whenever a CSF exists, no matter is the CSF actually contains something
sensible or not. So to detect if CST has been called successfully we
have to check if it generated output, not if it returned successfully.
Then CST uses csfsig.bin as a temporary file which breaks when the tool
is called multiple times at once, something which often happens in
parallel builds. We therefore have to lock accesses to this file using
flock().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This is the first step to support creating signed images directly
with the imx-image tool. i.MX images must be signed using the Freescale
CST tool. CST needs informations already present in the imx-image tool,
so it's convenient to call CST directly from imx-image.
CST takes CSF files (Command Sequence Files) as input. This patch
supports generating CSF files from the imx-image configuration file.
This adds three new commands to the config file:
hab <str>: All options to the hab command are directly passed through to
the CSF.
hab_blocks: This generates the "Blocks =" line in the CSF. This is the
place where the CSF needs information which is contained in
the imx-image tool: The image size, the image filename and
the load address.
super_root_key <file>: For HABv3 the super root key hash is needed in
the i.MX flash header. This command is used to
specify the path to the super root key. Needed
for HABv3 only.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Now that we have a config data struct we can pass it to add_header_*
to reduce the argument count.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Based on kernel commit d2fd719bcb0e ("net/phy: micrel: Add workaround
for bad autoneg") by Nathan Sullivan <nathan.sullivan@ni.com>:
Very rarely, the KSZ9031 will appear to complete autonegotiation, but
will drop all traffic afterwards. When this happens, the idle error
count will read 0xFF after autonegotiation completes. Reset the PHY
when in that state.
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Based on kernel commit 6270e1ae804a ("net/phy: micrel: Center FLP
timing at 16ms") by Jaeden Amero <jaeden.amero@ni.com>:
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>