#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
#define MAX6902_REG_SECONDS 0x01
#define MAX6902_REG_MINUTES 0x03
#define MAX6902_REG_HOURS 0x05
#define MAX6902_REG_DATE 0x07
#define MAX6902_REG_MONTH 0x09
#define MAX6902_REG_DAY 0x0B
#define MAX6902_REG_YEAR 0x0D
#define MAX6902_REG_CONTROL 0x0F
#define MAX6902_REG_CENTURY 0x13
static int max6902_set_reg(struct device *dev, unsigned char address,
struct spi_device *spi = to_spi_device(dev);
return spi_write_then_read(spi, buf, 2, NULL, 0);
static int max6902_get_reg(struct device *dev, unsigned char address,
struct spi_device *spi = to_spi_device(dev);
return spi_write_then_read(spi, data, 1, data, 1);
static int max6902_read_time(struct device *dev, struct rtc_time *dt)
struct spi_device *spi = to_spi_device(dev);