board: nexell: artik711s: choose sdcard/clipper1 by bootmode
authorChanho Park <chanho61.park@samsung.com>
Wed, 18 Apr 2018 11:05:49 +0000 (20:05 +0900)
committerChanho Park <chanho61.park@samsung.com>
Wed, 18 Apr 2018 11:20:39 +0000 (20:20 +0900)
The sdcard of artik711s raptor board is muxed with the ccir1 camera.
It can be switched by jumper select but there is no way to control the
jumper by S/W. Thus, we decided to switch them according to boot mode.
When a board is turned on eMMC boot mode,
 - sdcard: disable
 - clipper1: enable
otherwise,
 - sdcard: enable
 - clipper1: disable

Change-Id: I0ef9674b8865d943394a27a8aba5c80fe30994ed
Signed-off-by: Chanho Park <chanho61.park@samsung.com>
board/nexell/s5p6818/artik711s_raptor/board.c

index ac253d729e913620b4e6f207a9f9d5bbfb5d4c71..8fb54f83a6a4590d1a6b46df0ee27d105554ff57 100644 (file)
@@ -119,6 +119,48 @@ int mmc_get_env_dev(void)
        return -1;
 }
 
+#if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
+int ft_board_setup(void *blob, bd_t *bd)
+{
+       int rc;
+       int boot_dev = mmc_get_env_dev();
+       const char *okay = "okay";
+       const char *disabled = "disabled";
+       char *sdcard_status, *clipper1_status;
+
+       if (boot_dev == 0) {
+               /* eMMC boot, let's disable sdcard and enable clipper1 */
+               sdcard_status = disabled;
+               clipper1_status = okay;
+       } else if (boot_dev == 1) {
+               /* SDCard boot, let's enable sdcard and disable clipper1 */
+               sdcard_status = okay;
+               clipper1_status = disabled;
+       } else {
+               return 0;
+       }
+
+       rc = fdt_find_and_setprop(blob, "/soc/dw_mmc@c0062000", "status",
+                                 sdcard_status, strlen(sdcard_status) + 1, 1);
+       if (rc) {
+               printf("Unable to update property status of sdcard,err=%s\n",
+                      fdt_strerror(rc));
+               return rc;
+       }
+
+       rc = fdt_find_and_setprop(blob, "/soc/clipper1@c0064000", "status",
+                                 clipper1_status, strlen(clipper1_status) + 1,
+                                 1);
+       if (rc) {
+               printf("Unable to update property status of clipper1,err=%s\n",
+                      fdt_strerror(rc));
+               return rc;
+       }
+
+       return 0;
+}
+#endif
+
 int board_init(void)
 {
 #ifdef CONFIG_REVISION_TAG