#include <asm/blackfin.h>
-#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
-#define stampit() stamp("here i am")
+#define dev_dbg_stamp(dev) dev_dbg(dev, "%s:%i: here i am\n", __func__, __LINE__)
struct bfin_rtc {
struct rtc_device *rtc_dev;
*/
static void rtc_bfin_sync_pending(void)
{
- stampit();
while (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_COMPLETE)) {
if (!(bfin_read_RTC_ISTAT() & RTC_ISTAT_WRITE_PENDING))
break;
bfin_write_RTC_ISTAT(RTC_ISTAT_WRITE_COMPLETE);
}
-static void rtc_bfin_reset(struct bfin_rtc *rtc)
+static void rtc_bfin_reset(struct device *dev)
{
+ struct bfin_rtc *rtc = dev_get_drvdata(dev);
/* Initialize the RTC. Enable pre-scaler to scale RTC clock
* to 1Hz and clear interrupt/status registers. */
spin_lock_irq(&rtc->lock);
unsigned long events = 0;
u16 rtc_istat;
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
static int bfin_rtc_open(struct device *dev)
{
- struct bfin_rtc *rtc = dev_get_drvdata(dev);
int ret;
- stampit();
+ dev_dbg_stamp(dev);
ret = request_irq(IRQ_RTC, bfin_rtc_interrupt, IRQF_DISABLED, "rtc-bfin", dev);
if (unlikely(ret)) {
return ret;
}
- rtc_bfin_reset(rtc);
+ rtc_bfin_reset(dev);
return ret;
}
static void bfin_rtc_release(struct device *dev)
{
- struct bfin_rtc *rtc = dev_get_drvdata(dev);
- stampit();
- rtc_bfin_reset(rtc);
+ dev_dbg_stamp(dev);
+ rtc_bfin_reset(dev);
free_irq(IRQ_RTC, dev);
}
{
struct bfin_rtc *rtc = dev_get_drvdata(dev);
- stampit();
+ dev_dbg_stamp(dev);
switch (cmd) {
case RTC_PIE_ON:
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
rtc_bfin_sync_pending();
bfin_write_RTC_ISTAT(RTC_ISTAT_STOPWATCH);
spin_unlock_irq(&rtc->lock);
return 0;
case RTC_PIE_OFF:
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
rtc_bfin_sync_pending();
bfin_write_RTC_SWCNT(0);
return 0;
case RTC_UIE_ON:
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
rtc_bfin_sync_pending();
bfin_write_RTC_ISTAT(RTC_ISTAT_SEC);
spin_unlock_irq(&rtc->lock);
return 0;
case RTC_UIE_OFF:
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
rtc_bfin_sync_pending();
bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~RTC_ISTAT_SEC);
u16 which_alarm;
int ret = 0;
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
return ret;
}
case RTC_AIE_OFF:
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
rtc_bfin_sync_pending();
bfin_write_RTC_ICTL(bfin_read_RTC_ICTL() & ~(RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
{
struct bfin_rtc *rtc = dev_get_drvdata(dev);
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
rtc_bfin_sync_pending();
int ret;
unsigned long now;
- stampit();
+ dev_dbg_stamp(dev);
spin_lock_irq(&rtc->lock);
static int bfin_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct bfin_rtc *rtc = dev_get_drvdata(dev);
- stampit();
+ dev_dbg_stamp(dev);
memcpy(&alrm->time, &rtc->rtc_alarm, sizeof(struct rtc_time));
alrm->pending = !!(bfin_read_RTC_ICTL() & (RTC_ISTAT_ALARM | RTC_ISTAT_ALARM_DAY));
return 0;
static int bfin_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
{
struct bfin_rtc *rtc = dev_get_drvdata(dev);
- stampit();
+ dev_dbg_stamp(dev);
memcpy(&rtc->rtc_alarm, &alrm->time, sizeof(struct rtc_time));
return 0;
}
{
#define yesno(x) ((x) ? "yes" : "no")
u16 ictl = bfin_read_RTC_ICTL();
- stampit();
+ dev_dbg_stamp(dev);
seq_printf(seq,
"alarm_IRQ\t: %s\n"
"wkalarm_IRQ\t: %s\n"
*/
static int bfin_irq_set_freq(struct device *dev, int freq)
{
- stampit();
+ dev_dbg_stamp(dev);
return -ENOTTY;
}
struct bfin_rtc *rtc;
int ret = 0;
- stampit();
+ dev_dbg_stamp(&pdev->dev);
rtc = kzalloc(sizeof(*rtc), GFP_KERNEL);
if (unlikely(!rtc))
static int __init bfin_rtc_init(void)
{
- stampit();
return platform_driver_register(&bfin_rtc_driver);
}