drm/gk104/gr: therm magic needed on some kepler boards

Not needed everywhere, and potentially not safe to do depending on how
the rest of PTHERM is configured...

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nv50/gpio: exclude sense value from mask when changing registers

Shouldn't effect anything, was just momentarily confusing while looking
at traces.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nv50/gpio: fixup reset for gpios >= 16

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/bios: have strap reads show on devinit spam debug level

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/devinit: add interface to check if a mmio access by scripts is ok

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nva3/devinit: restrict script access to some PFB regs

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nva3/fbram: restrict training pattern setup to GT218

It doesn't look like the others have the registers.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/disp: limit dp capabilities as per dcb

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau: recognise higher link rate for available dp bw calculations

I should resurrect/merge that cleanup branch to remove the weird
duplication.. One day.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/disp/dp: allow 540MHz data rate

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=76319
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/therm: check for sensor presence with requested mode, not current

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau: fix small thinko in vblank timestamping.

*hpos horizontal scanout position doesn't need to be corrected
to count the pixels between hactive end and htotal negative.
That is only needed for *vpos to count lines until end of
vblank for the vblank timestamping.

Use hpos as is without correction.

Removes occassional spikes in timestamps of up to 1 scanline
duration, thereby improves accuracy to about +/- 2 usecs instead
of +/- 12 usecs, wrt. true onset time as measured with high
precision equipment on NV-A5.

Signed-off-by: Mario Kleiner <mario.kleiner.de@gmail.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling

This should fix a deadlock that has been reported to us where fan_update()
would hold the fan lock and try to grab the alarm_program_lock to reschedule
an update. On an other CPU, the alarm_program_lock would have been taken
before calling fan_update(), leading to a deadlock.

We should Cc: <stable@vger.kernel.org> # 3.9+

Reported-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Tested-by: Timothée Ravier <tim@siosm.fr>
Tested-by: Boris Fersing (IRC nick fersingb, no public email address)
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nvd7/therm: handle another kind of PWM fans

This should fix fan management on many nvd7+ chipsets.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/therm: let the vbios decide on the automatic fan management mode

This should fix automatic fan management on fermi cards who do not have
0x46 entries in the thermal table.

On my nve6, the blob sets the default linear range from 40°C to 100°C
but my nvcf's default values are 40°C to 85°C. Let's keep 85 as a default
for everyone.

Signed-off-by: Martin Peres <martin.peres@labri.fr>
Tested-by: Timothée Ravier <tim@siosm.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses

Other kind of accesses are unreliable on Kepler cards. As advised by NVIDIA,
let's only use 32-bit accesses to fetch the vbios from PROM.

This fixes vbios fetching on my nve7 which failed in certain specific
conditions.

I suggest we Cc stable, for all kernels they still maintain after the big
rewrite.

Suggested-by: Christian Zander <czander@nvidia.com>
Signed-off-by: Martin Peres <martin.peres@free.fr>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drm/nouveau: fix missing newline

Add a missing newline at the end of a DRM_INFO message.

Signed-off-by: Alexandre Courbot <acourbot@nvidia.com>
Reviewed-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Merge branch 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6 into drm-next

- first stage of (ongoing) gpu fault recovery work
- initial support for maxwell (binary driver fw needed)
- various random fixes across the board

* 'drm-nouveau-next' of git://anongit.freedesktop.org/git/nouveau/linux-2.6: (87 commits)
  drm/nouveau: fix missing newline
  drm/nouveau/bios: fetch the vbios from PROM using only aligned 32-bit accesses
  drm/nouveau/therm: let the vbios decide on the automatic fan management mode
  drm/nvd7/therm: handle another kind of PWM fans
  drm/nouveau/pm/fan: drop the fan lock in fan_update() before rescheduling
  drm/nouveau: fix small thinko in vblank timestamping.
  drm/nouveau/therm: check for sensor presence with requested mode, not current
  drm/nouveau/disp/dp: allow 540MHz data rate
  drm/nouveau: recognise higher link rate for available dp bw calculations
  drm/nouveau/disp: limit dp capabilities as per dcb
  drm/nva3/fbram: restrict training pattern setup to GT218
  drm/nva3/devinit: restrict script access to some PFB regs
  drm/nouveau/devinit: add interface to check if a mmio access by scripts is ok
  drm/nouveau/bios: have strap reads show on devinit spam debug level
  drm/nv50/gpio: fixup reset for gpios >= 16
  drm/nv50/gpio: exclude sense value from mask when changing registers
  drm/gk104/gr: therm magic needed on some kepler boards
  drm/gm107/gr: initial support
  drm/gf100-/gf: fix a stupid typo, waiting on wrong signal for mmctx
  drm/nouveau/bios: parsing of some random table needed to bring up gr
  ...
mtd: devices: elm: check for hardware engine's design constraints

ELM hardware engine is used by BCH ecc-schemes for detecting and locating ECC
errors. This patch adds the following checks for ELM hardware engine:

 - ELM internal buffers are of 1K,
   so it cannot process data with ecc-step-size > 1K.

 - ELM engine can execute upto maximum of 8 threads in parallel,
   so in *page-mode* (when complete page is processed in single iteration),
   ELM cannot support ecc-steps > 8.

Signed-off-by: Pekon Gupta <pekon@ti.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
mtd: devices: elm: clean elm_load_syndrome

This patch refactors elm_load_syndrome() to make it scalable for newer
ECC schemes by removing scheme specific macros (like ECC_BYTES*xx),
and instead using ECC control information passed during elm_config.

Signed-off-by: Pekon Gupta <pekon@ti.com>
Reviewed-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>