change source file mode to 0644 instead of 0755
[profile/mobile/platform/kernel/u-boot-tm1.git] / board / spreadtrum / sp7735ec / openphone.c
1 #include <common.h>
2 #include <asm/io.h>
3 #include <asm/arch/ldo.h>
4 #include <asm/arch/sprd_reg_ahb.h>
5 #include <asm/arch/regs_ahb.h>
6 #include <asm/arch/common.h>
7 #include <asm/arch/adi_hal_internal.h>
8 #include <asm/u-boot.h>
9 #include <part.h>
10 #include <sdhci.h>
11 #include <asm/arch/mfp.h>
12 #include <linux/gpio.h>
13 #include <asm/arch/gpio.h>
14 #include <asm/arch/pinmap.h>
15 DECLARE_GLOBAL_DATA_PTR;
16
17 extern void sprd_gpio_init(void);
18 extern void ADI_init (void);
19 extern int LDO_Init(void);
20 extern void ADC_Init(void);
21 extern int sound_init(void);
22
23 #ifdef CONFIG_GENERIC_MMC
24 int mv_sdh_init(u32 regbase, u32 max_clk, u32 min_clk, u32 quirks);
25 int board_mmc_init(bd_t *bd)
26 {
27         ulong mmc_base_address[CONFIG_SYS_MMC_NUM] = CONFIG_SYS_MMC_BASE;
28         u8 i, data;
29 #ifdef CONFIG_SC8830
30         REG32(AHB_CTL0)     |= BIT_11;
31         REG32(AHB_SOFT_RST) |= BIT_14;
32         for (i=0; i<0x10; i++){}
33         REG32(AHB_SOFT_RST) &= ~BIT_14;
34         
35 #else
36         REG32(AHB_CTL0)     |= BIT_4;
37         REG32(AHB_SOFT_RST) |= BIT_12;
38         REG32(AHB_SOFT_RST) &= ~BIT_12;
39 #endif
40
41 #ifndef CONFIG_SC8830
42         LDO_SetVoltLevel(LDO_LDO_SDIO1, LDO_VOLT_LEVEL1);
43         LDO_TurnOnLDO(LDO_LDO_SDIO1);
44 #endif
45         for (i = 0; i < CONFIG_SYS_MMC_NUM; i++) {
46                 if (mv_sdh_init(mmc_base_address[i], SDIO_BASE_CLK_96M, 
47                         SDIO_CLK_250K, 0))
48                         return 1;
49         }
50
51         return 0;
52 }
53 #endif
54
55 extern struct eic_gpio_resource sprd_gpio_resource[];
56
57 int board_init()
58 {
59         gd->bd->bi_arch_number = MACH_TYPE_OPENPHONE;
60         gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
61         
62         ADI_init();
63         LDO_Init();
64         ADC_Init();
65         pin_init();
66         sprd_eic_init();
67         sprd_gpio_init();
68         sound_init();
69
70         init_ldo_sleep_gr();
71         TDPllRefConfig(1);
72
73         return 0;
74 }
75
76 int dram_init(void)
77 {
78         gd->ram_size = get_ram_size((volatile void *)PHYS_SDRAM_1,
79                         PHYS_SDRAM_1_SIZE);
80         return 0;
81 }