Cleanup glamo mmc driver.

SVN-Revision: 16786
This commit is contained in:
Lars-Peter Clausen 2009-07-11 19:07:15 +00:00
parent a21bf40453
commit 4147b632e9
4 changed files with 324 additions and 584 deletions

View file

@ -45,8 +45,6 @@
#include <asm/uaccess.h>
#include <asm/div64.h>
//#include <mach/regs-irq.h>
#ifdef CONFIG_PM
#include <linux/pm.h>
#endif
@ -54,11 +52,8 @@
#include "glamo-regs.h"
#include "glamo-core.h"
#define RESSIZE(ressource) (((ressource)->end - (ressource)->start)+1)
#define GLAMO_MEM_REFRESH_COUNT 0x100
/*
* Glamo internal settings
*
@ -151,27 +146,6 @@ static inline void __reg_clear_bit(struct glamo_core *glamo,
__reg_set_bit_mask(glamo, reg, bit, 0);
}
static inline void glamo_vmem_write(struct glamo_core *glamo, u_int32_t addr,
u_int16_t *src, int len)
{
if (addr & 0x0001 || (unsigned long)src & 0x0001 || len & 0x0001) {
dev_err(&glamo->pdev->dev, "unaligned write(0x%08x, 0x%p, "
"0x%x)!!\n", addr, src, len);
}
}
static inline void glamo_vmem_read(struct glamo_core *glamo, u_int16_t *buf,
u_int32_t addr, int len)
{
if (addr & 0x0001 || (unsigned long) buf & 0x0001 || len & 0x0001) {
dev_err(&glamo->pdev->dev, "unaligned read(0x%p, 0x08%x, "
"0x%x)!!\n", buf, addr, len);
}
}
/***********************************************************************
* resources of sibling devices
***********************************************************************/
@ -307,10 +281,10 @@ static struct resource glamo_mmc_resources[] = {
},
};
struct glamo_mci_pdata glamo_mci_def_pdata = {
static struct glamo_mci_pdata glamo_mci_def_pdata = {
.gpio_detect = 0,
.glamo_can_set_mci_power = NULL, /* filled in from MFD platform data */
.ocr_avail = MMC_VDD_20_21 |
/* .ocr_avail = MMC_VDD_20_21 |
MMC_VDD_21_22 |
MMC_VDD_22_23 |
MMC_VDD_23_24 |
@ -321,14 +295,11 @@ struct glamo_mci_pdata glamo_mci_def_pdata = {
MMC_VDD_28_29 |
MMC_VDD_29_30 |
MMC_VDD_30_31 |
MMC_VDD_32_33,
MMC_VDD_32_33,*/
.glamo_irq_is_wired = NULL, /* filled in from MFD platform data */
.mci_suspending = NULL, /* filled in from MFD platform data */
.mci_all_dependencies_resumed = NULL, /* filled in from MFD platform data */
};
EXPORT_SYMBOL_GPL(glamo_mci_def_pdata);
static void mangle_mem_resources(struct resource *res, int num_res,
struct resource *parent)
@ -1378,6 +1349,7 @@ static int __init glamo_probe(struct platform_device *pdev)
glamo_mmc_dev->dev.parent = &pdev->dev;
glamo_mmc_dev->resource = glamo_mmc_resources;
glamo_mmc_dev->num_resources = ARRAY_SIZE(glamo_mmc_resources);
glamo_mmc_dev->dev.platform_data = &glamo_mci_def_pdata;
/* we need it later to give to the engine enable and disable */
glamo_mci_def_pdata.pglamo = glamo;

View file

@ -45,7 +45,6 @@ struct glamo_mci_pdata {
struct glamo_core * pglamo;
unsigned int gpio_detect;
unsigned int gpio_wprotect;
unsigned long ocr_avail;
int (*glamo_can_set_mci_power)(void);
/* glamo-mci asking if it should use the slow clock to card */
int (*glamo_mci_use_slow)(void);

View file

@ -12,28 +12,14 @@
#include <linux/regulator/consumer.h>
enum glamo_mci_waitfor {
COMPLETION_NONE,
COMPLETION_FINALIZE,
COMPLETION_CMDSENT,
COMPLETION_RSPFIN,
COMPLETION_XFERFINISH,
COMPLETION_XFERFINISH_RSPFIN,
};
struct glamo_mci_host {
struct platform_device *pdev;
struct glamo_mci_pdata *pdata;
struct mmc_host *mmc;
struct resource *mem;
struct resource *mem_data;
struct clk *clk;
void __iomem *base;
u16 __iomem *base_data;
int irq;
int irq_cd;
int dma;
int data_max_size;
struct resource *mmio_mem;
struct resource *data_mem;
void __iomem *mmio_base;
u16 __iomem *data_base;
int suspending;
@ -43,42 +29,15 @@ struct glamo_mci_host {
unsigned long clk_rate;
unsigned long clk_div;
unsigned long real_rate;
u8 prescaler;
int force_slow_during_powerup;
unsigned sdiimsk;
int dodma;
volatile int dmatogo;
struct mmc_request *mrq;
int cmd_is_stop;
struct work_struct irq_work;
spinlock_t complete_lock;
volatile enum glamo_mci_waitfor
complete_what;
spinlock_t lock;
volatile int dma_complete;
volatile u32 pio_sgptr;
volatile u32 pio_words;
volatile u32 pio_count;
volatile u16 *pio_ptr;
#define XFER_NONE 0
#define XFER_READ 1
#define XFER_WRITE 2
volatile u32 pio_active;
int bus_width;
char dbgmsg_cmd[301];
char dbgmsg_dat[301];
volatile char *status;
unsigned int ccnt, dcnt;
struct tasklet_struct pio_tasklet;
unsigned int request_counter;
struct regulator *regulator;
};