]> git.sur5r.net Git - u-boot/blob - board/amazon/kc1/kc1.c
Amazon Kindle Fire (first generation) codename kc1 support
[u-boot] / board / amazon / kc1 / kc1.c
1 /*
2  * Amazon Kindle Fire (first generation) codename kc1 config
3  *
4  * Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
5  *
6  * SPDX-License-Identifier:     GPL-2.0+
7  */
8
9 #include <config.h>
10 #include <common.h>
11 #include <asm/arch/sys_proto.h>
12 #include <asm/arch/mmc_host_def.h>
13 #include <asm/gpio.h>
14 #include <asm/emif.h>
15 #include <twl6030.h>
16 #include "kc1.h"
17
18 DECLARE_GLOBAL_DATA_PTR;
19
20 const struct omap_sysinfo sysinfo = {
21         .board_string = "kc1"
22 };
23
24 void set_muxconf_regs(void)
25 {
26         do_set_mux((*ctrl)->control_padconf_core_base, core_padconf_array,
27                 sizeof(core_padconf_array) / sizeof(struct pad_conf_entry));
28 }
29
30 struct lpddr2_device_details *emif_get_device_details(u32 emif_nr, u8 cs,
31         struct lpddr2_device_details *lpddr2_dev_details)
32 {
33         if (cs == CS1)
34                 return NULL;
35
36         *lpddr2_dev_details = elpida_2G_S4_details;
37
38         return lpddr2_dev_details;
39 }
40
41 void emif_get_device_timings(u32 emif_nr,
42         const struct lpddr2_device_timings **cs0_device_timings,
43         const struct lpddr2_device_timings **cs1_device_timings)
44 {
45         *cs0_device_timings = &elpida_2G_S4_timings;
46         *cs1_device_timings = NULL;
47 }
48
49 int board_init(void)
50 {
51         /* GPMC init */
52         gpmc_init();
53
54         /* MACH number */
55         gd->bd->bi_arch_number = MACH_TYPE_OMAP_4430SDP;
56
57         /* ATAGs location */
58         gd->bd->bi_boot_params = OMAP44XX_DRAM_ADDR_SPACE_START + 0x100;
59
60         return 0;
61 }
62
63 int misc_init_r(void)
64 {
65         /* Serial number */
66
67         omap_die_id_serial();
68
69         return 0;
70 }
71
72 u32 get_board_rev(void)
73 {
74         u32 value = 0;
75
76         gpio_request(KC1_GPIO_MBID0, "MBID0");
77         gpio_request(KC1_GPIO_MBID1, "MBID1");
78         gpio_request(KC1_GPIO_MBID2, "MBID2");
79         gpio_request(KC1_GPIO_MBID3, "MBID3");
80
81         gpio_direction_input(KC1_GPIO_MBID0);
82         gpio_direction_input(KC1_GPIO_MBID1);
83         gpio_direction_input(KC1_GPIO_MBID2);
84         gpio_direction_input(KC1_GPIO_MBID3);
85
86         value |= (gpio_get_value(KC1_GPIO_MBID0) << 0);
87         value |= (gpio_get_value(KC1_GPIO_MBID1) << 1);
88         value |= (gpio_get_value(KC1_GPIO_MBID2) << 2);
89         value |= (gpio_get_value(KC1_GPIO_MBID3) << 3);
90
91         return value;
92 }
93
94 void get_board_serial(struct tag_serialnr *serialnr)
95 {
96         omap_die_id_get_board_serial(serialnr);
97 }
98
99 #ifndef CONFIG_SPL_BUILD
100 int board_mmc_init(bd_t *bis)
101 {
102         return omap_mmc_init(1, 0, 0, -1, -1);
103 }
104 #endif
105
106 void board_mmc_power_init(void)
107 {
108         twl6030_power_mmc_init(1);
109 }