Commit graph

1035 commits

Author SHA1 Message Date
Sascha Hauer
1b59b573e4 Merge branch 'for-next/rtc' 2016-01-11 13:11:08 +01:00
Sascha Hauer
b9a2512aaa Merge branch 'for-next/misc' 2016-01-11 13:11:06 +01:00
Sascha Hauer
a7964180e1 Merge branch 'for-next/gcc5' 2016-01-11 13:11:06 +01:00
Sascha Hauer
8a35fddf57 devfs: Add symlink support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-08 08:30:55 +01:00
Andrey Smirnov
4c9b2e7205 commands/hwclock: Check return value of rtc_read_time()
It is possible for rtc_read_time() to fill struct rtc_time it returns
with invalid values, so we have to check for its return value before
using returned time.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:47:25 +01:00
Sascha Hauer
616143ca8e hwclock: Allow to set hwclock from sntp
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +01:00
Sascha Hauer
720868011b hwclock command: forward return value of rtc_set_time
rtc_set_time can fail, forward the error to the user.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +01:00
Sascha Hauer
6eb5d78419 hwclock command: use format like the Linux tool does
Print three-letter abbreviations of the days and months.

With a fixup by Andrey Smirnov:
| common/date.c: Fix off-by-one error
|
| As per http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html
| 'tm_wday' is zero indexed with zero representing Sunday, this is also
| corroborated by the code in rtc_time_to_tm() which used 4 to represent
| Thursday.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:45:12 +01:00
Alexander Aring
91adf62feb memtest: fix missing arguments in help string
This patch adds some missing arguments in help string of memtest.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 09:34:00 +01:00
Sascha Hauer
ce4dc6df3b ubiformat: fix the subpage size hint on the error path
From mtd-utils commit:

| commit 15685fe39f1665d53d8b316c8f837f20f8700d4b
| Author: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
| Date:   Mon Sep 8 15:05:54 2014 +0300
|
|     ubiformat: fix the subpage size hint on the error path
|
|     David Binderman <dcb314@hotmail.com> reports that the following piece of looks
|     wrong:
|
|     if (!args.subpage_size != mtd->min_io_size)
|         normsg("may be sub-page size is incorrect?");
|
|     I totally agree with him and I believe that we actually meant to have no
|     negation in fron to f 'args.subpage_size', so instead, the code should look
|     like this:
|
|     if (args.subpage_size != mtd->min_io_size)
|         normsg("may be sub-page size is incorrect?");
|
|     Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 11:04:40 +01:00
Sascha Hauer
2ae9bbba07 Merge branch 'for-next/state' 2015-12-08 08:29:02 +01:00
Sascha Hauer
24f1c994cc Merge branch 'for-next/misc' 2015-12-08 08:28:07 +01:00
Sascha Hauer
a2b318fe21 Merge branch 'for-next/i2c' 2015-12-08 08:27:37 +01:00
Sascha Hauer
5e79364a66 Merge branch 'for-next/console' 2015-12-08 08:27:20 +01:00
Trent Piepho
a2b3a25417 ARM: Remove do_execute and thumb2_execute
In commit 104a6a7ccf support was added
for Thumb2.  It added do_execute() as a way to provide arch dependent
calling veneers for use in "go" and thumb2_execute() as the thumb2 to
arm veneer.

But thumb2_execute() isn't necessary as gcc generates a proper calling
sequence from a standard function pointer call.  Thumb2 barebox is
compiled with the AAPCS ABI which requires this.

It also had a bug and didn't pass the arguments properly, but code
execute via "go" rarely uses arguments so this wasn't very noticeable.

Since thumb2 was always the only user of do_execute(), go ahead and
delete that too.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-07 10:44:45 +01:00
Enrico Jorns
446f3d07dd state: disable load command
Explicitly loading environment is not required as it will be loaded if
available during device probing

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-27 08:26:40 +01:00
Wjatscheslaw Stoljarski
eda3453331 readline: Kconfig: fix typo
Signed-off-by: Wjatscheslaw Stoljarski <wjatscheslaw.stoljarski@kiwigrid.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-23 07:53:13 +01:00
Sascha Hauer
a07652deb4 i2c_probe: Make command easier to work with
Instead of insisting on multiple parameters just use sane defaults.
This allows us to scan all addresses on all busses which is normally
what one wants to get an overview over devices on i2c busses.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-19 08:58:26 +01:00
Sascha Hauer
94c3370843 loads: Use putchar rather than console_putc
'putchar' is a standard function to output a character. Use this one
instead of the lower level console_putc.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 12:06:59 +01:00
Sascha Hauer
28e81565a4 loadb: Allow to specify device to use
The port we want to have the console on may not necessarily be the port
we want to transfer files on. Make the port configurable with a
commandline option.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 12:04:42 +01:00
Sascha Hauer
67baa04396 loadb: deactivate console before using it for loadb
Remove the console device we are about using for loadb from the
console layer by deactivating it. This makes sure that no printf output
disturbs the current file transfer.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 12:02:02 +01:00
Sascha Hauer
fa6b6145d1 loadb: Use local cdev
We already retrieve a console_device using console_get_first_active().
Use this one also to send/receive characters instead of the combined
input/output of all console devices with putc/getc.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 12:00:29 +01:00
Sascha Hauer
ec871a7370 ls: fix exitcode
Once ls is called with a non-existing directory it should exit with a
non-zero status. Fix that.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-17 11:57:33 +01:00
Sascha Hauer
1d9295b344 Merge branch 'for-next/misc' 2015-11-06 16:10:42 +01:00
Enrico Jorns
867b30a0a0 edit: return error when save_file failed
When writing a file failed (e.g. due to a read-only file system), no
error was reported by the 'edit' tool. To be valid (and to not confuse
the poor user) at least '1' should be returned to indicate an error.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-05 09:16:12 +01:00
Enrico Jorns
79f04b235c edit: handle write() call errors in save_file()
save_file() did ignore possible errors of its write() calls.
Now the error code is used as return code for save_file().

write_full() is used instead of write() as it does not perform partial
writes which would require to check for returned size, too.

Signed-off-by: Enrico Jorns <ejo@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-05 09:15:53 +01:00
Sascha Hauer
5a5838f5cc memtest: Make cached/uncached test configurable
Add options to explicitly test cached/uncached tests. Without these
options still both cached and uncached is tested if remapping is
supported.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-04 08:03:43 +01:00
Sascha Hauer
8f2549abb7 memtest: By default only test biggest region
Often enough the biggest free region spans most free RAM, so
it doesn't add much value to test the remaining free regions. This
patch changes the default behaviour to only test the biggest free
region and adds the -t option to test all regions.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-04 08:03:43 +01:00
Sascha Hauer
e96b1713ea memtest: split tests in separate functions
The memtest does a bus integrity check and a moving inversions test.
Split the tests into two separate functions so that the can be called
separately.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:47 +01:00
Sascha Hauer
b792124a7d rework remap_range
remap_range is for remapping regions with different cache attributes.
It is implemented for ARM and PowerPC only, the other architectures only
provide stubs.
Currently the new cache attributes are passed in an architecture specific
way and the attributes have to be retrieved by calls to
mmu_get_pte_cached_flags() and mmu_get_pte_uncached_flags().
Make this simpler by providing architecture independent flags which can
be directly passed to remap_range()
Also provide a MAP_ARCH_DEFAULT flag and a arch_can_remap() function.
The MAP_ARCH_DEFAULT defaults to whatever caching type the architecture
has as default. the arch_can_remap() function returns true if the
architecture can change the cache attributes, false otherwise. This
allows the memtest code to better find out what it has to do.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-11-03 07:27:44 +01:00
Alexander Aring
a25cfdee7b loadb: add missing brackets in help
This patch adds missing brackets in the help text of loadb command.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-27 16:45:42 +01:00
Sascha Hauer
6b127d4f18 memtest: move request/release regions to common/
Normally code providing a feature should be implemented in common/ which
is then called from the command code. Follow this rule and move some more
of the memtest code to common/.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-27 08:22:45 +01:00
Sascha Hauer
31fd4cceb6 of_dump: Add option to print node names only
Devicetrees tend to become very long and it is hard to find the
interesting nodes in a full tree output.
This patch adds the -n option to the of_node command. With this
option only the names of the nodes are printed, but not the properties.
The resulting output is much shorter and the node one is interested
in can be copy/pasted to a second call to of_node.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-26 14:08:19 +01:00
Antony Pavlov
a1aa681089 commands: clk_dump: use COMMAND_SUCCESS instead of 0 return code
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-26 08:20:27 +01:00
Antony Pavlov
31ab7cd460 commands: add clk_get_rate command
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-22 09:33:58 +02:00
Andrey Smirnov
93fc1f1a1a memtest.c: Print iterations count if -i is 0
Even if memtest is started in endless mode it is still useful to see
current iteration count. Add the code to print that.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-15 08:56:21 +02:00
Sascha Hauer
c8fa7eed66 Merge branch 'for-next/misc' 2015-10-07 08:23:45 +02:00
Antony Pavlov
1c9e671462 commands: ls: use 14 digits for filesize
10 digits are not enough for modern SATA/USB storages. E.g.:

    barebox> ls -l /dev/
    cr-------- 500107862016 ata0
    cr--------   33554432 ata0.0
    cr-------- 500073258496 ata0.1
    cr-------- 32224837632 disk0
    cr--------   67108864 disk0.0
    cr-------- 32156680192 disk0.1

14 digits look much better. E.g.:

    barebox> ls -l /dev/
    cr--------   500107862016 ata0
    cr--------       33554432 ata0.0
    cr--------   500073258496 ata0.1
    cr--------    32224837632 disk0
    cr--------       67108864 disk0.0
    cr--------    32156680192 disk0.1

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-10-02 09:12:36 +02:00
Jan Remmet
0c2971a41c ubiformat: remove dead code
divisor isn't used.

Signed-off-by: Jan Remmet <j.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-29 08:40:42 +02:00
Daniel Schultz
319d5c1ffc commands: Add MMC ext. CSD register tool
This tools can read/write to the extended CSD register of MMC devices.

Signed-off-by: Daniel Schultz <d.schultz@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-09-24 19:33:27 +02:00
Sascha Hauer
67e0a30e77 Merge branch 'for-next/restart' 2015-09-01 09:43:55 +02:00
Sascha Hauer
69dccb494a Merge branch 'for-next/misc' 2015-09-01 09:43:54 +02:00
Sascha Hauer
049fb66d21 Merge branch 'for-next/login' 2015-09-01 09:43:54 +02:00
Sascha Hauer
b6b7203aca Merge branch 'for-next/fb' 2015-09-01 09:43:53 +02:00
Sascha Hauer
dfd536eb32 commands: ubiformat: Document -y option
This was missing in the help text.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 12:04:41 +02:00
Sascha Hauer
fe36276112 boot command: Allow to enable watchdog
Enabling the watchdog before booting the kernel is a common usecase.
Add an option to the boot command and also add a global variable for
it to make it configurable easily.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 12:04:41 +02:00
Sascha Hauer
2b5bdb47cf crypto: fix selecting of digests
SHA1 is meant as a boolean option which is true when sha1 support is available.
This works because the providers (DIGEST_SHA1_GENERIC and DIGEST_SHA1_ARM) have
a 'select SHA1'. However, consumers like the sha1sum command do a 'select SHA1'
to enable SHA1 support. This of course does not work; selecting SHA1 will not
select any of the SHA1 providers.

This is broken for all digest consumers. We have to explicitly select a digest
provider, that is DIGEST_*_GENERIC to enable the corresponding digest.

This means now we will always have the generic digest in the binary, even
when an optimized one is enabled. There is no sane way in Kconfig to
"select provider for feature xy", so let's live with the overhead in the binary.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:30 +02:00
Sascha Hauer
90e766a78f login: rework login mechanism
We used to have the login functionality in the /env/bin/init script.
This is hard to review and it's too easy to break the login functionality
with changes to this script. Move the places to ask for a password to
C code where we have only a few places where we have to ask for a password.
Mainly these are run_shell() and the menutree command.

This patch introduces a login() function which will only return if the correct
password has been entered. Following calls will return immediately without
asking for a password again.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-28 08:00:27 +02:00
Sascha Hauer
83b0a5ae05 restart: replace reset_cpu with registered restart handlers
This replaces the reset_cpu() function which every SoC or board must
provide with registered handlers. This makes it possible to have multiple
reset functions for boards which have multiple ways to reset the machine.
Also boards which have no way at all to reset the machine no longer
have to provide a dummy reset_cpu() function.

The problem this solves is that some machines have external PMICs or
similar to reset the system which have to be preferred over the
internal SoC reset, because the PMIC can reset not only the SoC but also
the external devices.

To pick the right way to reset a machine each handler has a priority. The
default priority is 100 and all currently existing restart handlers are
registered with this priority. of_get_restart_priority() allows to retrieve
the priority from the device tree which makes it possible for boards to
give certain restart handlers a higher priority in order to use this one
instead of the default one.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-27 21:37:03 +02:00
Sascha Hauer
f38ba32965 dhrystone: Fix documentation
BAREBOX_CMD_HELP_TEXT may not contain a linebreak.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-08-20 15:10:34 +02:00