Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1050037ybg; Wed, 23 Oct 2019 09:37:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwc+tTe3VNdJUn+gwRDhVDKoy2iGE6xIWgBc758h8pSKd+eZlgdqlQARbN0l1/mr8Cmj7fc X-Received: by 2002:a50:cb85:: with SMTP id k5mr38299119edi.131.1571848623771; Wed, 23 Oct 2019 09:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571848623; cv=none; d=google.com; s=arc-20160816; b=uaiXXzCzvN3AZ81UfDdV/PJfNxc9tCOnLdqiCCfpYj7eYoe+HFx+rgDXY26w/8PHQ2 iw2QeEbpjzEDCAIbWWkJhAKOjYVmxMzvZ8ZDl7V7xyJm4FHROaGmBJgkJFi+y0weNZ/O h3YzBVwLJeA5pbkoLRHm/ayF2ogFVOV3HQy07R6lYIUBoN+bFC92lmsOtQ/P2i+j1LTo RWKbVcb3JbltkQP/jlAtNDGFXibclfn82+2CE31S4fwECF+1CuuXHmNVF51jJhOnoYHJ Tmm4BYEgEJ2pllK5/8fQYVjt2B1g0vuLkgorZEIRHC853UzQVSRwE6kru6WskI43d0b7 eqow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=t9yscY3cldReUeJnGTW1RuCGAW8E5UxWLhXTLgxX2Pg=; b=nXjKTIyooLZ5wFsd1nZDD7eBJUqV/b3+Vn8090aNUKeMTXzamzoJWEpG7FBxPLDJhG gojU9sqahqllKoXuX3EL5fC5YNBdqt55SxE1/2+3dfOC8TmSxwh60G65UVsKQ4axcRsg UzytCLK2btfpFvMhP5gvb8pvQuGNaDadyoV4P2lhUoqyKzY+8o/AM3Sbz578iS8eY3pD EICz4zMxQ56ksNZpapkGrdbEui7D0rsGDkf/IvpCjvzQwRmR7W4XLlLCa+Lx6Gl54Rq8 Wt6iBlV5vbM15WsGXE6nwpX+2gnJYeoC6Aki2oaBVSnyTK7SMhvV0EM5Cc2Bj21ihdbc a8fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h91si16535747edd.270.2019.10.23.09.36.28; Wed, 23 Oct 2019 09:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405090AbfJWLzu (ORCPT + 99 others); Wed, 23 Oct 2019 07:55:50 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:46780 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732092AbfJWLzt (ORCPT ); Wed, 23 Oct 2019 07:55:49 -0400 Received: by mail-ed1-f68.google.com with SMTP id r18so15495124eds.13; Wed, 23 Oct 2019 04:55:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=t9yscY3cldReUeJnGTW1RuCGAW8E5UxWLhXTLgxX2Pg=; b=YCV0MfC3ngG8SFQmqgV96kDnKQds/7d0aB5eqI+WCfojF7kFT42H8RNY2GPr7QUoyT uOxGnoK6EwYkRHPofG6BNB5Ar8AR6OD4KMgKKFCPS43K95rEfx13NvDLKZRjCA+fl8gQ 7cshf5qGXjSULXsuoAb3JRy5aRQE7Rhu+8J9ZKWDbUSJ4PT3VCTQlfq+p0qo5wufPkFi ap2p7W+jeazngbvhjbeDnTqa9WIePF+JRFTEbkNMYjVQqkO4AlJezGAFVNyKARU57GbL jAm+yVbaGPj7SG/2Zkb9BKu6xwTBob6fh34J1vYFhhxHwNvmrEfqC0+LkLtP/KhDrJr7 mwHQ== X-Gm-Message-State: APjAAAX+6IayxiAB5kuZfin1o2cGK7LIxMLi9IuIqMMUdxiigo5U8Ky0 ab0OoKA91By9afDt+5nAAc0= X-Received: by 2002:a50:91f6:: with SMTP id h51mr8123336eda.99.1571831746966; Wed, 23 Oct 2019 04:55:46 -0700 (PDT) Received: from pi3 ([194.230.155.217]) by smtp.googlemail.com with ESMTPSA id i5sm739109edv.29.2019.10.23.04.55.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 23 Oct 2019 04:55:46 -0700 (PDT) Date: Wed, 23 Oct 2019 13:55:44 +0200 From: Krzysztof Kozlowski To: Arnd Bergmann Cc: Kukjin Kim , Kyungmin Park , linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Tomasz Figa , linux-kernel@vger.kernel.org Subject: Re: [PATCH 10/36] ARM: s5pv210: use private pm save/restore Message-ID: <20191023115544.GA11048@pi3> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> <20191010203043.1241612-10-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20191010203043.1241612-10-arnd@arndb.de> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 10, 2019 at 10:29:54PM +0200, Arnd Bergmann wrote: > The pm save/restore code is fairly small, so in order to > separate the s3c and s5p platforms, adding an s5p specific > copy instead of sharing it is actually easier. > > Signed-off-by: Arnd Bergmann > --- > arch/arm/mach-s5pv210/Makefile | 7 ----- > arch/arm/mach-s5pv210/pm.c | 45 ++++++++++++++++++++++++++++-- > arch/arm/mach-s5pv210/regs-clock.h | 2 +- > arch/arm/mach-s5pv210/s5pv210.c | 2 -- > arch/arm/plat-samsung/Makefile | 4 +-- > 5 files changed, 45 insertions(+), 15 deletions(-) > > diff --git a/arch/arm/mach-s5pv210/Makefile b/arch/arm/mach-s5pv210/Makefile > index e7b551e18e5c..aa0a1f091daf 100644 > --- a/arch/arm/mach-s5pv210/Makefile > +++ b/arch/arm/mach-s5pv210/Makefile > @@ -3,12 +3,5 @@ > # Copyright (c) 2010 Samsung Electronics Co., Ltd. > # http://www.samsung.com/ > > -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/arch/arm/plat-samsung/include > - > -# Core > - > obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o > - > -# machine support > - > obj-y += s5pv210.o > diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c > index efdb5a27c060..d59c094cdea8 100644 > --- a/arch/arm/mach-s5pv210/pm.c > +++ b/arch/arm/mach-s5pv210/pm.c > @@ -13,15 +13,56 @@ > #include > #include > #include > +#include > > #include > #include > > -#include > - > #include "common.h" > #include "regs-clock.h" > > +/* helper functions to save and restore register state */ > +struct sleep_save { > + void __iomem *reg; > + unsigned long val; > +}; > + > +#define SAVE_ITEM(x) \ > + { .reg = (x) } > + > +/** > + * s3c_pm_do_save() - save a set of registers for restoration on resume. > + * @ptr: Pointer to an array of registers. > + * @count: Size of the ptr array. > + * > + * Run through the list of registers given, saving their contents in the > + * array for later restoration when we wakeup. > + */ > +static void s3c_pm_do_save(struct sleep_save *ptr, int count) > +{ > + for (; count > 0; count--, ptr++) { > + ptr->val = readl_relaxed(ptr->reg); > + S3C_PMDBG("saved %p value %08lx\n", ptr->reg, ptr->val); > + } > +} > + > +/** > + * s3c_pm_do_restore() - restore register values from the save list. > + * @ptr: Pointer to an array of registers. > + * @count: Size of the ptr array. > + * > + * Restore the register values saved from s3c_pm_do_save(). > + * > + * WARNING: Do not put any debug in here that may effect memory or use > + * peripherals, as things may be changing! > +*/ > + > +static void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count) > +{ > + for (; count > 0; count--, ptr++) > + writel_relaxed(ptr->val, ptr->reg); > +} > + > static struct sleep_save s5pv210_core_save[] = { > /* Clock ETC */ > SAVE_ITEM(S5P_MDNIE_SEL), > diff --git a/arch/arm/mach-s5pv210/regs-clock.h b/arch/arm/mach-s5pv210/regs-clock.h > index 2a35c831a9b0..8c7530614e37 100644 > --- a/arch/arm/mach-s5pv210/regs-clock.h > +++ b/arch/arm/mach-s5pv210/regs-clock.h > @@ -9,7 +9,7 @@ > #ifndef __ASM_ARCH_REGS_CLOCK_H > #define __ASM_ARCH_REGS_CLOCK_H __FILE__ > > -#include > +#define S3C_VA_SYS ((void __iomem __force *)0xF6100000) The same as for one of earlier patches - I prefer to keep the S3C_ADDR() macro for consistency. > > #define S5P_CLKREG(x) (S3C_VA_SYS + (x)) > > diff --git a/arch/arm/mach-s5pv210/s5pv210.c b/arch/arm/mach-s5pv210/s5pv210.c > index 868f9c20419d..a21ed3bb992a 100644 > --- a/arch/arm/mach-s5pv210/s5pv210.c > +++ b/arch/arm/mach-s5pv210/s5pv210.c > @@ -13,8 +13,6 @@ > #include > #include > > -#include > - > #include "common.h" > #include "regs-clock.h" > > diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile > index d88b9b84f3a9..025ce22876c1 100644 > --- a/arch/arm/plat-samsung/Makefile > +++ b/arch/arm/plat-samsung/Makefile > @@ -24,9 +24,7 @@ obj-$(CONFIG_GPIO_SAMSUNG) += gpio-samsung.o > > # PM support > > -obj-$(CONFIG_PM_SLEEP) += pm-common.o > -obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm-common.o CONFIG_EXYNOS_CPU_SUSPEND looks unrelated and seems to be not needed at all. Can you remove it in separate patch? Best regards, Krzysztof > -obj-$(CONFIG_SAMSUNG_PM) += pm.o > +obj-$(CONFIG_SAMSUNG_PM) += pm.o pm-common.o > obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o > > obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o > -- > 2.20.0 >