From patchwork Wed Jan 6 00:32:28 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 59218 Delivered-To: patches@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp6280907lbb; Tue, 5 Jan 2016 16:32:34 -0800 (PST) X-Received: by 10.98.14.151 with SMTP id 23mr70202253pfo.154.1452040354374; Tue, 05 Jan 2016 16:32:34 -0800 (PST) Return-Path: Received: from mail-pf0-x22d.google.com (mail-pf0-x22d.google.com. [2607:f8b0:400e:c00::22d]) by mx.google.com with ESMTPS id he9si21488392pac.102.2016.01.05.16.32.34 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Jan 2016 16:32:34 -0800 (PST) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) client-ip=2607:f8b0:400e:c00::22d; Authentication-Results: mx.google.com; spf=pass (google.com: domain of john.stultz@linaro.org designates 2607:f8b0:400e:c00::22d as permitted sender) smtp.mailfrom=john.stultz@linaro.org; dkim=pass header.i=@linaro.org Received: by mail-pf0-x22d.google.com with SMTP id 78so231371426pfw.2 for ; Tue, 05 Jan 2016 16:32:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=EpIyAPpPe8fak76DE/Ht1UYB2+owmX90jRq7zS4OvNY=; b=D4eAx9DK9TDL+Roc9AYtHiyFz05ESfIbQxt5Emyp7zdh8N//0Ey0QQ4aSa+OhC/v36 7oQlZIwGvGMpXxibNOSpw9WO6sO/GeRWGrO9YF/7evJZEuymUav35mrrSqvHC5wwoV5K 9Qm5mdgXmtjF0wwD3SCvwfMu5UXYQRyC7s0EU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=EpIyAPpPe8fak76DE/Ht1UYB2+owmX90jRq7zS4OvNY=; b=mAlhJkEKcrsBg2wQuchHgDU/upcNKTSpu8KKrn3Kwb14D8yiZZdoi2ZSJPgLHnAo4X g3u/SzltmjRVZRG8WtNPgnhp2OoxFzRjften4zquzfkUtDYHBiub2HVVSVmktCyZ3Qk2 XMIndKnZicVbdMVLqX34stFLl3jrejyO87Un4X3DEf2Tna4ZC6bsRfHPPfBEcTIOLLMM crSrH2IODk8ZA83OjuAbJkaS+N2Zz1IzOOXDxexGEzipKgtDpWmdrGpVVhaWqKBfafFL WDJtxUlXobQV1P1oHrnOpkOzWbKj7lK+KZQae4+uZS0+Z3M4StNWXZxU4RVZjr+XhzLW fOHQ== X-Gm-Message-State: ALoCoQmbtYYv1DDP+UafjWMCxGaIx7y7SU3Wa0lo0SBYq7acS1Fp6WkYbbkCd8tbjxiOSoIXNizpRLHAPwPbmt8icdWn3U4eYA== X-Received: by 10.98.18.206 with SMTP id 75mr128195499pfs.91.1452040353980; Tue, 05 Jan 2016 16:32:33 -0800 (PST) Return-Path: Received: from localhost.localdomain (c-76-115-103-22.hsd1.or.comcast.net. [76.115.103.22]) by smtp.gmail.com with ESMTPSA id l66sm130816578pfj.71.2016.01.05.16.32.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 05 Jan 2016 16:32:33 -0800 (PST) From: John Stultz To: dev Cc: John Stultz , Rob Herring , Arnd Bergmann , Haojian Zhuang , Guodong Xu , Vishal Bhoj Subject: [RFC][PATCH] hikey: Add pstore platform driver for HiKey board Date: Tue, 5 Jan 2016 16:32:28 -0800 Message-Id: <1452040348-32307-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 Adds a platform driver to support pstore on HiKey (copied from the in-kernel ChromeOS driver). Also adds reservation in the hikey DTS and enables the feature in hikey_defconfig. Note: Unfortunately the ramoops DT driver never made it upstream, so I'm adding this via a platform driver. Would appreciate thoughts on how to best handle this. Cc: Rob Herring Cc: Arnd Bergmann Cc: Haojian Zhuang Cc: Guodong Xu Cc: Vishal Bhoj Signed-off-by: John Stultz --- arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts | 5 +++ arch/arm64/configs/hikey_defconfig | 9 +++++ drivers/platform/Kconfig | 2 ++ drivers/platform/Makefile | 1 + drivers/platform/hikey/Kconfig | 27 +++++++++++++++ drivers/platform/hikey/Makefile | 2 ++ drivers/platform/hikey/hikey_pstore.c | 47 ++++++++++++++++++++++++++ 7 files changed, 93 insertions(+) create mode 100644 drivers/platform/hikey/Kconfig create mode 100644 drivers/platform/hikey/Makefile create mode 100644 drivers/platform/hikey/hikey_pstore.c -- 1.9.1 diff --git a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts index f0cd5fa..a94f955 100644 --- a/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts +++ b/arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts @@ -61,6 +61,11 @@ no-map; reg = <0x0 0x06dff000 0x0 0x00001000>; /* Mailbox message buf */ }; + + pstore@0x21f00000 { + no-map; + reg = <0x0 0x21f00000 0x0 0x00100000>; /* pstore/ramoops buffer */ + }; }; reboot_reason: reboot-reason@05f01000 { diff --git a/arch/arm64/configs/hikey_defconfig b/arch/arm64/configs/hikey_defconfig index e3cd02d..5313620 100644 --- a/arch/arm64/configs/hikey_defconfig +++ b/arch/arm64/configs/hikey_defconfig @@ -345,6 +345,8 @@ CONFIG_ANDROID_LOW_MEMORY_KILLER=y CONFIG_SYNC=y CONFIG_ION=y CONFIG_ION_HISI=y +CONFIG_HIKEY_PLATFORM=y +CONFIG_HIKEY_PSTORE=y CONFIG_MAILBOX=y CONFIG_HISI_MBOX=y CONFIG_HI6220_MBOX=y @@ -354,6 +356,7 @@ CONFIG_ANDROID=y CONFIG_ANDROID_BINDER_IPC=y CONFIG_REBOOT_REASON_SRAM=y CONFIG_EFI_VARS=y +CONFIG_EFI_VARS_PSTORE_DEFAULT_DISABLE=y CONFIG_EXT4_FS=y CONFIG_EXT4_FS_SECURITY=y CONFIG_BTRFS_FS=y @@ -371,6 +374,10 @@ CONFIG_TMPFS=y CONFIG_HUGETLBFS=y CONFIG_SQUASHFS=y CONFIG_SQUASHFS_XZ=y +CONFIG_PSTORE=y +CONFIG_PSTORE_CONSOLE=y +CONFIG_PSTORE_PMSG=y +CONFIG_PSTORE_RAM=y CONFIG_NFS_FS=y # CONFIG_NFS_V2 is not set CONFIG_NFS_V3_ACL=y @@ -385,6 +392,8 @@ CONFIG_PRINTK_TIME=y CONFIG_DEBUG_INFO=y CONFIG_MAGIC_SYSRQ=y CONFIG_LOCKUP_DETECTOR=y +CONFIG_PANIC_ON_OOPS=y +CONFIG_PANIC_TIMEOUT=10 # CONFIG_SCHED_DEBUG is not set CONFIG_SCHEDSTATS=y CONFIG_TIMER_STATS=y diff --git a/drivers/platform/Kconfig b/drivers/platform/Kconfig index 5bd93a2..881c62b 100644 --- a/drivers/platform/Kconfig +++ b/drivers/platform/Kconfig @@ -7,3 +7,5 @@ endif source "drivers/platform/goldfish/Kconfig" source "drivers/platform/chrome/Kconfig" + +source "drivers/platform/hikey/Kconfig" diff --git a/drivers/platform/Makefile b/drivers/platform/Makefile index ca26925..b0e7286 100644 --- a/drivers/platform/Makefile +++ b/drivers/platform/Makefile @@ -7,3 +7,4 @@ obj-$(CONFIG_MIPS) += mips/ obj-$(CONFIG_OLPC) += olpc/ obj-$(CONFIG_GOLDFISH) += goldfish/ obj-$(CONFIG_CHROME_PLATFORMS) += chrome/ +obj-$(CONFIG_HIKEY_PLATFORM) += hikey/ diff --git a/drivers/platform/hikey/Kconfig b/drivers/platform/hikey/Kconfig new file mode 100644 index 0000000..5b36bba --- /dev/null +++ b/drivers/platform/hikey/Kconfig @@ -0,0 +1,27 @@ +# +# Platform support for Chrome OS hardware (Chromebooks and Chromeboxes) +# + +menuconfig HIKEY_PLATFORM + bool "Platform support for HiKey hardware" + depends on ARM64 + ---help--- + Say Y here to get to see options for platform support for + the HiKey board. This option alone does not add any kernel code. + + If you say N, all options in this submenu will be skipped and disabled. + +if HIKEY_PLATFORM + +config HIKEY_PSTORE + tristate "HiKey pstore support" + depends on ARM64 + ---help--- + This module instantiates the persistent storage on Hikey + devices. It can be used to store away console logs and crash + information across reboots. + + If you have a HiKey board, choose Y or M here. + The module will be called hikey_pstore. + +endif # HIKEY_PLATFORM diff --git a/drivers/platform/hikey/Makefile b/drivers/platform/hikey/Makefile new file mode 100644 index 0000000..7ab9173 --- /dev/null +++ b/drivers/platform/hikey/Makefile @@ -0,0 +1,2 @@ + +obj-$(CONFIG_HIKEY_PSTORE) += hikey_pstore.o diff --git a/drivers/platform/hikey/hikey_pstore.c b/drivers/platform/hikey/hikey_pstore.c new file mode 100644 index 0000000..1ab218b --- /dev/null +++ b/drivers/platform/hikey/hikey_pstore.c @@ -0,0 +1,47 @@ +/* + * hikey.c - Driver to instantiate HiKey ramoops device + * (Copied from ChromeOS ramoops implementation) + * + * Copyright (C) 2013 Google, Inc. + * Copyright (C) 2016 Linaro Limited + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 2 of the License. + */ + +#include +#include +#include + +static struct ramoops_platform_data hikey_ramoops_data = { + .mem_size = 0x00100000, + .mem_address = 0x21f00000, + .record_size = 0x20000, + .console_size = 0x20000, + .ftrace_size = 0x20000, + .dump_oops = 1, +}; + +static struct platform_device hikey_ramoops = { + .name = "ramoops", + .dev = { + .platform_data = &hikey_ramoops_data, + }, +}; + +static int __init hikey_pstore_init(void) +{ + return platform_device_register(&hikey_ramoops); +} + +static void __exit hikey_pstore_exit(void) +{ + platform_device_unregister(&hikey_ramoops); +} + +module_init(hikey_pstore_init); +module_exit(hikey_pstore_exit); + +MODULE_DESCRIPTION("HiKey pstore module"); +MODULE_LICENSE("GPL");