9
0
Fork 0
Commit Graph

14000 Commits

Author SHA1 Message Date
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
Andrey Smirnov 645320b94a rtc-lib: Check tm_wday for validity in rtc_valid_tm()
RTC drivers rely on rtc_valid_tm() in order to make sure that no bogus
values from uninitialized HW registers get passed to the uppper layers.

A somewhat contrived way to reproduce this problem with DS1307 RTC
would be to do the following:

> i2c_write -b <bus> -a <addr> -r 3 0x00
> hwclock

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:10 +01:00
Andrey Smirnov 304cdde167 rtc: ds1307: Fix a memory leak
Several failure paths would result in control being transfered to
'exit' label, so instead of just returning error codes in those cases
we also need to free the memory allocated for 'ds1307'

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +01:00
Andrey Smirnov 540140849c rtc: ds1307: Add code to support ds1337/1341
Port DS1337 specific bits from corresponding Linux driver and add
small changes needed for DS1341.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +01:00
Sascha Hauer 06a524a168 rtc: Add Abracon driver
This patch adds support for the Abracon ab-rtcmc-32.768khz-eoz9-s3
RTC. The driver can probably support other Abracon RTCs aswell, but this
hasn't been verified.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +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 f98b02365f net: Add SNTP support
This adds support for retrieving the time via Simple Network Time
Protocol (SNTP). No fancy features are supported, only plainly getting
the current time.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +01:00
Sascha Hauer e259115243 rtc: Fill in weekdays before setting time
Some rtcs store the weekday. Make sure it's filled in correctly before
passinf the time to the driver. This is easily done by converting it to
seconds-since-epoch and back to struct rtc_time.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-07 08:46:09 +01:00
Sascha Hauer db80eaf6d2 rtc: Check time for validity before passing it to the rtc driver
So that rtc drivers do not get invalid times.

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
Markus Pargmann 69528e8b79 mtd: gpmi: Add erased page bitflip correction
Hardware ECC does not work for erased pages. However as soon as
something that is not 0xff is found in the page, hardware ECC assumes
this is valid data and produces an uncorrectable error ECC status. We
can use that to check for bitflips in erased pages and fix them if the
number of flipped bits is below the ecc_strength.

We need to move the memcpy above the for loop to be able to access the
buffer directly.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 10:43:31 +01:00
Markus Pargmann 142963e9d5 mtd: nand: Add erased page bitflip check helper functions
This adds the bitflip check helper functions from the kernel. They are
used to check for bitflips in erased pages and correct them in the
buffer so that UBI can work with it. Unfortunately most nand controllers
do not have ECC for erased pages and don't do this on their own.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 10:43:31 +01:00
Alexander Aring 8430b90330 rpi: sync revision detection with u-boot
This patch adds parts from u-boot code for doing RPi revision detection
and take care about the "warranty bit". I got this bit on my RPi2.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 09:38:12 +01:00
Alexander Aring 801a8d40c1 bcm283x: mbox: align to cachesize
This patch change the align of mbox stack resource to 32. The reason is
that I had some experience with bcm2836 and the mbox implementation,
after setting the align to 64(on bcm2836) the issues was gone.

I found these values inside the u-boot implementation, they use 32
(bcm2835) and 64 (bcm2836).

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 09:38:12 +01:00
Alexander Aring 295d6763bf bcm2835: introduce mach-bcm283x
This patch changes the most part of mach-bcm2835 to mach-bcm283x. This
prepares to add RPi2 support which is a bcm2836. This patch changes the
Kconfig entry namens to BCM283X for drivers only. These drivers should
working the same in bcm2836.

While updating defconfig I added LED support/trigger option.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 09:38:12 +01:00
Alexander Aring 9bdfe1ff7f arm: bcm2835: fix indentation
This patch fix indentation in core.h of mach-bcm2835.

Signed-off-by: Alexander Aring <alex.aring@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-01-04 09:38: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
Zahari Doychev 295a5f8e4b environment: allow saving of symbolic link changes
Currently it is not possible to change symbolic links in the default
environment. For example if the default environment contains the
link "current_boot -> mmc" then the following does not work:

$ rm current_boot
$ ln net current_boot
$ saveenv

After reset the link is still pointing to "mmc" and this error appears:

"symlink: /env/boot/current_boot -> net : error -17"

The patch fixes the above problem and moves the "ENV_FLAG_NO_OVERWRITE"
to enable handling of symbolic links in this case too.

Signed-off-by: Zahari Doychev <zahari.doychev@linux.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-17 10:48:18 +01:00
Sascha Hauer 1b099f06ca imx-usb-loader: whitespace fixup
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-16 09:46:39 +01:00
Florian Vallee 79942715f0 imx-usb-loader: Add i.MX6ul support
Signed-off-by: Florian Vallee <fvallee@eukrea.fr>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-16 09:46:11 +01:00
Sascha Hauer 39698df6f7 net: resolv: Make argument const
resolv() is not allowed to change the hostname argument, make it const.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:40:50 +01:00
Sascha Hauer 7065fa32ca net: dhcp: make unmodified variable const
'str' in dhcp_set_string_options is never modified, so make it const.
With this we no longer have to cast away the const returned from getenv.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:40:45 +01:00
Sascha Hauer 802d8fdfbe net: dhcp: simplify dhcp_options_process
dhcp_options_handle returns the index into the dhcp_options array.
This is only to be able in the caller to print a debug message when
the index returned from dhcp_options_handle is out of bounds.
Simplify this by printing the debug message in dhcp_options_handle
and not in the caller.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:40:40 +01:00
Sascha Hauer d917c04972 net: dhcp: unify options and params
The dhcp code distinguishes between options and params. If sent to the
server they are params, if received from the server they are options.
Unify them all to be options. If it has a handle_param callback it's
a param, if it has a handle callback it's an option.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:40:36 +01:00
Trent Piepho c44e12f0bd socfpga: Allow setting partition xloader boots from for mmc
The xloader boots the 2nd stage barebox from socfpga_barebox_part when
using NOR.  But when using MMC it boots from a hardcoded "disk0.1".
Add the mmc device name to the partition description and use it for
mmc booting.

Add an extern declaration of socfpga_barebox_part to the socfpga
header so that a board can change it to use a different partition.

Initialize socfpga_barebox_part to the default value instead of NULL to
avoid the NULL check later.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:32:30 +01:00
Trent Piepho 1d31baf145 bootstrap: Boot barebox with kernel calling convention
In commit 8e3ddc13eb the bootm code was
changed to boot barebox using the same calling convention as the
kernel.  Which on ARM is to pass three arguments which are zero, an
architecture code, and a params pointer.

A 2nd stage barebox can be booted using lib/bootstrap, which is
different code from bootm.  This code just leaves garbage in the first
three parameters and so doesn't follow the convention.

Change it to be compatible with the ARM kernel booting convention.
This just sends a zero for the architecture, since the code for
architectures depends on boot[zmu] and something using bootstrap
wouldn't have those too.  And it just passes NULL for the params since
we don't have a way to pass a device tree from the preloader.

All users of bootstrap are ARM based, but the code is in lib so a
non-ARM board might someday make use of it.  If the current code would
work for them, then the change here will be ok too.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-14 11:13:32 +01:00
Andrey Panov 0c348c3f44 ARM: i.MX6Q: Embedsky E9: Convert environment paths in DTS to a new bindings
Signed-off-by: Andrey Panov <rockford@yandex.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-11 08:06:17 +01:00
Markus Pargmann 9e617362fc Documentation: Document pstore/RAMOOPS
Add some documentation about behaviour and setup of pstore/RAMOOPS.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-11 08:04:51 +01:00
Sascha Hauer a9e7e68279 ARM: dts: Add *.dtb.lzo to clean files
*.dtb.lzo are generated during compilatiion, delete them.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-11 08:02:04 +01:00
Sascha Hauer 5e11907b7b ARM: Omap3: Remove useless inline
Silences gcc5 warning:

In file included from arch/arm/mach-omap/gpmc.c:31:0:
arch/arm/mach-omap/include/mach/sys_info.h:93:83:
warning: inline function 'get_sysboot_value' declared but never defined

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 11:05:49 +01:00
Sascha Hauer f256280006 linux/barebox-wrapper: Silence gcc5 warning
gcc5 warns about using flags uninitialized in spin_lock_irqsave,
although it could look into the static inline spin_lock_irqsave
implementation and see it's not used at all. An empty define instead
of the static inline wrapper would lead to a "unused variable" warning.
Let's create a macro and fake some usage of the flags variable. This
probably helps until gcc6 is out.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 11:05:07 +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
Lucas Stach d37f1284de MCI: init device_node for MCI mainarea cdev
This fixes a regression, where boards specifying the environment
path using the form device-path = &phandle, "partname:part" would
be unable to find their env.

This is due to of_find_path() switching to cdev_by_device_node()
internally, which expects the device_node member of the main
area cdev to be initialized.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:51:58 +01:00
Lucas Stach 21854348c8 ARM: ccxmx53: properly guard initcall for multiimage
Make sure to not run this board specific initcall on any
other board.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:50:56 +01:00
Markus Pargmann 160d2ed0ba fs: Add pstore filesystem
pstore is a persistent storage filesystem used for RAMOOPS. It is used
to store console logs, panics, ftrace and other information in case of a
crash/panic/oops/reboot.

pstore is implemented for barebox as a read-only filesystem at the
moment. It may be extended later on. The idea is to provide a way to
extract essential data from the last running kernel.

Most of the code is copied from the kernel. However this is only a
lightweight implementation without real write support yet.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 6c42710ae0 arm: Add RAMOOPS memory area
RAMOOPS is a driver that uses a reserved static memory region to store
the data from the last panic or boot. This helps to debug crashes at the
next boot while preserving the boot messages.

To guarantee a memory area that is not altered by barebox or the kernel,
this area is located at the end of the RAM right after barebox and
before the STACK. This ensures that changing barebox sizes do not
interfere with RAMOOPS.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 9280600522 arm: start: Add visible sdram region for barebox board data
This helps to understand and find problems with the memory layout of
barebox. It adds another entry for the board data that barebox
allocated.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 65071bd091 arm: Clarify memory layout calculation
The memory calculations used are all hardcoded into three different
files, start-pbl.c, uncompress.c and start.c. To make this more readable
and reliable, this patch gathers these information in barebox-arm.h with
static inline functions for the calculation of the memory offsets.

This patch also adds proper handling of different barebox/board data
sizes. Currently only 1MB+Alignment of RAM is reserved for Barebox and
board data. This could be too small for bigger devicetrees and barebox.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 899b3822d2 lib: Import reed solomon code from kernel
reed solomon code is used by RAMOOPS to check and fix data stored in
volatile memory.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 647fba8ee3 vsprintf: Add scnprintf from kernel
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 45885266f9 printk: Add missing include/declaration
There are functions or structs used that do need these.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 6f42da2fc8 log2: Add missing __rounddown_pow_of_two()
Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Markus Pargmann 2ab52a7b67 arm: boards: karo-tx6x remove definition of DIV_ROUND_UP
DIV_ROUND_UP is defined in include/linux/kernel.h. Use that instead.

Signed-off-by: Markus Pargmann <mpa@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:49:52 +01:00
Sascha Hauer 405f629209 dts: update to v4.4-rc4
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:48:41 +01:00
Sascha Hauer 45b0310b1e dts: update to v4.4-rc3
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:48:41 +01:00
Sascha Hauer 7233b2c180 dts: update to v4.4-rc2
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:48:41 +01:00
Sascha Hauer 6e6d9a2ff0 dts: update to v4.4-rc1
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:48:40 +01:00
Sascha Hauer 8e2fd5380a dts: update to v4.3
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:48:40 +01:00
Sascha Hauer 14a2840b3d dts: update to v4.3-rc7
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2015-12-10 08:48:40 +01:00