forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/drivers/soc/rockchip/flash_vendor_storage.c
....@@ -23,34 +23,13 @@
2323 #define DLOG(x...)
2424 #endif
2525
26
-struct vendor_item {
27
- u16 id;
28
- u16 offset;
29
- u16 size;
30
- u16 flag;
31
-};
32
-
3326 #define FLASH_VENDOR_PART_START 8
34
-#define FLASH_VENDOR_PART_SIZE 8
3527 #define FLASH_VENDOR_PART_NUM 4
36
-#define FLASH_VENDOR_TAG 0x524B5644
37
-
38
-struct tag_vendor_info {
39
- u32 tag;
40
- u32 version;
41
- u16 next_index;
42
- u16 item_num;
43
- u16 free_offset;
44
- u16 free_size;
45
- struct vendor_item item[62]; /* 62 * 8 */
46
- u8 data[FLASH_VENDOR_PART_SIZE * 512 - 512 - 8];
47
- u32 hash;
48
- u32 version2;
49
-};
28
+#define FLASH_VENDOR_TAG VENDOR_HEAD_TAG
5029
5130 static int (*_flash_read)(u32 sec, u32 n_sec, void *p_data);
5231 static int (*_flash_write)(u32 sec, u32 n_sec, void *p_data);
53
-static struct tag_vendor_info *g_vendor;
32
+static struct flash_vendor_info *g_vendor;
5433
5534 int flash_vendor_dev_ops_register(int (*read)(u32 sec,
5635 u32 n_sec,
....@@ -174,7 +153,8 @@
174153 item->size = size;
175154 memcpy(&p_data[item->offset], pbuf, size);
176155 g_vendor->free_offset = offset + align_size;
177
- g_vendor->free_size = sizeof(g_vendor->data) - g_vendor->free_offset;
156
+ g_vendor->free_size -= (align_size -
157
+ alloc_size);
178158 } else {
179159 memcpy(&p_data[item->offset],
180160 pbuf,
....@@ -359,3 +339,4 @@
359339
360340 device_initcall_sync(vendor_storage_init);
361341 module_exit(vendor_storage_deinit);
342
+MODULE_LICENSE("GPL");