@@ -31,6 +31,16 @@ controllers work only in master mode.
3131 | AM62x LP SK | OSPI NAND | :file: `drivers/spi/cadence_qspi.c ` |
3232 +-------------+------------+------------------------------------+
3333
34+ .. ifconfig :: CONFIG_part_variant in ('AM62LX')
35+
36+ +-------------+------------+------------------------------------+
37+ | SoC Family | Capability | Driver |
38+ +=============+============+====================================+
39+ | | OSPI NOR | :file: `drivers/spi/cadence_qspi.c ` |
40+ + AM62Lx EVM +------------+------------------------------------+
41+ | | QSPI NAND | :file: `drivers/spi/cadence_qspi.c ` |
42+ +-------------+------------+------------------------------------+
43+
3444.. ifconfig :: CONFIG_part_variant in ('AM62AX')
3545
3646 +------------+------------+------------------------------------+
@@ -206,6 +216,85 @@ This driver also supports QSPI version of the same IP.
206216 };
207217 };
208218
219+ .. ifconfig :: CONFIG_part_variant in ('AM62LX')
220+
221+ The following is an example device-tree node for an OSPI NOR device
222+
223+ .. code-block :: dts
224+
225+ &ospi0 {
226+
227+ flash@0{
228+ compatible = "jedec,spi-nor";
229+ reg = <0x0>;
230+ spi-tx-bus-width = <8>;
231+ spi-rx-bus-width = <8>;
232+ spi-max-frequency = <25000000>;
233+ cdns,tshsl-ns = <60>;
234+ cdns,tsd2d-ns = <60>;
235+ cdns,tchsh-ns = <60>;
236+ cdns,tslch-ns = <60>;
237+ cdns,read-delay = <4>;
238+
239+ partitions {
240+ compatible = "fixed-partitions";
241+ #address-cells = <1>;
242+ #size-cells = <1>;
243+ bootph-all;
244+
245+ partition@0 {
246+ label = "ospi.tiboot3";
247+ reg = <0x00 0x80000>;
248+ };
249+
250+ partition@80000 {
251+ label = "ospi.tispl";
252+ reg = <0x80000 0x200000>;
253+ };
254+
255+ // other partitions
256+ };
257+ };
258+ };
259+
260+ The following is an example device-tree node for an QSPI NAND device
261+
262+ .. code-block :: dts
263+
264+ &ospi0 {
265+
266+ flash@0 {
267+ compatible = "spi-nand";
268+ reg = <0x0>;
269+ spi-tx-bus-width = <4>;
270+ spi-rx-bus-width = <4>;
271+ spi-max-frequency = <25000000>;
272+ cdns,tshsl-ns = <60>;
273+ cdns,tsd2d-ns = <60>;
274+ cdns,tchsh-ns = <60>;
275+ cdns,tslch-ns = <60>;
276+ cdns,read-delay = <2>;
277+
278+ partitions {
279+ compatible = "fixed-partitions";
280+ #address-cells = <1>;
281+ #size-cells = <1>;
282+
283+ partition@0 {
284+ label = "ospi_nand.tiboot3";
285+ reg = <0x0 0x80000>;
286+ };
287+
288+ partition@80000 {
289+ label = "ospi_nand.tispl";
290+ reg = <0x80000 0x200000>;
291+ };
292+
293+ // other partitions
294+ };
295+ };
296+ };
297+
209298 Flash properties:
210299
2113001. **compatible: ** specifies the compatible string for the device, the operating
@@ -843,6 +932,130 @@ Flash properties:
843932 | (256k) |
844933 +--------------------------+
845934
935+ .. ifconfig :: CONFIG_part_variant in ('AM62LX')
936+
937+ **OSPI NOR (Boot media) **
938+
939+ AM62Lx EVM has a Cypress S28HS512T OSPI NOR flash and SYSFW is bundled with
940+ :file: `tiboot3.bin `.
941+
942+ Below are two methods which can be used to flash the OSPI NOR device. For
943+ all methods, we will load the bootloaders into memory and then flash each
944+ to OSPI NOR at the respective addresses.
945+
946+ **Flashing Images to OSPI NOR using TFTP server **
947+
948+ In this example, we'll use the ``tftp-hpa `` package from Ubuntu for our
949+ tftp server. Assume bootloader names are :file: `tiboot3.bin `,
950+ :file: `tispl.bin `, :file: `u-boot.img `. Verify ethernet connection between
951+ AM62Lx EVM and host machine before proceeding.
952+
953+ 1. Setup TFTP server in Host machine
954+
955+ .. code-block :: console
956+
957+ # For complete instructions refer to: https://help.ubuntu.com/community/TFTP
958+ $ sudo apt install tftp-hpa
959+ $ sudo vi /etc/default/tftpd-hpa # optional to change tftp directory and other options
960+ $ sudo chown -R tftp /tftp # change owner/group of new directory /tftp
961+ $ sudo systemctl restart tftpd-hpa # restart server
962+
963+ 2. Setup U-boot environment for AM62Lx EVM
964+
965+ .. code-block :: console
966+
967+ # Boot to U-boot prompt using a working boot method
968+ => setenv ipaddr <ip-address-of-am62lx-evm>
969+ => setenv serverip <ip-address-of-tftp-server>
970+
971+ 3. Use tftp command to load the bootloaders into memory and flash to OSPI
972+ NOR
973+
974+ .. code-block :: console
975+
976+ => sf probe
977+ => tftp ${loadaddr} tiboot3.bin
978+ => sf update $loadaddr 0x0 $filesize
979+ => tftp ${loadaddr} tispl.bin
980+ => sf update $loadaddr 0x80000 $filesize
981+ => tftp ${loadaddr} u-boot.img
982+ => sf update $loadaddr 0x280000 $filesize
983+
984+ 4. Change boot mode pins to OSPI boot mode and reboot AM62Lx EVM
985+
986+ **Flashing images to OSPI NOR using SD card **
987+
988+ In this example, load binaries from SD card. Assume bootloader names are
989+ :file: `tiboot3.bin `, :file: `tispl.bin `, :file: `u-boot.img `. Boot via SD
990+ card boot and stop at U-boot prompt before procceeding.
991+
992+ 1. Use fatload command to load the bootloaders into memory and flash to
993+ OSPI NOR
994+
995+ .. code-block :: console
996+
997+ => sf probe
998+ => fatload mmc 1 ${loadaddr} tiboot3.bin
999+ => sf update $loadaddr 0x0 $filesize
1000+ => fatload mmc 1 ${loadaddr} tispl.bin
1001+ => sf update $loadaddr 0x80000 $filesize
1002+ => fatload mmc 1 ${loadaddr} u-boot.img
1003+ => sf update $loadaddr 0x280000 $filesize
1004+
1005+ 2. Change boot mode pins to OSPI boot mode and reboot AM62Lx EVM
1006+
1007+ **OSPI Boot Mode **
1008+
1009+ Please refer to the AM62Lx TRM Section 5.4 for more information.
1010+
1011+ **Phy Calibration **
1012+
1013+ Phy Calibration allows for higher read performance. To enable phy, the phy
1014+ calibration pattern must be flashed to OSPI at the start of the last erase
1015+ sector. For the Cypress S28HS512T flash, this lies at the address 0x3FC0000.
1016+ The partition name should be 'ospi.phypattern' as the driver looks for it
1017+ before PHY Calibration.
1018+
1019+ Download the binary file containing the phy pattern from :download: `here </files/ospi_phy_pattern >`.
1020+ The commands below can be used to flash the phy pattern, with the location
1021+ of the pattern depending on which flash is being used:
1022+
1023+ .. code-block :: console
1024+
1025+ => sf probe
1026+ => tftp ${loadaddr} ospi_phy_pattern
1027+ => sf update $loadaddr 0x3fc0000 $filesize
1028+
1029+ **Flash layout for OSPI NOR **
1030+
1031+ .. code-block :: text
1032+
1033+ +---------------------+ 0x0
1034+ | ospi.tiboot3 |
1035+ | (512k) |
1036+ +---------------------+ 0x80000
1037+ | ospi.tispl |
1038+ | (2m) |
1039+ +---------------------+ 0x280000
1040+ | ospi.u-boot |
1041+ | (4m) |
1042+ +---------------------+ 0x680000
1043+ | ospi.env |
1044+ | (256k) |
1045+ +---------------------+ 0x6C0000
1046+ | ospi.env.backup |
1047+ | (256k) |
1048+ +---------------------+ 0x700000
1049+ | padding |
1050+ | (1m) |
1051+ +---------------------+ 0x800000
1052+ | ospi.rootfs |
1053+ | (55m)(ubifs) |
1054+ +---------------------+ 0x3FC0000
1055+ | ospi.phypattern |
1056+ | (256k) |
1057+ +---------------------+
1058+
8461059 .. ifconfig :: CONFIG_part_variant in ('AM62AX')
8471060
8481061 AM62Ax has a Winbond W35N01JW OSPI NAND flash and SYSFW is bundled with
0 commit comments