]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
board: add SDHCI support for PIC32MZDASK board.
authorPurna Chandra Mandal <purna.mandal@microchip.com>
Thu, 28 Jan 2016 10:00:19 +0000 (15:30 +0530)
committerDaniel Schwierzeck <daniel.schwierzeck@gmail.com>
Mon, 1 Feb 2016 21:14:02 +0000 (22:14 +0100)
Enable MMC, SDHCI, FAT_FS support for PIC32MZ[DA] StarterKit.
Also add custom scripts, rules to boot Linux from microSD card.

Signed-off-by: Purna Chandra Mandal <purna.mandal@microchip.com>
arch/mips/dts/pic32mzda.dtsi
arch/mips/dts/pic32mzda_sk.dts
configs/pic32mzdask_defconfig
include/configs/pic32mzdask.h

index c67cfa9d0d07284f16140b82b387fccd5d724225..f1894ec37cabc0291c6aab9efde59784eebaa20c 100644 (file)
                        #gpio-cells = <2>;
                };
        };
+
+       sdhci: sdhci@1f8ec000 {
+               compatible = "microchip,pic32mzda-sdhci";
+               reg = <0x1f8ec000 0x100>;
+               interrupts = <191 IRQ_TYPE_LEVEL_HIGH>;
+               clocks = <&clock REF4CLK>, <&clock PB5CLK>;
+               clock-names = "base_clk", "sys_clk";
+               clock-freq-min-max = <25000000>,<25000000>;
+               bus-width = <4>;
+               status = "disabled";
+       };
 };
index 99e7f6498381b0b1ebca94eabb3898e9ba450d9a..f886a0f87f68ce0a9baedf1afd2199c361848dc7 100644 (file)
@@ -23,6 +23,9 @@
 };
 
 &clock {
+       microchip,refo2-frequency = <50000000>;
+       microchip,refo4-frequency = <25000000>;
+       microchip,refo5-frequency = <40000000>;
        status = "okay";
        u-boot,dm-pre-reloc;
 };
@@ -36,3 +39,7 @@
        status = "okay";
        u-boot,dm-pre-reloc;
 };
+
+&sdhci {
+       status = "okay";
+};
\ No newline at end of file
index 1c968fc73ebff0013d2a598c7dda7820eaa55624..55ba3f87abb18e7b34335cb7f73012739dfcb6d8 100644 (file)
@@ -9,7 +9,6 @@ CONFIG_DEFAULT_DEVICE_TREE="pic32mzda_sk"
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="dask # "
 # CONFIG_CMD_IMLS is not set
-# CONFIG_CMD_EXPORTENV is not set
 # CONFIG_CMD_SAVEENV is not set
 CONFIG_LOOPW=y
 CONFIG_CMD_MEMTEST=y
@@ -22,6 +21,8 @@ CONFIG_CMD_GPIO=y
 CONFIG_CMD_TIME=y
 CONFIG_OF_EMBED=y
 CONFIG_CLK=y
+CONFIG_DM_MMC=y
+CONFIG_PIC32_SDHCI=y
 CONFIG_PINCTRL=y
 # CONFIG_PINCTRL_FULL is not set
 CONFIG_SYS_VSNPRINTF=y
index 5ba2a19c607c570f673784cd38c8f769dc63e6ee..b25803897e6debed35a6d83182911674bb86c2ac 100644 (file)
@@ -46,6 +46,7 @@
 
 #define CONFIG_SYS_LOAD_ADDR           0x88500000 /* default load address */
 #define CONFIG_SYS_ENV_ADDR            0x88300000
+#define CONFIG_SYS_FDT_ADDR            0x89d00000
 
 /* Memory Test */
 #define CONFIG_SYS_MEMTEST_START       0x88000000
  */
 #define CONFIG_OF_LIBFDT       1
 
+/*-----------------------------------------------------------------------
+ * SDHC Configuration
+ */
+#define CONFIG_SDHCI
+#define CONFIG_MMC
+#define CONFIG_GENERIC_MMC
+#define CONFIG_CMD_MMC
+
+/*-----------------------------------------------------------------------
+ * File System Configuration
+ */
+/* FAT FS */
+#define CONFIG_DOS_PARTITION
+#define CONFIG_PARTITION_UUIDS
+#define CONFIG_SUPPORT_VFAT
+#define CONFIG_FS_FAT
+#define CONFIG_FAT_WRITE
+#define CONFIG_CMD_FS_GENERIC
+#define CONFIG_CMD_PART
+#define CONFIG_CMD_FAT
+
+/* EXT4 FS */
+#define CONFIG_FS_EXT4
+#define CONFIG_CMD_EXT2
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
+
 /* -------------------------------------------------
  * Environment
  */
  * Board boot configuration
  */
 #define CONFIG_TIMESTAMP       /* Print image info with timestamp */
-#define CONFIG_BOOTDELAY       5 /* autoboot after X seconds     */
-#undef CONFIG_BOOTARGS
+#define CONFIG_BOOTDELAY       5
+
+#define MEM_LAYOUT_ENV_SETTINGS                                        \
+       "kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0"   \
+       "fdt_addr_r="__stringify(CONFIG_SYS_FDT_ADDR)"\0"       \
+       "scriptaddr="__stringify(CONFIG_SYS_ENV_ADDR)"\0"
+
+#define CONFIG_LEGACY_BOOTCMD_ENV                                      \
+       "legacy_bootcmd= "                                              \
+               "if load mmc 0 ${scriptaddr} uEnv.txt; then "           \
+                       "env import -tr ${scriptaddr} ${filesize}; "    \
+                       "if test -n \"${bootcmd_uenv}\" ; then "        \
+                               "echo Running bootcmd_uenv ...; "       \
+                               "run bootcmd_uenv; "                    \
+                       "fi; "                                          \
+               "fi; \0"
+
+#define BOOT_TARGET_DEVICES(func)      \
+       func(MMC, mmc, 0)
+
+#include <config_distro_bootcmd.h>
+
+#define CONFIG_EXTRA_ENV_SETTINGS      \
+       MEM_LAYOUT_ENV_SETTINGS         \
+       CONFIG_LEGACY_BOOTCMD_ENV       \
+       BOOTENV
+
+#undef CONFIG_BOOTCOMMAND
+#define CONFIG_BOOTCOMMAND     "run distro_bootcmd || run legacy_bootcmd"
 
 #endif /* __PIC32MZDASK_CONFIG_H */