firefly-linux-kernel-4.4.55.git
5 years agoarm64: dts: rockchip: add gsl3673 node for rk3399-evb
buluess.li [Tue, 9 Aug 2016 08:55:44 +0000 (16:55 +0800)]
arm64: dts: rockchip: add gsl3673 node for rk3399-evb

Change-Id: Ie2af9afdef987924a94fad3b65adf0ccd7c8001d
Signed-off-by: buluess.li <buluess.li@rock-chips.com>
5 years agoarm64: dts: rk3399-mid: update backlight brightness-levels
Bin Yang [Tue, 9 Aug 2016 03:49:29 +0000 (11:49 +0800)]
arm64: dts: rk3399-mid: update backlight brightness-levels

Change-Id: I4416f3f53347e8efa5452777cf0c918961a6f5f3
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
5 years agoARM64: dts: rk3399: add 3399 sapphire&excavator box and edp board support
Huang zhibao [Tue, 9 Aug 2016 06:56:50 +0000 (14:56 +0800)]
ARM64: dts: rk3399: add 3399 sapphire&excavator box and edp board support

Change-Id: I14fd6d2e49eee6852625241cfd9ef22b549588c0
Signed-off-by: Huang zhibao <hzb@rock-chips.com>
5 years agoMerge tag 'lsk-v4.4-16.07-android'
Huang, Tao [Wed, 10 Aug 2016 07:15:47 +0000 (15:15 +0800)]
Merge tag 'lsk-v4.4-16.07-android'

LSK 16.07 v4.4-android

* tag 'lsk-v4.4-16.07-android': (160 commits)
  arm64: kaslr: increase randomization granularity
  arm64: relocatable: deal with physically misaligned kernel images
  arm64: don't map TEXT_OFFSET bytes below the kernel if we can avoid it
  arm64: kernel: replace early 64-bit literal loads with move-immediates
  arm64: introduce mov_q macro to move a constant into a 64-bit register
  arm64: kernel: perform relocation processing from ID map
  arm64: kernel: use literal for relocated address of __secondary_switched
  arm64: kernel: don't export local symbols from head.S
  arm64: simplify kernel segment mapping granularity
  arm64: cover the .head.text section in the .text segment mapping
  arm64: move early boot code to the .init segment
  arm64: use 'segment' rather than 'chunk' to describe mapped kernel regions
  arm64: mm: Mark .rodata as RO
  Linux 4.4.16
  ovl: verify upper dentry before unlink and rename
  drm/i915: Revert DisplayPort fast link training feature
  tmpfs: fix regression hang in fallocate undo
  tmpfs: don't undo fallocate past its last page
  crypto: qat - make qat_asym_algs.o depend on asn1 headers
  xen/acpi: allow xen-acpi-processor driver to load on Xen 4.7
  ...

5 years agodrm/panel: Don't init gpio value at probe
Mark Yao [Tue, 2 Aug 2016 07:19:27 +0000 (15:19 +0800)]
drm/panel: Don't init gpio value at probe

When enable display on loader, init gpio would change gpio status,
that would make screen flash,

Change-Id: I4b69a8d3d83c5bef09014c2134abaee6522a7046
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoarm64: dts: rk3399: enable hdmi node for android-next
Mark Yao [Tue, 2 Aug 2016 09:21:10 +0000 (17:21 +0800)]
arm64: dts: rk3399: enable hdmi node for android-next

Change-Id: I4a6542592adb2b0fd947aa368c1714b33a2eb4bc
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoUPSTREAM: drm/rockchip: allocate correct crtc state structure on reset
John Keeping [Thu, 14 Jul 2016 15:29:15 +0000 (16:29 +0100)]
UPSTREAM: drm/rockchip: allocate correct crtc state structure on reset

Because we are using a custom crtc_state structure, we must override the
reset helper to allocate the correct amount of memory.

Cc: stable@vger.kernel.org
Change-Id: I1895dbe994232991c1659cf2f4d63c4aa957b794
Fixes: 4e257d9eee23 ("drm/rockchip: get rid of rockchip_drm_crtc_mode_config")
Signed-off-by: John Keeping <john@metanate.com>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
(cherry picked from dc0b408f5a87cce3ea3f81a6800244fb7d395435)

5 years agodrm/rockchip: fix compile error when build as modules
Mark Yao [Wed, 10 Aug 2016 02:24:42 +0000 (10:24 +0800)]
drm/rockchip: fix compile error when build as modules

Build fail with:
  ERROR: "memblock_free" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined!

memblok_free fuction not export symbol, and use the flag __init, so it
can't be used on modules.

the memblock_free function only used for loader memory manager, not use
on modules context, so just use it when build-in drm/rockchip.

Change-Id: Ib88b6ca6c61f7ef85b4126d705a4911e207b57e5
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoARM64: dts: rk3399: support fusb302 for box rev1/2
Meng Dongyang [Tue, 9 Aug 2016 04:17:37 +0000 (12:17 +0800)]
ARM64: dts: rk3399: support fusb302 for box rev1/2

Change-Id: Iea3f9e673a08bc959b3f57d169fff738ce746645
Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
5 years agoFROMLIST: Documentation: bindings: add dt documentation for cdn DP controller
Chris Zhong [Fri, 29 Jul 2016 07:48:22 +0000 (15:48 +0800)]
FROMLIST: Documentation: bindings: add dt documentation for cdn DP controller

This patch adds a binding that describes the cdn DP controller for
rk3399.

(am from https://patchwork.kernel.org/patch/9256921/)

Change-Id: Ibf5ed51f9b049b2b310ea049f30d237ee4f9e6aa
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
5 years agoFROMLIST: arm64: dts: rockchip: add Type-C phy for RK3399
Chris Zhong [Fri, 29 Jul 2016 07:48:21 +0000 (15:48 +0800)]
FROMLIST: arm64: dts: rockchip: add Type-C phy for RK3399

There are 2 Type-C phy on RK3399, they are almost same, except the
address of register. They support USB3.0 Type-C and DisplayPort1.3
Alt Mode on USB Type-C. Register a phy, supply it to USB3 controller
and DP controller.

(am from https://patchwork.kernel.org/patch/9256949/)

Change-Id: I840fbb0cc5e9b95e4d2fa88409ef1a98990dffb7
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
5 years agoFROMLIST: phy: Add USB Type-C PHY driver for rk3399
Chris Zhong [Fri, 29 Jul 2016 07:48:20 +0000 (15:48 +0800)]
FROMLIST: phy: Add USB Type-C PHY driver for rk3399

Add a PHY provider driver for the rk3399 SoC Type-c PHY. The USB
Type-C PHY is designed to support the USB3 and DP applications. The
PHY basically has two main components: USB3 and DisplyPort. USB3
operates in SuperSpeed mode and the DP can operate at RBR, HBR and
HBR2 data rates. Hence, create 2 PHY deivces, the phy[0] for DP,
and phy[1] for USB3.

(am from https://patchwork.kernel.org/patch/9260745/)

Change-Id: I0cd851a59c00a1249415da109598007a09088591
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Kever Yang <kever.yang@rock-chips.com>
5 years agoFROMLIST: Documentation: bindings: add dt doc for Rockchip USB Type-C PHY
Chris Zhong [Fri, 29 Jul 2016 07:48:19 +0000 (15:48 +0800)]
FROMLIST: Documentation: bindings: add dt doc for Rockchip USB Type-C PHY

This patch adds a binding that describes the Rockchip USB Type-C PHY
for rk3399

(am from https://patchwork.kernel.org/patch/9256943/)

Change-Id: I91d9451126e37ac1786e19f269f547fc0d0df96e
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
Acked-by: Rob Herring <robh@kernel.org>
5 years agoARM64: dts: rk3399: support fusb302 for evb1/2/3
Zain Wang [Thu, 7 Apr 2016 10:05:32 +0000 (18:05 +0800)]
ARM64: dts: rk3399: support fusb302 for evb1/2/3

Change-Id: I27d3c4848466a672b42446cc2b208fed067c4417
Signed-off-by: Zain Wang <wzz@rock-chips.com>
5 years agoarm64: dts: rk3399-mid: add support for new hardware
Bin Yang [Tue, 2 Aug 2016 02:58:26 +0000 (10:58 +0800)]
arm64: dts: rk3399-mid: add support for new hardware

Change-Id: Id832c96aec605f38dfe7639271becdf83740e9f3
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
5 years agoARM64: dts: rk3399: adjust box temperature patameters
buluess.li [Mon, 8 Aug 2016 02:17:00 +0000 (10:17 +0800)]
ARM64: dts: rk3399: adjust box temperature patameters

Change-Id: I24982ee8ccb0fc9cbc92f357661d3b07ca275920
Signed-off-by: buluess.li <buluess.li@rock-chips.com>
5 years agoarm64: dts: rockchip: rk3399: fix pd_sd as sub domain of pd_perihp
Elaine Zhang [Mon, 8 Aug 2016 11:05:30 +0000 (19:05 +0800)]
arm64: dts: rockchip: rk3399: fix pd_sd as sub domain of pd_perihp

Change-Id: I62e53b85444f0f4bbb1d2e786a23ff1f91c89000
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
5 years agoRevert "driver, iio, mpuxxx: do nothing when fifo count is zero"
Zorro Liu [Fri, 5 Aug 2016 08:54:59 +0000 (16:54 +0800)]
Revert "driver, iio, mpuxxx: do nothing when fifo count is zero"

This reverts commit 98827e305e4c13add79acbfc58f15bd96c09cc92.

Change-Id: I603799406f380fc649083e2ef66e8e78608f378c
Signed-off-by: Zorro Liu <lyx@rock-chips.com>
5 years agoFROMLIST: drm/rockchip: fix fbdev crash when not use DRM_FBDEV_EMULATION
Mark Yao [Thu, 4 Aug 2016 01:40:51 +0000 (09:40 +0800)]
FROMLIST: drm/rockchip: fix fbdev crash when not use DRM_FBDEV_EMULATION

[    1.162571] Unable to handle kernel NULL pointer dereference at virtual address 00000200
[    1.165656] Modules linked in:
[    1.165941] CPU: 5 PID: 143 Comm: kworker/5:2 Not tainted 4.4.15 #237
[    1.166506] Hardware name: Rockchip RK3399 Evaluation Board v1 (Android) (DT)
[    1.167153] Workqueue: events output_poll_execute
[    1.168231] PC is at mutex_lock+0x14/0x44
[    1.168586] LR is at drm_fb_helper_hotplug_event+0x28/0xcc
[    1.172192] [<ffffff8008982110>] mutex_lock+0x14/0x44
[    1.172196] [<ffffff80084025a4>] drm_fb_helper_hotplug_event+0x28/0xcc
[    1.172201] [<ffffff8008427ae4>] rockchip_drm_output_poll_changed+0x14/0x1c
[    1.172204] [<ffffff80083f7c4c>] drm_kms_helper_hotplug_event+0x28/0x34
[    1.172207] [<ffffff80083f7ddc>] output_poll_execute+0x150/0x198
[    1.172212] [<ffffff80080b0ea8>] process_one_work+0x218/0x3dc
[    1.172215] [<ffffff80080b1578>] worker_thread+0x24c/0x374
[    1.172217] [<ffffff80080b5bcc>] kthread+0xdc/0xe4
[    1.172222] [<ffffff8008084cd0>] ret_from_fork+0x10/0x40

Change-Id: I681b9260ad7f2e3cae5cd08a109dad89b3575c2c
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(am from https://patchwork.kernel.org/patch/9262523)

5 years agoUPSTREAM: drm/rockchip: Use atomic PM helpers
Tomeu Vizoso [Mon, 6 Jun 2016 14:53:32 +0000 (16:53 +0200)]
UPSTREAM: drm/rockchip: Use atomic PM helpers

This driver was still using the old legacy helpers and that caused a few
NULL dereferences when trying to call empty callbacks.

Change-Id: I9656aed34892260dbf9b571b95befd6af4d9b70f
Signed-off-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Caesar Wang <wxt@rock-chips.com>
Cc: Douglas Anderson <dianders@chromium.org>
Cc: Heiko Stuebner <heiko@sntech.de>
Cc: Yakir Yang <ykk@rock-chips.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465224813-7359-1-git-send-email-tomeu.vizoso@collabora.com
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(cherry picked from 5a5873830972e7d8983dd205b3686f728047d556)

5 years agoUPSTREAM: drm/atomic-helper: Implement subsystem-level suspend/resume
Thierry Reding [Wed, 2 Dec 2015 16:50:04 +0000 (17:50 +0100)]
UPSTREAM: drm/atomic-helper: Implement subsystem-level suspend/resume

Provide subsystem-level suspend and resume helpers that can be used to
implement suspend/resume on atomic mode-setting enabled drivers.

v2: simplify locking, enhance kerneldoc comments
v3: pass lock acquisition context by parameter, improve kerneldoc
v4: - remove redundant code (already provided by atomic helpers)
      (Maarten Lankhorst)
    - move backoff dance from drm_modeset_lock_all_ctx() into suspend
      helper (Daniel Vetter)
v5: handle potential EDEADLK from drm_atomic_helper_duplicate_state()
    and drm_atomic_helper_disable_all() (Daniel Vetter)

Change-Id: I58c5b794cdafa6c9f2594376fc2e98918156e409
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1449075005-13937-2-git-send-email-thierry.reding@gmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(cherry picked from 1494276000db789c6d2acd85747be4707051c801)

5 years agoUPSTREAM: drm: Implement drm_modeset_lock_all_ctx()
Thierry Reding [Wed, 2 Dec 2015 16:50:03 +0000 (17:50 +0100)]
UPSTREAM: drm: Implement drm_modeset_lock_all_ctx()

This function is like drm_modeset_lock_all(), but it takes the lock
acquisition context as a parameter rather than storing it in the DRM
device's mode_config structure.

Implement drm_modeset_{,un}lock_all() in terms of the new function for
better code reuse, and add a note to the kerneldoc that new code should
use the new functions.

v2: improve kerneldoc
v4: rename drm_modeset_lock_all_crtcs() to drm_modeset_lock_all_ctx()
    and take mode_config's .connection_mutex instead of .mutex lock to
    avoid lock inversion (Daniel Vetter), use drm_modeset_drop_locks()
    which is now the equivalent of drm_modeset_unlock_all_ctx()
v5: do not take the dev->mode_config.connection_mutex in
    drm_atomic_legacy_backoff() since drm_modeset_lock_all_ctx()
    already keeps it, enhance kerneldoc for drm_modeset_lock_all_ctx()
    (Daniel Vetter)

Change-Id: I1f16f686f77139b749b38c7a3a0dbc0b5d25f6fd
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: http://patchwork.freedesktop.org/patch/msgid/1449075005-13937-1-git-send-email-thierry.reding@gmail.com
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
(cherry picked from commit 06eaae46381737a6236ad6fe81e5358fad3bbbe5)

5 years agoARM: dts: rockchip: add supports-sd for rk3288 sdmmc property
Nickey Yang [Mon, 8 Aug 2016 03:30:15 +0000 (11:30 +0800)]
ARM: dts: rockchip: add supports-sd for rk3288 sdmmc property

Change-Id: Iecd1bb362c1437cd9d5d72c4f6ddc7aaad8b5282
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
5 years agoarm64: dts: rockchip: add pd_gmac support for rk3399 gmac
Elaine Zhang [Mon, 8 Aug 2016 02:58:29 +0000 (10:58 +0800)]
arm64: dts: rockchip: add pd_gmac support for rk3399 gmac

Change-Id: Ib26b4364cf9133d04ba252c48e48a157ac8b02eb
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
5 years agoarm64: dts: rockchip: add pd_usb3 support for rk3399 usb3
Elaine Zhang [Mon, 8 Aug 2016 02:53:32 +0000 (10:53 +0800)]
arm64: dts: rockchip: add pd_usb3 support for rk3399 usb3

Change-Id: Ic0e123b3657039cf3cc7a36589091bf741fffecb
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
5 years agoarm64: dts: rockchip: add pd_perihp support for rk3399 usb2
Elaine Zhang [Mon, 8 Aug 2016 02:50:28 +0000 (10:50 +0800)]
arm64: dts: rockchip: add pd_perihp support for rk3399 usb2

Change-Id: I3a46d7dfb2846b332c81a5879a12853ce7423180
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
5 years agoarm64: dts: rockchip: Provide power-domains for sd/sdio/emmc/pcie
Shawn Lin [Mon, 1 Aug 2016 07:26:26 +0000 (15:26 +0800)]
arm64: dts: rockchip: Provide power-domains for sd/sdio/emmc/pcie

The PM domain will be "powered on" once we have registered our PM domain
with genpd and when the device (dw_mmc etc) gets attached to the domain.
The attach occurs when the platform bus'->probe() function get invoked
for the device.

Genpd monitors each device within the domain. To allow it to "power
off", all devices in same domain needs to be runtime PM enabled and
runtime PM suspended.

Due to this, we should be able to deploy genpd support+an updated
DTB, without first having to deploying runtime PM support in the
related drivers. In other words, we could be able to work on these
things almost independently of each other。

So let's only provide power-domains to each devices' node to make
power policy collect the unreferenced ones once avaiable.

But please KEEP IN MIND that this patch doesn't mean we don't support
rpm or any genpd control related stuff on the future, which in other
words means that could be available later.

Change-Id: I1c7b2fdecb7f203d2c35e47892ae5296cfb32884
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
5 years agoarm64: dts: rockchip: add some pd nodes for rk3399 power domain
Elaine Zhang [Mon, 8 Aug 2016 01:59:16 +0000 (09:59 +0800)]
arm64: dts: rockchip: add some pd nodes for rk3399 power domain

add emmc\gmac\usb3\sd\sdioaudio\perihp pd nodes

Change-Id: Ie5f65c19ebd87ef9ca25846674e17cb2018cfbf7
Signed-off-by: Elaine Zhang <zhangqing@rock-chips.com>
5 years agoarm64: rockchip_defconfig: enable configfs usb gadget rndis
Wu Liang feng [Thu, 4 Aug 2016 12:52:55 +0000 (20:52 +0800)]
arm64: rockchip_defconfig: enable configfs usb gadget rndis

Change-Id: Ie6d90b3dc149a0687776972d8b83023f0c71921b
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
5 years agoARM64: rockchip_defconfig: enable fusb302 driver
Zain Wang [Thu, 7 Apr 2016 10:35:17 +0000 (18:35 +0800)]
ARM64: rockchip_defconfig: enable fusb302 driver

Change-Id: Iedbf055ff6bef523ed374c7ee265cce703b1702b
Signed-off-by: Zain Wang <wzz@rock-chips.com>
5 years agomfd: add driver for fusb302 Type-C PD
Zain Wang [Fri, 17 Jun 2016 08:51:37 +0000 (16:51 +0800)]
mfd: add driver for fusb302 Type-C PD

New driver only support DRP mode without swap function.
Swap function will be added in later.

Change-Id: I7e0c2c424def069d4be78c3bc8f704c3f7e5be48
Signed-off-by: Zain Wang <wzz@rock-chips.com>
5 years agoDocumentation: bindings: add devicetree bindings for fusb302 drivers
Zain Wang [Thu, 7 Apr 2016 10:29:20 +0000 (18:29 +0800)]
Documentation: bindings: add devicetree bindings for fusb302 drivers

Change-Id: Ifa82d8602d2ee39d43aac6cc98f8a402a0bd67d0
Signed-off-by: Zain Wang <wzz@rock-chips.com>
5 years agoUPSTREAM: nvmem: rockchip-efuse: remove nvmem regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:11 +0000 (20:28 +0100)]
UPSTREAM: nvmem: rockchip-efuse: remove nvmem regmap dependency

This patch moves to nvmem support in the driver to use callback
instead of regmap.

Change-Id: Ic565b927f985f4ac27367ff0a7042d48716654cc
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from cc907553ff55dda59c67e09706d3b734d67d0242)

5 years agoUPSTREAM: nvmem: core: remove regmap dependency
Srinivas Kandagatla [Sun, 24 Apr 2016 19:28:05 +0000 (20:28 +0100)]
UPSTREAM: nvmem: core: remove regmap dependency

nvmem uses regmap_raw_read/write apis to read/write data from providers,
regmap raw apis stopped working with recent kernels which removed raw
accessors on mmio bus. This resulted in broken nvmem for providers
which are based on regmap mmio bus. This issue can be fixed temporarly
by moving to other regmap apis, but we might hit same issue in future.
Moving to interfaces based on read/write callbacks from providers would
be more robust.

This patch removes regmap dependency from nvmem and introduces
read/write callbacks from the providers.

Without this patch nvmem providers like qfprom based on regmap mmio
bus would not work.

Change-Id: I510034b1cfe3057ef1e7eb20ad6a4175458f0b2b
Reported-by: Rajendra Nayak <rjendra@qti.qualcomm.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
cherry pick from 795ddd18d38f9762fbfefceab9aa16caef0cf431)

5 years agoUPSTREAM: nvmem: Fix dependencies for !HAS_IOMEM archs
Richard Weinberger [Mon, 22 Feb 2016 11:23:44 +0000 (11:23 +0000)]
UPSTREAM: nvmem: Fix dependencies for !HAS_IOMEM archs

Not every arch has io memory.
So, unbreak the build by fixing the dependencies.

Change-Id: Id5983c06d5b2627516c1622c44231ba426212b9a
Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from 5685e24446ab9aa0a529cf87a69ad73f4775888a)

5 years agoUPSTREAM: nvmem: Add backwards compatibility support for older EEPROM drivers.
Andrew Lunn [Fri, 26 Feb 2016 19:59:19 +0000 (20:59 +0100)]
UPSTREAM: nvmem: Add backwards compatibility support for older EEPROM drivers.

Older drivers made an 'eeprom' file available in the /sys device
directory. Have the NVMEM core provide this to retain backwards
compatibility.

Change-Id: I03449b029f7595c291144baea4d5fe9969ad7829
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from b6c217ab9be6895384cf0b284ace84ad79e5c53b)

5 years agoUPSTREAM: nvmem: Add flag to export NVMEM to root only
Andrew Lunn [Fri, 26 Feb 2016 19:59:18 +0000 (20:59 +0100)]
UPSTREAM: nvmem: Add flag to export NVMEM to root only

Legacy AT24, AT25 EEPROMs are exported in sys so that only root can
read the contents. The EEPROMs may contain sensitive information. Add
a flag so the provide can indicate that NVMEM should also restrict
access to root only.

Change-Id: Ida22fb0ea22aef379e1bd0be241725eb96c31789
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from 811b0d6538b9f26f3eb0f90fe4e6118f2480ec6f)

5 years agoUPSTREAM: nvmem: core: fix error path in nvmem_add_cells()
Rasmus Villemoes [Mon, 8 Feb 2016 21:04:29 +0000 (22:04 +0100)]
UPSTREAM: nvmem: core: fix error path in nvmem_add_cells()

The current code fails to nvmem_cell_drop(cells[0]) - even worse, if
the loop above fails already at i==0, we'll enter an essentially
infinite loop doing nvmem_cell_drop on cells[-1], cells[-2], ... which
is unlikely to end well.

Also, we're not freeing the temporary backing array cells on the error
path.

Change-Id: I1029a520e86f2c2fd2ad9054037c86b129dde172
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from dfdf141429f0895b63c882facc42c86f225033cb)

5 years agoUPSTREAM: nvmem: rockchip: trivial: Make the driver more readability
Caesar Wang [Mon, 14 Dec 2015 09:43:39 +0000 (09:43 +0000)]
UPSTREAM: nvmem: rockchip: trivial: Make the driver more readability

1) Make the include file to sort from order
2) clean up the driver to make more readability

Let's clean up such trivial details.

Change-Id: Ic014bedb7c1ed57a9121afa72eb8c690644ac59f
Signed-off-by: Caesar Wang <wxt@rock-chips.com>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from c37ff3fbe06f44e8ec3f8077b3a3c468635a8868)

5 years agoUPSTREAM: nvmem: core: return error for non word aligned access
Srinivas Kandagatla [Tue, 17 Nov 2015 09:12:41 +0000 (09:12 +0000)]
UPSTREAM: nvmem: core: return error for non word aligned access

nvmem providers have restrictions on register strides, so return error
when users attempt to read/write buffers with sizes which are less
than word size.

Without this patch the userspace would continue to try as it does not
get any error from the nvmem core, resulting in a hang or endless loop
in userspace.

Change-Id: Iffb76b5a784a79a008f80281ac64449733b855a6
Reported-by: Ariel D'Alessandro <ariel@vanguardiasur.com.ar>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Finley Xiao <finley.xiao@rock-chips.com>
(cherry pick from 2f9ba5b2f8420e0e5712080dafc773f7dd47c3df)

5 years agoarm64: dts: rockchip: Enable rga power domain for rk3399
Zikim,Wei [Thu, 4 Aug 2016 07:06:03 +0000 (15:06 +0800)]
arm64: dts: rockchip: Enable rga power domain for rk3399

Change-Id: Ib75fe7c32b84a210f9e344d37de302888343731a
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
5 years agoARM: dts: rk3288: support AP6212 wifi for Fennec
Nickey Yang [Thu, 4 Aug 2016 08:13:26 +0000 (16:13 +0800)]
ARM: dts: rk3288: support AP6212 wifi for Fennec

This patch add and enable AP6212 wifi node for rk3288-fennec

Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
Change-Id: I0bc77758869665992595c46471fc9bc7f9dff12c

5 years agoARM: configs: enable AP6XXX WiFi in rockchip_linux_defconfig
Nickey Yang [Wed, 3 Aug 2016 12:36:51 +0000 (20:36 +0800)]
ARM: configs: enable AP6XXX WiFi in rockchip_linux_defconfig

This patch enable rkwifi and AP6XXX series wifi chips config

Change-Id: I663df14011ce8402566d62c9e4d9b9a11b274fbe
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
5 years agoARM: dts: rk3288: support AP6335 bt for rk3288-evb
Nickey Yang [Thu, 4 Aug 2016 09:08:02 +0000 (17:08 +0800)]
ARM: dts: rk3288: support AP6335 bt for rk3288-evb

This patch add and enable AP6335 bt node for rk3288-evb

Change-Id: I31fcc8017d9cc52f0394affaba00f1c4c5394b3a
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
5 years agoARM: dts: rk3288: support AP6335 wifi for rk3288-evb
Nickey Yang [Thu, 4 Aug 2016 09:06:32 +0000 (17:06 +0800)]
ARM: dts: rk3288: support AP6335 wifi for rk3288-evb

This patch add and enable AP6335 wifi node for rk3288-evb

Change-Id: I49e7f6a67130a105579627d30db55010967da57a
Signed-off-by: Nickey Yang <nickey.yang@rock-chips.com>
5 years agommc: core: need retune if error value is -EIO
xiaoyao [Thu, 4 Aug 2016 09:02:59 +0000 (17:02 +0800)]
mmc: core: need retune if error value is -EIO

We need to do retune if receiving -EIO, otherwise we
could see debug dump like:

[ 89.057226] bcmsdh_sdmmc: Failed to Read byte F1:@0x1001f=ff, Err: -5
[ 89.058811] bcmsdh_sdmmc: Failed to Read byte F1:@0x1001f=ff, Err: -5
[ 89.059415] bcmsdh_sdmmc: Failed to Read byte F1:@0x1000e=ff, Err: -84
[ 89.254248] dwmmc_rockchip fe310000.dwmmc: Successfully tuned phase to 199
[ 89.273912] dhd_set_suspend: Remove extra suspend setting
[ 89.274478] dhd_enable_packet_filter: enter, value = 0
64 bytes from 112.90.83.112: icmp_seq=24 ttl=53 time=1321 ms
64 bytes from 112.90.83.112: icmp_seq=25 ttl=53 time=319 ms
64 bytes from 112.90.83.112: icmp_seq=26 ttl=53 time=69.8 ms
64 bytes from 112.90.83.112: icmp_seq=27 ttl=53 time=37.5 ms
...

In this case we see dw_mmc finally enter retune process, but
if this patch is applied, we could save more time to make it
work. Also many host drivers will generate -EIO, so this patch
can also prevent them from failing to enter retune process.

Change-Id: Iba59817fc4677a52bacc857bc99088d1f7790450
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
5 years agoFROMLIST: extcon: Add EXTCON_DISP_DP and the property for USB Type-C
Chris Zhong [Thu, 21 Jul 2016 16:13:02 +0000 (01:13 +0900)]
FROMLIST: extcon: Add EXTCON_DISP_DP and the property for USB Type-C

Add EXTCON_DISP_DP for the Display external connector. For Type-C
connector the DisplayPort can work as an Alternate Mode(VESA DisplayPort
Alt Mode on USB Type-C Standard). The Type-C support both normal
and flipped orientation, so add a property to extcon.

Change-Id: I490f82cdf278aa84db9c21ba8d0b7b0e9dfa4cff
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit e49de5133573
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-test)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
5 years agoFROMLIST: extcon: Add the synchronization extcon APIs to support the notification
Chanwoo Choi [Fri, 22 Jul 2016 04:16:34 +0000 (13:16 +0900)]
FROMLIST: extcon: Add the synchronization extcon APIs to support the notification

This patch adds the synchronization extcon APIs to support the notifications
for both state and property. When extcon_*_sync() functions is called,
the extcon informs the information from extcon provider to extcon client.

The extcon driver may need to change the both state and multiple properties
at the same time. After setting the data of a external connector,
the extcon send the notification to client driver with the extcon_*_sync().

The list of new extcon APIs as following:
- extcon_sync() : Send the notification for each external connector to
synchronize the information between extcon provider driver
and extcon client driver.
- extcon_set_state_sync() : Set the state of external connector with noti.
- extcon_set_property_sync() : Set the property of external connector with noti.

For example,
case 1, change the state of external connector and synchronized the data.
extcon_set_state_sync(edev, EXTCON_USB, 1);

case 2, change both the state and property of external connector
and synchronized the data.
extcon_set_state(edev, EXTCON_USB, 1);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);

case 3, change the property of external connector and synchronized the data.
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);
extcon_set_property(edev, EXTCON_USB, EXTCON_PROP_USB_ID, 1);
extcon_sync(edev, EXTCON_USB);

case 4, change the property of external connector and synchronized the data.
extcon_set_property_sync(edev, EXTCON_USB, EXTCON_PROP_USB_VBUS, 0);

Change-Id: Id8c04a88f28b8f3428afae122a761ff1d27a485f
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit cc3e39670d41
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-test)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
5 years agoFROMLIST: extcon: Rename the extcon_set/get_state() to maintain the function naming...
Chanwoo Choi [Fri, 22 Jul 2016 04:03:17 +0000 (13:03 +0900)]
FROMLIST: extcon: Rename the extcon_set/get_state() to maintain the function naming pattern

This patch just renames the existing extcon_get/set_cable_state_()
as following because of maintaining the function naming pattern
like as extcon APIs for property.
- extcon_set_cable_state_() -> extcon_set_state()
- extcon_get_cable_state_() -> extcon_get_state()

But, this patch remains the old extcon_set/get_cable_state_() functions
to prevent the build break. After altering new APIs, remove the old APIs.

Change-Id: I9dfdf0e254d2f598ca81836ec2a6a136da4fd8ba
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit 1bbc8c29be69
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-test)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
5 years agoFROMLIST: extcon: Add the support for the capability of each property
Chanwoo Choi [Mon, 25 Jul 2016 12:15:19 +0000 (21:15 +0900)]
FROMLIST: extcon: Add the support for the capability of each property

This patch adds the support of the property capability setting. This function
decides the supported properties of each external connector on extcon provider
driver.

Ths list of new extcon APIs to get/set the capability of property as following:
- int extcon_get_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);
- int extcon_set_property_capability(struct extcon_dev *edev,
unsigned int id, unsigned int prop);

Change-Id: I6b8b41de70f2bccc7b996592ec9a2a008730f45d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit e4a095473938
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-test)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
5 years agoFROMLIST: extcon: Add the support for extcon property according to extcon type
Chanwoo Choi [Mon, 11 Jul 2016 10:30:43 +0000 (19:30 +0900)]
FROMLIST: extcon: Add the support for extcon property according to extcon type

This patch support the extcon property for the external connector
because each external connector might have the property according to
the H/W design and the specific characteristics.

- EXTCON_PROP_USB_[property name]
- EXTCON_PROP_CHG_[property name]
- EXTCON_PROP_JACK_[property name]
- EXTCON_PROP_DISP_[property name]

Add the new extcon APIs to get/set the property value as following:
- int extcon_get_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value *prop_val)
- int extcon_set_property(struct extcon_dev *edev, unsigned int id,
unsigned int prop,
union extcon_property_value prop_val)

Change-Id: I3e483c69b374dcd6b340c94671d237c21e862cd2
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit f8ffa9daf942
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-test)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
5 years agoFROMLIST: extcon: Add the extcon_type to gather each connector into five category
Chanwoo Choi [Mon, 11 Jul 2016 07:34:52 +0000 (16:34 +0900)]
FROMLIST: extcon: Add the extcon_type to gather each connector into five category

This patch adds the new extcon type to group the each connecotr
into following five category. This type would be used to handle
the connectors as a group unit instead of a connector unit.
- EXTCON_TYPE_USB  : USB connector
- EXTCON_TYPE_CHG  : Charger connector
- EXTCON_TYPE_JACK : Jack connector
- EXTCON_TYPE_DISP : Display connector
- EXTCON_TYPE_MISC : Miscellaneous connector

Also, each external connector is possible to belong to one more extcon type.
In caes of EXTCON_CHG_USB_SDP, it have the EXTCON_TYPE_CHG and EXTCON_TYPE_USB.

Change-Id: I8299ecaa87a8277af4018f8cc28e9b63f25c026c
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Tested-by: Chris Zhong <zyw@rock-chips.com>
Tested-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
(cherry picked from commit 3665c70e95f7
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-test)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
5 years agodrm/rockchip: Fix drm rga driver for arm64
Zikim,Wei [Thu, 4 Aug 2016 06:24:10 +0000 (14:24 +0800)]
drm/rockchip: Fix drm rga driver for arm64

compat_uptr_t is defined in asm/compat.h:
typedef u32  compat_uptr_t;
but cmd and cmd_buf store the user pointers.
Do not convert 64 bit pointer to 32 bit, it
will lead copy_from_user fail.

Change-Id: Ia0435f2a495bbe64d583e213349cb9f041c9d75a
Signed-off-by: Zikim,Wei <wzq@rock-chips.com>
5 years agoInput: gslx680 - enable macro define RK_GEAR_TOUCH
jerry.zhang [Tue, 2 Aug 2016 05:58:06 +0000 (13:58 +0800)]
Input: gslx680 - enable macro define RK_GEAR_TOUCH

Change-Id: Ie0cb0ccd645cbecf74b3d0d85d80d4537bae75cd
Signed-off-by: jerry.zhang <jerry.zhang@rock-chips.com>
5 years agoarm64: dts: rockchip: modify sd minimum frequency for rk3399-box
xiaoyao [Tue, 2 Aug 2016 10:13:02 +0000 (18:13 +0800)]
arm64: dts: rockchip: modify sd minimum frequency for rk3399-box

The host can issue continuous clock in the frequency range
of 100KHz-400KHz for card identification mode.

Change-Id: I4e6a96a5ec49ee102a3b24c3f7f9b74d6bc8fd5f
Signed-off-by: xiaoyao <xiaoyao@rock-chips.com>
5 years agoARM64: dts: rk3399-vr: fix eas parameters for vr board with ES2
Jianqun Xu [Wed, 3 Aug 2016 04:11:07 +0000 (12:11 +0800)]
ARM64: dts: rk3399-vr: fix eas parameters for vr board with ES2

Change-Id: I8c1834e8515cc6387c68f1b3f8e370a5a1073aab
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
5 years agousb: dwc3: core: support DRD mode switch with extcon notifier
Wu Liang feng [Thu, 14 Jul 2016 02:32:19 +0000 (10:32 +0800)]
usb: dwc3: core: support DRD mode switch with extcon notifier

This patch register extcon notification for DRD mode.
If extcon cable state is EXTCON_USB, means that an USB
peripheral cable connected, and we need to set DWC3 work
in device mode. If extcon cable state is EXTCON_USB_HOST,
means that an USB host cable connected, and we need to
set DWC3 work in host mode.

And we need to register different notifier block for
EXTCON_USB notifier and EXTCON_USB_HOST notifier,because
if multiple notifiers registered with the same notifier
block, it will cause kernel crash on notification events.

Change-Id: Ia09e5088f738496b87d06b0f4062c144fa781e4e
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
5 years agodrm/rockchip: dsi: fix mipi display can't found at init time
Mark Yao [Mon, 1 Aug 2016 09:54:53 +0000 (17:54 +0800)]
drm/rockchip: dsi: fix mipi display can't found at init time

The problem is that:
  mipi panel probe request mipi_dsi_host_register.
  mipi host attach is call from panel device, so the defer function
always can't works.

So at the first bind time, always can't found mipi panel.

Change-Id: Ic95eeb4876896ea93860d8baaae074f50f078c62
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: support add fb from dev resource
Mark Yao [Mon, 1 Aug 2016 09:34:23 +0000 (17:34 +0800)]
drm/rockchip: support add fb from dev resource

Change-Id: I980af965d83de25c433ba5424bab2ad063534bcb
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: vop: enable iommu when we actually need it
Mark Yao [Tue, 2 Aug 2016 09:25:42 +0000 (17:25 +0800)]
drm/rockchip: vop: enable iommu when we actually need it

Change-Id: If22525a251b17a64c9e549b1aff93e4851de4080
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: find connector by device node
Mark Yao [Mon, 1 Aug 2016 09:03:17 +0000 (17:03 +0800)]
drm/rockchip: find connector by device node

Change-Id: I3851e296669c5c67ada47b472a3f7294ca25c796
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoarm64: dts: rk3399: use timing from dts
Mark Yao [Thu, 7 Jul 2016 08:28:42 +0000 (16:28 +0800)]
arm64: dts: rk3399: use timing from dts

Change-Id: I336af668ebc917388af47146400e6d5e3d94c2e0
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoARM64: dts: rk3399-box: adjust gpu opp table
Hans Yang [Tue, 2 Aug 2016 06:48:51 +0000 (14:48 +0800)]
ARM64: dts: rk3399-box: adjust gpu opp table

Adjust voltage of 500M to 0.9v

Change-Id: I21ac14f27cc7aaddfea6280e76decc28c8b1182a
Signed-off-by: Hans Yang <yhx@rock-chips.com>
5 years agosensor: add accel&gyro sensor driver for lsm330
Bin Yang [Tue, 2 Aug 2016 02:17:08 +0000 (10:17 +0800)]
sensor: add accel&gyro sensor driver for lsm330

Change-Id: Ibb0b6fe769774abc1a0f619eb9c626340e8b8bcc
Signed-off-by: Bin Yang <yangbin@rock-chips.com>
5 years agoUPSTREAM: extcon: Block the bit masking operation for cable state except for extcon...
Chanwoo Choi [Thu, 30 Jun 2016 17:41:18 +0000 (02:41 +0900)]
UPSTREAM: extcon: Block the bit masking operation for cable state except for extcon core

This patch restrict the usage of extcon_update_state() in the extcon
core because the extcon_update_state() use the bit masking to change
the state of external connector. When this function is used in device drivers,
it may occur the probelm with the handling mistake of bit masking.

Also, this patch removes the extcon_get/set_state() functions because these
functions use the bit masking which is reluctant way. Instead, extcon
provides the extcon_set/get_cable_state_() functions.

Change-Id: I436b8d4f9485bb318e7d77db8902f85e2bc15778
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit c2692f2dad4f3228579bb0b2cf2d6d9bf283f31a)

5 years agoUPSTREAM: extcon: adc-jack: Remove the usage of extcon_set_state()
Chanwoo Choi [Mon, 18 Jul 2016 07:16:29 +0000 (16:16 +0900)]
UPSTREAM: extcon: adc-jack: Remove the usage of extcon_set_state()

This patch removes the usage of extcon_set_state() because it uses the bit
masking to change the state of external connectors. The extcon framework
should handle the state by extcon_set/get_cable_state_() with extcon id.

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
(cherry picked from commit 0ddde3db610d57d28c1fe9a61e32dff1dc55ea59
 git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-next)

Change-Id: I64d5ff0c054ca0bab9a59105bf5c395d998665ff
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
5 years agoUPSTREAM: extcon: gpio: Remove the usage of extcon_set_state()
Chanwoo Choi [Thu, 21 Jul 2016 11:00:29 +0000 (20:00 +0900)]
UPSTREAM: extcon: gpio: Remove the usage of extcon_set_state()

This patch removes the usage of extcon_set_state() because it uses
the bit masking to change the state of external connectors. The extcon framework
should handle the state by extcon_set_cable_state_() with extcon id.

Change-Id: I726f690d900375d36001fe4eda9b53bcdd2b4f86
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit 448991505c967d7b44ae9ea328224ec02858c8da)

5 years agoUPSTREAM: extcon: arizona: Remove the usage of extcon_update_state()
Chanwoo Choi [Thu, 30 Jun 2016 17:36:49 +0000 (02:36 +0900)]
UPSTREAM: extcon: arizona: Remove the usage of extcon_update_state()

This patch remvoes the usage of extcon_update_state() because
the extcon_update_state() use directly the bit masking calculation
to change the state of external connector without the unique id of
external connector. It makes the code diffcult to read it.
So, this patch uses the extcon_set_cable_state_() instead.

Change-Id: I807cce6c46e37b32d5fbdbf65c45d1ddf6587996
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit af67ea70da0e8e906a81ae00d742c82ecda63a27)

5 years agoUPSTREAM: extcon: arizona: Remove unneeded semi-colon
Charles Keepax [Tue, 19 Jul 2016 12:23:56 +0000 (13:23 +0100)]
UPSTREAM: extcon: arizona: Remove unneeded semi-colon

There is no need for a semi-colon at the end of a switch statement so
remove it.

Change-Id: I64a6f485bcb1b064d17cea5f56f22f8b3773bf75
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit fa1723bb3461f42b3c35eeb313f7021d089da5f1)

5 years agoUPSTREAM: extcon: Fix the wrong description about extcon_set/get_cable_state_()
Chanwoo Choi [Mon, 27 Jun 2016 12:09:04 +0000 (21:09 +0900)]
UPSTREAM: extcon: Fix the wrong description about extcon_set/get_cable_state_()

This patch fixes the wrong description about extcon_set/get_cable_state_()
because they use the unique id of external connector instead of legacy name.

Change-Id: I954d0905c966b5128e9de577db9633f6b4b398bb
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit bc92126012c8c84988eebbbf9c8a246949b07462)

5 years agoUPSTREAM: extcon: Remove the state_store() to prevent the wrong access
Chanwoo Choi [Mon, 18 Jul 2016 06:39:28 +0000 (15:39 +0900)]
UPSTREAM: extcon: Remove the state_store() to prevent the wrong access

This patch removes the state_store() which change the state of external
connectors with bit masking on user-space. It is wrong access to modify
the change the state of external connectors.

Change-Id: I635e30e2a22ddc313ed90dc7ab0f7fdaa271ed1d
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit eeb820116207aa5dd71edbc0b8f0eaf3b20d77a1)

5 years agoUPSTREAM: extcon: Move extcon_get_edev_by_phandle() errors to dbg level
Stephen Boyd [Tue, 5 Jul 2016 18:57:05 +0000 (11:57 -0700)]
UPSTREAM: extcon: Move extcon_get_edev_by_phandle() errors to dbg level

Sometimes drivers may call this API and expect it to fail because
the extcon they're looking for is optional. Let's move these
prints to debug level so it doesn't look like there's a problem
when there isn't one.

Change-Id: Id3297af428cbaaef208e1990e1678b9ef04a7246
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit 27210e4efd5259c691c4c3ab53e74239efa0d581)

5 years agoUPSTREAM: extcon: add missing of_node_put after calling of_parse_phandle
Peter Chen [Fri, 1 Jul 2016 09:41:55 +0000 (18:41 +0900)]
UPSTREAM: extcon: add missing of_node_put after calling of_parse_phandle

of_node_put needs to be called when the device node which is got
from of_parse_phandle has finished using.

Change-Id: I96ad96b55e6f6c5e5335d12aeb5963c1b06451b3
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit 5d5c4c139dd766dff903ba35d72fb3ec90022e91)

5 years agoUPSTREAM: extcon: link devres into core module
Arnd Bergmann [Wed, 29 Jun 2016 14:38:30 +0000 (16:38 +0200)]
UPSTREAM: extcon: link devres into core module

Splitting the resource-managed functions into a separate module
means that the extcon core now fails to build because the internal
"extcon_dev_allocate" symbol is not exported:

ERROR: extcon_dev_allocate [drivers/extcon/devres.ko] undefined!

My guess is that the intention was not to have two separate
modules (which could be fixed by adding an export, plus the
normal MODULE_AUTHOR/MODULE_LICENSE/... fields), but have two
source files in the same module.

This fixes the Makefile accordingly, making the name of the
module extcon_core.ko, which is created from building both
extcon.c and devres.c.

Fixes: b225d00f3ad2 ("extcon: Split out the resource-managed functions from extcon core")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
(cherry picked from commit af61f96109b73fefbe0589c320d2219567f4f660
  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-next)

Change-Id: I8a319f46437cd3d6ce98a4f6ac5d1c56930c9c76
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
5 years agoUPSTREAM: extcon: Add resource-managed functions to register extcon notifier
Chanwoo Choi [Mon, 27 Jun 2016 11:03:39 +0000 (20:03 +0900)]
UPSTREAM: extcon: Add resource-managed functions to register extcon notifier

This patch adds the resource-managed functions for register/unregister
the extcon notifier with the id of each external connector. This function
will make it easy to handle the extcon notifier.

- int devm_extcon_register_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);
- void devm_extcon_unregister_notifier(struct device *dev,
struct extcon_dev *edev, unsigned int id,
struct notifier_block *nb);

Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
(cherry picked from commit 58f386560a68dd98bd6744a28fc853eef11faebe
  git://git.kernel.org/pub/scm/linux/kernel/git/chanwoo/extcon.git extcon-next)
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Change-Id: I852184d12dc4a03b6d526112e998b087931726e5
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
5 years agoUPSTREAM: extcon: Split out the resource-managed functions from extcon core
Chanwoo Choi [Mon, 27 Jun 2016 10:28:04 +0000 (19:28 +0900)]
UPSTREAM: extcon: Split out the resource-managed functions from extcon core

This patch split out the resource-managed related functions
from extcon core driver.

Change-Id: I4dd6cff278849c754bd529f44c3489d8bc665b15
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit b225d00f3ad2d996f914790a0f6324a4efd18768)

5 years agoUPSTREAM: extcon: Move struct extcon_cable from header file to core
Chanwoo Choi [Mon, 27 Jun 2016 10:17:06 +0000 (19:17 +0900)]
UPSTREAM: extcon: Move struct extcon_cable from header file to core

This patch moves the struct extcon_cable because that should
be only handled by extcon core. There are no reason to publish
the internal structure.

Change-Id: I7b2e68487ad0ddfa8a2342e7754f16af8623aa58
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit 20f7b53dfc24e0caa984087691af82e442229680)

5 years agoUPSTREAM: extcon: Check for incorrect connection type in notifier register
Stephen Boyd [Thu, 23 Jun 2016 10:34:30 +0000 (19:34 +0900)]
UPSTREAM: extcon: Check for incorrect connection type in notifier register

If we call extcon_register_notifier() with the wrong cable type,
it blows up with an oops instead of returning an error code.
Let's be nice and fail gracefully given that the consumer might
not know if the cable is supported by the extcon provider.

Change-Id: I6e357a6af600dac82e9b1c30499b2d0a3d58d716
Signed-off-by: Stephen Boyd <stephen.boyd@linaro.org>
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit a05f44c89ee1151b0da3ddd43d9e57d8f15b2f20)

5 years agoUPSTREAM: extcon: Remove the deprecated extcon functions
Chanwoo Choi [Tue, 31 May 2016 08:32:30 +0000 (17:32 +0900)]
UPSTREAM: extcon: Remove the deprecated extcon functions

This patch removes the deprecated extcon functions using string type
to identify the type of external connector. The Commit 2a9de9c0f08d61
("extcon: Use the unique id for external connector instead of string)
uses the unique id to separate the type of external connector instead of
string name.
- extcon_register_interest()
- extcon_unregister_interest()
- extcon_set_cable_state()
- extcon_get_cable_state()

And, extcon_register_interest() finds the first extcon device to include the
requested external connector from extcon client device and then register the
notifier if extcon device argument is NULL. Instead, extcon_register_notifier()
supports this feature.

But, this patch remains the deprecatd function definition to prevent
the build break.

Change-Id: I8238aa91a6da91fe66cb6c182602bc3bcc8688ae
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
(cherry picked from commit 830ae442202e314c2bdf7cb4c7cc64d76db0e197)

5 years agovideo: rockchip: edp: rk3399: add power domain control
Xubilv [Fri, 29 Jul 2016 10:15:51 +0000 (18:15 +0800)]
video: rockchip: edp: rk3399: add power domain control

Change-Id: I08a57e15bd182e3c4bcf87c383f55c21535a6acc
Signed-off-by: Xubilv <xbl@rock-chips.com>
5 years agoarm64: dts: rk3399-vr: ajust gpu opp table
wlq [Mon, 1 Aug 2016 01:38:12 +0000 (09:38 +0800)]
arm64: dts: rk3399-vr: ajust gpu opp table

ajust gpu voltage for stability

Change-Id: I1927bbe7990d6a9c9c712b53f1d5bf16b6102bb5
Signed-off-by: Liangqing Wu <wlq@rock-chips.com>
5 years agoARM: configs: remove DEBUG_LL relate configures from rockchip_linux_defconfig
Yakir Yang [Mon, 1 Aug 2016 10:10:28 +0000 (18:10 +0800)]
ARM: configs: remove DEBUG_LL relate configures from rockchip_linux_defconfig

If we enable the kernel low-level debugging port option, then we must
assign the right UART types and PHYS address for it. But different
CPUs must have different UART configures, we can't cover all of them
in this common configure file. For example:

* RK3036 would want to chose the UART types would be RK29_UART2, and
  UART_PHYS would be 0x20068000.

* RK3228 would want to chose the UART types would be RK29_UART2, and
  UART_PHYS would be 0x11030000.

* RK3288 would want to chose the UART types would be RK32_UART2, and
  UART_PHYS would be 0xff690000.

Change-Id: I70d0da1fbffbb720b5e464acd79405624d9e7d40
Signed-off-by: Yakir Yang <ykk@rock-chips.com>
5 years agodrm/rockchip: dw-mipi: remove mode_valid
Chris Zhong [Tue, 2 Aug 2016 01:44:21 +0000 (09:44 +0800)]
drm/rockchip: dw-mipi: remove mode_valid

The MIPI DSI do not need check the validity of resolution, the max resolution
should depend VOP. So remove rk3288_mipi_dsi_mode_valid here.

Change-Id: I789d184f9a14010795fe595ef31e1bea5d1022e0
Signed-off-by: Chris Zhong <zyw@rock-chips.com>
5 years agoARM64: dts: rk3399: add support edp screen for evb3
Jianqun Xu [Mon, 1 Aug 2016 08:13:12 +0000 (16:13 +0800)]
ARM64: dts: rk3399: add support edp screen for evb3

Support for some evb3 with edp screen, and with new touchscreen.

Change-Id: I8624ae38faef63aa5205861cfebb2a04f7bb8b30
Signed-off-by: Jianqun Xu <jay.xu@rock-chips.com>
Tested-by: Frank Wang <frank.wang@rock-chips.com>
5 years agodt-bindings: display: support drm_mipi_dsi macro
Mark Yao [Tue, 26 Jul 2016 03:25:21 +0000 (11:25 +0800)]
dt-bindings: display: support drm_mipi_dsi macro

Change-Id: Ibbe73605fff42762d88f2bc138ce98914ab200cc
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agodrm/rockchip: get rid of vop->is_enabled
Mark Yao [Mon, 1 Aug 2016 06:32:32 +0000 (14:32 +0800)]
drm/rockchip: get rid of vop->is_enabled

With atomic helpers there's no need to track the enabled state of a pipe
any more, because atomic helpers track this accurately already.

Change-Id: Ic2441b5acefe327cdef797aca88f6a2098643c69
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoUPSTREAM: drm/rockchip: Disarm vop->is_enabled
Mark Yao [Tue, 2 Aug 2016 09:24:37 +0000 (17:24 +0800)]
UPSTREAM: drm/rockchip: Disarm vop->is_enabled

With atomic helpers there's no need to track the enabled state of a pipe
any more, because atomic helpers track this accurately already.

Just disable the early returns, since the debug checks might be useful.

v2: Don't call drm_helper_disable_unused_functions, it blows up
without this check. At least explains why rockchip still needed this
old legacy-style state tracing - to work around issues from calling
other legacy style functions!

Change-Id: Ib63ad83b0212c5e2b0a44c1c5e2d188e7c876107
Cc: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Cc: Mark yao <mark.yao@rock-chips.com>
Tested-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Reviewed-by: Tomeu Vizoso <tomeu.vizoso@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1465388359-8070-18-git-send-email-daniel.vetter@ffwll.ch
Signed-off-by: Mark Yao <mark.yao@rock-chips.com>
5 years agoMALI: midgard: rockchip: add sysfs files to get GPU utilisation
chenzhen [Wed, 11 May 2016 10:18:04 +0000 (18:18 +0800)]
MALI: midgard: rockchip: add sysfs files to get GPU utilisation

Change-Id: I758369bdd9ef945a89fd87fd7a69bd9f391f0880
Signed-off-by: chenzhen <chenzhen@rock-chips.com>
5 years agoMerge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android
Mark Brown [Fri, 29 Jul 2016 20:38:37 +0000 (21:38 +0100)]
Merge branch 'linux-linaro-lsk-v4.4' into linux-linaro-lsk-v4.4-android

5 years agoMerge tag 'v4.4.16' into linux-linaro-lsk-v4.4
Mark Brown [Fri, 29 Jul 2016 20:38:36 +0000 (21:38 +0100)]
Merge tag 'v4.4.16' into linux-linaro-lsk-v4.4

This is the 4.4.16 stable release

# gpg: Signature made Wed 27 Jul 2016 17:48:38 BST using RSA key ID 6092693E
# gpg: requesting key 6092693E from hkp server the.earth.li
# gpg: key 6092693E: public key "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>" imported
# gpg: public key of ultimately trusted key B4B0BED6 not found
# gpg: 2 marginal(s) needed, 1 complete(s) needed, PGP trust model
# gpg: depth: 0  valid:   1  signed:   0  trust: 0-, 0q, 0n, 0m, 0f, 1u
# gpg: Total number processed: 1
# gpg:               imported: 1  (RSA: 1)
# gpg: Good signature from "Greg Kroah-Hartman (Linux kernel stable release signing key) <greg@kroah.com>"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 647F 2865 4894 E3BD 4571  99BE 38DB BDC8 6092 693E

5 years agoMerge remote-tracking branch 'lsk/v4.4/topic/mm-kaslr' into linux-linaro-lsk-v4.4
Mark Brown [Fri, 29 Jul 2016 20:33:51 +0000 (21:33 +0100)]
Merge remote-tracking branch 'lsk/v4.4/topic/mm-kaslr' into linux-linaro-lsk-v4.4

5 years agoarm64: kaslr: increase randomization granularity
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:48 +0000 (17:09 +0200)]
arm64: kaslr: increase randomization granularity

Currently, our KASLR implementation randomizes the placement of the core
kernel at 2 MB granularity. This is based on the arm64 kernel boot
protocol, which mandates that the kernel is loaded TEXT_OFFSET bytes above
a 2 MB aligned base address. This requirement is a result of the fact that
the block size used by the early mapping code may be 2 MB at the most (for
a 4 KB granule kernel)

But we can do better than that: since a KASLR kernel needs to be relocated
in any case, we can tolerate a physical misalignment as long as the virtual
misalignment relative to this 2 MB block size is equal in size, and code to
deal with this is already in place.

Since we align the kernel segments to 64 KB, let's randomize the physical
offset at 64 KB granularity as well (unless CONFIG_DEBUG_ALIGN_RODATA is
enabled). This way, the page table and TLB footprint is not affected.

The higher granularity allows for 5 bits of additional entropy to be used.

Reviewed-by: Matt Fleming <matt@codeblueprint.co.uk>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 6f26b3671184c36d07eb5d61ba9a6d0aeb583c5d)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: relocatable: deal with physically misaligned kernel images
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:47 +0000 (17:09 +0200)]
arm64: relocatable: deal with physically misaligned kernel images

When booting a relocatable kernel image, there is no practical reason
to refuse an image whose load address is not exactly TEXT_OFFSET bytes
above a 2 MB aligned base address, as long as the physical and virtual
misalignment with respect to the swapper block size are equal, and are
both aligned to THREAD_SIZE.

Since the virtual misalignment is under our control when we first enter
the kernel proper, we can simply choose its value to be equal to the
physical misalignment.

So treat the misalignment of the physical load address as the initial
KASLR offset, and fix up the remaining code to deal with that.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 08cdac619c81b3fa8cd73aeed2330ffe0a0b73ca)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: don't map TEXT_OFFSET bytes below the kernel if we can avoid it
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:46 +0000 (17:09 +0200)]
arm64: don't map TEXT_OFFSET bytes below the kernel if we can avoid it

For historical reasons, the kernel Image must be loaded into physical
memory at a 512 KB offset above a 2 MB aligned base address. The region
between the base address and the start of the kernel Image has no
significance to the kernel itself, but it is currently mapped explicitly
into the early kernel VMA range for all translation granules.

In some cases (i.e., 4 KB granule), this is unavoidable, due to the 2 MB
granularity of the early kernel mappings. However, in other cases, e.g.,
when running with larger page sizes, or in the future, with more granular
KASLR, there is no reason to map it explicitly like we do currently.

So update the logic so that the region is mapped only if that happens as
a side effect of rounding the start address of the kernel to swapper block
size, and leave it unmapped otherwise.

Since the symbol kernel_img_size now simply resolves to the memory
footprint of the kernel Image, we can drop its definition from image.h
and opencode its calculation.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 18b9c0d641938242d8bcdba3c14a8f2beec2a97e)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: kernel: replace early 64-bit literal loads with move-immediates
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:45 +0000 (17:09 +0200)]
arm64: kernel: replace early 64-bit literal loads with move-immediates

When building a relocatable kernel, we currently rely on the fact that
early 64-bit literal loads need to be deferred to after the relocation
has been performed only if they involve symbol references, and not if
they involve assemble time constants. While this is not an unreasonable
assumption to make, it is better to switch to movk/movz sequences, since
these are guaranteed to be resolved at link time, simply because there are
no dynamic relocation types to describe them.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit b03cc885328e3c0de61843737d42eb0a0f112aab)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: introduce mov_q macro to move a constant into a 64-bit register
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:44 +0000 (17:09 +0200)]
arm64: introduce mov_q macro to move a constant into a 64-bit register

Implement a macro mov_q that can be used to move an immediate constant
into a 64-bit register, using between 2 and 4 movz/movk instructions
(depending on the operand)

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 30b5ba5cf333cc650e474eaf2cc1ae91bc7cf89f)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: kernel: perform relocation processing from ID map
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:43 +0000 (17:09 +0200)]
arm64: kernel: perform relocation processing from ID map

Refactor the relocation processing so that the code executes from the
ID map while accessing the relocation tables via the virtual mapping.
This way, we can use literals containing virtual addresses as before,
instead of having to use convoluted absolute expressions.

For symmetry with the secondary code path, the relocation code and the
subsequent jump to the virtual entry point are implemented in a function
called __primary_switch(), and __mmap_switched() is renamed to
__primary_switched(). Also, the call sequence in stext() is aligned with
the one in secondary_startup(), by replacing the awkward 'adr_l lr' and
'b cpu_setup' sequence with a simple branch and link.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 0cd3defe0af4153ffc5fe39bcfa4abfc301984e9)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: kernel: use literal for relocated address of __secondary_switched
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:42 +0000 (17:09 +0200)]
arm64: kernel: use literal for relocated address of __secondary_switched

We can simply use a relocated 64-bit literal to store the address of
__secondary_switched(), and the relocation code will ensure that it
holds the correct value at secondary entry time, as long as we make sure
that the literal is not dereferenced until after we have enabled the MMU.

So jump via a small __secondary_switch() function covered by the ID map
that performs the literal load and branch-to-register.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit e5ebeec879b726c755af0c1c15f3699b53268cd5)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: kernel: don't export local symbols from head.S
Ard Biesheuvel [Mon, 18 Apr 2016 15:09:41 +0000 (17:09 +0200)]
arm64: kernel: don't export local symbols from head.S

This unexports some symbols from head.S that are only used locally.

Acked-by: Catalin Marinas <catalin.marinas@arm.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 190c056fc32a528979807cb5d5a0d68285933073)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
5 years agoarm64: simplify kernel segment mapping granularity
Ard Biesheuvel [Wed, 30 Mar 2016 15:43:09 +0000 (17:43 +0200)]
arm64: simplify kernel segment mapping granularity

The mapping of the kernel consist of four segments, each of which is mapped
with different permission attributes and/or lifetimes. To optimize the TLB
and translation table footprint, we define various opaque constants in the
linker script that resolve to different aligment values depending on the
page size and whether CONFIG_DEBUG_ALIGN_RODATA is set.

Considering that
- a 4 KB granule kernel benefits from a 64 KB segment alignment (due to
  the fact that it allows the use of the contiguous bit),
- the minimum alignment of the .data segment is THREAD_SIZE already, not
  PAGE_SIZE (i.e., we already have padding between _data and the start of
  the .data payload in many cases),
- 2 MB is a suitable alignment value on all granule sizes, either for
  mapping directly (level 2 on 4 KB), or via the contiguous bit (level 3 on
  16 KB and 64 KB),
- anything beyond 2 MB exceeds the minimum alignment mandated by the boot
  protocol, and can only be mapped efficiently if the physical alignment
  happens to be the same,

we can simplify this by standardizing on 64 KB (or 2 MB) explicitly, i.e.,
regardless of granule size, all segments are aligned either to 64 KB, or to
2 MB if CONFIG_DEBUG_ALIGN_RODATA=y. This also means we can drop the Kconfig
dependency of CONFIG_DEBUG_ALIGN_RODATA on CONFIG_ARM64_4K_PAGES.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 97740051dd31d200a0efaa84544fe5e4713aac40)
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>