lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190416180938.GA23210@roeck-us.net>
Date:   Tue, 16 Apr 2019 11:09:38 -0700
From:   Guenter Roeck <linux@...ck-us.net>
To:     Arnd Bergmann <arnd@...db.de>
Cc:     arm@...nel.org, Greg Ungerer <gerg@...inux.org>,
        Wim Van Sebroeck <wim@...ux-watchdog.org>,
        linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        linux-watchdog@...r.kernel.org
Subject: Re: [PATCH 1/6 v2] ARM: ks8695: watchdog: stop using mach/*.h

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@...db.de>

Acked-by: Guenter Roeck <linux@...ck-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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ