watchdog: dw: Make internal primitives Kconfig based
Base address, IRQ, interrupt priority as well as the instance name: all are now Kconfig based. Thus Applying the change to quark_se and quark_d2000 platforms. Sample code is updated as well. Change-Id: Idcc89e6e9f4acc337fafc7d42f8de3061a5ece04 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
466cb00d3f
commit
85b49efe67
8 changed files with 76 additions and 13 deletions
|
@ -140,4 +140,15 @@ config UART_PIPE_IRQ_PRI
|
|||
|
||||
endif
|
||||
|
||||
if WATCHDOG
|
||||
|
||||
config WDT_DW
|
||||
def_bool y
|
||||
config WDT_DW_BASE_ADDR
|
||||
default 0xB0000000
|
||||
config WDT_DW_IRQ
|
||||
default 16
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
@ -127,8 +127,6 @@ struct scss_interrupt {
|
|||
#define UART_IOAPIC_FLAGS (IOAPIC_LEVEL)
|
||||
|
||||
/* Watchdog */
|
||||
#define WDT_BASE_ADDR 0xB0000000
|
||||
#define INT_WDT_IRQ 0x10
|
||||
#define INT_WATCHDOG_MASK 0x47C
|
||||
#define SCSS_PERIPH_CFG0 0x4
|
||||
#define SCSS_PERIPH_CFG0_WDT_ENABLE (1 << 1)
|
||||
|
|
|
@ -167,6 +167,15 @@ config SPI_DW_PORT_1_IRQ
|
|||
default 3
|
||||
endif
|
||||
|
||||
if WATCHDOG
|
||||
config WDT_DW
|
||||
def_bool y
|
||||
config WDT_DW_BASE_ADDR
|
||||
default 0xB0000000
|
||||
config WDT_DW_IRQ
|
||||
default 12
|
||||
endif
|
||||
|
||||
config KERNEL_INIT_PRIORITY_DEFAULT
|
||||
default 40
|
||||
|
||||
|
|
|
@ -220,9 +220,6 @@ struct scss_interrupt {
|
|||
#define CCU_PWM_PCLK_EN_SW (1 << 12)
|
||||
|
||||
/* Watchdog */
|
||||
#define WDT_BASE_ADDR 0xB0000000
|
||||
#define INT_WDT_IRQ 0xc
|
||||
#define INT_WDT_IRQ_PRI 2
|
||||
#define INT_WATCHDOG_MASK 0x47C
|
||||
#define SCSS_PERIPH_CFG0_WDT_ENABLE (1 << 1)
|
||||
#define CCU_WDT_PCLK_EN_SW (1 << 10)
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
# Kconfig - Watchdog configuration options
|
||||
#
|
||||
#
|
||||
# Copyright (c) 2015 Intel Corporation
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#
|
||||
# Watchdog options
|
||||
#
|
||||
menuconfig WATCHDOG
|
||||
bool
|
||||
prompt "Watchdog Support"
|
||||
|
@ -12,4 +33,31 @@ config WDT_DW
|
|||
help
|
||||
Enable watchdog timer.
|
||||
|
||||
config WDT_DW_DRV_NAME
|
||||
string "Driver instance name"
|
||||
default "WDT_DW"
|
||||
depends on WDT_DW
|
||||
help
|
||||
Designware WDT driver instance name
|
||||
|
||||
config WDT_DW_BASE_ADDR
|
||||
hex "Base address"
|
||||
default 0x00000000
|
||||
depends on WDT_DW
|
||||
help
|
||||
Base address to access WDT DesignWare controller registers
|
||||
|
||||
config WDT_DW_IRQ
|
||||
int "Interrupt number"
|
||||
default 0
|
||||
depends on WDT_DW
|
||||
help
|
||||
DesignWare WDT interrupt number
|
||||
|
||||
config WDT_DW_IRQ_PRI
|
||||
int "Interrupt priority"
|
||||
default 2
|
||||
depends on WDT_DW
|
||||
help
|
||||
DesignWare WDT interrupt priority
|
||||
endif
|
||||
|
|
|
@ -107,14 +107,15 @@ static struct wdt_driver_api wdt_dw_funcs = {
|
|||
};
|
||||
|
||||
/* IRQ_CONFIG needs the flags variable declared by IRQ_CONNECT_STATIC */
|
||||
IRQ_CONNECT_STATIC(wdt_dw, INT_WDT_IRQ, INT_WDT_IRQ_PRI, wdt_dw_isr, 0, 0);
|
||||
IRQ_CONNECT_STATIC(wdt_dw, CONFIG_WDT_DW_IRQ,
|
||||
CONFIG_WDT_DW_IRQ_PRI, wdt_dw_isr, 0, 0);
|
||||
|
||||
int wdt_dw_init(struct device *dev)
|
||||
{
|
||||
dev->driver_api = &wdt_dw_funcs;
|
||||
|
||||
IRQ_CONFIG(wdt_dw, INT_WDT_IRQ);
|
||||
irq_enable(INT_WDT_IRQ);
|
||||
IRQ_CONFIG(wdt_dw, CONFIG_WDT_DW_IRQ);
|
||||
irq_enable(CONFIG_WDT_DW_IRQ);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -122,10 +123,11 @@ int wdt_dw_init(struct device *dev)
|
|||
struct wdt_dw_runtime wdt_runtime;
|
||||
|
||||
struct wdt_dw_dev_config wdt_dev = {
|
||||
.base_address = WDT_BASE_ADDR,
|
||||
.base_address = CONFIG_WDT_DW_BASE_ADDR,
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(wdt, WDT_DRV_NAME, &wdt_dw_init, &wdt_dev);
|
||||
DECLARE_DEVICE_INIT_CONFIG(wdt, CONFIG_WDT_DW_DRV_NAME,
|
||||
&wdt_dw_init, &wdt_dev);
|
||||
|
||||
SYS_DEFINE_DEVICE(wdt, &wdt_runtime, SECONDARY,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
|
|
|
@ -45,8 +45,6 @@
|
|||
#define WDT_CR_INT_ENABLE (1 << 1)
|
||||
|
||||
|
||||
#define WDT_DRV_NAME "wdt_dw"
|
||||
|
||||
struct wdt_dw_runtime {
|
||||
void (*cb_fn)(struct device *dev);
|
||||
};
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
uint32_t wdt_fired;
|
||||
|
||||
#define WDT_DRIVER "wdt_dw"
|
||||
#define WDT_DRIVER CONFIG_WDT_DW_DRV_NAME
|
||||
|
||||
/* WDT Requires a callback, there is no interrupt enable / disable. */
|
||||
void wdt_example_cb(struct device *dev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue