diff options
Diffstat (limited to 'target/linux')
3 files changed, 57 insertions, 64 deletions
diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-core.c b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-core.c index 077a7a839c..b6df59d34e 100644 --- a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-core.c +++ b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-core.c @@ -1188,16 +1188,6 @@ static int __init glamo_probe(struct platform_device *pdev) glamo_pll_rate(glamo, GLAMO_PLL1), glamo_pll_rate(glamo, GLAMO_PLL2)); - /* register siblings */ - 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); - mfd_add_devices(&pdev->dev, pdev->id, glamo_cells, ARRAY_SIZE(glamo_cells), glamo->mem, 0); diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c index 3d13dd26ce..7bb2201f61 100644 --- a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c +++ b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-fb.c @@ -43,19 +43,10 @@ #include "glamo-regs.h" #include "glamo-core.h" -#ifndef DEBUG -#define GLAMO_LOG(...) -#else -#define GLAMO_LOG(...) \ -do { \ - printk(KERN_DEBUG "in %s:%s:%d", __FILE__, __func__, __LINE__); \ - printk(KERN_DEBUG __VA_ARGS__); \ -} while (0); -#endif - static void glamofb_program_mode(struct glamofb_handle* glamo); struct glamofb_handle { + struct glamo_core *core; struct fb_info *fb; struct device *dev; struct resource *reg; @@ -72,7 +63,7 @@ struct glamofb_handle { }; static void glamo_output_enable(struct glamofb_handle *gfb) { - struct glamo_core *gcore = gfb->mach_info->core; + struct glamo_core *gcore = gfb->core; if (gfb->output_enabled) return; @@ -89,7 +80,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->core; + struct glamo_core *gcore = gfb->core; if (!gfb->output_enabled) return; @@ -158,8 +149,8 @@ static int glamofb_run_script(struct glamofb_handle *glamo, { int i; - if (glamo->mach_info->core->suspending) { - dev_err(&glamo->mach_info->core->pdev->dev, + if (glamo->core->suspending) { + dev_err(&glamo->core->pdev->dev, "IGNORING glamofb_run_script while " "suspended\n"); return -EBUSY; @@ -184,8 +175,8 @@ static int glamofb_check_var(struct fb_var_screeninfo *var, { struct glamofb_handle *glamo = info->par; - if (glamo->mach_info->core->suspending) { - dev_err(&glamo->mach_info->core->pdev->dev, + if (glamo->core->suspending) { + dev_err(&glamo->core->pdev->dev, "IGNORING glamofb_check_var while " "suspended\n"); return -EBUSY; @@ -272,8 +263,8 @@ static void __rotate_lcd(struct glamofb_handle *glamo, __u32 rotation) { int glamo_rot; - if (glamo->mach_info->core->suspending) { - dev_err(&glamo->mach_info->core->pdev->dev, + if (glamo->core->suspending) { + dev_err(&glamo->core->pdev->dev, "IGNORING rotate_lcd while " "suspended\n"); return; @@ -308,7 +299,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->core; + struct glamo_core *gcore = gfb->core; struct fb_var_screeninfo *var = &gfb->fb->var; dev_dbg(&gcore->pdev->dev, @@ -413,8 +404,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->core->suspending) { - dev_err(&glamo->mach_info->core->pdev->dev, + if (glamo->core->suspending) { + dev_err(&glamo->core->pdev->dev, "IGNORING glamofb_set_par while " "suspended\n"); return -EBUSY; @@ -493,8 +484,8 @@ static int glamofb_setcolreg(unsigned regno, struct glamofb_handle *glamo = info->par; unsigned int val; - if (glamo->mach_info->core->suspending) { - dev_err(&glamo->mach_info->core->pdev->dev, + if (glamo->core->suspending) { + dev_err(&glamo->core->pdev->dev, "IGNORING glamofb_set_par while " "suspended\n"); return -EBUSY; @@ -525,7 +516,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->core; + struct glamo_core *gcore = gfb->core; int retval = -ENOTTY; switch (cmd) { @@ -687,8 +678,8 @@ int glamofb_cmd_mode(struct glamofb_handle *gfb, int on) { int timeout = 2000000; - if (gfb->mach_info->core->suspending) { - dev_err(&gfb->mach_info->core->pdev->dev, + if (gfb->core->suspending) { + dev_err(&gfb->core->pdev->dev, "IGNORING glamofb_cmd_mode while " "suspended\n"); return -EBUSY; @@ -699,7 +690,7 @@ int glamofb_cmd_mode(struct glamofb_handle *gfb, int on) dev_dbg(gfb->dev, "%s: waiting for cmdq empty: ", __func__); while ((!glamofb_cmdq_empty(gfb)) && (timeout--)) - yield(); + cpu_relax(); if (timeout < 0) { printk(KERN_ERR"*************" "glamofb cmd_queue never got empty" @@ -718,7 +709,7 @@ int glamofb_cmd_mode(struct glamofb_handle *gfb, int on) timeout = 2000000; while ((!reg_read(gfb, GLAMO_REG_LCD_STATUS2) & (1 << 12)) && (timeout--)) - /* yield() */; + cpu_relax(); if (timeout < 0) { printk(KERN_ERR"*************" "glamofb lcd never idle" @@ -751,8 +742,8 @@ int glamofb_cmd_write(struct glamofb_handle *gfb, u_int16_t val) { int timeout = 200000; - if (gfb->mach_info->core->suspending) { - dev_err(&gfb->mach_info->core->pdev->dev, + if (gfb->core->suspending) { + dev_err(&gfb->core->pdev->dev, "IGNORING glamofb_cmd_write while " "suspended\n"); return -EBUSY; @@ -807,15 +798,21 @@ static int __init glamofb_probe(struct platform_device *pdev) int rc = -EIO; struct fb_info *fbinfo; struct glamofb_handle *glamofb; - struct glamo_fb_platform_data *mach_info = pdev->dev.platform_data; + struct glamo_core *core = dev_get_drvdata(pdev->dev.parent); + struct glamo_fb_platform_data *mach_info; printk(KERN_INFO "SMEDIA Glamo frame buffer driver (C) 2007 " "Openmoko, Inc.\n"); + if (!core->pdata || !core->pdata->fb_data) + return -ENOENT; + + fbinfo = framebuffer_alloc(sizeof(struct glamofb_handle), &pdev->dev); if (!fbinfo) return -ENOMEM; + glamofb = fbinfo->par; glamofb->fb = fbinfo; glamofb->dev = &pdev->dev; @@ -876,7 +873,9 @@ static int __init glamofb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, glamofb); - glamofb->mach_info = pdev->dev.platform_data; + mach_info = core->pdata->fb_data; + glamofb->core = core; + glamofb->mach_info = mach_info; fbinfo->fix.visual = FB_VISUAL_TRUECOLOR; fbinfo->fix.type = FB_TYPE_PACKED_PIXELS; @@ -901,8 +900,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->core, GLAMO_ENGINE_LCD); - glamo_engine_reset(mach_info->core, GLAMO_ENGINE_LCD); + glamo_engine_enable(core, GLAMO_ENGINE_LCD); + glamo_engine_reset(core, GLAMO_ENGINE_LCD); glamofb->output_enabled = 1; glamofb->mode_set = 1; @@ -971,13 +970,12 @@ static int glamofb_suspend(struct device *dev) static int glamofb_resume(struct device *dev) { struct glamofb_handle *gfb = dev_get_drvdata(dev); - struct glamo_fb_platform_data *mach_info = 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->core, GLAMO_ENGINE_LCD); - glamo_engine_reset(mach_info->core, GLAMO_ENGINE_LCD); + glamo_engine_enable(gfb->core, GLAMO_ENGINE_LCD); + glamo_engine_reset(gfb->core, GLAMO_ENGINE_LCD); glamofb_init_regs(gfb); #ifdef CONFIG_MFD_GLAMO_HWACCEL diff --git a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-mci.c b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-mci.c index fdf292f8ea..b728c8745d 100644 --- a/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-mci.c +++ b/target/linux/s3c24xx/files-2.6.30/drivers/mfd/glamo/glamo-mci.c @@ -31,8 +31,9 @@ #define DRIVER_NAME "glamo-mci" struct glamo_mci_host { - struct platform_device *pdev; struct glamo_mmc_platform_data *pdata; + struct platform_device *pdev; + struct glamo_core *core; struct mmc_host *mmc; struct resource *mmio_mem; struct resource *data_mem; @@ -55,6 +56,7 @@ struct glamo_mci_host { struct work_struct read_work; unsigned clk_enabled : 1; + }; static void glamo_mci_send_request(struct mmc_host *mmc, struct mmc_request* mrq); @@ -139,7 +141,7 @@ static void glamo_reg_set_bit_mask(struct glamo_mci_host *glamo, static void glamo_mci_clock_disable(struct glamo_mci_host *host) { if (host->clk_enabled) { - glamo_engine_div_disable(host->pdata->core, GLAMO_ENGINE_MMC); + glamo_engine_div_disable(host->core, GLAMO_ENGINE_MMC); host->clk_enabled = 0; } } @@ -148,7 +150,7 @@ static void glamo_mci_clock_enable(struct glamo_mci_host *host) { del_timer_sync(&host->disable_timer); if (!host->clk_enabled) { - glamo_engine_div_enable(host->pdata->core, GLAMO_ENGINE_MMC); + glamo_engine_div_enable(host->core, GLAMO_ENGINE_MMC); host->clk_enabled = 1; } } @@ -205,7 +207,7 @@ static int glamo_mci_set_card_clock(struct glamo_mci_host *host, int freq) if (freq) { glamo_mci_clock_enable(host); - real_rate = glamo_engine_reclock(host->pdata->core, GLAMO_ENGINE_MMC, freq); + real_rate = glamo_engine_reclock(host->core, GLAMO_ENGINE_MMC, freq); } else { glamo_mci_clock_disable(host); } @@ -558,7 +560,7 @@ static int glamo_mci_irq_poll(struct glamo_mci_host *host, * but something insane like suspend problems can mean * we spin here forever, so we timeout after a LONG time */ - while ((!(readw(host->pdata->core->base + + while ((!(readw(host->core->base + GLAMO_REG_IRQ_STATUS) & GLAMO_IRQ_MMC)) && (timeout--)); @@ -569,7 +571,7 @@ static int glamo_mci_irq_poll(struct glamo_mci_host *host, return -ETIMEDOUT; } /* ack this interrupt source */ - writew(GLAMO_IRQ_MMC, host->pdata->core->base + + writew(GLAMO_IRQ_MMC, host->core->base + GLAMO_REG_IRQ_CLEAR); /* yay we are an interrupt controller! -- call the ISR @@ -609,7 +611,7 @@ static void glamo_mci_send_request(struct mmc_host *mmc, struct mmc_request *mrq goto done; - if (!host->pdata->core->irq_works) { + if (!host->core->irq_works) { if (glamo_mci_irq_poll(host, mrq->cmd)) goto done; } @@ -645,7 +647,7 @@ static void glamo_mci_set_power_mode(struct glamo_mci_host *host, break; case MMC_POWER_OFF: default: - glamo_engine_disable(host->pdata->core, + glamo_engine_disable(host->core, GLAMO_ENGINE_MMC); ret = regulator_disable(host->regulator); @@ -717,8 +719,9 @@ static struct mmc_host_ops glamo_mci_ops = { static int glamo_mci_probe(struct platform_device *pdev) { - struct mmc_host *mmc; - struct glamo_mci_host *host; + struct mmc_host *mmc; + struct glamo_mci_host *host; + struct glamo_core *core = dev_get_drvdata(pdev->dev.parent); int ret; dev_info(&pdev->dev, "glamo_mci driver (C)2007 Openmoko, Inc\n"); @@ -732,9 +735,11 @@ static int glamo_mci_probe(struct platform_device *pdev) host = mmc_priv(mmc); host->mmc = mmc; host->pdev = pdev; - host->pdata = pdev->dev.platform_data; + if (core->pdata) + host->pdata = core->pdata->mmc_data; host->power_mode = MMC_POWER_OFF; host->clk_enabled = 0; + host->core = core; INIT_WORK(&host->irq_work, glamo_mci_irq_worker); INIT_WORK(&host->read_work, glamo_mci_read_worker); @@ -809,7 +814,7 @@ static int glamo_mci_probe(struct platform_device *pdev) host->vdd = 0; - host->clk_rate = glamo_pll_rate(host->pdata->core, GLAMO_PLL1); + host->clk_rate = glamo_pll_rate(host->core, GLAMO_PLL1); /* explain our host controller capabilities */ mmc->ops = &glamo_mci_ops; @@ -835,8 +840,8 @@ static int glamo_mci_probe(struct platform_device *pdev) platform_set_drvdata(pdev, mmc); - glamo_engine_enable(host->pdata->core, GLAMO_ENGINE_MMC); - glamo_engine_reset(host->pdata->core, GLAMO_ENGINE_MMC); + glamo_engine_enable(host->core, GLAMO_ENGINE_MMC); + glamo_engine_reset(host->core, GLAMO_ENGINE_MMC); glamo_reg_write(host, GLAMO_REG_MMC_WDATADS1, (u16)(host->data_mem->start)); @@ -894,7 +899,7 @@ static int glamo_mci_remove(struct platform_device *pdev) mmc_free_host(mmc); - glamo_engine_disable(host->pdata->core, GLAMO_ENGINE_MMC); + glamo_engine_disable(host->core, GLAMO_ENGINE_MMC); return 0; } @@ -921,8 +926,8 @@ static int glamo_mci_resume(struct device *dev) struct glamo_mci_host *host = mmc_priv(mmc); int ret; - glamo_engine_enable(host->pdata->core, GLAMO_ENGINE_MMC); - glamo_engine_reset(host->pdata->core, GLAMO_ENGINE_MMC); + glamo_engine_enable(host->core, GLAMO_ENGINE_MMC); + glamo_engine_reset(host->core, GLAMO_ENGINE_MMC); glamo_reg_write(host, GLAMO_REG_MMC_WDATADS1, (u16)(host->data_mem->start)); |