23 Feb, 2017

40 commits

  • Some registers on pfuze3000 will lost after exit from LPSR, need restore them,
    otherwise system may reboot with below command after system enter LPSR one time:

    root@imx7d_all:~# echo enabled > /sys/class/tty/ttymxc0/power/wakeup
    root@imx7d_all:~# echo mem > /sys/power/state

    because LDOGCTL not recover as 1. Add 'fsl,lpsr-mode' property to this case,
    please add this property if your board support LPSR mode as imx7d-12x12-lpddr3-arm2
    board.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • As SNVS clk may be disabled in kernel to save power(~1mA),
    but during suspend/resume, we have to access SNVS register
    to do MMDC retention and power down SoC etc.., need to
    make sure SNVS clk is enabled before accessing its register.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • fix the pin conflict between ECSPI with MIPI and EPDC on i.MX7D 12x12 lpddr3 ARM2 board.

    Signed-off-by: Han Xu

    Han Xu
     
  • mipi pins conflict with ecspi1 on i.MX7D 12x12 lpddr3 ARM2 board, manage
    the mipi pins in a individual group to solve the issue.

    Signed-off-by: Han Xu

    Han Xu
     
  • Add i2c IOMUX sleep state for imx7d-12x12-lpddr3-arm2.

    Signed-off-by: Gao Pan

    Gao Pan
     
  • …em entered suspend mode. 100%

    The 'backlight' and 'pwm1' are disabled due to the lpsr mode
    not ready in the previous patch in the imx7d-12x12-lpddr3-arm2
    dts. So they should be enabled again after lpsr ready.

    Signed-off-by: Fancy Fang <chen.fang@freescale.com>

    Fancy Fang
     
  • enable v4l2 output feature on i.MX7D 12x12 LPDDR3 ARM2 board.

    Signed-off-by: Robby Cai

    Robby Cai
     
  • Add 'fsl,lpsr-mode' property to support LPSR mode on arm2 board.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • Enabled lcdif and pxp as lpsr mode is supported.

    Signed-off-by: Robby Cai

    Robby Cai
     
  • Add lpsr mode for lcdif

    Signed-off-by: Robby Cai

    Robby Cai
     
  • SIM1 IOMUX is changed into reset state in LPSR mode. This patch
    adds sim1 IOMUX sleep state in dts for IOMUX restoring.

    Signed-off-by: Gao Pan

    Gao Pan
     
  • It doesn't need to do any changes when using lpsr mode for USB.

    Signed-off-by: Peter Chen

    Peter Chen
     
  • Restore pinhogs after exit from lpsr mode.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • During stress test of LPSR using RTC alarm, sometimes
    RTC alarm fail to fire, the control register(offset 0x38)
    is changed and RTC alarm is disabled, according to
    design team, when enter LPSR with programming SNVS
    to shutdown PMIC, SNVS need some time to finish power
    down process, better to put ARM into wfi during this
    window.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Redo necessary gpcv2 initialization after resume from
    LPSR mode, as its state is lost in lpsr mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Restore RC_OSC after LPSR resume back, otherwise,
    low power idle will never works normally.

    Signed-off-by: Robin Gong
    Signed-off-by: Anson Huang

    Robin Gong
     
  • Add GPIO state retention support for i.MX7D LPSR mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add system counter state retention for i.MX7D LPSR mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add GPT1 state retention support for i.MX7D LPSR mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • When exit from LPSR mode, CCM settings will be lost, so
    we need to do CCM state retention support to make sure
    after resume from LPSR mode, clk tree settings are same
    as before entering LPSR;

    Due to hardware design requirement, CCM clk root registers
    access needs their parents enabled, so we use special
    sequence to restore PLLs, PFDs, ROOTs, and LPCGs.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • When exit from lpsr mode, iomuxc's io/pad settings will
    be lost, although driver resume callback will restore
    module io settings from sleep mode to default mode, debug
    uart needs to be enabled earlier to support
    "no_console_suspend" case.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add IOMUXC GPR state retention support for i.MX7D LPSR mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • In LPSR mode, low power ocram can NOT contain its memory any
    more, need to support state retention to make sure its memory
    is correct after resume from LPSR mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add LPSR mode support if dtb contains "fsl,enable-lpsr" property,
    when echo mem to make system enter DSM mode, whole SOC will be
    powered down except LPSR, SNVS domain and DDR chip's power,
    that means all modules in SOC domain will be powered down,
    including ccm, iomuxc, gpc....

    So, all drivers need to restore their iomux settings and
    clk settings after resume;

    When system enters LPSR mode, can be waked up by long press
    ON/OFF button or using RTC alarm.

    In LPSR mode resume, ROM will read the entry point in LPSR
    register, make DRAM exit retention mode and jump to DRAM
    to resume kernel immediately, so before entering LPSR mode,
    we need to set the resume entry correctly in LPSR register
    and clear it after resume.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add property "fsl,enable-lpsr" to enable lpsr mode by default,
    when this property is set, DSM mode will go into LPSR mode.

    As many modules save/restore is NOT ready, to make tiny
    kernel enter/exit LPSR mode work, only enable those
    necessary modules for now.

    Other modules will be enabled after their drivers are
    ready to support LPSR mode.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • Add LPSR GPR node to support LPSR mode on i.MX7D.

    Signed-off-by: Anson Huang

    Anson Huang
     
  • To support pinctl hog restore after LPSR resume back,
    add suspend/resume in pinctrl driver.

    Signed-off-by: Robin Gong

    Robin Gong
     
  • Murata adapter VDDIO is derived from sd slot VMMC supply, if usdhc cannot
    detect sd/sdio card, VMMC is shutdown that causes VDDIO has no voltage, and
    bt cannot work. So BT depends on VDDIO/VMMC.

    Now the workaround is set wlreg_on alwasys on, usdhc can detect wifi card
    and supply VMMC 3.3V voltage, so that Murata adapter VDDIO has power supply.

    Signed-off-by: Fugang Duan
    (cherry picked from commit f17b5e5be37875e05794621eacf386ec25adf223)

    Fugang Duan
     
  • …PIO function before lpsr suspend

    It's hardware issue that if there are interrupts in GPIO1, the system
    will not enter lpsr suspend state.

    gpio1_12 pin is used as headphone detect pin for wm8958 sound card. If
    headphone is not plugged in, the gpio1_12 pin is high level. When lpsr
    suspend without headphone plugged in, gpio will be powered down and
    there will be a interrupt in the gpio1_12 pin.

    So we should avoid thus interrupt. We fix this issue by configuring
    gpio1_12 pin to non GPIO function before lpsr suspend.

    Because ALSA will set SAI pins to sleep state before suspend, and will
    not set them to default state after resume if cpu dai is not active. So
    we'd better remove non SAI pins from SAI pin group, and let iomuxc to
    control the gpio pin state.

    Signed-off-by: Zidan Wang <zidan.wang@freescale.com>
    (cherry picked from commit b3e988b838388f901d471a6938d0fb67b9bcad3b)

    Conflicts:
    arch/arm/boot/dts/imx7d-12x12-lpddr3-arm2.dts

    Zidan Wang
     
  • In order to workaround the PRE SoC bug recorded by errata ERR009624, the
    software cannot write the PRE_CTRL register when the PRE writes the PRE_CTRL
    register automatically to set the ENABLE bit(bit0) to 1 in the PRE repeat mode.

    In non-small y resolution cases(>9 lines), we choose to check the STORE_BLOCK_Y
    field of the register HW_PRE_STRORE_ENGINE_STATUS to determine the bad window
    to update the SDW_UDPATE bit of the PRE_CTRL register. According to the
    description of the STRORE_BLOCK_Y field in block mode, the field indicates the
    Y coordinate of the block currently being rendered. Thus, we should round up
    the real display y resolution to 4 lines to align with the block high(the out-
    standing lines are cropped by PRG and IPU). To maximize the safe window, we
    just need to avoid updating the shadow bit during the last block of lines.
    To conclude, the bad window for block mode is (store_block_y == 0 ||
    store_block_y >= DIV_ROUND_UP(y_resolution, 4) - 1).

    Signed-off-by: Liu Ying

    Liu Ying
     
  • It's pretty common that on some reference design or validation boards,
    one pin could be used by two devices on board, and the pin route is
    controlled by a GPIO. So to assert the pin for given device, not only
    the pinmux controller in SoC needs to be set up properly but also the
    GPIO needs to be pulled up/down.

    The patch adds support of a device tree property "pinctrl-assert-gpios"
    under client device node. It plays pretty much like a board level pin
    multiplexer, and steers the pin route by controlling the GPIOs. When
    client device has the property represent in its node, pinctrl device
    tree mapping function will firstly pull up/down the GPIOs to assert the
    pins for the device at board level.

    [shawn.guo: cherry-pick commit e5a718edab82 from imx_3.10.y]
    Signed-off-by: Shawn Guo

    Shawn Guo
     
  • Flexcan2 on ddr3 arm2 board is conflict with uart2, thus a new dts
    imx6ul-14x14-ddr3-arm2-flexcan2.dts with uart2 disabled is introduced to
    resolve such confliction.

    Signed-off-by: Dong Aisheng
    (cherry picked from commit 14d7595a2f1622c72de1bc534cf18b9e828140ea)

    Conflicts:
    arch/arm/boot/dts/Makefile
    arch/arm/boot/dts/imx6ul-ddr3-arm2.dts

    Dong Aisheng
     
  • Add ultra high speed mode pinctrl states to support eMMC HS200.
    HW rework needed that changing both NVCC_SD and NVCC_NAND to 1.8v.

    Signed-off-by: Dong Aisheng
    (cherry picked from commit f0f86b3bcd0ae1b1405f752862bde9745222372d)

    Dong Aisheng
     
  • The eMMC signals are reused from SD1 slot signals on MX6UL ARM2 board.
    Thus a new dts is introduced to avoid such pin confliction.
    Before using this dts, user has to do hw rework to connect eMMC IO
    signals and disconnect SD1 Slot signals.

    Signed-off-by: Dong Aisheng
    (cherry picked from commit e46408ad15bed829e6f254ced16524fcfe99176f)

    Conflicts:
    arch/arm/boot/dts/Makefile
    arch/arm/boot/dts/imx6ul-14x14-ddr3-arm2.dts

    Dong Aisheng
     
  • As part of starting up IBSS, CFG80211 driver needs BSS information to be
    plumbed into it. Hence in DHD we call cfg80211_infrom_bss() and it needs whole
    frame consist of IEs contained in beacon frame. But FW was passing frame buffer
    with some extra bytes preceded and when same is plumbed into CFG80211 it was not
    able to decode the frame and it ignores the frame as result we get such warnings.
    Using latest FW delivered by Broadcom to fix the issue.

    As well as wl_cfg80211.c changes are essential. This change is actually fix certain
    warnings seen when moving between IBSS and BSS network mode.
    Changes must be done in wl_cfg80211_change_virtual_iface() which you can find at
    wl_cfg80211.c and this file is not specific wl tool.

    Signed-off-by: Dong Aisheng
    (cherry picked from commit a6a35af7350b26c1e30cc14aa2ad6e117ab260dc)

    Dong Aisheng
     
  • Should call cfg80211_disconnected() when do rmmod if associcated with AP before..

    root@imx7d_all:~# modprobe -r bcmdhd
    dhd_prot_ioctl : bus is down. we have nothing to do
    dhd_wlfc_deinit():3268, ampdu_hostreorder get failed Err = -1
    dhd_prot_ioctl : bus is down. we have nothing to do
    dhd_wlfc_deinit():3291 failed to enable/disable bdcv2 tlv signaling Err = -1
    CFG80211-ERROR) wl_cfg80211_disconnect : Reason 3
    dhd_prot_ioctl : bus is down. we have nothing to do
    CFG80211-ERROR) wl_cfg80211_disconnect : error (-1)
    ------------[ cut here ]------------
    WARNING: CPU: 1 PID: 1057 at net/wireless/core.c:953 cfg80211_netdev_notifier_call+0x3f4/0x468()
    Modules linked in: bcmdhd(-) evbug
    CPU: 1 PID: 1057 Comm: modprobe Not tainted 3.14.38-02140-g3418ee9 #1074
    [] (unwind_backtrace) from [] (show_stack+0x10/0x14)
    [] (show_stack) from [] (dump_stack+0x7c/0xbc)
    [] (dump_stack) from [] (warn_slowpath_common+0x6c/0x88)
    [] (warn_slowpath_common) from [] (warn_slowpath_null+0x1c/0x24)
    [] (warn_slowpath_null) from [] (cfg80211_netdev_notifier_call+0x3f4/0x468)
    [] (cfg80211_netdev_notifier_call) from [] (notifier_call_chain+0x44/0x84)
    [] (notifier_call_chain) from [] (raw_notifier_call_chain+0x18/0x20)
    [] (raw_notifier_call_chain) from [] (rollback_registered_many+0x1dc/0x340)
    [] (rollback_registered_many) from [] (rollback_registered+0x28/0x3c)
    [] (rollback_registered) from [] (unregister_netdevice_queue+0x54/0xb0)
    [] (unregister_netdevice_queue) from [] (unregister_netdev+0x18/0x20)
    [] (unregister_netdev) from [] (dhd_detach+0x238/0x474 [bcmdhd])
    [] (dhd_detach [bcmdhd]) from [] (dhdsdio_release+0x40/0x1c0 [bcmdhd])
    [] (dhdsdio_release [bcmdhd]) from [] (dhdsdio_disconnect+0x3c/0x94 [bcmdhd])
    [] (dhdsdio_disconnect [bcmdhd]) from [] (bcmsdh_remove+0x3c/0x60 [bcmdhd])
    [] (bcmsdh_remove [bcmdhd]) from [] (bcmsdh_sdmmc_remove+0x4c/0x64 [bcmdhd])
    [] (bcmsdh_sdmmc_remove [bcmdhd]) from [] (sdio_bus_remove+0x30/0xf8)
    [] (sdio_bus_remove) from [] (__device_release_driver+0x70/0xcc)
    [] (__device_release_driver) from [] (driver_detach+0xac/0xb0)
    [] (driver_detach) from [] (bus_remove_driver+0x4c/0xa0)
    [] (bus_remove_driver) from [] (dhd_module_cleanup+0x2c/0x3c [bcmdhd])
    [] (dhd_module_cleanup [bcmdhd]) from [] (SyS_delete_module+0x11c/0x17c)
    [] (SyS_delete_module) from [] (ret_fast_syscall+0x0/0x30)
    ---[ end trace 89522c1a1370465d ]---
    dhd_detach(): thread:dhd_watchdog_thread:291 terminated OK
    dhd_dpc_thread: Unexpected up_cnt 0
    dhd_detach(): thread:dhd_dpc:292 terminated OK
    CFG80211-ERROR) wl_event_handler : was terminated
    wl_destroy_event_handler(): thread:wl_event_handler:290 terminated OK
    unregister wifi platform drivers
    wifi_platform_bus_enumerate device present 0
    mmc1: card 0001 removed

    Signed-off-by: Dong Aisheng
    (cherry picked from commit 740bef7011441010f6183662d452304dca7c7adf)

    Dong Aisheng
     
  • CC [M] drivers/net/wireless/bcmdhd/dhd_ip.o
    LD [M] fs/udf/udf.o
    drivers/net/wireless/bcmdhd/dhd_common.c:108:22: error: macro "__DATE__" might prevent reproducible builds [-Werror=date-time]
    DHD_COMPILED " on " __DATE__ " at " __TIME__;
    ^
    drivers/net/wireless/bcmdhd/dhd_common.c:108:38: error: macro "__TIME__" might prevent reproducible builds [-Werror=date-time]
    DHD_COMPILED " on " __DATE__ " at " __TIME__;

    Drop debug version with build date/time.
    The kernel already has this information, and individual drivers
    shouldn't duplicate that. This also eliminates the use of __DATE__ and
    __TIME__, which make the build non-deterministic.

    Signed-off-by: Dong Aisheng
    (cherry picked from commit 3f47e9588c8acf5c4cc5079e746bc05e7d5c69ec)

    Dong Aisheng
     
  • Without this, WiFi can not work when re-insmod module because
    the card is not reset in rmmod.

    Signed-off-by: Dong Aisheng
    (cherry picked from commit 25ce53802b419f3b2002c5345abee1b85827c688)

    Dong Aisheng
     
  • root@imx7d_all:~# rmmod bcmdhd
    dhd_prot_ioctl : bus is down. we have nothing to do
    dhd_wlfc_deinit():3268, ampdu_hostreorder get failed Err = -1
    dhd_prot_ioctl : bus is down. we have nothing to do
    dhd_wlfc_deinit():3291 failed to enable/disable bdcv2 tlv signaling Err = -1
    dhd_detach(): thread:dhd_watchdog_thread:2d4 terminated OK
    dhd_dpc_thread: Unexpected up_cnt 0
    dhd_detach(): thread:dhd_dpc:2d5 terminated OK
    CFG80211-ERROR) wl_event_handler : was terminated
    wl_destroy_event_handler(): thread:wl_event_handler:2d3 terminated OK
    ------------[ cut here ]------------
    Kernel BUG at 800d12b0 [verbose debug info unavailable]
    Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM
    Modules linked in: bcmdhd(-) evbug
    CPU: 0 PID: 755 Comm: rmmod Not tainted 3.14.28-7D_alpha #1
    task: a8a31680 ti: a841a000 task.ti: a841a000
    PC is at kfree+0x17c/0x180
    LR is at wiphy_unregister+0x15c/0x1cc
    pc : [] lr : [] psr: 40070013
    sp : a841be28 ip : 00000000 fp : a901396c
    r10: 7f078dc0 r9 : a9240120 r8 : a9240380
    r7 : a9240000 r6 : a9010000 r5 : ab73af20 r4 : a9240120
    r3 : 00000000 r2 : ab75a000 r1 : 00000000 r0 : 7f079220
    Flags: nZcv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
    Control: 10c53c7d Table: a863406a DAC: 00000015
    Process rmmod (pid: 755, stack limit = 0xa841a238)
    Stack: (0xa841be28 to 0xa841c000)
    be20: 7f079220 a9240120 00000000 a9010000 a9240000 a9240380
    be40: a9240120 7f078dc0 a901396c 806b0cf8 00000000 7f078dc0 a901396c 805962b4
    be60: 7f07cea0 a8433800 a8ae3840 a9240380 a9010000 a9013000 a9240380 7f02b088
    be80: 00000000 00000000 a9010000 a9013000 a9010000 7f07cea0 7f078dc0 7f00f00c
    bea0: 00000001 a850f800 7f078dc0 a865b3c0 00000081 8000e5e4 a841a000 00000000
    bec0: 00000000 7f05588c 7f078dc0 a850f800 00000000 7f056080 7f056044 a865b180
    bee0: a865b340 7f048944 a8fe7800 a865b3c0 7f07acd4 7f04a37c 7f04a330 a8487408
    bf00: a8487400 804baf10 a8487408 7f07acd4 a848743c 803476b4 7f07acd4 a8487408
    bf20: 7f07acd4 80347dc4 7f07acd4 7f07ad38 00000800 803473b4 00000000 7f05f158
    bf40: 7f05f12c 80083be8 00000000 00000000 7f07ad38 00000800 a841bf4c 646d6362
    bf60: 00006468 00000000 8108f030 a8a31680 a8a31a30 00000000 00000000 8004605c
    bf80: a89c4d80 a841a018 8000e5e4 a841bfb0 a841a000 00011330 00000000 7ecc5e1c
    bfa0: 00000002 8000e460 00000000 7ecc5e1c 01b05d3c 00000800 76f26104 00002002
    bfc0: 00000000 7ecc5e1c 00000002 00000081 7ecc5f0a 00000001 01b05d08 00000000
    bfe0: 76eebeb0 7ecc5bfc 00016e3c 76eebebc 60080010 01b05d3c efdff749 faff7bf3
    [] (kfree) from [] (wiphy_unregister+0x15c/0x1cc)
    [] (wiphy_unregister) from [] (wl_free_wdev+0x2c/0xf8 [bcmdhd])
    [] (wl_free_wdev [bcmdhd]) from [] (dhd_detach+0x274/0x430 [bcmdhd])
    [] (dhd_detach [bcmdhd]) from [] (dhdsdio_release+0x40/0x1cc [bcmdhd])
    [] (dhdsdio_release [bcmdhd]) from [] (dhdsdio_disconnect+0x3c/0xa0 [bcmdhd])
    [] (dhdsdio_disconnect [bcmdhd]) from [] (bcmsdh_remove+0x3c/0x60 [bcmdhd])
    [] (bcmsdh_remove [bcmdhd]) from [] (bcmsdh_sdmmc_remove+0x4c/0x64 [bcmdhd])
    [] (bcmsdh_sdmmc_remove [bcmdhd]) from [] (sdio_bus_remove+0x30/0xf8)
    [] (sdio_bus_remove) from [] (__device_release_driver+0x70/0xcc)
    [] (__device_release_driver) from [] (driver_detach+0xac/0xb0)
    [] (driver_detach) from [] (bus_remove_driver+0x4c/0xa0)
    [] (bus_remove_driver) from [] (dhd_module_cleanup+0x2c/0x3c [bcmdhd])
    [] (dhd_module_cleanup [bcmdhd]) from [] (SyS_delete_module+0x11c/0x17c)
    [] (SyS_delete_module) from [] (ret_fast_syscall+0x0/0x30)
    Code: e1a01005 e1a02006 e8bd4ff8 eafffef1 (e7f001f2)
    ---[ end trace ca749705cd612037 ]---
    Segmentation fault

    Signed-off-by: Dong Aisheng
    (cherry picked from commit 8d019afe680fd7f20e42159daf2da7d9bfc94577)

    Dong Aisheng
     
  • 1. Add dummy regulator in dts which is must required by bcmdhd driver
    2. Workaround to add dummy sdio_reset_comm as suggested by Broadcom guy
    because driver always failed in this function porting from Android kernel,
    root cause unknown.
    3. enable driver dts function, inband irq, built as module
    4. comment out the hard code in wifi_plat_dev_drv_probe which has to parse
    oob irq gpio properties and gpio regulators from device tree even the driver
    does not use it.
    5. warning fix

    Signed-off-by: Dong Aisheng
    (cherry picked from commit fb572304245ab19b79a101c66f0c658a555cc3fe)

    Dong Aisheng