28 Oct, 2013
26 commits
-
This helper detects that whether the mtd's type is nand type.
Now, it's clear that the MTD_NANDFLASH stands for SLC nand only.
So use the mtd_type_is_nand() to replace the old check method
to do the nand type (include the SLC and MLC) check.Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
In current code, the MTD_NANDFLASH is used to represent both the SLC and
MLC. It is confusing to us.By adding an explicit comment about these two macros, this patch makes it
clear that:
MTD_NANDFLASH : stands for SLC NAND,
MTD_MLCNANDFLASH : stands for MLC NAND (including TLC).Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
When we use the ECC info which is get from the nand chip's datasheet,
we may have some freed oob area now.This patch rewrites the gpmi_ecc_write_oob() to implement the ecc.write_oob().
We also update the comment for gpmi_hw_ecclayout.Yes! We can support the JFFS2 for the SLC nand now.
Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
Print out the cell information for nand chip.
(Since the message is too long, this patch also splits the log
with two separate pr_info())Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
The current code does not set the SLC/MLC information for onfi nand.
(This makes that the kernel treats all the onfi nand as SLC nand.)This patch fills the cell information for ONFI nands.
Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
The legacy ID NAND are all SLC.
This patch sets 1 to the @bits_per_cell for the legacy ID NAND,
which means they are all SLC.Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
The @cellinfo fields contains unused information, such as write caching,
internal chip numbering, etc. But we only use it to check the SLC or MLC.This patch tries to make it more clear and simple, renames the @cellinfo
to @bits_per_cell.In order to avoiding the bisect issue, this patch also does the following
changes:
(0) add a macro NAND_CI_CELLTYPE_SHIFT to avoid the hardcode.(1) add a helper to parse out the cell type : nand_get_bits_per_cell()
(2) parse out the cell type for extended-ID chips and the full-id nand chips.
Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
Add a helper to check if a nand chip is SLC or MLC.
This helper makes the code more readable.Signed-off-by: Huang Shijie
Signed-off-by: Brian Norris -
If the ONFI extended parameter page gives codeword_size == 0, the
extended ECC information is corrupt and should not be used. Currently,
we (correctly) avoid using the information, but we don't report the
error to the caller, so the caller doesn't know that we didn't
initialize ecc_strength_ds and ecc_step_ds. Now the caller can warn the
user that it does not have sufficient information.This also removes the false and useless "ONFI extended param page
detected" debug message (it was printed even on the aforementioned
corruption, and for the success case, we don't really want a print).Signed-off-by: Brian Norris
Acked-by: Huang Shijie -
Since ecc_{strength,step}_ds is introduced in nand_chip structure for
minimum ecc requirements. So we can use them directly and remove our
own get_onfi_ecc_param function.Signed-off-by: Josh Wu
Signed-off-by: Brian Norris -
This patch also add a const keyword for the of_device_id of nfc.
Signed-off-by: Josh Wu
Acked-by: Ezequiel Garcia
Signed-off-by: Brian Norris -
Since the of specific code are declared in regardless
of CONFIG_OF. Remove the #if defined(CONFIG_OF) guard and use an
IS_ENABLED(CONFIG_OF) instead.Thanks to Ezequiel Garcia's for this protype.
Signed-off-by: Josh Wu
Acked-by: Ezequiel Garcia
Signed-off-by: Brian Norris -
Nothing calls omap2_onenand_rephase(). And __adjust_timing() is only
called by omap2_onenand_rephase(). Remove these two unused functions.Signed-off-by: Paul Bolle
Signed-off-by: Brian Norris -
The ONFI detection routine is too verbose in some cases and not verbose
enough in others. This patch refactors it to print only when there are
significant warnings/errors.Probing in 16-bit mode:
It is unnecessary to print until after the READID (address 20h)
command. READID *has* to work properly in whatever bus width
configuration we are in, or else no identification mode works. So we
can silence some useless warnings on systems which come up in 16-bit
mode and do not even respond with an O-N-F-I string.Valid parameter page:
Nobody needs to see this. Do we inform the user every time other
hardware responds properly? Instead, add an error message if *no*
uncorrupted parameter pages are found.ONFI ECC:
Most drivers don't yet use the reported minimum ECC values, so it
shouldn't yet be a fatal condition if the extended parameter page is
incorrect. But we should at least give a warning for the corner cases
that we don't expect.ONFI flash detected:
Nobody needs to see this. This is the expected case, that we detect
ONFI properly, or else it wasn't ONFI-compliant and is detected by
some other routine.Signed-off-by: Brian Norris
Cc: Huang Shijie
Cc: Ezequiel Garcia -
do_xxlock() is only used locally. This silences a sparse warning:
drivers/mtd/lpddr/lpddr_cmds.c:706:5: warning: no previous prototype for 'do_xxlock' [-Wmissing-prototypes]
Signed-off-by: Brian Norris
-
These variable assignments are never used (the variables are either
never used or are overwritten before use). This resolves some compiler
warnings like the following:drivers/mtd/onenand/onenand_base.c: In function 'flexonenand_get_boundary':
drivers/mtd/onenand/onenand_base.c:3532:6: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
drivers/mtd/onenand/onenand_base.c: In function 'onenand_probe':
drivers/mtd/onenand/onenand_base.c:3838:6: warning: variable 'maf_id' set but not used [-Wunused-but-set-variable]Signed-off-by: Brian Norris
Cc: Kyungmin Park -
This field is never used, except to print it out.
Signed-off-by: Brian Norris
-
The mtd_block_isbad() interface already checks for this.
Signed-off-by: Brian Norris
-
It's only used in this file.
Signed-off-by: Brian Norris
-
struct dataflash's 'partition' field is unused. Just remove it.
Signed-off-by: Brian Norris
Cc: David Brownell -
I removed the last non-nand_base users of this, and we shouldn't have
any more modules that need to access it. It's only non-static to share
between nand_base and nand_bbt.Signed-off-by: Brian Norris
-
We want the default nand_chip.scan_bbt() function, so just use the
proper indirection.Signed-off-by: Brian Norris
-
This driver is doing some strange logic here. If it doesn't have
flash-based BBT enabled, it allows nand_scan_tail() to scan the BBT. But
if it is using flash-based BBT, it tells nand_scan_tail() to skip
scanning, then it immediately calls the default BBT scanning function
itself.As I read it, this logic is equivalent to the default nand_scan_tail()
behavior without interfering with NAND_SKIP_BBTSCAN or calling
nand_default_bbt() directly at all.Signed-off-by: Brian Norris
-
There's no point in the low level driver doing the work that nand_base
already is doing; just let nand_base set the default BBT scanning
function.Signed-off-by: Brian Norris
Acked-by: Mike Dunn -
Just like the rest of the subsystems, let's add the required no-op
functions to implement stubs when CONFIG_OF=n.This prevents MTD drivers from having ugly ifdefs in their code,
and instead hide the ifdef monster in the header closet (far away
from people's sight).Signed-off-by: Ezequiel Garcia
Signed-off-by: Brian Norris -
Acked-by: Huang Shijie
Signed-off-by: Lothar Waßmann
Signed-off-by: Artem Bityutskiy
26 Oct, 2013
3 commits
-
Pull final mtd fixes from Brian Norris:
"A few more last-minute regression fixes, prepared jointly by me and
David Woodhouse:- Revert pxa3xx to its old name to avoid breaking existing
'mtdparts=' boot strings.- Return GPMI NAND to its legacy ECC layout for backwards
compatibility. We will revisit this in 3.13.A note from David on the latter fix: 'This leaves a harmless cosmetic
warning about an unused function. At this point in the cycle I really
don't care.'"* tag 'for-linus-20131025' of git://git.infradead.org/linux-mtd:
mtd: gpmi: fix ECC regression
mtd: nand: pxa3xx: Fix registered MTD name -
Pull vfs fixes (try two) from Al Viro:
"nfsd performance regression fix + seq_file lseek(2) fix"* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
seq_file: always update file->f_pos in seq_lseek()
nfsd regression since delayed fput() -
The "legacy" ECC layout used until 3.12-rc1 uses all the OOB area by
computing the ECC strength and ECC step size ourselves.Commit 2febcdf84b ("mtd: gpmi: set the BCHs geometry with the ecc info")
makes the driver use the ECC info (ECC strength and ECC step size)
provided by the MTD code, and creates a different NAND ECC layout
for the BCH, and use the new ECC layout. This causes a regression:We can not mount the ubifs which was created by the old NAND ECC layout.
This patch fixes this issue by reverting to the legacy ECC layout.
We will probably introduce a new device-tree property to indicate that
the new ECC layout can be used. For now though, for the imminent 3.12
release, we just unconditionally revert to the 3.11 behaviour.This leaves a harmless cosmetic warning about an unused function. At
this point in the cycle I really don't care.Signed-off-by: David Woodhouse
Signed-off-by: Brian Norris
Acked-by: Huang Shijie
Acked-by: Marek Vasut
Tested-by: Marek Vasut
25 Oct, 2013
5 commits
-
This issue was first pointed out by Jiaxing Wang several months ago, but no
further comments:
https://lkml.org/lkml/2013/6/29/41As we know pread() does not change f_pos, so after pread(), file->f_pos
and m->read_pos become different. And seq_lseek() does not update file->f_pos
if offset equals to m->read_pos, so after pread() and seq_lseek()(lseek to
m->read_pos), then a subsequent read may read from a wrong position, the
following program produces the problem:char str1[32] = { 0 };
char str2[32] = { 0 };
int poffset = 10;
int count = 20;/*open any seq file*/
int fd = open("/proc/modules", O_RDONLY);pread(fd, str1, count, poffset);
printf("pread:%s\n", str1);/*seek to where m->read_pos is*/
lseek(fd, poffset+count, SEEK_SET);/*supposed to read from poffset+count, but this read from position 0*/
read(fd, str2, count);
printf("read:%s\n", str2);out put:
pread:
ck_netbios_ns 12665
read:
nf_conntrack_netbios/proc/modules:
nf_conntrack_netbios_ns 12665 0 - Live 0xffffffffa038b000
nf_conntrack_broadcast 12589 1 nf_conntrack_netbios_ns, Live 0xffffffffa0386000So we always update file->f_pos to offset in seq_lseek() to fix this issue.
Signed-off-by: Jiaxing Wang
Signed-off-by: Gu Zheng
Signed-off-by: Al Viro -
Pull ARM SoC fixes from Olof Johansson:
"There's really only one bugfix in this branch, which is a fix for
timers on the integrator platform. Since Linus Walleij is
resurrecting support for the platform it seems valuable to get the fix
into 3.12 even though the regression has been around a while.The rest are a handful of maintainers updates. If you prefer to hold
those until 3.13 then just merge the first patch on the branch which
is the fix"* tag 'fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc:
MAINTAINERS: Add maintainers entry for Rockchip SoCs
MAINTAINERS: Tegra updates, and driver ownership
MAINTAINERS: ARM: mvebu: add Sebastian Hesselbarth
ARM: integrator: deactivate timer0 on the Integrator/CP -
…/git/tyhicks/ecryptfs
Pull ecryptfs fixes from Tyler Hicks:
"Two important fixes
- Fix long standing memory leak in the (rarely used) public key
support
- Fix large file corruption on 32 bit architectures"* tag 'ecryptfs-3.12-rc7-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/tyhicks/ecryptfs:
eCryptfs: fix 32 bit corruption issue
ecryptfs: Fix memory leakage in keystore.c -
In a recent commit:
commit f455578dd961087a5cf94730d9f6489bb1d355f0
Author: Ezequiel Garcia
Date: Mon Aug 12 14:14:53 2013 -0300mtd: nand: pxa3xx: Remove hardcoded mtd name
There's no advantage in using a hardcoded name for the mtd device.
Instead use the provided by the platform_device.The MTD name was changed to use the one provided by the platform_device.
However, this can be problematic as some users want to set partitions
using the kernel parameter 'mtdparts', where the name is needed.Therefore, to avoid regressions in users relying in 'mtdparts' we revert
the change and use the previous one 'pxa3xx_nand-0'.While at it, let's put a big comment and prevent this change from happening
ever again.Signed-off-by: Ezequiel Garcia
Signed-off-by: Brian Norris -
Shifting page->index on 32 bit systems was overflowing, causing
data corruption of > 4GB files. Fix this by casting it first.https://launchpad.net/bugs/1243636
Signed-off-by: Colin Ian King
Reported-by: Lars Duesing
Cc: stable@vger.kernel.org # v3.11+
Signed-off-by: Tyler Hicks
24 Oct, 2013
6 commits
-
Pull md bugfixes from Neil Brown:
"Assorted md bug-fixes for 3.12.All tagged for -stable releases too"
* tag 'md/3.12-fixes' of git://neil.brown.name/md:
raid5: avoid finding "discard" stripe
raid5: set bio bi_vcnt 0 for discard request
md: avoid deadlock when md_set_badblocks.
md: Fix skipping recovery for read-only arrays. -
Pull SCSI fixes from James Bottomley:
"This is a set of two fixes which cause oopses (Buslogic, qla2xxx) and
one fix which may cause a hang because of request miscounting (sd)"* tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
[SCSI] sd: call blk_pm_runtime_init before add_disk
[SCSI] qla2xxx: Fix request queue null dereference.
[SCSI] BusLogic: Fix an oops when intializing multimaster adapter -
SCSI discard will damage discard stripe bio setting, eg, some fields are
changed. If the stripe is reused very soon, we have wrong bios setting. We
remove discard stripe from hash list, so next time the strip will be fully
initialized.Suitable for backport to 3.7+.
Cc: (3.7+)
Signed-off-by: Shaohua Li
Signed-off-by: NeilBrown -
SCSI layer will add new payload for discard request. If two bios are merged
to one, the second bio has bi_vcnt 1 which is set in raid5. This will confuse
SCSI and cause oops.Suitable for backport to 3.7+
Cc: stable@vger.kernel.org (v3.7+)
Reported-by: Jes Sorensen
Signed-off-by: Shaohua Li
Signed-off-by: NeilBrown
Acked-by: Martin K. Petersen -
When operate harddisk and hit errors, md_set_badblocks is called after
scsi_restart_operations which already disabled the irq. but md_set_badblocks
will call write_sequnlock_irq and enable irq. so softirq can preempt the
current thread and that may cause a deadlock. I think this situation should
use write_sequnlock_irqsave/irqrestore instead.I met the situation and the call trace is below:
[ 638.919974] BUG: spinlock recursion on CPU#0, scsi_eh_13/1010
[ 638.921923] lock: 0xffff8800d4d51fc8, .magic: dead4ead, .owner: scsi_eh_13/1010, .owner_cpu: 0
[ 638.923890] CPU: 0 PID: 1010 Comm: scsi_eh_13 Not tainted 3.12.0-rc5+ #37
[ 638.925844] Hardware name: To be filled by O.E.M. To be filled by O.E.M./MAHOBAY, BIOS 4.6.5 03/05/2013
[ 638.927816] ffff880037ad4640 ffff880118c03d50 ffffffff8172ff85 0000000000000007
[ 638.929829] ffff8800d4d51fc8 ffff880118c03d70 ffffffff81730030 ffff8800d4d51fc8
[ 638.931848] ffffffff81a72eb0 ffff880118c03d90 ffffffff81730056 ffff8800d4d51fc8
[ 638.933884] Call Trace:
[ 638.935867] [] dump_stack+0x55/0x76
[ 638.937878] [] spin_dump+0x8a/0x8f
[ 638.939861] [] spin_bug+0x21/0x26
[ 638.941836] [] do_raw_spin_lock+0xa4/0xc0
[ 638.943801] [] _raw_spin_lock+0x66/0x80
[ 638.945747] [] ? scsi_device_unbusy+0x9d/0xd0
[ 638.947672] [] ? _raw_spin_unlock+0x2b/0x50
[ 638.949595] [] scsi_device_unbusy+0x9d/0xd0
[ 638.951504] [] scsi_finish_command+0x37/0xe0
[ 638.953388] [] scsi_softirq_done+0xa8/0x140
[ 638.955248] [] blk_done_softirq+0x7b/0x90
[ 638.957116] [] __do_softirq+0xfd/0x330
[ 638.958987] [] ? __lock_release+0x6f/0x100
[ 638.960861] [] call_softirq+0x1c/0x30
[ 638.962724] [] do_softirq+0x8d/0xc0
[ 638.964565] [] irq_exit+0x10e/0x150
[ 638.966390] [] smp_apic_timer_interrupt+0x4a/0x60
[ 638.968223] [] apic_timer_interrupt+0x6f/0x80
[ 638.970079] [] ? __lock_release+0x6f/0x100
[ 638.971899] [] ? _raw_spin_unlock_irq+0x3a/0x50
[ 638.973691] [] ? _raw_spin_unlock_irq+0x30/0x50
[ 638.975475] [] md_set_badblocks+0x1f3/0x4a0
[ 638.977243] [] rdev_set_badblocks+0x27/0x80
[ 638.978988] [] raid5_end_read_request+0x36b/0x4e0 [raid456]
[ 638.980723] [] bio_endio+0x1d/0x40
[ 638.982463] [] req_bio_endio.isra.65+0x83/0xa0
[ 638.984214] [] blk_update_request+0x7f/0x350
[ 638.985967] [] blk_update_bidi_request+0x31/0x90
[ 638.987710] [] __blk_end_bidi_request+0x20/0x50
[ 638.989439] [] __blk_end_request_all+0x1f/0x30
[ 638.991149] [] blk_peek_request+0x106/0x250
[ 638.992861] [] ? scsi_kill_request.isra.32+0xe9/0x130
[ 638.994561] [] scsi_request_fn+0x4a/0x3d0
[ 638.996251] [] __blk_run_queue+0x37/0x50
[ 638.997900] [] blk_run_queue+0x2f/0x50
[ 638.999553] [] scsi_run_queue+0xe0/0x1c0
[ 639.001185] [] scsi_run_host_queues+0x21/0x40
[ 639.002798] [] scsi_restart_operations+0x177/0x200
[ 639.004391] [] scsi_error_handler+0xc9/0xe0
[ 639.005996] [] ? scsi_unjam_host+0xd0/0xd0
[ 639.007600] [] kthread+0xdb/0xe0
[ 639.009205] [] ? flush_kthread_worker+0x170/0x170
[ 639.010821] [] ret_from_fork+0x7c/0xb0
[ 639.012437] [] ? flush_kthread_worker+0x170/0x170This bug was introduce in commit 2e8ac30312973dd20e68073653
(the first time rdev_set_badblock was call from interrupt context),
so this patch is appropriate for 3.5 and subsequent kernels.Cc: (3.5+)
Signed-off-by: Bian Yu
Reviewed-by: Jianpeng Ma
Signed-off-by: NeilBrown -
Since:
commit 7ceb17e87bde79d285a8b988cfed9eaeebe60b86
md: Allow devices to be re-added to a read-only array.spares are activated on a read-only array. In case of raid1 and raid10
personalities it causes that not-in-sync devices are marked in-sync
without checking if recovery has been finished.If a read-only array is degraded and one of its devices is not in-sync
(because the array has been only partially recovered) recovery will be skipped.This patch adds checking if recovery has been finished before marking a device
in-sync for raid1 and raid10 personalities. In case of raid5 personality
such condition is already present (at raid5.c:6029).Bug was introduced in 3.10 and causes data corruption.
Cc: stable@vger.kernel.org
Signed-off-by: Pawel Baldysiak
Signed-off-by: Lukasz Dorau
Signed-off-by: NeilBrown