Merge branch 'drm-patches' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied...
[pandora-kernel.git] / arch / arm / mach-imx / generic.c
index cb14b06..b5aa49d 100644 (file)
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
  */
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/string.h>
+
 #include <asm/arch/imxfb.h>
 #include <asm/hardware.h>
 #include <asm/arch/imx-regs.h>
 
 #include <asm/mach/map.h>
+#include <asm/arch/mmc.h>
 
 void imx_gpio_mode(int gpio_mode)
 {
@@ -101,6 +104,9 @@ EXPORT_SYMBOL(imx_gpio_mode);
  */
 static unsigned int imx_decode_pll(unsigned int pll)
 {
+       unsigned long long ll;
+       unsigned long quot;
+
        u32 mfi = (pll >> 10) & 0xf;
        u32 mfn = pll & 0x3ff;
        u32 mfd = (pll >> 16) & 0x3ff;
@@ -109,7 +115,11 @@ static unsigned int imx_decode_pll(unsigned int pll)
 
        mfi = mfi <= 5 ? 5 : mfi;
 
-       return (2 * (f_ref>>10) * ( (mfi<<10) + (mfn<<10) / (mfd+1) )) / (pd+1);
+       ll = 2 * (unsigned long long)f_ref * ( (mfi<<16) + (mfn<<16) / (mfd+1) );
+       quot = (pd+1) * (1<<16);
+       ll += quot / 2;
+       do_div(ll, quot);
+       return (unsigned int) ll;
 }
 
 unsigned int imx_get_system_clk(void)
@@ -173,62 +183,24 @@ static struct resource imx_mmc_resources[] = {
        },
 };
 
+static u64 imxmmmc_dmamask = 0xffffffffUL;
+
 static struct platform_device imx_mmc_device = {
        .name           = "imx-mmc",
        .id             = 0,
+       .dev            = {
+               .dma_mask = &imxmmmc_dmamask,
+               .coherent_dma_mask = 0xffffffff,
+       },
        .num_resources  = ARRAY_SIZE(imx_mmc_resources),
        .resource       = imx_mmc_resources,
 };
 
-static struct resource imx_uart1_resources[] = {
-       [0] = {
-               .start  = 0x00206000,
-               .end    = 0x002060FF,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = (UART1_MINT_RX),
-               .end    = (UART1_MINT_RX),
-               .flags  = IORESOURCE_IRQ,
-       },
-       [2] = {
-               .start  = (UART1_MINT_TX),
-               .end    = (UART1_MINT_TX),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device imx_uart1_device = {
-       .name           = "imx-uart",
-       .id             = 0,
-       .num_resources  = ARRAY_SIZE(imx_uart1_resources),
-       .resource       = imx_uart1_resources,
-};
-
-static struct resource imx_uart2_resources[] = {
-       [0] = {
-               .start  = 0x00207000,
-               .end    = 0x002070FF,
-               .flags  = IORESOURCE_MEM,
-       },
-       [1] = {
-               .start  = (UART2_MINT_RX),
-               .end    = (UART2_MINT_RX),
-               .flags  = IORESOURCE_IRQ,
-       },
-       [2] = {
-               .start  = (UART2_MINT_TX),
-               .end    = (UART2_MINT_TX),
-               .flags  = IORESOURCE_IRQ,
-       },
-};
-
-static struct platform_device imx_uart2_device = {
-       .name           = "imx-uart",
-       .id             = 1,
-       .num_resources  = ARRAY_SIZE(imx_uart2_resources),
-       .resource       = imx_uart2_resources,
-};
+void __init imx_set_mmc_info(struct imxmmc_platform_data *info)
+{
+       imx_mmc_device.dev.platform_data = info;
+}
+EXPORT_SYMBOL(imx_set_mmc_info);
 
 static struct imxfb_mach_info imx_fb_info;
 
@@ -268,8 +240,6 @@ static struct platform_device imxfb_device = {
 static struct platform_device *devices[] __initdata = {
        &imx_mmc_device,
        &imxfb_device,
-       &imx_uart1_device,
-       &imx_uart2_device,
 };
 
 static struct map_desc imx_io_desc[] __initdata = {