mmdc.c (a8a93c6f9922c0d70459668c1300b226cb3918ab) | mmdc.c (ec336b284136610a43c9daac56d66b20d43ddf7b) |
---|---|
1/* 2 * Copyright 2011 Freescale Semiconductor, Inc. 3 * Copyright 2011 Linaro Ltd. 4 * 5 * The code contained herein is licensed under the GNU General Public 6 * License. You may obtain a copy of the GNU General Public License 7 * Version 2 or later at the following locations: 8 * --- 7 unchanged lines hidden (view full) --- 16#include <linux/of.h> 17#include <linux/of_address.h> 18#include <linux/of_device.h> 19 20#define MMDC_MAPSR 0x404 21#define BP_MMDC_MAPSR_PSD 0 22#define BP_MMDC_MAPSR_PSS 4 23 | 1/* 2 * Copyright 2011 Freescale Semiconductor, Inc. 3 * Copyright 2011 Linaro Ltd. 4 * 5 * The code contained herein is licensed under the GNU General Public 6 * License. You may obtain a copy of the GNU General Public License 7 * Version 2 or later at the following locations: 8 * --- 7 unchanged lines hidden (view full) --- 16#include <linux/of.h> 17#include <linux/of_address.h> 18#include <linux/of_device.h> 19 20#define MMDC_MAPSR 0x404 21#define BP_MMDC_MAPSR_PSD 0 22#define BP_MMDC_MAPSR_PSS 4 23 |
24#define MMDC_MDMISC 0x18 25#define BM_MMDC_MDMISC_DDR_TYPE 0x18 26#define BP_MMDC_MDMISC_DDR_TYPE 0x3 27 28static int ddr_type; 29 |
|
24static int imx_mmdc_probe(struct platform_device *pdev) 25{ 26 struct device_node *np = pdev->dev.of_node; 27 void __iomem *mmdc_base, *reg; 28 u32 val; 29 int timeout = 0x400; 30 31 mmdc_base = of_iomap(np, 0); 32 WARN_ON(!mmdc_base); 33 | 30static int imx_mmdc_probe(struct platform_device *pdev) 31{ 32 struct device_node *np = pdev->dev.of_node; 33 void __iomem *mmdc_base, *reg; 34 u32 val; 35 int timeout = 0x400; 36 37 mmdc_base = of_iomap(np, 0); 38 WARN_ON(!mmdc_base); 39 |
40 reg = mmdc_base + MMDC_MDMISC; 41 /* Get ddr type */ 42 val = readl_relaxed(reg); 43 ddr_type = (val & BM_MMDC_MDMISC_DDR_TYPE) >> 44 BP_MMDC_MDMISC_DDR_TYPE; 45 |
|
34 reg = mmdc_base + MMDC_MAPSR; 35 36 /* Enable automatic power saving */ 37 val = readl_relaxed(reg); 38 val &= ~(1 << BP_MMDC_MAPSR_PSD); 39 writel_relaxed(val, reg); 40 41 /* Ensure it's successfully enabled */ --- 4 unchanged lines hidden (view full) --- 46 pr_warn("%s: failed to enable automatic power saving\n", 47 __func__); 48 return -EBUSY; 49 } 50 51 return 0; 52} 53 | 46 reg = mmdc_base + MMDC_MAPSR; 47 48 /* Enable automatic power saving */ 49 val = readl_relaxed(reg); 50 val &= ~(1 << BP_MMDC_MAPSR_PSD); 51 writel_relaxed(val, reg); 52 53 /* Ensure it's successfully enabled */ --- 4 unchanged lines hidden (view full) --- 58 pr_warn("%s: failed to enable automatic power saving\n", 59 __func__); 60 return -EBUSY; 61 } 62 63 return 0; 64} 65 |
66int imx_mmdc_get_ddr_type(void) 67{ 68 return ddr_type; 69} 70 |
|
54static struct of_device_id imx_mmdc_dt_ids[] = { 55 { .compatible = "fsl,imx6q-mmdc", }, 56 { /* sentinel */ } 57}; 58 59static struct platform_driver imx_mmdc_driver = { 60 .driver = { 61 .name = "imx-mmdc", | 71static struct of_device_id imx_mmdc_dt_ids[] = { 72 { .compatible = "fsl,imx6q-mmdc", }, 73 { /* sentinel */ } 74}; 75 76static struct platform_driver imx_mmdc_driver = { 77 .driver = { 78 .name = "imx-mmdc", |
79 .owner = THIS_MODULE, |
|
62 .of_match_table = imx_mmdc_dt_ids, 63 }, 64 .probe = imx_mmdc_probe, 65}; 66 67static int __init imx_mmdc_init(void) 68{ 69 return platform_driver_register(&imx_mmdc_driver); 70} 71postcore_initcall(imx_mmdc_init); | 80 .of_match_table = imx_mmdc_dt_ids, 81 }, 82 .probe = imx_mmdc_probe, 83}; 84 85static int __init imx_mmdc_init(void) 86{ 87 return platform_driver_register(&imx_mmdc_driver); 88} 89postcore_initcall(imx_mmdc_init); |