Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Sebastien Bourdelin | f012f66 | 2016-11-08 12:18:07 -0500 | [diff] [blame] | 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. |
Sebastien Bourdelin | f012f66 | 2016-11-08 12:18:07 -0500 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #include <common.h> |
Simon Glass | 9758973 | 2020-05-10 11:40:02 -0600 | [diff] [blame] | 17 | #include <init.h> |
Sebastien Bourdelin | f012f66 | 2016-11-08 12:18:07 -0500 | [diff] [blame] | 18 | #include <asm/gpio.h> |
| 19 | #include <asm/io.h> |
| 20 | #include <asm/arch/imx-regs.h> |
| 21 | #include <asm/arch/iomux-mx28.h> |
| 22 | #include <asm/arch/clock.h> |
| 23 | #include <asm/arch/sys_proto.h> |
Simon Glass | dbd7954 | 2020-05-10 11:40:11 -0600 | [diff] [blame] | 24 | #include <linux/delay.h> |
Sebastien Bourdelin | f012f66 | 2016-11-08 12:18:07 -0500 | [diff] [blame] | 25 | #include <linux/mii.h> |
| 26 | #include <miiphy.h> |
| 27 | #include <netdev.h> |
| 28 | #include <errno.h> |
| 29 | |
| 30 | DECLARE_GLOBAL_DATA_PTR; |
| 31 | |
| 32 | int board_early_init_f(void) |
| 33 | { |
| 34 | /* IO0 clock at 480MHz */ |
| 35 | mxs_set_ioclk(MXC_IOCLK0, 480000); |
| 36 | /* IO1 clock at 480MHz */ |
| 37 | mxs_set_ioclk(MXC_IOCLK1, 480000); |
| 38 | |
| 39 | /* SSP0 clocks at 96MHz */ |
| 40 | mxs_set_sspclk(MXC_SSPCLK0, 96000, 0); |
| 41 | |
| 42 | return 0; |
| 43 | } |
| 44 | |
| 45 | int dram_init(void) |
| 46 | { |
| 47 | return mxs_dram_init(); |
| 48 | } |
| 49 | |
| 50 | int board_init(void) |
| 51 | { |
| 52 | /* Adress of boot parameters */ |
| 53 | gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100; |
| 54 | |
| 55 | return 0; |
| 56 | } |
| 57 | |
| 58 | #ifdef CONFIG_CMD_MMC |
| 59 | static int ts4600_mmc_cd(int id) |
| 60 | { |
| 61 | return 1; |
| 62 | } |
| 63 | |
Masahiro Yamada | f7ed78b | 2020-06-26 15:13:33 +0900 | [diff] [blame] | 64 | int board_mmc_init(struct bd_info *bis) |
Sebastien Bourdelin | f012f66 | 2016-11-08 12:18:07 -0500 | [diff] [blame] | 65 | { |
| 66 | int ret; |
| 67 | |
| 68 | mxs_iomux_setup_pad(MX28_PAD_PWM3__GPIO_3_28); |
| 69 | |
| 70 | /* Power-on SD */ |
| 71 | gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 1); |
| 72 | udelay(1000); |
| 73 | gpio_direction_output(MX28_PAD_PWM3__GPIO_3_28, 0); |
| 74 | |
| 75 | /* SD card */ |
| 76 | ret = mxsmmc_initialize(bis, 0, NULL, ts4600_mmc_cd); |
| 77 | if(ret != 0) { |
| 78 | printf("SD controller initialized with %d\n", ret); |
| 79 | } |
| 80 | |
| 81 | return ret; |
| 82 | } |
| 83 | #endif |
| 84 | |
| 85 | int checkboard(void) |
| 86 | { |
| 87 | puts("Board: TS4600\n"); |
| 88 | |
| 89 | return 0; |
| 90 | } |