Commit c76eb72c43ac3ef4518dac4bee653b769d95e63e
Committed by
Daniel Schwierzeck
1 parent
102142c9e0
Exists in
v2017.01-smarct4x
and in
30 other branches
board: add SDHCI support for PIC32MZDASK board.
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>
Showing 4 changed files with 77 additions and 3 deletions Side-by-side Diff
arch/mips/dts/pic32mzda.dtsi
... | ... | @@ -150,5 +150,16 @@ |
150 | 150 | #gpio-cells = <2>; |
151 | 151 | }; |
152 | 152 | }; |
153 | + | |
154 | + sdhci: sdhci@1f8ec000 { | |
155 | + compatible = "microchip,pic32mzda-sdhci"; | |
156 | + reg = <0x1f8ec000 0x100>; | |
157 | + interrupts = <191 IRQ_TYPE_LEVEL_HIGH>; | |
158 | + clocks = <&clock REF4CLK>, <&clock PB5CLK>; | |
159 | + clock-names = "base_clk", "sys_clk"; | |
160 | + clock-freq-min-max = <25000000>,<25000000>; | |
161 | + bus-width = <4>; | |
162 | + status = "disabled"; | |
163 | + }; | |
153 | 164 | }; |
arch/mips/dts/pic32mzda_sk.dts
... | ... | @@ -23,6 +23,9 @@ |
23 | 23 | }; |
24 | 24 | |
25 | 25 | &clock { |
26 | + microchip,refo2-frequency = <50000000>; | |
27 | + microchip,refo4-frequency = <25000000>; | |
28 | + microchip,refo5-frequency = <40000000>; | |
26 | 29 | status = "okay"; |
27 | 30 | u-boot,dm-pre-reloc; |
28 | 31 | }; |
... | ... | @@ -35,5 +38,9 @@ |
35 | 38 | &uart2 { |
36 | 39 | status = "okay"; |
37 | 40 | u-boot,dm-pre-reloc; |
41 | +}; | |
42 | + | |
43 | +&sdhci { | |
44 | + status = "okay"; | |
38 | 45 | }; |
configs/pic32mzdask_defconfig
... | ... | @@ -9,7 +9,6 @@ |
9 | 9 | CONFIG_HUSH_PARSER=y |
10 | 10 | CONFIG_SYS_PROMPT="dask # " |
11 | 11 | # CONFIG_CMD_IMLS is not set |
12 | -# CONFIG_CMD_EXPORTENV is not set | |
13 | 12 | # CONFIG_CMD_SAVEENV is not set |
14 | 13 | CONFIG_LOOPW=y |
15 | 14 | CONFIG_CMD_MEMTEST=y |
... | ... | @@ -22,6 +21,8 @@ |
22 | 21 | CONFIG_CMD_TIME=y |
23 | 22 | CONFIG_OF_EMBED=y |
24 | 23 | CONFIG_CLK=y |
24 | +CONFIG_DM_MMC=y | |
25 | +CONFIG_PIC32_SDHCI=y | |
25 | 26 | CONFIG_PINCTRL=y |
26 | 27 | # CONFIG_PINCTRL_FULL is not set |
27 | 28 | CONFIG_SYS_VSNPRINTF=y |
include/configs/pic32mzdask.h
... | ... | @@ -46,6 +46,7 @@ |
46 | 46 | |
47 | 47 | #define CONFIG_SYS_LOAD_ADDR 0x88500000 /* default load address */ |
48 | 48 | #define CONFIG_SYS_ENV_ADDR 0x88300000 |
49 | +#define CONFIG_SYS_FDT_ADDR 0x89d00000 | |
49 | 50 | |
50 | 51 | /* Memory Test */ |
51 | 52 | #define CONFIG_SYS_MEMTEST_START 0x88000000 |
... | ... | @@ -77,6 +78,33 @@ |
77 | 78 | */ |
78 | 79 | #define CONFIG_OF_LIBFDT 1 |
79 | 80 | |
81 | +/*----------------------------------------------------------------------- | |
82 | + * SDHC Configuration | |
83 | + */ | |
84 | +#define CONFIG_SDHCI | |
85 | +#define CONFIG_MMC | |
86 | +#define CONFIG_GENERIC_MMC | |
87 | +#define CONFIG_CMD_MMC | |
88 | + | |
89 | +/*----------------------------------------------------------------------- | |
90 | + * File System Configuration | |
91 | + */ | |
92 | +/* FAT FS */ | |
93 | +#define CONFIG_DOS_PARTITION | |
94 | +#define CONFIG_PARTITION_UUIDS | |
95 | +#define CONFIG_SUPPORT_VFAT | |
96 | +#define CONFIG_FS_FAT | |
97 | +#define CONFIG_FAT_WRITE | |
98 | +#define CONFIG_CMD_FS_GENERIC | |
99 | +#define CONFIG_CMD_PART | |
100 | +#define CONFIG_CMD_FAT | |
101 | + | |
102 | +/* EXT4 FS */ | |
103 | +#define CONFIG_FS_EXT4 | |
104 | +#define CONFIG_CMD_EXT2 | |
105 | +#define CONFIG_CMD_EXT4 | |
106 | +#define CONFIG_CMD_EXT4_WRITE | |
107 | + | |
80 | 108 | /* ------------------------------------------------- |
81 | 109 | * Environment |
82 | 110 | */ |
... | ... | @@ -87,8 +115,35 @@ |
87 | 115 | * Board boot configuration |
88 | 116 | */ |
89 | 117 | #define CONFIG_TIMESTAMP /* Print image info with timestamp */ |
90 | -#define CONFIG_BOOTDELAY 5 /* autoboot after X seconds */ | |
91 | -#undef CONFIG_BOOTARGS | |
118 | +#define CONFIG_BOOTDELAY 5 | |
119 | + | |
120 | +#define MEM_LAYOUT_ENV_SETTINGS \ | |
121 | + "kernel_addr_r="__stringify(CONFIG_SYS_LOAD_ADDR)"\0" \ | |
122 | + "fdt_addr_r="__stringify(CONFIG_SYS_FDT_ADDR)"\0" \ | |
123 | + "scriptaddr="__stringify(CONFIG_SYS_ENV_ADDR)"\0" | |
124 | + | |
125 | +#define CONFIG_LEGACY_BOOTCMD_ENV \ | |
126 | + "legacy_bootcmd= " \ | |
127 | + "if load mmc 0 ${scriptaddr} uEnv.txt; then " \ | |
128 | + "env import -tr ${scriptaddr} ${filesize}; " \ | |
129 | + "if test -n \"${bootcmd_uenv}\" ; then " \ | |
130 | + "echo Running bootcmd_uenv ...; " \ | |
131 | + "run bootcmd_uenv; " \ | |
132 | + "fi; " \ | |
133 | + "fi; \0" | |
134 | + | |
135 | +#define BOOT_TARGET_DEVICES(func) \ | |
136 | + func(MMC, mmc, 0) | |
137 | + | |
138 | +#include <config_distro_bootcmd.h> | |
139 | + | |
140 | +#define CONFIG_EXTRA_ENV_SETTINGS \ | |
141 | + MEM_LAYOUT_ENV_SETTINGS \ | |
142 | + CONFIG_LEGACY_BOOTCMD_ENV \ | |
143 | + BOOTENV | |
144 | + | |
145 | +#undef CONFIG_BOOTCOMMAND | |
146 | +#define CONFIG_BOOTCOMMAND "run distro_bootcmd || run legacy_bootcmd" | |
92 | 147 | |
93 | 148 | #endif /* __PIC32MZDASK_CONFIG_H */ |