From patchwork Mon Apr 15 20:24:13 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10901489 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6ABDD13B5 for ; Mon, 15 Apr 2019 20:25:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4D5F7287FF for ; Mon, 15 Apr 2019 20:25:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 417DC288DD; Mon, 15 Apr 2019 20:25:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 44BAB2883F for ; Mon, 15 Apr 2019 20:25:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tdzB4+41JaWMhUW5iTZkhDMpzQ1zpGz6X+TD+E1pbXM=; b=pOY+w5nGx14gWk 27/t4Y8c7yrF8AyTVsqZ80UhDD9WdOV+wtAa05ECvYR0vmhKy6nkBPvD84Z+2ldje8JV7q69ke/6w LVcKIhkru2LGwPDQ/VvU9tQe+rRrA1k32R2pf6/6DUfyipzPDvsGzFFh0E8MyPabf+TFLT0Za6AMw yTwQDT+ib1elHvZjPvwjz6OYr4ey2vbRtapWOBxOySDp3Try7MJwMxn9W+DjbAooxwq2dxgl0Wk4H /7D1GDzyXBZCEP0YzIdFj/0fJByNoDk6fLzrh58IZ/ttmOu2m9J2dgYqFXXoO+AmPXWoaA9heKfIL 36pWM75z1+TaD/26NLBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8AW-0006pO-NU; Mon, 15 Apr 2019 20:25:32 +0000 Received: from mout.kundenserver.de ([212.227.126.131]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8AU-0006p2-1q for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 20:25:31 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1Macf4-1gjXR22qiY-00cDX5; Mon, 15 Apr 2019 22:25:06 +0200 From: Arnd Bergmann To: Greg Ungerer Subject: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Date: Mon, 15 Apr 2019 22:24:13 +0200 Message-Id: <20190415202501.941196-1-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 MIME-Version: 1.0 X-Provags-ID: V03:K1:3f0N7e03dpDdEs2wFtzwS0wRc0tVAs7W6slwO/9ZNkRveBQIjcS bm4Kk2zlsXHtNp6ivUcyOVN3NHYArHErq8bNj2eKnYJh+VMwm8BYplE1+TMUj3wuEl3UMHu xuwifGzbWpilUzrkx6snzAfW3nWp+Dc8SiAvqtdCc2D0kGJqB/uRVm8Kc3k47bgPHivbyAB LsM+6YV4gTQAJ79yOsakA== X-UI-Out-Filterresults: notjunk:1;V03:K0:lishDkrJYUI=:Rg/rjkvrXx+dapNCpggbg8 KL2QAoY8mgIU7lQn3xtTlbSJdjVKysqV3KoJmb0RPKVoUF0MKptbJwmi1uqNex14l5fLkAjk1 mOWjJ+OYHFITg7GCwGMtPZZPlMeTWbzlix7c46jz7dHBxhLAtF7dcc07EeMTRzYZ6WNc6jlb0 MEm/Cvr5OuzVTiN4LRfYkiDZ6lgNrb3Jt7/N+ePrJ0sYGxgDV8xHDWJnFkNYAd//PMpCteYfa YH0dIUZGkNq826yDHCevz8KpnnWjruM/9eeQV89/mFpUDlfeThRcv+tGksw0/7v0c+K5HmDFV urSd9qS0ZH7eNid8C+1c+VVWdiV3YXg/ecRYAzijeYqKqleX+k2QHjaOQpADXVkHu8CeSfXcW UKWY1MKoqbfREaBoJyjctjhtRxSyeBb/NPWMjMUb5jglLDbs96ESZ30e7RArj57HPoPHPa9kr r65YOGI6y9G1oSXtdUb+SeTk8o7+zrrlUfI7P4Czu3gdxy80xcaHC3J9qOPqN0RPgVQ0JlnGM y3+/SzwuscWKgiamxQhqxZaakA+DDn/z+BPWX7q5wua9uSX+jD+iJ0GQpOkKKFfxya84at/Um K0M+c+/LKxAHh1JwW/myDO+QXyUmMr45bBJwUfK3U5dUSsGba6GlpjmE9fYfMvOjD+z29qQ2J Mw/m/RAMoAGWIAf2er7eNVgDiCBYL4TToWKlCZFYotTilexwYkNEmH6XL1NRkwPgSPQ0SIM5N s9REX+/W0ovB8/Ft48Lz2xDe/MOni9MGKesk7A== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_132530_396093_4C68E6D6 X-CRM114-Status: GOOD ( 15.73 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-watchdog@vger.kernel.org, Arnd Bergmann , Linus Walleij , linux-kernel@vger.kernel.org, arm@kernel.org, Guenter Roeck , Wim Van Sebroeck , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP drivers should not rely on machine specific headers but get their information from the platform device. Signed-off-by: Arnd Bergmann Acked-by: Greg Ungerer --- arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 30 +++++++++++++++++------------- 3 files changed, 30 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c index 61cf20beb45f..57766817d86f 100644 --- a/arch/arm/mach-ks8695/devices.c +++ b/arch/arm/mach-ks8695/devices.c @@ -169,11 +169,22 @@ void __init ks8696_add_device_hpna(void) /* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */ +#define KS8695_TMR_OFFSET (0xF0000 + 0xE400) +#define KS8695_TMR_PA (KS8695_IO_PA + KS8695_TMR_OFFSET) +static struct resource ks8695_wdt_resources[] = { + [0] = { + .name = "tmr", + .start = KS8695_TMR_PA, + .end = KS8695_TMR_PA + 0xf, + .flags = IORESOURCE_MEM, + }, +}; static struct platform_device ks8695_wdt_device = { .name = "ks8695_wdt", .id = -1, - .num_resources = 0, + .resource = ks8695_wdt_resources, + .num_resources = ARRAY_SIZE(ks8695_wdt_resources), }; static void __init ks8695_add_device_watchdog(void) diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index 242eea859637..046e01daef57 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -397,7 +397,7 @@ config IXP4XX_WATCHDOG config KS8695_WATCHDOG tristate "KS8695 watchdog" - depends on ARCH_KS8695 + depends on ARCH_KS8695 || COMPILE_TEST help Watchdog timer embedded into KS8695 processor. This will reboot your system when the timeout is reached. diff --git a/drivers/watchdog/ks8695_wdt.c b/drivers/watchdog/ks8695_wdt.c index 1e41818a44bc..87c542c2f912 100644 --- a/drivers/watchdog/ks8695_wdt.c +++ b/drivers/watchdog/ks8695_wdt.c @@ -23,10 +23,8 @@ #include #include #include -#include -#define KS8695_TMR_OFFSET (0xF0000 + 0xE400) -#define KS8695_TMR_VA (KS8695_IO_VA + KS8695_TMR_OFFSET) +#define KS8695_CLOCK_RATE 25000000 /* * Timer registers @@ -57,6 +55,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" static unsigned long ks8695wdt_busy; static DEFINE_SPINLOCK(ks8695_lock); +static void __iomem *tmr_reg; /* ......................................................................... */ @@ -69,8 +68,8 @@ static inline void ks8695_wdt_stop(void) spin_lock(&ks8695_lock); /* disable timer0 */ - tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON); - __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON); + tmcon = __raw_readl(tmr_reg + KS8695_TMCON); + __raw_writel(tmcon & ~TMCON_T0EN, tmr_reg + KS8695_TMCON); spin_unlock(&ks8695_lock); } @@ -84,15 +83,15 @@ static inline void ks8695_wdt_start(void) spin_lock(&ks8695_lock); /* disable timer0 */ - tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON); - __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON); + tmcon = __raw_readl(tmr_reg + KS8695_TMCON); + __raw_writel(tmcon & ~TMCON_T0EN, tmr_reg + KS8695_TMCON); /* program timer0 */ - __raw_writel(tval | T0TC_WATCHDOG, KS8695_TMR_VA + KS8695_T0TC); + __raw_writel(tval | T0TC_WATCHDOG, tmr_reg + KS8695_T0TC); /* re-enable timer0 */ - tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON); - __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON); + tmcon = __raw_readl(tmr_reg + KS8695_TMCON); + __raw_writel(tmcon | TMCON_T0EN, tmr_reg + KS8695_TMCON); spin_unlock(&ks8695_lock); } @@ -105,9 +104,9 @@ static inline void ks8695_wdt_reload(void) spin_lock(&ks8695_lock); /* disable, then re-enable timer0 */ - tmcon = __raw_readl(KS8695_TMR_VA + KS8695_TMCON); - __raw_writel(tmcon & ~TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON); - __raw_writel(tmcon | TMCON_T0EN, KS8695_TMR_VA + KS8695_TMCON); + tmcon = __raw_readl(tmr_reg + KS8695_TMCON); + __raw_writel(tmcon & ~TMCON_T0EN, tmr_reg + KS8695_TMCON); + __raw_writel(tmcon | TMCON_T0EN, tmr_reg + KS8695_TMCON); spin_unlock(&ks8695_lock); } @@ -238,6 +237,11 @@ static struct miscdevice ks8695wdt_miscdev = { static int ks8695wdt_probe(struct platform_device *pdev) { int res; + struct resource *resource = platform_get_resource(pdev, IORESOURCE_MEM, 0); + + tmr_reg = devm_ioremap_resource(&pdev->dev, resource); + if (!tmr_reg) + return -ENXIO; if (ks8695wdt_miscdev.parent) return -EBUSY; From patchwork Mon Apr 15 20:24:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10901491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9D0DB1800 for ; Mon, 15 Apr 2019 20:26:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7DC0D28820 for ; Mon, 15 Apr 2019 20:26:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 71B82288EE; Mon, 15 Apr 2019 20:26:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6170528820 for ; Mon, 15 Apr 2019 20:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=I8Qf8UZsewAblj43u/hZcRLmSYA6gEux5HCseFb6vNc=; b=Mvq55ba7mM4bTE jlWQ5et9TZjQmcYa87bDZHuKnLoFnW6Z4rQ6MRdt/uLghdm+cvShBpbCqKRcjqcMRb0ZO7amPqlih vd9lsYElGAKRVgQRoQuKp/+zY0WrNOeTksH47T80HQ3dnGLkCkQ+8JSUUaaWIMib/EEVBAR8XCvEn 4ZkLkLcW2dQkmgCpCWXYw4QIqVbXkU/33pPN8SpCVph3uLIQPoc6/tN4awQNVd1urvPFWlL5AxTe2 K1dLHD4mQTmLDgD60Ktv0A+5plJrSZGolfGOh10jpDWRrFgvoVlumUrS/Ia7Hhq/+tnrNjLRCZr+L dOPdGbgntNay5gTL6MTQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8BM-00075Q-NY; Mon, 15 Apr 2019 20:26:24 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8BD-000755-Rc for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 20:26:22 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1N2lv2-1gqaRJ31GW-0133p3; Mon, 15 Apr 2019 22:26:09 +0200 From: Arnd Bergmann To: Greg Ungerer Subject: [PATCH 3/6] ARM: ks8695: net: move machine header contents Date: Mon, 15 Apr 2019 22:24:15 +0200 Message-Id: <20190415202501.941196-3-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190415202501.941196-1-arnd@arndb.de> References: <20190415202501.941196-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:IyfXVAi6CM4P9EgizpcZtkIJmhbyjrAob6YPsAkHaOiC5wwZcAM JBIISStr63qoAtDqcrnpjyPjQUJcZYOrpZ5042zmbYmDnE2vixbY3aeROfCJRYIr+fUPlTP 0Za7FKYLdDqz00vWk4MvoV/KGJGjBV6iq2iZJPHA3ByK5jqsXfTGi/b6IiXdm3+UNxLlIFc 6jXPd9Emj6eK7OIUpp1/A== X-UI-Out-Filterresults: notjunk:1;V03:K0:TS3Bx3A2MW8=:PZk6d1DO7MqupR58Mr7c6E aSFgZXy4XgEks2Yl+ZDSyutKO82QM/DqGt02gTR9Di7cr28BA5jQve+OE6e/rD1Exh/XpYkYO bPiHk7WJODOSanUAZRFmRhG4KFM2oHycJdTNEcb2ymUKTiabo0wp/3+PpeuGd10lcXxTEnmFK /kq8wOcZJ2W4CRXqtobWYZS15wZ7JPXeYl4ZdO4Q7//Agxub1Wv4I1lGiKY0/7LmCc0QYNrwp IAFpDRMzcBso8bY+x9wwIOuwrioowqNPJispVgD/Ps+VUt0tsgoNVzPgnRcSX6UJq1n+m/9Ze UCbTWEMBsLVgEy2OuBAQXDB6pU5G6vL1dSLpLoFm/CwzUBjPUJIq9TaksyLTXph8LJLqMNuCj WjH7xP+Qg6w52Z9IUlENGKfwqY24Y9GN1NjIKhhiiRT0yxzmrSck3i3wQlHz2yh+e4oR4s1O1 VOL+rgJ39c93E0FPmpJzA/eHrsXc1LkH3uEzHOVdbPVzhFKC3Xsjxn3kF39yXGrw54zdhpUdh XEVMI5ZaSBaMBe84YQZen+mjSRTX5t1OsXALsv1mvmhQi4g52NGpGVx/XTkAjXg8ayFfeO88T ZOI7AZGoSzcDq53nmRRwM89Tu9QZPu9k2m64tRw7XdNyhMeV7abqllanzF+qt8ReMyqeLFWYt qN1kQV426geJnjggbfBBlEneRzJBTotdLqbeOGsVa2SznqpuQ13+Et1/4WKRts0MOQ43gsvrF QhMcky6MR+1Kxj0l5njnpYA+LlGZ5C9SU7UBZg== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_132616_193864_8625B9A2 X-CRM114-Status: GOOD ( 18.82 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , netdev@vger.kernel.org, Linus Walleij , linux-kernel@vger.kernel.org, arm@kernel.org, "David S. Miller" , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Parts of the headers are only used by the ethernet driver, other parts are only used in the machine definitions. Move everything to the appropriate place that lets us kill off the global headers and allow build testing on other architectures. Signed-off-by: Arnd Bergmann --- arch/arm/mach-ks8695/cpu.c | 2 +- arch/arm/mach-ks8695/devices.c | 5 +- arch/arm/mach-ks8695/include/mach/regs-misc.h | 97 --------------- .../mach-ks8695/include/mach/regs-switch.h | 66 ---------- arch/arm/mach-ks8695/regs-misc.h | 33 +++++ arch/arm/mach-ks8695/regs-switch.h | 18 +++ drivers/net/ethernet/micrel/Kconfig | 2 +- drivers/net/ethernet/micrel/ks8695net.c | 116 ++++++++++++++++-- 8 files changed, 164 insertions(+), 175 deletions(-) delete mode 100644 arch/arm/mach-ks8695/include/mach/regs-misc.h delete mode 100644 arch/arm/mach-ks8695/include/mach/regs-switch.h create mode 100644 arch/arm/mach-ks8695/regs-misc.h create mode 100644 arch/arm/mach-ks8695/regs-switch.h diff --git a/arch/arm/mach-ks8695/cpu.c b/arch/arm/mach-ks8695/cpu.c index 7a1c4caa1ab5..7eadf73c7e30 100644 --- a/arch/arm/mach-ks8695/cpu.c +++ b/arch/arm/mach-ks8695/cpu.c @@ -31,7 +31,7 @@ #include #include "regs-sys.h" -#include +#include "regs-misc.h" static struct map_desc ks8695_io_desc[] __initdata = { diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c index 57766817d86f..6bd50a8f12f9 100644 --- a/arch/arm/mach-ks8695/devices.c +++ b/arch/arm/mach-ks8695/devices.c @@ -27,9 +27,8 @@ #include "regs-wan.h" #include "regs-lan.h" #include "regs-hpna.h" -#include -#include - +#include "regs-switch.h" +#include "regs-misc.h" /* -------------------------------------------------------------------- * Ethernet diff --git a/arch/arm/mach-ks8695/include/mach/regs-misc.h b/arch/arm/mach-ks8695/include/mach/regs-misc.h deleted file mode 100644 index 2740c52494a0..000000000000 --- a/arch/arm/mach-ks8695/include/mach/regs-misc.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * arch/arm/mach-ks8695/include/mach/regs-misc.h - * - * Copyright (C) 2006 Andrew Victor - * - * KS8695 - Miscellaneous Registers - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef KS8695_MISC_H -#define KS8695_MISC_H - -#define KS8695_MISC_OFFSET (0xF0000 + 0xEA00) -#define KS8695_MISC_VA (KS8695_IO_VA + KS8695_MISC_OFFSET) -#define KS8695_MISC_PA (KS8695_IO_PA + KS8695_MISC_OFFSET) - - -/* - * Miscellaneous registers - */ -#define KS8695_DID (0x00) /* Device ID */ -#define KS8695_RID (0x04) /* Revision ID */ -#define KS8695_HMC (0x08) /* HPNA Miscellaneous Control [KS8695 only] */ -#define KS8695_WMC (0x0c) /* WAN Miscellaneous Control */ -#define KS8695_WPPM (0x10) /* WAN PHY Power Management */ -#define KS8695_PPS (0x1c) /* PHY PowerSave */ - -/* Device ID Register */ -#define DID_ID (0xffff << 0) /* Device ID */ - -/* Revision ID Register */ -#define RID_SUBID (0xf << 4) /* Sub-Device ID */ -#define RID_REVISION (0xf << 0) /* Revision ID */ - -/* HPNA Miscellaneous Control Register */ -#define HMC_HSS (1 << 1) /* Speed */ -#define HMC_HDS (1 << 0) /* Duplex */ - -/* WAN Miscellaneous Control Register */ -#define WMC_WANC (1 << 30) /* Auto-negotiation complete */ -#define WMC_WANR (1 << 29) /* Auto-negotiation restart */ -#define WMC_WANAP (1 << 28) /* Advertise Pause */ -#define WMC_WANA100F (1 << 27) /* Advertise 100 FDX */ -#define WMC_WANA100H (1 << 26) /* Advertise 100 HDX */ -#define WMC_WANA10F (1 << 25) /* Advertise 10 FDX */ -#define WMC_WANA10H (1 << 24) /* Advertise 10 HDX */ -#define WMC_WLS (1 << 23) /* Link status */ -#define WMC_WDS (1 << 22) /* Duplex status */ -#define WMC_WSS (1 << 21) /* Speed status */ -#define WMC_WLPP (1 << 20) /* Link Partner Pause */ -#define WMC_WLP100F (1 << 19) /* Link Partner 100 FDX */ -#define WMC_WLP100H (1 << 18) /* Link Partner 100 HDX */ -#define WMC_WLP10F (1 << 17) /* Link Partner 10 FDX */ -#define WMC_WLP10H (1 << 16) /* Link Partner 10 HDX */ -#define WMC_WAND (1 << 15) /* Auto-negotiation disable */ -#define WMC_WANF100 (1 << 14) /* Force 100 */ -#define WMC_WANFF (1 << 13) /* Force FDX */ -#define WMC_WLED1S (7 << 4) /* LED1 Select */ -#define WLED1S_SPEED (0 << 4) -#define WLED1S_LINK (1 << 4) -#define WLED1S_DUPLEX (2 << 4) -#define WLED1S_COLLISION (3 << 4) -#define WLED1S_ACTIVITY (4 << 4) -#define WLED1S_FDX_COLLISION (5 << 4) -#define WLED1S_LINK_ACTIVITY (6 << 4) -#define WMC_WLED0S (7 << 0) /* LED0 Select */ -#define WLED0S_SPEED (0 << 0) -#define WLED0S_LINK (1 << 0) -#define WLED0S_DUPLEX (2 << 0) -#define WLED0S_COLLISION (3 << 0) -#define WLED0S_ACTIVITY (4 << 0) -#define WLED0S_FDX_COLLISION (5 << 0) -#define WLED0S_LINK_ACTIVITY (6 << 0) - -/* WAN PHY Power Management Register */ -#define WPPM_WLPBK (1 << 14) /* Local Loopback */ -#define WPPM_WRLPKB (1 << 13) /* Remove Loopback */ -#define WPPM_WPI (1 << 12) /* PHY isolate */ -#define WPPM_WFL (1 << 10) /* Force link */ -#define WPPM_MDIXS (1 << 9) /* MDIX Status */ -#define WPPM_FEF (1 << 8) /* Far End Fault */ -#define WPPM_AMDIXP (1 << 7) /* Auto MDIX Parameter */ -#define WPPM_TXDIS (1 << 6) /* Disable transmitter */ -#define WPPM_DFEF (1 << 5) /* Disable Far End Fault */ -#define WPPM_PD (1 << 4) /* Power Down */ -#define WPPM_DMDX (1 << 3) /* Disable Auto MDI/MDIX */ -#define WPPM_FMDX (1 << 2) /* Force MDIX */ -#define WPPM_LPBK (1 << 1) /* MAX Loopback */ - -/* PHY Power Save Register */ -#define PPS_PPSM (1 << 0) /* PHY Power Save Mode */ - - -#endif diff --git a/arch/arm/mach-ks8695/include/mach/regs-switch.h b/arch/arm/mach-ks8695/include/mach/regs-switch.h deleted file mode 100644 index 97e8acb1cf6c..000000000000 --- a/arch/arm/mach-ks8695/include/mach/regs-switch.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * arch/arm/mach-ks8695/include/mach/regs-switch.h - * - * Copyright (C) 2006 Andrew Victor - * - * KS8695 - Switch Registers and bit definitions. - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. - */ - -#ifndef KS8695_SWITCH_H -#define KS8695_SWITCH_H - -#define KS8695_SWITCH_OFFSET (0xF0000 + 0xe800) -#define KS8695_SWITCH_VA (KS8695_IO_VA + KS8695_SWITCH_OFFSET) -#define KS8695_SWITCH_PA (KS8695_IO_PA + KS8695_SWITCH_OFFSET) - - -/* - * Switch registers - */ -#define KS8695_SEC0 (0x00) /* Switch Engine Control 0 */ -#define KS8695_SEC1 (0x04) /* Switch Engine Control 1 */ -#define KS8695_SEC2 (0x08) /* Switch Engine Control 2 */ - -#define KS8695_SEPXCZ(x,z) (0x0c + (((x)-1)*3 + ((z)-1))*4) /* Port Configuration Registers */ - -#define KS8695_SEP12AN (0x48) /* Port 1 & 2 Auto-Negotiation */ -#define KS8695_SEP34AN (0x4c) /* Port 3 & 4 Auto-Negotiation */ -#define KS8695_SEIAC (0x50) /* Indirect Access Control */ -#define KS8695_SEIADH2 (0x54) /* Indirect Access Data High 2 */ -#define KS8695_SEIADH1 (0x58) /* Indirect Access Data High 1 */ -#define KS8695_SEIADL (0x5c) /* Indirect Access Data Low */ -#define KS8695_SEAFC (0x60) /* Advance Feature Control */ -#define KS8695_SEDSCPH (0x64) /* TOS Priority High */ -#define KS8695_SEDSCPL (0x68) /* TOS Priority Low */ -#define KS8695_SEMAH (0x6c) /* Switch Engine MAC Address High */ -#define KS8695_SEMAL (0x70) /* Switch Engine MAC Address Low */ -#define KS8695_LPPM12 (0x74) /* Port 1 & 2 PHY Power Management */ -#define KS8695_LPPM34 (0x78) /* Port 3 & 4 PHY Power Management */ - - -/* Switch Engine Control 0 */ -#define SEC0_LLED1S (7 << 25) /* LED1 Select */ -#define LLED1S_SPEED (0 << 25) -#define LLED1S_LINK (1 << 25) -#define LLED1S_DUPLEX (2 << 25) -#define LLED1S_COLLISION (3 << 25) -#define LLED1S_ACTIVITY (4 << 25) -#define LLED1S_FDX_COLLISION (5 << 25) -#define LLED1S_LINK_ACTIVITY (6 << 25) -#define SEC0_LLED0S (7 << 22) /* LED0 Select */ -#define LLED0S_SPEED (0 << 22) -#define LLED0S_LINK (1 << 22) -#define LLED0S_DUPLEX (2 << 22) -#define LLED0S_COLLISION (3 << 22) -#define LLED0S_ACTIVITY (4 << 22) -#define LLED0S_FDX_COLLISION (5 << 22) -#define LLED0S_LINK_ACTIVITY (6 << 22) -#define SEC0_ENABLE (1 << 0) /* Enable Switch */ - - - -#endif diff --git a/arch/arm/mach-ks8695/regs-misc.h b/arch/arm/mach-ks8695/regs-misc.h new file mode 100644 index 000000000000..54866182c5b9 --- /dev/null +++ b/arch/arm/mach-ks8695/regs-misc.h @@ -0,0 +1,33 @@ +/* + * arch/arm/mach-ks8695/include/mach/regs-misc.h + * + * Copyright (C) 2006 Andrew Victor + * + * KS8695 - Miscellaneous Registers + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#ifndef KS8695_MISC_H +#define KS8695_MISC_H + +#define KS8695_MISC_OFFSET (0xF0000 + 0xEA00) +#define KS8695_MISC_VA (KS8695_IO_VA + KS8695_MISC_OFFSET) +#define KS8695_MISC_PA (KS8695_IO_PA + KS8695_MISC_OFFSET) + +/* + * Miscellaneous registers + */ +#define KS8695_DID (0x00) /* Device ID */ +#define KS8695_RID (0x04) /* Revision ID */ + +/* Device ID Register */ +#define DID_ID (0xffff << 0) /* Device ID */ + +/* Revision ID Register */ +#define RID_SUBID (0xf << 4) /* Sub-Device ID */ +#define RID_REVISION (0xf << 0) /* Revision ID */ + +#endif diff --git a/arch/arm/mach-ks8695/regs-switch.h b/arch/arm/mach-ks8695/regs-switch.h new file mode 100644 index 000000000000..4b33b4bdc1b0 --- /dev/null +++ b/arch/arm/mach-ks8695/regs-switch.h @@ -0,0 +1,18 @@ +/* + * Copyright (C) 2006 Andrew Victor + * + * KS8695 - Switch Registers and bit definitions. + * + * This file is licensed under the terms of the GNU General Public + * License version 2. This program is licensed "as is" without any + * warranty of any kind, whether express or implied. + */ + +#ifndef KS8695_SWITCH_H +#define KS8695_SWITCH_H + +#define KS8695_SWITCH_OFFSET (0xF0000 + 0xe800) +#define KS8695_SWITCH_VA (KS8695_IO_VA + KS8695_SWITCH_OFFSET) +#define KS8695_SWITCH_PA (KS8695_IO_PA + KS8695_SWITCH_OFFSET) + +#endif diff --git a/drivers/net/ethernet/micrel/Kconfig b/drivers/net/ethernet/micrel/Kconfig index b7e2f49696b7..c5027014a8e9 100644 --- a/drivers/net/ethernet/micrel/Kconfig +++ b/drivers/net/ethernet/micrel/Kconfig @@ -19,7 +19,7 @@ if NET_VENDOR_MICREL config ARM_KS8695_ETHER tristate "KS8695 Ethernet support" - depends on ARM && ARCH_KS8695 + depends on (ARM && ARCH_KS8695) || COMPILE_TEST select MII ---help--- If you wish to compile a kernel for the KS8695 and want to diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c index 3b6375adff08..8e8037a83ed9 100644 --- a/drivers/net/ethernet/micrel/ks8695net.c +++ b/drivers/net/ethernet/micrel/ks8695net.c @@ -33,18 +33,120 @@ #include #include -#include - -#include -#include -#include -#include - #include "ks8695net.h" #define MODULENAME "ks8695_ether" #define MODULEVERSION "1.02" +#define KS8695_HMC (0x08) /* HPNA Miscellaneous Control [KS8695 only] */ +#define KS8695_WMC (0x0c) /* WAN Miscellaneous Control */ +#define KS8695_WPPM (0x10) /* WAN PHY Power Management */ +#define KS8695_PPS (0x1c) /* PHY PowerSave */ + + +/* WAN Miscellaneous Control Register */ +#define WMC_WANC (1 << 30) /* Auto-negotiation complete */ +#define WMC_WANR (1 << 29) /* Auto-negotiation restart */ +#define WMC_WANAP (1 << 28) /* Advertise Pause */ +#define WMC_WANA100F (1 << 27) /* Advertise 100 FDX */ +#define WMC_WANA100H (1 << 26) /* Advertise 100 HDX */ +#define WMC_WANA10F (1 << 25) /* Advertise 10 FDX */ +#define WMC_WANA10H (1 << 24) /* Advertise 10 HDX */ +#define WMC_WLS (1 << 23) /* Link status */ +#define WMC_WDS (1 << 22) /* Duplex status */ +#define WMC_WSS (1 << 21) /* Speed status */ +#define WMC_WLPP (1 << 20) /* Link Partner Pause */ +#define WMC_WLP100F (1 << 19) /* Link Partner 100 FDX */ +#define WMC_WLP100H (1 << 18) /* Link Partner 100 HDX */ +#define WMC_WLP10F (1 << 17) /* Link Partner 10 FDX */ +#define WMC_WLP10H (1 << 16) /* Link Partner 10 HDX */ +#define WMC_WAND (1 << 15) /* Auto-negotiation disable */ +#define WMC_WANF100 (1 << 14) /* Force 100 */ +#define WMC_WANFF (1 << 13) /* Force FDX */ +#define WMC_WLED1S (7 << 4) /* LED1 Select */ +#define WLED1S_SPEED (0 << 4) +#define WLED1S_LINK (1 << 4) +#define WLED1S_DUPLEX (2 << 4) +#define WLED1S_COLLISION (3 << 4) +#define WLED1S_ACTIVITY (4 << 4) +#define WLED1S_FDX_COLLISION (5 << 4) +#define WLED1S_LINK_ACTIVITY (6 << 4) +#define WMC_WLED0S (7 << 0) /* LED0 Select */ +#define WLED0S_SPEED (0 << 0) +#define WLED0S_LINK (1 << 0) +#define WLED0S_DUPLEX (2 << 0) +#define WLED0S_COLLISION (3 << 0) +#define WLED0S_ACTIVITY (4 << 0) +#define WLED0S_FDX_COLLISION (5 << 0) +#define WLED0S_LINK_ACTIVITY (6 << 0) + +/* + * Switch registers + */ +#define KS8695_SEC0 (0x00) /* Switch Engine Control 0 */ +#define KS8695_SEC1 (0x04) /* Switch Engine Control 1 */ +#define KS8695_SEC2 (0x08) /* Switch Engine Control 2 */ + +#define KS8695_SEPXCZ(x,z) (0x0c + (((x)-1)*3 + ((z)-1))*4) /* Port Configuration Registers */ + +#define KS8695_SEP12AN (0x48) /* Port 1 & 2 Auto-Negotiation */ +#define KS8695_SEP34AN (0x4c) /* Port 3 & 4 Auto-Negotiation */ +#define KS8695_SEIAC (0x50) /* Indirect Access Control */ +#define KS8695_SEIADH2 (0x54) /* Indirect Access Data High 2 */ +#define KS8695_SEIADH1 (0x58) /* Indirect Access Data High 1 */ +#define KS8695_SEIADL (0x5c) /* Indirect Access Data Low */ +#define KS8695_SEAFC (0x60) /* Advance Feature Control */ +#define KS8695_SEDSCPH (0x64) /* TOS Priority High */ +#define KS8695_SEDSCPL (0x68) /* TOS Priority Low */ +#define KS8695_SEMAH (0x6c) /* Switch Engine MAC Address High */ +#define KS8695_SEMAL (0x70) /* Switch Engine MAC Address Low */ +#define KS8695_LPPM12 (0x74) /* Port 1 & 2 PHY Power Management */ +#define KS8695_LPPM34 (0x78) /* Port 3 & 4 PHY Power Management */ + + +/* Switch Engine Control 0 */ +#define SEC0_LLED1S (7 << 25) /* LED1 Select */ +#define LLED1S_SPEED (0 << 25) +#define LLED1S_LINK (1 << 25) +#define LLED1S_DUPLEX (2 << 25) +#define LLED1S_COLLISION (3 << 25) +#define LLED1S_ACTIVITY (4 << 25) +#define LLED1S_FDX_COLLISION (5 << 25) +#define LLED1S_LINK_ACTIVITY (6 << 25) +#define SEC0_LLED0S (7 << 22) /* LED0 Select */ +#define LLED0S_SPEED (0 << 22) +#define LLED0S_LINK (1 << 22) +#define LLED0S_DUPLEX (2 << 22) +#define LLED0S_COLLISION (3 << 22) +#define LLED0S_ACTIVITY (4 << 22) +#define LLED0S_FDX_COLLISION (5 << 22) +#define LLED0S_LINK_ACTIVITY (6 << 22) +#define SEC0_ENABLE (1 << 0) /* Enable Switch */ + + +/* HPNA Miscellaneous Control Register */ +#define HMC_HSS (1 << 1) /* Speed */ +#define HMC_HDS (1 << 0) /* Duplex */ + +/* WAN PHY Power Management Register */ +#define WPPM_WLPBK (1 << 14) /* Local Loopback */ +#define WPPM_WRLPKB (1 << 13) /* Remove Loopback */ +#define WPPM_WPI (1 << 12) /* PHY isolate */ +#define WPPM_WFL (1 << 10) /* Force link */ +#define WPPM_MDIXS (1 << 9) /* MDIX Status */ +#define WPPM_FEF (1 << 8) /* Far End Fault */ +#define WPPM_AMDIXP (1 << 7) /* Auto MDIX Parameter */ +#define WPPM_TXDIS (1 << 6) /* Disable transmitter */ +#define WPPM_DFEF (1 << 5) /* Disable Far End Fault */ +#define WPPM_PD (1 << 4) /* Power Down */ +#define WPPM_DMDX (1 << 3) /* Disable Auto MDI/MDIX */ +#define WPPM_FMDX (1 << 2) /* Force MDIX */ +#define WPPM_LPBK (1 << 1) /* MAX Loopback */ + +/* PHY Power Save Register */ +#define PPS_PPSM (1 << 0) /* PHY Power Save Mode */ + + /* * Transmit and device reset timeout, default 5 seconds. */ From patchwork Mon Apr 15 20:24:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10901495 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 609EB1800 for ; Mon, 15 Apr 2019 20:27:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E812288DD for ; Mon, 15 Apr 2019 20:27:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2EF19288EF; Mon, 15 Apr 2019 20:27:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id A5E03288DD for ; Mon, 15 Apr 2019 20:27:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ugMy3GVvEOtgU7n+rYdkZj0n1PnJjWuJeCDLLxeyfow=; b=qJFJP2cFbCWATE TnsaRQ91m+dWV3KXhgyZQvPno5c4ek4xLckjtmdAfjVBOT5RAeKXZRs557xbuWdDFwxSkw/wEqoiE 5/q8sJ8i9fP+UCxmAeuOdXxibjNhDW20nI69gUlsnAsP/eTjeD8CaDwTm3NFW8ynYAB89KKC7w38w /PsRslnNGEFwwcUfi/QMU3oUK6ADsk2SC1Rtc84jC2nTrzFRoa/+d4hglXe2ZcuA6Wk+8XAHCT0+v WhjqIzwTuVUO9evdY0jkzlVPh74JBVymgwV1YhDfgJ7qSgiYsKHGYn229lzUGWUV/W9YsoHNKMAeQ ZN16l86CXjS4JHi3Nu9w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8Cl-0007Ro-BJ; Mon, 15 Apr 2019 20:27:51 +0000 Received: from mout.kundenserver.de ([212.227.126.133]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8Ci-0007RT-2o for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 20:27:49 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1Mtf7H-1h0FRt0VLz-00v7Sc; Mon, 15 Apr 2019 22:27:46 +0200 From: Arnd Bergmann To: Greg Ungerer Subject: [PATCH 4/6] ARM: ks8695: move gpio code back into platform Date: Mon, 15 Apr 2019 22:24:16 +0200 Message-Id: <20190415202501.941196-4-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190415202501.941196-1-arnd@arndb.de> References: <20190415202501.941196-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:HMe83s6pohIq/i3bMUw9/5Y38GKGIFa+UtVjWFJhBUsCcTyyx7n Gi1iz1hKJqvLPvGlsvmkwc63TPYBxkT0UaJSOeGypK86L0fpZUJq3iwi8bZ/TkWcb2WXplf AJNdEJdU31Ncc3IjFDxJL25DIWvBFVj3ds11KFKllCWMiwFWF3GD8QBfFPzXfPj5LIgTmCP oG9++Bt28owQxdjC7Zltw== X-UI-Out-Filterresults: notjunk:1;V03:K0:q8TLkGYH7ao=:7tbN0O9vt0g0Uo0lpplzUn /uv1sRo7/rgsXEYThWrqNaVbxpEKGpA882wAB1Lbn6v7cMpjvW4MmB1Mda/fiAlG4sxHIdy/c /LlRjWVQb64f93FAaQtlJiQVePg/xCKSrF/e38RBBpCoQkCZc+b+LhIWlCCqav6Nc4jL5ETG/ bW3c0v8g/iHtFWXqIacXeNhC9sFjbdBy6soKKx7NhHoieRgecO8Suk/1O2omycu/socdRiv2n gshc0uyOuG2E0q+4aIBwEynQ9SJ8ny4M/LxhQavsHxdbcr4o5DsEqQbbG2UsUGf/0ECkgzYH+ SdaUbLxynr5p9+j1N25VRtO840zNEgnyAKdwqsHjR3bWgMaPpfsNHx+eDP4OSQYCHCYChnPm5 rx5AWtFAevb1ckg7Pg1D+11dv0ppykPEm9F09DPYNDterffZcOzwgJJGpHZ7jSEetGrlRMu6L 1Z9QI15TDM9sgUFrcfoGu0eUpqxwHkJGvTQyEYtUZE+or2nuJCi7PZ4Okzplumt++/I+GiQzr 0nMj5LXu45dwh9K//2LN3VOJlAXe0FOvzLFqwa1qsyKybh8K8CLxJoUO572lpe5MnPLm8Mhe3 5ulZ1hQ8uRY/rN8dKXPhOE9gt5la8dOlq8865Zb/LxLByeK9sDlaLUlaINGtbnWLYPRWyOAie P0Iq6sbPc/BZvjUPeNpXCFfOpm6oZIZyZ2HSWFbv7ugr5kdiiZ2gWWLEBjZyrJSCISuS4P47/ EYSY1g78XKe2JEq82uf/5DM8+YPW7hoJrsRZbA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_132748_423005_DB7EB1DD X-CRM114-Status: GOOD ( 13.34 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , linux-gpio@vger.kernel.org, Linus Walleij , linux-kernel@vger.kernel.org, Bartosz Golaszewski , arm@kernel.org, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Properly splitting this out into a portable driver is hard, as the gpio code tightly interacts with the irqchip code. Give up and move it back to its original location, but make the headers private in the process. Signed-off-by: Arnd Bergmann Acked-by: Linus Walleij --- arch/arm/mach-ks8695/Makefile | 2 +- arch/arm/mach-ks8695/board-acs5k.c | 2 +- arch/arm/mach-ks8695/board-dsm320.c | 2 +- arch/arm/mach-ks8695/board-micrel.c | 2 +- arch/arm/mach-ks8695/board-og.c | 4 ++-- arch/arm/mach-ks8695/{include/mach => }/gpio-ks8695.h | 0 drivers/gpio/gpio-ks8695.c => arch/arm/mach-ks8695/gpio.c | 6 +++--- arch/arm/mach-ks8695/irq.c | 2 +- arch/arm/mach-ks8695/{include/mach => }/regs-gpio.h | 2 -- drivers/gpio/Makefile | 1 - 10 files changed, 10 insertions(+), 13 deletions(-) rename arch/arm/mach-ks8695/{include/mach => }/gpio-ks8695.h (100%) rename drivers/gpio/gpio-ks8695.c => arch/arm/mach-ks8695/gpio.c (98%) rename arch/arm/mach-ks8695/{include/mach => }/regs-gpio.h (97%) diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile index 439b22255a32..0a64557c3050 100644 --- a/arch/arm/mach-ks8695/Makefile +++ b/arch/arm/mach-ks8695/Makefile @@ -4,7 +4,7 @@ # Makefile for KS8695 architecture support # -obj-y := cpu.o irq.o time.o devices.o +obj-y := cpu.o irq.o time.o devices.o gpio.o # PCI support is optional obj-$(CONFIG_PCI) += pci.o diff --git a/arch/arm/mach-ks8695/board-acs5k.c b/arch/arm/mach-ks8695/board-acs5k.c index 5783062224c3..9baa7f91811e 100644 --- a/arch/arm/mach-ks8695/board-acs5k.c +++ b/arch/arm/mach-ks8695/board-acs5k.c @@ -34,7 +34,7 @@ #include #include "devices.h" -#include +#include "gpio-ks8695.h" #include "generic.h" diff --git a/arch/arm/mach-ks8695/board-dsm320.c b/arch/arm/mach-ks8695/board-dsm320.c index 13537e9c5485..d3cfc9c955ad 100644 --- a/arch/arm/mach-ks8695/board-dsm320.c +++ b/arch/arm/mach-ks8695/board-dsm320.c @@ -29,7 +29,7 @@ #include #include "devices.h" -#include +#include "gpio-ks8695.h" #include "generic.h" diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c index 69cfb9935fc1..69a27dfe8232 100644 --- a/arch/arm/mach-ks8695/board-micrel.c +++ b/arch/arm/mach-ks8695/board-micrel.c @@ -18,7 +18,7 @@ #include #include -#include +#include "gpio-ks8695.h" #include "devices.h" #include "generic.h" diff --git a/arch/arm/mach-ks8695/board-og.c b/arch/arm/mach-ks8695/board-og.c index 478ebd1f2b0f..7b962ba1425d 100644 --- a/arch/arm/mach-ks8695/board-og.c +++ b/arch/arm/mach-ks8695/board-og.c @@ -19,8 +19,8 @@ #include #include #include "devices.h" -#include -#include +#include "regs-gpio.h" +#include "gpio-ks8695.h" #include "generic.h" static int og_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) diff --git a/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h b/arch/arm/mach-ks8695/gpio-ks8695.h similarity index 100% rename from arch/arm/mach-ks8695/include/mach/gpio-ks8695.h rename to arch/arm/mach-ks8695/gpio-ks8695.h diff --git a/drivers/gpio/gpio-ks8695.c b/arch/arm/mach-ks8695/gpio.c similarity index 98% rename from drivers/gpio/gpio-ks8695.c rename to arch/arm/mach-ks8695/gpio.c index d6d6140ffc40..3a6c8f804f91 100644 --- a/drivers/gpio/gpio-ks8695.c +++ b/arch/arm/mach-ks8695/gpio.c @@ -28,10 +28,10 @@ #include #include -#include +#include -#include -#include +#include "regs-gpio.h" +#include "gpio-ks8695.h" /* * Configure a GPIO line for either GPIO function, or its internal diff --git a/arch/arm/mach-ks8695/irq.c b/arch/arm/mach-ks8695/irq.c index 31439f2ee21e..ee3f08f66e7e 100644 --- a/arch/arm/mach-ks8695/irq.c +++ b/arch/arm/mach-ks8695/irq.c @@ -32,7 +32,7 @@ #include #include -#include +#include "regs-gpio.h" static void ks8695_irq_mask(struct irq_data *d) { diff --git a/arch/arm/mach-ks8695/include/mach/regs-gpio.h b/arch/arm/mach-ks8695/regs-gpio.h similarity index 97% rename from arch/arm/mach-ks8695/include/mach/regs-gpio.h rename to arch/arm/mach-ks8695/regs-gpio.h index 90614a7d0548..c97414b8825a 100644 --- a/arch/arm/mach-ks8695/include/mach/regs-gpio.h +++ b/arch/arm/mach-ks8695/regs-gpio.h @@ -1,6 +1,4 @@ /* - * arch/arm/mach-ks8695/include/mach/regs-gpio.h - * * Copyright (C) 2007 Andrew Victor * * KS8695 - GPIO control registers and bit definitions. diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile index 54d55274b93a..a3b44ef6a8ea 100644 --- a/drivers/gpio/Makefile +++ b/drivers/gpio/Makefile @@ -64,7 +64,6 @@ obj-$(CONFIG_GPIO_IOP) += gpio-iop.o obj-$(CONFIG_GPIO_IT87) += gpio-it87.o obj-$(CONFIG_GPIO_JANZ_TTL) += gpio-janz-ttl.o obj-$(CONFIG_GPIO_KEMPLD) += gpio-kempld.o -obj-$(CONFIG_ARCH_KS8695) += gpio-ks8695.o obj-$(CONFIG_GPIO_INTEL_MID) += gpio-intel-mid.o obj-$(CONFIG_GPIO_LOONGSON) += gpio-loongson.o obj-$(CONFIG_GPIO_LP3943) += gpio-lp3943.o From patchwork Mon Apr 15 20:24:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 10901497 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 8ABEB13B5 for ; Mon, 15 Apr 2019 20:29:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A01F288DD for ; Mon, 15 Apr 2019 20:29:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A19D288F1; Mon, 15 Apr 2019 20:29:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13A6E288DD for ; Mon, 15 Apr 2019 20:29:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bQRkgy9nOkZ3ofNEsDAnVyR9H+BDsQHwsUu3RUr2S6g=; b=khYEHyImOGUWs+ AjkHGW2Eoa//eBF7tlWt2oF0ysnKd+opwa2B29hay2ns8Q2FCGLtkoF8V1hh01R6KXEInVBsvue7S KgF8Htr7zVq3SkHGkQZq6bWZ9iMzGJV4Asm/0x7JKj1b9JgOapbwCdxtNRI32u1fvDvkZDYaYZ03z bPG67ovANf1jIuw4ELaI+5AdZtttjx4RssPfcvNb2LjD6pBKQpBPFyBX/gxvXC5nHOqmazHoOktC/ o0xnC4Vj5f8jV3ZJgRn7u8BBexFrp/WkvbjUpSWnBLuD4SUJ3D0MlJW5PzEZqcD71i1pdGrABGqcw vGXRYv08x3DEUd1mvSWQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8E2-0007iF-Cn; Mon, 15 Apr 2019 20:29:10 +0000 Received: from mout.kundenserver.de ([212.227.126.135]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hG8Dx-0007hu-TV for linux-arm-kernel@lists.infradead.org; Mon, 15 Apr 2019 20:29:08 +0000 Received: from threadripper.lan ([149.172.19.189]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPA (Nemesis) id 1MRTAj-1hSSRo2tld-00NPXk; Mon, 15 Apr 2019 22:28:57 +0200 From: Arnd Bergmann To: Greg Ungerer Subject: [PATCH 6/6] ARM: ks8695: split up uart register headers Date: Mon, 15 Apr 2019 22:24:18 +0200 Message-Id: <20190415202501.941196-6-arnd@arndb.de> X-Mailer: git-send-email 2.20.0 In-Reply-To: <20190415202501.941196-1-arnd@arndb.de> References: <20190415202501.941196-1-arnd@arndb.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:KiiZGm8YYPg8G/jJRJdkMeVv/8SrVOCElJq1sII8vzv/hVVohtD PXnBQ9HYNT07JO6Geh3HLK0DKVIDH0XKqg2a+JWb7TnfhFUflyT3zoLpCzoEnqA6C7s2nDy Gjt/2VjQ0Ym97AlIwcyOTNcLvygxk3jZIRJBTKc7x2WpYJs2hfhW5jY6QNnwyc0mu2+7pil R5GijGm9Pd6Pa4JxzCxYw== X-UI-Out-Filterresults: notjunk:1;V03:K0:DjLmN6oN0FM=:qsjUL+sa3Iq66tbf9oaXwS TGy0M39DsDx/w99FJjVK+Pi9xppysOLr7HeNzg2j3Wnp2jHsBqO3g/vRmq504chITM3yIxFfk MREELmQtY4xpG9dyCc4DDRqwr4yeuUOLKq7g9ynjh4dh7QOOVYzI6dDZVrd+zhb7jEZ3Q4bIF W0Nt2vl9g8UW/+ltxf91e3kzUyR7J+zlUY8AfgN+td9csRJiDdksRRLu6ootqOyB4jz/pZa3Y 82ZqgAt01S3mkeeeLT9N29MNtp8fkidIy9M+ICm+cXEeqVunmD860OERBPZvFu/vqUCOGS8c7 uR7rK7zkn6Kt3GGOWbRNHtK5a+0koNf5sf/xwhc0sW3LwF/vCrID0OjHwkyuC1du/bgOgoaxd ujbg9Ngjy85qalJXvX1x64OxG3lbYEjj8ueuLTslKc6iPdqX4ezY060yoDCslhwnIso3gsraN s3GNKb0x/TX/wHVFEndV7LbUF7svYUKvmZaPkvjBzlVp+rRSE2juDrXZm0hdQ/WQ+gKXMAU4H c5BVYBNM3Wq6DOQLlak5NJS+BptOI6xX5HWYk66Tis2wnNEwfH7sdRLUj8z0u6pnQN/JeEQlB 82NgMzYI0f2NBYPS9x6mNmDBAuDTpJnWGRksC2073/aDCZRl39d0y1FmLDuAhcl3KKN0mEY2e lf/Wi088SL52HIhXyOU8iamIHSAwKNZc1wt0kwNOqwqYlTugyMPu7L9RKqbs96cG2/fgWjgbi BjDYnYUef0zp+mERSUIpF59U3M7rsIDzCpXbgA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190415_132906_257602_0681E679 X-CRM114-Status: GOOD ( 22.70 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Greg Kroah-Hartman , Linus Walleij , linux-kernel@vger.kernel.org, arm@kernel.org, linux-serial@vger.kernel.org, Jiri Slaby , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The uart driver is tightly coupled with the platform code, without real need. The uart registers can be moved into the driver itself (and the uncompress code), and instead of referring to the IRQ lines by number, we can generally use port->irq. Finally, the initialization of the uart_port structure gets moved into the platform code. This cannot use platform_data since we need it before console_init(), but map_io is called very early, and the data is all hardcoded. Signed-off-by: Arnd Bergmann --- arch/arm/mach-ks8695/cpu.c | 15 ++- arch/arm/mach-ks8695/devices.c | 2 +- arch/arm/mach-ks8695/include/mach/regs-uart.h | 92 ------------- .../arm/mach-ks8695/include/mach/uncompress.h | 16 ++- arch/arm/mach-ks8695/regs-uart.h | 19 +++ drivers/tty/serial/Kconfig | 2 +- drivers/tty/serial/serial_ks8695.c | 123 ++++++++++++++---- include/linux/platform_data/serial-ks8695.h | 10 ++ 8 files changed, 157 insertions(+), 122 deletions(-) delete mode 100644 arch/arm/mach-ks8695/include/mach/regs-uart.h create mode 100644 arch/arm/mach-ks8695/regs-uart.h create mode 100644 include/linux/platform_data/serial-ks8695.h diff --git a/arch/arm/mach-ks8695/cpu.c b/arch/arm/mach-ks8695/cpu.c index 7eadf73c7e30..680b94641196 100644 --- a/arch/arm/mach-ks8695/cpu.c +++ b/arch/arm/mach-ks8695/cpu.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -32,7 +33,7 @@ #include "regs-sys.h" #include "regs-misc.h" - +#include "regs-uart.h" static struct map_desc ks8695_io_desc[] __initdata = { { @@ -64,10 +65,22 @@ static void __init ks8695_clock_info(void) sysclk[scdc] / 1000000, cpuclk[scdc] / 1000000); } +static void __init ks8695_serial_setup(void) +{ + if (!IS_ENABLED(CONFIG_SERIAL_KS8695)) + return; + + ks8695uart_ports[0].membase = KS8695_UART_VA; + ks8695uart_ports[0].mapbase = KS8695_UART_PA; + ks8695uart_ports[0].irq = KS8695_IRQ_UART_TX; /* actaully four IRQs */ + ks8695uart_ports[0].uartclk = KS8695_CLOCK_RATE * 16; +} + void __init ks8695_map_io(void) { iotable_init(ks8695_io_desc, ARRAY_SIZE(ks8695_io_desc)); ks8695_processor_info(); ks8695_clock_info(); + ks8695_serial_setup(); } diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c index 6bd50a8f12f9..ba9d0f0f47ac 100644 --- a/arch/arm/mach-ks8695/devices.c +++ b/arch/arm/mach-ks8695/devices.c @@ -29,6 +29,7 @@ #include "regs-hpna.h" #include "regs-switch.h" #include "regs-misc.h" +#include "regs-uart.h" /* -------------------------------------------------------------------- * Ethernet @@ -191,7 +192,6 @@ static void __init ks8695_add_device_watchdog(void) platform_device_register(&ks8695_wdt_device); } - /* -------------------------------------------------------------------- */ /* diff --git a/arch/arm/mach-ks8695/include/mach/regs-uart.h b/arch/arm/mach-ks8695/include/mach/regs-uart.h deleted file mode 100644 index 8581fbc6245f..000000000000 --- a/arch/arm/mach-ks8695/include/mach/regs-uart.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * arch/arm/mach-ks8695/include/mach/regs-uart.h - * - * Copyright (C) 2006 Ben Dooks - * Copyright (C) 2006 Simtec Electronics - * - * KS8695 - UART register and bit definitions. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2 as - * published by the Free Software Foundation. - */ - -#ifndef KS8695_UART_H -#define KS8695_UART_H - -#define KS8695_UART_OFFSET (0xF0000 + 0xE000) -#define KS8695_UART_VA (KS8695_IO_VA + KS8695_UART_OFFSET) -#define KS8695_UART_PA (KS8695_IO_PA + KS8695_UART_OFFSET) - - -/* - * UART registers - */ -#define KS8695_URRB (0x00) /* Receive Buffer Register */ -#define KS8695_URTH (0x04) /* Transmit Holding Register */ -#define KS8695_URFC (0x08) /* FIFO Control Register */ -#define KS8695_URLC (0x0C) /* Line Control Register */ -#define KS8695_URMC (0x10) /* Modem Control Register */ -#define KS8695_URLS (0x14) /* Line Status Register */ -#define KS8695_URMS (0x18) /* Modem Status Register */ -#define KS8695_URBD (0x1C) /* Baud Rate Divisor Register */ -#define KS8695_USR (0x20) /* Status Register */ - - -/* FIFO Control Register */ -#define URFC_URFRT (3 << 6) /* Receive FIFO Trigger Level */ -#define URFC_URFRT_1 (0 << 6) -#define URFC_URFRT_4 (1 << 6) -#define URFC_URFRT_8 (2 << 6) -#define URFC_URFRT_14 (3 << 6) -#define URFC_URTFR (1 << 2) /* Transmit FIFO Reset */ -#define URFC_URRFR (1 << 1) /* Receive FIFO Reset */ -#define URFC_URFE (1 << 0) /* FIFO Enable */ - -/* Line Control Register */ -#define URLC_URSBC (1 << 6) /* Set Break Condition */ -#define URLC_PARITY (7 << 3) /* Parity */ -#define URPE_NONE (0 << 3) -#define URPE_ODD (1 << 3) -#define URPE_EVEN (3 << 3) -#define URPE_MARK (5 << 3) -#define URPE_SPACE (7 << 3) -#define URLC_URSB (1 << 2) /* Stop Bits */ -#define URLC_URCL (3 << 0) /* Character Length */ -#define URCL_5 (0 << 0) -#define URCL_6 (1 << 0) -#define URCL_7 (2 << 0) -#define URCL_8 (3 << 0) - -/* Modem Control Register */ -#define URMC_URLB (1 << 4) /* Loop-back mode */ -#define URMC_UROUT2 (1 << 3) /* OUT2 signal */ -#define URMC_UROUT1 (1 << 2) /* OUT1 signal */ -#define URMC_URRTS (1 << 1) /* Request to Send */ -#define URMC_URDTR (1 << 0) /* Data Terminal Ready */ - -/* Line Status Register */ -#define URLS_URRFE (1 << 7) /* Receive FIFO Error */ -#define URLS_URTE (1 << 6) /* Transmit Empty */ -#define URLS_URTHRE (1 << 5) /* Transmit Holding Register Empty */ -#define URLS_URBI (1 << 4) /* Break Interrupt */ -#define URLS_URFE (1 << 3) /* Framing Error */ -#define URLS_URPE (1 << 2) /* Parity Error */ -#define URLS_URROE (1 << 1) /* Receive Overrun Error */ -#define URLS_URDR (1 << 0) /* Receive Data Ready */ - -/* Modem Status Register */ -#define URMS_URDCD (1 << 7) /* Data Carrier Detect */ -#define URMS_URRI (1 << 6) /* Ring Indicator */ -#define URMS_URDSR (1 << 5) /* Data Set Ready */ -#define URMS_URCTS (1 << 4) /* Clear to Send */ -#define URMS_URDDCD (1 << 3) /* Delta Data Carrier Detect */ -#define URMS_URTERI (1 << 2) /* Trailing Edge Ring Indicator */ -#define URMS_URDDST (1 << 1) /* Delta Data Set Ready */ -#define URMS_URDCTS (1 << 0) /* Delta Clear to Send */ - -/* Status Register */ -#define USR_UTI (1 << 0) /* Timeout Indication */ - - -#endif diff --git a/arch/arm/mach-ks8695/include/mach/uncompress.h b/arch/arm/mach-ks8695/include/mach/uncompress.h index a001c7c34df2..a8ae2e82dcf1 100644 --- a/arch/arm/mach-ks8695/include/mach/uncompress.h +++ b/arch/arm/mach-ks8695/include/mach/uncompress.h @@ -15,7 +15,21 @@ #define __ASM_ARCH_UNCOMPRESS_H #include -#include + +#define KS8695_UART_OFFSET (0xF0000 + 0xE000) +#define KS8695_UART_PA (KS8695_IO_PA + KS8695_UART_OFFSET) +#define KS8695_URRB (0x00) /* Receive Buffer Register */ +#define KS8695_URTH (0x04) /* Transmit Holding Register */ +#define KS8695_URFC (0x08) /* FIFO Control Register */ +#define KS8695_URLC (0x0C) /* Line Control Register */ +#define KS8695_URMC (0x10) /* Modem Control Register */ +#define KS8695_URLS (0x14) /* Line Status Register */ +#define KS8695_URMS (0x18) /* Modem Status Register */ +#define KS8695_URBD (0x1C) /* Baud Rate Divisor Register */ +#define KS8695_USR (0x20) /* Status Register */ + +#define URLS_URTE (1 << 6) +#define URLS_URTHRE (1 << 5) static inline void putc(char c) { diff --git a/arch/arm/mach-ks8695/regs-uart.h b/arch/arm/mach-ks8695/regs-uart.h new file mode 100644 index 000000000000..ab6c70e8fc7a --- /dev/null +++ b/arch/arm/mach-ks8695/regs-uart.h @@ -0,0 +1,19 @@ +/* + * Copyright (C) 2006 Ben Dooks + * Copyright (C) 2006 Simtec Electronics + * + * KS8695 - UART register and bit definitions. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + */ + +#ifndef KS8695_UART_H +#define KS8695_UART_H + +#define KS8695_UART_OFFSET (0xF0000 + 0xE000) +#define KS8695_UART_VA (KS8695_IO_VA + KS8695_UART_OFFSET) +#define KS8695_UART_PA (KS8695_IO_PA + KS8695_UART_OFFSET) + +#endif diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig index 72966bc0ac76..bdb3fc987ea2 100644 --- a/drivers/tty/serial/Kconfig +++ b/drivers/tty/serial/Kconfig @@ -198,7 +198,7 @@ config SERIAL_KGDB_NMI config SERIAL_KS8695 bool "Micrel KS8695 (Centaur) serial port support" - depends on ARCH_KS8695 + depends on ARCH_KS8695 || COMPILE_TEST select SERIAL_CORE help This selects the Micrel Centaur KS8695 UART. Say Y here. diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c index 6c5e9900e69d..6caad7e5ab74 100644 --- a/drivers/tty/serial/serial_ks8695.c +++ b/drivers/tty/serial/serial_ks8695.c @@ -15,12 +15,11 @@ #include #include #include +#include -#include -#include -#include +#include -#include +#include #if defined(CONFIG_SERIAL_KS8695_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) #define SUPPORT_SYSRQ @@ -34,6 +33,82 @@ #define SERIAL_KS8695_DEVNAME "ttyAM" #define SERIAL_KS8695_NR 1 +extern struct uart_port ks8695uart_ports[SERIAL_KS8695_NR]; + +/* + * UART registers + */ +#define KS8695_URRB (0x00) /* Receive Buffer Register */ +#define KS8695_URTH (0x04) /* Transmit Holding Register */ +#define KS8695_URFC (0x08) /* FIFO Control Register */ +#define KS8695_URLC (0x0C) /* Line Control Register */ +#define KS8695_URMC (0x10) /* Modem Control Register */ +#define KS8695_URLS (0x14) /* Line Status Register */ +#define KS8695_URMS (0x18) /* Modem Status Register */ +#define KS8695_URBD (0x1C) /* Baud Rate Divisor Register */ +#define KS8695_USR (0x20) /* Status Register */ + + +/* FIFO Control Register */ +#define URFC_URFRT (3 << 6) /* Receive FIFO Trigger Level */ +#define URFC_URFRT_1 (0 << 6) +#define URFC_URFRT_4 (1 << 6) +#define URFC_URFRT_8 (2 << 6) +#define URFC_URFRT_14 (3 << 6) +#define URFC_URTFR (1 << 2) /* Transmit FIFO Reset */ +#define URFC_URRFR (1 << 1) /* Receive FIFO Reset */ +#define URFC_URFE (1 << 0) /* FIFO Enable */ + +/* Line Control Register */ +#define URLC_URSBC (1 << 6) /* Set Break Condition */ +#define URLC_PARITY (7 << 3) /* Parity */ +#define URPE_NONE (0 << 3) +#define URPE_ODD (1 << 3) +#define URPE_EVEN (3 << 3) +#define URPE_MARK (5 << 3) +#define URPE_SPACE (7 << 3) +#define URLC_URSB (1 << 2) /* Stop Bits */ +#define URLC_URCL (3 << 0) /* Character Length */ +#define URCL_5 (0 << 0) +#define URCL_6 (1 << 0) +#define URCL_7 (2 << 0) +#define URCL_8 (3 << 0) + +/* Modem Control Register */ +#define URMC_URLB (1 << 4) /* Loop-back mode */ +#define URMC_UROUT2 (1 << 3) /* OUT2 signal */ +#define URMC_UROUT1 (1 << 2) /* OUT1 signal */ +#define URMC_URRTS (1 << 1) /* Request to Send */ +#define URMC_URDTR (1 << 0) /* Data Terminal Ready */ + +/* Line Status Register */ +#define URLS_URRFE (1 << 7) /* Receive FIFO Error */ +#define URLS_URTE (1 << 6) /* Transmit Empty */ +#define URLS_URTHRE (1 << 5) /* Transmit Holding Register Empty */ +#define URLS_URBI (1 << 4) /* Break Interrupt */ +#define URLS_URFE (1 << 3) /* Framing Error */ +#define URLS_URPE (1 << 2) /* Parity Error */ +#define URLS_URROE (1 << 1) /* Receive Overrun Error */ +#define URLS_URDR (1 << 0) /* Receive Data Ready */ + +/* Modem Status Register */ +#define URMS_URDCD (1 << 7) /* Data Carrier Detect */ +#define URMS_URRI (1 << 6) /* Ring Indicator */ +#define URMS_URDSR (1 << 5) /* Data Set Ready */ +#define URMS_URCTS (1 << 4) /* Clear to Send */ +#define URMS_URDDCD (1 << 3) /* Delta Data Carrier Detect */ +#define URMS_URTERI (1 << 2) /* Trailing Edge Ring Indicator */ +#define URMS_URDDST (1 << 1) /* Delta Data Set Ready */ +#define URMS_URDCTS (1 << 0) /* Delta Clear to Send */ + +/* Status Register */ +#define USR_UTI (1 << 0) /* Timeout Indication */ + + +#define IRQ_TX 0 +#define IRQ_RX 1 +#define IRQ_LINE_STATUS 2 +#define IRQ_MODEM_STATUS 3 /* * Access macros for the KS8695 UART @@ -105,7 +180,7 @@ static void ks8695uart_stop_tx(struct uart_port *port) * imposed deadlock by not waiting for irq handler to end, * since this ks8695uart_stop_tx() is called from interrupt context. */ - disable_irq_nosync(KS8695_IRQ_UART_TX); + disable_irq_nosync(port->irq + IRQ_TX); tx_enable(port, 0); } } @@ -113,7 +188,7 @@ static void ks8695uart_stop_tx(struct uart_port *port) static void ks8695uart_start_tx(struct uart_port *port) { if (!tx_enabled(port)) { - enable_irq(KS8695_IRQ_UART_TX); + enable_irq(port->irq + IRQ_TX); tx_enable(port, 1); } } @@ -121,7 +196,7 @@ static void ks8695uart_start_tx(struct uart_port *port) static void ks8695uart_stop_rx(struct uart_port *port) { if (rx_enabled(port)) { - disable_irq(KS8695_IRQ_UART_RX); + disable_irq(port->irq + IRQ_RX); rx_enable(port, 0); } } @@ -129,7 +204,7 @@ static void ks8695uart_stop_rx(struct uart_port *port) static void ks8695uart_enable_ms(struct uart_port *port) { if (!ms_enabled(port)) { - enable_irq(KS8695_IRQ_UART_MODEM_STATUS); + enable_irq(port->irq + IRQ_MODEM_STATUS); ms_enable(port,1); } } @@ -137,7 +212,7 @@ static void ks8695uart_enable_ms(struct uart_port *port) static void ks8695uart_disable_ms(struct uart_port *port) { if (ms_enabled(port)) { - disable_irq(KS8695_IRQ_UART_MODEM_STATUS); + disable_irq(port->irq + IRQ_MODEM_STATUS); ms_enable(port,0); } } @@ -318,7 +393,7 @@ static int ks8695uart_startup(struct uart_port *port) { int retval; - irq_modify_status(KS8695_IRQ_UART_TX, IRQ_NOREQUEST, IRQ_NOAUTOEN); + irq_modify_status(port->irq + IRQ_TX, IRQ_NOREQUEST, IRQ_NOAUTOEN); tx_enable(port, 0); rx_enable(port, 1); ms_enable(port, 1); @@ -326,30 +401,30 @@ static int ks8695uart_startup(struct uart_port *port) /* * Allocate the IRQ */ - retval = request_irq(KS8695_IRQ_UART_TX, ks8695uart_tx_chars, 0, "UART TX", port); + retval = request_irq(port->irq + IRQ_TX, ks8695uart_tx_chars, 0, "UART TX", port); if (retval) goto err_tx; - retval = request_irq(KS8695_IRQ_UART_RX, ks8695uart_rx_chars, 0, "UART RX", port); + retval = request_irq(port->irq + IRQ_RX, ks8695uart_rx_chars, 0, "UART RX", port); if (retval) goto err_rx; - retval = request_irq(KS8695_IRQ_UART_LINE_STATUS, ks8695uart_rx_chars, 0, "UART LineStatus", port); + retval = request_irq(port->irq + IRQ_LINE_STATUS, ks8695uart_rx_chars, 0, "UART LineStatus", port); if (retval) goto err_ls; - retval = request_irq(KS8695_IRQ_UART_MODEM_STATUS, ks8695uart_modem_status, 0, "UART ModemStatus", port); + retval = request_irq(port->irq + IRQ_MODEM_STATUS, ks8695uart_modem_status, 0, "UART ModemStatus", port); if (retval) goto err_ms; return 0; err_ms: - free_irq(KS8695_IRQ_UART_LINE_STATUS, port); + free_irq(port->irq + IRQ_LINE_STATUS, port); err_ls: - free_irq(KS8695_IRQ_UART_RX, port); + free_irq(port->irq + IRQ_RX, port); err_rx: - free_irq(KS8695_IRQ_UART_TX, port); + free_irq(port->irq + IRQ_TX, port); err_tx: return retval; } @@ -359,10 +434,10 @@ static void ks8695uart_shutdown(struct uart_port *port) /* * Free the interrupt */ - free_irq(KS8695_IRQ_UART_RX, port); - free_irq(KS8695_IRQ_UART_TX, port); - free_irq(KS8695_IRQ_UART_MODEM_STATUS, port); - free_irq(KS8695_IRQ_UART_LINE_STATUS, port); + free_irq(port->irq + IRQ_TX, port); + free_irq(port->irq + IRQ_RX, port); + free_irq(port->irq + IRQ_MODEM_STATUS, port); + free_irq(port->irq + IRQ_LINE_STATUS, port); /* disable break condition and fifos */ UART_PUT_LCR(port, UART_GET_LCR(port) & ~URLC_URSBC); @@ -535,13 +610,9 @@ static struct uart_ops ks8695uart_pops = { .verify_port = ks8695uart_verify_port, }; -static struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] = { +struct uart_port ks8695uart_ports[SERIAL_KS8695_NR] = { { - .membase = KS8695_UART_VA, - .mapbase = KS8695_UART_PA, .iotype = SERIAL_IO_MEM, - .irq = KS8695_IRQ_UART_TX, - .uartclk = KS8695_CLOCK_RATE * 16, .fifosize = 16, .ops = &ks8695uart_pops, .flags = UPF_BOOT_AUTOCONF, diff --git a/include/linux/platform_data/serial-ks8695.h b/include/linux/platform_data/serial-ks8695.h new file mode 100644 index 000000000000..ade3f0a03a75 --- /dev/null +++ b/include/linux/platform_data/serial-ks8695.h @@ -0,0 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0+ +#ifndef _LINUX_PLATFORM_DATA_SERIAL_KS8695 +#define _LINUX_PLATFORM_DATA_SERIAL_KS8695 + +#include + +#define SERIAL_KS8695_NR 1 +extern struct uart_port ks8695uart_ports[SERIAL_KS8695_NR]; + +#endif