Commit graph

3984 commits

Author SHA1 Message Date
Sascha Hauer
d059216c48 Merge branch 'for-next/ubi' 2016-06-14 09:13:41 +02:00
Sascha Hauer
db17be7f34 Merge branch 'for-next/mtd' 2016-06-14 09:13:41 +02:00
Sascha Hauer
6bfb591cc1 Merge branch 'for-next/misc' 2016-06-14 09:13:41 +02:00
Sascha Hauer
336dcea5a1 Merge branch 'for-next/mips' 2016-06-14 09:13:41 +02:00
Sascha Hauer
0fcd7fdbb9 Merge branch 'for-next/imx' 2016-06-14 09:13:40 +02:00
Sascha Hauer
f0a3a956b8 Merge branch 'for-next/e1000' 2016-06-14 09:13:40 +02:00
Sascha Hauer
5f987cd3f7 Merge branch 'for-next/aiodev' 2016-06-14 09:13:26 +02:00
Antony Pavlov
f1772f4798 MIPS: ath79: dts: sync spi stuff with linux v4.7-rc2
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-14 08:39:55 +02:00
Antony Pavlov
5253099564 MIPS: ath79: dts: sync clk stuff with linux v4.7-rc2
Please see these linux kernel ath79 commits:

    commit 1e6a3492e7bb12aa8ee26050ff6829c39ebaa152
    Author: Antony Pavlov <antonynpavlov@gmail.com>
    Date:   Thu Mar 17 06:34:17 2016 +0300

        MIPS: dts: qca: introduce AR9331 devicetree

    commit 5ae5c452e3361612cd8182eb8bdfecf0ebf42288
    Author: Antony Pavlov <antonynpavlov@gmail.com>
    Date:   Thu Mar 17 06:34:18 2016 +0300

        MIPS: ath79: update devicetree clock support for AR9331

Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-14 08:39:55 +02:00
Antony Pavlov
9f4e3730bd clk: ar933x: fix copyright header
Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-14 08:39:55 +02:00
grodriguez
a945a51b76 Fix genphy_restart_aneg() for Micrel's ksz9031.
Commit da89ee8f2e ("Center FLP timing at 16ms") breaks
genphy_restart_aneg() for Micrel's ksz9031. According to the
datasheet, the ksz9031 requires a wait of 1ms after clearing
the PDOWN bit and before read/write access to any PHY registers.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-14 08:32:15 +02:00
Trent Piepho
edb96cf3d7 mci: Fix version numbers again
The SD and eMMC version numbers are a pain to print and sort, since
they are inconsistent in if a two digit minor version shdoulde be
treated as a single number or as minor and micro version numbers.

This allows version 1.10 and 4.5 and 4.41, where 41 is less than 5.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-07 08:06:43 +02:00
Andrey Smirnov
4ff3269a70 e1000: Expose i210's external flash as MTD
Add code needed to access SPI-NOR flash attached to i210 as a regular
MTD device.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
a74b97f009 e1000: Expose i210's iNVM as a cdev
Add code needed to expose iNVM memory on the chip as a cdev. The
driver also registers a dummy "invm" device that exposes "locked"
property which is used to implement iNMV line locking feature.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
91d3dd2fd8 e1000: Add a "poll register" function
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
72f02e6c0b e1000: Add EEPROM access locking for i210
As per datasheet (section 4.6 p. 147) accessing EEPROM on i210
requires software to hold a corresponding lock bit in SW_FW_SYNC
register.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
741cdaf506 e1000: Properly release SW_FW_SYNC semaphore bits
As described in the datasheet Software/Firmware synchronisation bits
are expected to be released by the software after it is done using
it. Add a porper subroutine to do that instead of relying on the
Firmware clearing those bits due to timeout.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
2bac167769 e1000: Refactor Flash/EEPROM reading code
Refactor Flash/EEPROM reading code to use vtable with pointers to
small, specialized functions based on the flash class instead of big
monolithic funtions whose behaviour is driven by a number of flags and
variables.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
580ad4021c e1000: Remove unnecessary intialization
We always call e1000_init_eeprom_params() as a part of probing, so
there's no need check if it needs to be called in e1000_read_eeprom().

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
224174354f e1000: Fix a bug in e1000_probe()
There are several reasons why that code in e1000_probe had to be
changed:

 - It reads from chip variant specific register (present only on
   i210) in a chip variant agnostic codepath

 - It makes no sense to check for FLUPD bit to make a decision weither
   to validate EEPROM or not since its function per datasheet is:

   " ... Flash Update.

     Writing 1b to this bit causes the content of the internal 4 KB
     shadow RAM to be written into one of the first two 4 KB sectors
     of the Flash device (Sector 0 or Sector 1). The bit is
     self-cleared immediately... "

   and it is only through sheer serendipity the defined value for
   bitmask for FLUPD is equivalent to bitmask for FLASH_DETECTED bit
   which is the bit we actually care about and need to test against
   (FLUPD for i210 has a different bitmask)

Fix those problems by replacing the i210 specific check inside of
e1000_validate_eeprom_checksum() with a chip agnostic one and using
correct bitmask.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
e1e4976931 e1000: Consolidate Microwire EEPROM init code
All of the chips that bitbang Microwire to access EEPROM appear to be
configured in the same way, so move common code into a separate
function and make use of it.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
81f2d33a83 e1000: Consolidate SPI EEPROM init code
All of the chips that bitbang SPI to access EEPROM appear to be
configured in the same way, so move common code into a separate
function and make use of it.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
8ba2db7646 e1000: Simplify EEPROM init for e1000_igb
That chip specifies read access uising EERD via use_eerd, which means
that none of the more "advanced" EEPROM parameters will be used for
reads, so remove them.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
7f7833ec83 e1000: Simplify EEPROM init for e1000_80003es2lan
That chip specifies read access uising EERD via use_eerd, which means
that none of the more "advanced" EEPROM parameters will be used for
reads, so remove them.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
b141814765 e1000: Remove 'page_size'
Remove 'page_size' from 'struct e1000_eeprom_info' since it is not
used anywhere in the code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
920fc71094 e1000: Remove 'use_eewr' parameter
Remove 'use_eewr' from 'struct e1000_eeprom_info' since it is not used
anywhere in the code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
ff6a64d42f e1000: Consolidate register offset fixups
Consolidate all code taking care on CSR offset differences for i210
chips into a single place in the driver and integrate that funcionality
into e1000_{read,write}_reg functions. This way we can get rid of all
those

    if (hw->mac_type == e1000_igb) {
       ....
    } else {
       ....
    }

snippets sprinkled all across the driver code.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
7477a1500a e1000: Remove unneeded i210 specific register code
Despite having EEC(EECD) and EERD at "non-standard" offsets i210
aliases those registers to be accesible via regular addresses so none
of the code removed by this commit is really necessary.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
3d68327587 e1000: Do not read same register twice
EEPROM_INIT_CONTROL2_REG is already read once before entering this
switch statement, so there's not much use in reading its value for the
second time.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
2ea081c242 e1000: Remove unnecessary variable
There doesn't seem to be any point for having 'nv_packet' variable and
it looks like a leftover from driving porting. Remove it and use
'txpacket' instead

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
a199e7b221 e1000: Fix a bug in e1000_detect_gig_phy
It seems there's stray exclamation mark character in
e1000_detect_gig_phy which renders the whole if statement useless
since it converts 'phy_type' into a boolean and comparing that to 0xFF
would always result in false (which GCC 5.1 is now able to detect and
warn about). This commit fixes that.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
940bd8bb25 e1000: Convert E1000_*_REG macros to functions
E1000_*_REG don't bring any value by being macros and implicit appending
of "E1000_" prefix to the constant name only makes thing harder to grep
or understand. Replace those macros with functions.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
ae4915ff38 e1000: Include <net.h> in e1000.h
That header(e1000.h) uses a number of definitions from net.h, so for it
to be self-contained it needs to include that file. This change also
allows remove includes of net.h from other files.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Andrey Smirnov
fcfd488cec e1000: Split driver into multiple files
The driver has a number of not very tightly coupled subsystems and at
4K+ lines e1000.c is getting rather hard to wrangle, so let's move
EEPROM handling code (very self contained susbsystem) into a separate
file and put all of the driver into a dedicated subdirectory.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-06-03 09:14:14 +02:00
Uwe Kleine-König
17f77702e5 eeprom: at24: make device name setup more robust
With two eeproms that have a different compatible string (in my case
"at,24c64" and "at,24c32") dev->id is 0 for both which results in a
failure to bind the device that is probed later.

So pick a name more intelligently: If there is an alias defined in the
device tree, use this one, otherwise pick a free index.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-31 08:57:46 +02:00
Uwe Kleine-König
3982f4ad8a eeprom: at24: check return value of devfs_create and fix error path
if devfs_create failed because "eeprom0" already exists
of_parse_partitions must not be called, otherwise the already existing
eeprom gets assigned partitions that don't belog there.

Also free dummy clients in the error path and the write protect gpio
only if it is actually valid.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-31 08:57:46 +02:00
Uwe Kleine-König
a20a3cb4cd eeprom: at25: check return value of devfs_create
Also only emit the message that the device was probed when it
actually was.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-31 08:57:46 +02:00
Alexander Shiyan
3f374304ad pinctrl: iomux-v3: Cleaning SION patch before applying
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-31 08:23:45 +02:00
Alexander Shiyan
fd5f9fc3ab MCI: imx-esdhc: Allow to use 1-bit bus width in board files
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-31 08:23:45 +02:00
Trent Piepho
24fcf5fcee rtc: ds1307: Add support for configuring external clock pin
The DS1307 has a square wave output pin, which can be used to output a
clock signal from the DS1307.  Additionally, the DS1308 supports
configuring this pin as an input from an external clock source to
which it should sync itself.

Add support with OF device tree properties to configure these
settings.  Supported features are using the clock pin as an output, an
input, the rate of the pin, and if it should be enabled on battery
backup power.

The driver does not check that the selected features are supported by
the clock chip being used.  It is the designer's responsibility to
create a valid device tree node; the bootloader does not attempt to be
a device tree validator.

Signed-off-by: Trent Piepho <tpiepho@kymetacorp.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-30 07:12:19 +02:00
Teresa Remmet
31edb3f16d mtd: UBI: Remove ubi_free_fastmap
Freeing the fastmap is now done by ubi_fastmap_close() from kernel.
No need to keep the barebox own fastmap free function.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Richard Weinberger
58eb46f7cb ubi: Fix out of bounds write in volume update code
ubi_start_leb_change() allocates too few bytes.
ubi_more_leb_change_data() will write up to req->upd_bytes +
ubi->min_io_size bytes.

Cc: stable@vger.kernel.org
Signed-off-by: Richard Weinberger <richard@nod.at>
Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Sebastian Siewior
7027011106 mtd: ubi: wl: avoid erasing a PEB which is empty
wear_leveling_worker() currently unconditionally puts a PEB on erase in
the error case even it just been taken from the free_list and never
used.
In case the PEB was never used it can be put back on the free list
saving a precious erase cycle.

v1…v2:
	- to_leb_clean -> dst_leb_clean
	- use the nested option for ensure_wear_leveling()
	- do_sync_erase() can't go -ENOMEM so we can just go into
	  RO-mode now.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Sebastian Siewior
c5576d8a3a mtd: ubi: don't leak e if schedule_erase() fails
If __erase_worker() fails to erase the EB and schedule_erase() fails as
well to do anything about it then we go RO. But that is not a reason to
leak the e argument here. Therefore clean up e.

Cc: <stable@vger.kernel.org>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Sebastian Siewior
6c5c4a4171 mtd: ubi: fixup error correction in do_sync_erase()
Since fastmap we gained do_sync_erase(). This function can return an error
and its error handling isn't obvious. First the memory allocation for
struct ubi_work can fail and as such struct ubi_wl_entry is leaked.
However if the memory allocation succeeds then the tail function takes
care of the struct ubi_wl_entry. A free here could result in a double
free.
To make the error handling simpler, I split the tail function into one
piece which does the work and another which frees the struct ubi_work
which is passed as argument. As result do_sync_erase() can keep the
struct on stack and we get rid of one error source.

Cc: <stable@vger.kernel.org>
Fixes: 8199b901a ("UBI: Add fastmap support to the WL sub-system")
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Richard Weinberger <richard@nod.at>

Conflicts:
	drivers/mtd/ubi/wl.c

Fixed conflicts.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Brian Norris
2dace81b53 UBI: fix use of "VID" vs. "EC" in header self-check
Looks like a typo, using UBI_EC_HDR_SIZE_CRC (note the "EC") to compute
the CRC for the VID header.

This shouldn't cause any functional change, as both structures are 64
bytes. Verified with:

	BUILD_BUG_ON(UBI_VID_HDR_SIZE_CRC != UBI_EC_HDR_SIZE_CRC);

Reported here:
http://lists.infradead.org/pipermail/linux-mtd/2013-September/048570.html

Reported by: Bill Pringlemeir <bpringlemeir@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Ezequiel García
6cf1f78230 UBI: Fastmap: Fix PEB array type
The PEB array is an array of __be32, so let's fix the
scan_pool() prototype accordingly.

Signed-off-by: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Signed-off-by: Richard Weinberger <richard@nod.at>

Conflicts:
	drivers/mtd/ubi/fastmap.c

Fixed minor conflict.

Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Richard Weinberger
2926770741 UBI: Fix debug message
We have to use j instead of i. i is the volume id
and not the block.

Reported-by: Alexander.Block@continental-corporation.com
Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Richard Weinberger
3ff2991446 UBI: Fix typo in comment
While we are here fix a s/beween/between typo.

Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00
Richard Weinberger
da0647f244 UBI: Fastmap: Simplify expression
There is no need to compute pnum again.

Signed-off-by: Richard Weinberger <richard@nod.at>
Acked-by: Brian Norris <computersforpeace@gmail.com>
Signed-off-by: Teresa Remmet <t.remmet@phytec.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
2016-05-27 12:30:27 +02:00