diff options
author | Dmitry Lifshitz | 2016-12-28 18:28:33 +0200 |
---|---|---|
committer | Tom Rini | 2017-01-02 11:14:06 -0500 |
commit | 46650d583b8067c8aecf2ddea585e8a97f937d0c (patch) | |
tree | 50b31d30927a7692eb92ee7924e22da80c7ab53f /board/compulab/cl-som-am57x | |
parent | 6d799d04a843b85b0842b7c266a16b3c515b8c35 (diff) |
arm: am57xx: cl-som-am57x: add initial board support
Features supported :
* Serial console
* SPI Flash
* MMC/SD Card
* eMMC storage
* SATA
* PCA9555 - GPIO expander over I2C5 bus
* USB
Use spl alternate boot device feature to define fallback to
the main boot device as it is defined by hardware.
Signed-off-by: Dmitry Lifshitz <lifshitz@compulab.co.il>
[uri.mashiach@compulab.co.il: Adjust to v2016.11]
Signed-off-by: Uri Mashiach <uri.mashiach@compulab.co.il>
Acked-by: Igor Grinberg <grinberg@compulab.co.il>
Diffstat (limited to 'board/compulab/cl-som-am57x')
-rw-r--r-- | board/compulab/cl-som-am57x/Kconfig | 12 | ||||
-rw-r--r-- | board/compulab/cl-som-am57x/MAINTAINERS | 6 | ||||
-rw-r--r-- | board/compulab/cl-som-am57x/Makefile | 15 | ||||
-rw-r--r-- | board/compulab/cl-som-am57x/cl-som-am57x.c | 62 | ||||
-rw-r--r-- | board/compulab/cl-som-am57x/mux.c | 100 | ||||
-rw-r--r-- | board/compulab/cl-som-am57x/spl.c | 234 |
6 files changed, 429 insertions, 0 deletions
diff --git a/board/compulab/cl-som-am57x/Kconfig b/board/compulab/cl-som-am57x/Kconfig new file mode 100644 index 00000000000..85fc9a1fdbd --- /dev/null +++ b/board/compulab/cl-som-am57x/Kconfig @@ -0,0 +1,12 @@ +if TARGET_CL_SOM_AM57X + +config SYS_BOARD + default "cl-som-am57x" + +config SYS_VENDOR + default "compulab" + +config SYS_CONFIG_NAME + default "cl-som-am57x" + +endif diff --git a/board/compulab/cl-som-am57x/MAINTAINERS b/board/compulab/cl-som-am57x/MAINTAINERS new file mode 100644 index 00000000000..e0195f46106 --- /dev/null +++ b/board/compulab/cl-som-am57x/MAINTAINERS @@ -0,0 +1,6 @@ +CL-SOM-AM57x BOARD +M: Uri Mashiach <uri.mashiach@compulab.co.il> +S: Maintained +F: board/compulab/cl-som-am57x/ +F: include/configs/cl-som-am57x.h +F: configs/cl-som-am57x_defconfig diff --git a/board/compulab/cl-som-am57x/Makefile b/board/compulab/cl-som-am57x/Makefile new file mode 100644 index 00000000000..0c59781a8b8 --- /dev/null +++ b/board/compulab/cl-som-am57x/Makefile @@ -0,0 +1,15 @@ +# +# Makefile +# +# (C) Copyright 2016 CompuLab, Ltd. <www.compulab.co.il> +# +# Author: Dmitry Lifshitz <lifshitz@compulab.co.il> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +ifdef CONFIG_SPL_BUILD +obj-y += spl.o mux.o +else +obj-y += cl-som-am57x.o mux.o +endif diff --git a/board/compulab/cl-som-am57x/cl-som-am57x.c b/board/compulab/cl-som-am57x/cl-som-am57x.c new file mode 100644 index 00000000000..4bad6440f3f --- /dev/null +++ b/board/compulab/cl-som-am57x/cl-som-am57x.c @@ -0,0 +1,62 @@ +/* + * Board functions for CompuLab cl_som_am57x board + * + * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/ + * + * Author: Dmitry Lifshitz <lifshitz@compulab.co.il> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <palmas.h> +#include <usb.h> +#include <asm/gpio.h> +#include <asm/arch/mmc_host_def.h> +#include <asm/arch/sys_proto.h> + +DECLARE_GLOBAL_DATA_PTR; + +const struct omap_sysinfo sysinfo = { + "Board: CL-SOM-AM57x\n" +}; + +int board_init(void) +{ + /* Disable PMIC Powerhold feature, DEV_CTRL.DEV_ON = 1 */ + palmas_i2c_write_u8(TPS65903X_CHIP_P1, 0xA0, 0x1); + + gd->bd->bi_boot_params = CONFIG_SYS_SDRAM_BASE + 0x100; + + return 0; +} + +#ifdef CONFIG_GENERIC_MMC +#define SB_SOM_CD_GPIO 187 +#define SB_SOM_WP_GPIO 188 + +int board_mmc_init(bd_t *bis) +{ + int ret0, ret1; + + ret0 = omap_mmc_init(0, 0, 0, SB_SOM_CD_GPIO, SB_SOM_WP_GPIO); + if (ret0) + printf("cl-som-am57x: failed to initialize mmc0\n"); + + ret1 = omap_mmc_init(1, 0, 0, -1, -1); + if (ret1) + printf("cl-som-am57x: failed to initialize mmc1\n"); + + return ret0 && ret1; +} +#endif /* CONFIG_GENERIC_MMC */ + +#ifdef CONFIG_USB_XHCI_OMAP +int board_usb_init(int index, enum usb_init_type init) +{ + setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl, + OTG_SS_CLKCTRL_MODULEMODE_HW | OPTFCLKEN_REFCLK960M); + + return 0; +} +#endif /* CONFIG_USB_XHCI_OMAP */ diff --git a/board/compulab/cl-som-am57x/mux.c b/board/compulab/cl-som-am57x/mux.c new file mode 100644 index 00000000000..625cbc1dbdb --- /dev/null +++ b/board/compulab/cl-som-am57x/mux.c @@ -0,0 +1,100 @@ +/* + * Pinmux configuration for CompuLab CL-SOM-AM57x board + * + * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/ + * + * Author: Dmitry Lifshitz <lifshitz@compulab.co.il> + * + * SPDX-License-Identifier: GPL-2.0+ + */ +#include <asm/arch/sys_proto.h> +#include <asm/arch/mux_dra7xx.h> + +/* Serial console */ +static const struct pad_conf_entry cl_som_am57x_padconf_console[] = { + {UART3_RXD, (FSC | IEN | PDIS | PTU | M0)}, /* UART3_RXD */ + {UART3_TXD, (FSC | IEN | PDIS | PTU | M0)}, /* UART3_TXD */ +}; + +/* PMIC I2C */ +static const struct pad_conf_entry cl_som_am57x_padconf_pmic[] = { + {MCASP1_ACLKR, (IEN | PEN | M10)}, /* MCASP1_ACLKR.I2C4_SDA */ + {MCASP1_FSR, (IEN | PEN | M10)}, /* MCASP1_FSR.I2C4_SCL */ +}; + +/* Green GPIO led */ +static const struct pad_conf_entry cl_som_am57x_padconf_green_led[] = { + {GPMC_A15, (IDIS | PDIS | PTD | M14)}, /* GPMC_A15.GPIO2_5 */ +}; + +/* MMC/SD Card */ +static const struct pad_conf_entry cl_som_am57x_padconf_sd_card[] = { + {MMC1_CLK, (IEN | PDIS | PTU | M0) }, /* MMC1_CLK */ + {MMC1_CMD, (IEN | PDIS | PTU | M0) }, /* MMC1_CMD */ + {MMC1_DAT0, (IEN | PDIS | PTU | M0) }, /* MMC1_DAT0 */ + {MMC1_DAT1, (IEN | PDIS | PTU | M0) }, /* MMC1_DAT1 */ + {MMC1_DAT2, (IEN | PDIS | PTU | M0) }, /* MMC1_DAT2 */ + {MMC1_DAT3, (IEN | PDIS | PTU | M0) }, /* MMC1_DAT3 */ + {MMC1_SDCD, (IEN | PEN | M14)}, /* MMC1_SDCD */ + {MMC1_SDWP, (IEN | PEN | M14)}, /* MMC1_SDWP */ +}; + +/* WiFi - must be in the safe mode on boot */ +static const struct pad_conf_entry cl_som_am57x_padconf_wifi[] = { + {UART1_CTSN, (IEN | M15)}, /* UART1_CTSN */ + {UART1_RTSN, (IEN | M15)}, /* UART1_RTSN */ + {UART2_RXD, (IEN | M15)}, /* UART2_RXD */ + {UART2_TXD, (IEN | M15)}, /* UART2_TXD */ + {UART2_CTSN, (IEN | M15)}, /* UART2_CTSN */ + {UART2_RTSN, (IEN | M15)}, /* UART2_RTSN */ +}; + +/* QSPI */ +static const struct pad_conf_entry cl_som_am57x_padconf_qspi[] = { + {GPMC_A13, (IEN | PEN | M1)}, /* GPMC_A13.QSPI1_RTCLK */ + {GPMC_A18, (IEN | PEN | M1)}, /* GPMC_A18.QSPI1_SCLK */ + {GPMC_A16, (IEN | PEN | M1)}, /* GPMC_A16.QSPI1_D0 */ + {GPMC_A17, (IEN | PEN | M1)}, /* GPMC_A17.QSPI1_D1 */ + {GPMC_CS2, (IEN | PDIS | PTU | M1)}, /* GPMC_CS2.QSPI1_CS0 */ +}; + +/* GPIO Expander I2C */ +static const struct pad_conf_entry cl_som_am57x_padconf_i2c_gpio[] = { + {MCASP1_AXR0, (IEN | PEN | M10)}, /* MCASP1_AXR0.I2C5_SDA */ + {MCASP1_AXR1, (IEN | PEN | M10)}, /* MCASP1_AXR1.I2C5_SCL */ +}; + +/* eMMC internal storage */ +static const struct pad_conf_entry cl_som_am57x_padconf_emmc[] = { + {GPMC_A19, (IEN | PDIS | PTU | M1)}, /* GPMC_A19.MMC2_DAT4 */ + {GPMC_A20, (IEN | PDIS | PTU | M1)}, /* GPMC_A20.MMC2_DAT5 */ + {GPMC_A21, (IEN | PDIS | PTU | M1)}, /* GPMC_A21.MMC2_DAT6 */ + {GPMC_A22, (IEN | PDIS | PTU | M1)}, /* GPMC_A22.MMC2_DAT7 */ + {GPMC_A23, (IEN | PDIS | PTU | M1)}, /* GPMC_A23.MMC2_CLK */ + {GPMC_A24, (IEN | PDIS | PTU | M1)}, /* GPMC_A24.MMC2_DAT0 */ + {GPMC_A25, (IEN | PDIS | PTU | M1)}, /* GPMC_A25.MMC2_DAT1 */ + {GPMC_A26, (IEN | PDIS | PTU | M1)}, /* GPMC_A26.MMC2_DAT2 */ + {GPMC_A27, (IEN | PDIS | PTU | M1)}, /* GPMC_A27.MMC2_DAT3 */ + {GPMC_CS1, (IEN | PDIS | PTU | M1)}, /* GPMC_CS1.MMC2_CMD */ +}; + +/* usb1_drvvbus */ +static const struct pad_conf_entry cl_som_am57x_padconf_usb[] = { + {USB1_DRVVBUS, (M0 | FSC) }, /* USB1_DRVVBUS.USB1_DRVVBUS */ +}; + +#define SET_MUX(mux_array) do_set_mux32((*ctrl)->control_padconf_core_base, \ + mux_array, ARRAY_SIZE(mux_array)) + +void set_muxconf_regs(void) +{ + SET_MUX(cl_som_am57x_padconf_console); + SET_MUX(cl_som_am57x_padconf_pmic); + SET_MUX(cl_som_am57x_padconf_green_led); + SET_MUX(cl_som_am57x_padconf_sd_card); + SET_MUX(cl_som_am57x_padconf_wifi); + SET_MUX(cl_som_am57x_padconf_qspi); + SET_MUX(cl_som_am57x_padconf_i2c_gpio); + SET_MUX(cl_som_am57x_padconf_emmc); + SET_MUX(cl_som_am57x_padconf_usb); +} diff --git a/board/compulab/cl-som-am57x/spl.c b/board/compulab/cl-som-am57x/spl.c new file mode 100644 index 00000000000..855678fd5f4 --- /dev/null +++ b/board/compulab/cl-som-am57x/spl.c @@ -0,0 +1,234 @@ +/* + * SPL data and initialization for CompuLab CL-SOM-AM57x board + * + * (C) Copyright 2016 CompuLab, Ltd. http://compulab.co.il/ + * + * Author: Uri Mashiach <uri.mashiach@compulab.co.il> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <asm/emif.h> +#include <asm/omap_common.h> +#include <asm/arch/sys_proto.h> + +static const struct dmm_lisa_map_regs cl_som_am57x_lisa_regs = { + .dmm_lisa_map_3 = 0x80740300, + .is_ma_present = 0x1 +}; + +void emif_get_dmm_regs(const struct dmm_lisa_map_regs **dmm_lisa_regs) +{ + *dmm_lisa_regs = &cl_som_am57x_lisa_regs; +} + +static const struct emif_regs cl_som_am57x_emif1_ddr3_532mhz_emif_regs = { + .sdram_config_init = 0x61852332, + .sdram_config = 0x61852332, + .sdram_config2 = 0x00000000, + .ref_ctrl = 0x000040f1, + .ref_ctrl_final = 0x00001040, + .sdram_tim1 = 0xeeef36f3, + .sdram_tim2 = 0x348f7fda, + .sdram_tim3 = 0x027f88a8, + .read_idle_ctrl = 0x00050000, + .zq_config = 0x1007190b, + .temp_alert_config = 0x00000000, + .emif_ddr_phy_ctlr_1_init = 0x0034400b, + .emif_ddr_phy_ctlr_1 = 0x0e34400b, + .emif_ddr_ext_phy_ctrl_1 = 0x04040100, + .emif_ddr_ext_phy_ctrl_2 = 0x00740074, + .emif_ddr_ext_phy_ctrl_3 = 0x00780078, + .emif_ddr_ext_phy_ctrl_4 = 0x007c007c, + .emif_ddr_ext_phy_ctrl_5 = 0x007b007b, + .emif_rd_wr_lvl_rmp_win = 0x00000000, + .emif_rd_wr_lvl_rmp_ctl = 0x80000000, + .emif_rd_wr_lvl_ctl = 0x00000000, + .emif_rd_wr_exec_thresh = 0x00000305 +}; + +/* Ext phy ctrl regs 1-35 */ +static const u32 cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs[] = { + 0x10040100, + 0x00740074, + 0x00780078, + 0x007c007c, + 0x007b007b, + 0x00800080, + 0x00360036, + 0x00340034, + 0x00360036, + 0x00350035, + 0x00350035, + + 0x01ff01ff, + 0x01ff01ff, + 0x01ff01ff, + 0x01ff01ff, + 0x01ff01ff, + + 0x00430043, + 0x003e003e, + 0x004a004a, + 0x00470047, + 0x00400040, + + 0x00000000, + 0x00600020, + 0x40011080, + 0x08102040, + + 0x00400040, + 0x00400040, + 0x00400040, + 0x00400040, + 0x00400040, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0 +}; + +static const struct emif_regs cl_som_am57x_emif2_ddr3_532mhz_emif_regs = { + .sdram_config_init = 0x61852332, + .sdram_config = 0x61852332, + .sdram_config2 = 0x00000000, + .ref_ctrl = 0x000040f1, + .ref_ctrl_final = 0x00001040, + .sdram_tim1 = 0xeeef36f3, + .sdram_tim2 = 0x348f7fda, + .sdram_tim3 = 0x027f88a8, + .read_idle_ctrl = 0x00050000, + .zq_config = 0x1007190b, + .temp_alert_config = 0x00000000, + .emif_ddr_phy_ctlr_1_init = 0x0034400b, + .emif_ddr_phy_ctlr_1 = 0x0e34400b, + .emif_ddr_ext_phy_ctrl_1 = 0x04040100, + .emif_ddr_ext_phy_ctrl_2 = 0x00740074, + .emif_ddr_ext_phy_ctrl_3 = 0x00780078, + .emif_ddr_ext_phy_ctrl_4 = 0x007c007c, + .emif_ddr_ext_phy_ctrl_5 = 0x007b007b, + .emif_rd_wr_lvl_rmp_win = 0x00000000, + .emif_rd_wr_lvl_rmp_ctl = 0x80000000, + .emif_rd_wr_lvl_ctl = 0x00000000, + .emif_rd_wr_exec_thresh = 0x00000305 +}; + +static const u32 cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs[] = { + 0x10040100, + 0x00820082, + 0x008b008b, + 0x00800080, + 0x007e007e, + 0x00800080, + 0x00370037, + 0x00390039, + 0x00360036, + 0x00370037, + 0x00350035, + 0x01ff01ff, + 0x01ff01ff, + 0x01ff01ff, + 0x01ff01ff, + 0x01ff01ff, + 0x00540054, + 0x00540054, + 0x004e004e, + 0x004c004c, + 0x00400040, + + 0x00000000, + 0x00600020, + 0x40011080, + 0x08102040, + + 0x00400040, + 0x00400040, + 0x00400040, + 0x00400040, + 0x00400040, + 0x0, + 0x0, + 0x0, + 0x0, + 0x0 +}; + +static struct vcores_data cl_som_am57x_volts = { + .mpu.value[OPP_NOM] = VDD_MPU_DRA7_NOM, + .mpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_MPU_NOM, + .mpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, + .mpu.addr = TPS659038_REG_ADDR_SMPS12, + .mpu.pmic = &tps659038, + + .eve.value[OPP_NOM] = VDD_EVE_DRA7_NOM, + .eve.value[OPP_OD] = VDD_EVE_DRA7_OD, + .eve.value[OPP_HIGH] = VDD_EVE_DRA7_HIGH, + .eve.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_DSPEVE_NOM, + .eve.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_DSPEVE_OD, + .eve.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_DSPEVE_HIGH, + .eve.efuse.reg_bits = DRA752_EFUSE_REGBITS, + .eve.addr = TPS659038_REG_ADDR_SMPS45, + .eve.pmic = &tps659038, + + .gpu.value[OPP_NOM] = VDD_GPU_DRA7_NOM, + .gpu.value[OPP_OD] = VDD_GPU_DRA7_OD, + .gpu.value[OPP_HIGH] = VDD_GPU_DRA7_HIGH, + .gpu.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_GPU_NOM, + .gpu.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_GPU_OD, + .gpu.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_GPU_HIGH, + .gpu.efuse.reg_bits = DRA752_EFUSE_REGBITS, + .gpu.addr = TPS659038_REG_ADDR_SMPS6, + .gpu.pmic = &tps659038, + + .core.value[OPP_NOM] = VDD_CORE_DRA7_NOM, + .core.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_CORE_NOM, + .core.efuse.reg_bits = DRA752_EFUSE_REGBITS, + .core.addr = TPS659038_REG_ADDR_SMPS7, + .core.pmic = &tps659038, + + .iva.value[OPP_NOM] = VDD_IVA_DRA7_NOM, + .iva.value[OPP_OD] = VDD_IVA_DRA7_OD, + .iva.value[OPP_HIGH] = VDD_IVA_DRA7_HIGH, + .iva.efuse.reg[OPP_NOM] = STD_FUSE_OPP_VMIN_IVA_NOM, + .iva.efuse.reg[OPP_OD] = STD_FUSE_OPP_VMIN_IVA_OD, + .iva.efuse.reg[OPP_HIGH] = STD_FUSE_OPP_VMIN_IVA_HIGH, + .iva.efuse.reg_bits = DRA752_EFUSE_REGBITS, + .iva.addr = TPS659038_REG_ADDR_SMPS8, + .iva.pmic = &tps659038, +}; + +void hw_data_init(void) +{ + *prcm = &dra7xx_prcm; + *dplls_data = &dra7xx_dplls; + *omap_vcores = &cl_som_am57x_volts; + *ctrl = &dra7xx_ctrl; +} + +void emif_get_reg_dump(u32 emif_nr, const struct emif_regs **regs) +{ + switch (emif_nr) { + case 1: + *regs = &cl_som_am57x_emif1_ddr3_532mhz_emif_regs; + break; + case 2: + *regs = &cl_som_am57x_emif2_ddr3_532mhz_emif_regs; + break; + } +} + +void emif_get_ext_phy_ctrl_const_regs(u32 emif_nr, const u32 **regs, u32 *size) +{ + switch (emif_nr) { + case 1: + *regs = cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs; + *size = ARRAY_SIZE(cl_som_am57x_emif1_ddr3_ext_phy_ctrl_regs); + break; + case 2: + *regs = cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs; + *size = ARRAY_SIZE(cl_som_am57x_emif2_ddr3_ext_phy_ctrl_regs); + break; + } +} |