summaryrefslogtreecommitdiff
path: root/drivers/power/reset
diff options
context:
space:
mode:
authorBlagovest Kolenichev <bkolenichev@codeaurora.org>2017-04-25 07:51:26 -0700
committerBlagovest Kolenichev <bkolenichev@codeaurora.org>2017-04-25 12:51:55 -0700
commitd877e94313437ef265d49be0b810bb36f6a7b05e (patch)
tree8559b8fa9d28f6c9dc5f3c4ea27a1a7f6299d874 /drivers/power/reset
parentb47135257c42a70a26247b05ff0ab42b6ad8fc8a (diff)
parentb834e929774513db929303125486c2c34bedba73 (diff)
Merge branch 'android-4.4@b834e92' into branch 'msm-4.4'
* refs/heads/tmp-b834e92 Revert "USB: gadget: u_ether: Fix data stall issue in RNDIS tethering mode" Linux 4.4.63 MIPS: fix Select HAVE_IRQ_EXIT_ON_IRQ_STACK patch. sctp: deny peeloff operation on asocs with threads sleeping on it net: ipv6: check route protocol when deleting routes tty/serial: atmel: RS485 half duplex w/DMA: enable RX after TX is done SUNRPC: fix refcounting problems with auth_gss messages. ibmveth: calculate gso_segs for large packets catc: Use heap buffer for memory size test catc: Combine failure cleanup code in catc_probe() rtl8150: Use heap buffers for all register access pegasus: Use heap buffers for all register access virtio-console: avoid DMA from stack dvb-usb-firmware: don't do DMA on stack dvb-usb: don't use stack for firmware load mm: Tighten x86 /dev/mem with zeroing reads rtc: tegra: Implement clock handling platform/x86: acer-wmi: setup accelerometer when machine has appropriate notify event ext4: fix inode checksum calculation problem if i_extra_size is small dvb-usb-v2: avoid use-after-free ath9k: fix NULL pointer dereference crypto: ahash - Fix EINPROGRESS notification callback powerpc: Disable HFSCR[TM] if TM is not supported zram: do not use copy_page with non-page aligned address kvm: fix page struct leak in handle_vmon Revert "MIPS: Lantiq: Fix cascaded IRQ setup" char: lack of bool string made CONFIG_DEVPORT always on char: Drop bogus dependency of DEVPORT on !M68K ftrace: Fix removing of second function probe irqchip/irq-imx-gpcv2: Fix spinlock initialization libnvdimm: fix reconfig_mutex, mmap_sem, and jbd2_handle lockdep splat xen, fbfront: fix connecting to backend scsi: sd: Fix capacity calculation with 32-bit sector_t scsi: sd: Consider max_xfer_blocks if opt_xfer_blocks is unusable scsi: sr: Sanity check returned mode data iscsi-target: Drop work-around for legacy GlobalSAN initiator iscsi-target: Fix TMR reference leak during session shutdown acpi, nfit, libnvdimm: fix interleave set cookie calculation (64-bit comparison) x86/vdso: Plug race between mapping and ELF header setup x86/vdso: Ensure vdso32_enabled gets set to valid values only perf/x86: Avoid exposing wrong/stale data in intel_pmu_lbr_read_32() Input: xpad - add support for Razer Wildcat gamepad CIFS: store results of cifs_reopen_file to avoid infinite wait drm/nouveau/mmu/nv4a: use nv04 mmu rather than the nv44 one drm/nouveau/mpeg: mthd returns true on success now thp: fix MADV_DONTNEED vs clear soft dirty race cgroup, kthread: close race window where new kthreads can be migrated to non-root cgroups ANDROID: uid_sys_stats: reduce update_io_stats overhead UPSTREAM: char: lack of bool string made CONFIG_DEVPORT always on UPSTREAM: char: Drop bogus dependency of DEVPORT on !M68K Revert "Android: sdcardfs: Don't do d_add for lower fs" ANDROID: usb: gadget: fix MTP enumeration issue under super speed mode Android: sdcardfs: Don't complain in fixup_lower_ownership Android: sdcardfs: Don't do d_add for lower fs ANDROID: sdcardfs: ->iget fixes Android: sdcardfs: Change cache GID value BACKPORT: [UPSTREAM] ext2: convert to mbcache2 BACKPORT [UPSTREAM] ext4: convert to mbcache2 BACKPORT: [UPSTREAM] mbcache2: reimplement mbcache Linux 4.4.62 ibmveth: set correct gso_size and gso_type net/mlx4_core: Fix when to save some qp context flags for dynamic VST to VGT transitions net/mlx4_core: Fix racy CQ (Completion Queue) free net/mlx4_en: Fix bad WQE issue usb: hub: Wait for connection to be reestablished after port reset blk-mq: Avoid memory reclaim when remapping queues net/packet: fix overflow in check for priv area size crypto: caam - fix RNG deinstantiation error checking MIPS: IRQ Stack: Fix erroneous jal to plat_irq_dispatch MIPS: Select HAVE_IRQ_EXIT_ON_IRQ_STACK MIPS: Switch to the irq_stack in interrupts MIPS: Only change $28 to thread_info if coming from user mode MIPS: Stack unwinding while on IRQ stack MIPS: Introduce irq_stack mtd: bcm47xxpart: fix parsing first block after aligned TRX usb: dwc3: gadget: delay unmap of bounced requests drm/i915: Stop using RP_DOWN_EI on Baytrail drm/i915: Avoid tweaking evaluation thresholds on Baytrail v3 UPSTREAM: net: socket: Make unnecessarily global sockfs_setattr() static UPSTREAM: net: ipv4: Don't crash if passing a null sk to ip_do_redirect. UPSTREAM: net/packet: fix overflow in check for priv area size Linux 4.4.61 mm/mempolicy.c: fix error handling in set_mempolicy and mbind. MIPS: Flush wrong invalid FTLB entry for huge page MIPS: Lantiq: fix missing xbar kernel panic MIPS: End spinlocks with .insn MIPS: ralink: Fix typos in rt3883 pinctrl MIPS: Force o32 fp64 support on 32bit MIPS64r6 kernels s390/uaccess: get_user() should zero on failure (again) s390/decompressor: fix initrd corruption caused by bss clear nios2: reserve boot memory for device tree powerpc: Don't try to fix up misaligned load-with-reservation instructions powerpc/mm: Add missing global TLB invalidate if cxl is active metag/usercopy: Add missing fixups metag/usercopy: Fix src fixup in from user rapf loops metag/usercopy: Set flags before ADDZ metag/usercopy: Zero rest of buffer from copy_from_user metag/usercopy: Add early abort to copy_to_user metag/usercopy: Fix alignment error checking metag/usercopy: Drop unused macros ring-buffer: Fix return value check in test_ringbuffer() ptrace: fix PTRACE_LISTEN race corrupting task->state Reset TreeId to zero on SMB2 TREE_CONNECT iio: bmg160: reset chip when probing arm/arm64: KVM: Take mmap_sem in kvm_arch_prepare_memory_region arm/arm64: KVM: Take mmap_sem in stage2_unmap_vm staging: android: ashmem: lseek failed due to no FMODE_LSEEK. sysfs: be careful of error returns from ops->show() drm/vmwgfx: fix integer overflow in vmw_surface_define_ioctl() drm/vmwgfx: Remove getparam error message drm/ttm, drm/vmwgfx: Relax permission checking when opening surfaces drm/vmwgfx: avoid calling vzalloc with a 0 size in vmw_get_cap_3d_ioctl() drm/vmwgfx: NULL pointer dereference in vmw_surface_define_ioctl() drm/vmwgfx: Type-check lookups of fence objects Revert "Revert "Revert "CHROMIUM: android: binder: Fix potential scheduling-while-atomic""" ANDROID: sdcardfs: Directly pass lower file for mmap UPSTREAM: checkpatch: special audit for revert commit line UPSTREAM: PM / sleep: make PM notifiers called symmetrically Revert "Revert "CHROMIUM: android: binder: Fix potential scheduling-while-atomic"" Linux 4.4.60 padata: avoid race in reordering blk: Ensure users for current->bio_list can see the full list. blk: improve order of bio handling in generic_make_request() power: reset: at91-poweroff: timely shutdown LPDDR memories KVM: kvm_io_bus_unregister_dev() should never fail rtc: s35390a: improve irq handling rtc: s35390a: implement reset routine as suggested by the reference rtc: s35390a: make sure all members in the output are set rtc: s35390a: fix reading out alarm MIPS: Lantiq: Fix cascaded IRQ setup mm, hugetlb: use pte_present() instead of pmd_present() in follow_huge_pmd() drm/radeon: Override fpfn for all VRAM placements in radeon_evict_flags KVM: x86: clear bus pointer when destroyed USB: fix linked-list corruption in rh_call_control() tty/serial: atmel: fix TX path in atmel_console_write() tty/serial: atmel: fix race condition (TX+DMA) ACPI: Do not create a platform_device for IOAPIC/IOxAPIC ACPI: Fix incompatibility with mcount-based function graph tracing ASoC: atmel-classd: fix audio clock rate ALSA: hda - fix a problem for lineout on a Dell AIO machine ALSA: seq: Fix race during FIFO resize scsi: libsas: fix ata xfer length scsi: sg: check length passed to SG_NEXT_CMD_LEN scsi: mpt3sas: fix hang on ata passthrough commands xen/setup: Don't relocate p2m over existing one libceph: force GFP_NOIO for socket allocations Linux 4.4.59 sched/rt: Add a missing rescheduling point fscrypt: remove broken support for detecting keyring key revocation metag/ptrace: Reject partial NT_METAG_RPIPE writes metag/ptrace: Provide default TXSTATUS for short NT_PRSTATUS metag/ptrace: Preserve previous registers for short regset write sparc/ptrace: Preserve previous registers for short regset write mips/ptrace: Preserve previous registers for short regset write h8300/ptrace: Fix incorrect register transfer count c6x/ptrace: Remove useless PTRACE_SETREGSET implementation pinctrl: qcom: Don't clear status bit on irq_unmask virtio_balloon: init 1st buffer in stats vq xfrm_user: validate XFRM_MSG_NEWAE incoming ESN size harder xfrm_user: validate XFRM_MSG_NEWAE XFRMA_REPLAY_ESN_VAL replay_window xfrm: policy: init locks early Conflicts: drivers/scsi/sd.c drivers/usb/gadget/function/f_mtp.c drivers/usb/gadget/function/u_ether.c Change-Id: I80501cf02d04204f8c0f3a7f5a036eaa4d54546e Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
Diffstat (limited to 'drivers/power/reset')
-rw-r--r--drivers/power/reset/at91-poweroff.c54
1 files changed, 53 insertions, 1 deletions
diff --git a/drivers/power/reset/at91-poweroff.c b/drivers/power/reset/at91-poweroff.c
index e9e24df35f26..2579f025b90b 100644
--- a/drivers/power/reset/at91-poweroff.c
+++ b/drivers/power/reset/at91-poweroff.c
@@ -14,9 +14,12 @@
#include <linux/io.h>
#include <linux/module.h>
#include <linux/of.h>
+#include <linux/of_address.h>
#include <linux/platform_device.h>
#include <linux/printk.h>
+#include <soc/at91/at91sam9_ddrsdr.h>
+
#define AT91_SHDW_CR 0x00 /* Shut Down Control Register */
#define AT91_SHDW_SHDW BIT(0) /* Shut Down command */
#define AT91_SHDW_KEY (0xa5 << 24) /* KEY Password */
@@ -50,6 +53,7 @@ static const char *shdwc_wakeup_modes[] = {
static void __iomem *at91_shdwc_base;
static struct clk *sclk;
+static void __iomem *mpddrc_base;
static void __init at91_wakeup_status(void)
{
@@ -73,6 +77,29 @@ static void at91_poweroff(void)
writel(AT91_SHDW_KEY | AT91_SHDW_SHDW, at91_shdwc_base + AT91_SHDW_CR);
}
+static void at91_lpddr_poweroff(void)
+{
+ asm volatile(
+ /* Align to cache lines */
+ ".balign 32\n\t"
+
+ /* Ensure AT91_SHDW_CR is in the TLB by reading it */
+ " ldr r6, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t"
+
+ /* Power down SDRAM0 */
+ " str %1, [%0, #" __stringify(AT91_DDRSDRC_LPR) "]\n\t"
+ /* Shutdown CPU */
+ " str %3, [%2, #" __stringify(AT91_SHDW_CR) "]\n\t"
+
+ " b .\n\t"
+ :
+ : "r" (mpddrc_base),
+ "r" cpu_to_le32(AT91_DDRSDRC_LPDDR2_PWOFF),
+ "r" (at91_shdwc_base),
+ "r" cpu_to_le32(AT91_SHDW_KEY | AT91_SHDW_SHDW)
+ : "r0");
+}
+
static int at91_poweroff_get_wakeup_mode(struct device_node *np)
{
const char *pm;
@@ -124,6 +151,8 @@ static void at91_poweroff_dt_set_wakeup_mode(struct platform_device *pdev)
static int __init at91_poweroff_probe(struct platform_device *pdev)
{
struct resource *res;
+ struct device_node *np;
+ u32 ddr_type;
int ret;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -150,12 +179,30 @@ static int __init at91_poweroff_probe(struct platform_device *pdev)
pm_power_off = at91_poweroff;
+ np = of_find_compatible_node(NULL, NULL, "atmel,sama5d3-ddramc");
+ if (!np)
+ return 0;
+
+ mpddrc_base = of_iomap(np, 0);
+ of_node_put(np);
+
+ if (!mpddrc_base)
+ return 0;
+
+ ddr_type = readl(mpddrc_base + AT91_DDRSDRC_MDR) & AT91_DDRSDRC_MD;
+ if ((ddr_type == AT91_DDRSDRC_MD_LPDDR2) ||
+ (ddr_type == AT91_DDRSDRC_MD_LPDDR3))
+ pm_power_off = at91_lpddr_poweroff;
+ else
+ iounmap(mpddrc_base);
+
return 0;
}
static int __exit at91_poweroff_remove(struct platform_device *pdev)
{
- if (pm_power_off == at91_poweroff)
+ if (pm_power_off == at91_poweroff ||
+ pm_power_off == at91_lpddr_poweroff)
pm_power_off = NULL;
clk_disable_unprepare(sclk);
@@ -163,6 +210,11 @@ static int __exit at91_poweroff_remove(struct platform_device *pdev)
return 0;
}
+static const struct of_device_id at91_ramc_of_match[] = {
+ { .compatible = "atmel,sama5d3-ddramc", },
+ { /* sentinel */ }
+};
+
static const struct of_device_id at91_poweroff_of_match[] = {
{ .compatible = "atmel,at91sam9260-shdwc", },
{ .compatible = "atmel,at91sam9rl-shdwc", },