Home | History | Annotate | Download | only in boot
      1 /*
      2  * Copyright (C) 2007 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 #include <boot/boot.h>
     18 #include <boot/flash.h>
     19 
     20 ptentry PTABLE[] = {
     21     {
     22         .start = 310,
     23         .length = 40,
     24         .name = "recovery",
     25     },
     26     {
     27         .start = 350,
     28         .length = 20,
     29         .name = "boot",
     30     },
     31     {
     32         .start = 370,
     33         .length = 540,
     34         .name = "system",
     35     },
     36     {
     37         .start = 910,
     38         .length = 1138,
     39         .name = "userdata",
     40     },
     41     {
     42         .start = 0,
     43         .length = 0,
     44         .name = "",
     45     },
     46 };
     47 
     48 #define MISC2_CHARGER_OFF  0x01  /* DISABLE charge circuitry */
     49 #define MISC2_ISET         0x02  /* Enable Current Limit */
     50 
     51 #define MISC2_H2W_MASK     0xC0
     52 #define MISC2_H2W_GPIO     0x00
     53 #define MISC2_H2W_UART1    0x40
     54 #define MISC2_H2W_UART3    0x80
     55 #define MISC2_H2W_BT       0xC0
     56 
     57 void board_init()
     58 {
     59     unsigned n;
     60 
     61     /* if we already have partitions from elsewhere,
     62     ** don't use the hardcoded ones
     63     */
     64     if(flash_get_ptn_count() == 0) {
     65         for(n = 0; PTABLE[n].name[0]; n++) {
     66             flash_add_ptn(PTABLE + n);
     67         }
     68     }
     69 
     70     /* UART configuration */
     71 #if 1
     72         /* UART3 */
     73     writeb(MISC2_H2W_UART3, 0x98000000);
     74     uart_init(2);
     75 #else
     76         /* UART1 */
     77     writeb(MISC2_H2W_UART1, 0x98000000);
     78     uart_init(0);
     79 #endif
     80     mdelay(100);
     81 }
     82 
     83 const char *board_cmdline(void)
     84 {
     85     return "mem=112M console=ttyMSM0 androidboot.console=ttyMSM0";
     86 };
     87 
     88 unsigned board_machtype(void)
     89 {
     90     return 1440;
     91 }
     92 
     93 void board_reboot(void)
     94 {
     95     gpio_set(25, 0);
     96 }
     97 
     98 void board_getvar(const char *name, char *value)
     99 {
    100     if(!strcmp(name, "version.amss")) {
    101         get_version_modem(value);
    102     } else if(!strcmp(name, "version.amss.sbl")) {
    103         get_version_modem_sbl(value);
    104     }
    105 }
    106