]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - board/samsung/trats/trats.c
Merge branch 'master' of git://git.denx.de/u-boot-spi
[karo-tx-uboot.git] / board / samsung / trats / trats.c
index 472402942442da0c16e2d530e33c89e36fed7927..b72550538a9916ccf46f0b7702a2fcd06e692084 100644 (file)
@@ -4,23 +4,7 @@
  * Kyungmin Park <kyungmin.park@samsung.com>
  * Donghwa Lee <dh09.lee@samsung.com>
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -42,6 +26,9 @@
 #include <power/max8997_muic.h>
 #include <power/battery.h>
 #include <power/max17042_fg.h>
+#include <usb.h>
+#include <usb_mass_storage.h>
+#include <samsung/misc.h>
 
 #include "setup.h"
 
@@ -57,17 +44,11 @@ u32 get_board_rev(void)
 #endif
 
 static void check_hw_revision(void);
-
-static int hwrevision(int rev)
-{
-       return (board_rev & 0xf) == rev;
-}
-
 struct s3c_plat_otg_data s5pc210_otg_data;
 
 int board_init(void)
 {
-       gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+       gd->bd->bi_boot_params = CONFIG_SYS_SPL_ARGS_ADDR;
 
        check_hw_revision();
        printf("HW Revision:\t0x%x\n", board_rev);
@@ -77,15 +58,18 @@ int board_init(void)
 
 void i2c_init_board(void)
 {
-       struct exynos4_gpio_part1 *gpio1 =
-               (struct exynos4_gpio_part1 *)samsung_get_base_gpio_part1();
+       int err;
        struct exynos4_gpio_part2 *gpio2 =
                (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
 
        /* I2C_5 -> PMIC */
-       s5p_gpio_direction_output(&gpio1->b, 7, 1);
-       s5p_gpio_direction_output(&gpio1->b, 6, 1);
-       /* I2C_9 -> FG */
+       err = exynos_pinmux_config(PERIPH_ID_I2C5, PINMUX_FLAG_NONE);
+       if (err) {
+               debug("I2C%d not configured\n", (I2C_5));
+               return;
+       }
+
+       /* I2C_8 -> FG */
        s5p_gpio_direction_output(&gpio2->y4, 0, 1);
        s5p_gpio_direction_output(&gpio2->y4, 1, 1);
 }
@@ -303,6 +287,13 @@ int power_init_board(void)
        struct power_battery *pb;
        struct pmic *p_fg, *p_chrg, *p_muic, *p_bat;
 
+       /*
+        * For PMIC/MUIC the I2C bus is named as I2C5, but it is connected
+        * to logical I2C adapter 0
+        *
+        * The FUEL_GAUGE is marked as I2C9 on the schematic, but connected
+        * to logical I2C adapter 1
+        */
        ret = pmic_init(I2C_5);
        ret |= pmic_init_max8997();
        ret |= power_fg_init(I2C_9);
@@ -509,12 +500,23 @@ struct s3c_plat_otg_data s5pc210_otg_data = {
        .usb_flags      = PHY0_SLEEP,
 };
 
-void board_usb_init(void)
+int board_usb_init(int index, enum usb_init_type init)
 {
        debug("USB_udc_probe\n");
-       s3c_udc_probe(&s5pc210_otg_data);
+       return s3c_udc_probe(&s5pc210_otg_data);
+}
+
+#ifdef CONFIG_USB_CABLE_CHECK
+int usb_cable_connected(void)
+{
+       struct pmic *muic = pmic_get("MAX8997_MUIC");
+       if (!muic)
+               return 0;
+
+       return !!muic->chrg->chrg_type(muic);
 }
 #endif
+#endif
 
 static void pmic_reset(void)
 {
@@ -634,7 +636,7 @@ int board_early_init_f(void)
        return 0;
 }
 
-static void lcd_reset(void)
+void exynos_reset_lcd(void)
 {
        struct exynos4_gpio_part2 *gpio2 =
                (struct exynos4_gpio_part2 *)samsung_get_base_gpio_part2();
@@ -741,7 +743,7 @@ vidinfo_t panel_info = {
        .vl_hsp         = CONFIG_SYS_LOW,
        .vl_vsp         = CONFIG_SYS_LOW,
        .vl_dp          = CONFIG_SYS_LOW,
-       .vl_bpix        = 5,    /* Bits per pixel, 2^5 = 32 */
+       .vl_bpix        = 4,    /* Bits per pixel, 2^4 = 16 */
 
        /* s6e8ax0 Panel infomation */
        .vl_hspw        = 5,
@@ -754,10 +756,6 @@ vidinfo_t panel_info = {
        .vl_cmd_allow_len = 0xf,
 
        .win_id         = 3,
-       .cfg_gpio       = NULL,
-       .backlight_on   = NULL,
-       .lcd_power_on   = NULL, /* lcd_power_on in mipi dsi driver */
-       .reset_lcd      = lcd_reset,
        .dual_lcd_enabled = 0,
 
        .init_delay     = 0,
@@ -776,9 +774,7 @@ void init_panel_info(vidinfo_t *vid)
 #ifdef CONFIG_TIZEN
        get_tizen_logo_info(vid);
 #endif
-
-       if (hwrevision(2))
-               mipi_lcd_device.reverse_panel = 1;
+       mipi_lcd_device.reverse_panel = 1;
 
        strcpy(s6e8ax0_platform_data.lcd_panel_name, mipi_lcd_device.name);
        s6e8ax0_platform_data.lcd_power = lcd_power;
@@ -791,3 +787,21 @@ void init_panel_info(vidinfo_t *vid)
 
        setenv("lcdinfo", "lcd=s6e8ax0");
 }
+
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
+       set_board_info();
+#endif
+#ifdef CONFIG_LCD_MENU
+       keys_init();
+       check_boot_mode();
+#endif
+#ifdef CONFIG_CMD_BMP
+       if (panel_info.logo_on)
+               draw_logo();
+#endif
+       return 0;
+}
+#endif