#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;
-
- int num_modes;
- struct fb_videomode *modes;
-
- struct glamo_spigpio_info *spigpio_info;
- struct glamo_core *glamo;
+struct glamo_fb_platform_data {
+ int width, height;
- /* glamo mmc platform specific info */
- int (*glamo_can_set_mci_power)(void);
+ int num_modes;
+ struct fb_videomode *modes;
- /* 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);
#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>
#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>
.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)
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 */
/*
}
};
-
-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,
+};
+
+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,
+};
- .spigpio_info = &glamo_spigpio_cfg,
+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 = >a02_glamo_fb_pdata,
+ .spigpio_data = >a02_glamo_spigpio_pdata,
+ .mmc_data = >a02_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[] = {
s3c24xx_udc_set_platdata(>a02_udc_cfg);
s3c_i2c0_set_platdata(NULL);
set_s3c2410ts_info(>a02_ts_cfg);
-
+
mangle_glamo_res_by_system_rev();
i2c_register_board_info(0, gta02_i2c_devs, ARRAY_SIZE(gta02_i2c_devs));
platform_device_register(>a02_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(>a02_vibrator_dev);
#endif
}
#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
};
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 }, */
},
};
-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,
{
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;
{
int n;
unsigned long flags;
-
+
spin_lock_irqsave(&glamo->lock, flags);
dev_info(&glamo->pdev->dev, "***** glamo_power -> %d\n", new_state);
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_cells[GLAMO_CELL_FB].platform_data = glamo->pdata;
- glamo_cells[GLAMO_CELL_FB].data_size = sizeof(struct glamofb_platform_data);
-
- glamo->pdata->spigpio_info->glamo = glamo;
- glamo_cells[GLAMO_CELL_SPI_GPIO].platform_data = glamo->pdata->spigpio_info;
+ 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->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_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),
#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
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;
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);
#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>
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];
};
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;
}
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;
{
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;
{
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;
{
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;
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,
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;
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;
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;
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) {
{
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;
{
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;
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");
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;
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);
*/
#define DEBUG
-
+#if 0
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/delay.h>
MODULE_DESCRIPTION("Smedia Glamo 336x/337x LCM serial command SPI Driver");
MODULE_AUTHOR("Harald Welte <laforge@openmoko.org>")
MODULE_LICENSE("GPL");
+#endif
*/
#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>
#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"
{
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)
* 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);
}
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)) {
* 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--));
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
*/
glamo_mci_irq(IRQ_GLAMO(GLAMO_IRQIDX_MMC), host);
}
- return;
+ return;
done:
host->mrq = NULL;
mmc_request_done(host->mmc, cmd->mrq);
/* 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:
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;
}
/* 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);
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;
}
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");
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:
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:
mmc_free_host(mmc);
- glamo_engine_disable(host->pdata->pglamo, GLAMO_ENGINE_MMC);
+ glamo_engine_disable(host->pdata->core, GLAMO_ENGINE_MMC);
return 0;
}
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--;
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;
#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>
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)
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;
}
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);
}
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;
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
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;
}
--- /dev/null
+#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
#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_info {
- unsigned int pin_clk;
- unsigned int pin_mosi;
- unsigned int pin_miso;
- unsigned int pin_cs;
- int bus_num;
+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_core *glamo;
+ struct glamo_core *core;
};