summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe.Li <B37916@freescale.com>2014-06-06 16:31:50 +0800
committerYe.Li <B37916@freescale.com>2014-06-17 11:13:46 +0800
commit66e7a93ff1e47d0e47627a984bcf2337db4f3bbf (patch)
tree2c426f613baf512a411093cae51dd0b69d3d3ddd
parent8b3db31d607be02409b1f4937d91241f48229e96 (diff)
downloadu-boot-imx-66e7a93ff1e47d0e47627a984bcf2337db4f3bbf.zip
u-boot-imx-66e7a93ff1e47d0e47627a984bcf2337db4f3bbf.tar.gz
u-boot-imx-66e7a93ff1e47d0e47627a984bcf2337db4f3bbf.tar.bz2
ENGR00315894-34 imx6:dlsabresd/slevk Fix build break when enables EPDC
-Use the new pins' name for imx6dl. -Change the read/write to registers by using register structure. Signed-off-by: Ye.Li <B37916@freescale.com>
-rw-r--r--board/freescale/mx6sabresd/mx6sabresd.c602
-rw-r--r--board/freescale/mx6slevk/mx6slevk.c25
2 files changed, 316 insertions, 311 deletions
diff --git a/board/freescale/mx6sabresd/mx6sabresd.c b/board/freescale/mx6sabresd/mx6sabresd.c
index 1350e9f..b085963 100644
--- a/board/freescale/mx6sabresd/mx6sabresd.c
+++ b/board/freescale/mx6sabresd/mx6sabresd.c
@@ -8,6 +8,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/imx-regs.h>
+#include <asm/arch/crm_regs.h>
#include <asm/arch/iomux.h>
#include <asm/arch/mx6-pins.h>
#include <asm/errno.h>
@@ -200,49 +201,49 @@ iomux_v3_cfg_t const di0_pads[] = {
#if defined(CONFIG_MX6DL) && defined(CONFIG_MXC_EPDC)
static iomux_v3_cfg_t const epdc_enable_pads[] = {
- MX6_PAD_EIM_A16__EPDC_SDDO_0 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA10__EPDC_SDDO_1 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA12__EPDC_SDDO_2 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA11__EPDC_SDDO_3 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_LBA__EPDC_SDDO_4 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_EB2__EPDC_SDDO_5 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_CS0__EPDC_SDDO_6 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_RW__EPDC_SDDO_7 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_A16__EPDC_DATA00 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA10__EPDC_DATA01 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA12__EPDC_DATA02 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA11__EPDC_DATA03 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_LBA__EPDC_DATA04 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_EB2__EPDC_DATA05 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_CS0__EPDC_DATA06 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_RW__EPDC_DATA07 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_A21__EPDC_GDCLK | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_A22__EPDC_GDSP | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_A23__EPDC_GDOE | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_A24__EPDC_GDRL | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_D31__EPDC_SDCLK | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_D31__EPDC_SDCLK_P | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_D27__EPDC_SDOE | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_DA1__EPDC_SDLE | MUX_PAD_CTRL(EPDC_PAD_CTRL),
MX6_PAD_EIM_EB1__EPDC_SDSHR | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA2__EPDC_BDR_0 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA4__EPDC_SDCE_0 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA5__EPDC_SDCE_1 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
- MX6_PAD_EIM_DA6__EPDC_SDCE_2 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA2__EPDC_BDR0 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA4__EPDC_SDCE0 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA5__EPDC_SDCE1 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
+ MX6_PAD_EIM_DA6__EPDC_SDCE2 | MUX_PAD_CTRL(EPDC_PAD_CTRL),
};
static iomux_v3_cfg_t const epdc_disable_pads[] = {
- MX6_PAD_EIM_A16__GPIO_2_22,
- MX6_PAD_EIM_DA10__GPIO_3_10,
- MX6_PAD_EIM_DA12__GPIO_3_12,
- MX6_PAD_EIM_DA11__GPIO_3_11,
- MX6_PAD_EIM_LBA__GPIO_2_27,
- MX6_PAD_EIM_EB2__GPIO_2_30,
- MX6_PAD_EIM_CS0__GPIO_2_23,
- MX6_PAD_EIM_RW__GPIO_2_26,
- MX6_PAD_EIM_A21__GPIO_2_17,
- MX6_PAD_EIM_A22__GPIO_2_16,
- MX6_PAD_EIM_A23__GPIO_6_6,
- MX6_PAD_EIM_A24__GPIO_5_4,
- MX6_PAD_EIM_D31__GPIO_3_31,
- MX6_PAD_EIM_D27__GPIO_3_27,
- MX6_PAD_EIM_DA1__GPIO_3_1,
- MX6_PAD_EIM_EB1__GPIO_2_29,
- MX6_PAD_EIM_DA2__GPIO_3_2,
- MX6_PAD_EIM_DA4__GPIO_3_4,
- MX6_PAD_EIM_DA5__GPIO_3_5,
- MX6_PAD_EIM_DA6__GPIO_3_6,
+ MX6_PAD_EIM_A16__GPIO2_IO22,
+ MX6_PAD_EIM_DA10__GPIO3_IO10,
+ MX6_PAD_EIM_DA12__GPIO3_IO12,
+ MX6_PAD_EIM_DA11__GPIO3_IO11,
+ MX6_PAD_EIM_LBA__GPIO2_IO27,
+ MX6_PAD_EIM_EB2__GPIO2_IO30,
+ MX6_PAD_EIM_CS0__GPIO2_IO23,
+ MX6_PAD_EIM_RW__GPIO2_IO26,
+ MX6_PAD_EIM_A21__GPIO2_IO17,
+ MX6_PAD_EIM_A22__GPIO2_IO16,
+ MX6_PAD_EIM_A23__GPIO6_IO06,
+ MX6_PAD_EIM_A24__GPIO5_IO04,
+ MX6_PAD_EIM_D31__GPIO3_IO31,
+ MX6_PAD_EIM_D27__GPIO3_IO27,
+ MX6_PAD_EIM_DA1__GPIO3_IO01,
+ MX6_PAD_EIM_EB1__GPIO2_IO29,
+ MX6_PAD_EIM_DA2__GPIO3_IO02,
+ MX6_PAD_EIM_DA4__GPIO3_IO04,
+ MX6_PAD_EIM_DA5__GPIO3_IO05,
+ MX6_PAD_EIM_DA6__GPIO3_IO06,
};
#endif
@@ -511,6 +512,274 @@ void board_late_mmc_env_init(void)
}
#endif
+#if defined(CONFIG_MX6DL) && defined(CONFIG_MXC_EPDC)
+#ifdef CONFIG_SPLASH_SCREEN
+extern int mmc_get_env_devno(void);
+int setup_splash_img(void)
+{
+#ifdef CONFIG_SPLASH_IS_IN_MMC
+ int mmc_dev = mmc_get_env_devno();
+ ulong offset = CONFIG_SPLASH_IMG_OFFSET;
+ ulong size = CONFIG_SPLASH_IMG_SIZE;
+ ulong addr = 0;
+ char *s = NULL;
+ struct mmc *mmc = find_mmc_device(mmc_dev);
+ uint blk_start, blk_cnt, n;
+
+ s = getenv("splashimage");
+
+ if (NULL == s) {
+ puts("env splashimage not found!\n");
+ return -1;
+ }
+ addr = simple_strtoul(s, NULL, 16);
+
+ if (!mmc) {
+ printf("MMC Device %d not found\n", mmc_dev);
+ return -1;
+ }
+
+ if (mmc_init(mmc)) {
+ puts("MMC init failed\n");
+ return -1;
+ }
+
+ blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len;
+ blk_cnt = ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len;
+ n = mmc->block_dev.block_read(mmc_dev, blk_start,
+ blk_cnt, (u_char *)addr);
+ flush_cache((ulong)addr, blk_cnt * mmc->read_bl_len);
+
+ return (n == blk_cnt) ? 0 : -1;
+#endif
+
+ return 0;
+}
+#endif
+
+vidinfo_t panel_info = {
+ .vl_refresh = 85,
+ .vl_col = 800,
+ .vl_row = 600,
+ .vl_pixclock = 26666667,
+ .vl_left_margin = 8,
+ .vl_right_margin = 100,
+ .vl_upper_margin = 4,
+ .vl_lower_margin = 8,
+ .vl_hsync = 4,
+ .vl_vsync = 1,
+ .vl_sync = 0,
+ .vl_mode = 0,
+ .vl_flag = 0,
+ .vl_bpix = 3,
+ .cmap = 0,
+};
+
+struct epdc_timing_params panel_timings = {
+ .vscan_holdoff = 4,
+ .sdoed_width = 10,
+ .sdoed_delay = 20,
+ .sdoez_width = 10,
+ .sdoez_delay = 20,
+ .gdclk_hp_offs = 419,
+ .gdsp_offs = 20,
+ .gdoe_offs = 0,
+ .gdclk_offs = 5,
+ .num_ce = 1,
+};
+
+static void setup_epdc_power(void)
+{
+ /* Setup epdc voltage */
+
+ /* EIM_A17 - GPIO2[21] for PWR_GOOD status */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_A17__GPIO2_IO21 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+ /* Set as input */
+ gpio_direction_input(IMX_GPIO_NR(2, 21));
+
+ /* EIM_D17 - GPIO3[17] for VCOM control */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_D17__GPIO3_IO17 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+
+ /* Set as output */
+ gpio_direction_output(IMX_GPIO_NR(3, 17), 1);
+
+ /* EIM_D20 - GPIO3[20] for EPD PMIC WAKEUP */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_D20__GPIO3_IO20 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+ /* Set as output */
+ gpio_direction_output(IMX_GPIO_NR(3, 20), 1);
+
+ /* EIM_A18 - GPIO2[20] for EPD PWR CTL0 */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_A18__GPIO2_IO20 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+ /* Set as output */
+ gpio_direction_output(IMX_GPIO_NR(2, 20), 1);
+}
+
+int setup_waveform_file(void)
+{
+#ifdef CONFIG_WAVEFORM_FILE_IN_MMC
+ int mmc_dev = mmc_get_env_devno();
+ ulong offset = CONFIG_WAVEFORM_FILE_OFFSET;
+ ulong size = CONFIG_WAVEFORM_FILE_SIZE;
+ ulong addr = CONFIG_WAVEFORM_BUF_ADDR;
+ struct mmc *mmc = find_mmc_device(mmc_dev);
+ uint blk_start, blk_cnt, n;
+
+ if (!mmc) {
+ printf("MMC Device %d not found\n", mmc_dev);
+ return -1;
+ }
+
+ if (mmc_init(mmc)) {
+ puts("MMC init failed\n");
+ return -1;
+ }
+
+ blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len;
+ blk_cnt = ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len;
+ n = mmc->block_dev.block_read(mmc_dev, blk_start,
+ blk_cnt, (u_char *)addr);
+ flush_cache((ulong)addr, blk_cnt * mmc->read_bl_len);
+
+ return (n == blk_cnt) ? 0 : -1;
+#else
+ return -1;
+#endif
+}
+
+static void epdc_enable_pins(void)
+{
+ /* epdc iomux settings */
+ imx_iomux_v3_setup_multiple_pads(epdc_enable_pads,
+ ARRAY_SIZE(epdc_enable_pads));
+}
+
+static void epdc_disable_pins(void)
+{
+ /* Configure MUX settings for EPDC pins to GPIO */
+ imx_iomux_v3_setup_multiple_pads(epdc_disable_pads,
+ ARRAY_SIZE(epdc_disable_pads));
+}
+
+static void setup_epdc(void)
+{
+ unsigned int reg;
+ struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
+
+ /*** epdc Maxim PMIC settings ***/
+
+ /* EPDC PWRSTAT - GPIO2[21] for PWR_GOOD status */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_A17__GPIO2_IO21 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+
+ /* EPDC VCOM0 - GPIO3[17] for VCOM control */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_D17__GPIO3_IO17 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+
+ /* UART4 TXD - GPIO3[20] for EPD PMIC WAKEUP */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_D20__GPIO3_IO20 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+
+ /* EIM_A18 - GPIO2[20] for EPD PWR CTL0 */
+ imx_iomux_v3_setup_pad(MX6_PAD_EIM_A18__GPIO2_IO20 |
+ MUX_PAD_CTRL(EPDC_PAD_CTRL));
+
+ /*** Set pixel clock rates for EPDC ***/
+
+ /* EPDC AXI clk (IPU2_CLK) from PFD_400M, set to 396/2 = 198MHz */
+ reg = readl(&ccm_regs->cscdr3);
+ reg &= ~0x7C000;
+ reg |= (1 << 16) | (1 << 14);
+ writel(reg, &ccm_regs->cscdr3);
+
+ /* EPDC AXI clk enable */
+ reg = readl(&ccm_regs->CCGR3);
+ reg |= 0x00C0;
+ writel(reg, &ccm_regs->CCGR3);
+
+ /* EPDC PIX clk (IPU2_DI1_CLK) from PLL5, set to 650/4/6 = ~27MHz */
+ reg = readl(&ccm_regs->cscdr2);
+ reg &= ~0x3FE00;
+ reg |= (2 << 15) | (5 << 12);
+ writel(reg, &ccm_regs->cscdr2);
+
+ /* PLL5 enable (defaults to 650) */
+ reg = readl(ANATOP_BASE_ADDR + ANATOP_PLL_VIDEO);
+ reg &= ~((1 << 16) | (1 << 12));
+ reg |= (1 << 13);
+ writel(reg, ANATOP_BASE_ADDR + ANATOP_PLL_VIDEO);
+
+ /* EPDC PIX clk enable */
+ reg = readl(&ccm_regs->CCGR3);
+ reg |= 0x0C00;
+ writel(reg, &ccm_regs->CCGR3);
+
+ panel_info.epdc_data.working_buf_addr = CONFIG_WORKING_BUF_ADDR;
+ panel_info.epdc_data.waveform_buf_addr = CONFIG_WAVEFORM_BUF_ADDR;
+
+ panel_info.epdc_data.wv_modes.mode_init = 0;
+ panel_info.epdc_data.wv_modes.mode_du = 1;
+ panel_info.epdc_data.wv_modes.mode_gc4 = 3;
+ panel_info.epdc_data.wv_modes.mode_gc8 = 2;
+ panel_info.epdc_data.wv_modes.mode_gc16 = 2;
+ panel_info.epdc_data.wv_modes.mode_gc32 = 2;
+
+ panel_info.epdc_data.epdc_timings = panel_timings;
+
+ setup_epdc_power();
+
+ /* Assign fb_base */
+ gd->fb_base = CONFIG_FB_BASE;
+}
+
+void epdc_power_on(void)
+{
+ unsigned int reg;
+ struct gpio_regs *gpio_regs = (struct gpio_regs *)GPIO2_BASE_ADDR;
+
+ /* Set EPD_PWR_CTL0 to high - enable EINK_VDD (3.15) */
+ gpio_set_value(IMX_GPIO_NR(2, 20), 1);
+ udelay(1000);
+
+ /* Enable epdc signal pin */
+ epdc_enable_pins();
+
+ /* Set PMIC Wakeup to high - enable Display power */
+ gpio_set_value(IMX_GPIO_NR(3, 20), 1);
+
+ /* Wait for PWRGOOD == 1 */
+ while (1) {
+ reg = readl(&gpio_regs->gpio_psr);
+ if (!(reg & (1 << 21)))
+ break;
+
+ udelay(100);
+ }
+
+ /* Enable VCOM */
+ gpio_set_value(IMX_GPIO_NR(3, 17), 1);
+
+ udelay(500);
+}
+
+void epdc_power_off(void)
+{
+ /* Set PMIC Wakeup to low - disable Display power */
+ gpio_set_value(IMX_GPIO_NR(3, 20), 0);
+
+ /* Disable VCOM */
+ gpio_set_value(IMX_GPIO_NR(3, 17), 0);
+
+ epdc_disable_pins();
+
+ /* Set EPD_PWR_CTL0 to low - disable EINK_VDD (3.15) */
+ gpio_set_value(IMX_GPIO_NR(2, 20), 0);
+}
+#endif
+
int mx6_rgmii_rework(struct phy_device *phydev)
{
unsigned short val;
@@ -818,273 +1087,6 @@ int checkboard(void)
return 0;
}
-#if defined(CONFIG_MX6DL) && defined(CONFIG_MXC_EPDC)
-#ifdef CONFIG_SPLASH_SCREEN
-extern int mmc_get_env_devno(void);
-int setup_splash_img(void)
-{
-#ifdef CONFIG_SPLASH_IS_IN_MMC
- int mmc_dev = mmc_get_env_devno();
- ulong offset = CONFIG_SPLASH_IMG_OFFSET;
- ulong size = CONFIG_SPLASH_IMG_SIZE;
- ulong addr = 0;
- char *s = NULL;
- struct mmc *mmc = find_mmc_device(mmc_dev);
- uint blk_start, blk_cnt, n;
-
- s = getenv("splashimage");
-
- if (NULL == s) {
- puts("env splashimage not found!\n");
- return -1;
- }
- addr = simple_strtoul(s, NULL, 16);
-
- if (!mmc) {
- printf("MMC Device %d not found\n", mmc_dev);
- return -1;
- }
-
- if (mmc_init(mmc)) {
- puts("MMC init failed\n");
- return -1;
- }
-
- blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len;
- blk_cnt = ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len;
- n = mmc->block_dev.block_read(mmc_dev, blk_start,
- blk_cnt, (u_char *)addr);
- flush_cache((ulong)addr, blk_cnt * mmc->read_bl_len);
-
- return (n == blk_cnt) ? 0 : -1;
-#endif
-
- return 0;
-}
-#endif
-
-vidinfo_t panel_info = {
- .vl_refresh = 85,
- .vl_col = 800,
- .vl_row = 600,
- .vl_pixclock = 26666667,
- .vl_left_margin = 8,
- .vl_right_margin = 100,
- .vl_upper_margin = 4,
- .vl_lower_margin = 8,
- .vl_hsync = 4,
- .vl_vsync = 1,
- .vl_sync = 0,
- .vl_mode = 0,
- .vl_flag = 0,
- .vl_bpix = 3,
- .cmap = 0,
-};
-
-struct epdc_timing_params panel_timings = {
- .vscan_holdoff = 4,
- .sdoed_width = 10,
- .sdoed_delay = 20,
- .sdoez_width = 10,
- .sdoez_delay = 20,
- .gdclk_hp_offs = 419,
- .gdsp_offs = 20,
- .gdoe_offs = 0,
- .gdclk_offs = 5,
- .num_ce = 1,
-};
-
-static void setup_epdc_power(void)
-{
- /* Setup epdc voltage */
-
- /* EIM_A17 - GPIO2[21] for PWR_GOOD status */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_A17__GPIO_2_21 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
- /* Set as input */
- gpio_direction_input(IMX_GPIO_NR(2, 21));
-
- /* EIM_D17 - GPIO3[17] for VCOM control */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_D17__GPIO_3_17 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
-
- /* Set as output */
- gpio_direction_output(IMX_GPIO_NR(3, 17), 1);
-
- /* EIM_D20 - GPIO3[20] for EPD PMIC WAKEUP */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_D20__GPIO_3_20 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
- /* Set as output */
- gpio_direction_output(IMX_GPIO_NR(3, 20), 1);
-
- /* EIM_A18 - GPIO2[20] for EPD PWR CTL0 */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_A18__GPIO_2_20 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
- /* Set as output */
- gpio_direction_output(IMX_GPIO_NR(2, 20), 1);
-}
-
-int setup_waveform_file(void)
-{
-#ifdef CONFIG_WAVEFORM_FILE_IN_MMC
- int mmc_dev = mmc_get_env_devno();
- ulong offset = CONFIG_WAVEFORM_FILE_OFFSET;
- ulong size = CONFIG_WAVEFORM_FILE_SIZE;
- ulong addr = CONFIG_WAVEFORM_BUF_ADDR;
- struct mmc *mmc = find_mmc_device(mmc_dev);
- uint blk_start, blk_cnt, n;
-
- if (!mmc) {
- printf("MMC Device %d not found\n", mmc_dev);
- return -1;
- }
-
- if (mmc_init(mmc)) {
- puts("MMC init failed\n");
- return -1;
- }
-
- blk_start = ALIGN(offset, mmc->read_bl_len) / mmc->read_bl_len;
- blk_cnt = ALIGN(size, mmc->read_bl_len) / mmc->read_bl_len;
- n = mmc->block_dev.block_read(mmc_dev, blk_start,
- blk_cnt, (u_char *)addr);
- flush_cache((ulong)addr, blk_cnt * mmc->read_bl_len);
-
- return (n == blk_cnt) ? 0 : -1;
-#else
- return -1;
-#endif
-}
-
-static void epdc_enable_pins(void)
-{
- /* epdc iomux settings */
- imx_iomux_v3_setup_multiple_pads(epdc_enable_pads,
- ARRAY_SIZE(epdc_enable_pads));
-}
-
-static void epdc_disable_pins(void)
-{
- /* Configure MUX settings for EPDC pins to GPIO */
- imx_iomux_v3_setup_multiple_pads(epdc_disable_pads,
- ARRAY_SIZE(epdc_disable_pads));
-}
-
-static void setup_epdc(void)
-{
- unsigned int reg;
-
- /*** epdc Maxim PMIC settings ***/
-
- /* EPDC PWRSTAT - GPIO2[21] for PWR_GOOD status */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_A17__GPIO_2_21 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
-
- /* EPDC VCOM0 - GPIO3[17] for VCOM control */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_D17__GPIO_3_17 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
-
- /* UART4 TXD - GPIO3[20] for EPD PMIC WAKEUP */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_D20__GPIO_3_20 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
-
- /* EIM_A18 - GPIO2[20] for EPD PWR CTL0 */
- imx_iomux_v3_setup_pad(MX6_PAD_EIM_A18__GPIO_2_20 |
- MUX_PAD_CTRL(EPDC_PAD_CTRL));
-
- /*** Set pixel clock rates for EPDC ***/
-
- /* EPDC AXI clk (IPU2_CLK) from PFD_400M, set to 396/2 = 198MHz */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CSCDR3);
- reg &= ~0x7C000;
- reg |= (1 << 16) | (1 << 14);
- writel(reg, CCM_BASE_ADDR + CLKCTL_CSCDR3);
-
- /* EPDC AXI clk enable */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CCGR3);
- reg |= 0x00C0;
- writel(reg, CCM_BASE_ADDR + CLKCTL_CCGR3);
-
- /* EPDC PIX clk (IPU2_DI1_CLK) from PLL5, set to 650/4/6 = ~27MHz */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CSCDR2);
- reg &= ~0x3FE00;
- reg |= (2 << 15) | (5 << 12);
- writel(reg, CCM_BASE_ADDR + CLKCTL_CSCDR2);
-
- /* PLL5 enable (defaults to 650) */
- reg = readl(ANATOP_BASE_ADDR + ANATOP_PLL_VIDEO);
- reg &= ~((1 << 16) | (1 << 12));
- reg |= (1 << 13);
- writel(reg, ANATOP_BASE_ADDR + ANATOP_PLL_VIDEO);
-
- /* EPDC PIX clk enable */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CCGR3);
- reg |= 0x0C00;
- writel(reg, CCM_BASE_ADDR + CLKCTL_CCGR3);
-
- panel_info.epdc_data.working_buf_addr = CONFIG_WORKING_BUF_ADDR;
- panel_info.epdc_data.waveform_buf_addr = CONFIG_WAVEFORM_BUF_ADDR;
-
- panel_info.epdc_data.wv_modes.mode_init = 0;
- panel_info.epdc_data.wv_modes.mode_du = 1;
- panel_info.epdc_data.wv_modes.mode_gc4 = 3;
- panel_info.epdc_data.wv_modes.mode_gc8 = 2;
- panel_info.epdc_data.wv_modes.mode_gc16 = 2;
- panel_info.epdc_data.wv_modes.mode_gc32 = 2;
-
- panel_info.epdc_data.epdc_timings = panel_timings;
-
- setup_epdc_power();
-
- /* Assign fb_base */
- gd->fb_base = CONFIG_FB_BASE;
-}
-
-void epdc_power_on(void)
-{
- unsigned int reg;
-
- /* Set EPD_PWR_CTL0 to high - enable EINK_VDD (3.15) */
- gpio_set_value(IMX_GPIO_NR(2, 20), 1);
- udelay(1000);
-
- /* Enable epdc signal pin */
- epdc_enable_pins();
-
- /* Set PMIC Wakeup to high - enable Display power */
- gpio_set_value(IMX_GPIO_NR(3, 20), 1);
-
- /* Wait for PWRGOOD == 1 */
- while (1) {
- reg = readl(GPIO2_BASE_ADDR + GPIO_PSR);
- if (!(reg & (1 << 21)))
- break;
-
- udelay(100);
- }
-
- /* Enable VCOM */
- gpio_set_value(IMX_GPIO_NR(3, 17), 1);
-
- udelay(500);
-}
-
-void epdc_power_off(void)
-{
- /* Set PMIC Wakeup to low - disable Display power */
- gpio_set_value(IMX_GPIO_NR(3, 20), 0);
-
- /* Disable VCOM */
- gpio_set_value(IMX_GPIO_NR(3, 17), 0);
-
- epdc_disable_pins();
-
- /* Set EPD_PWR_CTL0 to low - disable EINK_VDD (3.15) */
- gpio_set_value(IMX_GPIO_NR(2, 20), 0);
-}
-#endif
-
-
#ifdef CONFIG_FASTBOOT
void board_fastboot_setup(void)
diff --git a/board/freescale/mx6slevk/mx6slevk.c b/board/freescale/mx6slevk/mx6slevk.c
index e98170b..6a6c405 100644
--- a/board/freescale/mx6slevk/mx6slevk.c
+++ b/board/freescale/mx6slevk/mx6slevk.c
@@ -9,6 +9,7 @@
#include <asm/arch/clock.h>
#include <asm/arch/iomux.h>
#include <asm/arch/imx-regs.h>
+#include <asm/arch/crm_regs.h>
#include <asm/arch/mx6-pins.h>
#include <asm/arch/sys_proto.h>
#include <asm/gpio.h>
@@ -470,6 +471,7 @@ static void epdc_disable_pins(void)
static void setup_epdc(void)
{
unsigned int reg;
+ struct mxc_ccm_reg *ccm_regs = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
/*** epdc Maxim PMIC settings ***/
@@ -492,31 +494,31 @@ static void setup_epdc(void)
/*** Set pixel clock rates for EPDC ***/
/* EPDC AXI clk from PFD_400M, set to 396/2 = 198MHz */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CHSCCDR);
+ reg = readl(&ccm_regs->chsccdr);
reg &= ~0x3F000;
reg |= (0x4 << 15) | (1 << 12);
- writel(reg, CCM_BASE_ADDR + CLKCTL_CHSCCDR);
+ writel(reg, &ccm_regs->chsccdr);
/* EPDC AXI clk enable */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CCGR3);
+ reg = readl(&ccm_regs->CCGR3);
reg |= 0x0030;
- writel(reg, CCM_BASE_ADDR + CLKCTL_CCGR3);
+ writel(reg, &ccm_regs->CCGR3);
/* EPDC PIX clk from PFD_540M, set to 540/4/5 = 27MHz */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CSCDR2);
+ reg = readl(&ccm_regs->cscdr2);
reg &= ~0x03F000;
reg |= (0x5 << 15) | (4 << 12);
- writel(reg, CCM_BASE_ADDR + CLKCTL_CSCDR2);
+ writel(reg, &ccm_regs->cscdr2);
- reg = readl(CCM_BASE_ADDR + CLKCTL_CBCMR);
+ reg = readl(&ccm_regs->cbcmr);
reg &= ~0x03800000;
reg |= (0x3 << 23);
- writel(reg, CCM_BASE_ADDR + CLKCTL_CBCMR);
+ writel(reg, &ccm_regs->cbcmr);
/* EPDC PIX clk enable */
- reg = readl(CCM_BASE_ADDR + CLKCTL_CCGR3);
+ reg = readl(&ccm_regs->CCGR3);
reg |= 0x0C00;
- writel(reg, CCM_BASE_ADDR + CLKCTL_CCGR3);
+ writel(reg, &ccm_regs->CCGR3);
panel_info.epdc_data.working_buf_addr = CONFIG_WORKING_BUF_ADDR;
panel_info.epdc_data.waveform_buf_addr = CONFIG_WAVEFORM_BUF_ADDR;
@@ -539,6 +541,7 @@ static void setup_epdc(void)
void epdc_power_on(void)
{
unsigned int reg;
+ struct gpio_regs *gpio_regs = (struct gpio_regs *)GPIO2_BASE_ADDR;
/* Set EPD_PWR_CTL0 to high - enable EINK_VDD (3.15) */
gpio_set_value(IMX_GPIO_NR(2, 7), 1);
@@ -552,7 +555,7 @@ void epdc_power_on(void)
/* Wait for PWRGOOD == 1 */
while (1) {
- reg = readl(GPIO2_BASE_ADDR + GPIO_PSR);
+ reg = readl(&gpio_regs->gpio_psr);
if (!(reg & (1 << 13)))
break;