DS1391 RTC using SPI - problems

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I have a custom board with the AP7000 chip and I am trying to talk to a DS1391 RTC over the SPI Bus.

I have written my own driver for the RTC but before I even get to testing it I cannot get the RTC registered with the Kernel to even have my probe and other driver functions called.

This is what I have in setup.c:

static struct spi_board_info spi1_board_info[] __initdata = {
    {
	.modalias	= "rtc-ds1931",
	.max_speed_hz	= 500000,
	.chip_select	= 0,
	.mode		= SPI_MODE_3
    },
};

and I added the following line to the init function, also in setup.c:

at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));

However it seems the SPI bus is being set up correctly because when I cat

/sys/devices/platform/atmel_spi.1/spi1.0/modalias

it returns:

rtc-ds1391

When I do a dmesg all I can see so far are my debug messages from the init function within my driver.

Has anyone had any experience using RTCs and the SPI bus or can anyone point out the mistake I am bound to have made somewhere.

Regards,

Jeremy

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So your driver doesn't get probed? Is that your problem? All your SPI stuff is fine and this has nothing to do with the RTC core yet. Your modalias in the spi setup is rtc-ds1391, does that match the modalias of your driver?

Sorry, I don't know what your actual problem is at the moment :-). FWIW everything there looks correct for a driver called "rtc-ds1391" which is driving a device attached to chip select 0 of controller 1. What ever your problem is I reckon is either in your driver or a mismatch between your driver and the above code.

-S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Squidgit,

Thanks for your response.

I was assuming my problem was with the code I listed above, but I guess not :) .

I'll check my driver when I next get a chance at work.

Regards,

Jeremy

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

So is it "rtc-ds1931" or "rtc-ds1391"?

And I observe that drivers/rtc in 2.6.27-rc6 has no entry for an rtc-ds1391 driver. You may need to write that. :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hehe, yeah - was a simple typo, though I must have looked at it 100 times.

It is supposed to be rtc-ds1391, not rtc-ds1931!

Someone is Lysdexic :roll: