summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2019-01-15 13:43:03 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2019-01-15 13:43:03 +0100
commit7c2517c2444fdd5c2eceee330a03ff15d12602ca (patch)
tree1770d5217d689f0513bb1534c7e4dfbf114800fc
parentcbc25b2b8488452085d3195dfc7164b00a265364 (diff)
parent0473048c4fa5410b0c4a75f667f7b317e44c15df (diff)
downloadbarebox-7c2517c2444fdd5c2eceee330a03ff15d12602ca.tar.gz
Merge branch 'for-next/misc'
-rw-r--r--Documentation/boards/at91.rst51
-rw-r--r--Documentation/boards/at91/microchip-at91rm9200-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-at91sam9260-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-at91sam9261-ek.rst18
-rw-r--r--Documentation/boards/at91/microchip-at91sam9263-ek.rst132
-rw-r--r--Documentation/boards/at91/microchip-at91sam9g10-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-at91sam9g20-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-at91sam9n12-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-at91sam9x5-ek.rst10
-rw-r--r--Documentation/boards/at91/microchip-ksz9477-evb.rst11
-rw-r--r--Documentation/boards/at91/microchip-sama5d3-xplained.rst8
-rw-r--r--Documentation/boards/at91/microchip-sama5d3x-ek.rst8
-rw-r--r--Documentation/boards/at91/microchip-sama5d4-xplained.rst8
-rw-r--r--Documentation/boards/at91/somfy-animeo-ip.rst4
-rw-r--r--Documentation/boards/at91/telit-evk-pro3.rst9
-rw-r--r--Documentation/boards/imx.rst107
-rw-r--r--README32
-rw-r--r--arch/arm/boards/at91sam9263ek/Makefile2
-rw-r--r--arch/arm/boards/clep7212/clep7212.c2
-rw-r--r--arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c3
-rw-r--r--arch/arm/mach-clps711x/Kconfig2
-rw-r--r--commands/boot.c4
-rw-r--r--commands/miitool.c6
-rw-r--r--commands/nand-bitflip.c1
-rw-r--r--common/memory_display.c2
-rw-r--r--common/state/state_variables.c10
-rw-r--r--drivers/led/core.c11
-rw-r--r--drivers/mci/mci-core.c26
-rw-r--r--drivers/mfd/rave-sp.c8
-rw-r--r--drivers/mfd/syscon.c2
-rw-r--r--drivers/net/fec_imx.c10
-rw-r--r--drivers/nvmem/ocotp.c9
-rw-r--r--drivers/serial/amba-pl011.c2
-rw-r--r--drivers/usb/gadget/dfu.c5
-rw-r--r--drivers/video/mtl017.c7
-rw-r--r--fs/fat/ff.c12
-rw-r--r--include/lib/libgcc.h1
-rw-r--r--include/linux/time.h6
-rw-r--r--include/printk.h2
-rw-r--r--lib/Kconfig3
-rw-r--r--lib/Makefile1
-rw-r--r--lib/gui/2d-primitives.c2
-rw-r--r--lib/muldi3.c73
-rw-r--r--lib/parameter.c4
-rw-r--r--net/lib.c8
-rwxr-xr-xscripts/mkcompile_h2
48 files changed, 559 insertions, 115 deletions
diff --git a/Documentation/boards/at91.rst b/Documentation/boards/at91.rst
new file mode 100644
index 0000000..f25cb01
--- /dev/null
+++ b/Documentation/boards/at91.rst
@@ -0,0 +1,51 @@
+Microchip (Atmel) AT91
+======================
+
+The Microchip (former Atmel) AT91 architecure has very good support within
+barebox.
+Most boards today have their description in their board files, but
+boards are slowly migrating to use DT.
+Likewise most boards are not yet migrated to multi image support, but
+this is also ongoing.
+
+The boot process of the AT91 CPU's is a two step process.
+The first step is named the bootstrap and at91bootstrap
+is often used (https://github.com/linux4sam/at91bootstrap).
+barebox supports bootstrapping some at91 boards as documented
+in the following.
+
+The bootstrap program are loaded by a boot program and can be loaded
+from DataFlash, NAND Flash, SD Card or via USB.
+The bootstrap program do the low-level configuration of the
+processor and then load and execute barebox.
+
+AT91 boards
+-----------
+The majority of the supported boards have a short entry here.
+For each board defconfig file(s) are noted but barebox may include additional
+defconfig files and may also include boards not included in the following.
+
+.. toctree::
+ :glob:
+ :maxdepth: 1
+
+ at91/*
+
+TODO
+----
+This is a list of AT91 specific TODO items, listed in no particular order.
+
+* fix prototype for barebox_arm_reset_vector. Introduce the prototype:
+
+.. code-block:: c
+
+ void __naked __bare_init barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2)
+
+
+This will unify the prototype for the reset vector for multi image and standalone images
+
+* Update remaining boards to DT
+* Update remaing boards to support multi image boot
+* Get bootstrap working in combination with multi image
+* Introduce defaultenv2 for all boards
+* Add pwm driver (required to support backlight)
diff --git a/Documentation/boards/at91/microchip-at91rm9200-ek.rst b/Documentation/boards/at91/microchip-at91rm9200-ek.rst
new file mode 100644
index 0000000..2eecf48
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91rm9200-ek.rst
@@ -0,0 +1,8 @@
+Atmel AT91RM9200-EK Evaluation Kit
+==================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91rm9200ek_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9260-ek.rst b/Documentation/boards/at91/microchip-at91sam9260-ek.rst
new file mode 100644
index 0000000..c54c262
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9260-ek.rst
@@ -0,0 +1,8 @@
+Atmel AT91SAM9260-EK Evaluation Kit
+===================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9260ek_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9261-ek.rst b/Documentation/boards/at91/microchip-at91sam9261-ek.rst
new file mode 100644
index 0000000..df88282
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9261-ek.rst
@@ -0,0 +1,18 @@
+Atmel AT91SAM9261-EK Evaluation Kit
+===================================
+
+For AT91SAM9261-EK there are three defconfigs.
+
+The two defconfigs listed below are almost identical.
+The one named _first_stage_ can be used for FLASH as it allows the first part to be loaded to SRAM.
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9261ek_defconfig
+ make ARCH=arm at91sam9261ek_first_stage_defconfig
+
+The following defconfig can be used to build a bootstrap variant of barebox
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9261ek_bootstrap_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9263-ek.rst b/Documentation/boards/at91/microchip-at91sam9263-ek.rst
new file mode 100644
index 0000000..8022cdd
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9263-ek.rst
@@ -0,0 +1,132 @@
+Atmel AT91SAM9263-EK Evaluation Kit
+===================================
+
+The AT91SAM9263-EK evaluation kit supports Device Tree and Multi Images.
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9263ek_defconfig
+
+Notes while working on at91sam9263ek bootstrap support
+
+The at91sam9263 have support for a boot program,
+like the other members in the Atmel at91 series.
+
+The boot program (ROMBOOT) will try to load the
+boot program from DataFlash, SD Card, NAND Flash and USB
+
+SD Card is the first to try.
+It looks for a file named BOOT.BIN in the first
+partition in a FAT16/32 filesystem.
+
+To generate the SD Card image I used genimage:
+(https://github.com/pengutronix/genimage)
+Onle 2 GB SD card works, 4 GB did not work. ROMBOOT do not
+support high capacity SD cards.
+
+Configuration file:
+
+.. code-block:: none
+
+ image boot.vfat {
+ name = "boot"
+ vfat {
+ /*
+ * RomBOOT in the at91sam9263 does not recognize
+ * the default FAT partition created by mkdosfs.
+ * -n BOOT - Set volume label to "BOOT"
+ * -F 16 - Force the partition to FAT 16
+ * -D 0 - Set drive number to 0
+ * -R 1 -a - Reserve only one sector
+ * The combination of "-D 0" AND "-R 1 -a"
+ * is required with mkdosfs version 4.1
+ */
+ extraargs = "-n BOOT -F 16 -D 0 -R 1 -a"
+ file BOOT.BIN { image = "barebox.bin" } // barebox.bin from root of barebox dir
+ file barebox.bin { image = "barebox-at91sam9263ek.img" }
+ file zImage { image = "zImage" }
+ }
+
+ size = 16M
+ }
+
+ image rootfs.ext4 {
+ ext4 {
+ label = "root"
+ }
+ mountpoint = "/"
+ size = 1500M
+ }
+
+ image SD {
+ hdimage {}
+
+ partition boot {
+ partition-type = 0xc
+ bootable = "true"
+ image = "boot.vfat"
+ }
+
+ partition root {
+ image = "rootfs.ext4"
+ partition-type = 0x83
+ }
+
+ }
+
+ROMBOOT will load the BOOT.BIN file to internal SRAM that
+starts at 0x300000. Maximum size 0x12000 (72 KiB).
+When loaded ROMBOOT will remap like this:
+
+.. code-block:: none
+
+ 0x00000000 0x00000000
+ Internal ROM => Internal SRAM
+
+ 0x00300000 0x00400000
+ Internal SRAM => Internal ROM
+
+It is not documented but assumed that ROMBOOT uses the
+MMU to remap the addresses.
+There seems not to be a dedicated remapping feature that is used.
+
+Note: For DataFlash and NAND Flash the image is validated.
+The first 28 bytes must be valid load PC or PC relative addressing.
+Vector 0x6 must include the size of the image (in bytes).
+This validation is (according to datasheet) not done for SD Card boots.
+
+barebox related notes when trying to make it work with PBL enabled
+
+To let barebox detect the SD card early use: CONFIG_MCI_STARTUP=y
+
+When PBL (and MULTI_IMAGE) are enabled then barebox creates
+a binary with the following structure:
+
+.. code-block:: none
+
+ +----------------------+
+ | PBL (PreBootLoader) |
+ +----------------------+
+ | piggy.o |
+ |+--------------------+|
+ ||barebox second stage||
+ |+--------------------+|
+ +----------------------+
+
+The PBL contains code from the sections .text_head_entry*, .text_bare_init* and .text*
+
+``.text_head_entry*:``
+This is the reset vector and exception vectors. Must be the very first in the file
+
+``.text_bare_init*:``
+Everything in this section, and , is checked at link time.
+Size most be less than BAREBOX_MAX_BARE_INIT_SIZE / ARCH_BAREBOX_MAX_BARE_INIT_SIZE
+
+at91 specify the size of the two sections in exception vector 6 (see above),
+if CONFIG_AT91_LOAD_BAREBOX_SRAM is defined.
+I think this is because some at91 variants have only very limited SRAM size,
+and we copy only a minimal part to the SRAM. The remaining part is then
+executed in-place.
+For at91sam9263 we have a large SRAM so there is room for the full bootstrap binary.
diff --git a/Documentation/boards/at91/microchip-at91sam9g10-ek.rst b/Documentation/boards/at91/microchip-at91sam9g10-ek.rst
new file mode 100644
index 0000000..f8f7d56
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9g10-ek.rst
@@ -0,0 +1,8 @@
+Atmel AT91SAM9G10-EK Evaluation Kit
+===================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9g10ek_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9g20-ek.rst b/Documentation/boards/at91/microchip-at91sam9g20-ek.rst
new file mode 100644
index 0000000..b641e0a
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9g20-ek.rst
@@ -0,0 +1,8 @@
+Atmel AT91SAM9G20-EK Evaluation Kit
+===================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9g20ek_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst b/Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst
new file mode 100644
index 0000000..ac54ed7
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9m10g45-ek.rst
@@ -0,0 +1,8 @@
+Atmel AT91SAM9M10G45-EK Evaluation Kit
+======================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9m10g45ek_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9n12-ek.rst b/Documentation/boards/at91/microchip-at91sam9n12-ek.rst
new file mode 100644
index 0000000..8aeba53
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9n12-ek.rst
@@ -0,0 +1,8 @@
+Atmel AT91SAM9N12-EK Evaluation Kit
+===================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9n12ek_defconfig
diff --git a/Documentation/boards/at91/microchip-at91sam9x5-ek.rst b/Documentation/boards/at91/microchip-at91sam9x5-ek.rst
new file mode 100644
index 0000000..4c7b0cf
--- /dev/null
+++ b/Documentation/boards/at91/microchip-at91sam9x5-ek.rst
@@ -0,0 +1,10 @@
+Atmel AT91SAM9X5-EK Evaluation Kit
+===================================
+
+The AT91SAM9X5-EK kit supports Device Tree and Multi Images.
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm at91sam9x5ek_defconfig
diff --git a/Documentation/boards/at91/microchip-ksz9477-evb.rst b/Documentation/boards/at91/microchip-ksz9477-evb.rst
new file mode 100644
index 0000000..4c4c4ae
--- /dev/null
+++ b/Documentation/boards/at91/microchip-ksz9477-evb.rst
@@ -0,0 +1,11 @@
+Microchip KSZ 9477 Evaluation board
+===================================
+
+This is an evaluation board for a switch that uses the at91sam9x5 CPU.
+The board uses Device Tree and supports multi image.
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm microchip_ksz9477_evb_defconfig
diff --git a/Documentation/boards/at91/microchip-sama5d3-xplained.rst b/Documentation/boards/at91/microchip-sama5d3-xplained.rst
new file mode 100644
index 0000000..e96111a
--- /dev/null
+++ b/Documentation/boards/at91/microchip-sama5d3-xplained.rst
@@ -0,0 +1,8 @@
+Atmel SAMA5D3_XPLAINED Evaluation Kit
+=====================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm sama5d3_xplained_defconfig
diff --git a/Documentation/boards/at91/microchip-sama5d3x-ek.rst b/Documentation/boards/at91/microchip-sama5d3x-ek.rst
new file mode 100644
index 0000000..10bf2e6
--- /dev/null
+++ b/Documentation/boards/at91/microchip-sama5d3x-ek.rst
@@ -0,0 +1,8 @@
+Atmel SAMA5D3X Evaluation Kit
+=============================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm sama5d3xek_defconfig
diff --git a/Documentation/boards/at91/microchip-sama5d4-xplained.rst b/Documentation/boards/at91/microchip-sama5d4-xplained.rst
new file mode 100644
index 0000000..d8615e4
--- /dev/null
+++ b/Documentation/boards/at91/microchip-sama5d4-xplained.rst
@@ -0,0 +1,8 @@
+Atmel SAMA5D4 XPLAINED ULTRA Evaluation Kit
+===========================================
+
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm sama5d4_xplained_defconfig
diff --git a/Documentation/boards/at91/somfy-animeo-ip.rst b/Documentation/boards/at91/somfy-animeo-ip.rst
new file mode 100644
index 0000000..a871794
--- /dev/null
+++ b/Documentation/boards/at91/somfy-animeo-ip.rst
@@ -0,0 +1,4 @@
+Somfy Animeo IP
+===============
+
+No defconfig provided to build barebox
diff --git a/Documentation/boards/at91/telit-evk-pro3.rst b/Documentation/boards/at91/telit-evk-pro3.rst
new file mode 100644
index 0000000..ea0b070
--- /dev/null
+++ b/Documentation/boards/at91/telit-evk-pro3.rst
@@ -0,0 +1,9 @@
+Atmel Telit EVK-PRO3
+====================
+
+Telit EVK-PRO3 with GE863-PRO3
+Building barebox:
+
+.. code-block:: sh
+
+ make ARCH=arm telit_evk_pro3_defconfig
diff --git a/Documentation/boards/imx.rst b/Documentation/boards/imx.rst
index 99ca10b..2e6a30f 100644
--- a/Documentation/boards/imx.rst
+++ b/Documentation/boards/imx.rst
@@ -43,22 +43,51 @@ SD card:
The above will overwrite the MBR (and consequently the partition table)
on the destination SD card. To preserve the MBR while writing the rest
-of the image to the card, use::
+of the image to the card, use:
+
+.. code-block:: sh
dd if=images/barebox-freescale-imx51-babbage.img of=/dev/sdd bs=1024 skip=1 seek=1
-NOTE: MaskROM on i.MX8 expects image to start at +33KiB mark, so the
+Note that MaskROM on i.MX8 expects the image to start at the +33KiB mark, so the
following command has to be used instead:
+.. code-block:: sh
+
dd if=images/barebox-nxp-imx8mq-evk.img of=/dev/sdd bs=1024 skip=33 seek=33
Or, in case of NAND:
+.. code-block:: sh
+
dd if=images/barebox-nxp-imx8mq-evk.img of=/dev/nand bs=1024 skip=33 seek=1
-The images can also always be started second stage::
+The images can also always be started as second stage on the target:
+
+.. code-block:: console
+
+ barebox@Board Name:/ bootm /mnt/tftp/barebox-freescale-imx51-babbage.img
+
+Using GPT on i.MX
+^^^^^^^^^^^^^^^^^
+
+For i.MX SoCs that place a vendor specific header at the +1KiB mark of a
+boot medium, special care needs to be taken when partitioning that medium
+with GPT. In order to make room for the i.MX boot header, the GPT Partition
+Entry Array needs to be moved from its typical location, LBA 2, to an
+offset past vendor specific information. One way to do this would be
+to use the ``-j`` or ``--adjust-main-table`` option of ``sgdisk``. For
+example, the following sequence
+
+.. code-block:: sh
+
+ sgdisk -Z <block device>
+ sgdisk -o -j 2048 -n 1:8192:+100M <block device>
- bootm /mnt/tftp/barebox-freescale-imx51-babbage.img
+will create a single GPT partition starting at LBA 8192 and would
+place the Partition Entry Array starting at LBA 2048, which should leave
+enough room for the Barebox/i.MX boot header. Once that is done, the ``dd``
+command above can be used to place Barebox on the same medium.
Information about the ``imx-image`` tool
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -70,46 +99,48 @@ options in this file are:
Header:
-+----------------+--------------------------------------------------------------+
-| soc <soctype> |soctype can be one of imx35, imx51, imx53, imx6, imx7, vf610, |
-| | imx8mq |
-+----------------+--------------------------------------------------------------+
-| loadaddr <adr> | The address the binary is uploaded to |
-+----------------+--------------------------------------------------------------+
-| dcdofs <ofs> | The offset of the image header in the image. This should be: |
-| | * ``0x400``: MMC/SD, NAND, serial ROM, PATA, SATA |
-| | * ``0x1000``: NOR Flash |
-| | * ``0x100``: OneNAND |
-+----------------+--------------------------------------------------------------+
++--------------------+--------------------------------------------------------------+
+| ``soc <soctype>`` | soctype can be one of imx35, imx51, imx53, imx6, imx7, vf610,|
+| | imx8mq |
++--------------------+--------------------------------------------------------------+
+| ``loadaddr <adr>`` | The address the binary is uploaded to |
++--------------------+--------------------------------------------------------------+
+| ``dcdofs <ofs>`` | The offset of the image header in the image. This should be: |
+| | |
+| | * ``0x400``: MMC/SD, NAND, serial ROM, PATA, SATA |
+| | * ``0x1000``: NOR Flash |
+| | * ``0x100``: OneNAND |
++--------------------+--------------------------------------------------------------+
Memory manipulation:
-+------------------------------------+-----------------------------------------+
-| wm 8 <addr> <value> | write <value> into byte <addr> |
-+------------------------------------+-----------------------------------------+
-| wm 16 <addr> <value> | write <value> into short <addr> |
-+------------------------------------+-----------------------------------------+
-| wm 32 <addr> <value> | write <value> into word <addr> |
-+------------------------------------+-----------------------------------------+
-| set_bits <width> <addr> <value> | set set bits in <value> in <addr> |
-+------------------------------------+-----------------------------------------+
-| clear_bits <width> <addr> <value> | clear set bits in <value> in <addr> |
-+------------------------------------+-----------------------------------------+
-| nop | do nothing (just waste time) |
-+------------------------------------+-----------------------------------------+
-
-<width> can be of 8, 16 or 32.
++----------------------------------------+-------------------------------------------------+
+| ``wm 8 <addr> <value>`` | write ``<value>`` into byte ``<addr>`` |
++----------------------------------------+-------------------------------------------------+
+| ``wm 16 <addr> <value>`` | write ``<value>`` into short ``<addr>`` |
++----------------------------------------+-------------------------------------------------+
+| ``wm 32 <addr> <value>`` | write ``<value>`` into word ``<addr>`` |
++----------------------------------------+-------------------------------------------------+
+| ``set_bits <width> <addr> <value>`` | set set bits in ``<value>`` in ``<addr>`` |
++----------------------------------------+-------------------------------------------------+
+| ``clear_bits <width> <addr> <value>`` | clear set bits in ``<value>`` in ``<addr>`` |
++----------------------------------------+-------------------------------------------------+
+| ``nop`` | do nothing (just waste time) |
++----------------------------------------+-------------------------------------------------+
+
+``<width>`` can be one of 8, 16 or 32.
Checking conditions:
-+------------------------------------+-----------------------------------------+
-| check <width> <cond> <addr> <mask> | Poll until condition becomes true. |
-| | with <cond> being one of: |
-| | * ``until_all_bits_clear`` |
-| | * ``until_all_bits_set`` |
-| | * ``until_any_bit_clear`` |
-| | * ``until_any_bit_set`` |
-+------------------------------------+-----------------------------------------+
++----------------------------------------+-----------------------------------------+
+| ``check <width> <cond> <addr> <mask>`` | Poll until condition becomes true. |
+| | with ``<cond>`` being one of: |
+| | |
+| | * ``until_all_bits_clear`` |
+| | * ``until_all_bits_set`` |
+| | * ``until_any_bit_clear`` |
+| | * ``until_any_bit_set`` |
++----------------------------------------+-----------------------------------------+
Some notes about the mentioned *conditions*.
diff --git a/README b/README
index 940e1f9..dada97c 100644
--- a/README
+++ b/README
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0-only
+
Barebox
-------
@@ -222,3 +224,33 @@ are the release rules:
does never change, in order to make life easier for distribution
people.
+
+License
+-------
+
+Copyright (C) 2000 - 2005 Wolfgang Denk, DENX Software Engineering, wd@denx.de.
+Copyright (C) 2018 Sascha Hauer, Pengutronix, and individual contributors
+
+Barebox is free software: you can redistribute it and/or modify it under the
+terms of the GNU General Public License, version 2, as published by the Free
+Software Foundation.
+
+This program is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License in the file
+COPYING along with this program. If not, see <https://www.gnu.org/licenses/>.
+
+Individual files may contain the following SPDX license tags as a shorthand for
+the above copyright and warranty notices:
+
+ SPDX-License-Identifier: GPL-2.0-only
+ SPDX-License-Identifier: GPL-2.0-or-later
+
+This eases machine processing of licensing information based on the SPDX
+License Identifiers that are available at http://spdx.org/licenses/.
+
+Also note that some files in the Barebox source tree are available under
+several different GPLv2-compatible open-source licenses. This fact is noted
+clearly in the file headers of the respective files.
diff --git a/arch/arm/boards/at91sam9263ek/Makefile b/arch/arm/boards/at91sam9263ek/Makefile
index 66083a2..d4d5e76 100644
--- a/arch/arm/boards/at91sam9263ek/Makefile
+++ b/arch/arm/boards/at91sam9263ek/Makefile
@@ -1,7 +1,7 @@
ifeq ($(CONFIG_OFDEVICE),)
obj-y += init.o
endif
-obj-$(CONFIG_OF_DEVICE) += of_init.o
+obj-$(CONFIG_OFDEVICE) += of_init.o
lwl-y += lowlevel_init.o
diff --git a/arch/arm/boards/clep7212/clep7212.c b/arch/arm/boards/clep7212/clep7212.c
index 584ecdc..641fa15 100644
--- a/arch/arm/boards/clep7212/clep7212.c
+++ b/arch/arm/boards/clep7212/clep7212.c
@@ -37,7 +37,7 @@ static int clps711x_devices_init(void)
add_cfi_flash_device(DEVICE_ID_DYNAMIC, (unsigned long)cfi_io, SZ_32M,
IORESOURCE_MEM);
- devfs_add_partition("nor0", 0x00000, SZ_256K, DEVFS_PARTITION_FIXED,
+ devfs_add_partition("nor0", 0x00000, SZ_512K, DEVFS_PARTITION_FIXED,
"self0");
devfs_add_partition("nor0", SZ_256K, SZ_256K, DEVFS_PARTITION_FIXED,
"env0");
diff --git a/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor b/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor
index 39777f9..e2e518c 100644
--- a/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor
+++ b/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor
@@ -1,6 +1,6 @@
#!/bin/sh
-mtdparts="256k(boot),256k(env),3584k(kernel),-(root)"
+mtdparts="512k(boot),256k(env),3584k(kernel),-(root)"
kernelname="physmap-flash.0"
mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts}
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index a67345f..c7e4962 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -396,6 +396,9 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
} else { /* MCI1 */
start = AT91SAM9263_BASE_MCI1;
+ /* CLK */
+ at91_set_A_periph(AT91_PIN_PA6, 0);
+
if (data->slot_b) {
/* CMD */
at91_set_A_periph(AT91_PIN_PA21, 1);
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index 0853ce2..c00514e 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -24,7 +24,7 @@ endmenu
config ARCH_TEXT_BASE
hex
- default 0xc0780000 if MACH_CLEP7212
+ default 0xc0740000 if MACH_CLEP7212
config BAREBOX_MAX_IMAGE_SIZE
hex
diff --git a/commands/boot.c b/commands/boot.c
index 5d81d79..0257b3d 100644
--- a/commands/boot.c
+++ b/commands/boot.c
@@ -29,10 +29,6 @@ static int do_boot(int argc, char *argv[])
struct bootentries *entries;
struct bootentry *entry;
- verbose = 0;
- dryrun = 0;
- timeout = -1;
-
while ((opt = getopt(argc, argv, "vldmt:w:")) > 0) {
switch (opt) {
case 'v':
diff --git a/commands/miitool.c b/commands/miitool.c
index acf6142..4ea6fda 100644
--- a/commands/miitool.c
+++ b/commands/miitool.c
@@ -281,12 +281,6 @@ static int do_miitool(int argc, char *argv[])
while ((opt = getopt(argc, argv, "vs:r:")) > 0) {
switch (opt) {
- case 'a':
- addr = simple_strtol(optarg, NULL, 0);
- break;
- case 'b':
- bus = simple_strtoul(optarg, NULL, 0);
- break;
case 's':
action = MIITOOL_SHOW;
phydevname = xstrdup(optarg);
diff --git a/commands/nand-bitflip.c b/commands/nand-bitflip.c
index a8a97c1..cfde2f4 100644
--- a/commands/nand-bitflip.c
+++ b/commands/nand-bitflip.c
@@ -107,6 +107,7 @@ BAREBOX_CMD_HELP_START(nand_bitflip)
BAREBOX_CMD_HELP_TEXT("This command creates bitflips on Nand pages.")
BAREBOX_CMD_HELP_TEXT("Options:")
BAREBOX_CMD_HELP_OPT ("-b <block>", "block to work on")
+BAREBOX_CMD_HELP_OPT ("-c\t", "Check only for bitflips")
BAREBOX_CMD_HELP_OPT ("-o <offset>", "offset in Nand")
BAREBOX_CMD_HELP_OPT ("-r\t", "flip random bits")
BAREBOX_CMD_HELP_OPT ("-n <numbitflips>", "Specify maximum number of bitflips to generate")
diff --git a/common/memory_display.c b/common/memory_display.c
index cd0eadf..fbb8bbb 100644
--- a/common/memory_display.c
+++ b/common/memory_display.c
@@ -96,7 +96,7 @@ int __pr_memory_display(int level, const void *addr, loff_t offs, unsigned nbyte
offs += size;
}
- pos += sprintf(pos, "%*s", 61 - (pos - line), "");
+ pos += sprintf(pos, "%*s", (int)(61 - (pos - line)), "");
cp = linebuf;
for (i = 0; i < linebytes; i++) {
diff --git a/common/state/state_variables.c b/common/state/state_variables.c
index 269d175..6a00c82 100644
--- a/common/state/state_variables.c
+++ b/common/state/state_variables.c
@@ -102,7 +102,7 @@ static int state_uint8_set(struct param_d *p, void *priv)
static struct state_variable *state_uint8_create(struct state *state,
const char *name,
struct device_node *node,
- const struct variable_type *vtype)
+ const struct variable_type *vtype)
{
struct state_uint32 *su32;
struct param_d *param;
@@ -132,7 +132,7 @@ static struct state_variable *state_uint8_create(struct state *state,
static struct state_variable *state_uint32_create(struct state *state,
const char *name,
struct device_node *node,
- const struct variable_type *vtype)
+ const struct variable_type *vtype)
{
struct state_uint32 *su32;
struct param_d *param;
@@ -223,7 +223,7 @@ static int state_enum32_import(struct state_variable *sv,
static struct state_variable *state_enum32_create(struct state *state,
const char *name,
struct device_node *node,
- const struct variable_type *vtype)
+ const struct variable_type *vtype)
{
struct state_enum32 *enum32;
int ret, i, num_names;
@@ -307,7 +307,7 @@ static int state_mac_import(struct state_variable *sv, struct device_node *node)
static struct state_variable *state_mac_create(struct state *state,
const char *name,
struct device_node *node,
- const struct variable_type *vtype)
+ const struct variable_type *vtype)
{
struct state_mac *mac;
int ret;
@@ -409,7 +409,7 @@ static int state_string_get(struct param_d *p, void *priv)
static struct state_variable *state_string_create(struct state *state,
const char *name,
struct device_node *node,
- const struct variable_type *vtype)
+ const struct variable_type *vtype)
{
struct state_string *string;
uint32_t start_size[2];
diff --git a/drivers/led/core.c b/drivers/led/core.c
index a388e6b..431966d 100644
--- a/drivers/led/core.c
+++ b/drivers/led/core.c
@@ -127,12 +127,13 @@ static void led_blink_func(struct poller_struct *poller)
struct led *led;
list_for_each_entry(led, &leds, list) {
+ const uint64_t now = get_time_ns();
int on;
if (!led->blink && !led->flash)
continue;
- if (led->blink_next_event > get_time_ns()) {
+ if (led->blink_next_event > now) {
continue;
}
@@ -140,7 +141,7 @@ static void led_blink_func(struct poller_struct *poller)
if (on)
on = led->max_value;
- led->blink_next_event = get_time_ns() +
+ led->blink_next_event = now +
(led->blink_states[led->blink_next_state] * MSECOND);
led->blink_next_state = (led->blink_next_state + 1) %
led->blink_nr_states;
@@ -176,7 +177,7 @@ int led_blink_pattern(struct led *led, const unsigned int *pattern,
pattern_len * sizeof(*led->blink_states));
led->blink_nr_states = pattern_len;
led->blink_next_state = 0;
- led->blink_next_event = get_time_ns();
+ led->blink_next_event = 0;
led->blink = 1;
led->flash = 0;
@@ -187,7 +188,7 @@ int led_blink(struct led *led, unsigned int on_ms, unsigned int off_ms)
{
unsigned int pattern[] = {on_ms, off_ms};
- return led_blink_pattern(led, pattern, 2);
+ return led_blink_pattern(led, ARRAY_AND_SIZE(pattern));
}
int led_flash(struct led *led, unsigned int duration_ms)
@@ -195,7 +196,7 @@ int led_flash(struct led *led, unsigned int duration_ms)
unsigned int pattern[] = {duration_ms, 0};
int ret;
- ret = led_blink_pattern(led, pattern, 2);
+ ret = led_blink_pattern(led, ARRAY_AND_SIZE(pattern));
if (ret)
return ret;
diff --git a/drivers/mci/mci-core.c b/drivers/mci/mci-core.c
index c8d1d5e..0bd68b1 100644
--- a/drivers/mci/mci-core.c
+++ b/drivers/mci/mci-core.c
@@ -1628,7 +1628,12 @@ static int mci_register_partition(struct mci_part *part)
if (np) {
of_parse_partitions(&part->blk.cdev, np);
- of_partitions_register_fixup(&part->blk.cdev);
+
+ /* bootN-partitions binding barebox-specific, so don't register
+ * for fixup into kernel device tree
+ */
+ if (part->area_type != MMC_BLK_DATA_AREA_BOOT)
+ of_partitions_register_fixup(&part->blk.cdev);
}
return 0;
@@ -1650,13 +1655,11 @@ static int mci_card_probe(struct mci *mci)
return -ENODEV;
}
- if (!IS_ERR(host->supply)) {
- ret = regulator_enable(host->supply);
- if (ret) {
- dev_err(&mci->dev, "failed to enable regulator: %s\n",
- strerror(-ret));
- return ret;
- }
+ ret = regulator_enable(host->supply);
+ if (ret) {
+ dev_err(&mci->dev, "failed to enable regulator: %s\n",
+ strerror(-ret));
+ return ret;
}
/* start with a host interface reset */
@@ -1728,8 +1731,7 @@ on_error:
if (rc != 0) {
host->clock = 0; /* disable the MCI clock */
mci_set_ios(mci);
- if (!IS_ERR(host->supply))
- regulator_disable(host->supply);
+ regulator_disable(host->supply);
}
return rc;
@@ -1816,8 +1818,10 @@ int mci_register(struct mci_host *host)
mci->dev.detect = mci_detect;
host->supply = regulator_get(host->hw_dev, "vmmc");
- if (IS_ERR(host->supply))
+ if (IS_ERR(host->supply)) {
dev_err(&mci->dev, "Failed to get 'vmmc' regulator.\n");
+ host->supply = NULL;
+ }
ret = register_device(&mci->dev);
if (ret)
diff --git a/drivers/mfd/rave-sp.c b/drivers/mfd/rave-sp.c
index b7efb62..1448c41 100644
--- a/drivers/mfd/rave-sp.c
+++ b/drivers/mfd/rave-sp.c
@@ -320,7 +320,6 @@ int rave_sp_exec(struct rave_sp *sp,
unsigned char *data = __data;
int command, ret = 0;
u8 ackid;
- uint64_t start = get_time_ns();
command = sp->variant->cmd.translate(data[0]);
if (command < 0)
@@ -340,12 +339,9 @@ int rave_sp_exec(struct rave_sp *sp,
* is_timeout will implicitly poll serdev via poller
* infrastructure
*/
- while (!is_timeout(start, SECOND) && !reply.received)
- ;
-
- if (!reply.received) {
+ ret = wait_on_timeout(SECOND, reply.received);
+ if (ret) {
dev_err(dev, "Command timeout\n");
- ret = -ETIMEDOUT;
sp->reply = NULL;
}
diff --git a/drivers/mfd/syscon.c b/drivers/mfd/syscon.c
index 957d9a7..30ed65f 100644
--- a/drivers/mfd/syscon.c
+++ b/drivers/mfd/syscon.c
@@ -176,7 +176,7 @@ static int syscon_probe(struct device_d *dev)
syscon->base = IOMEM(res->start);
dev->priv = syscon;
- dev_dbg(dev, "map 0x%x-0x%x registered\n", res->start, res->end);
+ dev_dbg(dev, "map %pa-%pa registered\n", &res->start, &res->end);
return 0;
}
diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c
index c2628cc..4823b08 100644
--- a/drivers/net/fec_imx.c
+++ b/drivers/net/fec_imx.c
@@ -51,7 +51,7 @@ static int fec_miibus_read(struct mii_bus *bus, int phyAddr, int regAddr)
* wait for the related interrupt
*/
if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg,
- reg & FEC_IEVENT_MII, MSECOND)) {
+ reg & FEC_IEVENT_MII, USEC_PER_MSEC)) {
dev_err(&fec->edev.dev, "Read MDIO failed...\n");
return -1;
}
@@ -88,7 +88,7 @@ static int fec_miibus_write(struct mii_bus *bus, int phyAddr,
* wait for the MII interrupt
*/
if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg,
- reg & FEC_IEVENT_MII, MSECOND)) {
+ reg & FEC_IEVENT_MII, USEC_PER_MSEC)) {
dev_err(&fec->edev.dev, "Write MDIO failed...\n");
return -1;
}
@@ -401,7 +401,7 @@ static void fec_halt(struct eth_device *dev)
/* wait for graceful stop to register */
if (readl_poll_timeout(fec->regs + FEC_IEVENT, reg,
- reg & FEC_IEVENT_GRA, SECOND))
+ reg & FEC_IEVENT_GRA, USEC_PER_SEC))
dev_err(&dev->dev, "graceful stop timeout\n");
/* Disable SmartDMA tasks */
@@ -475,7 +475,7 @@ static int fec_send(struct eth_device *dev, void *eth_data, int data_length)
fec_tx_task_enable(fec);
if (readw_poll_timeout(&fec->tbd_base[fec->tbd_index].status,
- status, !(status & FEC_TBD_READY), SECOND))
+ status, !(status & FEC_TBD_READY), USEC_PER_SEC))
dev_err(&dev->dev, "transmission timeout\n");
dma_unmap_single(fec->dev, dma, data_length, DMA_TO_DEVICE);
@@ -796,7 +796,7 @@ static int fec_probe(struct device_d *dev)
/* Reset chip. */
writel(FEC_ECNTRL_RESET, fec->regs + FEC_ECNTRL);
ret = readl_poll_timeout(fec->regs + FEC_ECNTRL, reg,
- !(reg & FEC_ECNTRL_RESET), SECOND);
+ !(reg & FEC_ECNTRL_RESET), USEC_PER_SEC);
if (ret)
goto free_gpio;
diff --git a/drivers/nvmem/ocotp.c b/drivers/nvmem/ocotp.c
index d904bd0..5b8b925 100644
--- a/drivers/nvmem/ocotp.c
+++ b/drivers/nvmem/ocotp.c
@@ -706,11 +706,4 @@ static struct driver_d imx_ocotp_driver = {
.probe = imx_ocotp_probe,
.of_compatible = DRV_OF_COMPAT(imx_ocotp_dt_ids),
};
-
-static int imx_ocotp_init(void)
-{
- platform_driver_register(&imx_ocotp_driver);
-
- return 0;
-}
-postcore_initcall(imx_ocotp_init);
+postcore_platform_driver(imx_ocotp_driver);
diff --git a/drivers/serial/amba-pl011.c b/drivers/serial/amba-pl011.c
index 4c4067d..ce40f84 100644
--- a/drivers/serial/amba-pl011.c
+++ b/drivers/serial/amba-pl011.c
@@ -185,7 +185,7 @@ static int pl011_probe(struct amba_device *dev, const struct amba_id *id)
struct regulator *r;
r = regulator_get(&dev->dev, NULL);
- if (r) {
+ if (!IS_ERR(r)) {
int ret;
ret = regulator_enable(r);
diff --git a/drivers/usb/gadget/dfu.c b/drivers/usb/gadget/dfu.c
index d7bf92c..c2b3d48 100644
--- a/drivers/usb/gadget/dfu.c
+++ b/drivers/usb/gadget/dfu.c
@@ -489,7 +489,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
value = handle_dnload(f, ctrl);
dfu->dfu_state = DFU_STATE_dfuDNLOAD_IDLE;
return 0;
- break;
case USB_REQ_DFU_UPLOAD:
dfu->dfu_state = DFU_STATE_dfuUPLOAD_IDLE;
debug("dfu: starting upload from %s\n", dfu_file_entry->filename);
@@ -505,7 +504,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
}
handle_upload(f, ctrl);
return 0;
- break;
case USB_REQ_DFU_ABORT:
dfu->dfu_status = DFU_STATUS_OK;
value = 0;
@@ -517,7 +515,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
default:
dfu->dfu_state = DFU_STATE_dfuERROR;
value = -EINVAL;
- goto out;
break;
}
break;
@@ -544,7 +541,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
case USB_REQ_DFU_UPLOAD:
handle_upload(f, ctrl);
return 0;
- break;
case USB_REQ_DFU_ABORT:
dfu_abort(dfu);
value = 0;
@@ -574,7 +570,6 @@ static int dfu_setup(struct usb_function *f, const struct usb_ctrlrequest *ctrl)
case DFU_STATE_dfuMANIFEST:
dfu->dfu_state = DFU_STATE_dfuERROR;
value = -EINVAL;
- goto out;
break;
default:
break;
diff --git a/drivers/video/mtl017.c b/drivers/video/mtl017.c
index 085ea11..c04875c 100644
--- a/drivers/video/mtl017.c
+++ b/drivers/video/mtl017.c
@@ -244,6 +244,9 @@ static int mtl017_probe(struct device_d *dev)
mtl017->client = to_i2c_client(dev);
mtl017->regulator = regulator_get(dev, "vdd");
+ if (IS_ERR(mtl017->regulator))
+ mtl017->regulator = NULL;
+
mtl017->enable_gpio = of_get_named_gpio_flags(dev->device_node,
"enable-gpios", 0, &flags);
if (gpio_is_valid(mtl017->enable_gpio)) {
@@ -265,8 +268,8 @@ static int mtl017_probe(struct device_d *dev)
return 0;
}
-static struct driver_d twl_driver = {
+static struct driver_d mtl_driver = {
.name = "mtl017",
.probe = mtl017_probe,
};
-device_i2c_driver(twl_driver);
+device_i2c_driver(mtl_driver);
diff --git a/fs/fat/ff.c b/fs/fat/ff.c
index 33f8b61..ba4adfc 100644
--- a/fs/fat/ff.c
+++ b/fs/fat/ff.c
@@ -1591,9 +1591,14 @@ static int chk_mounted ( /* 0(0): successful, !=0: any error occurred */
return -EINVAL;
/* Number of sectors per FAT */
+ fmt = FS_FAT12;
fasize = LD_WORD(fs->win+BPB_FATSz16);
- if (!fasize)
+ if (!fasize) {
fasize = LD_DWORD(fs->win+BPB_FATSz32);
+ if (fasize)
+ /* Must be FAT32 */
+ fmt = FS_FAT32;
+ }
fs->fsize = fasize;
/* Number of FAT copies */
@@ -1633,11 +1638,8 @@ static int chk_mounted ( /* 0(0): successful, !=0: any error occurred */
nclst = (tsect - sysect) / fs->csize;
if (!nclst)
return -EINVAL; /* (Invalid volume size) */
- fmt = FS_FAT12;
- if (nclst >= MIN_FAT16)
+ if (fmt == FS_FAT12 && nclst >= MIN_FAT16)
fmt = FS_FAT16;
- if (nclst >= MIN_FAT32)
- fmt = FS_FAT32;
/* Boundaries and Limits */
/* Number of FAT entries */
diff --git a/include/lib/libgcc.h b/include/lib/libgcc.h
index adad277..f7b9be6 100644
--- a/include/lib/libgcc.h
+++ b/include/lib/libgcc.h
@@ -43,5 +43,6 @@ typedef union {
long long __lshrdi3(long long u, word_type b);
long long __ashldi3(long long u, word_type b);
long long __ashrdi3(long long u, word_type b);
+long long __muldi3(long long u, long long v);
#endif /* __ASM_LIBGCC_H */
diff --git a/include/linux/time.h b/include/linux/time.h
index 3a1bb50..7903139 100644
--- a/include/linux/time.h
+++ b/include/linux/time.h
@@ -3,7 +3,13 @@
#include <linux/types.h>
+#define MSEC_PER_SEC 1000L
+#define USEC_PER_MSEC 1000L
+#define NSEC_PER_USEC 1000L
+#define NSEC_PER_MSEC 1000000L
+#define USEC_PER_SEC 1000000L
#define NSEC_PER_SEC 1000000000L
+#define FSEC_PER_SEC 1000000000000000LL
struct timespec {
time_t tv_sec; /* seconds */
diff --git a/include/printk.h b/include/printk.h
index aaad075..ab2c64c 100644
--- a/include/printk.h
+++ b/include/printk.h
@@ -119,7 +119,7 @@ static inline void print_hex_dump(const char *level, const char *prefix_str,
int prefix_type, int rowsize, int groupsize,
const void *buf, size_t len, bool ascii)
{
- memory_display(buf, 0, len, 4, 0);
+ memory_display(buf, 0, len, groupsize, 0);
}
struct log_entry {
diff --git a/lib/Kconfig b/lib/Kconfig
index 67680ad..e048ade 100644
--- a/lib/Kconfig
+++ b/lib/Kconfig
@@ -145,4 +145,7 @@ config GENERIC_LIB_ASHRDI3
config GENERIC_LIB_LSHRDI3
bool
+config GENERIC_LIB_MULDI3
+ bool
+
endmenu
diff --git a/lib/Makefile b/lib/Makefile
index 8ece2c2..e72aa66 100644
--- a/lib/Makefile
+++ b/lib/Makefile
@@ -72,5 +72,6 @@ obj-$(CONFIG_CRC8) += crc8.o
obj-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
obj-$(CONFIG_GENERIC_LIB_ASHRDI3) += ashrdi3.o
obj-$(CONFIG_GENERIC_LIB_LSHRDI3) += lshrdi3.o
+obj-$(CONFIG_GENERIC_LIB_MULDI3) += muldi3.o
pbl-$(CONFIG_GENERIC_LIB_ASHLDI3) += ashldi3.o
diff --git a/lib/gui/2d-primitives.c b/lib/gui/2d-primitives.c
index 82e59d9..940e82b 100644
--- a/lib/gui/2d-primitives.c
+++ b/lib/gui/2d-primitives.c
@@ -7,6 +7,8 @@
#include <fs.h>
#include <malloc.h>
+#include <gui/2d-primitives.h>
+
static void __illuminate(struct fb_info *info,
int x, int y,
u8 r, u8 g, u8 b, u8 a)
diff --git a/lib/muldi3.c b/lib/muldi3.c
new file mode 100644
index 0000000..eec810e
--- /dev/null
+++ b/lib/muldi3.c
@@ -0,0 +1,73 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.
+ */
+
+#include <module.h>
+
+#include <lib/libgcc.h>
+
+#define W_TYPE_SIZE 32
+
+#define __ll_B ((unsigned long) 1 << (W_TYPE_SIZE / 2))
+#define __ll_lowpart(t) ((unsigned long) (t) & (__ll_B - 1))
+#define __ll_highpart(t) ((unsigned long) (t) >> (W_TYPE_SIZE / 2))
+
+/* If we still don't have umul_ppmm, define it using plain C. */
+#if !defined(umul_ppmm)
+#define umul_ppmm(w1, w0, u, v) \
+ do { \
+ unsigned long __x0, __x1, __x2, __x3; \
+ unsigned short __ul, __vl, __uh, __vh; \
+ \
+ __ul = __ll_lowpart(u); \
+ __uh = __ll_highpart(u); \
+ __vl = __ll_lowpart(v); \
+ __vh = __ll_highpart(v); \
+ \
+ __x0 = (unsigned long) __ul * __vl; \
+ __x1 = (unsigned long) __ul * __vh; \
+ __x2 = (unsigned long) __uh * __vl; \
+ __x3 = (unsigned long) __uh * __vh; \
+ \
+ __x1 += __ll_highpart(__x0); /* this can't give carry */\
+ __x1 += __x2; /* but this indeed can */ \
+ if (__x1 < __x2) /* did we get it? */ \
+ __x3 += __ll_B; /* yes, add it in the proper pos */ \
+ \
+ (w1) = __x3 + __ll_highpart(__x1); \
+ (w0) = __ll_lowpart(__x1) * __ll_B + __ll_lowpart(__x0);\
+ } while (0)
+#endif
+
+#if !defined(__umulsidi3)
+#define __umulsidi3(u, v) ({ \
+ DWunion __w; \
+ umul_ppmm(__w.s.high, __w.s.low, u, v); \
+ __w.ll; \
+ })
+#endif
+
+long long notrace __muldi3(long long u, long long v)
+{
+ const DWunion uu = {.ll = u};
+ const DWunion vv = {.ll = v};
+ DWunion w = {.ll = __umulsidi3(uu.s.low, vv.s.low)};
+
+ w.s.high += ((unsigned long) uu.s.low * (unsigned long) vv.s.high
+ + (unsigned long) uu.s.high * (unsigned long) vv.s.low);
+
+ return w.ll;
+}
+EXPORT_SYMBOL(__muldi3);
diff --git a/lib/parameter.c b/lib/parameter.c
index a21b8fa..00e9a9f 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -343,10 +343,10 @@ static int param_int_set(struct device_d *dev, struct param_d *p, const char *va
ret = strtobool(val, pi->value);
break;
case PARAM_TYPE_INT32:
- *(uint32_t *)pi->value = simple_strtol(val, NULL, 0);
+ *(int32_t *)pi->value = simple_strtol(val, NULL, 0);
break;
case PARAM_TYPE_UINT32:
- *(int32_t *)pi->value = simple_strtoul(val, NULL, 0);
+ *(uint32_t *)pi->value = simple_strtoul(val, NULL, 0);
break;
case PARAM_TYPE_INT64:
*(int64_t *)pi->value = simple_strtoll(val, NULL, 0);
diff --git a/net/lib.c b/net/lib.c
index d4343bc..d2b3313 100644
--- a/net/lib.c
+++ b/net/lib.c
@@ -28,13 +28,13 @@
#include <net.h>
#include <linux/ctype.h>
-int string_to_ethaddr(const char *str, u8 enetaddr[6])
+int string_to_ethaddr(const char *str, u8 enetaddr[ETH_ALEN])
{
int reg;
char *e;
if (!str || strlen(str) != 17) {
- memset(enetaddr, 0, 6);
+ memset(enetaddr, 0, ETH_ALEN);
return -EINVAL;
}
@@ -42,7 +42,7 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6])
str[11] != ':' || str[14] != ':')
return -EINVAL;
- for (reg = 0; reg < 6; ++reg) {
+ for (reg = 0; reg < ETH_ALEN; ++reg) {
enetaddr[reg] = simple_strtoul(str, &e, 16);
str = e + 1;
}
@@ -50,7 +50,7 @@ int string_to_ethaddr(const char *str, u8 enetaddr[6])
return 0;
}
-void ethaddr_to_string(const u8 enetaddr[6], char *str)
+void ethaddr_to_string(const u8 enetaddr[ETH_ALEN], char *str)
{
sprintf(str, "%02x:%02x:%02x:%02x:%02x:%02x",
enetaddr[0], enetaddr[1], enetaddr[2], enetaddr[3],
diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h
index 1a80ef7..60b20ca 100755
--- a/scripts/mkcompile_h
+++ b/scripts/mkcompile_h
@@ -72,7 +72,7 @@ UTS_TRUNCATE="cut -b -$UTS_LEN"
echo \#define BAREBOX_COMPILE_BY \"`echo $BAREBOX_COMPILE_BY | $UTS_TRUNCATE`\"
echo \#define BAREBOX_COMPILE_HOST \"`echo $BAREBOX_COMPILE_HOST | $UTS_TRUNCATE`\"
- echo \#define BAREBOX_COMPILER \"`$CC -v 2>&1 | tail -n 1`\"
+ echo \#define BAREBOX_COMPILER \"`$CC -v 2>&1 | grep ' version ' | sed 's/[[:space:]]*$//'`\"
) > .tmpcompile
# Only replace the real compile.h if the new one is different,