@@ -396,6 +396,7 @@ int OSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
396
396
if (size % 2 != 0 ) {
397
397
<<<<<<< HEAD
398
398
<<<<<<< HEAD
399
+ <<<<<<< HEAD
399
400
<<<<<<< HEAD
400
401
size ++;
401
402
=======
@@ -407,6 +408,9 @@ int OSPIFBlockDevice::read(void *buffer, bd_addr_t addr, bd_size_t size)
407
408
=======
408
409
size ++;
409
410
>>>>>>> 7266070 ... Modify the astyle
411
+ =======
412
+ size ++;
413
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
410
414
}
411
415
412
416
if (OSPI_STATUS_OK != _ospi_send_read_command (_read_instruction, buffer, addr, size)) {
@@ -515,6 +519,7 @@ int OSPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
515
519
// cur_erase_inst should be 4-Byte erase instruction for Macronix octa flash OPI mode
516
520
<<<<<<< HEAD
517
521
<<<<<<< HEAD
522
+ <<<<<<< HEAD
518
523
<<<<<<< HEAD
519
524
cur_erase_inst = (_address_size == OSPI_CFG_ADDR_SIZE_32) ? _sfdp_info.fbatbl .erase_type_4_byte_inst_arr [type] : _sfdp_info.smptbl .erase_type_inst_arr [type];
520
525
=======
@@ -526,6 +531,9 @@ int OSPIFBlockDevice::erase(bd_addr_t addr, bd_size_t in_size)
526
531
=======
527
532
cur_erase_inst = (_address_size == OSPI_CFG_ADDR_SIZE_32) ? _sfdp_info.fbatbl .erase_type_4_byte_inst_arr [type] : _sfdp_info.smptbl .erase_type_inst_arr [type];
528
533
>>>>>>> 7266070 ... Modify the astyle
534
+ =======
535
+ cur_erase_inst = (_address_size == OSPI_CFG_ADDR_SIZE_32) ? _sfdp_info.fbatbl .erase_type_4_byte_inst_arr [type] : _sfdp_info.smptbl .erase_type_inst_arr [type];
536
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
529
537
eu_size = _sfdp_info.smptbl .erase_type_size_arr [type];
530
538
} else {
531
539
// Must use legacy 4k erase instruction
@@ -660,6 +668,7 @@ int OSPIFBlockDevice::change_mode(int mode)
660
668
if (((mode == SPI) && (_read_instruction == OSPIF_INST_READ_4B)) ||
661
669
<<<<<<< HEAD
662
670
<<<<<<< HEAD
671
+ <<<<<<< HEAD
663
672
<<<<<<< HEAD
664
673
((mode == SOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_STR)) ||
665
674
((mode == DOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_DTR))) {
@@ -677,6 +686,10 @@ int OSPIFBlockDevice::change_mode(int mode)
677
686
((mode == SOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_STR)) ||
678
687
((mode == DOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_DTR))) {
679
688
>>>>>>> 7266070 ... Modify the astyle
689
+ =======
690
+ ((mode == SOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_STR)) ||
691
+ ((mode == DOPI) && (_read_instruction == DTROSPIF_INST_READ_OCTA_DTR))) {
692
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
680
693
tr_debug (" Flash does not need change mode" );
681
694
}
682
695
@@ -707,6 +720,7 @@ int OSPIFBlockDevice::change_mode(int mode)
707
720
OSPI_CFG_BUS_SINGLE, 0 , OSPI_CFG_BUS_SINGLE, 0 );
708
721
<<<<<<< HEAD
709
722
<<<<<<< HEAD
723
+ <<<<<<< HEAD
710
724
<<<<<<< HEAD
711
725
// Write new Status Register Setup
712
726
=======
@@ -718,6 +732,9 @@ int OSPIFBlockDevice::change_mode(int mode)
718
732
=======
719
733
// Write new Status Register Setup
720
734
>>>>>>> 7266070 ... Modify the astyle
735
+ =======
736
+ // Write new Status Register Setup
737
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
721
738
if (_set_write_enable () != 0 ) {
722
739
tr_error (" Write Enabe failed" );
723
740
return -1 ;
@@ -746,6 +763,7 @@ int OSPIFBlockDevice::change_mode(int mode)
746
763
0 , _data_width, 0 );
747
764
<<<<<<< HEAD
748
765
<<<<<<< HEAD
766
+ <<<<<<< HEAD
749
767
<<<<<<< HEAD
750
768
} else if (mode == DOPI) {
751
769
if ((_read_instruction != OSPIF_INST_READ_4B) && (_read_instruction != OSPIF_INST_READ_DEFAULT)) {// chang mode from SOPI to SPI
@@ -766,6 +784,11 @@ int OSPIFBlockDevice::change_mode(int mode)
766
784
if ((_read_instruction != OSPIF_INST_READ_4B) && (_read_instruction != OSPIF_INST_READ_DEFAULT)) {// chang mode from SOPI to SPI
767
785
// Write new Status Register Setup
768
786
>>>>>>> 7266070 ... Modify the astyle
787
+ =======
788
+ } else if (mode == DOPI) {
789
+ if ((_read_instruction != OSPIF_INST_READ_4B) && (_read_instruction != OSPIF_INST_READ_DEFAULT)) {// chang mode from SOPI to SPI
790
+ // Write new Status Register Setup
791
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
769
792
if (_set_write_enable () != 0 ) {
770
793
tr_error (" Write Enabe failed" );
771
794
return -1 ;
@@ -790,6 +813,7 @@ int OSPIFBlockDevice::change_mode(int mode)
790
813
OSPI_CFG_BUS_SINGLE, 0 , OSPI_CFG_BUS_SINGLE, 0 );
791
814
<<<<<<< HEAD
792
815
<<<<<<< HEAD
816
+ <<<<<<< HEAD
793
817
<<<<<<< HEAD
794
818
// Write new Status Register Setup
795
819
=======
@@ -801,6 +825,9 @@ int OSPIFBlockDevice::change_mode(int mode)
801
825
=======
802
826
// Write new Status Register Setup
803
827
>>>>>>> 7266070 ... Modify the astyle
828
+ =======
829
+ // Write new Status Register Setup
830
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
804
831
if (_set_write_enable () != 0 ) {
805
832
tr_error (" Write Enabe failed" );
806
833
return -1 ;
@@ -829,6 +856,7 @@ int OSPIFBlockDevice::change_mode(int mode)
829
856
0 , _data_width, 0 );
830
857
<<<<<<< HEAD
831
858
<<<<<<< HEAD
859
+ <<<<<<< HEAD
832
860
<<<<<<< HEAD
833
861
} else if (mode == SPI) {
834
862
// Write new Status Register Setup
@@ -846,6 +874,10 @@ int OSPIFBlockDevice::change_mode(int mode)
846
874
} else if (mode == SPI) {
847
875
// Write new Status Register Setup
848
876
>>>>>>> 7266070 ... Modify the astyle
877
+ =======
878
+ } else if (mode == SPI) {
879
+ // Write new Status Register Setup
880
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
849
881
if (_set_write_enable () != 0 ) {
850
882
tr_error (" Write Enabe failed" );
851
883
return -1 ;
@@ -1170,6 +1202,7 @@ int OSPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table
1170
1202
_dummy_cycles = (basic_param_table_ptr[OSPIF_BASIC_PARAM_TABLE_888_READ_INST_BYTE - 1 ] >> 5 )
1171
1203
<<<<<<< HEAD
1172
1204
<<<<<<< HEAD
1205
+ <<<<<<< HEAD
1173
1206
<<<<<<< HEAD
1174
1207
+ (basic_param_table_ptr[OSPIF_BASIC_PARAM_TABLE_888_READ_INST_BYTE - 1 ] & 0x1F );
1175
1208
=======
@@ -1181,6 +1214,9 @@ int OSPIFBlockDevice::_sfdp_detect_best_bus_read_mode(uint8_t *basic_param_table
1181
1214
=======
1182
1215
+ (basic_param_table_ptr[OSPIF_BASIC_PARAM_TABLE_888_READ_INST_BYTE - 1 ] & 0x1F );
1183
1216
>>>>>>> 7266070 ... Modify the astyle
1217
+ =======
1218
+ + (basic_param_table_ptr[OSPIF_BASIC_PARAM_TABLE_888_READ_INST_BYTE - 1 ] & 0x1F );
1219
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1184
1220
tr_debug (" Read Bus Mode set to 8-8-8, Instruction: 0x%xh" , _read_instruction);
1185
1221
// _inst_width = OSPI_CFG_BUS_OCTA;
1186
1222
// _inst_size = OSPI_CFG_INST_SIZE_16;
@@ -1351,6 +1387,7 @@ int OSPIFBlockDevice::_sfdp_detect_and_enable_4byte_addressing(uint8_t *basic_pa
1351
1387
_read_instruction = OSPIF_INST_READ_4B;
1352
1388
<<<<<<< HEAD
1353
1389
<<<<<<< HEAD
1390
+ <<<<<<< HEAD
1354
1391
<<<<<<< HEAD
1355
1392
break ;
1356
1393
=======
@@ -1362,6 +1399,9 @@ int OSPIFBlockDevice::_sfdp_detect_and_enable_4byte_addressing(uint8_t *basic_pa
1362
1399
=======
1363
1400
break ;
1364
1401
>>>>>>> 7266070 ... Modify the astyle
1402
+ =======
1403
+ break ;
1404
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1365
1405
case 0xc2 :
1366
1406
break ;
1367
1407
}
@@ -1445,6 +1485,7 @@ int OSPIFBlockDevice::_sfdp_parse_4_byte_inst_table(Callback<int(bd_addr_t, void
1445
1485
if (four_byte_inst_table[OSPIF_4_BYTE_INST_TABLE_ERASE_SUPPORT_BYTE] & (FOURBYTE_INST_ERASE_TYPE_1_BITMASK << i_ind)) {
1446
1486
<<<<<<< HEAD
1447
1487
<<<<<<< HEAD
1488
+ <<<<<<< HEAD
1448
1489
<<<<<<< HEAD
1449
1490
sfdp_info.fbatbl .erase_type_4_byte_inst_arr [i_ind] = four_byte_inst_table[OSPIF_4_BYTE_INST_TABLE_INST_ERASE_TYPE_1_BYTE + i_ind];
1450
1491
=======
@@ -1456,6 +1497,9 @@ int OSPIFBlockDevice::_sfdp_parse_4_byte_inst_table(Callback<int(bd_addr_t, void
1456
1497
=======
1457
1498
sfdp_info.fbatbl .erase_type_4_byte_inst_arr [i_ind] = four_byte_inst_table[OSPIF_4_BYTE_INST_TABLE_INST_ERASE_TYPE_1_BYTE + i_ind];
1458
1499
>>>>>>> 7266070 ... Modify the astyle
1500
+ =======
1501
+ sfdp_info.fbatbl .erase_type_4_byte_inst_arr [i_ind] = four_byte_inst_table[OSPIF_4_BYTE_INST_TABLE_INST_ERASE_TYPE_1_BYTE + i_ind];
1502
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1459
1503
}
1460
1504
tr_debug (" Erase Type %d - Inst: 0x%xh" , (i_ind + 1 ), sfdp_info.fbatbl .erase_type_4_byte_inst_arr [i_ind]);
1461
1505
}
@@ -1877,13 +1921,17 @@ ospi_status_t OSPIFBlockDevice::_ospi_send_general_command(ospi_inst_t instructi
1877
1921
<<<<<<< HEAD
1878
1922
<<<<<<< HEAD
1879
1923
<<<<<<< HEAD
1924
+ <<<<<<< HEAD
1925
+ =======
1926
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1880
1927
if ((_inst_width == OSPI_CFG_BUS_OCTA) || (_inst_width == OSPI_CFG_BUS_OCTA_DTR)) {
1881
1928
if ((instruction == OSPIF_INST_RSR1) || (instruction == OSPIF_INST_RDID) ||
1882
1929
(instruction == OSPIF_INST_RDCR2) || (instruction == OSPIF_INST_RDCR)) {
1883
1930
_ospi.configure_format (_inst_width, _inst_size, _address_width, _address_size, OSPI_CFG_BUS_SINGLE,
1884
1931
0 , _data_width, 4 );
1885
1932
addr = 0 ;
1886
1933
} else if ((instruction == OSPIF_INST_WSR1)) {
1934
+ <<<<<<< HEAD
1887
1935
=======
1888
1936
=======
1889
1937
>>>>>>> 060eabb... add OSPI HAL and OSPIF driver
@@ -1909,6 +1957,8 @@ ospi_status_t OSPIFBlockDevice::_ospi_send_general_command(ospi_inst_t instructi
1909
1957
=======
1910
1958
} else if ((instruction == OSPIF_INST_WSR1)) {
1911
1959
>>>>>>> 7266070 ... Modify the astyle
1960
+ =======
1961
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1912
1962
addr = 0 ;
1913
1963
}
1914
1964
}
@@ -1922,6 +1972,7 @@ ospi_status_t OSPIFBlockDevice::_ospi_send_general_command(ospi_inst_t instructi
1922
1972
1923
1973
<<<<<<< HEAD
1924
1974
<<<<<<< HEAD
1975
+ <<<<<<< HEAD
1925
1976
<<<<<<< HEAD
1926
1977
if (((_inst_width == OSPI_CFG_BUS_OCTA) || (_inst_width == OSPI_CFG_BUS_OCTA_DTR)) &&
1927
1978
((instruction == OSPIF_INST_RSR1) || (instruction == OSPIF_INST_RDID) ||
@@ -1941,6 +1992,11 @@ ospi_status_t OSPIFBlockDevice::_ospi_send_general_command(ospi_inst_t instructi
1941
1992
((instruction == OSPIF_INST_RSR1) || (instruction == OSPIF_INST_RDID) ||
1942
1993
(instruction == OSPIF_INST_RDCR2) || (instruction == OSPIF_INST_RDCR))) {
1943
1994
>>>>>>> 7266070 ... Modify the astyle
1995
+ =======
1996
+ if (((_inst_width == OSPI_CFG_BUS_OCTA) || (_inst_width == OSPI_CFG_BUS_OCTA_DTR)) &&
1997
+ ((instruction == OSPIF_INST_RSR1) || (instruction == OSPIF_INST_RDID) ||
1998
+ (instruction == OSPIF_INST_RDCR2) || (instruction == OSPIF_INST_RDCR))) {
1999
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1944
2000
_ospi.configure_format (_inst_width, _inst_size, _address_width, _address_size, OSPI_CFG_BUS_SINGLE,
1945
2001
0 , _data_width, 0 );
1946
2002
}
@@ -1957,10 +2013,14 @@ int OSPIFBlockDevice::_ospi_send_read_sfdp_command(bd_addr_t addr, void *rx_buff
1957
2013
if (addr < 30 ) {
1958
2014
<<<<<<< HEAD
1959
2015
<<<<<<< HEAD
2016
+ <<<<<<< HEAD
1960
2017
<<<<<<< HEAD
1961
2018
for (uint8_t i_ind = 0 ; i_ind < rx_len; i_ind++) {
1962
2019
<<<<<<< HEAD
1963
2020
<<<<<<< HEAD
2021
+ =======
2022
+ for (uint8_t i_ind = 0 ; i_ind < rx_len; i_ind++) {
2023
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
1964
2024
*(rx_buffer_tmp + i_ind) = _sfdp_head_table[i_ind + addr];
1965
2025
}
1966
2026
} else if (addr == 0x30 ) {
@@ -1971,6 +2031,7 @@ int OSPIFBlockDevice::_ospi_send_read_sfdp_command(bd_addr_t addr, void *rx_buff
1971
2031
for (uint8_t i_ind = 0 ; i_ind < rx_len; i_ind++) {
1972
2032
*(rx_buffer_tmp + i_ind) = _sfdp_4_byte_inst_table[i_ind];
1973
2033
}
2034
+ <<<<<<< HEAD
1974
2035
=======
1975
2036
=======
1976
2037
>>>>>>> 060eabb... add OSPI HAL and OSPIF driver
@@ -2005,6 +2066,8 @@ int OSPIFBlockDevice::_ospi_send_read_sfdp_command(bd_addr_t addr, void *rx_buff
2005
2066
>>>>>>> 3b8265d... Modify the astyle
2006
2067
}
2007
2068
>>>>>>> 7266070 ... Modify the astyle
2069
+ =======
2070
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
2008
2071
}
2009
2072
} else {
2010
2073
// SFDP read instruction requires 1-1-1 bus mode with 8 dummy cycles and a 3-byte address
@@ -2082,6 +2145,7 @@ ospi_status_t OSPIFBlockDevice::_ospi_write_status_registers(uint8_t *reg_buffer
2082
2145
NULL , 0 );
2083
2146
<<<<<<< HEAD
2084
2147
<<<<<<< HEAD
2148
+ <<<<<<< HEAD
2085
2149
<<<<<<< HEAD
2086
2150
// for octa flash DOPI mode, WRSR just write 1 byte, but the byte number need to even because of protocol
2087
2151
=======
@@ -2093,6 +2157,9 @@ ospi_status_t OSPIFBlockDevice::_ospi_write_status_registers(uint8_t *reg_buffer
2093
2157
=======
2094
2158
// for octa flash DOPI mode, WRSR just write 1 byte, but the byte number need to even because of protocol
2095
2159
>>>>>>> 7266070 ... Modify the astyle
2160
+ =======
2161
+ // for octa flash DOPI mode, WRSR just write 1 byte, but the byte number need to even because of protocol
2162
+ >>>>>>> 197660953e3736e09bf4f46bfc7e57c8f506e304
2096
2163
} else if (_read_instruction == DTROSPIF_INST_READ_OCTA_DTR) {
2097
2164
status = _ospi_send_general_command (OSPIF_INST_WSR1, OSPI_NO_ADDRESS_COMMAND,
2098
2165
(char *) reg_buffer, 2 ,
0 commit comments