ARM: ks8695: watchdog: stop using mach/*.h
Subsystems (7)
PATCH 1/6 ARM: ks8695: watchdog: stop using mach/*.h
drivers should not rely on machine specific headers but get their information from the platform device.
--- arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 30 +++++++++++++++++------------- 3 files changed, 30 insertions(+), 15 deletions(-)
arch/arm/mach-ks8695/devices.c +12 -1
@@ -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 )
drivers/watchdog/Kconfig +1 -1
@@ -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.
drivers/watchdog/ks8695_wdt.c +17 -13
@@ -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 ;
Signature · 1 line
2.20.0
PATCH 2/6 ARM: ks8695, net: use disable_irq/enable_irq
Rather than poking the registers manually, better use the exported interfaces for it.
--- drivers/net/ethernet/micrel/ks8695net.c | 30 ++----------------------- 1 file changed, 2 insertions(+), 28 deletions(-)
drivers/net/ethernet/micrel/ks8695net.c +2 -28
@@ -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;
Signature · 1 line
2.20.0
PATCH 3/6 ARM: ks8695: net: move machine header contents
In reply to Arnd BergmannParts 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.
--- 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
arch/arm/mach-ks8695/cpu.c +1 -1
@@ -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 = {
arch/arm/mach-ks8695/devices.c +2 -3
@@ -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
arch/arm/mach-ks8695/include/mach/regs-misc.h deleted +0 -97
97 lines not on this page · raw message
arch/arm/mach-ks8695/include/mach/regs-switch.h deleted +0 -66
66 lines not on this page · raw message
arch/arm/mach-ks8695/regs-misc.h new file +33 -0
@@ -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
arch/arm/mach-ks8695/regs-switch.h new file +18 -0
@@ -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
drivers/net/ethernet/micrel/Kconfig +1 -1
@@ -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
drivers/net/ethernet/micrel/ks8695net.c +109 -7
127 lines not on this page · raw message
Signature · 1 line
2.20.0
PATCH 4/6 ARM: ks8695: move gpio code back into platform
In reply to Arnd BergmannProperly 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.
---
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%)arch/arm/mach-ks8695/Makefile +1 -1
@@ -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
arch/arm/mach-ks8695/board-acs5k.c +1 -1
@@ -34,7 +34,7 @@#include <asm/mach/irq.h> #include "devices.h" -#include <mach/gpio-ks8695.h> +#include "gpio-ks8695.h" #include "generic.h"
arch/arm/mach-ks8695/board-dsm320.c +1 -1
@@ -29,7 +29,7 @@#include <asm/mach/irq.h> #include "devices.h" -#include <mach/gpio-ks8695.h> +#include "gpio-ks8695.h" #include "generic.h"
arch/arm/mach-ks8695/board-micrel.c +1 -1
@@ -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"
arch/arm/mach-ks8695/board-og.c +2 -2
@@ -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)
arch/arm/mach-ks8695/gpio-ks8695.h renamed from arch/arm/mach-ks8695/include/mach/gpio-ks8695.h +0 -0
arch/arm/mach-ks8695/gpio.c renamed from drivers/gpio/gpio-ks8695.c +3 -3
@@ -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
arch/arm/mach-ks8695/irq.c +1 -1
@@ -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) {
arch/arm/mach-ks8695/regs-gpio.h renamed from arch/arm/mach-ks8695/include/mach/regs-gpio.h +0 -2
@@ -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.
drivers/gpio/Makefile +0 -1
@@ -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
Signature · 1 line
2.20.0
Re: [PATCH 4/6] ARM: ks8695: move gpio code back into platform
Quoted 6 lines · Arnd Bergmann
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 <[email protected]>
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:
Yours,
Linus Walleij
PATCH 5/6 ARM: ks8695, serial: skip manual tx IRQ ack
In reply to Arnd BergmannThe 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.
--- drivers/tty/serial/serial_ks8695.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/tty/serial/serial_ks8695.c +0 -5
@@ -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 );
Signature · 1 line
2.20.0
Re: [PATCH 5/6] ARM: ks8695, serial: skip manual tx IRQ ack
Hi Arnd,
Quoted 43 lines · Arnd Bergmann
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.hfile that is otherwise reserved for the interrupt controller driver.Signed-off-by Arnd Bergmann <[email protected]>--- drivers/tty/serial/serial_ks8695.c | 5 ----- 1 file changed, 5 deletions(-)drivers/tty/serial/serial_ks8695.c +0
-4@@ -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 ;
drivers/tty/serial/serial_ks8695.c static irqreturn_t ks8695uart_tx_chars(int irq, void *dev_id) · line 224
Quoted 4 lines
drivers/tty/serial/serial_ks8695.c +0
-1@@ -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
Quoted 4 lines
drivers/tty/serial/serial_ks8695.c +0
-0UART_PUT_CHAR (port, xmit->buf[xmit->tail]); xmit->tail = (xmit->tail +1 ) & (UART_XMIT_SIZE -1 );
PATCH 6/6 ARM: ks8695: split up uart register headers
In reply to Arnd BergmannThe 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.
--- 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
arch/arm/mach-ks8695/cpu.c +14 -1
@@ -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 (); }
arch/arm/mach-ks8695/devices.c +1 -1
@@ -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); } -/* -------------------------------------------------------------------- */ /*
arch/arm/mach-ks8695/include/mach/regs-uart.h deleted +0 -92
92 lines not on this page · raw message
arch/arm/mach-ks8695/include/mach/uncompress.h +15 -1
@@ -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) {
arch/arm/mach-ks8695/regs-uart.h new file +19 -0
@@ -0,0 +1,19 @@ +/* +* Copyright (C) 2006 Ben Dooks <[email protected]> +* 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
drivers/tty/serial/Kconfig +1 -1
@@ -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.
drivers/tty/serial/serial_ks8695.c +97 -26
210 lines not on this page · raw message
include/linux/platform_data/serial-ks8695.h new file +10 -0
@@ -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
Signature · 1 line
2.20.0
Guenter Roeck
maintainerQuoted 43 lines · Arnd Bergmann
drivers should not rely on machine specific headers but get their information from the platform device.
Signed-off-by Arnd Bergmann <[email protected]>--- arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 30 +++++++++++++++++------------- 3 files changed, 30 insertions(+), 15 deletions(-)arch/arm/mach-ks8695/devices.c +12
-1@@ -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 )drivers/watchdog/Kconfig +0
-0
drivers/watchdog/Kconfig config IXP4XX_WATCHDOG · line 400
Quoted 5 lines
drivers/watchdog/Kconfig +1
-1@@ -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 ?
Quoted 73 lines
drivers/watchdog/Kconfig +0
-0help Watchdog timer embedded into KS8695 processor. This will reboot your system when the timeout is reached.drivers/watchdog/ks8695_wdt.c +12
-13@@ -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); }
drivers/watchdog/ks8695_wdt.c static struct miscdevice ks8695wdt_miscdev = { · line 242
Quoted 6 lines
drivers/watchdog/ks8695_wdt.c +3
-0@@ -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
Quoted 5 lines
drivers/watchdog/ks8695_wdt.c +2
-0+if (!tmr_reg) +return -ENXIO ;if (ks8695wdt_miscdev.parent)return -EBUSY ;
Quoted 8 lines · Guenter Roeck
drivers/watchdog/Kconfig config IXP4XX_WATCHDOG · line 400
Quoted 6 lines
config
KS8695_WATCHDOG
tristate "KS8695 watchdog"drivers/watchdog/Kconfig +1
-1- depends on ARCH_KS8695 + depends on ARCH_KS8695 || COMPILE_TESTIs
__raw_readl/__raw_writelreally 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.
Quoted 9 lines
drivers/watchdog/ks8695_wdt.c static struct miscdevice ks8695wdt_miscdev = { · line 242
Quoted 7 lines
drivers/watchdog/ks8695_wdt.c +3
-0@@ -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
PATCH v2 1/6 ARM: ks8695: watchdog: stop using mach/*.h
In reply to Arnd Bergmanndrivers should not rely on machine specific headers but get their information from the platform device.
--- arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 29 ++++++++++++++++------------- 3 files changed, 29 insertions(+), 15 deletions(-)
arch/arm/mach-ks8695/devices.c +12 -1
@@ -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 )
drivers/watchdog/Kconfig +1 -1
@@ -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.
drivers/watchdog/ks8695_wdt.c +16 -13
@@ -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;
Signature · 1 line
2.20.0
Quoted 4 lines · Arnd Bergmann
drivers should not rely on machine specific headers but get their information from the platform device.
Signed-off-by Arnd Bergmann <[email protected]>
I assume this will be applied through an arm tree since it touches arm code.
Thanks,
Guenter
Quoted 127 lines
--- arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 29 ++++++++++++++++------------- 3 files changed, 29 insertions(+), 15 deletions(-)arch/arm/mach-ks8695/devices.c +12
-1@@ -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 )drivers/watchdog/Kconfig +1
-1@@ -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.drivers/watchdog/ks8695_wdt.c +16
-13@@ -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;
Hi Arnd,
Quoted 4 lines · Arnd Bergmann
drivers should not rely on machine specific headers but get their information from the platform device.
Signed-off-by Arnd Bergmann <[email protected]>
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
Quoted 129 lines
--- arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 30 +++++++++++++++++------------- 3 files changed, 30 insertions(+), 15 deletions(-)arch/arm/mach-ks8695/devices.c +12
-1@@ -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 )drivers/watchdog/Kconfig +1
-1@@ -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.drivers/watchdog/ks8695_wdt.c +17
-13@@ -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 ;
Hi Arnd,
Quoted 4 lines · Arnd Bergmann
drivers should not rely on machine specific headers but get their information from the platform device.
Signed-off-by Arnd Bergmann <[email protected]>
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.
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
Quoted 128 lines
arch/arm/mach-ks8695/devices.c | 13 ++++++++++++- drivers/watchdog/Kconfig | 2 +- drivers/watchdog/ks8695_wdt.c | 30 +++++++++++++++++------------- 3 files changed, 30 insertions(+), 15 deletions(-)arch/arm/mach-ks8695/devices.c +12
-1@@ -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 )drivers/watchdog/Kconfig +1
-1@@ -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.drivers/watchdog/ks8695_wdt.c +17
-13@@ -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 ;
Quoted 3 lines · Greg Ungerer
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.
Quoted 8 lines
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
Guenter Roeck
maintainerQuoted 26 lines · Linus Walleij
Quoted 3 lines · Greg Ungerer
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.
Quoted 8 lines
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.
Quoted 7 lines
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
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Linus Walleij
Quoted 3 lines · Greg Ungerer
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.
Quoted 23 lines
Quoted 15 lines
Quoted 8 lines
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.
Quoted 7 lines
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.
Quoted 2 lines
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
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 12 lines · Greg Ungerer
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Linus Walleij
Quoted 8 lines · Greg Ungerer
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 :-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 8 lines
Quoted 8 lines
Quoted 7 lines
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.
Quoted 5 lines
Quoted 2 lines
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
Quoted 45 lines · Arnd Bergmann
Quoted 12 lines · Greg Ungerer
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Linus Walleij
Quoted 8 lines · Greg Ungerer
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 :-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
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.
Quoted 7 lines
Quoted 2 lines
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
Hi Arnd,
Quoted 19 lines · Arnd Bergmann
Quoted 12 lines · Greg Ungerer
Quoted 11 lines · Guenter Roeck
Quoted 10 lines · Linus Walleij
Quoted 8 lines · Greg Ungerer
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 :-)
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 4 lines
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.
Quoted 21 lines
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.
Quoted 11 lines
Quoted 10 lines
Quoted 7 lines
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.
Quoted 7 lines
Quoted 2 lines
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
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 18 lines · Greg Ungerer
Quoted 17 lines · Arnd Bergmann
Quoted 15 lines · Greg Ungerer
Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Linus Walleij
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.
Quoted 6 lines
Quoted 4 lines
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