1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3 * (C) Copyright 2016 Savoir-faire Linux Inc.
4 *
5 * Author: Sebastien Bourdelin <sebastien.bourdelin@savoirfairelinux.com>
6 *
7 * Based on work from TS7680 code by:
8 * Kris Bahnsen <kris@embeddedarm.com>
9 * Mark Featherston <mark@embeddedarm.com>
10 * https://github.com/embeddedarm/u-boot/tree/master/board/technologic/ts7680
11 *
12 * Derived from MX28EVK code by
13 * Freescale Semiconductor, Inc.
14 */
15
16 #include <common.h>
17 #include <init.h>
18 #include <asm/global_data.h>
19 #include <asm/gpio.h>
20 #include <asm/io.h>
21 #include <asm/arch/imx-regs.h>
22 #include <asm/arch/iomux-mx28.h>
23 #include <asm/arch/clock.h>
24 #include <asm/arch/sys_proto.h>
25 #include <linux/delay.h>
26 #include <linux/mii.h>
27 #include <miiphy.h>
28 #include <netdev.h>
29 #include <errno.h>
30
31 DECLARE_GLOBAL_DATA_PTR;
32
board_early_init_f(void)33 int board_early_init_f(void)
34 {
35 /* IO0 clock at 480MHz */
36 mxs_set_ioclk(MXC_IOCLK0, 480000);
37 /* IO1 clock at 480MHz */
38 mxs_set_ioclk(MXC_IOCLK1, 480000);
39
40 /* SSP0 clocks at 96MHz */
41 mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
42
43 return 0;
44 }
45
dram_init(void)46 int dram_init(void)
47 {
48 return mxs_dram_init();
49 }
50
board_init(void)51 int board_init(void)
52 {
53 /* Adress of boot parameters */
54 gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
55
56 return 0;
57 }
58
59 #ifdef CONFIG_CMD_MMC
ts4600_mmc_cd(int id)60 static int ts4600_mmc_cd(int id)
61 {
62 return 1;
63 }
64
board_mmc_init(struct bd_info * bis)65 int board_mmc_init(struct bd_info *bis)
66 {
67 int ret;
68
69 mxs_iomux_setup_pad(MX28_PAD_PWM3__GPIO_3_28);
70
71 /* Power-on SD */
72 gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 1);
73 udelay(1000);
74 gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0);
75
76 /* SD card */
77 ret = mxsmmc_initialize(bis, 0, NULL, ts4600_mmc_cd);
78 if(ret != 0) {
79 printf("SD controller initialized with %d\n", ret);
80 }
81
82 return ret;
83 }
84 #endif
85
checkboard(void)86 int checkboard(void)
87 {
88 puts("Board: TS4600\n");
89
90 return 0;
91 }
92