]> git.sur5r.net Git - u-boot/blob - board/technologic/ts4600/ts4600.c
SPDX: Convert all of our single license tags to Linux Kernel style
[u-boot] / board / technologic / ts4600 / ts4600.c
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 <asm/gpio.h>
18 #include <asm/io.h>
19 #include <asm/arch/imx-regs.h>
20 #include <asm/arch/iomux-mx28.h>
21 #include <asm/arch/clock.h>
22 #include <asm/arch/sys_proto.h>
23 #include <linux/mii.h>
24 #include <miiphy.h>
25 #include <netdev.h>
26 #include <errno.h>
27
28 DECLARE_GLOBAL_DATA_PTR;
29
30 int board_early_init_f(void)
31 {
32         /* IO0 clock at 480MHz */
33         mxs_set_ioclk(MXC_IOCLK0, 480000);
34         /* IO1 clock at 480MHz */
35         mxs_set_ioclk(MXC_IOCLK1, 480000);
36
37         /* SSP0 clocks at 96MHz */
38         mxs_set_sspclk(MXC_SSPCLK0, 96000, 0);
39
40         return 0;
41 }
42
43 int dram_init(void)
44 {
45         return mxs_dram_init();
46 }
47
48 int board_init(void)
49 {
50         /* Adress of boot parameters */
51         gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
52
53         return 0;
54 }
55
56 #ifdef CONFIG_CMD_MMC
57 static int ts4600_mmc_cd(int id)
58 {
59         return 1;
60 }
61
62 int board_mmc_init(bd_t *bis)
63 {
64         int ret;
65
66         mxs_iomux_setup_pad(MX28_PAD_PWM3__GPIO_3_28);
67
68         /* Power-on SD */
69         gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 1);
70         udelay(1000);
71         gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0);
72
73         /* SD card */
74         ret = mxsmmc_initialize(bis, 0, NULL, ts4600_mmc_cd);
75         if(ret != 0) {
76                 printf("SD controller initialized with %d\n", ret);
77         }
78
79         return ret;
80 }
81 #endif
82
83 int checkboard(void)
84 {
85         puts("Board: TS4600\n");
86
87         return 0;
88 }