linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
@ 2019-04-15 20:24 Arnd Bergmann
  2019-04-15 20:24 ` [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq Arnd Bergmann
                   ` (8 more replies)
  0 siblings, 9 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:24 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Linus Walleij, arm, Arnd Bergmann, Wim Van Sebroeck,
	Guenter Roeck, linux-arm-kernel, linux-kernel, linux-watchdog

drivers should not rely on machine specific headers but
get their information from the platform device.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 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 <linux/watchdog.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
-#include <mach/hardware.h>
 
-#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;
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
@ 2019-04-15 20:24 ` Arnd Bergmann
  2019-04-15 20:24 ` [PATCH 3/6] ARM: ks8695: net: move machine header contents Arnd Bergmann
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:24 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Linus Walleij, arm, Arnd Bergmann, David S. Miller, YueHaibing,
	Yang Wei, netdev, linux-kernel

Rather than poking the registers manually, better use the exported
interfaces for it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/ethernet/micrel/ks8695net.c | 30 ++-----------------------
 1 file changed, 2 insertions(+), 28 deletions(-)

diff --git a/drivers/net/ethernet/micrel/ks8695net.c b/drivers/net/ethernet/micrel/ks8695net.c
index 6006d47707cb..3b6375adff08 100644
--- a/drivers/net/ethernet/micrel/ks8695net.c
+++ b/drivers/net/ethernet/micrel/ks8695net.c
@@ -402,25 +402,6 @@ ks8695_tx_irq(int irq, void *dev_id)
 	return IRQ_HANDLED;
 }
 
-/**
- *	ks8695_get_rx_enable_bit - Get rx interrupt enable/status bit
- *	@ksp: Private data for the KS8695 Ethernet
- *
- *    For KS8695 document:
- *    Interrupt Enable Register (offset 0xE204)
- *        Bit29 : WAN MAC Receive Interrupt Enable
- *        Bit16 : LAN MAC Receive Interrupt Enable
- *    Interrupt Status Register (Offset 0xF208)
- *        Bit29: WAN MAC Receive Status
- *        Bit16: LAN MAC Receive Status
- *    So, this Rx interrupt enable/status bit number is equal
- *    as Rx IRQ number.
- */
-static inline u32 ks8695_get_rx_enable_bit(struct ks8695_priv *ksp)
-{
-	return ksp->rx_irq;
-}
-
 /**
  *	ks8695_rx_irq - Receive IRQ handler
  *	@irq: The IRQ which went off (ignored)
@@ -438,11 +419,7 @@ ks8695_rx_irq(int irq, void *dev_id)
 	spin_lock(&ksp->rx_lock);
 
 	if (napi_schedule_prep(&ksp->napi)) {
-		unsigned long status = readl(KS8695_IRQ_VA + KS8695_INTEN);
-		unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
-		/*disable rx interrupt*/
-		status &= ~mask_bit;
-		writel(status , KS8695_IRQ_VA + KS8695_INTEN);
+		disable_irq(ksp->rx_irq);
 		__napi_schedule(&ksp->napi);
 	}
 
@@ -561,8 +538,6 @@ static int ks8695_rx(struct ks8695_priv *ksp, int budget)
 static int ks8695_poll(struct napi_struct *napi, int budget)
 {
 	struct ks8695_priv *ksp = container_of(napi, struct ks8695_priv, napi);
-	unsigned long isr = readl(KS8695_IRQ_VA + KS8695_INTEN);
-	unsigned long mask_bit = 1 << ks8695_get_rx_enable_bit(ksp);
 	int work_done;
 
 	work_done = ks8695_rx(ksp, budget);
@@ -571,8 +546,7 @@ static int ks8695_poll(struct napi_struct *napi, int budget)
 		unsigned long flags;
 
 		spin_lock_irqsave(&ksp->rx_lock, flags);
-		/* enable rx interrupt */
-		writel(isr | mask_bit, KS8695_IRQ_VA + KS8695_INTEN);
+		enable_irq(ksp->rx_irq);
 		spin_unlock_irqrestore(&ksp->rx_lock, flags);
 	}
 	return work_done;
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 3/6] ARM: ks8695: net: move machine header contents
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
  2019-04-15 20:24 ` [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq Arnd Bergmann
@ 2019-04-15 20:24 ` Arnd Bergmann
  2019-04-15 20:24 ` [PATCH 4/6] ARM: ks8695: move gpio code back into platform Arnd Bergmann
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:24 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Linus Walleij, arm, Arnd Bergmann, David S. Miller,
	linux-arm-kernel, linux-kernel, netdev

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 <arnd@arndb.de>
---
 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 <asm/mach/map.h>
 
 #include "regs-sys.h"
-#include <mach/regs-misc.h>
+#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 <mach/regs-switch.h>
-#include <mach/regs-misc.h>
-
+#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 <linux/io.h>
 #include <linux/slab.h>
 
-#include <asm/irq.h>
-
-#include <mach/regs-switch.h>
-#include <mach/regs-misc.h>
-#include <asm/mach/irq.h>
-#include <mach/regs-irq.h>
-
 #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.
  */
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 4/6] ARM: ks8695: move gpio code back into platform
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
  2019-04-15 20:24 ` [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq Arnd Bergmann
  2019-04-15 20:24 ` [PATCH 3/6] ARM: ks8695: net: move machine header contents Arnd Bergmann
@ 2019-04-15 20:24 ` Arnd Bergmann
  2019-04-23 10:44   ` Linus Walleij
  2019-04-15 20:24 ` [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack Arnd Bergmann
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:24 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Linus Walleij, arm, Arnd Bergmann, Bartosz Golaszewski,
	linux-arm-kernel, linux-kernel, linux-gpio

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 <arnd@arndb.de>
---
 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 <asm/mach/irq.h>
 
 #include "devices.h"
-#include <mach/gpio-ks8695.h>
+#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 <asm/mach/irq.h>
 
 #include "devices.h"
-#include <mach/gpio-ks8695.h>
+#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 <asm/mach/map.h>
 #include <asm/mach/irq.h>
 
-#include <mach/gpio-ks8695.h>
+#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 <asm/mach/arch.h>
 #include <asm/mach/map.h>
 #include "devices.h"
-#include <mach/regs-gpio.h>
-#include <mach/gpio-ks8695.h>
+#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 <linux/io.h>
 
 #include <mach/hardware.h>
-#include <asm/mach/irq.h>
+#include <mach/irqs.h>
 
-#include <mach/regs-gpio.h>
-#include <mach/gpio-ks8695.h>
+#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 <asm/mach/irq.h>
 
 #include <mach/regs-irq.h>
-#include <mach/regs-gpio.h>
+#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
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
                   ` (2 preceding siblings ...)
  2019-04-15 20:24 ` [PATCH 4/6] ARM: ks8695: move gpio code back into platform Arnd Bergmann
@ 2019-04-15 20:24 ` Arnd Bergmann
  2019-04-20  2:06   ` Greg Ungerer
  2019-04-15 20:24 ` [PATCH 6/6] ARM: ks8695: split up uart register headers Arnd Bergmann
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:24 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Linus Walleij, arm, Arnd Bergmann, Greg Kroah-Hartman,
	Jiri Slaby, linux-serial, linux-kernel

The TX interrupt is marked as edge triggered, so it will
already be acked by the top-level irq code, and does not
need the ack in the driver.

Removing this avoids a nasty dependency on the regs-irq.h
file that is otherwise reserved for the interrupt controller
driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/tty/serial/serial_ks8695.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c
index b461d791188c..6c5e9900e69d 100644
--- a/drivers/tty/serial/serial_ks8695.c
+++ b/drivers/tty/serial/serial_ks8695.c
@@ -21,7 +21,6 @@
 #include <asm/mach/irq.h>
 
 #include <mach/regs-uart.h>
-#include <mach/regs-irq.h>
 
 #if defined(CONFIG_SERIAL_KS8695_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
 #define SUPPORT_SYSRQ
@@ -52,8 +51,6 @@
 #define UART_GET_BRDR(p)	__raw_readl((p)->membase + KS8695_URBD)
 #define UART_PUT_BRDR(p, c)	__raw_writel((c), (p)->membase + KS8695_URBD)
 
-#define KS8695_CLR_TX_INT()	__raw_writel(1 << KS8695_IRQ_UART_TX, KS8695_IRQ_VA + KS8695_INTST)
-
 #define UART_DUMMY_LSR_RX	0x100
 #define UART_PORT_SIZE		(KS8695_USR - KS8695_URRB + 4)
 
@@ -207,7 +204,6 @@ static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id)
 	unsigned int count;
 
 	if (port->x_char) {
-		KS8695_CLR_TX_INT();
 		UART_PUT_CHAR(port, port->x_char);
 		port->icount.tx++;
 		port->x_char = 0;
@@ -221,7 +217,6 @@ static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id)
 
 	count = 16;	/* fifo size */
 	while (!uart_circ_empty(xmit) && (count-- > 0)) {
-		KS8695_CLR_TX_INT();
 		UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
 
 		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* [PATCH 6/6] ARM: ks8695: split up uart register headers
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
                   ` (3 preceding siblings ...)
  2019-04-15 20:24 ` [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack Arnd Bergmann
@ 2019-04-15 20:24 ` Arnd Bergmann
  2019-04-15 20:54 ` [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Guenter Roeck
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:24 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Linus Walleij, arm, Arnd Bergmann, Greg Kroah-Hartman,
	Jiri Slaby, linux-arm-kernel, linux-kernel, linux-serial

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 <arnd@arndb.de>
---
 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 <linux/module.h>
 #include <linux/init.h>
 #include <linux/io.h>
+#include <linux/platform_data/serial-ks8695.h>
 
 #include <mach/hardware.h>
 #include <asm/mach/arch.h>
@@ -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 <ben@simtec.co.uk>
- * 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 <linux/io.h>
-#include <mach/regs-uart.h>
+
+#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 <ben@simtec.co.uk>
+ * 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 <linux/console.h>
 #include <linux/sysrq.h>
 #include <linux/device.h>
+#include <linux/irq.h>
 
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/mach/irq.h>
+#include <linux/platform_data/serial-ks8695.h>
 
-#include <mach/regs-uart.h>
+#include <asm/io.h>
 
 #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 <linux/serial_core.h>
+
+#define SERIAL_KS8695_NR 1
+extern struct uart_port ks8695uart_ports[SERIAL_KS8695_NR];
+
+#endif
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
                   ` (4 preceding siblings ...)
  2019-04-15 20:24 ` [PATCH 6/6] ARM: ks8695: split up uart register headers Arnd Bergmann
@ 2019-04-15 20:54 ` Guenter Roeck
  2019-04-15 20:58   ` Arnd Bergmann
  2019-04-16 13:21 ` [PATCH 1/6 v2] " Arnd Bergmann
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 21+ messages in thread
From: Guenter Roeck @ 2019-04-15 20:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Ungerer, Linus Walleij, arm, Wim Van Sebroeck,
	linux-arm-kernel, linux-kernel, linux-watchdog

On Mon, Apr 15, 2019 at 10:24:13PM +0200, Arnd Bergmann wrote:
> drivers should not rely on machine specific headers but
> get their information from the platform device.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  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

Is __raw_readl / __raw_writel really available for all architectures / platforms ?

>  	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 <linux/watchdog.h>
>  #include <linux/io.h>
>  #include <linux/uaccess.h>
> -#include <mach/hardware.h>
>  
> -#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);

Please use devm_platform_ioremap_resource().

Thanks,
Guenter

> +	if (!tmr_reg)
> +		return -ENXIO;
>  
>  	if (ks8695wdt_miscdev.parent)
>  		return -EBUSY;

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-04-15 20:54 ` [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Guenter Roeck
@ 2019-04-15 20:58   ` Arnd Bergmann
  0 siblings, 0 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-15 20:58 UTC (permalink / raw)
  To: Guenter Roeck
  Cc: Greg Ungerer, Linus Walleij, arm-soc, Wim Van Sebroeck,
	Linux ARM, Linux Kernel Mailing List, linux-watchdog

On Mon, Apr 15, 2019 at 10:54 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> >
> >  config KS8695_WATCHDOG
> >       tristate "KS8695 watchdog"
> > -     depends on ARCH_KS8695
> > +     depends on ARCH_KS8695 || COMPILE_TEST
>
> Is __raw_readl / __raw_writel really available for all architectures / platforms ?

I'm fairly sure it is these days, only uml and s390 used to be the
exceptions here, but they both added this.

It's possible that something else is missing, I was hoping for the 0-day
bot to tell me if so.

> > @@ -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);
>
> Please use devm_platform_ioremap_resource().

Ah, that is the function I was looking for, thanks for the hint.

      Arnd

^ permalink raw reply	[flat|nested] 21+ messages in thread

* [PATCH 1/6 v2] ARM: ks8695: watchdog: stop using mach/*.h
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
                   ` (5 preceding siblings ...)
  2019-04-15 20:54 ` [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Guenter Roeck
@ 2019-04-16 13:21 ` Arnd Bergmann
  2019-04-16 18:09   ` Guenter Roeck
  2019-04-20  2:36 ` [PATCH 1/6] " Greg Ungerer
  2019-05-03  7:02 ` Greg Ungerer
  8 siblings, 1 reply; 21+ messages in thread
From: Arnd Bergmann @ 2019-04-16 13:21 UTC (permalink / raw)
  To: arm
  Cc: Arnd Bergmann, Greg Ungerer, Wim Van Sebroeck, Guenter Roeck,
	linux-arm-kernel, linux-kernel, linux-watchdog

drivers should not rely on machine specific headers but
get their information from the platform device.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/arm/mach-ks8695/devices.c | 13 ++++++++++++-
 drivers/watchdog/Kconfig       |  2 +-
 drivers/watchdog/ks8695_wdt.c  | 29 ++++++++++++++++-------------
 3 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
index 15afeb964280..ba9d0f0f47ac 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..2a11cdfe2ab1 100644
--- a/drivers/watchdog/ks8695_wdt.c
+++ b/drivers/watchdog/ks8695_wdt.c
@@ -23,10 +23,8 @@
 #include <linux/watchdog.h>
 #include <linux/io.h>
 #include <linux/uaccess.h>
-#include <mach/hardware.h>
 
-#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);
 }
 
@@ -239,6 +238,10 @@ static int ks8695wdt_probe(struct platform_device *pdev)
 {
 	int res;
 
+	tmr_reg = devm_platform_ioremap_resource(pdev, 0);
+	if (!tmr_reg)
+		return -ENXIO;
+
 	if (ks8695wdt_miscdev.parent)
 		return -EBUSY;
 	ks8695wdt_miscdev.parent = &pdev->dev;
-- 
2.20.0


^ permalink raw reply related	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6 v2] ARM: ks8695: watchdog: stop using mach/*.h
  2019-04-16 13:21 ` [PATCH 1/6 v2] " Arnd Bergmann
@ 2019-04-16 18:09   ` Guenter Roeck
  0 siblings, 0 replies; 21+ messages in thread
From: Guenter Roeck @ 2019-04-16 18:09 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: arm, Greg Ungerer, Wim Van Sebroeck, linux-arm-kernel,
	linux-kernel, linux-watchdog

On Tue, Apr 16, 2019 at 03:21:41PM +0200, Arnd Bergmann wrote:
> drivers should not rely on machine specific headers but
> get their information from the platform device.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Guenter Roeck <linux@roeck-us.net>

I assume this will be applied through an arm tree since it touches arm code.

Thanks,
Guenter

> ---
>  arch/arm/mach-ks8695/devices.c | 13 ++++++++++++-
>  drivers/watchdog/Kconfig       |  2 +-
>  drivers/watchdog/ks8695_wdt.c  | 29 ++++++++++++++++-------------
>  3 files changed, 29 insertions(+), 15 deletions(-)
> 
> diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
> index 15afeb964280..ba9d0f0f47ac 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..2a11cdfe2ab1 100644
> --- a/drivers/watchdog/ks8695_wdt.c
> +++ b/drivers/watchdog/ks8695_wdt.c
> @@ -23,10 +23,8 @@
>  #include <linux/watchdog.h>
>  #include <linux/io.h>
>  #include <linux/uaccess.h>
> -#include <mach/hardware.h>
>  
> -#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);
>  }
>  
> @@ -239,6 +238,10 @@ static int ks8695wdt_probe(struct platform_device *pdev)
>  {
>  	int res;
>  
> +	tmr_reg = devm_platform_ioremap_resource(pdev, 0);
> +	if (!tmr_reg)
> +		return -ENXIO;
> +
>  	if (ks8695wdt_miscdev.parent)
>  		return -EBUSY;
>  	ks8695wdt_miscdev.parent = &pdev->dev;

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack
  2019-04-15 20:24 ` [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack Arnd Bergmann
@ 2019-04-20  2:06   ` Greg Ungerer
  0 siblings, 0 replies; 21+ messages in thread
From: Greg Ungerer @ 2019-04-20  2:06 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, arm, Greg Kroah-Hartman, Jiri Slaby, linux-serial,
	linux-kernel

Hi Arnd,

On 16/4/19 6:24 am, Arnd Bergmann wrote:
> The TX interrupt is marked as edge triggered, so it will
> already be acked by the top-level irq code, and does not
> need the ack in the driver.
> 
> Removing this avoids a nasty dependency on the regs-irq.h
> file that is otherwise reserved for the interrupt controller
> driver.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>   drivers/tty/serial/serial_ks8695.c | 5 -----
>   1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/tty/serial/serial_ks8695.c b/drivers/tty/serial/serial_ks8695.c
> index b461d791188c..6c5e9900e69d 100644
> --- a/drivers/tty/serial/serial_ks8695.c
> +++ b/drivers/tty/serial/serial_ks8695.c
> @@ -21,7 +21,6 @@
>   #include <asm/mach/irq.h>
>   
>   #include <mach/regs-uart.h>
> -#include <mach/regs-irq.h>
>   
>   #if defined(CONFIG_SERIAL_KS8695_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
>   #define SUPPORT_SYSRQ
> @@ -52,8 +51,6 @@
>   #define UART_GET_BRDR(p)	__raw_readl((p)->membase + KS8695_URBD)
>   #define UART_PUT_BRDR(p, c)	__raw_writel((c), (p)->membase + KS8695_URBD)
>   
> -#define KS8695_CLR_TX_INT()	__raw_writel(1 << KS8695_IRQ_UART_TX, KS8695_IRQ_VA + KS8695_INTST)
> -
>   #define UART_DUMMY_LSR_RX	0x100
>   #define UART_PORT_SIZE		(KS8695_USR - KS8695_URRB + 4)
>   
> @@ -207,7 +204,6 @@ static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id)
>   	unsigned int count;
>   
>   	if (port->x_char) {
> -		KS8695_CLR_TX_INT();
>   		UART_PUT_CHAR(port, port->x_char);
>   		port->icount.tx++;
>   		port->x_char = 0;
> @@ -221,7 +217,6 @@ static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id)
>   
>   	count = 16;	/* fifo size */
>   	while (!uart_circ_empty(xmit) && (count-- > 0)) {
> -		KS8695_CLR_TX_INT();

I haven't looked at the ks8695 in quite a while...
But I recall that this was very problematic at the time. Without this being
done after each character it was very easy to get the transmitter to "hang" -
and stop wanting to send any more characters.

I'd like to test this before acking.

Regards
Greg


>   		UART_PUT_CHAR(port, xmit->buf[xmit->tail]);
>   
>   		xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
                   ` (6 preceding siblings ...)
  2019-04-16 13:21 ` [PATCH 1/6 v2] " Arnd Bergmann
@ 2019-04-20  2:36 ` Greg Ungerer
  2019-05-03  7:02 ` Greg Ungerer
  8 siblings, 0 replies; 21+ messages in thread
From: Greg Ungerer @ 2019-04-20  2:36 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, arm, Wim Van Sebroeck, Guenter Roeck,
	linux-arm-kernel, linux-kernel, linux-watchdog

Hi Arnd,

On 16/4/19 6:24 am, Arnd Bergmann wrote:
> drivers should not rely on machine specific headers but
> get their information from the platform device.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I like the whole series, thanks for doing this.

I haven't looked at the KS8695 in a long time now. I am not sure
that I have any working hardware - but I will have a look around my lab
and see if I can find something.

I'll get back to you with acks and tested bys soon.

Regards
Greg



> ---
>   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 <linux/watchdog.h>
>   #include <linux/io.h>
>   #include <linux/uaccess.h>
> -#include <mach/hardware.h>
>   
> -#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;
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 4/6] ARM: ks8695: move gpio code back into platform
  2019-04-15 20:24 ` [PATCH 4/6] ARM: ks8695: move gpio code back into platform Arnd Bergmann
@ 2019-04-23 10:44   ` Linus Walleij
  0 siblings, 0 replies; 21+ messages in thread
From: Linus Walleij @ 2019-04-23 10:44 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Ungerer, arm-soc, Bartosz Golaszewski, Linux ARM,
	linux-kernel, open list:GPIO SUBSYSTEM

On Mon, Apr 15, 2019 at 10:27 PM Arnd Bergmann <arnd@arndb.de> wrote:

> 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 <arnd@arndb.de>

I bet a million to one it "just" needs to be reworked into a hierarchical
interrupt controller with the GPIO at the level below the irqchip adding
level semantics.

I did provide an example of how to do this in the ixp4xx patchset, but
if you don't have the hardware at hand I would not recommend trying
it.

With the goal of getting a better build for ARM32 maintenance I
think this is a lesser evil, so:
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
                   ` (7 preceding siblings ...)
  2019-04-20  2:36 ` [PATCH 1/6] " Greg Ungerer
@ 2019-05-03  7:02 ` Greg Ungerer
  2019-05-03  7:16   ` Linus Walleij
  8 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2019-05-03  7:02 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Linus Walleij, arm, Wim Van Sebroeck, Guenter Roeck,
	linux-arm-kernel, linux-kernel, linux-watchdog

Hi Arnd,

On 16/4/19 6:24 am, Arnd Bergmann wrote:
> drivers should not rely on machine specific headers but
> get their information from the platform device.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

I dug out some old ks8695 based hardware to try this out.
I had a lot of trouble getting anything modern working on it.
In the end I still don't have a reliable test bed to test this properly.

Your patch series works as well as the kernel before the changes,
so I am happy enough to ack them as they are.

Acked-by: Greg Ungerer <gerg@kernel.org>

Ultimately though I am left wondering if the ks8695 support in the
kernel is useful to anyone the way it is at the moment. With a minimal
kernel configuration I can boot up to a shell - but the system is
really unreliable if you try to interactively use it. I don't think
it is the hardware - it seems to run reliably with the old code
it has running from flash on it. I am only testing the new kernel,
running with the existing user space root filesystem on it (which
dates from 2004 :-)

Regards
Greg



>   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 <linux/watchdog.h>
>   #include <linux/io.h>
>   #include <linux/uaccess.h>
> -#include <mach/hardware.h>
>   
> -#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;
> 

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-05-03  7:02 ` Greg Ungerer
@ 2019-05-03  7:16   ` Linus Walleij
  2019-05-03 17:06     ` Guenter Roeck
  0 siblings, 1 reply; 21+ messages in thread
From: Linus Walleij @ 2019-05-03  7:16 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Arnd Bergmann, arm-soc, Wim Van Sebroeck, Guenter Roeck,
	Linux ARM, linux-kernel, LINUXWATCHDOG

On Fri, May 3, 2019 at 8:02 AM Greg Ungerer <gerg@uclinux.org> wrote:

> I dug out some old ks8695 based hardware to try this out.
> I had a lot of trouble getting anything modern working on it.
> In the end I still don't have a reliable test bed to test this properly.

What is usually used by old ARMv4 systems is OpenWrt or
OpenEmbedded. Those is the only build systems that reliably
produce a userspace for these things now, and it is also the
appropriate size for this kind of systems.

> Ultimately though I am left wondering if the ks8695 support in the
> kernel is useful to anyone the way it is at the moment. With a minimal
> kernel configuration I can boot up to a shell - but the system is
> really unreliable if you try to interactively use it. I don't think
> it is the hardware - it seems to run reliably with the old code
> it has running from flash on it. I am only testing the new kernel,
> running with the existing user space root filesystem on it (which
> dates from 2004 :-)

Personally I think it is a bad sign that this subarch and boards do
not have active OpenWrt support, they are routers after all (right?)
and any active use of networking equipment should use a recent
userspace as well, given all the security bugs that popped up over
the years.

With IXP4xx, Gemini and EP93xx we have found active users and
companies selling the chips and reference designs and even
recommending it for new products (!) at times.  If this is not the
case with KS8695 and no hobbyists are willing to submit it
to OpenWrt and modernize it to use device tree I think it should be
deleted from the kernel.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-05-03  7:16   ` Linus Walleij
@ 2019-05-03 17:06     ` Guenter Roeck
  2019-05-04 14:26       ` Greg Ungerer
  0 siblings, 1 reply; 21+ messages in thread
From: Guenter Roeck @ 2019-05-03 17:06 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Greg Ungerer, Arnd Bergmann, arm-soc, Wim Van Sebroeck,
	Linux ARM, linux-kernel, LINUXWATCHDOG

On Fri, May 03, 2019 at 08:16:05AM +0100, Linus Walleij wrote:
> On Fri, May 3, 2019 at 8:02 AM Greg Ungerer <gerg@uclinux.org> wrote:
> 
> > I dug out some old ks8695 based hardware to try this out.
> > I had a lot of trouble getting anything modern working on it.
> > In the end I still don't have a reliable test bed to test this properly.
> 
> What is usually used by old ARMv4 systems is OpenWrt or
> OpenEmbedded. Those is the only build systems that reliably
> produce a userspace for these things now, and it is also the
> appropriate size for this kind of systems.
> 
> > Ultimately though I am left wondering if the ks8695 support in the
> > kernel is useful to anyone the way it is at the moment. With a minimal
> > kernel configuration I can boot up to a shell - but the system is
> > really unreliable if you try to interactively use it. I don't think
> > it is the hardware - it seems to run reliably with the old code
> > it has running from flash on it. I am only testing the new kernel,
> > running with the existing user space root filesystem on it (which
> > dates from 2004 :-)
> 
> Personally I think it is a bad sign that this subarch and boards do
> not have active OpenWrt support, they are routers after all (right?)
> and any active use of networking equipment should use a recent
> userspace as well, given all the security bugs that popped up over
> the years.
> 
> With IXP4xx, Gemini and EP93xx we have found active users and
> companies selling the chips and reference designs and even
> recommending it for new products (!) at times.  If this is not the
> case with KS8695 and no hobbyists are willing to submit it
> to OpenWrt and modernize it to use device tree I think it should be
> deleted from the kernel.
> 

That may be the best approach if indeed no one is using it,
much less maintaining it.

Guenter

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-05-03 17:06     ` Guenter Roeck
@ 2019-05-04 14:26       ` Greg Ungerer
  2019-07-22 14:44         ` Arnd Bergmann
  0 siblings, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2019-05-04 14:26 UTC (permalink / raw)
  To: Guenter Roeck, Linus Walleij
  Cc: Arnd Bergmann, arm-soc, Wim Van Sebroeck, Linux ARM,
	linux-kernel, LINUXWATCHDOG


On 4/5/19 3:06 am, Guenter Roeck wrote:
> On Fri, May 03, 2019 at 08:16:05AM +0100, Linus Walleij wrote:
>> On Fri, May 3, 2019 at 8:02 AM Greg Ungerer <gerg@uclinux.org> wrote:
>>
>>> I dug out some old ks8695 based hardware to try this out.
>>> I had a lot of trouble getting anything modern working on it.
>>> In the end I still don't have a reliable test bed to test this properly.
>>
>> What is usually used by old ARMv4 systems is OpenWrt or
>> OpenEmbedded. Those is the only build systems that reliably
>> produce a userspace for these things now, and it is also the
>> appropriate size for this kind of systems.

No, I can produce a user space environment for the KS8695 as well
using the uClinux-dist build system. But that worked even less well
than the old root filesystem that I had (which was also built with
an older version of that build system).

But there is no reason that old root filesystem should not work.
And that is the thing that concerns me a bit here. I could mount
it ok (it was a CRAMFS), it would run up the shell to a shell prompt,
but when I try to run any commands from there they would oops.
I didn't debug any further than that.


>>> Ultimately though I am left wondering if the ks8695 support in the
>>> kernel is useful to anyone the way it is at the moment. With a minimal
>>> kernel configuration I can boot up to a shell - but the system is
>>> really unreliable if you try to interactively use it. I don't think
>>> it is the hardware - it seems to run reliably with the old code
>>> it has running from flash on it. I am only testing the new kernel,
>>> running with the existing user space root filesystem on it (which
>>> dates from 2004 :-)
>>
>> Personally I think it is a bad sign that this subarch and boards do
>> not have active OpenWrt support, they are routers after all (right?)
>> and any active use of networking equipment should use a recent
>> userspace as well, given all the security bugs that popped up over
>> the years.
>>
>> With IXP4xx, Gemini and EP93xx we have found active users and
>> companies selling the chips and reference designs and even
>> recommending it for new products (!) at times.  If this is not the
>> case with KS8695 and no hobbyists are willing to submit it
>> to OpenWrt and modernize it to use device tree I think it should be
>> deleted from the kernel.
>>
> 
> That may be the best approach if indeed no one is using it,
> much less maintaining it.

Well, I for one don't really use it any more. So I don't have a lot
of motivation to maintain it any longer.

Regards
Greg


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-05-04 14:26       ` Greg Ungerer
@ 2019-07-22 14:44         ` Arnd Bergmann
  2019-07-22 20:13           ` Olof Johansson
  2019-07-29 12:53           ` Greg Ungerer
  0 siblings, 2 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-07-22 14:44 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Guenter Roeck, Linus Walleij, arm-soc, Wim Van Sebroeck,
	Linux ARM, linux-kernel, LINUXWATCHDOG

On Sat, May 4, 2019 at 4:27 PM Greg Ungerer <gerg@kernel.org> wrote:
> On 4/5/19 3:06 am, Guenter Roeck wrote:
> > On Fri, May 03, 2019 at 08:16:05AM +0100, Linus Walleij wrote:
> >> On Fri, May 3, 2019 at 8:02 AM Greg Ungerer <gerg@uclinux.org> wrote:
> >>> Ultimately though I am left wondering if the ks8695 support in the
> >>> kernel is useful to anyone the way it is at the moment. With a minimal
> >>> kernel configuration I can boot up to a shell - but the system is
> >>> really unreliable if you try to interactively use it. I don't think
> >>> it is the hardware - it seems to run reliably with the old code
> >>> it has running from flash on it. I am only testing the new kernel,
> >>> running with the existing user space root filesystem on it (which
> >>> dates from 2004 :-)
> >>
> >> Personally I think it is a bad sign that this subarch and boards do
> >> not have active OpenWrt support, they are routers after all (right?)
> >> and any active use of networking equipment should use a recent
> >> userspace as well, given all the security bugs that popped up over
> >> the years.

Looking around on the internet, I found that Micrel at some point
had their own openwrt fork for ks8695, but I can't find a copy
any more, as the micrel.com domain is no longer used after the
acquisition by Microchip.

https://wikidevi.com/wiki/Micrel has a list of devices based on
ks8695, and it seems that most of these are rather memory
limited, which is a problem for recent openwrt builds.

Only two of the 17 listed devices have the absolute minimum of 4MB
flash and 32MB RAM for openwrt, two more have 8/32 and one
or two have 4/64, but all these configurations are too limited for the
web U/I now.

> >> With IXP4xx, Gemini and EP93xx we have found active users and
> >> companies selling the chips and reference designs and even
> >> recommending it for new products (!) at times.  If this is not the
> >> case with KS8695 and no hobbyists are willing to submit it
> >> to OpenWrt and modernize it to use device tree I think it should be
> >> deleted from the kernel.
> >>
> >
> > That may be the best approach if indeed no one is using it,
> > much less maintaining it.
>
> Well, I for one don't really use it any more. So I don't have a lot
> of motivation to maintain it any longer.

I came across my patches while rebasing my backlog to 5.3-rc1.

Should I save the (very small) trouble of sending them out again
and just remove the platform then?

      Arnd

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-07-22 14:44         ` Arnd Bergmann
@ 2019-07-22 20:13           ` Olof Johansson
  2019-07-29 12:53           ` Greg Ungerer
  1 sibling, 0 replies; 21+ messages in thread
From: Olof Johansson @ 2019-07-22 20:13 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Greg Ungerer, Guenter Roeck, Linus Walleij, arm-soc,
	Wim Van Sebroeck, Linux ARM, linux-kernel, LINUXWATCHDOG

On Mon, Jul 22, 2019 at 7:44 AM Arnd Bergmann <arnd@arndb.de> wrote:
>
> On Sat, May 4, 2019 at 4:27 PM Greg Ungerer <gerg@kernel.org> wrote:
> > On 4/5/19 3:06 am, Guenter Roeck wrote:
> > > On Fri, May 03, 2019 at 08:16:05AM +0100, Linus Walleij wrote:
> > >> On Fri, May 3, 2019 at 8:02 AM Greg Ungerer <gerg@uclinux.org> wrote:
> > >>> Ultimately though I am left wondering if the ks8695 support in the
> > >>> kernel is useful to anyone the way it is at the moment. With a minimal
> > >>> kernel configuration I can boot up to a shell - but the system is
> > >>> really unreliable if you try to interactively use it. I don't think
> > >>> it is the hardware - it seems to run reliably with the old code
> > >>> it has running from flash on it. I am only testing the new kernel,
> > >>> running with the existing user space root filesystem on it (which
> > >>> dates from 2004 :-)
> > >>
> > >> Personally I think it is a bad sign that this subarch and boards do
> > >> not have active OpenWrt support, they are routers after all (right?)
> > >> and any active use of networking equipment should use a recent
> > >> userspace as well, given all the security bugs that popped up over
> > >> the years.
>
> Looking around on the internet, I found that Micrel at some point
> had their own openwrt fork for ks8695, but I can't find a copy
> any more, as the micrel.com domain is no longer used after the
> acquisition by Microchip.
>
> https://wikidevi.com/wiki/Micrel has a list of devices based on
> ks8695, and it seems that most of these are rather memory
> limited, which is a problem for recent openwrt builds.
>
> Only two of the 17 listed devices have the absolute minimum of 4MB
> flash and 32MB RAM for openwrt, two more have 8/32 and one
> or two have 4/64, but all these configurations are too limited for the
> web U/I now.
>
> > >> With IXP4xx, Gemini and EP93xx we have found active users and
> > >> companies selling the chips and reference designs and even
> > >> recommending it for new products (!) at times.  If this is not the
> > >> case with KS8695 and no hobbyists are willing to submit it
> > >> to OpenWrt and modernize it to use device tree I think it should be
> > >> deleted from the kernel.
> > >>
> > >
> > > That may be the best approach if indeed no one is using it,
> > > much less maintaining it.
> >
> > Well, I for one don't really use it any more. So I don't have a lot
> > of motivation to maintain it any longer.
>
> I came across my patches while rebasing my backlog to 5.3-rc1.
>
> Should I save the (very small) trouble of sending them out again
> and just remove the platform then?

Given the lack of response/interest from users, I'm OK with removing it.

If someone shows up wanting support, we'll have a good opportunity to
discuss testing/modernization involving someone actively using the
hardware.


-Olof

^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-07-22 14:44         ` Arnd Bergmann
  2019-07-22 20:13           ` Olof Johansson
@ 2019-07-29 12:53           ` Greg Ungerer
  2019-07-29 15:45             ` Arnd Bergmann
  1 sibling, 1 reply; 21+ messages in thread
From: Greg Ungerer @ 2019-07-29 12:53 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Guenter Roeck, Linus Walleij, arm-soc, Wim Van Sebroeck,
	Linux ARM, linux-kernel, LINUXWATCHDOG

Hi Arnd,

On 23/7/19 12:44 am, Arnd Bergmann wrote:
> On Sat, May 4, 2019 at 4:27 PM Greg Ungerer <gerg@kernel.org> wrote:
>> On 4/5/19 3:06 am, Guenter Roeck wrote:
>>> On Fri, May 03, 2019 at 08:16:05AM +0100, Linus Walleij wrote:
>>>> On Fri, May 3, 2019 at 8:02 AM Greg Ungerer <gerg@uclinux.org> wrote:
>>>>> Ultimately though I am left wondering if the ks8695 support in the
>>>>> kernel is useful to anyone the way it is at the moment. With a minimal
>>>>> kernel configuration I can boot up to a shell - but the system is
>>>>> really unreliable if you try to interactively use it. I don't think
>>>>> it is the hardware - it seems to run reliably with the old code
>>>>> it has running from flash on it. I am only testing the new kernel,
>>>>> running with the existing user space root filesystem on it (which
>>>>> dates from 2004 :-)
>>>>
>>>> Personally I think it is a bad sign that this subarch and boards do
>>>> not have active OpenWrt support, they are routers after all (right?)
>>>> and any active use of networking equipment should use a recent
>>>> userspace as well, given all the security bugs that popped up over
>>>> the years.
> 
> Looking around on the internet, I found that Micrel at some point
> had their own openwrt fork for ks8695, but I can't find a copy
> any more, as the micrel.com domain is no longer used after the
> acquisition by Microchip.

I build it with uClinux-dist, https://sourceforge.net/projects/uclinux/files/uClinux%20Stable/.
And again I can build for it, it just doesn't currently work
in any sort of reasonable way. So I get the impression it
hasn't worked for a while and nobody has noticed.


> https://wikidevi.com/wiki/Micrel has a list of devices based on
> ks8695, and it seems that most of these are rather memory
> limited, which is a problem for recent openwrt builds.
> 
> Only two of the 17 listed devices have the absolute minimum of 4MB
> flash and 32MB RAM for openwrt, two more have 8/32 and one
> or two have 4/64, but all these configurations are too limited for the
> web U/I now.


>>>> With IXP4xx, Gemini and EP93xx we have found active users and
>>>> companies selling the chips and reference designs and even
>>>> recommending it for new products (!) at times.  If this is not the
>>>> case with KS8695 and no hobbyists are willing to submit it
>>>> to OpenWrt and modernize it to use device tree I think it should be
>>>> deleted from the kernel.
>>>>
>>>
>>> That may be the best approach if indeed no one is using it,
>>> much less maintaining it.
>>
>> Well, I for one don't really use it any more. So I don't have a lot
>> of motivation to maintain it any longer.
> 
> I came across my patches while rebasing my backlog to 5.3-rc1.
> 
> Should I save the (very small) trouble of sending them out again
> and just remove the platform then?

At this time I have no issue with removing it.

Regards
Greg


^ permalink raw reply	[flat|nested] 21+ messages in thread

* Re: [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h
  2019-07-29 12:53           ` Greg Ungerer
@ 2019-07-29 15:45             ` Arnd Bergmann
  0 siblings, 0 replies; 21+ messages in thread
From: Arnd Bergmann @ 2019-07-29 15:45 UTC (permalink / raw)
  To: Greg Ungerer
  Cc: Guenter Roeck, Linus Walleij, arm-soc, Wim Van Sebroeck,
	Linux ARM, linux-kernel, LINUXWATCHDOG

On Mon, Jul 29, 2019 at 2:53 PM Greg Ungerer <gerg@kernel.org> wrote:
> On 23/7/19 12:44 am, Arnd Bergmann wrote:
> > On Sat, May 4, 2019 at 4:27 PM Greg Ungerer <gerg@kernel.org> wrote:
> >> On 4/5/19 3:06 am, Guenter Roeck wrote:
> >>> On Fri, May 03, 2019 at 08:16:05AM +0100, Linus Walleij wrote:
> >>>> With IXP4xx, Gemini and EP93xx we have found active users and
> >>>> companies selling the chips and reference designs and even
> >>>> recommending it for new products (!) at times.  If this is not the
> >>>> case with KS8695 and no hobbyists are willing to submit it
> >>>> to OpenWrt and modernize it to use device tree I think it should be
> >>>> deleted from the kernel.
> >>>>
> >>>
> >>> That may be the best approach if indeed no one is using it,
> >>> much less maintaining it.
> >>
> >> Well, I for one don't really use it any more. So I don't have a lot
> >> of motivation to maintain it any longer.
> >
> > I came across my patches while rebasing my backlog to 5.3-rc1.
> >
> > Should I save the (very small) trouble of sending them out again
> > and just remove the platform then?
>
> At this time I have no issue with removing it.

Ok, let's do that then.

For reference, this is what I think we should do for the
remaining ARM9 based platforms that never gained multiplatform
support, as time permits:

netx: is now removed
ks8695: remove next
w90x900: probably remove, need to confirm with last known users
davinci: almost multiplatform now, should be done in 5.4
ep93xx: convert to common-clk, generic-irq, then enable multiplatform
 (linusw is on it)
omap1: convert to common-clk, change pcmcia driver to common
  I/O space method, use dma_pfn_offset for virt_to_bus, add ugly
  hacks for cpu_is_omap*() and omap_readl(), then enable multiplatform
  (arnd has started this)
lpc32xx: clean up header files so we can build last 6 drivers
  independently, then move to multiplatform, probably after 5.4
  I have patches for this somewhere.
s3c24xx: change 18 drivers that still use mach/* headers, get
  creative about mach-bast ISA I/O space

        Arnd

^ permalink raw reply	[flat|nested] 21+ messages in thread

end of thread, other threads:[~2019-07-29 15:46 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-15 20:24 [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Arnd Bergmann
2019-04-15 20:24 ` [PATCH 2/6] ARM: ks8695, net: use disable_irq/enable_irq Arnd Bergmann
2019-04-15 20:24 ` [PATCH 3/6] ARM: ks8695: net: move machine header contents Arnd Bergmann
2019-04-15 20:24 ` [PATCH 4/6] ARM: ks8695: move gpio code back into platform Arnd Bergmann
2019-04-23 10:44   ` Linus Walleij
2019-04-15 20:24 ` [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack Arnd Bergmann
2019-04-20  2:06   ` Greg Ungerer
2019-04-15 20:24 ` [PATCH 6/6] ARM: ks8695: split up uart register headers Arnd Bergmann
2019-04-15 20:54 ` [PATCH 1/6] ARM: ks8695: watchdog: stop using mach/*.h Guenter Roeck
2019-04-15 20:58   ` Arnd Bergmann
2019-04-16 13:21 ` [PATCH 1/6 v2] " Arnd Bergmann
2019-04-16 18:09   ` Guenter Roeck
2019-04-20  2:36 ` [PATCH 1/6] " Greg Ungerer
2019-05-03  7:02 ` Greg Ungerer
2019-05-03  7:16   ` Linus Walleij
2019-05-03 17:06     ` Guenter Roeck
2019-05-04 14:26       ` Greg Ungerer
2019-07-22 14:44         ` Arnd Bergmann
2019-07-22 20:13           ` Olof Johansson
2019-07-29 12:53           ` Greg Ungerer
2019-07-29 15:45             ` Arnd Bergmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).