thor: fix invalid larger device descriptor than requested
[profile/mobile/platform/kernel/u-boot-tm1.git] / disk / part_cfg.c
1 #include "part_cfg.h"
2 #include "../drivers/mmc/card_sdio.h"
3
4 PART_DEVICE_IO g_part_device_io =
5 {
6         //emmc_get_id,
7         _get_device_info,
8         _read_block,
9         _write_block
10 };
11
12 PART_DEVICE emmc_part_device={0};
13
14 /**
15  *
16  *      block device access interface
17  *
18 **/
19 unsigned int _get_device_info(unsigned int *total_sector_number)
20 {
21                   *total_sector_number =  Emmc_GetCapacity(0);
22                   return 1;
23 }
24
25 unsigned int _read_block(unsigned int start_sector,unsigned int sector_number,unsigned char *buf)
26 {
27         //emmc read sector 
28
29         if(TRUE == Emmc_Read(0, start_sector, sector_number, buf))
30                         return 1;
31                   else
32                         return -1;
33 }
34
35 unsigned int _write_block(unsigned int start_sector,unsigned int sector_number,unsigned char *buf)
36 {
37         //emmc write sector
38         if(TRUE == Emmc_Write(0, start_sector, sector_number, buf))
39                        return 1;
40                    else
41                         return -1;
42 }
43
44 unsigned int _erase_block(unsigned int start_sector,unsigned int sector_number)
45 {
46         //for nand only
47         if(TRUE == Emmc_Erase(0, start_sector, sector_number))
48                          return 1;
49                    else
50                         return -1;
51 }
52
53 unsigned int emmc_part_device_init()
54 {
55         emmc_part_device._device_io = &g_part_device_io;
56         g_part_device_io._info(&emmc_part_device.total_sector);
57        return 0;
58 }