#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/slab.h>
#include <linux/irq.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <linux/mfd/core.h>
#include <linux/mfd/tmio.h>
#include <linux/mfd/t7l66xb.h>
enum {
T7L66XB_CELL_NAND,
T7L66XB_CELL_MMC,
};
static const struct resource t7l66xb_mmc_resources[] = {
{
.start = 0x800,
.end = 0x9ff,
.flags = IORESOURCE_MEM,
},
{
.start = IRQ_T7L66XB_MMC,
.end = IRQ_T7L66XB_MMC,
.flags = IORESOURCE_IRQ,
},
};
#define SCR_REVID 0x08
#define SCR_IMR 0x42
#define SCR_DEV_CTL 0xe0
#define SCR_ISR 0xe1
#define SCR_GPO_OC 0xf0
#define SCR_GPO_OS 0xf1
#define SCR_GPI_S 0xf2
#define SCR_APDC 0xf8
#define SCR_DEV_CTL_USB BIT(0)
#define SCR_DEV_CTL_MMC BIT(1)
struct t7l66xb {
void __iomem *scr;
raw_spinlock_t lock;
struct resource rscr;
struct clk *clk48m;
struct clk *clk32k;
int irq;
int irq_base;
};
static int t7l66xb_mmc_enable(struct platform_device *mmc)
{
struct t7l66xb *t7l66xb = dev_get_drvdata(mmc->dev.parent);
unsigned long flags;
u8 dev_ctl;
int ret;
ret = clk_prepare_enable(t7l66xb->clk32k);
if (ret)
return ret;
raw_spin_lock_irqsave(&t7l66xb->lock, flags);