Cleanup glamo platform_data.

SVN-Revision: 16863
This commit is contained in:
Lars-Peter Clausen 2009-07-16 12:06:48 +00:00
parent 3d2040de0f
commit 93d3f098eb
11 changed files with 191 additions and 212 deletions

View file

@ -2,30 +2,19 @@
#define _LINUX_GLAMOFB_H
#include <linux/fb.h>
#include <linux/glamo-engine.h>
#ifdef __KERNEL__
#include <linux/spi/glamo.h>
struct glamo_core;
struct glamofb_handle;
struct glamofb_platform_data {
int width, height;
struct glamo_fb_platform_data {
int width, height;
int num_modes;
struct fb_videomode *modes;
int num_modes;
struct fb_videomode *modes;
struct glamo_spigpio_info *spigpio_info;
struct glamo_core *glamo;
/* glamo mmc platform specific info */
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);
int (*glamo_irq_is_wired)(void);
void (*glamo_external_reset)(int);
struct glamo_core *core;
};
int glamofb_cmd_mode(struct glamofb_handle *gfb, int on);

View file

@ -35,7 +35,6 @@
#include <linux/platform_device.h>
#include <linux/serial_core.h>
#include <linux/spi/spi.h>
#include <linux/spi/glamo.h>
#include <linux/spi/spi_bitbang.h>
#include <linux/mmc/host.h>
@ -97,6 +96,8 @@
#include <linux/jbt6k74.h>
#include <linux/glamofb.h>
#include <linux/mfd/glamo.h>
#include <linux/spi/glamo.h>
#include <linux/hdq.h>
#include <linux/bq27000_battery.h>
@ -1108,14 +1109,6 @@ const struct jbt6k74_platform_data jbt6k74_pdata = {
.probe_completed = gta02_jbt6k74_probe_completed,
};
static struct glamo_spigpio_info glamo_spigpio_cfg = {
.pin_clk = GLAMO_GPIO10_OUTPUT,
.pin_mosi = GLAMO_GPIO11_OUTPUT,
.pin_cs = GLAMO_GPIO12_OUTPUT,
.pin_miso = 0,
.bus_num = 2,
};
/*----------- SPI: Accelerometers attached to SPI of s3c244x ----------------- */
void gta02_lis302dl_suspend_io(struct lis302dl_info *lis, int resume)
@ -1359,19 +1352,6 @@ static int glamo_irq_is_wired(void)
return -ENODEV;
}
static int gta02_glamo_can_set_mmc_power(void)
{
switch (S3C_SYSTEM_REV_ATAG) {
case GTA02v3_SYSTEM_REV:
case GTA02v4_SYSTEM_REV:
case GTA02v5_SYSTEM_REV:
case GTA02v6_SYSTEM_REV:
return 1;
}
return 0;
}
/* Smedia Glamo 3362 */
/*
@ -1417,21 +1397,35 @@ static struct fb_videomode gta02_glamo_modes[] = {
}
};
static struct glamofb_platform_data gta02_glamo_pdata = {
.width = 43,
.height = 58,
static struct glamo_fb_platform_data gta02_glamo_fb_pdata = {
.width = 43,
.height = 58,
.num_modes = ARRAY_SIZE(gta02_glamo_modes),
.modes = gta02_glamo_modes,
};
.spigpio_info = &glamo_spigpio_cfg,
static struct glamo_spigpio_platform_data gta02_glamo_spigpio_pdata = {
.pin_clk = GLAMO_GPIO10_OUTPUT,
.pin_mosi = GLAMO_GPIO11_OUTPUT,
.pin_cs = GLAMO_GPIO12_OUTPUT,
.pin_miso = 0,
.bus_num = 2,
};
static struct glamo_mmc_platform_data gta02_glamo_mmc_pdata = {
.glamo_mmc_use_slow = gta02_glamo_mci_use_slow,
};
static struct glamo_platform_data gta02_glamo_pdata = {
.fb_data = &gta02_glamo_fb_pdata,
.spigpio_data = &gta02_glamo_spigpio_pdata,
.mmc_data = &gta02_glamo_mmc_pdata,
.osci_clock_rate = 32768,
/* glamo MMC function platform data */
.glamo_can_set_mci_power = gta02_glamo_can_set_mmc_power,
.glamo_mci_use_slow = gta02_glamo_mci_use_slow,
.glamo_irq_is_wired = glamo_irq_is_wired,
.glamo_external_reset = gta02_glamo_external_reset
.glamo_external_reset = gta02_glamo_external_reset,
};
static struct resource gta02_glamo_resources[] = {
@ -1643,7 +1637,7 @@ static void __init gta02_machine_init(void)
s3c24xx_udc_set_platdata(&gta02_udc_cfg);
s3c_i2c0_set_platdata(NULL);
set_s3c2410ts_info(&gta02_ts_cfg);
mangle_glamo_res_by_system_rev();
i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
@ -1683,7 +1677,7 @@ static void __init gta02_machine_init(void)
platform_device_register(&gta02_hdq_device);
#endif
#ifdef CONFIG_LEDS_GTA02_VIBRATOR
gta02_vibrator_dev.dev.parent = &s3c24xx_pwm_device.dev;
gta02_vibrator_dev.dev.parent = &s3c24xx_pwm_device.dev;
platform_device_register(&gta02_vibrator_dev);
#endif
}

View file

@ -25,25 +25,22 @@
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/tty.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/wait.h>
#include <linux/platform_device.h>
#include <linux/kernel_stat.h>
#include <linux/spinlock.h>
#include <linux/glamofb.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/host.h>
#include <linux/mfd/core.h>
#include <linux/mfd/glamo.h>
#include <linux/spi/glamo.h>
#include <linux/glamo-gpio.h>
#include <linux/glamofb.h>
#include <linux/io.h>
#include <asm/io.h>
#include <asm/uaccess.h>
#include <asm/div64.h>
#ifdef CONFIG_PM
@ -81,7 +78,7 @@ struct reg_range {
};
struct reg_range reg_range[] = {
{ 0x0000, 0x76, "General", 1 },
{ 0x0200, 0x16, "Host Bus", 1 },
{ 0x0200, 0x18, "Host Bus", 1 },
{ 0x0300, 0x38, "Memory", 1 },
/* { 0x0400, 0x100, "Sensor", 0 }, */
/* { 0x0500, 0x300, "ISP", 0 }, */
@ -180,14 +177,6 @@ static struct resource glamo_mmc_resources[] = {
},
};
static struct glamo_mci_pdata glamo_mci_def_pdata = {
.gpio_detect = 0,
.glamo_can_set_mci_power = NULL, /* filled in from MFD platform data */
.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 */
};
enum glamo_cells {
GLAMO_CELL_FB,
GLAMO_CELL_MMC,
@ -620,8 +609,7 @@ static int glamo_pll_rate(struct glamo_core *glamo,
{
u_int16_t reg;
unsigned int div = 512;
/* FIXME: move osci into platform_data */
unsigned int osci = 32768;
unsigned int osci = glamo->pdata->osci_clock_rate;
if (osci == 32768)
div = 1;
@ -887,7 +875,7 @@ static void glamo_power(struct glamo_core *glamo,
{
int n;
unsigned long flags;
spin_lock_irqsave(&glamo->lock, flags);
dev_info(&glamo->pdev->dev, "***** glamo_power -> %d\n", new_state);
@ -1188,28 +1176,21 @@ static int __init glamo_probe(struct platform_device *pdev)
glamo_pll_rate(glamo, GLAMO_PLL1),
glamo_pll_rate(glamo, GLAMO_PLL2));
glamo->pdata->glamo = glamo;
/* bring MCI specific stuff over from our MFD platform data */
glamo_mci_def_pdata.glamo_can_set_mci_power =
glamo->pdata->glamo_can_set_mci_power;
glamo_mci_def_pdata.glamo_mci_use_slow =
glamo->pdata->glamo_mci_use_slow;
glamo_mci_def_pdata.glamo_irq_is_wired =
glamo->pdata->glamo_irq_is_wired;
glamo_mci_def_pdata.pglamo = glamo;
/* register siblings */
glamo_cells[GLAMO_CELL_MMC].platform_data = &glamo_mci_def_pdata;
glamo_cells[GLAMO_CELL_MMC].data_size = sizeof(glamo_mci_def_pdata);
glamo->pdata->mmc_data->core = glamo;
glamo_cells[GLAMO_CELL_MMC].platform_data = glamo->pdata->mmc_data;
glamo_cells[GLAMO_CELL_MMC].data_size =
sizeof(struct glamo_mmc_platform_data);
glamo_cells[GLAMO_CELL_FB].platform_data = glamo->pdata;
glamo_cells[GLAMO_CELL_FB].data_size = sizeof(struct glamofb_platform_data);
glamo->pdata->fb_data->core = glamo;
glamo_cells[GLAMO_CELL_FB].platform_data = glamo->pdata->fb_data;
glamo_cells[GLAMO_CELL_FB].data_size = sizeof(struct glamo_fb_platform_data);
glamo->pdata->spigpio_info->glamo = glamo;
glamo_cells[GLAMO_CELL_SPI_GPIO].platform_data = glamo->pdata->spigpio_info;
glamo->pdata->spigpio_data->core = glamo;
glamo_cells[GLAMO_CELL_SPI_GPIO].platform_data =
glamo->pdata->spigpio_data;
glamo_cells[GLAMO_CELL_SPI_GPIO].data_size =
sizeof(struct glamo_spigpio_info);
sizeof(struct glamo_spigpio_platform_data);
mfd_add_devices(&pdev->dev, pdev->id, glamo_cells,
ARRAY_SIZE(glamo_cells),

View file

@ -2,7 +2,7 @@
#define __GLAMO_CORE_H
#include <asm/system.h>
#include <linux/glamo-engine.h>
#include <linux/mfd/glamo.h>
/* for the time being, we put the on-screen framebuffer into the lowest
* VRAM space. This should make the code easily compatible with the various
@ -24,7 +24,7 @@ struct glamo_core {
struct resource *mem_core;
void __iomem *base;
struct platform_device *pdev;
struct glamofb_platform_data *pdata;
struct glamo_platform_data *pdata;
u_int16_t type;
u_int16_t revision;
spinlock_t lock;
@ -41,19 +41,6 @@ struct glamo_script {
int glamo_run_script(struct glamo_core *glamo,
struct glamo_script *script, int len, int may_sleep);
struct glamo_mci_pdata {
struct glamo_core * pglamo;
unsigned int gpio_detect;
unsigned int gpio_wprotect;
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);
int (*glamo_irq_is_wired)(void);
void (*mci_suspending)(struct platform_device *dev);
int (*mci_all_dependencies_resumed)(struct platform_device *dev);
};
int glamo_engine_enable(struct glamo_core *glamo, enum glamo_engine engine);
int glamo_engine_disable(struct glamo_core *glamo, enum glamo_engine engine);
void glamo_engine_reset(struct glamo_core *glamo, enum glamo_engine engine);

View file

@ -22,23 +22,15 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <linux/fb.h>
#include <linux/init.h>
#include <linux/vmalloc.h>
#include <linux/dma-mapping.h>
#include <linux/interrupt.h>
#include <linux/workqueue.h>
#include <linux/wait.h>
#include <linux/platform_device.h>
#include <linux/clk.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/uaccess.h>
#include <linux/mfd/glamo.h>
#include <asm/div64.h>
@ -69,7 +61,7 @@ struct glamofb_handle {
struct resource *reg;
struct resource *fb_res;
char __iomem *base;
struct glamofb_platform_data *mach_info;
struct glamo_fb_platform_data *mach_info;
char __iomem *cursor_addr;
int cursor_on;
u_int32_t pseudo_pal[16];
@ -80,7 +72,7 @@ struct glamofb_handle {
};
static void glamo_output_enable(struct glamofb_handle *gfb) {
struct glamo_core *gcore = gfb->mach_info->glamo;
struct glamo_core *gcore = gfb->mach_info->core;
if (gfb->output_enabled)
return;
@ -97,7 +89,7 @@ static void glamo_output_enable(struct glamofb_handle *gfb) {
}
static void glamo_output_disable(struct glamofb_handle *gfb) {
struct glamo_core *gcore = gfb->mach_info->glamo;
struct glamo_core *gcore = gfb->mach_info->core;
if (!gfb->output_enabled)
return;
@ -166,8 +158,8 @@ static int glamofb_run_script(struct glamofb_handle *glamo,
{
int i;
if (glamo->mach_info->glamo->suspending) {
dev_err(&glamo->mach_info->glamo->pdev->dev,
if (glamo->mach_info->core->suspending) {
dev_err(&glamo->mach_info->core->pdev->dev,
"IGNORING glamofb_run_script while "
"suspended\n");
return -EBUSY;
@ -192,8 +184,8 @@ static int glamofb_check_var(struct fb_var_screeninfo *var,
{
struct glamofb_handle *glamo = info->par;
if (glamo->mach_info->glamo->suspending) {
dev_err(&glamo->mach_info->glamo->pdev->dev,
if (glamo->mach_info->core->suspending) {
dev_err(&glamo->mach_info->core->pdev->dev,
"IGNORING glamofb_check_var while "
"suspended\n");
return -EBUSY;
@ -280,8 +272,8 @@ static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation)
{
int glamo_rot;
if (glamo->mach_info->glamo->suspending) {
dev_err(&glamo->mach_info->glamo->pdev->dev,
if (glamo->mach_info->core->suspending) {
dev_err(&glamo->mach_info->core->pdev->dev,
"IGNORING rotate_lcd while "
"suspended\n");
return;
@ -316,7 +308,7 @@ static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation)
static void glamofb_program_mode(struct glamofb_handle* gfb) {
int sync, bp, disp, fp, total;
unsigned long flags;
struct glamo_core *gcore = gfb->mach_info->glamo;
struct glamo_core *gcore = gfb->mach_info->core;
struct fb_var_screeninfo *var = &gfb->fb->var;
dev_dbg(&gcore->pdev->dev,
@ -402,7 +394,7 @@ static int glamofb_pan_display(struct fb_var_screeninfo *var,
static struct fb_videomode *glamofb_find_mode(struct fb_info *info,
struct fb_var_screeninfo *var) {
struct glamofb_handle *glamo = info->par;
struct glamofb_platform_data *mach_info = glamo->mach_info;
struct glamo_fb_platform_data *mach_info = glamo->mach_info;
struct fb_videomode *mode;
int i;
@ -421,8 +413,8 @@ static int glamofb_set_par(struct fb_info *info)
struct fb_var_screeninfo *var = &info->var;
struct fb_videomode *mode;
if (glamo->mach_info->glamo->suspending) {
dev_err(&glamo->mach_info->glamo->pdev->dev,
if (glamo->mach_info->core->suspending) {
dev_err(&glamo->mach_info->core->pdev->dev,
"IGNORING glamofb_set_par while "
"suspended\n");
return -EBUSY;
@ -501,8 +493,8 @@ static int glamofb_setcolreg(unsigned regno,
struct glamofb_handle *glamo = info->par;
unsigned int val;
if (glamo->mach_info->glamo->suspending) {
dev_err(&glamo->mach_info->glamo->pdev->dev,
if (glamo->mach_info->core->suspending) {
dev_err(&glamo->mach_info->core->pdev->dev,
"IGNORING glamofb_set_par while "
"suspended\n");
return -EBUSY;
@ -533,7 +525,7 @@ static int glamofb_setcolreg(unsigned regno,
static int glamofb_ioctl(struct fb_info *info, unsigned int cmd,
unsigned long arg) {
struct glamofb_handle *gfb = (struct glamofb_handle*)info->par;
struct glamo_core *gcore = gfb->mach_info->glamo;
struct glamo_core *gcore = gfb->mach_info->core;
int retval = -ENOTTY;
switch (cmd) {
@ -695,8 +687,8 @@ int glamofb_cmd_mode(struct glamofb_handle *gfb, int on)
{
int timeout = 2000000;
if (gfb->mach_info->glamo->suspending) {
dev_err(&gfb->mach_info->glamo->pdev->dev,
if (gfb->mach_info->core->suspending) {
dev_err(&gfb->mach_info->core->pdev->dev,
"IGNORING glamofb_cmd_mode while "
"suspended\n");
return -EBUSY;
@ -759,8 +751,8 @@ int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val)
{
int timeout = 200000;
if (gfb->mach_info->glamo->suspending) {
dev_err(&gfb->mach_info->glamo->pdev->dev,
if (gfb->mach_info->core->suspending) {
dev_err(&gfb->mach_info->core->pdev->dev,
"IGNORING glamofb_cmd_write while "
"suspended\n");
return -EBUSY;
@ -815,7 +807,7 @@ static int __init glamofb_probe(struct platform_device *pdev)
int rc = -EIO;
struct fb_info *fbinfo;
struct glamofb_handle *glamofb;
struct glamofb_platform_data *mach_info = pdev->dev.platform_data;
struct glamo_fb_platform_data *mach_info = pdev->dev.platform_data;
printk(KERN_INFO "SMEDIA Glamo frame buffer driver (C) 2007 "
"Openmoko, Inc.\n");
@ -909,8 +901,8 @@ static int __init glamofb_probe(struct platform_device *pdev)
fbinfo->var.accel_flags = 0;
fbinfo->var.vmode = FB_VMODE_NONINTERLACED;
glamo_engine_enable(mach_info->glamo, GLAMO_ENGINE_LCD);
glamo_engine_reset(mach_info->glamo, GLAMO_ENGINE_LCD);
glamo_engine_enable(mach_info->core, GLAMO_ENGINE_LCD);
glamo_engine_reset(mach_info->core, GLAMO_ENGINE_LCD);
glamofb->output_enabled = 1;
glamofb->mode_set = 1;
@ -979,13 +971,13 @@ static int glamofb_suspend(struct platform_device *pdev, pm_message_t state)
static int glamofb_resume(struct platform_device *pdev)
{
struct glamofb_handle *gfb = platform_get_drvdata(pdev);
struct glamofb_platform_data *mach_info = pdev->dev.platform_data;
struct glamo_fb_platform_data *mach_info = pdev->dev.platform_data;
/* OK let's allow framebuffer ops again */
/* gfb->fb->screen_base = ioremap(gfb->fb_res->start,
resource_size(gfb->fb_res)); */
glamo_engine_enable(mach_info->glamo, GLAMO_ENGINE_LCD);
glamo_engine_reset(mach_info->glamo, GLAMO_ENGINE_LCD);
glamo_engine_enable(mach_info->core, GLAMO_ENGINE_LCD);
glamo_engine_reset(mach_info->core, GLAMO_ENGINE_LCD);
printk(KERN_ERR"spin_lock_init\n");
spin_lock_init(&gfb->lock_cmd);

View file

@ -15,7 +15,7 @@
*/
#define DEBUG
#if 0
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
@ -238,3 +238,4 @@ module_exit(glamo_spi_exit);
MODULE_DESCRIPTION("Smedia Glamo 336x/337x LCM serial command SPI Driver");
MODULE_AUTHOR("Harald Welte <laforge@openmoko.org>")
MODULE_LICENSE("GPL");
#endif

View file

@ -11,8 +11,6 @@
*/
#include <linux/module.h>
#include <linux/dma-mapping.h>
#include <linux/clk.h>
#include <linux/mmc/mmc.h>
#include <linux/mmc/sd.h>
#include <linux/mmc/host.h>
@ -23,10 +21,9 @@
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/crc7.h>
#include <asm/dma.h>
#include <asm/dma-mapping.h>
#include <asm/io.h>
#include <linux/scatterlist.h>
#include <linux/io.h>
#include <linux/mfd/glamo.h>
#include "glamo-mci.h"
#include "glamo-core.h"
@ -189,19 +186,19 @@ static void glamo_mci_fix_card_div(struct glamo_mci_host *host, int div)
{
unsigned long flags;
spin_lock_irqsave(&host->pdata->pglamo->lock, flags);
spin_lock_irqsave(&host->pdata->core->lock, flags);
if (div < 0) {
/* stop clock - remove clock from divider input */
writew(readw(host->pdata->pglamo->base +
writew(readw(host->pdata->core->base +
GLAMO_REG_CLOCK_GEN5_1) & (~GLAMO_CLOCK_GEN51_EN_DIV_TCLK),
host->pdata->pglamo->base + GLAMO_REG_CLOCK_GEN5_1);
host->pdata->core->base + GLAMO_REG_CLOCK_GEN5_1);
} else {
if (host->force_slow_during_powerup)
div = host->clk_rate / sd_post_power_clock;
else if (host->pdata->glamo_mci_use_slow &&
host->pdata->glamo_mci_use_slow())
else if (host->pdata->glamo_mmc_use_slow &&
host->pdata->glamo_mmc_use_slow())
div = div * sd_slow_ratio;
if (div > 255)
@ -212,15 +209,15 @@ static void glamo_mci_fix_card_div(struct glamo_mci_host *host, int div)
* register shared with SCLK divisor -- no chance of race because
* we don't use sensor interface
*/
writew((readw(host->pdata->pglamo->base +
writew((readw(host->pdata->core->base +
GLAMO_REG_CLOCK_GEN8) & 0xff00) | div,
host->pdata->pglamo->base + GLAMO_REG_CLOCK_GEN8);
host->pdata->core->base + GLAMO_REG_CLOCK_GEN8);
/* enable clock to divider input */
writew(readw(host->pdata->pglamo->base +
writew(readw(host->pdata->core->base +
GLAMO_REG_CLOCK_GEN5_1) | GLAMO_CLOCK_GEN51_EN_DIV_TCLK,
host->pdata->pglamo->base + GLAMO_REG_CLOCK_GEN5_1);
host->pdata->core->base + GLAMO_REG_CLOCK_GEN5_1);
}
spin_unlock_irqrestore(&host->pdata->pglamo->lock, flags);
spin_unlock_irqrestore(&host->pdata->core->lock, flags);
mdelay(5);
}
@ -534,7 +531,7 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
struct mmc_command *cmd = mrq->cmd;
int timeout = 1000000;
host->request_counter++;
host->request_counter++;
/* this guy has data to read/write? */
if (cmd->data) {
if(glamo_mci_prepare_pio(host, cmd->data)) {
@ -573,13 +570,13 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
* I'm afraid we have to spin on the IRQ status bit and "be
* our own INT# line"
*/
if (!host->pdata->pglamo->irq_works) {
if (!host->pdata->core->irq_works) {
/*
* we have faith we will get an "interrupt"...
* but something insane like suspend problems can mean
* we spin here forever, so we timeout after a LONG time
*/
while ((!(readw(host->pdata->pglamo->base +
while ((!(readw(host->pdata->core->base +
GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC)) &&
(timeout--));
@ -590,7 +587,7 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
goto bail;
}
/* ack this interrupt source */
writew(GLAMO_IRQ_MMC, host->pdata->pglamo->base +
writew(GLAMO_IRQ_MMC, host->pdata->core->base +
GLAMO_REG_IRQ_CLEAR);
/* yay we are an interrupt controller! -- call the ISR
@ -598,7 +595,7 @@ static void glamo_mci_send_request(struct mmc_host *mmc)
*/
glamo_mci_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC), host);
}
return;
return;
done:
host->mrq = NULL;
mmc_request_done(host->mmc, cmd->mrq);
@ -631,7 +628,7 @@ static void glamo_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
/* Set power */
switch(ios->power_mode) {
case MMC_POWER_UP:
mmc_regulator_set_ocr(host->regulator, ios->vdd);
mmc_regulator_set_ocr(host->regulator, ios->vdd);
host->vdd_current = ios->vdd;
break;
case MMC_POWER_ON:
@ -642,11 +639,11 @@ static void glamo_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
host->force_slow_during_powerup = 1;
if (host->vdd_current != ios->vdd) {
mmc_regulator_set_ocr(host->regulator, ios->vdd);
mmc_regulator_set_ocr(host->regulator, ios->vdd);
host->vdd_current = ios->vdd;
}
if (host->power_mode_current == MMC_POWER_OFF) {
glamo_engine_enable(host->pdata->pglamo,
glamo_engine_enable(host->pdata->core,
GLAMO_ENGINE_MMC);
powering = 1;
}
@ -659,7 +656,7 @@ static void glamo_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
/* never want clocking with dead card */
glamo_mci_fix_card_div(host, -1);
glamo_engine_disable(host->pdata->pglamo,
glamo_engine_disable(host->pdata->core,
GLAMO_ENGINE_MMC);
mmc_regulator_set_ocr(host->regulator, 0);
@ -801,7 +798,7 @@ static int glamo_mci_probe(struct platform_device *pdev)
ret = request_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC), glamo_mci_irq, IRQF_SHARED,
pdev->name, host);
if (ret) {
if (ret) {
dev_err(&pdev->dev, "failed to register irq.\n");
goto probe_iounmap_data;
}
@ -829,8 +826,8 @@ static int glamo_mci_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, mmc);
glamo_engine_enable(host->pdata->pglamo, GLAMO_ENGINE_MMC);
glamo_engine_reset(host->pdata->pglamo, GLAMO_ENGINE_MMC);
glamo_engine_enable(host->pdata->core, GLAMO_ENGINE_MMC);
glamo_engine_reset(host->pdata->core, GLAMO_ENGINE_MMC);
if ((ret = mmc_add_host(mmc))) {
dev_err(&pdev->dev, "failed to add mmc host.\n");
@ -853,7 +850,7 @@ static int glamo_mci_probe(struct platform_device *pdev)
probe_freeirq:
free_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC), host);
probe_iounmap_data:
iounmap(host->data_base);
iounmap(host->data_base);
probe_free_mem_region_data:
release_mem_region(host->data_mem->start, resource_size(host->data_mem));
probe_iounmap_mmio:
@ -861,7 +858,7 @@ probe_iounmap_mmio:
probe_free_mem_region_mmio:
release_mem_region(host->mmio_mem->start, resource_size(host->mmio_mem));
probe_regulator_put:
regulator_put(host->regulator);
regulator_put(host->regulator);
probe_free_host:
mmc_free_host(mmc);
probe_out:
@ -885,7 +882,7 @@ static int glamo_mci_remove(struct platform_device *pdev)
mmc_free_host(mmc);
glamo_engine_disable(host->pdata->pglamo, GLAMO_ENGINE_MMC);
glamo_engine_disable(host->pdata->core, GLAMO_ENGINE_MMC);
return 0;
}
@ -929,8 +926,8 @@ int glamo_mci_resume(struct platform_device *dev)
sd_idleclk = 1;
glamo_engine_enable(host->pdata->pglamo, GLAMO_ENGINE_MMC);
glamo_engine_reset(host->pdata->pglamo, GLAMO_ENGINE_MMC);
glamo_engine_enable(host->pdata->core, GLAMO_ENGINE_MMC);
glamo_engine_reset(host->pdata->core, GLAMO_ENGINE_MMC);
host->suspending--;

View file

@ -14,7 +14,7 @@
struct glamo_mci_host {
struct platform_device *pdev;
struct glamo_mci_pdata *pdata;
struct glamo_mmc_platform_data *pdata;
struct mmc_host *mmc;
struct resource *mmio_mem;
struct resource *data_mem;

View file

@ -21,7 +21,6 @@
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/spinlock.h>
#include <linux/workqueue.h>
#include <linux/platform_device.h>
#include <linux/spi/spi.h>
@ -38,8 +37,7 @@
struct glamo_spigpio {
struct spi_bitbang bitbang;
struct spi_master *master;
struct glamo_spigpio_info *info;
struct glamo_core *glamo;
struct glamo_spigpio_platform_data *info;
};
static inline struct glamo_spigpio *to_sg(struct spi_device *spi)
@ -50,20 +48,20 @@ static inline struct glamo_spigpio *to_sg(struct spi_device *spi)
static inline void setsck(struct spi_device *dev, int on)
{
struct glamo_spigpio *sg = to_sg(dev);
glamo_gpio_setpin(sg->glamo, sg->info->pin_clk, on ? 1 : 0);
glamo_gpio_setpin(sg->info->core, sg->info->pin_clk, on ? 1 : 0);
}
static inline void setmosi(struct spi_device *dev, int on)
{
struct glamo_spigpio *sg = to_sg(dev);
glamo_gpio_setpin(sg->glamo, sg->info->pin_mosi, on ? 1 : 0);
glamo_gpio_setpin(sg->info->core, sg->info->pin_mosi, on ? 1 : 0);
}
static inline u32 getmiso(struct spi_device *dev)
{
struct glamo_spigpio *sg = to_sg(dev);
if (sg->info->pin_miso)
return glamo_gpio_getpin(sg->glamo, sg->info->pin_miso) ? 1 : 0;
return glamo_gpio_getpin(sg->info->core, sg->info->pin_miso) ? 1 : 0;
else
return 0;
}
@ -123,7 +121,7 @@ static void glamo_spigpio_chipsel(struct spi_device *spi, int value)
dev_dbg(&spi->dev, "chipsel %d: spi=%p, gs=%p, info=%p, handle=%p\n",
value, spi, gs, gs->info, gs->info->glamo);
#endif
glamo_gpio_setpin(gs->glamo, gs->info->pin_cs, value ? 0 : 1);
glamo_gpio_setpin(gs->info->core, gs->info->pin_cs, value ? 0 : 1);
}
@ -153,7 +151,6 @@ static int glamo_spigpio_probe(struct platform_device *pdev)
master->bus_num = 2; /* FIXME: use dynamic number */
sp->master = spi_master_get(master);
sp->glamo = sp->info->glamo;
sp->bitbang.master = sp->master;
sp->bitbang.chipselect = glamo_spigpio_chipsel;
@ -163,20 +160,20 @@ static int glamo_spigpio_probe(struct platform_device *pdev)
sp->bitbang.txrx_word[SPI_MODE_3] = glamo_spigpio_txrx_mode3;
/* set state of spi pins */
glamo_gpio_setpin(sp->glamo, sp->info->pin_clk, 0);
glamo_gpio_setpin(sp->glamo, sp->info->pin_mosi, 0);
glamo_gpio_setpin(sp->glamo, sp->info->pin_cs, 1);
glamo_gpio_setpin(sp->info->core, sp->info->pin_clk, 0);
glamo_gpio_setpin(sp->info->core, sp->info->pin_mosi, 0);
glamo_gpio_setpin(sp->info->core, sp->info->pin_cs, 1);
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_clk);
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_mosi);
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_cs);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_clk);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_mosi);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_cs);
if (sp->info->pin_miso)
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_miso);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_miso);
/* bring the LCM panel out of reset if it isn't already */
glamo_gpio_setpin(sp->glamo, GLAMO_GPIO4, 1);
glamo_gpio_cfgpin(sp->glamo, GLAMO_GPIO4_OUTPUT);
glamo_gpio_setpin(sp->info->core, GLAMO_GPIO4, 1);
glamo_gpio_cfgpin(sp->info->core, GLAMO_GPIO4_OUTPUT);
msleep(90);
#if 0
@ -233,15 +230,15 @@ static int glamo_spigpio_resume(struct platform_device *pdev)
return 0;
/* set state of spi pins */
glamo_gpio_setpin(sp->glamo, sp->info->pin_clk, 0);
glamo_gpio_setpin(sp->glamo, sp->info->pin_mosi, 0);
glamo_gpio_setpin(sp->glamo, sp->info->pin_cs, 1);
glamo_gpio_setpin(sp->info->core, sp->info->pin_clk, 0);
glamo_gpio_setpin(sp->info->core, sp->info->pin_mosi, 0);
glamo_gpio_setpin(sp->info->core, sp->info->pin_cs, 1);
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_clk);
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_mosi);
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_cs);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_clk);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_mosi);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_cs);
if (sp->info->pin_miso)
glamo_gpio_cfgpin(sp->glamo, sp->info->pin_miso);
glamo_gpio_cfgpin(sp->info->core, sp->info->pin_miso);
return 0;
}

View file

@ -0,0 +1,49 @@
#ifndef __GLAMO_MFD_H
#define __GLAMO_MFD_H
struct glamo_core;
struct glamo_spigpio_platform_data;
struct glamo_fb_platform_data;
struct glamo_mmc_platform_data {
int (*glamo_mmc_use_slow)(void);
struct glamo_core *core;
};
struct glamo_platform_data {
struct glamo_fb_platform_data *fb_data;
struct glamo_spigpio_platform_data *spigpio_data;
struct glamo_mmc_platform_data *mmc_data;
unsigned int osci_clock_rate;
int (*glamo_irq_is_wired)(void);
void (*glamo_external_reset)(int);
};
enum glamo_engine {
GLAMO_ENGINE_CAPTURE = 0,
GLAMO_ENGINE_ISP = 1,
GLAMO_ENGINE_JPEG = 2,
GLAMO_ENGINE_MPEG_ENC = 3,
GLAMO_ENGINE_MPEG_DEC = 4,
GLAMO_ENGINE_LCD = 5,
GLAMO_ENGINE_CMDQ = 6,
GLAMO_ENGINE_2D = 7,
GLAMO_ENGINE_3D = 8,
GLAMO_ENGINE_MMC = 9,
GLAMO_ENGINE_MICROP0 = 10,
GLAMO_ENGINE_RISC = 11,
GLAMO_ENGINE_MICROP1_MPEG_ENC = 12,
GLAMO_ENGINE_MICROP1_MPEG_DEC = 13,
#if 0
GLAMO_ENGINE_H264_DEC = 14,
GLAMO_ENGINE_RISC1 = 15,
GLAMO_ENGINE_SPI = 16,
#endif
__NUM_GLAMO_ENGINES
};
#endif

View file

@ -3,24 +3,16 @@
#include <linux/glamo-gpio.h>
struct spi_board_info;
struct glamofb_handle;
struct glamo_core;
struct glamo_spi_info {
unsigned long board_size;
struct spi_board_info *board_info;
struct glamofb_handle *glamofb_handle;
};
struct glamo_spigpio_platform_data {
unsigned int pin_clk;
unsigned int pin_mosi;
unsigned int pin_miso;
unsigned int pin_cs;
int bus_num;
struct glamo_spigpio_info {
unsigned int pin_clk;
unsigned int pin_mosi;
unsigned int pin_miso;
unsigned int pin_cs;
int bus_num;
struct glamo_core *glamo;
struct glamo_core *core;
};