Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Copyright (C) 2011-2012 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
- #include <linux/types.h>
- #include <linux/sched.h>
- #include <linux/delay.h>
- #include <linux/pm.h>
- #include <linux/interrupt.h>
- #include <linux/irq.h>
- #include <linux/init.h>
- #include <linux/input.h>
- #include <linux/nodemask.h>
- #include <linux/clk.h>
- #include <linux/platform_device.h>
- #include <linux/fsl_devices.h>
- #include <linux/spi/spi.h>
- #include <linux/spi/spi_gpio.h>
- #include <linux/spi/ads7846.h>
- #include <linux/spi/flash.h>
- #include <linux/i2c.h>
- #include <linux/i2c/pca953x.h>
- #include <linux/ata.h>
- #include <linux/mtd/mtd.h>
- #include <linux/mtd/map.h>
- #include <linux/mtd/partitions.h>
- #include <linux/regulator/consumer.h>
- #include <linux/pmic_external.h>
- #include <linux/pmic_status.h>
- #include <linux/ipu.h>
- #include <linux/mxcfb.h>
- #include <linux/pwm_backlight.h>
- #include <linux/fec.h>
- #include <linux/memblock.h>
- #include <linux/gpio.h>
- #include <linux/etherdevice.h>
- #include <linux/regulator/anatop-regulator.h>
- #include <linux/regulator/consumer.h>
- #include <linux/regulator/machine.h>
- #include <linux/regulator/fixed.h>
- #include <mach/common.h>
- #include <mach/hardware.h>
- #include <mach/mxc_dvfs.h>
- #include <mach/memory.h>
- #include <mach/iomux-mx6q.h>
- #include <mach/iomux-mx6dl.h>
- #include <mach/imx-uart.h>
- #include <mach/viv_gpu.h>
- #include <mach/ahci_sata.h>
- #include <mach/ipu-v3.h>
- #include <mach/mxc_hdmi.h>
- #include <mach/mxc_asrc.h>
- #include <mach/mipi_dsi.h>
- #include <mach/mipi_csi2.h>
- #include <asm/irq.h>
- #include <asm/setup.h>
- #include <asm/mach-types.h>
- #include <asm/mach/arch.h>
- #include <asm/mach/time.h>
- #include "usb.h"
- #include "devices-imx6q.h"
- #include "crm_regs.h"
- #include "cpu_op-mx6.h"
- #define MX6Q_SK_CEC IMX_GPIO_NR(4, 11)
- #define MX6Q_SK_SD1_CD IMX_GPIO_NR(2, 9)
- #define MX6Q_SK_SD2_CD IMX_GPIO_NR(2, 11)
- #define MX6Q_SK_ETH_RESET IMX_GPIO_NR(1, 25)
- #define MX6DL_SK_ETH_RESET IMX_GPIO_NR(1, 23)
- #define MX6Q_SK_USB_OTG_PWR IMX_GPIO_NR(1, 28)
- #define MX6Q_SK_USB_HOST_PWR IMX_GPIO_NR(7, 7)
- #define MX6Q_SK_ECSPI1_CS0 IMX_GPIO_NR(5, 25)
- #define MX6Q_SK_ECSPI4_CS0 IMX_GPIO_NR(3, 29)
- #define MX6DL_SK_ECSPI4_CS0 IMX_GPIO_NR(3, 20)
- #define MX6Q_SK_LVDS0_PENIRQ IMX_GPIO_NR(1, 7)
- #define MX6Q_SK_DISP_PENIRQ IMX_GPIO_NR(2, 31)
- #define MX6DL_SK_LVDS0_PENIRQ IMX_GPIO_NR(1, 9)
- #define MX6DL_SK_LVDS1_PENIRQ IMX_GPIO_NR(4, 15)
- #define MX6Q_SK_LVDS1_SCK IMX_GPIO_NR(1, 1)
- #define MX6Q_SK_LVDS1_MOSI IMX_GPIO_NR(1, 2)
- #define MX6Q_SK_LVDS1_MISO IMX_GPIO_NR(7, 11)
- #define MX6Q_SK_LVDS1_CS IMX_GPIO_NR(4, 15)
- #define MX6Q_SK_LVDS1_PENIRQ IMX_GPIO_NR(4, 10)
- #define MX6_ENET_IRQ IMX_GPIO_NR(1, 6)
- #define IOMUX_OBSRV_MUX1_OFFSET 0x3c
- #define OBSRV_MUX1_MASK 0x3f
- #define OBSRV_MUX1_ENET_IRQ 0x9
- void __init early_console_setup(unsigned long base, struct clk *clk);
- static struct clk *sata_clk;
- extern char *gp_reg_id;
- extern char *soc_reg_id;
- extern char *pu_reg_id;
- extern bool enet_to_gpio_6;
- static int caam_enabled;
- extern struct regulator *(*get_cpu_regulator)(void);
- extern void (*put_cpu_regulator)(void);
- static iomux_v3_cfg_t mx6q_sabrelite_pads[] = {
- /* spi-gpio, LVDS1 */
- MX6Q_PAD_GPIO_1__GPIO_1_1, /* TS CLK */
- MX6Q_PAD_GPIO_2__GPIO_1_2, /* TS DIN */
- MX6Q_PAD_GPIO_16__GPIO_7_11, /* TS DOUT */
- MX6Q_PAD_KEY_ROW4__GPIO_4_15, /* TS CS */
- MX6Q_PAD_KEY_COL2__GPIO_4_10, /* TS PENIRQ */
- /* USDHC1 */
- MX6Q_PAD_SD1_CLK__USDHC1_CLK,
- MX6Q_PAD_SD1_CMD__USDHC1_CMD,
- MX6Q_PAD_SD1_DAT0__USDHC1_DAT0,
- MX6Q_PAD_SD1_DAT1__USDHC1_DAT1,
- MX6Q_PAD_SD1_DAT2__USDHC1_DAT2,
- MX6Q_PAD_SD1_DAT3__USDHC1_DAT3,
- MX6Q_PAD_SD4_DAT1__GPIO_2_9, /* SD1_DET */
- /* USDHC2 */
- MX6Q_PAD_SD2_CLK__USDHC2_CLK,
- MX6Q_PAD_SD2_CMD__USDHC2_CMD,
- MX6Q_PAD_SD2_DAT0__USDHC2_DAT0,
- MX6Q_PAD_SD2_DAT1__USDHC2_DAT1,
- MX6Q_PAD_SD2_DAT2__USDHC2_DAT2,
- MX6Q_PAD_SD2_DAT3__USDHC2_DAT3,
- MX6Q_PAD_SD4_DAT3__GPIO_2_11, /* SD2_DET */
- /* UART1 */
- MX6Q_PAD_CSI0_DAT10__UART1_TXD,
- MX6Q_PAD_CSI0_DAT11__UART1_RXD,
- /* ECSPI1 */
- MX6Q_PAD_CSI0_DAT4__ECSPI1_SCLK,
- MX6Q_PAD_CSI0_DAT5__ECSPI1_MOSI,
- MX6Q_PAD_CSI0_DAT6__ECSPI1_MISO,
- MX6Q_PAD_CSI0_DAT7__GPIO_5_25, /* LVDS0 TS CS */
- MX6Q_PAD_GPIO_7__GPIO_1_7, /* LVDS0 TS PENIRQ */
- /* ECSPI4 */
- MX6Q_PAD_EIM_D21__ECSPI4_SCLK,
- MX6Q_PAD_EIM_D22__ECSPI4_MISO,
- MX6Q_PAD_EIM_D28__ECSPI4_MOSI,
- MX6Q_PAD_EIM_D29__GPIO_3_29, /* RGB TS CS */
- MX6Q_PAD_EIM_EB3__GPIO_2_31, /* RGB TS PENIRQ */
- /* ENET */
- MX6Q_PAD_ENET_MDIO__ENET_MDIO,
- MX6Q_PAD_ENET_MDC__ENET_MDC,
- MX6Q_PAD_RGMII_TXC__ENET_RGMII_TXC,
- MX6Q_PAD_RGMII_TD0__ENET_RGMII_TD0,
- MX6Q_PAD_RGMII_TD1__ENET_RGMII_TD1,
- MX6Q_PAD_RGMII_TD2__ENET_RGMII_TD2,
- MX6Q_PAD_RGMII_TD3__ENET_RGMII_TD3,
- MX6Q_PAD_RGMII_TX_CTL__ENET_RGMII_TX_CTL,
- MX6Q_PAD_ENET_REF_CLK__ENET_TX_CLK,
- MX6Q_PAD_RGMII_RXC__ENET_RGMII_RXC,
- MX6Q_PAD_RGMII_RD0__ENET_RGMII_RD0,
- MX6Q_PAD_RGMII_RD1__ENET_RGMII_RD1,
- MX6Q_PAD_RGMII_RD2__ENET_RGMII_RD2,
- MX6Q_PAD_RGMII_RD3__ENET_RGMII_RD3,
- MX6Q_PAD_RGMII_RX_CTL__ENET_RGMII_RX_CTL,
- MX6Q_PAD_ENET_CRS_DV__GPIO_1_25, /* ETH_RESET */
- #ifdef CONFIG_MX6_ENET_IRQ_TO_GPIO
- MX6Q_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1,
- #endif
- /* AUDMUX */
- MX6Q_PAD_KEY_COL0__AUDMUX_AUD5_TXC,
- MX6Q_PAD_KEY_ROW0__AUDMUX_AUD5_TXD,
- MX6Q_PAD_KEY_COL1__AUDMUX_AUD5_TXFS,
- MX6Q_PAD_KEY_ROW1__AUDMUX_AUD5_RXD,
- MX6Q_PAD_NANDF_CS2__CCM_CLKO2, /* AUDIO_MCLK */
- /* CAN1 */
- MX6Q_PAD_SD3_CMD__CAN1_TXCAN,
- MX6Q_PAD_SD3_CLK__CAN1_RXCAN,
- /* CAN2 */
- MX6Q_PAD_SD3_DAT0__CAN2_TXCAN,
- MX6Q_PAD_SD3_DAT1__CAN2_RXCAN,
- /* DISPLAY */
- MX6Q_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK,
- MX6Q_PAD_DI0_PIN15__IPU1_DI0_PIN15, /* DE */
- MX6Q_PAD_DI0_PIN2__IPU1_DI0_PIN2, /* HSync */
- MX6Q_PAD_DI0_PIN3__IPU1_DI0_PIN3, /* VSync */
- MX6Q_PAD_DISP0_DAT0__IPU1_DISP0_DAT_0,
- MX6Q_PAD_DISP0_DAT1__IPU1_DISP0_DAT_1,
- MX6Q_PAD_DISP0_DAT2__IPU1_DISP0_DAT_2,
- MX6Q_PAD_DISP0_DAT3__IPU1_DISP0_DAT_3,
- MX6Q_PAD_DISP0_DAT4__IPU1_DISP0_DAT_4,
- MX6Q_PAD_DISP0_DAT5__IPU1_DISP0_DAT_5,
- MX6Q_PAD_DISP0_DAT6__IPU1_DISP0_DAT_6,
- MX6Q_PAD_DISP0_DAT7__IPU1_DISP0_DAT_7,
- MX6Q_PAD_DISP0_DAT8__IPU1_DISP0_DAT_8,
- MX6Q_PAD_DISP0_DAT9__IPU1_DISP0_DAT_9,
- MX6Q_PAD_DISP0_DAT10__IPU1_DISP0_DAT_10,
- MX6Q_PAD_DISP0_DAT11__IPU1_DISP0_DAT_11,
- MX6Q_PAD_DISP0_DAT12__IPU1_DISP0_DAT_12,
- MX6Q_PAD_DISP0_DAT13__IPU1_DISP0_DAT_13,
- MX6Q_PAD_DISP0_DAT14__IPU1_DISP0_DAT_14,
- MX6Q_PAD_DISP0_DAT15__IPU1_DISP0_DAT_15,
- MX6Q_PAD_DISP0_DAT16__IPU1_DISP0_DAT_16,
- MX6Q_PAD_DISP0_DAT17__IPU1_DISP0_DAT_17,
- MX6Q_PAD_DISP0_DAT18__IPU1_DISP0_DAT_18,
- MX6Q_PAD_DISP0_DAT19__IPU1_DISP0_DAT_19,
- MX6Q_PAD_DISP0_DAT20__IPU1_DISP0_DAT_20,
- MX6Q_PAD_DISP0_DAT21__IPU1_DISP0_DAT_21,
- MX6Q_PAD_DISP0_DAT22__IPU1_DISP0_DAT_22,
- MX6Q_PAD_DISP0_DAT23__IPU1_DISP0_DAT_23,
- /* HDMI */
- MX6Q_PAD_KEY_COL3__I2C2_SCL,
- MX6Q_PAD_KEY_ROW3__I2C2_SDA,
- MX6Q_PAD_KEY_ROW2__HDMI_TX_CEC_LINE,
- /* I2C1, TLV320AIC23, ADV7180 */
- MX6Q_PAD_CSI0_DAT8__I2C1_SDA,
- MX6Q_PAD_CSI0_DAT9__I2C1_SCL,
- /* USB OTG PWR */
- MX6Q_PAD_ENET_TX_EN__GPIO_1_28,
- /* USB HOST PWR */
- MX6Q_PAD_SD3_DAT3__GPIO_7_7,
- /* IPU1 Camera */
- MX6Q_PAD_CSI0_DAT12__IPU1_CSI0_D_12,
- MX6Q_PAD_CSI0_DAT13__IPU1_CSI0_D_13,
- MX6Q_PAD_CSI0_DAT14__IPU1_CSI0_D_14,
- MX6Q_PAD_CSI0_DAT15__IPU1_CSI0_D_15,
- MX6Q_PAD_CSI0_DAT16__IPU1_CSI0_D_16,
- MX6Q_PAD_CSI0_DAT17__IPU1_CSI0_D_17,
- MX6Q_PAD_CSI0_DAT18__IPU1_CSI0_D_18,
- MX6Q_PAD_CSI0_DAT19__IPU1_CSI0_D_19,
- MX6Q_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC,
- MX6Q_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK,
- MX6Q_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC,
- /* NAND */
- MX6Q_PAD_NANDF_CLE__RAWNAND_CLE,
- MX6Q_PAD_NANDF_ALE__RAWNAND_ALE,
- MX6Q_PAD_NANDF_CS0__RAWNAND_CE0N,
- MX6Q_PAD_NANDF_CS1__RAWNAND_CE1N,
- MX6Q_PAD_NANDF_RB0__RAWNAND_READY0,
- MX6Q_PAD_NANDF_D0__RAWNAND_D0,
- MX6Q_PAD_NANDF_D1__RAWNAND_D1,
- MX6Q_PAD_NANDF_D2__RAWNAND_D2,
- MX6Q_PAD_NANDF_D3__RAWNAND_D3,
- MX6Q_PAD_NANDF_D4__RAWNAND_D4,
- MX6Q_PAD_NANDF_D5__RAWNAND_D5,
- MX6Q_PAD_NANDF_D6__RAWNAND_D6,
- MX6Q_PAD_NANDF_D7__RAWNAND_D7,
- MX6Q_PAD_SD4_CMD__RAWNAND_RDN,
- MX6Q_PAD_SD4_CLK__RAWNAND_WRN,
- MX6Q_PAD_NANDF_WP_B__RAWNAND_RESETN,
- };
- static iomux_v3_cfg_t mx6dl_sabrelite_pads[] = {
- /* USDHC1 */
- MX6DL_PAD_SD1_CLK__USDHC1_CLK,
- MX6DL_PAD_SD1_CMD__USDHC1_CMD,
- MX6DL_PAD_SD1_DAT0__USDHC1_DAT0,
- MX6DL_PAD_SD1_DAT1__USDHC1_DAT1,
- MX6DL_PAD_SD1_DAT2__USDHC1_DAT2,
- MX6DL_PAD_SD1_DAT3__USDHC1_DAT3,
- MX6DL_PAD_SD4_DAT1__GPIO_2_9, /* SD1_DET */
- /* USDHC2 */
- MX6DL_PAD_SD2_CLK__USDHC2_CLK,
- MX6DL_PAD_SD2_CMD__USDHC2_CMD,
- MX6DL_PAD_SD2_DAT0__USDHC2_DAT0,
- MX6DL_PAD_SD2_DAT1__USDHC2_DAT1,
- MX6DL_PAD_SD2_DAT2__USDHC2_DAT2,
- MX6DL_PAD_SD2_DAT3__USDHC2_DAT3,
- MX6DL_PAD_SD4_DAT3__GPIO_2_11, /* SD2_DET */
- /* UART1 */
- MX6DL_PAD_CSI0_DAT10__UART1_TXD,
- MX6DL_PAD_CSI0_DAT11__UART1_RXD,
- /* ECSPI1 */
- MX6DL_PAD_CSI0_DAT4__ECSPI1_SCLK,
- MX6DL_PAD_CSI0_DAT5__ECSPI1_MOSI,
- MX6DL_PAD_CSI0_DAT6__ECSPI1_MISO,
- MX6DL_PAD_CSI0_DAT7__GPIO_5_25, /* LVDS1 TS CS */
- MX6DL_PAD_KEY_ROW4__GPIO_4_15, /* LVDS1 TS PENIRQ */
- /* ECSPI4 */
- MX6DL_PAD_EIM_D21__ECSPI4_SCLK,
- MX6DL_PAD_EIM_D22__ECSPI4_MISO,
- MX6DL_PAD_EIM_D28__ECSPI4_MOSI,
- MX6DL_PAD_EIM_D20__GPIO_3_20, /* LVDS0 TS CS */
- MX6DL_PAD_GPIO_9__GPIO_1_9, /* LVDS0 TS PENIRQ */
- /* ENET */
- MX6DL_PAD_GPIO_16__ENET_ANATOP_ETHERNET_REF_OUT,
- MX6DL_PAD_ENET_MDIO__ENET_MDIO,
- MX6DL_PAD_ENET_MDC__ENET_MDC,
- MX6DL_PAD_ENET_CRS_DV__ENET_RX_EN,
- MX6DL_PAD_ENET_RX_ER__ENET_RX_ER,
- MX6DL_PAD_ENET_TX_EN__ENET_TX_EN,
- MX6DL_PAD_ENET_RXD0__ENET_RDATA_0,
- MX6DL_PAD_ENET_RXD1__ENET_RDATA_1,
- MX6DL_PAD_ENET_TXD0__ENET_TDATA_0,
- MX6DL_PAD_ENET_TXD1__ENET_TDATA_1,
- MX6DL_PAD_ENET_REF_CLK__GPIO_1_23,
- #ifdef CONFIG_MX6_ENET_IRQ_TO_GPIO
- MX6DL_PAD_GPIO_6__OBSERVE_MUX_OBSRV_INT_OUT1,
- #endif
- /* AUDMUX */
- MX6DL_PAD_KEY_COL0__AUDMUX_AUD5_TXC,
- MX6DL_PAD_KEY_ROW0__AUDMUX_AUD5_TXD,
- MX6DL_PAD_KEY_COL1__AUDMUX_AUD5_TXFS,
- MX6DL_PAD_KEY_ROW1__AUDMUX_AUD5_RXD,
- MX6DL_PAD_NANDF_CS2__CCM_CLKO2, /* AUDIO_MCLK */
- /* CAN1 */
- MX6DL_PAD_SD3_CMD__CAN1_TXCAN,
- MX6DL_PAD_SD3_CLK__CAN1_RXCAN,
- /* CAN2 */
- MX6DL_PAD_SD3_DAT0__CAN2_TXCAN,
- MX6DL_PAD_SD3_DAT1__CAN2_RXCAN,
- /* DISPLAY */
- MX6DL_PAD_DI0_DISP_CLK__IPU1_DI0_DISP_CLK,
- MX6DL_PAD_DI0_PIN15__IPU1_DI0_PIN15, /* DE */
- MX6DL_PAD_DI0_PIN2__IPU1_DI0_PIN2, /* HSync */
- MX6DL_PAD_DI0_PIN3__IPU1_DI0_PIN3, /* VSync */
- MX6DL_PAD_DISP0_DAT0__IPU1_DISP0_DAT_0,
- MX6DL_PAD_DISP0_DAT1__IPU1_DISP0_DAT_1,
- MX6DL_PAD_DISP0_DAT2__IPU1_DISP0_DAT_2,
- MX6DL_PAD_DISP0_DAT3__IPU1_DISP0_DAT_3,
- MX6DL_PAD_DISP0_DAT4__IPU1_DISP0_DAT_4,
- MX6DL_PAD_DISP0_DAT5__IPU1_DISP0_DAT_5,
- MX6DL_PAD_DISP0_DAT6__IPU1_DISP0_DAT_6,
- MX6DL_PAD_DISP0_DAT7__IPU1_DISP0_DAT_7,
- MX6DL_PAD_DISP0_DAT8__IPU1_DISP0_DAT_8,
- MX6DL_PAD_DISP0_DAT9__IPU1_DISP0_DAT_9,
- MX6DL_PAD_DISP0_DAT10__IPU1_DISP0_DAT_10,
- MX6DL_PAD_DISP0_DAT11__IPU1_DISP0_DAT_11,
- MX6DL_PAD_DISP0_DAT12__IPU1_DISP0_DAT_12,
- MX6DL_PAD_DISP0_DAT13__IPU1_DISP0_DAT_13,
- MX6DL_PAD_DISP0_DAT14__IPU1_DISP0_DAT_14,
- MX6DL_PAD_DISP0_DAT15__IPU1_DISP0_DAT_15,
- MX6DL_PAD_DISP0_DAT16__IPU1_DISP0_DAT_16,
- MX6DL_PAD_DISP0_DAT17__IPU1_DISP0_DAT_17,
- MX6DL_PAD_DISP0_DAT18__IPU1_DISP0_DAT_18,
- MX6DL_PAD_DISP0_DAT19__IPU1_DISP0_DAT_19,
- MX6DL_PAD_DISP0_DAT20__IPU1_DISP0_DAT_20,
- MX6DL_PAD_DISP0_DAT21__IPU1_DISP0_DAT_21,
- MX6DL_PAD_DISP0_DAT22__IPU1_DISP0_DAT_22,
- MX6DL_PAD_DISP0_DAT23__IPU1_DISP0_DAT_23,
- /* HDMI */
- // MX6DL_PAD_KEY_COL3__I2C2_SCL,
- // MX6DL_PAD_KEY_ROW3__I2C2_SDA,
- // MX6DL_PAD_KEY_ROW2__HDMI_TX_CEC_LINE,
- MX6DL_PAD_KEY_ROW2__USDHC2_VSELECT,
- /* I2C2 */
- MX6DL_PAD_EIM_D16__I2C2_SDA,
- MX6DL_PAD_EIM_EB2__I2C2_SCL,
- /* I2C3 */
- MX6DL_PAD_EIM_D18__I2C3_SDA,
- MX6DL_PAD_EIM_D17__I2C3_SCL,
- /* USB HOST PWR */
- MX6DL_PAD_SD3_DAT3__GPIO_7_7,
- /* IPU1 Camera */
- MX6DL_PAD_CSI0_DAT12__IPU1_CSI0_D_12,
- MX6DL_PAD_CSI0_DAT13__IPU1_CSI0_D_13,
- MX6DL_PAD_CSI0_DAT14__IPU1_CSI0_D_14,
- MX6DL_PAD_CSI0_DAT15__IPU1_CSI0_D_15,
- MX6DL_PAD_CSI0_DAT16__IPU1_CSI0_D_16,
- MX6DL_PAD_CSI0_DAT17__IPU1_CSI0_D_17,
- MX6DL_PAD_CSI0_DAT18__IPU1_CSI0_D_18,
- MX6DL_PAD_CSI0_DAT19__IPU1_CSI0_D_19,
- MX6DL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC,
- MX6DL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK,
- MX6DL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC,
- /* NAND */
- MX6DL_PAD_NANDF_CLE__RAWNAND_CLE,
- MX6DL_PAD_NANDF_ALE__RAWNAND_ALE,
- MX6DL_PAD_NANDF_CS0__RAWNAND_CE0N,
- MX6DL_PAD_NANDF_CS1__RAWNAND_CE1N,
- MX6DL_PAD_NANDF_RB0__RAWNAND_READY0,
- MX6DL_PAD_NANDF_D0__RAWNAND_D0,
- MX6DL_PAD_NANDF_D1__RAWNAND_D1,
- MX6DL_PAD_NANDF_D2__RAWNAND_D2,
- MX6DL_PAD_NANDF_D3__RAWNAND_D3,
- MX6DL_PAD_NANDF_D4__RAWNAND_D4,
- MX6DL_PAD_NANDF_D5__RAWNAND_D5,
- MX6DL_PAD_NANDF_D6__RAWNAND_D6,
- MX6DL_PAD_NANDF_D7__RAWNAND_D7,
- MX6DL_PAD_SD4_CMD__RAWNAND_RDN,
- MX6DL_PAD_SD4_CLK__RAWNAND_WRN,
- MX6DL_PAD_NANDF_WP_B__RAWNAND_RESETN,
- };
- static iomux_v3_cfg_t mx6q_sabrelite_hdmi_ddc_pads[] = {
- MX6Q_PAD_KEY_COL3__HDMI_TX_DDC_SCL,
- MX6Q_PAD_KEY_ROW3__HDMI_TX_DDC_SDA,
- };
- static iomux_v3_cfg_t mx6q_sabrelite_i2c2_pads[] = {
- MX6Q_PAD_KEY_COL3__I2C2_SCL,
- MX6Q_PAD_KEY_ROW3__I2C2_SDA,
- };
- static iomux_v3_cfg_t mx6dl_sabrelite_hdmi_ddc_pads[] = {
- MX6DL_PAD_KEY_COL3__HDMI_TX_DDC_SCL,
- MX6DL_PAD_KEY_ROW3__HDMI_TX_DDC_SDA,
- };
- static iomux_v3_cfg_t mx6dl_sabrelite_i2c2_pads[] = {
- MX6DL_PAD_KEY_COL3__I2C2_SCL,
- MX6DL_PAD_KEY_ROW3__I2C2_SDA,
- };
- #define MX6DL_USDHC_PAD_SETTING(id, speed) \
- mx6dl_sd##id##_##speed##mhz[] = { \
- MX6DL_PAD_SD##id##_CLK__USDHC##id##_CLK_##speed##MHZ, \
- MX6DL_PAD_SD##id##_CMD__USDHC##id##_CMD_##speed##MHZ, \
- MX6DL_PAD_SD##id##_DAT0__USDHC##id##_DAT0_##speed##MHZ, \
- MX6DL_PAD_SD##id##_DAT1__USDHC##id##_DAT1_##speed##MHZ, \
- MX6DL_PAD_SD##id##_DAT2__USDHC##id##_DAT2_##speed##MHZ, \
- MX6DL_PAD_SD##id##_DAT3__USDHC##id##_DAT3_##speed##MHZ, \
- }
- static iomux_v3_cfg_t MX6DL_USDHC_PAD_SETTING(2, 50);
- static iomux_v3_cfg_t MX6DL_USDHC_PAD_SETTING(2, 100);
- static iomux_v3_cfg_t MX6DL_USDHC_PAD_SETTING(2, 200);
- #define MX6Q_USDHC_PAD_SETTING(id, speed) \
- mx6q_sd##id##_##speed##mhz[] = { \
- MX6Q_PAD_SD##id##_CLK__USDHC##id##_CLK_##speed##MHZ, \
- MX6Q_PAD_SD##id##_CMD__USDHC##id##_CMD_##speed##MHZ, \
- MX6Q_PAD_SD##id##_DAT0__USDHC##id##_DAT0_##speed##MHZ, \
- MX6Q_PAD_SD##id##_DAT1__USDHC##id##_DAT1_##speed##MHZ, \
- MX6Q_PAD_SD##id##_DAT2__USDHC##id##_DAT2_##speed##MHZ, \
- MX6Q_PAD_SD##id##_DAT3__USDHC##id##_DAT3_##speed##MHZ, \
- }
- static iomux_v3_cfg_t MX6Q_USDHC_PAD_SETTING(1, 50);
- static iomux_v3_cfg_t MX6Q_USDHC_PAD_SETTING(1, 100);
- static iomux_v3_cfg_t MX6Q_USDHC_PAD_SETTING(1, 200);
- enum sd_pad_mode {
- SD_PAD_MODE_LOW_SPEED,
- SD_PAD_MODE_MED_SPEED,
- SD_PAD_MODE_HIGH_SPEED,
- };
- static int plt_sd_pad_change(unsigned int index, int clock)
- {
- /* LOW speed is the default state of SD pads */
- static enum sd_pad_mode pad_mode = SD_PAD_MODE_LOW_SPEED;
- iomux_v3_cfg_t *sd_pads_200mhz = NULL;
- iomux_v3_cfg_t *sd_pads_100mhz = NULL;
- iomux_v3_cfg_t *sd_pads_50mhz = NULL;
- u32 sd_pads_200mhz_cnt;
- u32 sd_pads_100mhz_cnt;
- u32 sd_pads_50mhz_cnt;
- switch (index) {
- case 0:
- if (cpu_is_mx6q()) {
- sd_pads_200mhz = mx6q_sd1_200mhz;
- sd_pads_100mhz = mx6q_sd1_100mhz;
- sd_pads_50mhz = mx6q_sd1_50mhz;
- sd_pads_200mhz_cnt = ARRAY_SIZE(mx6q_sd1_200mhz);
- sd_pads_100mhz_cnt = ARRAY_SIZE(mx6q_sd1_100mhz);
- sd_pads_50mhz_cnt = ARRAY_SIZE(mx6q_sd1_50mhz);
- }
- break;
- case 1:
- if (cpu_is_mx6dl()) {
- sd_pads_200mhz = mx6dl_sd2_200mhz;
- sd_pads_100mhz = mx6dl_sd2_100mhz;
- sd_pads_50mhz = mx6dl_sd2_50mhz;
- sd_pads_200mhz_cnt = ARRAY_SIZE(mx6dl_sd2_200mhz);
- sd_pads_100mhz_cnt = ARRAY_SIZE(mx6dl_sd2_100mhz);
- sd_pads_50mhz_cnt = ARRAY_SIZE(mx6dl_sd2_50mhz);
- }
- break;
- default:
- printk(KERN_ERR "no such SD host controller index %d\n", index);
- return -EINVAL;
- }
- if (clock > 100000000) {
- if (pad_mode == SD_PAD_MODE_HIGH_SPEED)
- return 0;
- BUG_ON(!sd_pads_200mhz);
- pad_mode = SD_PAD_MODE_HIGH_SPEED;
- return mxc_iomux_v3_setup_multiple_pads(sd_pads_200mhz,
- sd_pads_200mhz_cnt);
- } else if (clock > 52000000) {
- if (pad_mode == SD_PAD_MODE_MED_SPEED)
- return 0;
- BUG_ON(!sd_pads_100mhz);
- pad_mode = SD_PAD_MODE_MED_SPEED;
- return mxc_iomux_v3_setup_multiple_pads(sd_pads_100mhz,
- sd_pads_100mhz_cnt);
- } else {
- if (pad_mode == SD_PAD_MODE_LOW_SPEED)
- return 0;
- BUG_ON(!sd_pads_50mhz);
- pad_mode = SD_PAD_MODE_LOW_SPEED;
- return mxc_iomux_v3_setup_multiple_pads(sd_pads_50mhz,
- sd_pads_50mhz_cnt);
- }
- }
- static const struct esdhc_platform_data mx6q_sabrelite_sd1_data __initconst = {
- .cd_gpio = MX6Q_SK_SD1_CD,
- .keep_power_at_suspend = 1,
- .platform_pad_change = plt_sd_pad_change,
- // .support_18v = 1,
- };
- static const struct esdhc_platform_data mx6q_sabrelite_sd2_data __initconst = {
- .cd_gpio = MX6Q_SK_SD2_CD,
- .keep_power_at_suspend = 1,
- .platform_pad_change = plt_sd_pad_change,
- // .support_18v = 1,
- };
- static struct mtd_partition sk_nand_partitions[] = {
- {
- .name = "U-boot partition",
- .offset = 0,
- .size = 16 * SZ_1M,
- },
- {
- .name = "U-boot environment partition",
- .offset = MTDPART_OFS_APPEND,
- .size = SZ_1M,
- },
- {
- .name = "Linux kernel partition",
- .offset = MTDPART_OFS_APPEND,
- .size = 7 * SZ_1M,
- },
- {
- .name = "Linux safe kernel partition (rootfs in initramfs)",
- .offset = MTDPART_OFS_APPEND,
- .size = 12 * SZ_1M,
- },
- {
- .name = "NAND rootfs partition",
- .offset = MTDPART_OFS_NXTBLK,
- .size = MTDPART_SIZ_FULL,
- },
- };
- static int __init gpmi_nand_platform_init(void) { return 0; }
- static const struct gpmi_nand_platform_data
- mx6q_gpmi_nand_platform_data __initconst = {
- .platform_init = gpmi_nand_platform_init,
- .min_prop_delay_in_ns = 5,
- .max_prop_delay_in_ns = 9,
- .max_chip_count = 1,
- .enable_bbt = 1,
- .partitions = sk_nand_partitions,
- .partition_count = ARRAY_SIZE(sk_nand_partitions),
- };
- static const struct anatop_thermal_platform_data
- mx6q_sabrelite_anatop_thermal_data __initconst = {
- .name = "anatop_thermal",
- };
- static inline void mx6q_sabrelite_init_uart(void)
- {
- imx6q_add_imx_uart(0, NULL);
- }
- static int mx6q_sabrelite_fec_phy_init(struct phy_device *phydev)
- {
- unsigned int rst_gpio;
- if (cpu_is_mx6q())
- rst_gpio = MX6Q_SK_ETH_RESET;
- else
- rst_gpio = MX6DL_SK_ETH_RESET;
- gpio_request(rst_gpio, "sk-eth-reset");
- gpio_direction_output(rst_gpio, 1);
- gpio_set_value(rst_gpio, 0);
- msleep(1);
- gpio_set_value(rst_gpio, 1);
- return 0;
- }
- static struct fec_platform_data fec_data __initdata = {
- .init = mx6q_sabrelite_fec_phy_init,
- .phy = PHY_INTERFACE_MODE_RGMII,
- .gpio_irq = MX6_ENET_IRQ,
- };
- static int mx6q_sabrelite_spi1_cs[] = {
- MX6Q_SK_ECSPI1_CS0,
- };
- static const struct spi_imx_master mx6q_sabrelite_spi1_data __initconst = {
- .chipselect = mx6q_sabrelite_spi1_cs,
- .num_chipselect = ARRAY_SIZE(mx6q_sabrelite_spi1_cs),
- };
- static int mx6q_sabrelite_spi4_cs[] = {
- MX6Q_SK_ECSPI4_CS0,
- };
- static const struct spi_imx_master mx6q_sabrelite_spi4_data __initconst = {
- .chipselect = mx6q_sabrelite_spi4_cs,
- .num_chipselect = ARRAY_SIZE(mx6q_sabrelite_spi4_cs),
- };
- static int lvds0_pendown_state(void)
- {
- unsigned int penirq_gpio;
- if (cpu_is_mx6q())
- penirq_gpio = MX6Q_SK_LVDS0_PENIRQ;
- else
- penirq_gpio = MX6DL_SK_LVDS0_PENIRQ;
- return !gpio_get_value(penirq_gpio);
- }
- static struct ads7846_platform_data lvds0_ads_info = {
- .x_min = 150,
- .x_max = 3830,
- .y_min = 190,
- .y_max = 3830,
- .debounce_max = 5,
- .debounce_tol = 5, //10
- .debounce_rep = 0,
- .get_pendown_state = lvds0_pendown_state,
- };
- static int lvds1_pendown_state(void)
- {
- unsigned int penirq_gpio;
- if (cpu_is_mx6q())
- penirq_gpio = MX6Q_SK_LVDS1_PENIRQ;
- else
- penirq_gpio = MX6DL_SK_LVDS1_PENIRQ;
- return !gpio_get_value(penirq_gpio);
- }
- static struct ads7846_platform_data lvds1_ads_info = {
- .x_min = 150,
- .x_max = 3830,
- .y_min = 190,
- .y_max = 3830,
- .debounce_max = 5,
- .debounce_tol = 5, //10
- .debounce_rep = 0,
- .get_pendown_state = lvds1_pendown_state,
- };
- static int disp_pendown_state(void)
- {
- return !gpio_get_value(MX6Q_SK_DISP_PENIRQ);
- }
- static struct ads7846_platform_data disp_ads_info = {
- .x_min = 150,
- .x_max = 3830,
- .y_min = 190,
- .y_max = 3830,
- .debounce_max = 5,
- .debounce_tol = 5, //10
- .debounce_rep = 0,
- .get_pendown_state = disp_pendown_state,
- };
- static struct spi_board_info imx6_sabrelite_spi_devices[] __initdata = {
- {
- .modalias = "ads7846",
- .max_speed_hz = 1000 * 1000,
- .bus_num = 0,
- .chip_select = 0,
- .platform_data = &lvds0_ads_info,
- .irq = gpio_to_irq(MX6Q_SK_LVDS0_PENIRQ),
- },
- {
- .modalias = "ads7846",
- .max_speed_hz = 1000 * 1000,
- .bus_num = 3,
- .chip_select = 0,
- .platform_data = &disp_ads_info,
- .irq = gpio_to_irq(MX6Q_SK_DISP_PENIRQ),
- },
- {
- .modalias = "ads7846",
- .max_speed_hz = 1000 * 1000,
- .bus_num = 4,
- .chip_select = 0,
- .controller_data = (void *)MX6Q_SK_LVDS1_CS,
- .platform_data = &lvds1_ads_info,
- .irq = gpio_to_irq(MX6Q_SK_LVDS1_PENIRQ),
- },
- };
- struct spi_gpio_platform_data lvds1_spi_platform_data = {
- .sck = MX6Q_SK_LVDS1_SCK,
- .mosi = MX6Q_SK_LVDS1_MOSI,
- .miso = MX6Q_SK_LVDS1_MISO,
- .num_chipselect = 1,
- };
- struct platform_device lvds1_spi_gpio_device = {
- .name = "spi_gpio",
- .id = 4,
- .dev = {
- .platform_data = &lvds1_spi_platform_data,
- },
- };
- static void spi_device_init(void)
- {
- if (cpu_is_mx6q()) {
- platform_device_register(&lvds1_spi_gpio_device);
- spi_register_board_info(imx6_sabrelite_spi_devices,
- ARRAY_SIZE(imx6_sabrelite_spi_devices));
- } else {
- imx6_sabrelite_spi_devices[0].platform_data = &lvds1_ads_info;
- imx6_sabrelite_spi_devices[0].irq = gpio_to_irq(MX6DL_SK_LVDS1_PENIRQ);
- imx6_sabrelite_spi_devices[1].platform_data = &lvds0_ads_info;
- imx6_sabrelite_spi_devices[1].irq = gpio_to_irq(MX6DL_SK_LVDS0_PENIRQ);
- spi_register_board_info(imx6_sabrelite_spi_devices, 2);
- }
- }
- static struct mxc_audio_platform_data mx6_sabrelite_audio_data;
- static int mx6_sabrelite_sgtl5000_init(void)
- {
- struct clk *clko2;
- struct clk *new_parent;
- int rate;
- clko2 = clk_get(NULL, "clko2_clk");
- if (IS_ERR(clko2)) {
- pr_err("can't get CLKO2 clock.\n");
- return PTR_ERR(clko2);
- }
- new_parent = clk_get(NULL, "osc_clk");
- if (!IS_ERR(new_parent)) {
- clk_set_parent(clko2, new_parent);
- clk_put(new_parent);
- }
- rate = clk_round_rate(clko2, 12000000);
- mx6_sabrelite_audio_data.sysclk = rate;
- clk_set_rate(clko2, rate);
- clk_enable(clko2);
- return 0;
- }
- static struct imx_ssi_platform_data mx6_sabrelite_ssi_pdata = {
- .flags = IMX_SSI_DMA | IMX_SSI_SYN,
- };
- static struct mxc_audio_platform_data mx6_sabrelite_audio_data = {
- .ssi_num = 1,
- .src_port = 2,
- .ext_port = 5,
- .init = mx6_sabrelite_sgtl5000_init,
- .hp_gpio = -1,
- };
- static struct platform_device mx6_sabrelite_audio_device = {
- .name = "imx-sgtl5000",
- };
- static struct imxi2c_platform_data mx6q_sabrelite_i2c_data = {
- .bitrate = 100000,
- };
- static void mx6q_csi0_io_init(void)
- {
- if (cpu_is_mx6q())
- mxc_iomux_set_gpr_register(1, 19, 1, 1);
- else
- mxc_iomux_set_gpr_register(13, 0, 3, 4);
- }
- static struct fsl_mxc_tvin_platform_data adv7180_data = {
- .dvddio_reg = NULL,
- .dvdd_reg = NULL,
- .avdd_reg = NULL,
- .pvdd_reg = NULL,
- .pwdn = NULL,
- .reset = NULL,
- .cvbs = true,
- .io_init = mx6q_csi0_io_init,
- };
- static void mx6q_csi0_cam_powerndown(int powerdown)
- {
- //TODO...
- msleep(2);
- }
- static struct fsl_mxc_camera_platform_data camera_data = {
- .mclk = 24000000,
- .mclk_source = 0,
- .csi = 0,
- .io_init = mx6q_csi0_io_init,
- .pwdn = mx6q_csi0_cam_powerndown,
- };
- static struct i2c_board_info mx6q_sk_i2c0_board_info[] __initdata = {
- {
- I2C_BOARD_INFO("tlv320aic23", 0x1a),
- },
- // {
- // I2C_BOARD_INFO("adv7180", 0x21),
- // .platform_data = (void *)&adv7180_data,
- //
- // },
- {
- I2C_BOARD_INFO("ov2640", 0x30),
- .platform_data = (void *)&camera_data,
- },
- };
- static struct i2c_board_info mx6q_sk_i2c1_board_info[] __initdata = {
- {
- I2C_BOARD_INFO("mxc_hdmi_i2c", 0x50),
- },
- };
- static struct i2c_board_info mx6dl_sk_i2c1_board_info[] __initdata = {
- {
- I2C_BOARD_INFO("tlv320aic23", 0x1a),
- },
- {
- I2C_BOARD_INFO("adv7180", 0x21),
- .platform_data = (void *)&adv7180_data,
- },
- {
- I2C_BOARD_INFO("pcf8563", 0x51),
- },
- {
- I2C_BOARD_INFO("mxc_hdmi_i2c", 0x50),
- },
- };
- static void imx6q_sabrelite_usbotg_vbus(bool on)
- {
- if (cpu_is_mx6q()) {
- if (on)
- gpio_set_value_cansleep(MX6Q_SK_USB_OTG_PWR, 1);
- else
- gpio_set_value_cansleep(MX6Q_SK_USB_OTG_PWR, 0);
- }
- }
- static void imx6q_sabrelite_usbhost1_vbus(bool on)
- {
- if (on)
- gpio_set_value_cansleep(MX6Q_SK_USB_HOST_PWR, 1);
- else
- gpio_set_value_cansleep(MX6Q_SK_USB_HOST_PWR, 0);
- }
- static void __init imx6q_sabrelite_init_usb(void)
- {
- int ret = 0;
- imx_otg_base = MX6_IO_ADDRESS(MX6Q_USB_OTG_BASE_ADDR);
- if (cpu_is_mx6q()) {
- ret = gpio_request(MX6Q_SK_USB_OTG_PWR, "sk-usb-otg-pwr");
- if (ret) {
- pr_err("failed to get GPIO MX6Q_SK_USB_OTG_PWR: %d\n", ret);
- return;
- }
- gpio_direction_output(MX6Q_SK_USB_OTG_PWR, 1);
- }
- ret = gpio_request(MX6Q_SK_USB_HOST_PWR, "sk-usb-host-pwr");
- if (ret) {
- pr_err("failed to get GPIO MX6Q_SK_USB_HOST_PWR: %d\n", ret);
- return;
- }
- gpio_direction_output(MX6Q_SK_USB_HOST_PWR, 1);
- mxc_iomux_set_gpr_register(1, 13, 1, 1);
- mx6_set_otghost_vbus_func(imx6q_sabrelite_usbotg_vbus);
- mx6_set_host1_vbus_func(imx6q_sabrelite_usbhost1_vbus);
- }
- /* HW Initialization, if return 0, initialization is successful. */
- static int mx6q_sabrelite_sata_init(struct device *dev, void __iomem *addr)
- {
- u32 tmpdata;
- int ret = 0;
- struct clk *clk;
- sata_clk = clk_get(dev, "imx_sata_clk");
- if (IS_ERR(sata_clk)) {
- dev_err(dev, "no sata clock.\n");
- return PTR_ERR(sata_clk);
- }
- ret = clk_enable(sata_clk);
- if (ret) {
- dev_err(dev, "can't enable sata clock.\n");
- goto put_sata_clk;
- }
- tmpdata = readl(IOMUXC_GPR13);
- writel(((tmpdata & ~0x07FFFFFD) | 0x0593A044), IOMUXC_GPR13);
- /* enable SATA_PHY PLL */
- tmpdata = readl(IOMUXC_GPR13);
- writel(((tmpdata & ~0x2) | 0x2), IOMUXC_GPR13);
- /* Get the AHB clock rate, and configure the TIMER1MS reg later */
- clk = clk_get(NULL, "ahb");
- if (IS_ERR(clk)) {
- dev_err(dev, "no ahb clock.\n");
- ret = PTR_ERR(clk);
- goto release_sata_clk;
- }
- tmpdata = clk_get_rate(clk) / 1000;
- clk_put(clk);
- #ifdef CONFIG_SATA_AHCI_PLATFORM
- ret = sata_init(addr, tmpdata);
- if (ret == 0)
- return ret;
- #else
- usleep_range(1000, 2000);
- /* AHCI PHY enter into PDDQ mode if the AHCI module is not enabled */
- tmpdata = readl(addr + PORT_PHY_CTL);
- writel(tmpdata | PORT_PHY_CTL_PDDQ_LOC, addr + PORT_PHY_CTL);
- pr_info("No AHCI save PWR: PDDQ %s\n", ((readl(addr + PORT_PHY_CTL)
- >> 20) & 1) ? "enabled" : "disabled");
- #endif
- release_sata_clk:
- /* disable SATA_PHY PLL */
- writel((readl(IOMUXC_GPR13) & ~0x2), IOMUXC_GPR13);
- clk_disable(sata_clk);
- put_sata_clk:
- clk_put(sata_clk);
- return ret;
- }
- #ifdef CONFIG_SATA_AHCI_PLATFORM
- static void mx6q_sabrelite_sata_exit(struct device *dev)
- {
- clk_disable(sata_clk);
- clk_put(sata_clk);
- }
- static struct ahci_platform_data mx6q_sabrelite_sata_data = {
- .init = mx6q_sabrelite_sata_init,
- .exit = mx6q_sabrelite_sata_exit,
- };
- #endif
- static void mx6q_sabrelite_flexcan0_switch(int enable) {}
- static void mx6q_sabrelite_flexcan1_switch(int enable) {}
- static const struct flexcan_platform_data
- mx6q_sabrelite_flexcan0_pdata __initconst = {
- .transceiver_switch = mx6q_sabrelite_flexcan0_switch,
- };
- static const struct flexcan_platform_data
- mx6q_sabrelite_flexcan1_pdata __initconst = {
- .transceiver_switch = mx6q_sabrelite_flexcan1_switch,
- };
- static struct viv_gpu_platform_data imx6q_gpu_pdata __initdata = {
- .reserved_mem_size = SZ_128M,
- };
- static struct imx_asrc_platform_data imx_asrc_data = {
- .channel_bits = 4,
- .clk_map_ver = 2,
- };
- static struct ipuv3_fb_platform_data sabrelite_fb_data[] = {
- { /*fb0*/
- .disp_dev = "ldb",
- .interface_pix_fmt = IPU_PIX_FMT_RGB24,
- .mode_str = "SK-ATM0704",
- .default_bpp = 16,
- .int_clk = false,
- }, {
- .disp_dev = "lcd",
- .interface_pix_fmt = IPU_PIX_FMT_RGB24,
- .mode_str = "SK-MI0430",
- .default_bpp = 16,
- .int_clk = false,
- }, {
- .disp_dev = "ldb",
- .interface_pix_fmt = IPU_PIX_FMT_RGB24,
- .mode_str = "LDB-XGA",
- .default_bpp = 16,
- .int_clk = false,
- }, {
- .disp_dev = "ldb",
- .interface_pix_fmt = IPU_PIX_FMT_RGB24,
- .mode_str = "SK-ATM0704",
- .default_bpp = 16,
- .int_clk = false,
- },
- };
- static void hdmi_init(int ipu_id, int disp_id)
- {
- int hdmi_mux_setting;
- if ((ipu_id > 1) || (ipu_id < 0)) {
- pr_err("Invalid IPU select for HDMI: %d. Set to 0\n", ipu_id);
- ipu_id = 0;
- }
- if ((disp_id > 1) || (disp_id < 0)) {
- pr_err("Invalid DI select for HDMI: %d. Set to 0\n", disp_id);
- disp_id = 0;
- }
- /* Configure the connection between IPU1/2 and HDMI */
- hdmi_mux_setting = 2*ipu_id + disp_id;
- /* GPR3, bits 2-3 = HDMI_MUX_CTL */
- mxc_iomux_set_gpr_register(3, 2, 2, hdmi_mux_setting);
- /* Set HDMI event as SDMA event2 while Chip version later than TO1.2 */
- if ((mx6q_revision() > IMX_CHIP_REVISION_1_1))
- mxc_iomux_set_gpr_register(0, 0, 1, 1);
- }
- static void hdmi_enable_ddc_pin(void)
- {
- if (cpu_is_mx6q())
- mxc_iomux_v3_setup_multiple_pads(mx6q_sabrelite_hdmi_ddc_pads,
- ARRAY_SIZE(mx6q_sabrelite_hdmi_ddc_pads));
- // else
- // mxc_iomux_v3_setup_multiple_pads(mx6dl_sabrelite_hdmi_ddc_pads,
- // ARRAY_SIZE(mx6q_sabrelite_hdmi_ddc_pads));
- }
- static void hdmi_disable_ddc_pin(void)
- {
- if (cpu_is_mx6q())
- mxc_iomux_v3_setup_multiple_pads(mx6q_sabrelite_i2c2_pads,
- ARRAY_SIZE(mx6q_sabrelite_i2c2_pads));
- // else
- // mxc_iomux_v3_setup_multiple_pads(mx6dl_sabrelite_i2c2_pads,
- // ARRAY_SIZE(mx6q_sabrelite_i2c2_pads));
- }
- static struct fsl_mxc_hdmi_platform_data hdmi_data = {
- .init = hdmi_init,
- .enable_pins = hdmi_enable_ddc_pin,
- .disable_pins = hdmi_disable_ddc_pin,
- };
- static struct fsl_mxc_hdmi_core_platform_data hdmi_core_data = {
- .ipu_id = 0,
- .disp_id = 1,
- };
- static struct fsl_mxc_lcd_platform_data lcdif_data = {
- .ipu_id = 0,
- .disp_id = 0,
- .default_ifmt = IPU_PIX_FMT_RGB565,
- };
- static struct fsl_mxc_ldb_platform_data ldb_data = {
- .ipu_id = 1,
- .disp_id = 0,
- .ext_ref = 1,
- .mode = LDB_SEP0,
- .sec_ipu_id = 1,
- .sec_disp_id = 1,
- };
- static struct imx_ipuv3_platform_data ipu_data[] = {
- {
- .rev = 4,
- .csi_clk[0] = "clko_clk",
- }, {
- .rev = 4,
- .csi_clk[0] = "clko_clk",
- },
- };
- static struct fsl_mxc_capture_platform_data capture_data[] = {
- {
- .csi = 0,
- .ipu = 0,
- .mclk_source = 0,
- .is_mipi = 0,
- }, {
- .csi = 1,
- .ipu = 0,
- .mclk_source = 0,
- .is_mipi = 0,
- },
- };
- static struct mipi_csi2_platform_data mipi_csi2_pdata = {
- .ipu_id = 0,
- .csi_id = 1,
- .v_channel = 0,
- .lanes = 2,
- .dphy_clk = "mipi_pllref_clk",
- .pixel_clk = "emi_clk",
- };
- struct imx_vout_mem {
- resource_size_t res_mbase;
- resource_size_t res_msize;
- };
- static struct imx_vout_mem vout_mem __initdata = {
- .res_msize = SZ_128M,
- };
- static void sabrelite_suspend_enter(void)
- {
- /* suspend preparation */
- }
- static void sabrelite_suspend_exit(void)
- {
- /* resume restore */
- }
- static const struct pm_platform_data mx6q_sabrelite_pm_data __initconst = {
- .name = "imx_pm",
- .suspend_enter = sabrelite_suspend_enter,
- .suspend_exit = sabrelite_suspend_exit,
- };
- static struct regulator_consumer_supply sabrelite_vmmc_consumers[] = {
- REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.0"),
- REGULATOR_SUPPLY("vmmc", "sdhci-esdhc-imx.1"),
- };
- static struct regulator_init_data sabrelite_vmmc_init = {
- .num_consumer_supplies = ARRAY_SIZE(sabrelite_vmmc_consumers),
- .consumer_supplies = sabrelite_vmmc_consumers,
- };
- static struct fixed_voltage_config sabrelite_vmmc_reg_config = {
- .supply_name = "vmmc",
- .microvolts = 3300000,
- .gpio = -1,
- .init_data = &sabrelite_vmmc_init,
- };
- static struct platform_device sabrelite_vmmc_reg_devices = {
- .name = "reg-fixed-voltage",
- .id = 3,
- .dev = {
- .platform_data = &sabrelite_vmmc_reg_config,
- },
- };
- static int imx6q_init_audio(void)
- {
- mxc_register_device(&mx6_sabrelite_audio_device,
- &mx6_sabrelite_audio_data);
- imx6q_add_imx_ssi(1, &mx6_sabrelite_ssi_pdata);
- return 0;
- }
- static struct platform_pwm_backlight_data mx6_sabrelite_pwm_backlight_data = {
- .pwm_id = 3,
- .max_brightness = 255,
- .dft_brightness = 128,
- .pwm_period_ns = 50000,
- };
- static struct mxc_dvfs_platform_data sabrelite_dvfscore_data = {
- .reg_id = "cpu_vddgp",
- .soc_id = "cpu_vddsoc",
- .pu_id = "cpu_vddvpu",
- .clk1_id = "cpu_clk",
- .clk2_id = "gpc_dvfs_clk",
- .gpc_cntr_offset = MXC_GPC_CNTR_OFFSET,
- .ccm_cdcr_offset = MXC_CCM_CDCR_OFFSET,
- .ccm_cacrr_offset = MXC_CCM_CACRR_OFFSET,
- .ccm_cdhipr_offset = MXC_CCM_CDHIPR_OFFSET,
- .prediv_mask = 0x1F800,
- .prediv_offset = 11,
- .prediv_val = 3,
- .div3ck_mask = 0xE0000000,
- .div3ck_offset = 29,
- .div3ck_val = 2,
- .emac_val = 0x08,
- .upthr_val = 25,
- .dnthr_val = 9,
- .pncthr_val = 33,
- .upcnt_val = 10,
- .dncnt_val = 10,
- .delay_time = 80,
- };
- static void __init fixup_mxc_board(struct machine_desc *desc, struct tag *tags,
- char **cmdline, struct meminfo *mi)
- {
- }
- static int __init caam_setup(char *__unused)
- {
- caam_enabled = 1;
- return 1;
- }
- early_param("caam", caam_setup);
- static const struct imx_pcie_platform_data mx6_sabrelite_pcie_data __initconst = {
- .pcie_pwr_en = -EINVAL,
- .pcie_rst = -EINVAL,
- .pcie_wake_up = -EINVAL,
- .pcie_dis = -EINVAL,
- };
- /*!
- * Board specific initialization.
- */
- static void __init mx6_sabrelite_board_init(void)
- {
- int i;
- struct platform_device *voutdev;
- if (cpu_is_mx6q())
- mxc_iomux_v3_setup_multiple_pads(mx6q_sabrelite_pads,
- ARRAY_SIZE(mx6q_sabrelite_pads));
- else
- mxc_iomux_v3_setup_multiple_pads(mx6dl_sabrelite_pads,
- ARRAY_SIZE(mx6dl_sabrelite_pads));
- if (enet_to_gpio_6) {
- iomux_v3_cfg_t enet_gpio_pad =
- MX6Q_PAD_GPIO_6__ENET_IRQ_TO_GPIO_6;
- mxc_iomux_v3_setup_pad(enet_gpio_pad);
- }
- #ifdef CONFIG_FEC_1588
- if (cpu_is_mx6q()) {
- /* Set GPIO_16 input for IEEE-1588 ts_clk and RMII reference clock
- * For MX6 GPR1 bit21 meaning:
- * Bit21: 0 - GPIO_16 pad output
- * 1 - GPIO_16 pad input
- */
- mxc_iomux_set_gpr_register(1, 21, 1, 1);
- }
- #endif
- gp_reg_id = sabrelite_dvfscore_data.reg_id;
- soc_reg_id = sabrelite_dvfscore_data.soc_id;
- pu_reg_id = sabrelite_dvfscore_data.pu_id;
- mx6q_sabrelite_init_uart();
- /*
- * MX6DL/Solo only supports single IPU
- * The following codes are used to change ipu id
- * and display id information for MX6DL/Solo. Then
- * register 1 IPU device and up to 2 displays for
- * MX6DL/Solo
- */
- if (cpu_is_mx6dl()) {
- ldb_data.ipu_id = 0;
- ldb_data.sec_ipu_id = 0;
- }
- imx6q_add_mxc_hdmi_core(&hdmi_core_data);
- imx6q_add_ipuv3(0, &ipu_data[0]);
- if (cpu_is_mx6q()) {
- imx6q_add_ipuv3(1, &ipu_data[1]);
- for (i = 0; i < ARRAY_SIZE(sabrelite_fb_data); i++)
- imx6q_add_ipuv3fb(i, &sabrelite_fb_data[i]);
- } else
- for (i = 0; i < 2 && i < ARRAY_SIZE(sabrelite_fb_data); i++)
- imx6q_add_ipuv3fb(i, &sabrelite_fb_data[i]);
- imx6q_add_vdoa();
- imx6q_add_lcdif(&lcdif_data);
- imx6q_add_ldb(&ldb_data);
- voutdev = imx6q_add_v4l2_output(0);
- if (vout_mem.res_msize && voutdev) {
- dma_declare_coherent_memory(&voutdev->dev,
- vout_mem.res_mbase,
- vout_mem.res_mbase,
- vout_mem.res_msize,
- (DMA_MEMORY_MAP |
- DMA_MEMORY_EXCLUSIVE));
- }
- imx6q_add_v4l2_capture(0, &capture_data[0]);
- imx6q_add_v4l2_capture(1, &capture_data[1]);
- // imx6q_add_mipi_csi2(&mipi_csi2_pdata);
- imx6q_add_imx_snvs_rtc();
- if (1 == caam_enabled)
- imx6q_add_imx_caam();
- imx6q_add_imx_i2c(0, &mx6q_sabrelite_i2c_data);
- imx6q_add_imx_i2c(1, &mx6q_sabrelite_i2c_data);
- imx6q_add_imx_i2c(2, &mx6q_sabrelite_i2c_data);
- if (cpu_is_mx6q()) {
- i2c_register_board_info(0, mx6q_sk_i2c0_board_info,
- ARRAY_SIZE(mx6q_sk_i2c0_board_info));
- i2c_register_board_info(1, mx6q_sk_i2c1_board_info,
- ARRAY_SIZE(mx6q_sk_i2c1_board_info));
- } else {
- i2c_register_board_info(1, mx6dl_sk_i2c1_board_info,
- ARRAY_SIZE(mx6dl_sk_i2c1_board_info));
- }
- /* SPI */
- if (cpu_is_mx6dl()) {
- mx6q_sabrelite_spi4_cs[0] = MX6DL_SK_ECSPI4_CS0;
- }
- imx6q_add_ecspi(0, &mx6q_sabrelite_spi1_data);
- imx6q_add_ecspi(3, &mx6q_sabrelite_spi4_data);
- spi_device_init();
- imx6q_add_mxc_hdmi(&hdmi_data);
- imx6q_add_anatop_thermal_imx(1, &mx6q_sabrelite_anatop_thermal_data);
- if (enet_to_gpio_6)
- /* Make sure the IOMUX_OBSRV_MUX1 is set to ENET_IRQ. */
- mxc_iomux_set_specialbits_register(
- IOMUX_OBSRV_MUX1_OFFSET,
- OBSRV_MUX1_ENET_IRQ,
- OBSRV_MUX1_MASK);
- else
- fec_data.gpio_irq = -1;
- if (cpu_is_mx6dl())
- fec_data.phy = PHY_INTERFACE_MODE_RMII;
- imx6_init_fec(fec_data);
- imx6q_add_pm_imx(0, &mx6q_sabrelite_pm_data);
- imx6q_add_sdhci_usdhc_imx(0, &mx6q_sabrelite_sd1_data);
- imx6q_add_sdhci_usdhc_imx(1, &mx6q_sabrelite_sd2_data);
- imx_add_viv_gpu(&imx6_gpu_data, &imx6q_gpu_pdata);
- imx6q_sabrelite_init_usb();
- if (cpu_is_mx6q()) {
- #ifdef CONFIG_SATA_AHCI_PLATFORM
- imx6q_add_ahci(0, &mx6q_sabrelite_sata_data);
- #else
- mx6q_sabrelite_sata_init(NULL,
- (void __iomem *)ioremap(MX6Q_SATA_BASE_ADDR, SZ_4K));
- #endif
- }
- imx6q_add_vpu();
- imx6q_init_audio();
- platform_device_register(&sabrelite_vmmc_reg_devices);
- imx_asrc_data.asrc_core_clk = clk_get(NULL, "asrc_clk");
- imx_asrc_data.asrc_audio_clk = clk_get(NULL, "asrc_serial_clk");
- imx6q_add_asrc(&imx_asrc_data);
- imx6q_add_mxc_pwm(0);
- imx6q_add_mxc_pwm(1);
- imx6q_add_mxc_pwm(2);
- imx6q_add_mxc_pwm(3);
- imx6q_add_mxc_pwm_backlight(3, &mx6_sabrelite_pwm_backlight_data);
- imx6q_add_otp();
- imx6q_add_viim();
- imx6q_add_imx2_wdt(0, NULL);
- imx6q_add_dma();
- imx6q_add_gpmi(&mx6q_gpmi_nand_platform_data);
- imx6q_add_dvfs_core(&sabrelite_dvfscore_data);
- imx6q_add_hdmi_soc();
- imx6q_add_hdmi_soc_dai();
- imx6q_add_flexcan0(&mx6q_sabrelite_flexcan0_pdata);
- imx6q_add_flexcan1(&mx6q_sabrelite_flexcan1_pdata);
- imx6q_add_busfreq();
- /* Add PCIe RC interface support */
- imx6q_add_pcie(&mx6_sabrelite_pcie_data);
- imx6q_add_perfmon(0);
- imx6q_add_perfmon(1);
- imx6q_add_perfmon(2);
- }
- extern void __iomem *twd_base;
- static void __init mx6_sabrelite_timer_init(void)
- {
- struct clk *uart_clk;
- #ifdef CONFIG_LOCAL_TIMERS
- twd_base = ioremap(LOCAL_TWD_ADDR, SZ_256);
- BUG_ON(!twd_base);
- #endif
- mx6_clocks_init(32768, 24000000, 0, 0);
- uart_clk = clk_get_sys("imx-uart.0", NULL);
- early_console_setup(UART1_BASE_ADDR, uart_clk);
- }
- static struct sys_timer mx6_sabrelite_timer = {
- .init = mx6_sabrelite_timer_init,
- };
- static void __init mx6q_sabrelite_reserve(void)
- {
- phys_addr_t phys;
- #if defined(CONFIG_MXC_GPU_VIV) || defined(CONFIG_MXC_GPU_VIV_MODULE)
- if (imx6q_gpu_pdata.reserved_mem_size) {
- phys = memblock_alloc_base(imx6q_gpu_pdata.reserved_mem_size,
- SZ_4K, SZ_1G);
- memblock_remove(phys, imx6q_gpu_pdata.reserved_mem_size);
- imx6q_gpu_pdata.reserved_mem_base = phys;
- }
- #endif
- if (vout_mem.res_msize) {
- phys = memblock_alloc_base(vout_mem.res_msize,
- SZ_4K, SZ_1G);
- memblock_remove(phys, vout_mem.res_msize);
- vout_mem.res_mbase = phys;
- }
- }
- /*
- * initialize __mach_desc_MX6Q_SABRELITE data structure.
- */
- MACHINE_START(MX6Q_SABRELITE, "Freescale i.MX 6Quad Sabre-Lite Board")
- /* Maintainer: Freescale Semiconductor, Inc. */
- .boot_params = MX6_PHYS_OFFSET + 0x100,
- .fixup = fixup_mxc_board,
- .map_io = mx6_map_io,
- .init_irq = mx6_init_irq,
- .init_machine = mx6_sabrelite_board_init,
- .timer = &mx6_sabrelite_timer,
- .reserve = mx6q_sabrelite_reserve,
- MACHINE_END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement