rtc: 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: I1c225c1b68d94b22ca10423b50a78a0ba09a27a5 Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
parent
85b49efe67
commit
66f05ce4b3
8 changed files with 77 additions and 16 deletions
|
@ -151,4 +151,15 @@ config WDT_DW_IRQ
|
|||
|
||||
endif
|
||||
|
||||
if RTC
|
||||
|
||||
config RTC_DW
|
||||
def_bool y
|
||||
config RTC_DW_BASE_ADDR
|
||||
default 0xB0000400
|
||||
config RTC_DW_IRQ
|
||||
default 2
|
||||
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
@ -134,10 +134,8 @@ struct scss_interrupt {
|
|||
|
||||
|
||||
/* RTC */
|
||||
#define RTC_BASE_ADDR 0xB0000400
|
||||
#define CCU_RTC_CLK_DIV_OFFSET 0x3
|
||||
#define INT_RTC_MASK 0x478
|
||||
#define INT_RTC_IRQ 0x2
|
||||
#define CCU_RTC_PCLK_EN_SW (1 << 11)
|
||||
|
||||
|
||||
|
|
|
@ -176,6 +176,15 @@ config WDT_DW_IRQ
|
|||
default 12
|
||||
endif
|
||||
|
||||
if RTC
|
||||
config RTC_DW
|
||||
def_bool y
|
||||
config RTC_DW_BASE_ADDR
|
||||
default 0xB0000400
|
||||
config RTC_DW_IRQ
|
||||
default 11
|
||||
endif
|
||||
|
||||
config KERNEL_INIT_PRIORITY_DEFAULT
|
||||
default 40
|
||||
|
||||
|
|
|
@ -225,11 +225,9 @@ struct scss_interrupt {
|
|||
#define CCU_WDT_PCLK_EN_SW (1 << 10)
|
||||
|
||||
/* RTC */
|
||||
#define RTC_BASE_ADDR 0xB0000400
|
||||
#define CCU_RTC_CLK_DIV_OFFSET (3)
|
||||
#define SCSS_INT_RTC_MASK 0x478
|
||||
#define CCU_RTC_PCLK_EN_SW (1 << 11)
|
||||
#define INT_RTC_IRQ 0xb
|
||||
|
||||
/* Clock */
|
||||
#define CLOCK_PERIPHERAL_BASE_ADDR (SCSS_REGISTER_BASE + 0x18)
|
||||
|
|
|
@ -1,3 +1,24 @@
|
|||
# Kconfig - RTC 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.
|
||||
#
|
||||
|
||||
#
|
||||
# Real-Time Clock (RTC) options
|
||||
#
|
||||
menuconfig RTC
|
||||
bool "Real-Time Clock"
|
||||
default n
|
||||
|
@ -12,9 +33,31 @@ config RTC_DW
|
|||
help
|
||||
Designware RTC driver.
|
||||
|
||||
config RTC_IRQ_PRI
|
||||
int "RTC Interrupt Priority"
|
||||
default 2
|
||||
config RTC_DW_DRV_NAME
|
||||
string "Driver instance name"
|
||||
default "RTC_DW"
|
||||
depends on RTC_DW
|
||||
help
|
||||
RTC Interrupt Priority.
|
||||
Designware RTC driver instance name
|
||||
|
||||
config RTC_DW_BASE_ADDR
|
||||
hex "Base address"
|
||||
depends on RTC_DW
|
||||
default 0x00000000
|
||||
help
|
||||
Base address to access RTC DesignWare controller registers
|
||||
|
||||
config RTC_DW_IRQ
|
||||
int "Interrupt number"
|
||||
default 0
|
||||
depends on RTC_DW
|
||||
help
|
||||
DesignWare RTC interrupt number
|
||||
|
||||
config RTC_DW_IRQ_PRI
|
||||
int "Interrupt priority"
|
||||
default 2
|
||||
depends on RTC_DW
|
||||
help
|
||||
DesignWare RTC interrupt priority.
|
||||
endif # RTC
|
||||
|
|
|
@ -149,24 +149,28 @@ static struct rtc_driver_api funcs = {
|
|||
};
|
||||
|
||||
/* IRQ_CONFIG needs the flags variable declared by IRQ_CONNECT_STATIC */
|
||||
IRQ_CONNECT_STATIC(rtc, INT_RTC_IRQ, CONFIG_RTC_IRQ_PRI, rtc_dw_isr, 0, 0);
|
||||
IRQ_CONNECT_STATIC(rtc, CONFIG_RTC_DW_IRQ,
|
||||
CONFIG_RTC_DW_IRQ_PRI, rtc_dw_isr, 0, 0);
|
||||
|
||||
int rtc_dw_init(struct device *dev)
|
||||
{
|
||||
IRQ_CONFIG(rtc, INT_RTC_IRQ);
|
||||
irq_enable(INT_RTC_IRQ);
|
||||
IRQ_CONFIG(rtc, CONFIG_RTC_DW_IRQ);
|
||||
irq_enable(CONFIG_RTC_DW_IRQ);
|
||||
|
||||
SCSS_INTERRUPT->int_rtc_mask = INT_UNMASK_IA;
|
||||
dev->driver_api = &funcs;
|
||||
|
||||
return DEV_OK;
|
||||
}
|
||||
|
||||
struct rtc_dw_runtime rtc_runtime;
|
||||
|
||||
struct rtc_dw_dev_config rtc_dev = {
|
||||
.base_address = RTC_BASE_ADDR,
|
||||
.base_address = CONFIG_RTC_DW_BASE_ADDR,
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_INIT_CONFIG(rtc, RTC_DRV_NAME, &rtc_dw_init, &rtc_dev);
|
||||
DECLARE_DEVICE_INIT_CONFIG(rtc, CONFIG_RTC_DW_DRV_NAME,
|
||||
&rtc_dw_init, &rtc_dev);
|
||||
|
||||
SYS_DEFINE_DEVICE(rtc, &rtc_runtime, SECONDARY,
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
|
||||
|
|
|
@ -21,8 +21,6 @@
|
|||
#include <device.h>
|
||||
#include <rtc.h>
|
||||
|
||||
#define RTC_DRV_NAME "rtc"
|
||||
|
||||
#define RTC_CCVR (0x0)
|
||||
#define RTC_CMR (0x4)
|
||||
#define RTC_CLR (0x8)
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
|
||||
#define ALARM (RTC_ALARM_MINUTE / 6)
|
||||
#define RTC_DRIVER "rtc"
|
||||
#define RTC_DRIVER CONFIG_RTC_DW_DRV_NAME
|
||||
|
||||
void test_rtc_interrupt_fn(struct device *rtc_dev)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue