2016-02-27 18:19:00 +00:00
|
|
|
/*
|
|
|
|
* Amazon Kindle Fire (first generation) codename kc1 config
|
|
|
|
*
|
|
|
|
* Copyright (C) 2016 Paul Kocialkowski <contact@paulk.fr>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0+
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <config.h>
|
|
|
|
#include <common.h>
|
2016-02-27 18:19:06 +00:00
|
|
|
#include <linux/ctype.h>
|
|
|
|
#include <linux/usb/musb.h>
|
|
|
|
#include <asm/omap_musb.h>
|
2016-02-27 18:19:00 +00:00
|
|
|
#include <asm/arch/sys_proto.h>
|
|
|
|
#include <asm/arch/mmc_host_def.h>
|
|
|
|
#include <asm/gpio.h>
|
|
|
|
#include <asm/emif.h>
|
|
|
|
#include <twl6030.h>
|
|
|
|
#include "kc1.h"
|
2017-06-01 01:47:48 +00:00
|
|
|
#include <asm/mach-types.h>
|
2016-02-27 18:19:00 +00:00
|
|
|
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
|
|
|
|
const struct omap_sysinfo sysinfo = {
|
|
|
|
.board_string = "kc1"
|
|
|
|
};
|
|
|
|
|
2016-02-27 18:19:06 +00:00
|
|
|
static struct musb_hdrc_config musb_config = {
|
|
|
|
.multipoint = 1,
|
|
|
|
.dyn_fifo = 1,
|
|
|
|
.num_eps = 16,
|
|
|
|
.ram_bits = 12
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct omap_musb_board_data musb_board_data = {
|
|
|
|
.interface_type = MUSB_INTERFACE_UTMI,
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct musb_hdrc_platform_data musb_platform_data = {
|
|
|
|
.mode = MUSB_PERIPHERAL,
|
|
|
|
.config = &musb_config,
|
|
|
|
.power = 100,
|
|
|
|
.platform_ops = &omap2430_ops,
|
|
|
|
.board_data = &musb_board_data,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2016-02-27 18:19:00 +00:00
|
|
|
void set_muxconf_regs(void)
|
|
|
|
{
|
|
|
|
do_set_mux((*ctrl)->control_padconf_core_base, core_padconf_array,
|
|
|
|
sizeof(core_padconf_array) / sizeof(struct pad_conf_entry));
|
|
|
|
}
|
|
|
|
|
|
|
|
struct lpddr2_device_details *emif_get_device_details(u32 emif_nr, u8 cs,
|
|
|
|
struct lpddr2_device_details *lpddr2_dev_details)
|
|
|
|
{
|
|
|
|
if (cs == CS1)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
*lpddr2_dev_details = elpida_2G_S4_details;
|
|
|
|
|
|
|
|
return lpddr2_dev_details;
|
|
|
|
}
|
|
|
|
|
|
|
|
void emif_get_device_timings(u32 emif_nr,
|
|
|
|
const struct lpddr2_device_timings **cs0_device_timings,
|
|
|
|
const struct lpddr2_device_timings **cs1_device_timings)
|
|
|
|
{
|
|
|
|
*cs0_device_timings = &elpida_2G_S4_timings;
|
|
|
|
*cs1_device_timings = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
int board_init(void)
|
|
|
|
{
|
|
|
|
/* GPMC init */
|
|
|
|
gpmc_init();
|
|
|
|
|
|
|
|
/* MACH number */
|
|
|
|
gd->bd->bi_arch_number = MACH_TYPE_OMAP_4430SDP;
|
|
|
|
|
|
|
|
/* ATAGs location */
|
|
|
|
gd->bd->bi_boot_params = OMAP44XX_DRAM_ADDR_SPACE_START + 0x100;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int misc_init_r(void)
|
|
|
|
{
|
2016-02-27 18:19:09 +00:00
|
|
|
char reboot_mode[2] = { 0 };
|
2016-02-27 18:19:14 +00:00
|
|
|
u32 data = 0;
|
2016-02-27 18:19:10 +00:00
|
|
|
u32 value;
|
2016-03-29 12:16:26 +00:00
|
|
|
int rc;
|
2016-02-27 18:19:09 +00:00
|
|
|
|
|
|
|
/* Reboot mode */
|
|
|
|
|
2016-03-29 12:16:26 +00:00
|
|
|
rc = omap_reboot_mode(reboot_mode, sizeof(reboot_mode));
|
2016-02-27 18:19:09 +00:00
|
|
|
|
2016-02-27 18:19:10 +00:00
|
|
|
/* USB ID pin pull-up indicates factory (fastboot) cable detection. */
|
|
|
|
gpio_request(KC1_GPIO_USB_ID, "USB_ID");
|
|
|
|
gpio_direction_input(KC1_GPIO_USB_ID);
|
|
|
|
value = gpio_get_value(KC1_GPIO_USB_ID);
|
|
|
|
|
|
|
|
if (value)
|
|
|
|
reboot_mode[0] = 'b';
|
|
|
|
|
2016-03-29 12:16:26 +00:00
|
|
|
if (rc < 0 || reboot_mode[0] == 'o') {
|
2016-02-27 18:19:14 +00:00
|
|
|
/*
|
|
|
|
* When not rebooting, valid power on reasons are either the
|
|
|
|
* power button, charger plug or USB plug.
|
|
|
|
*/
|
|
|
|
|
|
|
|
data |= twl6030_input_power_button();
|
|
|
|
data |= twl6030_input_charger();
|
|
|
|
data |= twl6030_input_usb();
|
|
|
|
|
|
|
|
if (!data)
|
|
|
|
twl6030_power_off();
|
2016-02-27 18:19:09 +00:00
|
|
|
}
|
|
|
|
|
2016-03-29 12:16:26 +00:00
|
|
|
if (reboot_mode[0] > 0 && isascii(reboot_mode[0])) {
|
2017-08-03 18:22:12 +00:00
|
|
|
if (!env_get("reboot-mode"))
|
2017-08-03 18:22:09 +00:00
|
|
|
env_set("reboot-mode", (char *)reboot_mode);
|
2016-03-29 12:16:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
omap_reboot_mode_clear();
|
|
|
|
|
2016-02-27 18:19:00 +00:00
|
|
|
/* Serial number */
|
|
|
|
|
|
|
|
omap_die_id_serial();
|
|
|
|
|
2016-02-27 18:19:06 +00:00
|
|
|
/* MUSB */
|
|
|
|
|
|
|
|
musb_register(&musb_platform_data, &musb_board_data, (void *)MUSB_BASE);
|
|
|
|
|
2016-02-27 18:19:00 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
u32 get_board_rev(void)
|
|
|
|
{
|
|
|
|
u32 value = 0;
|
|
|
|
|
|
|
|
gpio_request(KC1_GPIO_MBID0, "MBID0");
|
|
|
|
gpio_request(KC1_GPIO_MBID1, "MBID1");
|
|
|
|
gpio_request(KC1_GPIO_MBID2, "MBID2");
|
|
|
|
gpio_request(KC1_GPIO_MBID3, "MBID3");
|
|
|
|
|
|
|
|
gpio_direction_input(KC1_GPIO_MBID0);
|
|
|
|
gpio_direction_input(KC1_GPIO_MBID1);
|
|
|
|
gpio_direction_input(KC1_GPIO_MBID2);
|
|
|
|
gpio_direction_input(KC1_GPIO_MBID3);
|
|
|
|
|
|
|
|
value |= (gpio_get_value(KC1_GPIO_MBID0) << 0);
|
|
|
|
value |= (gpio_get_value(KC1_GPIO_MBID1) << 1);
|
|
|
|
value |= (gpio_get_value(KC1_GPIO_MBID2) << 2);
|
|
|
|
value |= (gpio_get_value(KC1_GPIO_MBID3) << 3);
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
void get_board_serial(struct tag_serialnr *serialnr)
|
|
|
|
{
|
|
|
|
omap_die_id_get_board_serial(serialnr);
|
|
|
|
}
|
|
|
|
|
2016-02-27 18:19:09 +00:00
|
|
|
int fb_set_reboot_flag(void)
|
|
|
|
{
|
|
|
|
return omap_reboot_mode_store("b");
|
|
|
|
}
|
|
|
|
|
2016-02-27 18:19:00 +00:00
|
|
|
int board_mmc_init(bd_t *bis)
|
|
|
|
{
|
|
|
|
return omap_mmc_init(1, 0, 0, -1, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
void board_mmc_power_init(void)
|
|
|
|
{
|
|
|
|
twl6030_power_mmc_init(1);
|
|
|
|
}
|