From patchwork Thu Oct 10 20:29:46 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175848 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2797616ill; Thu, 10 Oct 2019 13:31:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqzR2O9A10EfaXS3bFITGNMY2RvZwuLxkRHKNeDDp75Tn/ODjyHq0YbvgtRS4TY7i1uoqueL X-Received: by 2002:a50:d4d7:: with SMTP id e23mr10093289edj.135.1570739474792; Thu, 10 Oct 2019 13:31:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739474; cv=none; d=google.com; s=arc-20160816; b=qcxqGU0Eg1XTuEukeU3h/vVr5PAKQcis1AyClUXac4rBN7kmuIi5hLJkbOjnOGvWap hPogQFjlpkOOzlM5s89h6TxibTmTp21alP4AImNyPTR/DeTCvsS8GpMV8PH8ULqsu43m 86qXOVN0AVhmUxvR12BnB0aFVgty2NVR8fcg5uaO8fxByQt8hrUY4bniSLXpxJhtUXuY ZP/9wj5DIYZpyBexKGEm2hO8wc+lmT4jEQYpGdR6NXVWhj31eEuPKW1Zn5F/2NxBXKVn 3e78LwVEIqeFg8T3TBjGJVUWsqAg3AJ6UvlDRFpaP4tIIPrlfVhN4c6wjJM92jeb1avD ezmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1TUSWMphgOiRgeJidfJessygke8e0S+8L4RJJEPgk/0=; b=nKMGNY3RSPdsPDGpWZWcYfoyQkgXwvBi1FwofgnowZN/kcojgm1m6P55DV6XpG9hg6 NbuWnndeVIjzPEibxnC25g6stu1dRCkGV4ksJLd2XQ1fcr49bDifJxILyKSJsBSduZzU S/iHpZRPVbeNB5F2ZRJbYftF6FzszVoqUZrnRJKn1mhyzuDQtIHMn1VS4sxegCpkccjz n8X8qmkAeVALHrhGedCj9My5YXLONuH7Evdrm6s4xadEaiGoTVCqklUHMCCXk9tRCjyn Yx0R2UfRiHFMvZ4r1Le+XMhsYVdXsurn64X1cG8U5Mbc8q3dg6O+wsZpciQySh2VZZgN 7/4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si3930360ejd.277.2019.10.10.13.31.14; Thu, 10 Oct 2019 13:31:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727365AbfJJUbO (ORCPT + 3 others); Thu, 10 Oct 2019 16:31:14 -0400 Received: from mout.kundenserver.de ([212.227.126.133]:33625 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbfJJUbN (ORCPT ); Thu, 10 Oct 2019 16:31:13 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MLAZe-1iZmX01Cba-00IFWi; Thu, 10 Oct 2019 22:31:00 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , linux-kernel@vger.kernel.org Subject: [PATCH 02/36] ARM: s3c: simplify mach/io.h Date: Thu, 10 Oct 2019 22:29:46 +0200 Message-Id: <20191010203043.1241612-2-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:0tiKXBin+zV2d6A7Bkn+koMgOjLf4/3gPok0KUKFj4mdDaZb1Ch DVIyDqx8gGg8jZN9LAt63DdUtnBWHO0wn0k38AzhTVaPnmXaAK9bcpUNb9YAyZD1MvKkOqX uWa3/J2p4PMy7/qyDGsjhnAG8Z4xWkVY+iXvu8qgF0qwT1FLBydauk+BJXoZk+bumsB1vHj 614BbmslkcUWjl9rF9zlg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:d08sluXfzGk=:gcOUeL87/3jzbCSd3lREPB VRPMtbF8PUwppjwKBZ8Zq9KU4r8wrO0QbRffGfv34yHWStyoAvPVRpSGBTfkDMvj4/UCnQUOq JwmNLOuKSDaobAd/Hn1VDsvmyJutlSZEkKdULn6MUjNHKmc9Zl9exsF9BJm7lMvgYiWwHagWN dbkdXbD4dl92Cjot6heIZnPgQc1/Eq+kS3PT4qJOuljULyOhLYlwW2ItUp78STo6Pj26NcaG9 bVJuQZmoZmALP3HwQPOFbCOIq7QsSM9sutbgJDEs/Ptr+1FG5NhWyuYEg/12xNPOb1B/Qxbxc k2Jfcb8oS6rRwhgvyT7lQ15VHw43/O4gPv1TsY+LKhVTrCnKUWNPBngtM/OASPLeFjMB/sUo/ uCsOlzbdxYsWJOuiMJVEKHNW+Fe2jDT4ZdaU5vqAM6UQbQyPotHcpQXWxrqjWpn40UNihd4dr YaAmBUq5QlYuCGyECpiZYCZ9lW+hGX9Y3KrXixTccvAwhIdTHIyi7bf9mECx6X3sk3PY7NpPT c90ra+gr3Oo3XJ8/gchw3IMFXkV+iyTZNBsIjhZLpptkb4z3NxrsYY/pz8oaz7pLleJOi8UVB vmQp7MkuaLQ0L2qShWdk4lvsRd0HSWizZw7nQf/DSfo5etaQi5LANEyKZoB6wzmgKsbPUF+ga g/LTT788WpLoKwZZ2+vjvcAvzv3y4DlGNmMKud0QL+XFqcLjcpUhLrLrVN7Hex64TEgEaRlGh Vcwy342h5If2+Z3GZE7OrmM5AZ9RK5PVpC3JYeg7S/P59uKjhDEw0EWBCWsaBS2MPVolM/RL9 H1aav/1fBDsU0cQa2vDGH40S0xTlFFpkCPGwkXGzdrc1bqd4AKUYCH7uOxLUgXEUcVSVLB1au hggybic8E/lSvA/iwn8A== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org s3c24xx has a custom implementation of the inb/outb family of I/O accessors, implementing both general register access and ISA I/O port through a multiplexer. As far as I can tell, the first case has never been needed, and certainly is not used now, as drivers only use inb/outb to actually driver ISA or PCI port I/O. Similarly, the special ISA support is limited to a single machine, the Simtec Electronics BAST (EB2410ITX) with its PC/104 expansion connector, all other machines could simply use the generic implementation from asm/io.h that expects a single memory-mapped address range for byte, word and dword access. As no other machines besides BAST actually selects CONFIG_ISA, this is likely not even necessary. As a cleanup, remove suport for the non-ISA access from the helpers, and make the ISA access use the virtual address window that we use elsewhere for PCI I/O ports. In configurations without the BAST machine, this now falls back on the generic implementation from asm/io.h, but the mach/io.h header is still relied on to include a number of other header files implicitly. Signed-off-by: Arnd Bergmann --- arch/arm/mach-s3c24xx/include/mach/io.h | 209 +++---------------- arch/arm/plat-samsung/include/plat/map-s3c.h | 10 +- 2 files changed, 26 insertions(+), 193 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-s3c24xx/include/mach/io.h b/arch/arm/mach-s3c24xx/include/mach/io.h index f960e6d10114..3e8bff26cdd5 100644 --- a/arch/arm/mach-s3c24xx/include/mach/io.h +++ b/arch/arm/mach-s3c24xx/include/mach/io.h @@ -12,201 +12,40 @@ #include -#define IO_SPACE_LIMIT 0xffffffff /* - * We use two different types of addressing - PC style addresses, and ARM - * addresses. PC style accesses the PC hardware with the normal PC IO - * addresses, eg 0x3f8 for serial#1. ARM addresses are above A28 - * and are translated to the start of IO. Note that all addresses are - * not shifted left! + * ISA style IO, for each machine to sort out mappings for, + * if it implements it. We reserve two 16M regions for ISA, + * so the PC/104 can use separate addresses for 8-bit and + * 16-bit port I/O. */ +#define PCIO_BASE S3C_ADDR(0x02000000) +#define IO_SPACE_LIMIT 0x00ffffff +#define S3C24XX_VA_ISA_WORD (PCIO_BASE) +#define S3C24XX_VA_ISA_BYTE (PCIO_BASE + 0x01000000) -#define __PORT_PCIO(x) ((x) < (1<<28)) +#ifdef CONFIG_ISA -#define PCIO_BASE (S3C24XX_VA_ISA_WORD) -#define PCIO_BASE_b (S3C24XX_VA_ISA_BYTE) -#define PCIO_BASE_w (S3C24XX_VA_ISA_WORD) -#define PCIO_BASE_l (S3C24XX_VA_ISA_WORD) -/* - * Dynamic IO functions - let the compiler - * optimize the expressions - */ - -#define DECLARE_DYN_OUT(sz,fnsuffix,instr) \ -static inline void __out##fnsuffix (unsigned int val, unsigned int port) \ -{ \ - unsigned long temp; \ - __asm__ __volatile__( \ - "cmp %2, #(1<<28)\n\t" \ - "mov %0, %2\n\t" \ - "addcc %0, %0, %3\n\t" \ - "str" instr " %1, [%0, #0 ] @ out" #fnsuffix \ - : "=&r" (temp) \ - : "r" (val), "r" (port), "Ir" (PCIO_BASE_##fnsuffix) \ - : "cc"); \ -} - - -#define DECLARE_DYN_IN(sz,fnsuffix,instr) \ -static inline unsigned sz __in##fnsuffix (unsigned int port) \ -{ \ - unsigned long temp, value; \ - __asm__ __volatile__( \ - "cmp %2, #(1<<28)\n\t" \ - "mov %0, %2\n\t" \ - "addcc %0, %0, %3\n\t" \ - "ldr" instr " %1, [%0, #0 ] @ in" #fnsuffix \ - : "=&r" (temp), "=r" (value) \ - : "r" (port), "Ir" (PCIO_BASE_##fnsuffix) \ - : "cc"); \ - return (unsigned sz)value; \ -} +#define inb(p) readb(S3C24XX_VA_ISA_BYTE + (p)) +#define inw(p) readw(S3C24XX_VA_ISA_WORD + (p)) +#define inl(p) readl(S3C24XX_VA_ISA_WORD + (p)) -static inline void __iomem *__ioaddr (unsigned long port) -{ - return __PORT_PCIO(port) ? (PCIO_BASE + port) : (void __iomem *)port; -} +#define outb(v,p) writeb((v), S3C24XX_VA_ISA_BYTE + (p)) +#define outw(v,p) writew((v), S3C24XX_VA_ISA_WORD + (p)) +#define outl(v,p) writel((v), S3C24XX_VA_ISA_WORD + (p)) -#define DECLARE_IO(sz,fnsuffix,instr) \ - DECLARE_DYN_IN(sz,fnsuffix,instr) \ - DECLARE_DYN_OUT(sz,fnsuffix,instr) +#define insb(p,d,l) readsb(S3C24XX_VA_ISA_BYTE + (p),d,l) +#define insw(p,d,l) readsw(S3C24XX_VA_ISA_WORD + (p),d,l) +#define insl(p,d,l) readsl(S3C24XX_VA_ISA_WORD + (p),d,l) -DECLARE_IO(char,b,"b") -DECLARE_IO(short,w,"h") -DECLARE_IO(int,l,"") +#define outsb(p,d,l) writesb(S3C24XX_VA_ISA_BYTE + (p),d,l) +#define outsw(p,d,l) writesw(S3C24XX_VA_ISA_WORD + (p),d,l) +#define outsl(p,d,l) writesl(S3C24XX_VA_ISA_WORD + (p),d,l) -#undef DECLARE_IO -#undef DECLARE_DYN_IN - -/* - * Constant address IO functions - * - * These have to be macros for the 'J' constraint to work - - * +/-4096 immediate operand. - */ -#define __outbc(value,port) \ -({ \ - if (__PORT_PCIO((port))) \ - __asm__ __volatile__( \ - "strb %0, [%1, %2] @ outbc" \ - : : "r" (value), "r" (PCIO_BASE), "Jr" ((port))); \ - else \ - __asm__ __volatile__( \ - "strb %0, [%1, #0] @ outbc" \ - : : "r" (value), "r" ((port))); \ -}) +#else -#define __inbc(port) \ -({ \ - unsigned char result; \ - if (__PORT_PCIO((port))) \ - __asm__ __volatile__( \ - "ldrb %0, [%1, %2] @ inbc" \ - : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ - else \ - __asm__ __volatile__( \ - "ldrb %0, [%1, #0] @ inbc" \ - : "=r" (result) : "r" ((port))); \ - result; \ -}) +#define __io(x) (PCIO_BASE + (x)) -#define __outwc(value,port) \ -({ \ - unsigned long v = value; \ - if (__PORT_PCIO((port))) { \ - if ((port) < 256 && (port) > -256) \ - __asm__ __volatile__( \ - "strh %0, [%1, %2] @ outwc" \ - : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ - else if ((port) > 0) \ - __asm__ __volatile__( \ - "strh %0, [%1, %2] @ outwc" \ - : : "r" (v), \ - "r" (PCIO_BASE + ((port) & ~0xff)), \ - "Jr" (((port) & 0xff))); \ - else \ - __asm__ __volatile__( \ - "strh %0, [%1, #0] @ outwc" \ - : : "r" (v), \ - "r" (PCIO_BASE + (port))); \ - } else \ - __asm__ __volatile__( \ - "strh %0, [%1, #0] @ outwc" \ - : : "r" (v), "r" ((port))); \ -}) - -#define __inwc(port) \ -({ \ - unsigned short result; \ - if (__PORT_PCIO((port))) { \ - if ((port) < 256 && (port) > -256 ) \ - __asm__ __volatile__( \ - "ldrh %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE), \ - "Jr" ((port))); \ - else if ((port) > 0) \ - __asm__ __volatile__( \ - "ldrh %0, [%1, %2] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE + ((port) & ~0xff)), \ - "Jr" (((port) & 0xff))); \ - else \ - __asm__ __volatile__( \ - "ldrh %0, [%1, #0] @ inwc" \ - : "=r" (result) \ - : "r" (PCIO_BASE + ((port)))); \ - } else \ - __asm__ __volatile__( \ - "ldrh %0, [%1, #0] @ inwc" \ - : "=r" (result) : "r" ((port))); \ - result; \ -}) - -#define __outlc(value,port) \ -({ \ - unsigned long v = value; \ - if (__PORT_PCIO((port))) \ - __asm__ __volatile__( \ - "str %0, [%1, %2] @ outlc" \ - : : "r" (v), "r" (PCIO_BASE), "Jr" ((port))); \ - else \ - __asm__ __volatile__( \ - "str %0, [%1, #0] @ outlc" \ - : : "r" (v), "r" ((port))); \ -}) - -#define __inlc(port) \ -({ \ - unsigned long result; \ - if (__PORT_PCIO((port))) \ - __asm__ __volatile__( \ - "ldr %0, [%1, %2] @ inlc" \ - : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port))); \ - else \ - __asm__ __volatile__( \ - "ldr %0, [%1, #0] @ inlc" \ - : "=r" (result) : "r" ((port))); \ - result; \ -}) - -#define __ioaddrc(port) ((__PORT_PCIO(port) ? PCIO_BASE + (port) : (void __iomem *)0 + (port))) - -#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p)) -#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p)) -#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p)) -#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p)) -#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) -#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) -#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) - -#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l) -#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l) -#define insl(p,d,l) __raw_readsl(__ioaddr(p),d,l) - -#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l) -#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l) -#define outsl(p,d,l) __raw_writesl(__ioaddr(p),d,l) +#endif #endif diff --git a/arch/arm/plat-samsung/include/plat/map-s3c.h b/arch/arm/plat-samsung/include/plat/map-s3c.h index 4244acbf4b65..bf247d836684 100644 --- a/arch/arm/plat-samsung/include/plat/map-s3c.h +++ b/arch/arm/plat-samsung/include/plat/map-s3c.h @@ -9,6 +9,8 @@ #ifndef __ASM_PLAT_MAP_S3C_H #define __ASM_PLAT_MAP_S3C_H __FILE__ +#include + #define S3C24XX_VA_IRQ S3C_VA_IRQ #define S3C24XX_VA_MEMCTRL S3C_VA_MEM #define S3C24XX_VA_UART S3C_VA_UART @@ -45,16 +47,8 @@ #define S3C_VA_USB_HSPHY S3C64XX_VA_USB_HSPHY -/* - * ISA style IO, for each machine to sort out mappings for, - * if it implements it. We reserve two 16M regions for ISA. - */ - #define S3C2410_ADDR(x) S3C_ADDR(x) -#define S3C24XX_VA_ISA_WORD S3C2410_ADDR(0x02000000) -#define S3C24XX_VA_ISA_BYTE S3C2410_ADDR(0x03000000) - /* deal with the registers that move under the 2412/2413 */ #if defined(CONFIG_CPU_S3C2412) From patchwork Thu Oct 10 20:29:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175849 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2798090ill; Thu, 10 Oct 2019 13:31:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxiYjX43hfE6luSLX+ON3JeK+V/sosIqriAgCaSpmI7hpNRVf7x/6ltZWeOetE8LoQbNqJ X-Received: by 2002:a17:906:300a:: with SMTP id 10mr10243191ejz.104.1570739503749; Thu, 10 Oct 2019 13:31:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739503; cv=none; d=google.com; s=arc-20160816; b=UtlfxpnSSW8Im2+a8K7Yx5dwMAC9Tj97Jb7SsSa01Fjgj3eW8t64odaTyr7BAjCPwW pN1RMmZ5sHZNA6SlvzyQkH5eCP3fBmW2dpZJfEouQwlHmBpFhJJ5n8YgfECan/z4S9b6 0Yvl88sR53e5jJATaXzJnfF9pQ04ZJk4H9YfF5TbSWzQ8g0kOvqpgb4EHhxJ04u8qVMb FgeCttmRCDOFav60+06HgL5YRAitkq3R2pLoVhyHNgx9kgVAXrEyyUx1UnefhpVN7bpg UgXADB7sneQeStrnJ+9O0TKxHt/tlvoqfRmEs9gZoNZWJrTYwoCGozvesKrSf7GMPqPH MXBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=W30pt+04YkImlP4r0/qEaxkVYbg2IRp2rLns0XoGsXA=; b=wR8s4KOw4epoxYinSdK1jUdO9YExVmNZcVh85dddxFJw0ORSZCeZrLWJLbzwojEkrk Dno3zsZsANQivhNOAJ7yWYeOpYa7+Sk2ivI20Fil8QpnO4jG1X+vfJ9fhS+V8byg4ihy UPP1DJXZm2mrFG0XtL2vswGic2aYgw9LzqZSCO9eAxksqBN53azFh/cVq6GwO7AkXB7E cLXQJkSHegQxg/CtgrUoHxJdPeIzRCk0sETCcQ/ns9mxwiqwfF15OXPJrlBF27ITVerf tBXcxugrX4QXUiMrVSZ684Axl6HwA6LJKvIEKPw2Gg2AEtLiXGTlJg3VuqA4AzeL6EVS /6yQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si3930360ejd.277.2019.10.10.13.31.43; Thu, 10 Oct 2019 13:31:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbfJJUbn (ORCPT + 3 others); Thu, 10 Oct 2019 16:31:43 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:37625 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726666AbfJJUbm (ORCPT ); Thu, 10 Oct 2019 16:31:42 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MS1G7-1ig9Fo3Vvv-00TYCf; Thu, 10 Oct 2019 22:31:31 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Felipe Balbi , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 03/36] usb: gadget: s3c: use platform resources Date: Thu, 10 Oct 2019 22:29:47 +0200 Message-Id: <20191010203043.1241612-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:iwNwd1cVxFxCrms7c8C5XzuQmcy9u/dn0xzTwy3RMzXW1HxHseW IktW/Os21uQmVtkwkRfdK8qY77KGxRXzPq9asnOccmpMKGioJurl5rwTvNROCMQ0hv7uHM1 5n3b0f1Gq1uQp5GkmFlZaHhavVkQl4zYOZ06/7iFrVU7yhx4YAWQB741n54+opUgSOKqapx Uqd7p7XE5W4DODvUhpdkg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:/KCtwZvm948=:MjTG6wQH6Bxkes8aciFuXb wupIQgdWQkr5jGLLinWtBtmLJ2v2beVp77GUTiiOxUYG6E8z5XEN47Fg5bXASQZeY78NP+X28 cuF+YJlcr9ywwhZamJFnQv8guj15mlGyx1EHNB+ZC5Dj2ob/Lmh+lo4+vK61tQsonzDlO0DvC qs7fRaIZeBcRWlPX75oaPOBrcGGoQN8+CTB7LemcVNUxkBUFKLtSB+OU+d1hbjT1vRgsXztYw GN7CJbrxCk4nLJ9+XwC4en0QBzhQ2Dl/wlyO1vRAVjPE8W/OS4SJSXNW8Nym8gE+PNpJwveDb qhbuXxK65AEu9ev0p6t4voIPYRdP2yo8g/comURhSF+9CpGPrxsoPb0TlD2JvRt6IgPxxTV83 3SlyGem/ISFtWbADtVkvTPwGxi6UPb33hVZF4A0XJfGRDrTOQ/+DOm1AfByNGebaPk++ZU4Ea LimmQYfyqNq4cxGUFua7x3Wx6PyPUhyyAJgJsJYu64uyDP3Hl/eLjV5kQ6nu/Wb6A+5oUkzXA Jl8FyQRkuwZP6zKUZC6moi3BtS6nOUpVieam8Xjao9HN5Fn7/t/Gs0o6aUoKhUGuGKBR19A9q n8kEG8c5zJJ36ptDqdr7XBFzFsvhSipybIw44e+YZZmojMFTusmcexy17QfjG4fTYnpR9ipCG taBNgRpoSESiUXenE+9ZFSjQ0sV8YLIR4wOs9Ml/wWbVND+oPHTEEzInk/73Av+ppsgtPa9fw 2U1M7pDIYSarTkneuXbiBHGIDID1b+Vh+9srUMkHEz3IRWIdD2QoiHZkuwi882ECwm4/w5Ny/ a2RxIEEXJ+5AVS9XPQh5C3rdadtoJUIwQdrPPcQKEhJB8OoJzkEwYN8XmML3GnFjITtOZzc0Y 2akHoI5CkL2+FlbMBIpQ== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The resources are correctly initialized, so just use them instead of relying on hardcoded data from platform headers. Signed-off-by: Arnd Bergmann --- drivers/usb/gadget/udc/s3c2410_udc.c | 31 +++++++------------ drivers/usb/gadget/udc/s3c2410_udc.h | 1 + .../usb/gadget/udc/s3c2410_udc_regs.h | 0 3 files changed, 12 insertions(+), 20 deletions(-) rename arch/arm/plat-samsung/include/plat/regs-udc.h => drivers/usb/gadget/udc/s3c2410_udc_regs.h (100%) -- 2.20.0 Acked-by: Krzysztof Kozlowski diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index f82208fbc249..e411d27b79fc 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -36,15 +36,11 @@ #include #include #include -#include -#include - -#include #include - #include "s3c2410_udc.h" +#include "s3c2410_udc_regs.h" #define DRIVER_DESC "S3C2410 USB Device Controller Gadget" #define DRIVER_AUTHOR "Herbert Pƶtzl , " \ @@ -57,6 +53,7 @@ static struct s3c2410_udc *the_controller; static struct clk *udc_clock; static struct clk *usb_bus_clock; static void __iomem *base_addr; +static int irq_usbd; static u64 rsrc_start; static u64 rsrc_len; static struct dentry *s3c2410_udc_debugfs_root; @@ -839,8 +836,6 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep) } } -#include - /* * s3c2410_udc_irq - interrupt handler */ @@ -981,7 +976,7 @@ static irqreturn_t s3c2410_udc_irq(int dummy, void *_dev) } } - dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", IRQ_USBD); + dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", irq_usbd); /* Restore old index */ udc_write(idx, S3C2410_UDC_INDEX_REG); @@ -1784,13 +1779,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) spin_lock_init(&udc->lock); udc_info = dev_get_platdata(&pdev->dev); - rsrc_start = S3C2410_PA_USBDEV; - rsrc_len = S3C24XX_SZ_USBDEV; - - if (!request_mem_region(rsrc_start, rsrc_len, gadget_name)) - return -EBUSY; - - base_addr = ioremap(rsrc_start, rsrc_len); + base_addr = devm_platform_ioremap_resource(pdev, 0); if (!base_addr) { retval = -ENOMEM; goto err_mem; @@ -1802,17 +1791,19 @@ static int s3c2410_udc_probe(struct platform_device *pdev) s3c2410_udc_disable(udc); s3c2410_udc_reinit(udc); + irq_usbd = platform_get_irq(pdev, 0); + /* irq setup after old hardware state is cleaned up */ - retval = request_irq(IRQ_USBD, s3c2410_udc_irq, + retval = request_irq(irq_usbd, s3c2410_udc_irq, 0, gadget_name, udc); if (retval != 0) { - dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval); + dev_err(dev, "cannot get irq %i, err %d\n", irq_usbd, retval); retval = -EBUSY; goto err_map; } - dev_dbg(dev, "got irq %i\n", IRQ_USBD); + dev_dbg(dev, "got irq %i\n", irq_usbd); if (udc_info && udc_info->vbus_pin > 0) { retval = gpio_request(udc_info->vbus_pin, "udc vbus"); @@ -1879,7 +1870,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) if (udc_info && udc_info->vbus_pin > 0) gpio_free(udc_info->vbus_pin); err_int: - free_irq(IRQ_USBD, udc); + free_irq(irq_usbd, udc); err_map: iounmap(base_addr); err_mem: @@ -1913,7 +1904,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev) free_irq(irq, udc); } - free_irq(IRQ_USBD, udc); + free_irq(irq_usbd, udc); iounmap(base_addr); release_mem_region(rsrc_start, rsrc_len); diff --git a/drivers/usb/gadget/udc/s3c2410_udc.h b/drivers/usb/gadget/udc/s3c2410_udc.h index bdcaa8dd300f..68bdf3e5aac2 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.h +++ b/drivers/usb/gadget/udc/s3c2410_udc.h @@ -90,6 +90,7 @@ struct s3c2410_udc { unsigned req_pending : 1; u8 vbus; struct dentry *regs_info; + int irq; }; #define to_s3c2410(g) (container_of((g), struct s3c2410_udc, gadget)) diff --git a/arch/arm/plat-samsung/include/plat/regs-udc.h b/drivers/usb/gadget/udc/s3c2410_udc_regs.h similarity index 100% rename from arch/arm/plat-samsung/include/plat/regs-udc.h rename to drivers/usb/gadget/udc/s3c2410_udc_regs.h From patchwork Thu Oct 10 20:29:48 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175850 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2798493ill; Thu, 10 Oct 2019 13:32:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqy8Pn1bC+bLIs5sOQm2JTyYF3UYDdJjkuC/OafVS0ZCnr4MP4BJtl4l7q367PD316BdE2jN X-Received: by 2002:a50:f384:: with SMTP id g4mr9919096edm.282.1570739528975; Thu, 10 Oct 2019 13:32:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739528; cv=none; d=google.com; s=arc-20160816; b=hYkiK1WjGDFQDEgi6VBokQZphd5TdDMGkcAqP4JuTKgvzZjx8bK4E9FrQNx9QyDeaI RkkyRLPtyKNWzgtdT+bN9qNKbMPz9E0GHGB88v/Bo2blrTUERAVb/2yOi345BQ9ADNzN 8NrKd62HRqPURV6R1NCSDyq+m19dcL+9QsfazR66N133nysYjTDKW7AgacFqmG0gJcDf f4omN1SZ0b+8vGkZop49luISzN8SO62OU/rARIcBO9+tEHWC5HYDrxvauqouoKQx4Th1 GDgscA+Dt/dwBh1uOBQsp8yKUj1cyZ4mgRyKETq+thQJzVWn4rpEh9sDRfHtnaO95DC2 GNog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=l4B3SkZF1VM5aH2pOiKbS8Oi2xpXAbHZXpAECL7JwYI=; b=DGb1jq52LgQGScjgLkHr80LkafYQ7/CrjhNmnPcnhRsVYxZqgFjTdphvwfhrKsInTj YdSqdVJTnvQ5yi1HDY1mD2EV8HAxk5a+9IIgd6OTtXMMFAGe84Cyq2knIYxwrp/jQtJp b098FNAerEwyBgI1USLobNz16ECq3jSAgwe3tzsNGFsNZMLtNYYSageEi/yMEIBlDf5E 933YqSFn/rRvXOBHEDO6015xGmpPXPxB4Z6n8Ct+uahKuiYR3NLRVMlbKx/S0mWBTRQk D4kvVE3SkID9zLs2VoO517RtGXnurP5vHKmF3e5U/d59ep0MeUUoa0jkHlUIMX4gK5UD MaQQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si3930360ejd.277.2019.10.10.13.32.08; Thu, 10 Oct 2019 13:32:08 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726964AbfJJUcI (ORCPT + 3 others); Thu, 10 Oct 2019 16:32:08 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:55959 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfJJUcI (ORCPT ); Thu, 10 Oct 2019 16:32:08 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1M7NaW-1iAwvS3qYe-007hQ6; Thu, 10 Oct 2019 22:31:59 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Felipe Balbi , Greg Kroah-Hartman Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org Subject: [PATCH 04/36] usb: gadget: s3c-hsudc: remove platform header dependency Date: Thu, 10 Oct 2019 22:29:48 +0200 Message-Id: <20191010203043.1241612-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:gBYTvSDyXkD66KPU2oG2uSqWCzyZ+9MjOjjxZ7K1N8Jdtu5VAm9 uBzrgOaZe47hxTJxPzxfWHiIy8u8IzO8gV3LN31u/Mqjy7tZzaSLxGgnqoVKuPXVg+B9ijX 7uUylmjPbZZ8xFBX62B8oZxkFcyv1U72ayUgQ7JNqWG8QE9yRihdJHWcmaZf1EWLj6XiOa4 YePja6N9Vkc5nD00s37Cw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:Ta5J2cCemyk=:WC7a/cOxyD9j1Hsk7CU2BR c8Bcn5Ut8kEPonusAYC4tFsN8m7KP8vLaNaKNq1AiT1/Nb/mkE6wX5QsfGTLFSlP4U7aGQ5aj fb0CLfLMkKIVVbrAi4tZWR+d2JagUt8UA1qtKFQntU2ahzSdIxE0bzsoiA6jfJ4Edh9ND3oXE hItiPa5woepT9kql4/kAqrFg5Ljzjtnx+IHl8uXx2TjneZfSBrQ+AAgRJcjiDVvngJQo6Avs8 Ugz2+YFPMgRmc2AOsP2YkrwJEcmFJAfNTDbEo6TTFOFsJhKVQuJ1JI19mVOUpgzeZkIE1obwG 6I0Tmem3DvqCNBm3BE1kVa4XrNqAmeKSxBX9m0gFMq44g1pia38XPBtOXARWkuCf1sh8KaS7Z +Ywc2ZWyu4IYS6aPinB5ybTc7a/V+hzmAKc2Sl4cp+Fcd8tYe8rQ+id9A6sKt99j4Sdm5bmDh 94Zqm3uGjvegg/hM9dlScH8JxxcxD4YhXuHQZun5BaAVAQShPtiIEbPc6MIYBX1mro06iCwJQ Jlg0wQzS/u9C5DQDIUvIX8UYU+KVOZIswLRFKWQ+ESPBZaX2QSZ7szyac3KuKTyJE0XYxpLXv wgcR3MGIwhTYn1aDWI9Rxdh7lZJehyoxFUDoKlomUlZhw+lY5INuM24qrjYL/56BlSP1Raljt nHAttXZK2y03Se8Sp8QxslircyBig3045s2XS56DExqvaNJ4/6qI30UGSV21AWVo7MPOuPZao W2sW8RBcoMKKD4zaBTARDqx4/Wpnf66KuOVY4Hi2Hb6IVBJg1t7fusc0hG984/sZsToIBhbOh BhjM1YF5FJe0Bjhp+GM0oq4V3QyzcGRzbRuoTMKIbHTHTDTRXiqqu2gBRFRalsFzlwhXaJBLg gyCntWSDfESeaa0IVhqw== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org There is no real phy driver, so s3c-hsudc just pokes the registers itself. Improve this a little by making it a platform data callback like we do for gpios. There is only one board using this driver, and it's unlikely that another would be added, so this is a minimal workaround. Signed-off-by: Arnd Bergmann --- .../include/mach/regs-s3c2443-clock.h | 49 +++++++++++++++++ arch/arm/plat-samsung/devs.c | 3 + drivers/usb/gadget/udc/s3c-hsudc.c | 55 ++----------------- include/linux/platform_data/s3c-hsudc.h | 2 + 4 files changed, 58 insertions(+), 51 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h index 6bf924612b06..682759549e63 100644 --- a/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h +++ b/arch/arm/mach-s3c24xx/include/mach/regs-s3c2443-clock.h @@ -10,6 +10,8 @@ #ifndef __ASM_ARM_REGS_S3C2443_CLOCK #define __ASM_ARM_REGS_S3C2443_CLOCK +#include + #define S3C2443_CLKREG(x) ((x) + S3C24XX_VA_CLKPWR) #define S3C2443_PLLCON_MDIVSHIFT 16 @@ -184,5 +186,52 @@ s3c2443_get_epll(unsigned int pllval, unsigned int baseclk) return (unsigned int)fvco; } +static inline void s3c_hsudc_init_phy(void) +{ + u32 cfg; + + cfg = readl(S3C2443_PWRCFG) | S3C2443_PWRCFG_USBPHY; + writel(cfg, S3C2443_PWRCFG); + + cfg = readl(S3C2443_URSTCON); + cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST); + writel(cfg, S3C2443_URSTCON); + mdelay(1); + + cfg = readl(S3C2443_URSTCON); + cfg &= ~(S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST); + writel(cfg, S3C2443_URSTCON); + + cfg = readl(S3C2443_PHYCTRL); + cfg &= ~(S3C2443_PHYCTRL_CLKSEL | S3C2443_PHYCTRL_DSPORT); + cfg |= (S3C2443_PHYCTRL_EXTCLK | S3C2443_PHYCTRL_PLLSEL); + writel(cfg, S3C2443_PHYCTRL); + + cfg = readl(S3C2443_PHYPWR); + cfg &= ~(S3C2443_PHYPWR_FSUSPEND | S3C2443_PHYPWR_PLL_PWRDN | + S3C2443_PHYPWR_XO_ON | S3C2443_PHYPWR_PLL_REFCLK | + S3C2443_PHYPWR_ANALOG_PD); + cfg |= S3C2443_PHYPWR_COMMON_ON; + writel(cfg, S3C2443_PHYPWR); + + cfg = readl(S3C2443_UCLKCON); + cfg |= (S3C2443_UCLKCON_DETECT_VBUS | S3C2443_UCLKCON_FUNC_CLKEN | + S3C2443_UCLKCON_TCLKEN); + writel(cfg, S3C2443_UCLKCON); +} + +static inline void s3c_hsudc_uninit_phy(void) +{ + u32 cfg; + + cfg = readl(S3C2443_PWRCFG) & ~S3C2443_PWRCFG_USBPHY; + writel(cfg, S3C2443_PWRCFG); + + writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR); + + cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN; + writel(cfg, S3C2443_UCLKCON); +} + #endif /* __ASM_ARM_REGS_S3C2443_CLOCK */ diff --git a/arch/arm/plat-samsung/devs.c b/arch/arm/plat-samsung/devs.c index 1d1fa068d228..6e4c1cb07104 100644 --- a/arch/arm/plat-samsung/devs.c +++ b/arch/arm/plat-samsung/devs.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include @@ -1038,6 +1039,8 @@ struct platform_device s3c_device_usb_hsudc = { void __init s3c24xx_hsudc_set_platdata(struct s3c24xx_hsudc_platdata *pd) { s3c_set_platdata(pd, sizeof(*pd), &s3c_device_usb_hsudc); + pd->phy_init = s3c_hsudc_init_phy; + pd->phy_uninit = s3c_hsudc_uninit_phy; } #endif /* CONFIG_PLAT_S3C24XX */ diff --git a/drivers/usb/gadget/udc/s3c-hsudc.c b/drivers/usb/gadget/udc/s3c-hsudc.c index 858993c73442..d482cbb4bb4d 100644 --- a/drivers/usb/gadget/udc/s3c-hsudc.c +++ b/drivers/usb/gadget/udc/s3c-hsudc.c @@ -30,8 +30,6 @@ #include #include -#include - #define S3C_HSUDC_REG(x) (x) /* Non-Indexed Registers */ @@ -186,53 +184,6 @@ static inline void __orr32(void __iomem *ptr, u32 val) writel(readl(ptr) | val, ptr); } -static void s3c_hsudc_init_phy(void) -{ - u32 cfg; - - cfg = readl(S3C2443_PWRCFG) | S3C2443_PWRCFG_USBPHY; - writel(cfg, S3C2443_PWRCFG); - - cfg = readl(S3C2443_URSTCON); - cfg |= (S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST); - writel(cfg, S3C2443_URSTCON); - mdelay(1); - - cfg = readl(S3C2443_URSTCON); - cfg &= ~(S3C2443_URSTCON_FUNCRST | S3C2443_URSTCON_PHYRST); - writel(cfg, S3C2443_URSTCON); - - cfg = readl(S3C2443_PHYCTRL); - cfg &= ~(S3C2443_PHYCTRL_CLKSEL | S3C2443_PHYCTRL_DSPORT); - cfg |= (S3C2443_PHYCTRL_EXTCLK | S3C2443_PHYCTRL_PLLSEL); - writel(cfg, S3C2443_PHYCTRL); - - cfg = readl(S3C2443_PHYPWR); - cfg &= ~(S3C2443_PHYPWR_FSUSPEND | S3C2443_PHYPWR_PLL_PWRDN | - S3C2443_PHYPWR_XO_ON | S3C2443_PHYPWR_PLL_REFCLK | - S3C2443_PHYPWR_ANALOG_PD); - cfg |= S3C2443_PHYPWR_COMMON_ON; - writel(cfg, S3C2443_PHYPWR); - - cfg = readl(S3C2443_UCLKCON); - cfg |= (S3C2443_UCLKCON_DETECT_VBUS | S3C2443_UCLKCON_FUNC_CLKEN | - S3C2443_UCLKCON_TCLKEN); - writel(cfg, S3C2443_UCLKCON); -} - -static void s3c_hsudc_uninit_phy(void) -{ - u32 cfg; - - cfg = readl(S3C2443_PWRCFG) & ~S3C2443_PWRCFG_USBPHY; - writel(cfg, S3C2443_PWRCFG); - - writel(S3C2443_PHYPWR_FSUSPEND, S3C2443_PHYPWR); - - cfg = readl(S3C2443_UCLKCON) & ~S3C2443_UCLKCON_FUNC_CLKEN; - writel(cfg, S3C2443_UCLKCON); -} - /** * s3c_hsudc_complete_request - Complete a transfer request. * @hsep: Endpoint to which the request belongs. @@ -1188,7 +1139,8 @@ static int s3c_hsudc_start(struct usb_gadget *gadget, pm_runtime_get_sync(hsudc->dev); - s3c_hsudc_init_phy(); + if (hsudc->pd->phy_init) + hsudc->pd->gpio_init(); if (hsudc->pd->gpio_init) hsudc->pd->gpio_init(); @@ -1210,7 +1162,8 @@ static int s3c_hsudc_stop(struct usb_gadget *gadget) spin_lock_irqsave(&hsudc->lock, flags); hsudc->gadget.speed = USB_SPEED_UNKNOWN; - s3c_hsudc_uninit_phy(); + if (hsudc->pd->phy_uninit) + hsudc->pd->phy_uninit(); pm_runtime_put(hsudc->dev); diff --git a/include/linux/platform_data/s3c-hsudc.h b/include/linux/platform_data/s3c-hsudc.h index 4dc9b8760166..a170939832d5 100644 --- a/include/linux/platform_data/s3c-hsudc.h +++ b/include/linux/platform_data/s3c-hsudc.h @@ -26,6 +26,8 @@ struct s3c24xx_hsudc_platdata { unsigned int epnum; void (*gpio_init)(void); void (*gpio_uninit)(void); + void (*phy_init)(void); + void (*phy_uninit)(void); }; #endif /* __LINUX_USB_S3C_HSUDC_H */ From patchwork Thu Oct 10 20:29:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175851 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2799132ill; Thu, 10 Oct 2019 13:32:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqz1utcYWNsMYYvTbShUPwuED39m+spHPCD/+ICphgtLFXGuJra/EIgyhQ9ygWSFGLDRloGx X-Received: by 2002:a50:f198:: with SMTP id x24mr10617430edl.238.1570739564430; Thu, 10 Oct 2019 13:32:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739564; cv=none; d=google.com; s=arc-20160816; b=CCvm/Dk0plrmtna4rZgWqp97KjerMIhyQGb+Ns08zsFNRxSyMTuyhN8Jrcc6snv+bl Y+Jpwa0AuGYpSD45AVUZRiq52979oyE+KkzE2EBWJlIBf4H6S5gsaA39ZJv93wq+jSpI DYH6F7oOOPm/cxBCgHjLcMhC+eVYhbSt3UDcSyurGu/EcPjM5+heg4/N/OLb2qvr5RXZ /zMnei1iZtpd+cL/qvOoGDL+i08OeUexmRUw4W9s1Lv23mjYhDqfRAYV08g2KHSH9Uk1 pgcHleLnp/Wp6HOsDKr+NmHRlpod9YL+cTFTnGfCFT9LebYs6Qe9YyRtVdCPWX0PNdp1 eKGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k3LlXyPAoLctS8FFW/QrPJqCLzKkT5k7P6f93/GOpyY=; b=WtFp4SmGk4egFG16BmflctGfiXvLzrtseDwLycUx/EGSIo8N7I95Lsi92u0wN85R3f Nh9F8FAXb+3/YVAxe0AUtWw0W1TWIBqZ7MAAQ+cxhkJlh7JP7BiujcyvvEyaqavj7nXY mdVyykh6pbEoWbUdiyTlGeCw8DJjAhrBdMa6+4aikgymedBii39udeXB/6wqrN+2y21X PtJG/iqf/gHB1TBeK+XZhbS/996tl1+wIAv6v4debVCsAH5Ms2ImUltyDpCi1p8vyRh8 O/uQeUIDDFBD1qcv/fNqcEaV1IYV0GiSV81bLqPGiIAGyRuwA693Fv9YCh6AtXyKJ8FY Do2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si3930360ejd.277.2019.10.10.13.32.44; Thu, 10 Oct 2019 13:32:44 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726205AbfJJUcn (ORCPT + 3 others); Thu, 10 Oct 2019 16:32:43 -0400 Received: from mout.kundenserver.de ([212.227.126.135]:51659 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfJJUcn (ORCPT ); Thu, 10 Oct 2019 16:32:43 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MavF5-1hgJQJ1Ubb-00cNsH; Thu, 10 Oct 2019 22:32:32 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Kyungmin Park Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Tomasz Figa , linux-kernel@vger.kernel.org Subject: [PATCH 05/36] ARM: samsung: make pm-debug platform independent Date: Thu, 10 Oct 2019 22:29:49 +0200 Message-Id: <20191010203043.1241612-5-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:tGjURh4yGInmeNo6DND3ebYdG/ni/aA/4KvW+48OCo2638uGl5x aRBbA1sQGQBdoGX6VIrs3W/Pab4eodoVviNeBCdbu4mmYUNqu2cReI05z5VODE5n+eNz9Jp NO1c/BsXmaqNGyaFY2ih1TSb2h8RSTjW2qRcaFdkUGmVUyO/YMJIfjC2Miwyt51Vp8vb1eu xrsXiyAj0MYCPsfJJmGDA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:f38de1Zb/nI=:St8cgUimk58V544mSRbo7L +6YzM9SmzZnxrsswusZx56XH4RfSzKFaSHrMpg68tkGlKDXCm7hsRPr1OSrYzEtfs9TP3DVpB qxz73IM3RhGbPDTy/QlRR1UiGtmyVWNtQ60oz3GRBHLKxBrOssRztfFdXFffMQ79YukX1Wivw QCqzrWvM00Z0nGI35B0XNxwPDy7lHvzktLQnN8FKd+00+DdaF02ZG0OUlaefsErAYA3uKei/M 6Y2Teq1ZjlUBVe+/iM1rBlvZBGZLcL0RE3zWkuwn+Xj7+pJuce0fIw74z0cY09F6hUW7D+UCg YnwHIyBj+nWCLyK5eZk8a3HqVzYpICFsgg5LASbVzXAMYAVzBXnSXFgkJ69lQFtezpJxX4rn9 9IzheyVP4PCa4vzxurnyM8XRbrYqLYLZnp/0Q+0w9+ETVDelrmaYdlfXtKTxnY383I0d/CKzU IEFNQCnU1oqUqhT94js1Pxv3+qa3XHrnXTRpnipJCkxqEImbuwetPtNypWuMDVD8+zuu3iTTj Sm89rp/QjQqnubgeVp49LQisVkqXLOOQJ1+8Xl1qAYk81OXFm1Wu6w2X5uVVLjWOCLj5bzfbU qyyRS/NvoEx3nvS17ae9eNBqeGCCNhvWHaO9S5ilAnEjR8XVFzIUQqs/s9iLRjrJccGdzlMSC e4iqslPGECEA5395nIlcCzptxT2028Gqfgtt27aT/ce0nvqK0ywrlSjNGwlPw50fXK58YoC3O 487/+Tkcygjgz+t8RtVoTtEse8YzOYVeo/k8UzPct28rEtYtQqZNgZSwmC3ZWAis6wR4oEj5B 5s7UWk8KA+1TeCimZ8ul1UgLUYp0R45GZ6BVIOWYJMMerx9dHN8b5+EiAlmKP7hqfnhJu8drD X6kks4sMHBTlhF46jkHA== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The pm-debug code is one of the few things shared between s3c24xx/s3c64xx and the newer s5pv210. In order to make s5pv210 independent of plat-samsung, change the common bits of this code to no longer reference the s3c specific bits. Signed-off-by: Arnd Bergmann --- arch/arm/mach-s3c24xx/include/mach/pm-core.h | 7 +-- arch/arm/mach-s3c64xx/include/mach/pm-core.h | 44 +--------------- arch/arm/mach-s3c64xx/pm.c | 50 +++++++++++++++++++ arch/arm/mach-s5pv210/pm.c | 6 +-- .../arm/plat-samsung/include/plat/pm-common.h | 29 +++++------ arch/arm/plat-samsung/pm-debug.c | 23 ++------- arch/arm/plat-samsung/pm.c | 10 ++-- 7 files changed, 80 insertions(+), 89 deletions(-) -- 2.20.0 diff --git a/arch/arm/mach-s3c24xx/include/mach/pm-core.h b/arch/arm/mach-s3c24xx/include/mach/pm-core.h index 5e4ce89d0158..8f87606c4cdc 100644 --- a/arch/arm/mach-s3c24xx/include/mach/pm-core.h +++ b/arch/arm/mach-s3c24xx/include/mach/pm-core.h @@ -15,6 +15,7 @@ static inline void s3c_pm_debug_init_uart(void) { +#ifdef CONFIG_SAMSUNG_PM_DEBUG unsigned long tmp = __raw_readl(S3C2410_CLKCON); /* re-start uart clocks */ @@ -24,6 +25,7 @@ static inline void s3c_pm_debug_init_uart(void) __raw_writel(tmp, S3C2410_CLKCON); udelay(10); +#endif } static inline void s3c_pm_arch_prepare_irqs(void) @@ -75,11 +77,6 @@ static inline void s3c_pm_arch_show_resume_irqs(void) s3c_irqwake_eintmask); } -static inline void s3c_pm_arch_update_uart(void __iomem *regs, - struct pm_uart_save *save) -{ -} - static inline void s3c_pm_restored_gpios(void) { } static inline void samsung_pm_saved_gpios(void) { } diff --git a/arch/arm/mach-s3c64xx/include/mach/pm-core.h b/arch/arm/mach-s3c64xx/include/mach/pm-core.h index bbf79ed28583..33cf242734a0 100644 --- a/arch/arm/mach-s3c64xx/include/mach/pm-core.h +++ b/arch/arm/mach-s3c64xx/include/mach/pm-core.h @@ -20,6 +20,7 @@ static inline void s3c_pm_debug_init_uart(void) { +#ifdef CONFIG_SAMSUNG_PM_DEBUG u32 tmp = __raw_readl(S3C_PCLK_GATE); /* As a note, since the S3C64XX UARTs generally have multiple @@ -35,6 +36,7 @@ static inline void s3c_pm_debug_init_uart(void) __raw_writel(tmp, S3C_PCLK_GATE); udelay(10); +#endif } static inline void s3c_pm_arch_prepare_irqs(void) @@ -63,48 +65,6 @@ static inline void s3c_pm_arch_show_resume_irqs(void) #define s3c_irqwake_intallow 0 #endif -static inline void s3c_pm_arch_update_uart(void __iomem *regs, - struct pm_uart_save *save) -{ - u32 ucon = __raw_readl(regs + S3C2410_UCON); - u32 ucon_clk = ucon & S3C6400_UCON_CLKMASK; - u32 save_clk = save->ucon & S3C6400_UCON_CLKMASK; - u32 new_ucon; - u32 delta; - - /* S3C64XX UART blocks only support level interrupts, so ensure that - * when we restore unused UART blocks we force the level interrupt - * settigs. */ - save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL; - - /* We have a constraint on changing the clock type of the UART - * between UCLKx and PCLK, so ensure that when we restore UCON - * that the CLK field is correctly modified if the bootloader - * has changed anything. - */ - if (ucon_clk != save_clk) { - new_ucon = save->ucon; - delta = ucon_clk ^ save_clk; - - /* change from UCLKx => wrong PCLK, - * either UCLK can be tested for by a bit-test - * with UCLK0 */ - if (ucon_clk & S3C6400_UCON_UCLK0 && - !(save_clk & S3C6400_UCON_UCLK0) && - delta & S3C6400_UCON_PCLK2) { - new_ucon &= ~S3C6400_UCON_UCLK0; - } else if (delta == S3C6400_UCON_PCLK2) { - /* as an precaution, don't change from - * PCLK2 => PCLK or vice-versa */ - new_ucon ^= S3C6400_UCON_PCLK2; - } - - S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n", - ucon, new_ucon, save->ucon); - save->ucon = new_ucon; - } -} - static inline void s3c_pm_restored_gpios(void) { /* ensure sleep mode has been cleared from the system */ diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c index fd6dbb263ed5..a612e9779057 100644 --- a/arch/arm/mach-s3c64xx/pm.c +++ b/arch/arm/mach-s3c64xx/pm.c @@ -305,6 +305,56 @@ static void s3c64xx_pm_prepare(void) __raw_writel(__raw_readl(S3C64XX_WAKEUP_STAT), S3C64XX_WAKEUP_STAT); } +#ifdef CONFIG_SAMSUNG_PM_DEBUG +void s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save) +{ + u32 ucon; + u32 ucon_clk + u32 save_clk; + u32 new_ucon; + u32 delta; + + if (!soc_is_s3c64xx()) + return; + + ucon = __raw_readl(regs + S3C2410_UCON); + ucon_clk = ucon & S3C6400_UCON_CLKMASK; + sav_clk = save->ucon & S3C6400_UCON_CLKMASK; + + /* S3C64XX UART blocks only support level interrupts, so ensure that + * when we restore unused UART blocks we force the level interrupt + * settigs. */ + save->ucon |= S3C2410_UCON_TXILEVEL | S3C2410_UCON_RXILEVEL; + + /* We have a constraint on changing the clock type of the UART + * between UCLKx and PCLK, so ensure that when we restore UCON + * that the CLK field is correctly modified if the bootloader + * has changed anything. + */ + if (ucon_clk != save_clk) { + new_ucon = save->ucon; + delta = ucon_clk ^ save_clk; + + /* change from UCLKx => wrong PCLK, + * either UCLK can be tested for by a bit-test + * with UCLK0 */ + if (ucon_clk & S3C6400_UCON_UCLK0 && + !(save_clk & S3C6400_UCON_UCLK0) && + delta & S3C6400_UCON_PCLK2) { + new_ucon &= ~S3C6400_UCON_UCLK0; + } else if (delta == S3C6400_UCON_PCLK2) { + /* as an precaution, don't change from + * PCLK2 => PCLK or vice-versa */ + new_ucon ^= S3C6400_UCON_PCLK2; + } + + S3C_PMDBG("ucon change %04x => %04x (save=%04x)\n", + ucon, new_ucon, save->ucon); + save->ucon = new_ucon; + } +} +#endif + int __init s3c64xx_pm_init(void) { int i; diff --git a/arch/arm/mach-s5pv210/pm.c b/arch/arm/mach-s5pv210/pm.c index b336df0c57f3..efdb5a27c060 100644 --- a/arch/arm/mach-s5pv210/pm.c +++ b/arch/arm/mach-s5pv210/pm.c @@ -99,8 +99,6 @@ static int s5pv210_suspend_enter(suspend_state_t state) u32 eint_wakeup_mask = s5pv210_read_eint_wakeup_mask(); int ret; - s3c_pm_debug_init(); - S3C_PMDBG("%s: suspending the system...\n", __func__); S3C_PMDBG("%s: wakeup masks: %08x,%08x\n", __func__, @@ -113,7 +111,7 @@ static int s5pv210_suspend_enter(suspend_state_t state) return -EINVAL; } - s3c_pm_save_uarts(); + s3c_pm_save_uarts(false); s5pv210_pm_prepare(); flush_cache_all(); s3c_pm_check_store(); @@ -122,7 +120,7 @@ static int s5pv210_suspend_enter(suspend_state_t state) if (ret) return ret; - s3c_pm_restore_uarts(); + s3c_pm_restore_uarts(false); S3C_PMDBG("%s: wakeup stat: %08x\n", __func__, __raw_readl(S5P_WAKEUP_STAT)); diff --git a/arch/arm/plat-samsung/include/plat/pm-common.h b/arch/arm/plat-samsung/include/plat/pm-common.h index 1268bae04234..87fa97fd6e8b 100644 --- a/arch/arm/plat-samsung/include/plat/pm-common.h +++ b/arch/arm/plat-samsung/include/plat/pm-common.h @@ -69,25 +69,26 @@ struct pm_uart_save { */ extern void s3c_pm_dbg(const char *msg, ...); -/** - * s3c_pm_debug_init() - suspend/resume low level debug initialization. - * @base: Virtual base of UART to use for suspend/resume debugging. - * - * This function needs to be called before S3C_PMDBG() can be used, to set up - * UART port base address and configuration. - */ -extern void s3c_pm_debug_init(void); - #define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt) -extern void s3c_pm_save_uarts(void); -extern void s3c_pm_restore_uarts(void); +extern void s3c_pm_save_uarts(bool is_s3c24xx); +extern void s3c_pm_restore_uarts(bool is_s3c24xx); + +#ifdef CONFIG_ARCH_S3C64XX +extern void s3c_pm_arch_update_uart(void __iomem *regs, + struct pm_uart_save *save); +#else +static inline void +s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save) +{ +} +#endif + #else #define S3C_PMDBG(fmt...) pr_debug(fmt) -#define s3c_pm_debug_init() do { } while (0) -static inline void s3c_pm_save_uarts(void) { } -static inline void s3c_pm_restore_uarts(void) { } +static inline void s3c_pm_save_uarts(bool is_s3c24xx) { } +static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { } #endif /* suspend memory checking */ diff --git a/arch/arm/plat-samsung/pm-debug.c b/arch/arm/plat-samsung/pm-debug.c index b76b1e9ba4ae..482d53753e93 100644 --- a/arch/arm/plat-samsung/pm-debug.c +++ b/arch/arm/plat-samsung/pm-debug.c @@ -18,15 +18,6 @@ #include #include -#ifdef CONFIG_SAMSUNG_ATAGS -#include -#include -#else -static inline void s3c_pm_debug_init_uart(void) {} -static inline void s3c_pm_arch_update_uart(void __iomem *regs, - struct pm_uart_save *save) {} -#endif - static struct pm_uart_save uart_save; extern void printascii(const char *); @@ -43,12 +34,6 @@ void s3c_pm_dbg(const char *fmt, ...) printascii(buff); } -void s3c_pm_debug_init(void) -{ - /* restart uart clocks so we can use them to output */ - s3c_pm_debug_init_uart(); -} - static inline void __iomem *s3c_pm_uart_base(void) { unsigned long paddr; @@ -59,7 +44,7 @@ static inline void __iomem *s3c_pm_uart_base(void) return (void __iomem *)vaddr; } -void s3c_pm_save_uarts(void) +void s3c_pm_save_uarts(bool is_s3c2410) { void __iomem *regs = s3c_pm_uart_base(); struct pm_uart_save *save = &uart_save; @@ -70,14 +55,14 @@ void s3c_pm_save_uarts(void) save->umcon = __raw_readl(regs + S3C2410_UMCON); save->ubrdiv = __raw_readl(regs + S3C2410_UBRDIV); - if (!soc_is_s3c2410()) + if (!is_s3c2410) save->udivslot = __raw_readl(regs + S3C2443_DIVSLOT); S3C_PMDBG("UART[%p]: ULCON=%04x, UCON=%04x, UFCON=%04x, UBRDIV=%04x\n", regs, save->ulcon, save->ucon, save->ufcon, save->ubrdiv); } -void s3c_pm_restore_uarts(void) +void s3c_pm_restore_uarts(bool is_s3c2410) { void __iomem *regs = s3c_pm_uart_base(); struct pm_uart_save *save = &uart_save; @@ -90,6 +75,6 @@ void s3c_pm_restore_uarts(void) __raw_writel(save->umcon, regs + S3C2410_UMCON); __raw_writel(save->ubrdiv, regs + S3C2410_UBRDIV); - if (!soc_is_s3c2410()) + if (!is_s3c2410) __raw_writel(save->udivslot, regs + S3C2443_DIVSLOT); } diff --git a/arch/arm/plat-samsung/pm.c b/arch/arm/plat-samsung/pm.c index d6bfd66592b0..03c22a9dee21 100644 --- a/arch/arm/plat-samsung/pm.c +++ b/arch/arm/plat-samsung/pm.c @@ -25,6 +25,7 @@ #include +#include #include #include @@ -70,8 +71,7 @@ static int s3c_pm_enter(suspend_state_t state) { int ret; /* ensure the debug is initialised (if enabled) */ - - s3c_pm_debug_init(); + s3c_pm_debug_init_uart(); S3C_PMDBG("%s(%d)\n", __func__, state); @@ -100,7 +100,7 @@ static int s3c_pm_enter(suspend_state_t state) samsung_pm_saved_gpios(); } - s3c_pm_save_uarts(); + s3c_pm_save_uarts(soc_is_s3c2410()); s3c_pm_save_core(); /* set the irq configuration for wake */ @@ -137,14 +137,14 @@ static int s3c_pm_enter(suspend_state_t state) /* restore the system state */ s3c_pm_restore_core(); - s3c_pm_restore_uarts(); + s3c_pm_restore_uarts(soc_is_s3c2410()); if (!of_have_populated_dt()) { samsung_pm_restore_gpios(); s3c_pm_restored_gpios(); } - s3c_pm_debug_init(); + s3c_pm_debug_init_uart(); /* check what irq (if any) restored the system */ From patchwork Thu Oct 10 20:29:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175852 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2799694ill; Thu, 10 Oct 2019 13:33:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZzXDvDvRlyoT+9m3cSv/ba/JdTqyEciNkUwbdtvkv2GFJkvHNpN8DN1hlnN5+HrtjcdY9 X-Received: by 2002:aa7:cd43:: with SMTP id v3mr9818892edw.235.1570739597811; Thu, 10 Oct 2019 13:33:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739597; cv=none; d=google.com; s=arc-20160816; b=tDwqkOF8Upedbx2ctYnvZ/w8+ejYillt5Xm9Jhsan/TA0L3luVyzTOn2ZIaewhOBAi 9op5jsQvpTIJ3lCgDfazrxWkEcu60I8q02KY3iHaRqLRFVbkvL/pluntr+b//A6B9LRV y1xlT69I+w9PrenI6TRlYXg+UXxNrfJ5+m/5SIKdDi7q7bgvnDUJBmSVu4fQ3d0Z6KOF hs5xsJaswvkBVp8f7/1fHn9Wa4DIRR9Im+ct8w19mgJ3UzG3aSOGrfCI5dWkGDQlDtr/ /iXu5pxiUPtWye7YTKq6WT7KZRbELdc8oynhUW2IKW+vuVEAX6ZlXCVx9OyTzgt8GH+z rM7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=HbSL4Me4MGRlW1T5dQFUaW4pNowPjqqWq1p4mwgdvlY=; b=cKJfeZpWkod1uB2y0S4ak+2tnNr0I/TfFOaHZrIJ9MHW/0j92k8f+UJuB9MpnLEiWa XJHB617saX29qvQQCLhzYshz2QhXxIcYmuCds+txRaBacsI4066W6tV7gRc701W1wWYK I0Cge/0PBqwDhAJyCHBRPub6MFR2bujj/jx4PjjN3+y1m0jQy7VOd2GzoUlxC3YqMx4m HpyMDP2P/Aunw6g2CmqCAa9VR0s1qdFAL6nNrdksaP70v7SXRwNy0b75oyHP/9o81fmj IDcF3x7cRnc/4swBUtU00YNgcMlSf/MaTniGRRRZRklRPafvajGZ9Piu5ldahsZKVY+i up+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s19si3930360ejd.277.2019.10.10.13.33.17; Thu, 10 Oct 2019 13:33:17 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726672AbfJJUdR (ORCPT + 3 others); Thu, 10 Oct 2019 16:33:17 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:35791 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfJJUdR (ORCPT ); Thu, 10 Oct 2019 16:33:17 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MzkK9-1hwIm602W9-00vgsN; Thu, 10 Oct 2019 22:33:03 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Olof Johansson , Sascha Hauer , Bartlomiej Zolnierkiewicz , linux-kernel@vger.kernel.org Subject: [PATCH 06/36] ARM: samsung: move CONFIG_DEBUG_S3C_UART to Kconfig.debug Date: Thu, 10 Oct 2019 22:29:50 +0200 Message-Id: <20191010203043.1241612-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:VmHDwku6i4VFjARXnLpCnVfD1UydvgapREzXhkJu6fdnoPO6rGu wYNUVRWspbYvsxlJp6FrcEsKsYXxN3QY10wAjgP+Q+GpOa8M78RLLLgVXBRpwKxB7nuFrT5 m8BNvREHqKlmoiI+7tmh6PYfqdVQC4WbmJm61FLBpeqopAU09S4pH+sNtF4zKqhSqS99Xk7 XETf6ONqXOzE5fohLQDsg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:syw+MREByLs=:yac/rd2RcuQULIkRgyTTBo c+o1mKThTiyRhSdrr6qj5jCq0IsmzixGLCkiNO/dhMmPRSmIurHIxL6kec769amngCLt6PbtS boTNDNG6d/rg+51TYiHYvNkNpB0s1RHaYhTRYWraq4VSjMTJMA6Av/TbF8iV/3zfiZz/OM4RM +Apn5+/gZKOPySfwFFMU2FFNHOSAf9bQHSD++6L6/lWZbXrDh+Ra+ld5OmINnwPh6XwXD2YKf YV1zXsJBhFXIpQIWLjQPfsSFamHDvGFPZcCztCwI0k4uANXziPuoPavP9ksEDWDRCRRakRPt+ 5AA5UQVfsL71mHQUSQ9S3cBwiuv9SzPab9sPtA38yIdE14y6Ui1h58DVgu9e6ou+mRo9PNpBs wPPy4TA+B9op+XSHi3IRYGL3Sk7Nm0ZGMOE1CsOS2QnjeFGTo0UA0xwNe8gj7Y51XzhzfdAfM babYDy1qVE5INVd0Xz9FiLe++3wKG9e7BBxc4yurfxzKNgpfgXpqY1freUuNn26dTaGqTnA8G g5Wdkjt0d1RwGJ7LXZ/BjTqUHKrpLOuOOmJOPfxq7q1MDAWavY84Slr8ijB3iLs9oSjwXdkDn sZYV2ne5dtJEdL4JKOvxxKOTwLAmjmzMzm9Ynx70ZSkbk4YsbjXUXGxrl5VJmluMYWF8oJwyC EkkqiGMlYoEkEzjwBk1r0uOZZKzPr0w5GntVdWskV3IjPeIF2YoJsIfKxrkz56PXYZUPS+wre RHAlhkcjD/rMh5uoHSONiLVpxb11mY9mpF4wEE675fqAHATgjm0LtjzIE9A14Phnj/Q29/PNc jcRW0KAEooAEgAm7080BbxrMJ/z7lhoQkmvda4IB4aGcM1tE6WK2ye2hiF9LCMgmwuErCohd0 SNtANEAe5rYehMohjGCQ== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Before we can plat-samsung from the individual platforms, this one has to get moved to a place where it remains accessible. Signed-off-by: Arnd Bergmann --- arch/arm/Kconfig.debug | 10 ++++++++++ arch/arm/plat-samsung/Kconfig | 8 -------- 2 files changed, 10 insertions(+), 8 deletions(-) -- 2.20.0 diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index 8bcbd0cd739b..d05b836dfeb2 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -1464,6 +1464,16 @@ config DEBUG_S3C64XX_UART config DEBUG_S5PV210_UART bool +config DEBUG_S3C_UART + depends on DEBUG_S3C2410_UART || DEBUG_S3C24XX_UART || \ + DEBUG_S3C64XX_UART || DEBUG_S5PV210_UART || \ + DEBUG_EXYNOS_UART + int + default "0" if DEBUG_S3C_UART0 + default "1" if DEBUG_S3C_UART1 + default "2" if DEBUG_S3C_UART2 + default "3" if DEBUG_S3C_UART3 + config DEBUG_OMAP2PLUS_UART bool depends on ARCH_OMAP2PLUS diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 301e572651c0..832ab0e6cd72 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig @@ -296,13 +296,5 @@ config SAMSUNG_WDT_RESET Compile support for system restart by triggering watchdog reset. Used on SoCs that do not provide dedicated reset control. -config DEBUG_S3C_UART - depends on PLAT_SAMSUNG - int - default "0" if DEBUG_S3C_UART0 - default "1" if DEBUG_S3C_UART1 - default "2" if DEBUG_S3C_UART2 - default "3" if DEBUG_S3C_UART3 - endmenu endif From patchwork Thu Oct 10 20:29:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175853 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2800371ill; Thu, 10 Oct 2019 13:33:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqznbygmpSz7yGB8oWJz27pkYyQ2oU6LqGvPNeDWTDKklKeGsUpEU/TD3IqUQyPshPV+oFb0 X-Received: by 2002:aa7:c257:: with SMTP id y23mr10096697edo.39.1570739638958; Thu, 10 Oct 2019 13:33:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739638; cv=none; d=google.com; s=arc-20160816; b=O2Mz/cgaSXPlRJxWB8Sy05KRSqXxW63oKspvO9TxMYdo4iDkGXbemyujPGgmN9K/ZH AvP5Msz5XmkCOw6+9tOVjFjOVqyOSI3kcfp7hBT0xNNpAg1YPjS+8asR8buFHhQIS9e5 Yi+4lMlbOlkwRdMieTP9cxYkNCfejQKb963nkveNkS+DS4W5S76MOR65BDliXx6GuYUC lf9ZAZzhswFpN1+el28jXF9udOnXO4CpZksl6J+ykzNFKGCqNby2cznlN94hTlaaRCiC 69VHKqTKTNU4glPj6pO2VvXvOJrKccfmElDPw8mjmqsb/NmS+hHygX8qDOuNZf1ONi+D i4Gw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MLHXVW+eMvRCSfACwauQXKxp1wL2n+rpuib7/yh1/h4=; b=OyVLep0Gl75boJCdt7DcfrkPwkhv/UzgnGyAlw0yW+58cZUXbs9Uv3/Kdlpf9aXaqY L0rKkzQAC9Cio6EYm6p1X2jirTtNrl7Fx/GxqL4cHn+VlWxgxX+JCOZhDRzmBU6pKS3Y +IkQ7iDFEtCJxci4f6SPDb8cQNe9hLDhRHLCviGKjUX9fv/NMTuXaZvky9Dvg5SeJ4N8 c0FeI6inDmiPi/auJXOMbljqHpaGrv1/Fg9Zo6xWFnT9NJrC246cOdVkwyUNV+IkHR2O lqYvKRJpI1J6+YOTOX8HeCwG1UYszd0S+cJZRDYbyss02K9UVV3QaZ4l3Okj9CsTaiI0 qNMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si4523340edd.431.2019.10.10.13.33.58; Thu, 10 Oct 2019 13:33:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbfJJUd6 (ORCPT + 3 others); Thu, 10 Oct 2019 16:33:58 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:33765 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfJJUd6 (ORCPT ); Thu, 10 Oct 2019 16:33:58 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MMH2M-1iYg741pdG-00JLSO; Thu, 10 Oct 2019 22:33:44 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Daniel Lezcano Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Tomasz Figa , Marek Szyprowski , Pankaj Dubey , linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: [PATCH 07/36] ARM: exynos: use private samsung_cpu_id copy Date: Thu, 10 Oct 2019 22:29:51 +0200 Message-Id: <20191010203043.1241612-7-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:b9MxJc22ojVV03aQI4g1hMswAIJMjso6s4GXVBlN9VbVcHoYTRb 3iyu7CbnJMT89XlWCnf8frmgACQN5evtlWJNiWG9bv1OfVvg8CWfOEUoXb37stRSawInWlj il+ob82bzA9kWe0gsTRifNAcl5Hltr5UOTzagnmvdFbza5tGwszZbH+0RLrBAEU9kKI1rhm hNIJXKtEmwVVKqI47CEkQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:fzD7h19igLg=:BKV1tvTl03vsepORG2YJDW WGR1yUsjoYM1tqLeBmQ8pfxD5vzhyBF/yBVWAdPzmQaxGmF92k4I5ENC0pZTUckTXLwJEGcAv TQkN/6B3KdXq4w9XLOny0nWJGTSzOghmwZ3jUkfR7UBNs2uHH9+A7KUJW52dSaLmXJo3VY63b lHZQsVz1ne3EMXpGbXulp9hgUhIKR+tTDaw2zUJUAfKuakc3bSNElMoKPCokVlrHN2iXFsWLL ZR/zeGWMHH6wvc9WM6HZIT8z701yt7ew9A68Y6BF3OoDw5gGNpvefztsI+Z7VBcFVS1u8GA8/ OOM9HrFuQCB+jDXKXIIwkuKPwxV5ZlDmHdO+QpIc7DHcnUJswwoGDBO5srlBbheBTC7j4mehH HO9SYGE/bzjTw2KI45pB1GFbgWH/2EEwpzdMgh0S/bc+3eg6H+tKYfBkghOKNpGG24w3D+Dit 1iTLWVF7mYHzOjqNSOktdGykKRzsHkBdADmafS3KgacIaSJdY8ClcP0A+nNCgsCdGIF03ejn5 FJtlIERVEebgwYFMQbiNtsRk/mE/J3JusTbtCkfxjbxSU3e3pFWAUlxUj89pM404Rk95JstwP kl7vqd/eXaXuL1h8CGy2bdNQiOAQjOY5kKMjH4SKZeAH3eKEGX3pRLVMEgK9LFGaKf7529Np3 Wx2WVplAQrvCw9lMAqk+l0torrBmOkXmZpd5MamLA0r/h3BQM2u8RtUQAFKsQR3+uYb56KKbd 8xWnd8fTK4CUZIvrEANU2osUQEZ42pUnAvEoQApd4tcIrNUG9nD6wZP4TWSrrr4oNIhhFyFEP q4J1ceIE/R4DEORzKFFThwuAXNL00e/0sYHXZYJ7bAYvZEdMw4ahqVH+KdI6GP6mIidhw+d3y 7i0qi3j5RNMWVeTChflg== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The only part of plat-samsung that is shared with arch-exynos is the CPU identification code. Having a separate exynos_cpu_id variable makes the two completely independent and is actually a bit less code in total. Signed-off-by: Arnd Bergmann --- arch/arm/mach-exynos/common.h | 6 +++--- arch/arm/mach-exynos/exynos.c | 19 +++++++++++++++---- arch/arm/mach-exynos/include/mach/map.h | 18 ------------------ arch/arm/mach-exynos/platsmp.c | 4 +--- arch/arm/mach-exynos/pm.c | 8 ++++---- arch/arm/plat-samsung/cpu.c | 17 ----------------- arch/arm/plat-samsung/include/plat/cpu.h | 2 -- arch/arm/plat-samsung/include/plat/map-s5p.h | 2 -- 8 files changed, 23 insertions(+), 53 deletions(-) delete mode 100644 arch/arm/mach-exynos/include/mach/map.h -- 2.20.0 diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 56411bb63d45..adf7db9c0885 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -24,12 +24,12 @@ #define EXYNOS5800_SOC_ID 0xE5422000 #define EXYNOS5_SOC_MASK 0xFFFFF000 -extern unsigned long samsung_cpu_id; +extern unsigned long exynos_cpu_id; #define IS_SAMSUNG_CPU(name, id, mask) \ static inline int is_samsung_##name(void) \ { \ - return ((samsung_cpu_id & mask) == (id & mask)); \ + return ((exynos_cpu_id & mask) == (id & mask)); \ } IS_SAMSUNG_CPU(exynos3250, EXYNOS3250_SOC_ID, EXYNOS3_SOC_MASK) @@ -147,7 +147,7 @@ extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data; extern void exynos_set_delayed_reset_assertion(bool enable); -extern unsigned int samsung_rev(void); +extern unsigned int exynos_rev(void); extern void exynos_core_restart(u32 core_id); extern int exynos_set_boot_addr(u32 core_id, unsigned long boot_addr); extern int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr); diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index 9aa483366ebc..da9300d655c6 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -19,11 +19,10 @@ #include #include -#include -#include - #include "common.h" +#define S5P_VA_CHIPID ((void __iomem __force *)0xF8000000) + static struct platform_device exynos_cpuidle = { .name = "exynos_cpuidle", #ifdef CONFIG_ARM_EXYNOS_CPUIDLE @@ -36,6 +35,14 @@ void __iomem *sysram_base_addr __ro_after_init; phys_addr_t sysram_base_phys __ro_after_init; void __iomem *sysram_ns_base_addr __ro_after_init; +unsigned long exynos_cpu_id; +static unsigned int exynos_cpu_rev; + +unsigned int exynos_rev(void) +{ + return exynos_cpu_rev; +} + void __init exynos_sysram_init(void) { struct device_node *node; @@ -86,7 +93,11 @@ static void __init exynos_init_io(void) of_scan_flat_dt(exynos_fdt_map_chipid, NULL); /* detect cpu id and rev. */ - s5p_init_cpu(S5P_VA_CHIPID); + exynos_cpu_id = readl_relaxed(S5P_VA_CHIPID); + exynos_cpu_rev = exynos_cpu_id & 0xFF; + + pr_info("Samsung CPU ID: 0x%08lx\n", exynos_cpu_id); + } /* diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h deleted file mode 100644 index 22ebe3654633..000000000000 --- a/arch/arm/mach-exynos/include/mach/map.h +++ /dev/null @@ -1,18 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* - * Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. - * http://www.samsung.com/ - * - * EXYNOS - Memory map definitions - */ - -#ifndef __ASM_ARCH_MAP_H -#define __ASM_ARCH_MAP_H __FILE__ - -#include - -#include - -#define EXYNOS_PA_CHIPID 0x10000000 - -#endif /* __ASM_ARCH_MAP_H */ diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 0cbbae8bf1f8..d7fedbb2eefe 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -22,8 +22,6 @@ #include #include -#include - #include "common.h" extern void exynos4_secondary_startup(void); @@ -188,7 +186,7 @@ void exynos_scu_enable(void) static void __iomem *cpu_boot_reg_base(void) { - if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) + if (soc_is_exynos4210() && exynos_rev() == EXYNOS4210_REV_1_1) return pmu_base_addr + S5P_INFORM5; return sysram_base_addr; } diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index 48e7fb38613e..624585641a9c 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -26,18 +26,18 @@ static inline void __iomem *exynos_boot_vector_addr(void) { - if (samsung_rev() == EXYNOS4210_REV_1_1) + if (exynos_rev() == EXYNOS4210_REV_1_1) return pmu_base_addr + S5P_INFORM7; - else if (samsung_rev() == EXYNOS4210_REV_1_0) + else if (exynos_rev() == EXYNOS4210_REV_1_0) return sysram_base_addr + 0x24; return pmu_base_addr + S5P_INFORM0; } static inline void __iomem *exynos_boot_vector_flag(void) { - if (samsung_rev() == EXYNOS4210_REV_1_1) + if (exynos_rev() == EXYNOS4210_REV_1_1) return pmu_base_addr + S5P_INFORM6; - else if (samsung_rev() == EXYNOS4210_REV_1_0) + else if (exynos_rev() == EXYNOS4210_REV_1_0) return sysram_base_addr + 0x20; return pmu_base_addr + S5P_INFORM1; } diff --git a/arch/arm/plat-samsung/cpu.c b/arch/arm/plat-samsung/cpu.c index e1ba88ba31d8..8acba21bbf4b 100644 --- a/arch/arm/plat-samsung/cpu.c +++ b/arch/arm/plat-samsung/cpu.c @@ -14,13 +14,6 @@ #include unsigned long samsung_cpu_id; -static unsigned int samsung_cpu_rev; - -unsigned int samsung_rev(void) -{ - return samsung_cpu_rev; -} -EXPORT_SYMBOL(samsung_rev); void __init s3c64xx_init_cpu(void) { @@ -34,15 +27,5 @@ void __init s3c64xx_init_cpu(void) samsung_cpu_id = readl_relaxed(S3C_VA_SYS + 0xA1C); } - samsung_cpu_rev = 0; - - pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); -} - -void __init s5p_init_cpu(const void __iomem *cpuid_addr) -{ - samsung_cpu_id = readl_relaxed(cpuid_addr); - samsung_cpu_rev = samsung_cpu_id & 0xFF; - pr_info("Samsung CPU ID: 0x%08lx\n", samsung_cpu_id); } diff --git a/arch/arm/plat-samsung/include/plat/cpu.h b/arch/arm/plat-samsung/include/plat/cpu.h index fadcddbea064..02d7f991d5a3 100644 --- a/arch/arm/plat-samsung/include/plat/cpu.h +++ b/arch/arm/plat-samsung/include/plat/cpu.h @@ -111,8 +111,6 @@ extern void s3c24xx_init_io(struct map_desc *mach_desc, int size); extern void s3c64xx_init_cpu(void); extern void s5p_init_cpu(const void __iomem *cpuid_addr); -extern unsigned int samsung_rev(void); - extern void s3c24xx_init_uarts(struct s3c2410_uartcfg *cfg, int no); extern void s3c24xx_init_clocks(int xtal); diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h index d69a0ca09fb5..3812085f8761 100644 --- a/arch/arm/plat-samsung/include/plat/map-s5p.h +++ b/arch/arm/plat-samsung/include/plat/map-s5p.h @@ -9,8 +9,6 @@ #ifndef __ASM_PLAT_MAP_S5P_H #define __ASM_PLAT_MAP_S5P_H __FILE__ -#define S5P_VA_CHIPID S3C_ADDR(0x02000000) - #define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000)) #define VA_VIC0 VA_VIC(0) #define VA_VIC1 VA_VIC(1) From patchwork Thu Oct 10 20:29:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175854 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2801311ill; Thu, 10 Oct 2019 13:34:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqysmKe1rRqfTs1Yded4+SDObWEVd5tt9pp2J+ffdrOOVh7cbkpw91N90DSFwW/8gI2FyCxP X-Received: by 2002:a17:906:1505:: with SMTP id b5mr10337254ejd.195.1570739696377; Thu, 10 Oct 2019 13:34:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739696; cv=none; d=google.com; s=arc-20160816; b=VEcVtyH6tUdaEo43NuqheHr0Yqxw3YyxqjbDwFz8jPu+q3yrNzJ6VRguxkp1eW8xEF f2tqSct3Wym5886FRbnc/haYhIBwltqbd+yxsOlCraWuGG/eDh+erN8WUyQur1CucMtp KyFTDCsgVn9bJR5RlBsfBttQDtDBjY6m709sgKYx8ipt+o4TQWSiAZf2h7WaoVZ5vFod 0OGqrbcW5zCQ12fHsjoCAsukaa4aNjvOq/0J657sI1HnRq9A0CLXO8auFEjXn8WcpmTY 7KmJ4Mx5x49jPr2gXLE0PmR2KEYa/SfWVPHFrN+ewOp6CM3pUwcVt0aR2rT46ydoT+cE 0J9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=zmoV5Z19LXX3gr0zX2gG/llf+RD9rcMIgtSfJfB2Jkk=; b=c5JGuIVTxRDZiJudo1G8YKcVF6d0NTB6+fFGstX3wAAMFRj0x0/RQDhENuZYjvKmon YjlwyoExKy9AoJ7wyGaOP4r8/5fAKBMTqcBGiFgC36up5ocZ/Q8J6H0wEeox438Ra7WD TLaFHjfrUKajNN+o57P4HskmIlZROotCZHN6qGrfvyHRTBnnIyomRuOYhU5t4+D+snJ3 X9I5vuwLIFWphxYVTB4CEK6pSEfJNtloy5qk0HYWK4Rt17l6wha1fTmUFmiIwUYucy22 uWoGQIPzrBWDlbJY3tyu+2lncxA9+HU9UVb9EeWbtQs9nOIYLSNKoFZ7i90rHgVTeHge x6Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si4523340edd.431.2019.10.10.13.34.56; Thu, 10 Oct 2019 13:34:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726310AbfJJUez (ORCPT + 3 others); Thu, 10 Oct 2019 16:34:55 -0400 Received: from mout.kundenserver.de ([212.227.126.131]:36719 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbfJJUez (ORCPT ); Thu, 10 Oct 2019 16:34:55 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MuF4v-1hxQGJ3NEb-00uawx; Thu, 10 Oct 2019 22:34:38 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Ulf Hansson Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Olof Johansson , Sascha Hauer , Bartlomiej Zolnierkiewicz , "Enrico Weigelt, metux IT consult" , linux-kernel@vger.kernel.org, linux-mmc@vger.kernel.org Subject: [PATCH 08/36] ARM: exynos: stop selecting PLAT_SAMSUNG Date: Thu, 10 Oct 2019 22:29:52 +0200 Message-Id: <20191010203043.1241612-8-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:uwZUxKfHU6aXQrxq5LBsqRjtGw4Jouv7a9Oj5nhgoB0hlXyrcjq cQyW2Cc79CrgKEOR6AddSkd8kEBELnOavaFnpiNz+2wYC6JLZtkFkNgiIgcAb7IBPMKOVw0 /4ytjJKtS7vIIFSkZF7IEeIC9HtyP3lGkyhZhf4Pi3jKK/5gN5ZDuHWv+OUxglNHQchIV00 9MUCnTUKaPQYLOuhuq7Yg== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:MjZuD1WSriM=:hwMzUoxCknZvCwSvNSjCMN 7y6Uvi/BhIjqy3zK9+GLPLSNPmAYLF6XMR5MVm9RdReMkMhEpRn9U0e2Bqx/jFGajmKkkwPaF OwPQDZ/+fO1eN5nL+6z52rQyDTWBG/uTALbBrsxJFjw2IXpGkynCbp+CvOZSYprMJ+B+R4ASg 8BLcQdVkFnlwHipnDjJMzkOCDq8f/K/fea3DmU+S6WllVxMBke4EAGCFCz+N7DLEAdxr1uit2 UHXrt4ArSWWE1IOV1hWsBjL9OoKUx6cb9T4rAhjcQrYQRjP8dXIy1yExNCq/K1pvVZm+chtMl gpJJYL3sYB5Hg7Aa6mC4X2/uNwbpQyBbZCXB1Lcxc6Rj402rXZQCV2Xjc4m5va6u+CCtnXL4x 4yC/wMNz5qcSvYatDm8uHxsqOXJ2qvf4Eh7HcD8JzxLmcY1MjSa3NB8LRnEZgol+ONBYmvDoz OEh2KpTH7cbgo3nQxW3+JuTkmuCV+x+NlnA1/PJKIzzxG2jj7xoi1GAS7ZrZwhGb/J9FU/oZa sMXSrcHyKE9XN+8rl6ymRIH1La+GHJZXvQw6Sd70xeGKzq5WJSqpklT2Ql4aKALBCxsLCaGxt Gvs7d/Fj8p4WWGHEyJNaHyK0X5ltlQo2XUe7WBqDH65jq+4uEstinmPiWPi7rgkwSppRrlyu+ kBzlPLcpQxheqyt2DqjQ9FMOnqx5mGNz1Oj6JaLtBKUDi8RpaZp7TGvCZ+njWgcqEhIGm/FQQ S5Y24w/1H9yJpgB9XlgNpINBNfESIaOnFJqyFXF7R12fdZ4/L7hfjdGcZ74xss1Qn9i4MeOBB t3OBWaJsXz357+6RJFLHXKD3cL1S4doTsLpMWmh5tniImws1g/Gy4X2PoBsyOv3h5d3eZfz6l rMhwf0F77SGifPySmcCg== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Now that no code in arch/arm is shared between mach-exynos and the others, make the split formal. Signed-off-by: Arnd Bergmann --- arch/arm/Kconfig.debug | 8 ++++---- arch/arm/Makefile | 1 - arch/arm/mach-exynos/Makefile | 4 ---- arch/arm/plat-samsung/Kconfig | 4 ++-- drivers/mmc/host/Kconfig | 2 +- 5 files changed, 7 insertions(+), 12 deletions(-) -- 2.20.0 Acked-by: Ulf Hansson diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug index d05b836dfeb2..9c4f2d6deb06 100644 --- a/arch/arm/Kconfig.debug +++ b/arch/arm/Kconfig.debug @@ -998,7 +998,7 @@ choice via SCIFA4 on Renesas SH-Mobile AG5 (SH73A0). config DEBUG_S3C_UART0 - depends on PLAT_SAMSUNG + depends on PLAT_SAMSUNG || ARCH_EXYNOS select DEBUG_EXYNOS_UART if ARCH_EXYNOS select DEBUG_S3C24XX_UART if ARCH_S3C24XX select DEBUG_S3C64XX_UART if ARCH_S3C64XX @@ -1010,7 +1010,7 @@ choice by the boot-loader before use. config DEBUG_S3C_UART1 - depends on PLAT_SAMSUNG + depends on PLAT_SAMSUNG || ARCH_EXYNOS select DEBUG_EXYNOS_UART if ARCH_EXYNOS select DEBUG_S3C24XX_UART if ARCH_S3C24XX select DEBUG_S3C64XX_UART if ARCH_S3C64XX @@ -1022,7 +1022,7 @@ choice by the boot-loader before use. config DEBUG_S3C_UART2 - depends on PLAT_SAMSUNG + depends on PLAT_SAMSUNG || ARCH_EXYNOS select DEBUG_EXYNOS_UART if ARCH_EXYNOS select DEBUG_S3C24XX_UART if ARCH_S3C24XX select DEBUG_S3C64XX_UART if ARCH_S3C64XX @@ -1034,7 +1034,7 @@ choice by the boot-loader before use. config DEBUG_S3C_UART3 - depends on PLAT_SAMSUNG && (ARCH_EXYNOS || ARCH_S5PV210) + depends on ARCH_EXYNOS || ARCH_S5PV210 select DEBUG_EXYNOS_UART if ARCH_EXYNOS select DEBUG_S3C64XX_UART if ARCH_S3C64XX select DEBUG_S5PV210_UART if ARCH_S5PV210 diff --git a/arch/arm/Makefile b/arch/arm/Makefile index db857d07114f..f492d7c338fe 100644 --- a/arch/arm/Makefile +++ b/arch/arm/Makefile @@ -233,7 +233,6 @@ machine-$(CONFIG_PLAT_SPEAR) += spear # Platform directory name. This list is sorted alphanumerically # by CONFIG_* macro name. -plat-$(CONFIG_ARCH_EXYNOS) += samsung plat-$(CONFIG_ARCH_OMAP) += omap plat-$(CONFIG_ARCH_S3C64XX) += samsung plat-$(CONFIG_ARCH_S5PV210) += samsung diff --git a/arch/arm/mach-exynos/Makefile b/arch/arm/mach-exynos/Makefile index 0fd3fcf8bfb0..53fa363c8e44 100644 --- a/arch/arm/mach-exynos/Makefile +++ b/arch/arm/mach-exynos/Makefile @@ -3,10 +3,6 @@ # Copyright (c) 2010-2011 Samsung Electronics Co., Ltd. # http://www.samsung.com/ -ccflags-$(CONFIG_ARCH_MULTIPLATFORM) += -I$(srctree)/$(src)/include -I$(srctree)/arch/arm/plat-samsung/include - -# Core - obj-$(CONFIG_ARCH_EXYNOS) += exynos.o exynos-smc.o firmware.o obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm.o sleep.o diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index 832ab0e6cd72..e31a156a27df 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig @@ -4,7 +4,7 @@ config PLAT_SAMSUNG bool - depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_EXYNOS || ARCH_S5PV210 + depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 default y select GENERIC_IRQ_CHIP select NO_IOPORT_MAP @@ -240,7 +240,7 @@ config SAMSUNG_PM_DEBUG bool "Samsung PM Suspend debug" depends on PM && DEBUG_KERNEL depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 - depends on DEBUG_EXYNOS_UART || DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART + depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART help Say Y here if you want verbose debugging from the PM Suspend and Resume code. See diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig index 49ea02c467bf..400a581c918c 100644 --- a/drivers/mmc/host/Kconfig +++ b/drivers/mmc/host/Kconfig @@ -275,7 +275,7 @@ config MMC_SDHCI_TEGRA config MMC_SDHCI_S3C tristate "SDHCI support on Samsung S3C SoC" - depends on MMC_SDHCI && PLAT_SAMSUNG + depends on MMC_SDHCI && (PLAT_SAMSUNG || ARCH_EXYNOS) help This selects the Secure Digital Host Controller Interface (SDHCI) often referrered to as the HSMMC block in some of the Samsung S3C From patchwork Thu Oct 10 20:29:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175855 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2802445ill; Thu, 10 Oct 2019 13:36:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqw3nihnyX/wqexDWcSWNM9oh4qfg1AfNIaLrtPYkud4/kIO7qNRByefBHnAri+783tB4FC2 X-Received: by 2002:a17:906:7257:: with SMTP id n23mr10397968ejk.132.1570739766510; Thu, 10 Oct 2019 13:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739766; cv=none; d=google.com; s=arc-20160816; b=0M88gvU8c1/FG2MqBFPBEe1Z132hIItuGjTV7biqFlUHLKQiHl92e8Esr/VuJQgPHD tdw6YeuCk5O6ktnnNdMgmDuzHIbh2i26b1H23pkfYUUubge644Q+ZskPibdl6uDXdPGG JTwbq0SEyY3hf+H1DnUrpMsORpOoXt8U4icNd51zI8GWqq6VHK5eROPAtzpZ+BpKg+ZG cb20//SYjQ+7ZmNIqQlH2tMOu8RRYrG6aA17eybzNMO92BnqxDyJWDSyX2Rw9+pL1ftG LDt7kt7oSgtL/DsNnoPkZq/vEOtR5zl4Hd/3LPPVuqNNhCFttZFetlenJ71Ftp/Q/lWG 889A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=IYZUpPRYLktOkMLKBP1edPa/yzDKE/Af/slQ0FhjWcQ=; b=tM+FNVuAvmh247c6g6RN8MDwo+xj4KXnrED2rhVEKtbI+s0h6BKGnzLmbTOnJkV0/F 49ZEZGeXg674NOzaKAWcuZY7ld1DM3ubOqvz0V0UlXMKO9qLyZj1Ew7NhcYG0Pbeuwrw Z32hhsceHhF8cbTPj+Ze8bAYZhALPw+pIGc6oKzb543/DZk+29xEISyz0ixskJvxEAEE QmgT0uwEk5uZmPywiZKQGYkyuMQ5ZFjrpI853tDz4yGKIxknFXRDlDLcWQfQP43hlFmK pE0LY70nMw9kph/kXgHW7XXtoXl/PtcSuO4XAAGTrbl4XAWjxu5DYQ34hqJfSV5oovSt Y71A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si4523340edd.431.2019.10.10.13.36.06; Thu, 10 Oct 2019 13:36:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726096AbfJJUgF (ORCPT + 3 others); Thu, 10 Oct 2019 16:36:05 -0400 Received: from mout.kundenserver.de ([212.227.126.187]:58151 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725867AbfJJUgF (ORCPT ); Thu, 10 Oct 2019 16:36:05 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1N7gfa-1i4rQr2Dv0-014nhA; Thu, 10 Oct 2019 22:35:51 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Kyungmin Park Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Mauro Carvalho Chehab , Bartlomiej Zolnierkiewicz , Sylwester Nawrocki , Pankaj Dubey , Marek Szyprowski , linux-kernel@vger.kernel.org Subject: [PATCH 09/36] ARM: samsung: move pm check code to drivers/soc Date: Thu, 10 Oct 2019 22:29:53 +0200 Message-Id: <20191010203043.1241612-9-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:K7Pp8lz4oEGFgdpuLCrdq/vsf/YBGIb6Lw7G2f0vWzebgPoLyzT 1AQm8/sarFF2+QJFLMgdyUDqRsJnVhIyLUi09fcmq3MPCpVO1grWYDCu9LwnymGpXPxgS/Z 4wgWrgKIPk1prkmEtPoLMOinYWnZmYh7qPIGGxSVdI45oP7N29+jE3tWa86Uz73j1J4QzvZ gSBwdx5VY+qcmadk/GdPw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:rwC7bMXZlVo=:GXnt7mvTtQyD56sqmJrpuq ypSf2LDJw5ag8E57yiPKCWm4Zwe7RRw0hZU+QrFB1rhhxAUU93HRrHCf51Hl+li/ZMQraJyoO bCo0liU8PEs3z3m5VGKAs1bmAzN7x3Fe+nsrq6XWf28XwZEXMoj7Dfb7eoUCdp9ts3ozxoZdV IvnTQtudLnMD1QT/eGgYQBnfGde3c9zVVorrMdx/f0YYNtpdrLk5mCBCSGnkN1eMN5NBB9Ks9 LxijrvVD0I2j49knvFigWZSTt7NVILW8imVNYLaZhDWEzYYEurHmsNDrY4GaStXCuQDH6xISI MmzbPDqx6Af4MU4ypGurANAThZtCFszuaziPfn9QlrpRZ1GcggiiTWGGv0TyzB0XMW5JdKTFq hdUTFTf1gW1BWnSoN+2iUOecCevF/SvzW+WxpVnSttz9F6FM7XAY789vbc2N45z5XUzaKhJk1 JigFqCrAy1kpLYiWH7y6F5Xy2bcVm1taMk+hUJzG6LhLx8KxwaPdoj2o3qHuqvKkUbqBSCsyB Dmmp/Qj1L0hEvV4XeEgrn2xPxfpUpBc2H1SW6oZuStEgCtxy6bmQh8TOej1Ei620KLnvEYZTg WBcOEvkRfh0ZBR2IfJXnN4yxyp6FmCmVFfd5tO1h9LIvp++r9Kl0zsnkJj4l4ZcW63nv8tj2N 7gdH094UgNeHITbPDPzrVCuvczjh0nC6qePY4hRITY6aEjxdNkJTT9hJR5tji/+Ic67kInjv6 v7jHo5Yjh8AOaCInoYqwENVVtP0kxkb/LEKmyTpBgsbNMTmA8hs9w+X/M9WAMGrUkEi5tyfzC jxc1SN7Zf8zYR8svo8gwiNhXQTOEA8duVBvQFV/qsYy8FBSbABcgXMwNWBZZmdsb5BtiPEf0c s32cQ5bAuTJZGJ4DRAQw== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This is the only part of plat-samsung that is really shared between the s3c and s5p ports. Moving it to drivers/soc/ lets us make them completely independent. Signed-off-by: Arnd Bergmann --- arch/arm/mach-s5pv210/Kconfig | 1 + arch/arm/plat-samsung/Kconfig | 49 +---------- arch/arm/plat-samsung/Makefile | 2 - .../arm/plat-samsung/include/plat/pm-common.h | 70 +--------------- drivers/soc/samsung/Kconfig | 48 ++++++++++- drivers/soc/samsung/Makefile | 3 + .../soc/samsung/s3c-pm-check.c | 2 +- .../soc/samsung/s3c-pm-debug.c | 3 +- include/linux/soc/samsung/s3c-pm.h | 84 +++++++++++++++++++ 9 files changed, 139 insertions(+), 123 deletions(-) rename arch/arm/plat-samsung/pm-check.c => drivers/soc/samsung/s3c-pm-check.c (99%) rename arch/arm/plat-samsung/pm-debug.c => drivers/soc/samsung/s3c-pm-debug.c (97%) create mode 100644 include/linux/soc/samsung/s3c-pm.h -- 2.20.0 diff --git a/arch/arm/mach-s5pv210/Kconfig b/arch/arm/mach-s5pv210/Kconfig index 03984a791879..d2b0e64bad7e 100644 --- a/arch/arm/mach-s5pv210/Kconfig +++ b/arch/arm/mach-s5pv210/Kconfig @@ -18,6 +18,7 @@ config ARCH_S5PV210 select HAVE_S3C_RTC if RTC_CLASS select PINCTRL select PINCTRL_EXYNOS + select SOC_SAMSUNG help Samsung S5PV210/S5PC110 series based systems diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig index e31a156a27df..740bdb23f38a 100644 --- a/arch/arm/plat-samsung/Kconfig +++ b/arch/arm/plat-samsung/Kconfig @@ -8,6 +8,7 @@ config PLAT_SAMSUNG default y select GENERIC_IRQ_CHIP select NO_IOPORT_MAP + select SOC_SAMSUNG help Base platform code for all Samsung SoC based systems @@ -234,54 +235,6 @@ config SAMSUNG_PM_GPIO pinctrl-samsung driver. endif -comment "Power management" - -config SAMSUNG_PM_DEBUG - bool "Samsung PM Suspend debug" - depends on PM && DEBUG_KERNEL - depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 - depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART - help - Say Y here if you want verbose debugging from the PM Suspend and - Resume code. See - for more information. - -config S3C_PM_DEBUG_LED_SMDK - bool "SMDK LED suspend/resume debugging" - depends on PM && (MACH_SMDK6410) - help - Say Y here to enable the use of the SMDK LEDs on the baseboard - for debugging of the state of the suspend and resume process. - - Note, this currently only works for S3C64XX based SMDK boards. - -config SAMSUNG_PM_CHECK - bool "S3C2410 PM Suspend Memory CRC" - depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210) - select CRC32 - help - Enable the PM code's memory area checksum over sleep. This option - will generate CRCs of all blocks of memory, and store them before - going to sleep. The blocks are then checked on resume for any - errors. - - Note, this can take several seconds depending on memory size - and CPU speed. - - See - -config SAMSUNG_PM_CHECK_CHUNKSIZE - int "S3C2410 PM Suspend CRC Chunksize (KiB)" - depends on PM && SAMSUNG_PM_CHECK - default 64 - help - Set the chunksize in Kilobytes of the CRC for checking memory - corruption over suspend and resume. A smaller value will mean that - the CRC data block will take more memory, but will identify any - faults with better precision. - - See - config SAMSUNG_WAKEMASK bool depends on PM diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile index 3db9d2c38258..d88b9b84f3a9 100644 --- a/arch/arm/plat-samsung/Makefile +++ b/arch/arm/plat-samsung/Makefile @@ -28,8 +28,6 @@ obj-$(CONFIG_PM_SLEEP) += pm-common.o obj-$(CONFIG_EXYNOS_CPU_SUSPEND) += pm-common.o obj-$(CONFIG_SAMSUNG_PM) += pm.o obj-$(CONFIG_SAMSUNG_PM_GPIO) += pm-gpio.o -obj-$(CONFIG_SAMSUNG_PM_CHECK) += pm-check.o -obj-$(CONFIG_SAMSUNG_PM_DEBUG) += pm-debug.o obj-$(CONFIG_SAMSUNG_WAKEMASK) += wakeup-mask.o obj-$(CONFIG_SAMSUNG_WDT_RESET) += watchdog-reset.o diff --git a/arch/arm/plat-samsung/include/plat/pm-common.h b/arch/arm/plat-samsung/include/plat/pm-common.h index 87fa97fd6e8b..18b9607e1e39 100644 --- a/arch/arm/plat-samsung/include/plat/pm-common.h +++ b/arch/arm/plat-samsung/include/plat/pm-common.h @@ -11,6 +11,7 @@ #define __PLAT_SAMSUNG_PM_COMMON_H __FILE__ #include +#include /* sleep save info */ @@ -36,73 +37,4 @@ extern void s3c_pm_do_save(struct sleep_save *ptr, int count); extern void s3c_pm_do_restore(const struct sleep_save *ptr, int count); extern void s3c_pm_do_restore_core(const struct sleep_save *ptr, int count); -/* PM debug functions */ - -/** - * struct pm_uart_save - save block for core UART - * @ulcon: Save value for S3C2410_ULCON - * @ucon: Save value for S3C2410_UCON - * @ufcon: Save value for S3C2410_UFCON - * @umcon: Save value for S3C2410_UMCON - * @ubrdiv: Save value for S3C2410_UBRDIV - * - * Save block for UART registers to be held over sleep and restored if they - * are needed (say by debug). -*/ -struct pm_uart_save { - u32 ulcon; - u32 ucon; - u32 ufcon; - u32 umcon; - u32 ubrdiv; - u32 udivslot; -}; - -#ifdef CONFIG_SAMSUNG_PM_DEBUG -/** - * s3c_pm_dbg() - low level debug function for use in suspend/resume. - * @msg: The message to print. - * - * This function is used mainly to debug the resume process before the system - * can rely on printk/console output. It uses the low-level debugging output - * routine printascii() to do its work. - */ -extern void s3c_pm_dbg(const char *msg, ...); - -#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt) - -extern void s3c_pm_save_uarts(bool is_s3c24xx); -extern void s3c_pm_restore_uarts(bool is_s3c24xx); - -#ifdef CONFIG_ARCH_S3C64XX -extern void s3c_pm_arch_update_uart(void __iomem *regs, - struct pm_uart_save *save); -#else -static inline void -s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save) -{ -} -#endif - -#else -#define S3C_PMDBG(fmt...) pr_debug(fmt) - -static inline void s3c_pm_save_uarts(bool is_s3c24xx) { } -static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { } -#endif - -/* suspend memory checking */ - -#ifdef CONFIG_SAMSUNG_PM_CHECK -extern void s3c_pm_check_prepare(void); -extern void s3c_pm_check_restore(void); -extern void s3c_pm_check_cleanup(void); -extern void s3c_pm_check_store(void); -#else -#define s3c_pm_check_prepare() do { } while (0) -#define s3c_pm_check_restore() do { } while (0) -#define s3c_pm_check_cleanup() do { } while (0) -#define s3c_pm_check_store() do { } while (0) -#endif - #endif diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index 33ad0de2de3c..0ea7402ffba3 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -25,6 +25,52 @@ config EXYNOS_PMU_ARM_DRIVERS config EXYNOS_PM_DOMAINS bool "Exynos PM domains" if COMPILE_TEST - depends on PM_GENERIC_DOMAINS || COMPILE_TEST + depends on (ARCH_EXYNOS && PM_GENERIC_DOMAINS) || COMPILE_TEST + +config SAMSUNG_PM_DEBUG + bool "Samsung PM Suspend debug" + depends on PM && DEBUG_KERNEL + depends on PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210 + depends on DEBUG_S3C24XX_UART || DEBUG_S3C2410_UART + help + Say Y here if you want verbose debugging from the PM Suspend and + Resume code. See + for more information. + +config S3C_PM_DEBUG_LED_SMDK + bool "SMDK LED suspend/resume debugging" + depends on PM && (MACH_SMDK6410) + help + Say Y here to enable the use of the SMDK LEDs on the baseboard + for debugging of the state of the suspend and resume process. + + Note, this currently only works for S3C64XX based SMDK boards. + +config SAMSUNG_PM_CHECK + bool "S3C2410 PM Suspend Memory CRC" + depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210) + select CRC32 + help + Enable the PM code's memory area checksum over sleep. This option + will generate CRCs of all blocks of memory, and store them before + going to sleep. The blocks are then checked on resume for any + errors. + + Note, this can take several seconds depending on memory size + and CPU speed. + + See + +config SAMSUNG_PM_CHECK_CHUNKSIZE + int "S3C2410 PM Suspend CRC Chunksize (KiB)" + depends on PM && SAMSUNG_PM_CHECK + default 64 + help + Set the chunksize in Kilobytes of the CRC for checking memory + corruption over suspend and resume. A smaller value will mean that + the CRC data block will take more memory, but will identify any + faults with better precision. + + See endif diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile index 3b6a8797416c..88ae7a522055 100644 --- a/drivers/soc/samsung/Makefile +++ b/drivers/soc/samsung/Makefile @@ -6,3 +6,6 @@ obj-$(CONFIG_EXYNOS_PMU) += exynos-pmu.o obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS) += exynos3250-pmu.o exynos4-pmu.o \ exynos5250-pmu.o exynos5420-pmu.o obj-$(CONFIG_EXYNOS_PM_DOMAINS) += pm_domains.o + +obj-$(CONFIG_SAMSUNG_PM_CHECK) += s3c-pm-check.o +obj-$(CONFIG_SAMSUNG_PM_DEBUG) += s3c-pm-debug.o diff --git a/arch/arm/plat-samsung/pm-check.c b/drivers/soc/samsung/s3c-pm-check.c similarity index 99% rename from arch/arm/plat-samsung/pm-check.c rename to drivers/soc/samsung/s3c-pm-check.c index cd2c02c68bc3..ff3e099fc208 100644 --- a/arch/arm/plat-samsung/pm-check.c +++ b/drivers/soc/samsung/s3c-pm-check.c @@ -15,7 +15,7 @@ #include #include -#include +#include #if CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE < 1 #error CONFIG_SAMSUNG_PM_CHECK_CHUNKSIZE must be a positive non-zero value diff --git a/arch/arm/plat-samsung/pm-debug.c b/drivers/soc/samsung/s3c-pm-debug.c similarity index 97% rename from arch/arm/plat-samsung/pm-debug.c rename to drivers/soc/samsung/s3c-pm-debug.c index 482d53753e93..b5ce0e9a41e5 100644 --- a/arch/arm/plat-samsung/pm-debug.c +++ b/drivers/soc/samsung/s3c-pm-debug.c @@ -15,8 +15,7 @@ #include -#include -#include +#include static struct pm_uart_save uart_save; diff --git a/include/linux/soc/samsung/s3c-pm.h b/include/linux/soc/samsung/s3c-pm.h new file mode 100644 index 000000000000..d477b314d034 --- /dev/null +++ b/include/linux/soc/samsung/s3c-pm.h @@ -0,0 +1,84 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Tomasz Figa + * Copyright (c) 2004 Simtec Electronics + * http://armlinux.simtec.co.uk/ + * Written by Ben Dooks, + */ + +#ifndef __SAMSUNG_SOC_S3C_PM_H +#define __SAMSUNG_SOC_S3C_PM_H __FILE__ + +#include + +/* PM debug functions */ + +/** + * struct pm_uart_save - save block for core UART + * @ulcon: Save value for S3C2410_ULCON + * @ucon: Save value for S3C2410_UCON + * @ufcon: Save value for S3C2410_UFCON + * @umcon: Save value for S3C2410_UMCON + * @ubrdiv: Save value for S3C2410_UBRDIV + * + * Save block for UART registers to be held over sleep and restored if they + * are needed (say by debug). +*/ +struct pm_uart_save { + u32 ulcon; + u32 ucon; + u32 ufcon; + u32 umcon; + u32 ubrdiv; + u32 udivslot; +}; + +#ifdef CONFIG_SAMSUNG_PM_DEBUG +/** + * s3c_pm_dbg() - low level debug function for use in suspend/resume. + * @msg: The message to print. + * + * This function is used mainly to debug the resume process before the system + * can rely on printk/console output. It uses the low-level debugging output + * routine printascii() to do its work. + */ +extern void s3c_pm_dbg(const char *msg, ...); + +#define S3C_PMDBG(fmt...) s3c_pm_dbg(fmt) + +extern void s3c_pm_save_uarts(bool is_s3c24xx); +extern void s3c_pm_restore_uarts(bool is_s3c24xx); + +#ifdef CONFIG_ARCH_S3C64XX +extern void s3c_pm_arch_update_uart(void __iomem *regs, + struct pm_uart_save *save); +#else +static inline void +s3c_pm_arch_update_uart(void __iomem *regs, struct pm_uart_save *save) +{ +} +#endif + +#else +#define S3C_PMDBG(fmt...) pr_debug(fmt) + +static inline void s3c_pm_save_uarts(bool is_s3c24xx) { } +static inline void s3c_pm_restore_uarts(bool is_s3c24xx) { } +#endif + +/* suspend memory checking */ + +#ifdef CONFIG_SAMSUNG_PM_CHECK +extern void s3c_pm_check_prepare(void); +extern void s3c_pm_check_restore(void); +extern void s3c_pm_check_cleanup(void); +extern void s3c_pm_check_store(void); +#else +#define s3c_pm_check_prepare() do { } while (0) +#define s3c_pm_check_restore() do { } while (0) +#define s3c_pm_check_cleanup() do { } while (0) +#define s3c_pm_check_store() do { } while (0) +#endif + +#endif From patchwork Thu Oct 10 20:29:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175856 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2802831ill; Thu, 10 Oct 2019 13:36:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqxPifDURhe54UQF6TsGMe681gH6/JCPpLH9XCvE2louTa5zPY1MyUMIR+NxlW734aXQ09G+ X-Received: by 2002:a17:906:1505:: with SMTP id b5mr10344049ejd.195.1570739793724; Thu, 10 Oct 2019 13:36:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739793; cv=none; d=google.com; s=arc-20160816; b=Q/fyr+gECuEFeSfGJNTp50MpZ3dJKybc87Wpi1rlNm//ADwdLZZfN+wLJYx/ZwSe0v yAtQ0iGFGtsLadlucOdkuOzUU2gv13Ae6qrqwvSlYHKd/1Q0JRIvO2lLo3pshJrEHZBb rA6jk0jRZH4lvciC6auzQRW5l38BFMlEAg6O8q/cxlZrIgYv5uRpWpLcsk9FO1FV8DmH q0N2IDkLikUjkbjfmDNBi4TkkrzX6Px5rb3MPUOxdxvWb47k8546X2+mH/30By6rkbYY tBAhJ7/9Ck5bB5lYzPiUxzFxVFFA+BGioiZeOEuBCnkOjThHJQ5gCDfhe1Tercpdozp5 7j3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=nZH1izDDB43K7yz1aAjYBlmHO5E4Tl7sjwelwy7xdDw=; b=LKOQC3cDHPsqMWElbTmnpCwBKALjnlf7j6IByMb6c/LIM1+vQg+Ie7Mrb3gwRkPqfb mcNMYPR2XoPmWz14wSbQW8AWUpYCwpczeAJWOteZeQ5vZQu2a9IC+3OfAb2RJgGmxG8/ G9/9bnX/FHrs2D59+LVInqCvB/Zug3wDMjfH0Q3Xp75981ISmZvbv8MS5w7+M1aI3BIo Q7tzj8qASZEm1tpGqg2zxq6PfhBvh9nBh/P0oVEjYz/rUMt/UgLxkM95mtaw46VtZ2FZ LQIFRZtXjiPykGjwc+xsnvBpuFUYFScPgy+mgNCGmh7htQjkqck1TE725bMbqsON8d1f z9ZA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si4523340edd.431.2019.10.10.13.36.33; Thu, 10 Oct 2019 13:36:33 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727161AbfJJUgd (ORCPT + 3 others); Thu, 10 Oct 2019 16:36:33 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:42067 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726533AbfJJUgd (ORCPT ); Thu, 10 Oct 2019 16:36:33 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MYLqs-1ieCBJ1q2k-00VSwa; Thu, 10 Oct 2019 22:36:15 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski , Kyungmin Park Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Tomasz Figa , linux-kernel@vger.kernel.org Subject: [PATCH 10/36] ARM: s5pv210: use private pm save/restore Date: Thu, 10 Oct 2019 22:29:54 +0200 Message-Id: <20191010203043.1241612-10-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:t06pj45vMcSDoEbxSCss3f5CI4Q0mCvmon4HXQKdFVgc3CZE2SZ 6GDEv57UdL2pMT9oYaML5s6k6H4an0hD0vSPqL1TK9QhIqAiZ3JXJGQRYiLA10kdPybEDLM LkmdsIkBh+fEfuZ4qKsBYg1p1Ya6B3jCBopYbIsgcd7xLrXfT9D/yReO3ELSeGlzG11eU+v IdbSm0rP+MzyF0ya7wCxQ== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:XV+MPK70w7E=:BhQ4bhqXydFKuIa+TPbyId A5KmTH4/XxVCeHb+3+T5c/+c9wqtBBLomtafNUtbfL7geLlXVDKW10N4L6+AuH1WBjanj7LvJ dUFJ4oNaE75ImwWCooDU1IX6BtFBbqMzAypBLcYxMKc7pEA7se7MiEXiGET8BD7NWCYy+Gm4v xo32t0jwcI1xZ2hc4rrG7kLEvVfDZ2YUZsJI8Ad4oolmeZVJy//p5Cv5VLW6KYTXCG2TrDC67 LoQVDf0jAV616OOAAF+jKJIsMqu6Cq2rlSVykk2ZZbKHmByhbdRjqPiUhVpY+ffdMkC7yHUgx YLgRrU20ShewwEukIpbl+B7KfZ0zmaawX8Z9CdSYrRKnru5ohJTg3S4SxjyE2WnxZGOBRtFot p6i+CXENZsa4rgfp6x9GEoNZj4Rof+xn0WxjqpNP7dNHQECpVls3CHZj7rzGc8TIPzzSqq+1I xVHhIuSLdGsq8xL6n8JaiwDD6yqNVPhfeFiSF0SA9MyJulhLZF6n0cQ3zCSauqUSDR7w8XIzf O+QLobMdBq81IEEue1nmPN8WlMjIgCZxSjj1H7V2a1hBItJcRp5uCwDjv1vhqM/Yvbj1qkKEt lwPpFZ7VPrCtQYmHXOiSDZVRplbPgeD8reNkF4ylUttAds+sCpXi7XwkW/amkRCCjLH5K3bsw iksEKWMxTuKZznLo8ThpwcjNdmN6ylK+eBLvmzhHhiW50uLoKZ4wk3YHFRG5ZZyiVoTN++Hji IxFdNsp/402JjDicaaBR3WlWnjX586w7YTzQ1x9LvCYrPuIJ8TclTw1NYrMFqu9I8qwXxzJBn S3rdkwTgwAzhDmBBaDAvDU72X8nw5Z3tHJ4YIHgDtsFRGEnslYRbRuv+aPzqpybQqwnBOsODv 44eaAD7nyQxBDF6tZyig== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org 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(-) -- 2.20.0 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) #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 -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 From patchwork Thu Oct 10 20:29:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 175858 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2805026ill; Thu, 10 Oct 2019 13:39:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2Q5L6XivirQNoo/62LTwfU9PgJpcgm+5QS8xompKUivUdWBFnz9u9yBo2jSn34j1HNev9 X-Received: by 2002:a1c:2e4c:: with SMTP id u73mr306525wmu.94.1570739945291; Thu, 10 Oct 2019 13:39:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570739945; cv=none; d=google.com; s=arc-20160816; b=ycoLBFZvULikSVPNrHgywbYBRRbj0na2KAIE+ug/D4J578qDJWncVEqdPWuxJiAUcb /C165aTqNx2KL72DBx/jAelJHRbksWE2/1BLhXVSI86p6RwVHLiHLh/N6OKOS3HfYS0N WkjuycOvZm/f14uqv9iAYeoRhb506PEFi5DWcKgWh1X8dTV2z3dqSACzDauIQtLUWEex CnlF4uZ3mz283B1bGgJg0Q9rwlkHVIFxi6f1scgRGc46VB95UV0WEYdtAa+I5B3HFZCU zU/JpBbdTDWoBxVzRTSmsq4Hb0QhH8OM584OFK/lioe8BIqdxtGrOQPIVACF6e/nxyz2 Gd6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=9xlG+UXy0Qazpse7+LcHnVRX0d1ciG1fROaXCPAPcJg=; b=ZnjHrsTPtKiTRiMSbg72OBCXH1XkYBf7sKBmbfvKYAUOg3ApVA9ZJkzMLBLphodseD yUN9Q59OSEc2gT/9ldsXQIk9b3H4QhVYSn9mnZ+ij4OjoQZi4RGTiAJ3W0hJn8HjWC+1 T/HBzHy6dl3w/hpLQLl94xK7TysefIh6NYMHPpPZ3YN28DAsepjYbuitUBAAaRzE3DMy DCjdbj7S+XjSo76lYnP/eBO8gvTADkIKwTR7U9YoSMb3laJHrwFpEAG4+76e2qzWCS8e EHIXpns/vHI3tCVunIRF2Cf8x1RS1puWrYKElSjVUNJsncwkAx/JHF53V1WTqeFZmG5D w8bQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f45si4578503eda.345.2019.10.10.13.39.05; Thu, 10 Oct 2019 13:39:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-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-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727083AbfJJUjE (ORCPT + 3 others); Thu, 10 Oct 2019 16:39:04 -0400 Received: from mout.kundenserver.de ([212.227.126.134]:59639 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfJJUjE (ORCPT ); Thu, 10 Oct 2019 16:39:04 -0400 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.129]) with ESMTPA (Nemesis) id 1MlL5x-1hoan32nCH-00llHL; Thu, 10 Oct 2019 22:38:52 +0200 From: Arnd Bergmann To: Kukjin Kim , Krzysztof Kozlowski Cc: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linus.walleij@linaro.org, Arnd Bergmann , Mark Brown , Charles Keepax , linux-kernel@vger.kernel.org Subject: [PATCH 12/36] ARM: s3c64xx: remove mach/hardware.h Date: Thu, 10 Oct 2019 22:29:56 +0200 Message-Id: <20191010203043.1241612-12-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20191010203043.1241612-1-arnd@arndb.de> References: <20191010202802.1132272-1-arnd@arndb.de> <20191010203043.1241612-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:OXe9QnfIOm2QB7E89P7eHTIAVvdAUR8mNrxxSaX9vBslXNpzA9w Lg+aJ+KE73cm6jXF7a1hIijERFXs9Yq/KzYJQAoVZk3PGgnOkaO+oS0kOazRYUFMvsVN9xI 6zys/ptdflbTnlNoqYrjnMzd98Fn8RfCEglT6NWiG7Sl1sqH3/wb3uRbAh1P6NiYtYrDFH3 9IImxelmRSj0RdAu1eiWw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1; V03:K0:hs2OK14Huk4=:UoqLsaEEin+XUyqgAC0Bbu 8DzXYBz0uUZcngn/LCWTOPtv5gd/AuAugN8yEUtvb9+uUz7f/QThRZ2vwWIVx0QGnXhDbvhZQ eYNUfVHgkHtL6QlL6RhucARKyWVZaxCPLhiTZ0cHWJBkI4w4DSzSqx9+fWw8WxaNeHRFurbDS 28cqGO7FjkfeXVE4l1d7JW2VE2hxlHo4zIWT0KJfzJ6cXjkSDWeF3Cn5tjqdSc+IoEeUYt/KT xmLJNHI4KEsaKyMxOS0/TA2Uw+1vJUXeo4ERg6jOSyTqbyotKO4Rf0EJ9HoJ6CPJqHZ80sdOp GU8oW68vcNDeuPXFhzd0zHYMIrLHdP1SjJ3id0pDfZWxcnGBA/6cXwjEKVcmxitXXGTTIcEDW hOY/xlpijCx2UxAK+aTDa6q9NSL5gPsB1gEOci5+aLt+ZAqBD/qJRwNWiNVWdtl7cpyoM1Rnt uCKH7VnmuqTN3hJ3SoqLEw0LmvsTLiwwcjeJyYBXQ60/bDTgcoF0zAPN7zpUiWimGOFeVMhub usP/44lqKL7GGu7hG8pTR2BjN8XwJ98RM0plbqpuW3oi/gmnbvSBg3gRjtWfnUfKB464nizoC j4rCFQgt1ffip5sIusR2xYZfSoAmVHofEI4MClDtefSLRUUpfr8VRet5kP1EiZ3/hbyIIRp3m 85+nUPPm5CHyQZt9b8bfol/8I5BmlDY2XP8ZA9j7VlPePzR0mp3gkn3s/niVv8ndNX93H5yDR aE8EgdUvHpF3Q1cLO33KutOMplv/n/61Eg3cBwRbxOiRukZamUlLgQvFW7+yJRZxzac15zSgx JJ0ax0++Xvua5WXN1PdKowbvMAlgYNR/6W/9opEZrtYwgGpirLvRFSzWrRDl8bAgk4uksHdeD 92rdQipwb7tiSo0bheMQ== Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org This header is empty and conflicts with the s3c24xx version of the same file when we merge the two, so stop including it. Signed-off-by: Arnd Bergmann --- arch/arm/mach-s3c64xx/common.c | 1 - arch/arm/mach-s3c64xx/dev-uart.c | 1 - arch/arm/mach-s3c64xx/include/mach/hardware.h | 17 ----------------- arch/arm/mach-s3c64xx/mach-anw6410.c | 1 - arch/arm/mach-s3c64xx/mach-crag6410.c | 1 - arch/arm/mach-s3c64xx/mach-hmt.c | 1 - arch/arm/mach-s3c64xx/mach-ncp.c | 1 - arch/arm/mach-s3c64xx/mach-smdk6400.c | 1 - arch/arm/mach-s3c64xx/mach-smdk6410.c | 1 - arch/arm/mach-s3c64xx/s3c6400.c | 1 - arch/arm/mach-s3c64xx/s3c6410.c | 1 - 11 files changed, 27 deletions(-) delete mode 100644 arch/arm/mach-s3c64xx/include/mach/hardware.h -- 2.20.0 Acked-by: Charles Keepax diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c index 13e91074308a..19d544f6808a 100644 --- a/arch/arm/mach-s3c64xx/common.c +++ b/arch/arm/mach-s3c64xx/common.c @@ -36,7 +36,6 @@ #include #include -#include #include #include diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c index 5fb59ad30008..021a2b7926fa 100644 --- a/arch/arm/mach-s3c64xx/dev-uart.c +++ b/arch/arm/mach-s3c64xx/dev-uart.c @@ -15,7 +15,6 @@ #include #include -#include #include #include diff --git a/arch/arm/mach-s3c64xx/include/mach/hardware.h b/arch/arm/mach-s3c64xx/include/mach/hardware.h deleted file mode 100644 index c4ed359474de..000000000000 --- a/arch/arm/mach-s3c64xx/include/mach/hardware.h +++ /dev/null @@ -1,17 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -/* linux/arch/arm/mach-s3c6400/include/mach/hardware.h - * - * Copyright 2008 Openmoko, Inc. - * Copyright 2008 Simtec Electronics - * Ben Dooks - * http://armlinux.simtec.co.uk/ - * - * S3C6400 - Hardware support - */ - -#ifndef __ASM_ARCH_HARDWARE_H -#define __ASM_ARCH_HARDWARE_H __FILE__ - -/* currently nothing here, placeholder */ - -#endif /* __ASM_ARCH_IRQ_H */ diff --git a/arch/arm/mach-s3c64xx/mach-anw6410.c b/arch/arm/mach-s3c64xx/mach-anw6410.c index 0d3d5befb806..44858c5aea5d 100644 --- a/arch/arm/mach-s3c64xx/mach-anw6410.c +++ b/arch/arm/mach-s3c64xx/mach-anw6410.c @@ -30,7 +30,6 @@ #include #include -#include #include #include diff --git a/arch/arm/mach-s3c64xx/mach-crag6410.c b/arch/arm/mach-s3c64xx/mach-crag6410.c index 8ec6a4f5eb05..da5b50981a14 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410.c @@ -44,7 +44,6 @@ #include #include