1.3: update to latest
* - removed other targets from source - removed tinboot like wrapper, now romhdr is in crt0 - power collapse fix - off charge support. - misc partition check removed
This commit is contained in:
parent
72ee75a82d
commit
fc88e6ffb9
6
compile
6
compile
@ -12,7 +12,6 @@ if [ "$1" = "clean" ]; then
|
||||
fi
|
||||
|
||||
rm bin/lk.bin
|
||||
rm bin/tinboot
|
||||
rm bin/os.nb.payload
|
||||
rm bin/os.nb
|
||||
rm bin/RUU_signed.nbh
|
||||
@ -27,18 +26,17 @@ cd lk
|
||||
make htcleo DEBUG=1
|
||||
[ $? -eq 0 ] || exit 1
|
||||
cp build-htcleo/lk.bin ../bin/
|
||||
cp build-htcleo/tinboot ../bin/
|
||||
cd ..
|
||||
|
||||
|
||||
|
||||
cd bin
|
||||
cp template_os.nb.payload os.nb.payload
|
||||
wine osnbtool.exe -c os.nb.payload 0 tinboot
|
||||
wine osnbtool.exe -c os.nb.payload 0 lk.bin
|
||||
mv os.nb.payload.NEW os.nb.payload
|
||||
./nbfix
|
||||
wine NBMerge.exe -kaiser os.nb
|
||||
wine yang.exe -F RUU_signed.nbh -f os.nb -t 0x400 -s 64 -d PB8110000 -c 11111111 -v CLK1.1 -l WWE
|
||||
wine yang.exe -F RUU_signed.nbh -f os.nb -t 0x400 -s 64 -d PB8110000 -c 11111111 -v CLK1.3 -l WWE
|
||||
cd ..
|
||||
|
||||
|
||||
|
@ -49,7 +49,7 @@
|
||||
|
||||
#define EXPAND(NAME) #NAME
|
||||
#define TARGET(NAME) EXPAND(NAME)
|
||||
#define DEFAULT_CMDLINE "console=null";
|
||||
#define DEFAULT_CMDLINE "";
|
||||
|
||||
#ifdef MEMBASE
|
||||
#define EMMC_BOOT_IMG_HEADER_ADDR (0xFF000+(MEMBASE))
|
||||
|
@ -223,6 +223,11 @@ int update_firmware_image (struct update_header *header, char *name)
|
||||
|
||||
int recovery_init (void)
|
||||
{
|
||||
/** cedesmith: we can't update radio like native android phones
|
||||
* so there is no need for misc partition just to boot recovery
|
||||
*/
|
||||
return -1;
|
||||
|
||||
struct recovery_message msg;
|
||||
struct update_header header;
|
||||
char partition_name[32];
|
||||
|
@ -36,6 +36,42 @@ _start:
|
||||
b arm_irq
|
||||
b arm_fiq
|
||||
|
||||
#ifdef WSPL_VADDR
|
||||
//if LK is loaded by wince spl add romhdr
|
||||
.org 0x40
|
||||
.word 0x43454345
|
||||
.word (romhdr-_start)+WSPL_VADDR // virtual address of romhdr
|
||||
//.word romhdr+0x96C00000 // virtual address of romhdr
|
||||
.word romhdr-_start // file address of romhdr
|
||||
|
||||
.org 0x00000900
|
||||
romhdr:
|
||||
.word 0x2000000 // dllfirst
|
||||
.word 0x2000000 // dlllast
|
||||
.word WSPL_VADDR // physfirst
|
||||
.word WSPL_VADDR+(_end-_start) // physlast
|
||||
.word 0 // nummods (no TOCentry after ROMHDR)
|
||||
.word WSPL_VADDR+(_end-_start) // ulRAMStart
|
||||
.word WSPL_VADDR+(_end-_start) // ulRAMFree
|
||||
.word WSPL_VADDR+MEMSIZE // ulRAMEnd
|
||||
.word 0 // ulCopyEntries
|
||||
.word 0 // ulCopyOffset
|
||||
.word 0 // ulProfileLen
|
||||
.word 0 // ulProfileOffset
|
||||
.word 0 // numfiles
|
||||
.word 0 // ulKernelFlags
|
||||
.word 0x80808080 // ulFSRamPercent
|
||||
.word 0 // ulDrivglobStart
|
||||
.word 0 // ulDrivglobLen
|
||||
.hword 0x1C2 // usCPUType
|
||||
.hword 0x2 // usMiscFlags
|
||||
.word 0 // pExtensions
|
||||
.word 0 // ulTrackingStart
|
||||
.word 0 // ulTrackingLen
|
||||
.org 0x00001000
|
||||
#endif
|
||||
|
||||
|
||||
reset:
|
||||
/* do some cpu setup */
|
||||
#if ARM_WITH_CP15
|
||||
@ -73,9 +109,13 @@ reset:
|
||||
#endif
|
||||
|
||||
/* see if we need to relocate */
|
||||
ldr r1, = .Laddr
|
||||
ldr r0, = _start
|
||||
sub r1, r1, r0
|
||||
mov r0, pc
|
||||
sub r0, r0, #(.Laddr - _start)
|
||||
sub r0, r0, r1 //#(.Laddr - _start)
|
||||
.Laddr:
|
||||
str r0, load_address
|
||||
ldr r1, =_start
|
||||
cmp r0, r1
|
||||
beq .Lstack_setup
|
||||
@ -99,6 +139,10 @@ warm_boot_tag:
|
||||
.word 0
|
||||
#endif
|
||||
|
||||
.global load_address
|
||||
load_address:
|
||||
.word 0
|
||||
|
||||
.Lstack_setup:
|
||||
/* set up the stack for irq, fiq, abort, undefined, system/user, and lastly supervisor mode */
|
||||
mrs r0, cpsr
|
||||
|
@ -1,6 +0,0 @@
|
||||
# mostly null target configuration for the arm emulator, since there's only one real
|
||||
# implementation.
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
PLATFORM := armemu
|
||||
|
@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#ifndef __TARGET_DEBUGCONFIG_H
|
||||
#define __TARGET_DEBUGCONFIG_H
|
||||
|
||||
#define DEBUG_UART 2
|
||||
|
||||
#endif
|
@ -1,15 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += \
|
||||
-I$(LOCAL_DIR)/include
|
||||
|
||||
PLATFORM := omap3
|
||||
|
||||
MODULES += \
|
||||
dev/pmic/twl4030
|
||||
|
||||
MEMSIZE := 0x08000000 # 128MB
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE)
|
||||
|
@ -1,14 +1,7 @@
|
||||
|
||||
//cedesmith: from kernel board-htcleo.
|
||||
#define MSM_EBI1_BANK0_BASE 0x11800000
|
||||
//#define MSM_EBI1_BANK0_SIZE 0x1E800000 /* 488MB */
|
||||
//CONFIG_USING_BRAVOS_DSP
|
||||
//#define MSM_EBI1_BANK0_SIZE 0x1CFC0000 /* 488MB - DESIRE DSP - 0x00040000 RAM CONSOLE*/
|
||||
#define MSM_EBI1_BANK0_SIZE 0x1E7C0000 /* 488MB - 0x00040000 RAM CONSOLE*/
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
|
||||
#if 0
|
||||
//MEM TAG
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
@ -16,13 +9,13 @@ unsigned* target_atag_mem(unsigned* ptr)
|
||||
//*ptr++ = 0x1E7C0000; //mem size from kernel config
|
||||
*ptr++ = 0x1CFC0000; //mem size from kernel config with bravo dsp
|
||||
*ptr++ = 0x11800000; //mem base
|
||||
|
||||
#endif
|
||||
|
||||
//add atag to notify nand boot
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x4C47414D;
|
||||
*ptr++ = 0;
|
||||
*ptr++ = 0;
|
||||
*ptr++ = 0x4C47414D; // NAND atag (MAGL :))
|
||||
*ptr++ = 0x004b4c63; // cLK signature
|
||||
*ptr++ = 13; // cLK version number
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
#include <platform/iomap.h>
|
||||
#include <reg.h>
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <arch/arm.h>
|
||||
|
||||
// cedesmith: we need to stop interrupts or kernel will receive dex interrupt to early and crash
|
||||
#define VIC_REG(off) (MSM_VIC_BASE + (off))
|
||||
|
@ -6,12 +6,52 @@ htcleo_boot_s:
|
||||
// save registers
|
||||
MOV r9, r0
|
||||
|
||||
//cedesmith: cotulla's code so kernel will not crash. aux control register
|
||||
//cedesmith:
|
||||
// cotulla's code so kernel will not crash. aux control register
|
||||
// found more info here: http://www.spinics.net/lists/linux-arm-msm/msg00492.html
|
||||
// it looks it is Martijn Stolk's code
|
||||
MRC p15, 0, r0, c1, c0, 1
|
||||
BIC r0, r0, #0x40 // (1<<6) Instruction cache reload on a parity error disabled
|
||||
BIC r0, r0, #0x200000 // (1<<21) undocumented bit ?
|
||||
BIC r0, r0, #0x40 //; (1<<6) IBE (0 = executes the CP15 Invalidate All and Invalidate by MVA instructions as a NOP instruction, reset value)
|
||||
BIC r0, r0, #0x200000 //; (1<<21) undocumented bit
|
||||
MCR p15, 0, r0, c1, c0, 1
|
||||
|
||||
//; Disable VFP
|
||||
MOV R0, #0
|
||||
FMXR FPEXC, r0
|
||||
|
||||
//; ICIALL to invalidate entire I-Cache
|
||||
MCR p15, 0, r0, c7, c5, 0 //; ICIALLU
|
||||
|
||||
// disable dcache and i cache
|
||||
MRC p15, 0, r0, c1, c0, 0
|
||||
BIC r0, r0, #(1<<0) // disable mmu ( already disabled )
|
||||
BIC r0, r0, #(1<<2) // disable data cache
|
||||
BIC r0, r0, #(1<<12) // disable instruction cache
|
||||
MCR p15, 0, r0, c1, c0, 0
|
||||
ISB
|
||||
|
||||
//; DCIALL to invalidate L2 cache bank (needs to be run 4 times, once per bank)
|
||||
//; This must be done early in code (prior to enabling the caches)
|
||||
MOV r0, #0x2
|
||||
MCR p15, 0, r0, c9, c0, 6 //; DCIALL bank D ([15:14] == 2'b00)
|
||||
ORR r0, r0, #0x00004000
|
||||
MCR p15, 0, r0, c9, c0, 6 //; DCIALL bank C ([15:14] == 2'b01)
|
||||
ADD r0, r0, #0x00004000
|
||||
MCR p15, 0, r0, c9, c0, 6 //; DCIALL bank B ([15:14] == 2'b10)
|
||||
ADD r0, r0, #0x00004000
|
||||
MCR p15, 0, r0, c9, c0, 6 //; DCIALL bank A ([15:14] == 2'b11)
|
||||
//; DCIALL to invalidate entire D-Cache
|
||||
MOV r0, #0
|
||||
MCR p15, 0, r0, c9, c0, 6 //; DCIALL r0
|
||||
DSB
|
||||
ISB
|
||||
|
||||
//; Invalidate the UTLB
|
||||
MOV r0, #0
|
||||
MCR p15, 0, r0, c8, c7, 0 //; UTLBIALL
|
||||
ISB
|
||||
|
||||
|
||||
//flashlight to see we get here
|
||||
//ldr r4, =0xa9000864 @ bank6_in (phys)
|
||||
//ldr r5, =0xa9000814 @ bank6_out (phys)
|
||||
@ -22,3 +62,15 @@ htcleo_boot_s:
|
||||
BLX R9
|
||||
|
||||
.ltorg
|
||||
|
||||
// code to put at 0, get opcode from debug.lst
|
||||
.global pc_reset_vector
|
||||
.global pc_reset_vector_end
|
||||
pc_reset_vector:
|
||||
mov r0, #0x11800000
|
||||
ldr pc, [r0, #4]
|
||||
//mov pc, #MEMBASE
|
||||
#ldr pc, #MEMBASE
|
||||
BX LR
|
||||
pc_reset_vector_end:
|
||||
.ltorg
|
||||
|
@ -19,8 +19,7 @@
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
// align data on a 512 boundary so will not be interrupted in nbh
|
||||
#if 1
|
||||
//generic partition table
|
||||
#ifdef SYSTEM_PARTITION_SIZE
|
||||
static struct ptentry board_part_list[MAX_PTABLE_PARTS] __attribute__ ((aligned (512))) = {
|
||||
{
|
||||
.name = "PTABLE-MB", // PTABLE-BLK or PTABLE-MB for length in MB or BLOCKS
|
||||
@ -35,10 +34,10 @@ static struct ptentry board_part_list[MAX_PTABLE_PARTS] __attribute__ ((aligned
|
||||
},
|
||||
{
|
||||
.name = "system",
|
||||
.length = 250 /* In MB */,
|
||||
.length = SYSTEM_PARTITION_SIZE /* In MB */,
|
||||
},
|
||||
{
|
||||
.length = 10 /* In MB */,
|
||||
.length = 44 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
@ -48,6 +47,12 @@ static struct ptentry board_part_list[MAX_PTABLE_PARTS] __attribute__ ((aligned
|
||||
#else
|
||||
// partition table matching gau desire hd on my (cedesmith) phone
|
||||
// allows me to just swap bootloader from magldr to clk and viceversa
|
||||
/*
|
||||
clk_recovery | 28 | 28 | 219 | 53 | 9
|
||||
clk_boot | 28 | 28 | 241 | 53 | 9
|
||||
system | 68B | 68A | 269 | 61 | 9
|
||||
userdata | 64C | 64C | 8F4 | 50 | 11
|
||||
*/
|
||||
static struct ptentry board_part_list[MAX_PTABLE_PARTS] __attribute__ ((aligned (512))) = {
|
||||
{
|
||||
.name = "PTABLE-BLK", // or PTABLE-MB for len in MB
|
||||
@ -74,10 +79,14 @@ static struct ptentry board_part_list[MAX_PTABLE_PARTS] __attribute__ ((aligned
|
||||
},
|
||||
};
|
||||
#endif
|
||||
|
||||
|
||||
static unsigned num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
//#define part_empty(p) (p->name[0]==0 && p->start==0 && p->length==0 && p->flags==0 && p->type==0 && p->perm==0)
|
||||
#define IS_PART_EMPTY(p) (p->name[0]==0)
|
||||
|
||||
extern unsigned load_address;
|
||||
extern unsigned boot_into_recovery;
|
||||
|
||||
void keypad_init(void);
|
||||
void display_init(void);
|
||||
@ -93,12 +102,9 @@ void target_init(void)
|
||||
unsigned blocks_per_plen = 1; //blocks per partition length
|
||||
unsigned nand_num_blocks;
|
||||
|
||||
|
||||
keys_init();
|
||||
keypad_init();
|
||||
|
||||
|
||||
|
||||
uint16_t keys[] = {KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_SOFT1, KEY_SEND, KEY_CLEAR, KEY_BACK, KEY_HOME};
|
||||
for(unsigned i=0; i< sizeof(keys)/sizeof(uint16_t); i++)
|
||||
if (keys_get_state(keys[i]) != 0)
|
||||
@ -110,17 +116,13 @@ void target_init(void)
|
||||
}
|
||||
dprintf(INFO, "htcleo_init\n");
|
||||
|
||||
// When boot mode is 1 it hangs
|
||||
if(/*get_boot_reason()==1 ||*/ get_boot_reason()==2)
|
||||
if(get_boot_reason()==2) // booting for offmode charging, start recovery so kernel will charge phone
|
||||
{
|
||||
dprintf(INFO, "reboot needed... \n");
|
||||
reboot(0);
|
||||
boot_into_recovery = 1;
|
||||
//dprintf(INFO, "reboot needed... \n");
|
||||
//reboot(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* cedesmith notes:
|
||||
* DON'T use smem_ptable_init and smem_get_apps_flash_start as 0:APPS points to wrong place
|
||||
*/
|
||||
dprintf(ALWAYS, "load address %x\n", load_address);
|
||||
|
||||
dprintf(INFO, "flash init\n");
|
||||
flash_init();
|
||||
@ -131,10 +133,8 @@ void target_init(void)
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
|
||||
// cedesmith:DON'T USE SMEM ptable
|
||||
|
||||
if( strcmp(board_part_list[0].name,"PTABLE-BLK")==0 ) blocks_per_plen =1 ;
|
||||
else if( strcmp(board_part_list[0].name,"PTABLE-MB")==0 ) blocks_per_plen = (1024*1024) /flash_info->block_size;
|
||||
else if( strcmp(board_part_list[0].name,"PTABLE-MB")==0 ) blocks_per_plen = (1024*1024)/flash_info->block_size;
|
||||
else panic("Invalid partition table\n");
|
||||
|
||||
start_block = HTCLEO_FLASH_OFFSET;
|
||||
@ -175,7 +175,12 @@ void target_init(void)
|
||||
htcleo_ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
void target_early_init(void)
|
||||
{
|
||||
//cedesmith: write reset vector while we can as MPU kicks in after flash_init();
|
||||
writel(0xe3a00546, 0); //mov r0, #0x11800000
|
||||
writel(0xe590f004, 4); //ldr r15, [r0, #4]
|
||||
}
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
@ -196,6 +201,8 @@ unsigned get_boot_reason(void)
|
||||
}
|
||||
return boot_reason;
|
||||
}
|
||||
|
||||
|
||||
unsigned target_pause_for_battery_charge(void)
|
||||
{
|
||||
if (get_boot_reason() == 2) return 1;
|
||||
|
@ -1,43 +1,8 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/*
|
||||
* cedesmith
|
||||
* NOTE: htcleo kernel differs by having row swapped to col
|
||||
*/
|
||||
static unsigned int htcleo_row_gpios[] = { 33, 32, 31 };
|
||||
static unsigned int htcleo_col_gpios[] = { 42, 41, 40 };
|
||||
|
||||
@ -46,14 +11,14 @@ static unsigned int htcleo_col_gpios[] = { 42, 41, 40 };
|
||||
static const unsigned short htcleo_keymap[ARRAY_SIZE(htcleo_col_gpios) * ARRAY_SIZE(htcleo_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_VOLUMEUP, // Volume Up
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_VOLUMEDOWN, // Volume Down
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_SOFT1, // Windows Button
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND, // Dial Button
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_CLEAR, // Hangup Button
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_BACK, // Back Button
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, // Home Button
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_SOFT1, // Windows Button
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_SEND, // Dial Button
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_CLEAR, // Hangup Button
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_BACK, // Back Button
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, // Home Button
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
static struct gpio_keypad_info htcleo_keypad_info = {
|
||||
.keymap = htcleo_keymap,
|
||||
.output_gpios = htcleo_row_gpios,
|
||||
.input_gpios = htcleo_col_gpios,
|
||||
@ -66,5 +31,5 @@ static struct gpio_keypad_info halibut_keypad_info = {
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
gpio_keypad_init(&htcleo_keypad_info);
|
||||
}
|
||||
|
@ -4,17 +4,27 @@ INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := qsd8k
|
||||
|
||||
#define system partition size (in MB), if not defined my custom (from magldr) layout is used. see init.c
|
||||
#DEFINES += SYSTEM_PARTITION_SIZE=150
|
||||
DEFINES += SYSTEM_PARTITION_SIZE=250
|
||||
|
||||
#cedesmith note: MEMBASE requires edit in platform/qsd8k/rules.mk
|
||||
#MEMBASE := 0x20000000
|
||||
#MEMBASE := 0x27000000
|
||||
MEMBASE := 0x2E000000
|
||||
#MEMSIZE := 0x00100000
|
||||
MEMSIZE := 0x00800000
|
||||
#MEMBASE := 0x2E000000
|
||||
#MEMSIZE := 0x00800000
|
||||
|
||||
# maximum partition size will be about 340mb ( MEMBASE-SCRATCH_ADDR)
|
||||
MEMBASE := 0x28000000
|
||||
MEMSIZE := 0x00100000
|
||||
#SPL virtual address where LK is loaded
|
||||
#DEFINES += WSPL_VADDR=0x80000000
|
||||
#SPL 0x26600000=>0x95100000 so VADDR = (0x28000000-0x26600000)+0x95100000
|
||||
DEFINES += WSPL_VADDR=0x96B00000
|
||||
#SPL 0x28500000=>0x98B00000
|
||||
|
||||
|
||||
BASE_ADDR := 0x11800000
|
||||
|
||||
TAGS_ADDR := "(BASE_ADDR+0x00000100)"
|
||||
KERNEL_ADDR := "(BASE_ADDR+0x00008000)"
|
||||
RAMDISK_ADDR := "(BASE_ADDR+0x00a00000)"
|
||||
@ -40,8 +50,11 @@ MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
|
||||
|
||||
DEFINES += \
|
||||
MEMBASE=$(MEMBASE)\
|
||||
MEMSIZE=$(MEMSIZE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
@ -55,4 +68,5 @@ OBJS += \
|
||||
$(LOCAL_DIR)/atags.o
|
||||
|
||||
OBJS += $(LOCAL_DIR)/htcleo_boot.o \
|
||||
$(LOCAL_DIR)/htcleo_boot_s.o
|
||||
$(LOCAL_DIR)/htcleo_boot_s.o
|
||||
|
||||
|
@ -1,17 +1 @@
|
||||
#Makefile to generate tinboot
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
EXTRA_CLEANDEPS += tinboot_clean
|
||||
|
||||
APPSBOOTHEADER: $(BUILDDIR)/tinboot
|
||||
|
||||
$(BUILDDIR)/tinboot.o: $(SRC_DIR)/tinboot.S $(OUTBIN)
|
||||
$(TOOLCHAIN_PREFIX)as $(SRC_DIR)/tinboot.S -I "$(BUILDDIR)" -o $(BUILDDIR)/tinboot.o
|
||||
|
||||
$(BUILDDIR)/tinboot: $(BUILDDIR)/tinboot.o
|
||||
$(OBJCOPY) $(BUILDDIR)/tinboot.o -O binary $(BUILDDIR)/tinboot
|
||||
|
||||
|
||||
|
||||
tinboot_clean:
|
||||
rm -f $(BUILDDIR)/tinboot.o $(BUILDDIR)/tinboot
|
||||
APPSBOOTHEADER:
|
||||
|
@ -1,32 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
return ptr;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_MSM7625_FFA_DISPLAY_H
|
||||
#define _TARGET_MSM7625_FFA_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 480
|
||||
#define TARGET_YRES 800
|
||||
|
||||
#define LCDC_FB_WIDTH 480
|
||||
#define LCDC_FB_HEIGHT 640
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 144
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 33
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 2
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 2
|
||||
|
||||
#endif
|
@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2704
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 95 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 2 /* In MB */,
|
||||
.name = "persist",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
int target_is_emmc_boot(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
|
||||
if (target_is_emmc_boot())
|
||||
return;
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
//[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
//[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_SEND,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_VOLUMEUP,
|
||||
//[KEYMAP_INDEX(1, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_6,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_HOME, /* A */
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_BACK, /* B */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_0,
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CENTER,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
//[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_SOUND,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_8,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_5,
|
||||
|
||||
//[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_STAR,
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_SOFT2,
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_MENU,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := msm7k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x02008000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_TYPE_MDDI=0
|
||||
DEFINES += ENABLE_PLL3=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/keypad.o \
|
||||
$(LOCAL_DIR)/atags.o
|
@ -1,38 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN emmc_appsboothd.mbn
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn appsboothd.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
appsboot.mbn: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn unified-boot
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
|
@ -1,87 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00500000; /* 5M for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
return ptr;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_MSM7625_SURF_DISPLAY_H
|
||||
#define _TARGET_MSM7625_SURF_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 800
|
||||
#define TARGET_YRES 480
|
||||
|
||||
#define LCDC_FB_WIDTH 800
|
||||
#define LCDC_FB_HEIGHT 480
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 20
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 27
|
||||
|
||||
#endif
|
@ -1,192 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2703
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 95 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 2 /* In MB */,
|
||||
.name = "persist",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
int target_is_emmc_boot(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
|
||||
if (target_is_emmc_boot())
|
||||
return;
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_SOFT1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_6,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_0,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_SEND,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, /* FA */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_F8, /* QCHT */
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_F6, /* R+ */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_F7, /* R- */
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_SOFT2, /* SOFT2 */
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_CENTER, /* KEY_CENTER */
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_BACK, /* FB */
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_STAR, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_MAIL, /* MESG */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_3,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := msm7k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x02008000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_TYPE_MDDI=0
|
||||
DEFINES += ENABLE_PLL3=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/keypad.o \
|
||||
$(LOCAL_DIR)/atags.o
|
@ -1,37 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN emmc_appsboothd.mbn
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn appsboothd.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
appsboot.mbn: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn unified-boot
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
@ -1,87 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00500000; /* 5M for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
#include <debug.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define SIZE_1M 0x00100000
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
struct smem_ram_ptable ram_ptable;
|
||||
unsigned i = 0;
|
||||
|
||||
if (smem_ram_ptable_init(&ram_ptable))
|
||||
{
|
||||
for (i = 0; i < ram_ptable.len; i++)
|
||||
{
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].start != 0x0)
|
||||
&& (!(ram_ptable.parts[i].size < SIZE_1M)))
|
||||
{
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
/* FIXME: RAM partition table currently reports 2M extra
|
||||
Fix this by subracting 2M, until modem ram partition table
|
||||
starts reporting the right values */
|
||||
*ptr++ = ram_ptable.parts[i].size - (2*SIZE_1M);
|
||||
*ptr++ = ram_ptable.parts[i].start;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: Unable to read RAM partition\n");
|
||||
ASSERT(0);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_MSM7627_FFA_DISPLAY_H
|
||||
#define _TARGET_MSM7627_FFA_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 480
|
||||
#define TARGET_YRES 640
|
||||
|
||||
#define LCDC_FB_WIDTH 480
|
||||
#define LCDC_FB_HEIGHT 640
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 144
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 33
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 2
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 2
|
||||
|
||||
#endif
|
@ -1,219 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2706
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 105 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 2 /* In MB */,
|
||||
.name = "persist",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
int target_is_emmc_boot(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
|
||||
if (target_is_emmc_boot())
|
||||
return;
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
static unsigned target_check_power_on_reason(void)
|
||||
{
|
||||
unsigned power_on_status = 0;
|
||||
unsigned int status_len = sizeof(power_on_status);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_POWER_ON_STATUS_INFO,
|
||||
&power_on_status, status_len);
|
||||
if (!smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for power on reason\n");
|
||||
}
|
||||
|
||||
return power_on_status;
|
||||
}
|
||||
|
||||
unsigned target_pause_for_battery_charge(void)
|
||||
{
|
||||
if (target_check_power_on_reason() == PWR_ON_EVENT_USB_CHG)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
//[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
//[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_SEND,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_VOLUMEUP,
|
||||
//[KEYMAP_INDEX(1, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_6,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_HOME, /* A */
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_BACK, /* B */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_0,
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CENTER,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
//[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_SOUND,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_8,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_5,
|
||||
|
||||
//[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_STAR,
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_SOFT2,
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_MENU,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := msm7k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x04000000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_TYPE_MDDI=0
|
||||
DEFINES += DISPLAY_TYPE_LCDC=1
|
||||
|
||||
DEFINES += DISPLAY_SPLASH_SCREEN=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/keypad.o \
|
||||
$(LOCAL_DIR)/atags.o
|
@ -1,39 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN emmc_appsboothd.mbn
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn appsboothd.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
appsboot.mbn: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboot.mbn
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn unified-boot
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
|
@ -1,87 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00000000; /* not setting size for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,72 +0,0 @@
|
||||
/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
#include <debug.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define SIZE_1M 0x00100000
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
struct smem_ram_ptable ram_ptable;
|
||||
unsigned i = 0;
|
||||
|
||||
if (smem_ram_ptable_init(&ram_ptable))
|
||||
{
|
||||
for (i = 0; i < ram_ptable.len; i++)
|
||||
{
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].start != 0x0)
|
||||
&& (!(ram_ptable.parts[i].size < SIZE_1M)))
|
||||
{
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
/* FIXME: RAM partition table currently reports 2M extra
|
||||
Fix this by subracting 2M, until modem ram partition table
|
||||
starts reporting the right values. Also need fixes for
|
||||
RAM partition table to have emmc entries correct */
|
||||
if (target_is_emmc_boot())
|
||||
*ptr++ = ram_ptable.parts[i].size - (2*SIZE_1M) - (6*SIZE_1M);
|
||||
else
|
||||
*ptr++ = ram_ptable.parts[i].size - (2*SIZE_1M);
|
||||
|
||||
*ptr++ = ram_ptable.parts[i].start;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: Unable to read RAM partition\n");
|
||||
ASSERT(0);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_MSM7627_SURF_DISPLAY_H
|
||||
#define _TARGET_MSM7627_SURF_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 800
|
||||
#define TARGET_YRES 480
|
||||
|
||||
#define LCDC_FB_WIDTH 800
|
||||
#define LCDC_FB_HEIGHT 480
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 20
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 27
|
||||
|
||||
#endif
|
@ -1,227 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
#include <platform/iomap.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2705
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 105 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 2 /* In MB */,
|
||||
.name = "persist",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
int target_is_emmc_boot(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
|
||||
if (target_is_emmc_boot())
|
||||
{
|
||||
if(mmc_boot_main(MMC_SLOT, MSM_SDC1_BASE))
|
||||
{
|
||||
dprintf(CRITICAL, "mmc init failed!");
|
||||
ASSERT(0);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
static unsigned target_check_power_on_reason(void)
|
||||
{
|
||||
unsigned power_on_status = 0;
|
||||
unsigned int status_len = sizeof(power_on_status);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_POWER_ON_STATUS_INFO,
|
||||
&power_on_status, status_len);
|
||||
if (!smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for power on reason\n");
|
||||
}
|
||||
|
||||
return power_on_status;
|
||||
}
|
||||
|
||||
unsigned target_pause_for_battery_charge(void)
|
||||
{
|
||||
if (target_check_power_on_reason() == PWR_ON_EVENT_USB_CHG)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_SOFT1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_6,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_0,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_SEND,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, /* FA */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_F8, /* QCHT */
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_F6, /* R+ */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_F7, /* R- */
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_SOFT2, /* SOFT2 */
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_CENTER, /* KEY_CENTER */
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_BACK, /* FB */
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_STAR, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_MAIL, /* MESG */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_3,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := msm7k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x04000000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_TYPE_MDDI=0
|
||||
DEFINES += DISPLAY_TYPE_LCDC=1
|
||||
DEFINES += DISPLAY_SPLASH_SCREEN=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/keypad.o \
|
||||
$(LOCAL_DIR)/atags.o
|
@ -1,38 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN emmc_appsboothd.mbn
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn appsboothd.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
appsboot.mbn: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: $(OUTBIN)
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
cp -f $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboot.mbn
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn unified-boot
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
@ -1,87 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00000000; /* not setting size for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,119 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
#include <debug.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define EBI1_ADDR_128M 0x08000000
|
||||
#define SIZE_256M 0x10000000
|
||||
#define SIZE_128M 0x08000000
|
||||
#define SIZE_1M 0x00100000
|
||||
|
||||
static int scratch_addr = -1;
|
||||
int smem_ram_ptable_init(struct smem_ram_ptable *);
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
struct smem_ram_ptable ram_ptable;
|
||||
unsigned i = 0;
|
||||
|
||||
if (smem_ram_ptable_init(&ram_ptable))
|
||||
{
|
||||
for (i = 0; i < ram_ptable.len; i++)
|
||||
{
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].start != 0x0)
|
||||
&& (!(ram_ptable.parts[i].size < SIZE_1M)))
|
||||
{
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
// Tag EBI-1 memory as unstable.
|
||||
if(ram_ptable.parts[i].category == EBI1_CS0) {
|
||||
// if EBI-1 CS-0 is 256Mb then this is a 2x256 target and
|
||||
// the kernel can reserve this mem region as unstable.
|
||||
// This memory region can be activated when the kernel
|
||||
// receives a request from Android init scripts.
|
||||
if(ram_ptable.parts[i].size == SIZE_256M)
|
||||
*ptr++ = 0x5441000A; //Deep-Power-Down Tag.
|
||||
|
||||
//if EBI-1 CS-0 s 128Mb then this is a 2x128 target.
|
||||
//Android + Kernel + PMEM regions account for more than
|
||||
//128Mb and the target will not be able to boot with just
|
||||
//one memory bank active and the second memory bank is reserved.
|
||||
//In the case of 2x128 the tag is set to SelfRefresh Only.
|
||||
else if(ram_ptable.parts[i].size == SIZE_128M)
|
||||
*ptr++ = 0x5441000B; //Self-Refresh Tag.
|
||||
}
|
||||
else
|
||||
*ptr++ = 0x54410002;
|
||||
|
||||
*ptr++ = ram_ptable.parts[i].size;
|
||||
*ptr++ = ram_ptable.parts[i].start;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: Unable to read RAM partition\n");
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *target_get_scratch_address(void)
|
||||
{
|
||||
struct smem_ram_ptable ram_ptable;
|
||||
unsigned i = 0;
|
||||
|
||||
if (smem_ram_ptable_init(&ram_ptable))
|
||||
{
|
||||
for (i = 0; i < ram_ptable.len; i++)
|
||||
{
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].start != 0x0))
|
||||
{
|
||||
if (ram_ptable.parts[i].size >= FASTBOOT_BUF_SIZE)
|
||||
{
|
||||
scratch_addr = ram_ptable.parts[i].start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: Unable to read RAM partition\n");
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
return (void *)((scratch_addr == -1) ? EBI1_ADDR_128M : scratch_addr);
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_MSM7630_SURF_DISPLAY_H
|
||||
#define _TARGET_MSM7630_SURF_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 480
|
||||
#define TARGET_YRES 800
|
||||
|
||||
#define LCDC_FB_WIDTH 480
|
||||
#define LCDC_FB_HEIGHT 800
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 8
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 184
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 4
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 1
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 2
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 3
|
||||
|
||||
#endif
|
@ -1,271 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE_7x30_SURF 2679
|
||||
#define LINUX_MACHTYPE_7x30_FFA 2707
|
||||
#define LINUX_MACHTYPE_7x30_FLUID 2741
|
||||
#define LINUX_MACHTYPE_8x55_SURF 2768
|
||||
#define LINUX_MACHTYPE_8x55_FFA 2769
|
||||
|
||||
#define MSM8255_ID 74
|
||||
#define MSM8655_ID 75
|
||||
#define APQ8055_ID 85
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
static int hw_platform_type = -1;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 20 /* 5MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = 20,
|
||||
.length = 480 /* 120MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = 500,
|
||||
.length = 120 /* 30MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = 620,
|
||||
.length = 4, /* 1MB */
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = 624,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 12 /* 3MB */,
|
||||
.name = "persist",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 20 /* 5MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
static int emmc_boot = -1; /* set to uninitialized */
|
||||
int target_is_emmc_boot(void);
|
||||
static int platform_version = -1;
|
||||
static int target_msm_id = -1;
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
bool start_addr_changed = false;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
|
||||
if (target_is_emmc_boot())
|
||||
return;
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ptn->length;
|
||||
|
||||
if(len == VARIABLE_LENGTH)
|
||||
{
|
||||
start_addr_changed = true;
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += temp_ptn->length;
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
}
|
||||
if((ptn->start == DIFF_START_ADDR) && (start_addr_changed))
|
||||
{
|
||||
ASSERT(next_ptr_start_adr);
|
||||
ptn->start = next_ptr_start_adr;
|
||||
next_ptr_start_adr = ptn->start + ptn->length;
|
||||
}
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
int target_platform_version(void)
|
||||
{
|
||||
return platform_version;
|
||||
}
|
||||
|
||||
int target_is_msm8x55(void)
|
||||
{
|
||||
if ((target_msm_id == MSM8255_ID) ||
|
||||
(target_msm_id == MSM8655_ID) ||
|
||||
(target_msm_id == APQ8055_ID))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
struct smem_board_info_v4 board_info_v4;
|
||||
unsigned int board_info_len = 0;
|
||||
enum platform platform_type = 0;
|
||||
unsigned smem_status;
|
||||
unsigned format = 0;
|
||||
if(hw_platform_type != -1)
|
||||
return hw_platform_type;
|
||||
|
||||
smem_status = smem_read_alloc_entry_offset(SMEM_BOARD_INFO_LOCATION,
|
||||
&format, sizeof(format), 0);
|
||||
if(!smem_status)
|
||||
{
|
||||
if ((format == 3) || (format == 4))
|
||||
{
|
||||
if (format == 4)
|
||||
board_info_len = sizeof(board_info_v4);
|
||||
else
|
||||
board_info_len = sizeof(board_info_v4.board_info_v3);
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION,
|
||||
&board_info_v4, board_info_len);
|
||||
if(!smem_status)
|
||||
{
|
||||
if(format == 4)
|
||||
platform_version = board_info_v4.platform_version;
|
||||
|
||||
platform_type = board_info_v4.board_info_v3.hw_platform;
|
||||
target_msm_id = board_info_v4.board_info_v3.msm_id;
|
||||
switch (platform_type)
|
||||
{
|
||||
case HW_PLATFORM_SURF:
|
||||
hw_platform_type = ((target_is_msm8x55()) ?
|
||||
LINUX_MACHTYPE_8x55_SURF : LINUX_MACHTYPE_7x30_SURF); break;
|
||||
case HW_PLATFORM_FFA:
|
||||
hw_platform_type = ((target_is_msm8x55()) ?
|
||||
LINUX_MACHTYPE_8x55_FFA : LINUX_MACHTYPE_7x30_FFA); break;
|
||||
case HW_PLATFORM_FLUID:
|
||||
hw_platform_type = LINUX_MACHTYPE_7x30_FLUID; break;
|
||||
default:
|
||||
hw_platform_type = ((target_is_msm8x55()) ?
|
||||
LINUX_MACHTYPE_8x55_SURF : LINUX_MACHTYPE_7x30_SURF); break;
|
||||
}
|
||||
return hw_platform_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
hw_platform_type = LINUX_MACHTYPE_7x30_SURF;
|
||||
return hw_platform_type;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
#define BITS_IN_ELEMENT(x) (sizeof(x)[0] * 8)
|
||||
|
||||
static unsigned char qwerty_keys_old[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static unsigned char qwerty_keys_new[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#define KEYMAP_INDEX(row, col) (row)* BITS_IN_ELEMENT(qwerty_keys_new) + (col)
|
||||
|
||||
static unsigned int qwerty_keymap[] = {
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_BACK, /* -L on SURF & FFA */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_HOME, /* +R on SURF & FFA */
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_CLEAR, /* '-' of left side switch on FLUID */
|
||||
};
|
||||
|
||||
static struct qwerty_keypad_info qwerty_keypad = {
|
||||
.keymap = qwerty_keymap,
|
||||
.old_keys = qwerty_keys_old,
|
||||
.rec_keys = qwerty_keys_new,
|
||||
.rows = 5,
|
||||
.columns = 5,
|
||||
.num_of_reads = 6,
|
||||
.rd_func = &i2c_ssbi_read_bytes,
|
||||
.wr_func = &i2c_ssbi_write_bytes,
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
ssbi_keypad_init(&qwerty_keypad);
|
||||
}
|
@ -1,471 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/gpio.h>
|
||||
#include <kernel/thread.h>
|
||||
#include <platform/mddi.h>
|
||||
|
||||
#define MDDI_CLIENT_CORE_BASE 0x108000
|
||||
#define LCD_CONTROL_BLOCK_BASE 0x110000
|
||||
#define SPI_BLOCK_BASE 0x120000
|
||||
#define I2C_BLOCK_BASE 0x130000
|
||||
#define PWM_BLOCK_BASE 0x140000
|
||||
#define GPIO_BLOCK_BASE 0x150000
|
||||
#define SYSTEM_BLOCK1_BASE 0x160000
|
||||
#define SYSTEM_BLOCK2_BASE 0x170000
|
||||
|
||||
|
||||
#define MDDICAP0 (MDDI_CLIENT_CORE_BASE|0x00)
|
||||
#define MDDICAP1 (MDDI_CLIENT_CORE_BASE|0x04)
|
||||
#define MDDICAP2 (MDDI_CLIENT_CORE_BASE|0x08)
|
||||
#define MDDICAP3 (MDDI_CLIENT_CORE_BASE|0x0C)
|
||||
#define MDCAPCHG (MDDI_CLIENT_CORE_BASE|0x10)
|
||||
#define MDCRCERC (MDDI_CLIENT_CORE_BASE|0x14)
|
||||
#define TTBUSSEL (MDDI_CLIENT_CORE_BASE|0x18)
|
||||
#define DPSET0 (MDDI_CLIENT_CORE_BASE|0x1C)
|
||||
#define DPSET1 (MDDI_CLIENT_CORE_BASE|0x20)
|
||||
#define DPSUS (MDDI_CLIENT_CORE_BASE|0x24)
|
||||
#define DPRUN (MDDI_CLIENT_CORE_BASE|0x28)
|
||||
#define SYSCKENA (MDDI_CLIENT_CORE_BASE|0x2C)
|
||||
#define TESTMODE (MDDI_CLIENT_CORE_BASE|0x30)
|
||||
#define FIFOMONI (MDDI_CLIENT_CORE_BASE|0x34)
|
||||
#define INTMONI (MDDI_CLIENT_CORE_BASE|0x38)
|
||||
#define MDIOBIST (MDDI_CLIENT_CORE_BASE|0x3C)
|
||||
#define MDIOPSET (MDDI_CLIENT_CORE_BASE|0x40)
|
||||
#define BITMAP0 (MDDI_CLIENT_CORE_BASE|0x44)
|
||||
#define BITMAP1 (MDDI_CLIENT_CORE_BASE|0x48)
|
||||
#define BITMAP2 (MDDI_CLIENT_CORE_BASE|0x4C)
|
||||
#define BITMAP3 (MDDI_CLIENT_CORE_BASE|0x50)
|
||||
#define BITMAP4 (MDDI_CLIENT_CORE_BASE|0x54)
|
||||
|
||||
|
||||
#define SRST (LCD_CONTROL_BLOCK_BASE|0x00)
|
||||
#define PORT_ENB (LCD_CONTROL_BLOCK_BASE|0x04)
|
||||
#define START (LCD_CONTROL_BLOCK_BASE|0x08)
|
||||
#define PORT (LCD_CONTROL_BLOCK_BASE|0x0C)
|
||||
#define CMN (LCD_CONTROL_BLOCK_BASE|0x10)
|
||||
#define GAMMA (LCD_CONTROL_BLOCK_BASE|0x14)
|
||||
#define INTFLG (LCD_CONTROL_BLOCK_BASE|0x18)
|
||||
#define INTMSK (LCD_CONTROL_BLOCK_BASE|0x1C)
|
||||
#define MPLFBUF (LCD_CONTROL_BLOCK_BASE|0x20)
|
||||
#define HDE_LEFT (LCD_CONTROL_BLOCK_BASE|0x24)
|
||||
#define VDE_TOP (LCD_CONTROL_BLOCK_BASE|0x28)
|
||||
|
||||
#define PXL (LCD_CONTROL_BLOCK_BASE|0x30)
|
||||
#define HCYCLE (LCD_CONTROL_BLOCK_BASE|0x34)
|
||||
#define HSW (LCD_CONTROL_BLOCK_BASE|0x38)
|
||||
#define HDE_START (LCD_CONTROL_BLOCK_BASE|0x3C)
|
||||
#define HDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x40)
|
||||
#define VCYCLE (LCD_CONTROL_BLOCK_BASE|0x44)
|
||||
#define VSW (LCD_CONTROL_BLOCK_BASE|0x48)
|
||||
#define VDE_START (LCD_CONTROL_BLOCK_BASE|0x4C)
|
||||
#define VDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x50)
|
||||
#define WAKEUP (LCD_CONTROL_BLOCK_BASE|0x54)
|
||||
#define WSYN_DLY (LCD_CONTROL_BLOCK_BASE|0x58)
|
||||
#define REGENB (LCD_CONTROL_BLOCK_BASE|0x5C)
|
||||
#define VSYNIF (LCD_CONTROL_BLOCK_BASE|0x60)
|
||||
#define WRSTB (LCD_CONTROL_BLOCK_BASE|0x64)
|
||||
#define RDSTB (LCD_CONTROL_BLOCK_BASE|0x68)
|
||||
#define ASY_DATA (LCD_CONTROL_BLOCK_BASE|0x6C)
|
||||
#define ASY_DATB (LCD_CONTROL_BLOCK_BASE|0x70)
|
||||
#define ASY_DATC (LCD_CONTROL_BLOCK_BASE|0x74)
|
||||
#define ASY_DATD (LCD_CONTROL_BLOCK_BASE|0x78)
|
||||
#define ASY_DATE (LCD_CONTROL_BLOCK_BASE|0x7C)
|
||||
#define ASY_DATF (LCD_CONTROL_BLOCK_BASE|0x80)
|
||||
#define ASY_DATG (LCD_CONTROL_BLOCK_BASE|0x84)
|
||||
#define ASY_DATH (LCD_CONTROL_BLOCK_BASE|0x88)
|
||||
#define ASY_CMDSET (LCD_CONTROL_BLOCK_BASE|0x8C)
|
||||
|
||||
#define MONI (LCD_CONTROL_BLOCK_BASE|0xB0)
|
||||
|
||||
#define Current (LCD_CONTROL_BLOCK_BASE|0xC0)
|
||||
#define LCD (LCD_CONTROL_BLOCK_BASE|0xC4)
|
||||
#define COMMAND (LCD_CONTROL_BLOCK_BASE|0xC8)
|
||||
|
||||
|
||||
#define SSICTL (SPI_BLOCK_BASE|0x00)
|
||||
#define SSITIME (SPI_BLOCK_BASE|0x04)
|
||||
#define SSITX (SPI_BLOCK_BASE|0x08)
|
||||
#define SSIRX (SPI_BLOCK_BASE|0x0C)
|
||||
#define SSIINTC (SPI_BLOCK_BASE|0x10)
|
||||
#define SSIINTS (SPI_BLOCK_BASE|0x14)
|
||||
#define SSIDBG1 (SPI_BLOCK_BASE|0x18)
|
||||
#define SSIDBG2 (SPI_BLOCK_BASE|0x1C)
|
||||
#define SSIID (SPI_BLOCK_BASE|0x20)
|
||||
|
||||
|
||||
#define I2CSETUP (I2C_BLOCK_BASE|0x00)
|
||||
#define I2CCTRL (I2C_BLOCK_BASE|0x04)
|
||||
|
||||
|
||||
#define TIMER0LOAD (PWM_BLOCK_BASE|0x00)
|
||||
#define TIMER0VALUE (PWM_BLOCK_BASE|0x04)
|
||||
#define TIMER0CONTROL (PWM_BLOCK_BASE|0x08)
|
||||
#define TIMER0INTCLR (PWM_BLOCK_BASE|0x0C)
|
||||
#define TIMER0RIS (PWM_BLOCK_BASE|0x10)
|
||||
#define TIMER0MIS (PWM_BLOCK_BASE|0x14)
|
||||
#define TIMER0BGLOAD (PWM_BLOCK_BASE|0x18)
|
||||
#define PWM0OFF (PWM_BLOCK_BASE|0x1C)
|
||||
#define TIMER1LOAD (PWM_BLOCK_BASE|0x20)
|
||||
#define TIMER1VALUE (PWM_BLOCK_BASE|0x24)
|
||||
#define TIMER1CONTROL (PWM_BLOCK_BASE|0x28)
|
||||
#define TIMER1INTCLR (PWM_BLOCK_BASE|0x2C)
|
||||
#define TIMER1RIS (PWM_BLOCK_BASE|0x30)
|
||||
#define TIMER1MIS (PWM_BLOCK_BASE|0x34)
|
||||
#define TIMER1BGLOAD (PWM_BLOCK_BASE|0x38)
|
||||
#define PWM1OFF (PWM_BLOCK_BASE|0x3C)
|
||||
#define TIMERITCR (PWM_BLOCK_BASE|0x60)
|
||||
#define TIMERITOP (PWM_BLOCK_BASE|0x64)
|
||||
#define PWMCR (PWM_BLOCK_BASE|0x68)
|
||||
#define PWMID (PWM_BLOCK_BASE|0x6C)
|
||||
#define PWMMON (PWM_BLOCK_BASE|0x70)
|
||||
|
||||
|
||||
#define GPIODATA (GPIO_BLOCK_BASE|0x00)
|
||||
#define GPIODIR (GPIO_BLOCK_BASE|0x04)
|
||||
#define GPIOIS (GPIO_BLOCK_BASE|0x08)
|
||||
#define GPIOIBE (GPIO_BLOCK_BASE|0x0C)
|
||||
#define GPIOIEV (GPIO_BLOCK_BASE|0x10)
|
||||
#define GPIOIE (GPIO_BLOCK_BASE|0x14)
|
||||
#define GPIORIS (GPIO_BLOCK_BASE|0x18)
|
||||
#define GPIOMIS (GPIO_BLOCK_BASE|0x1C)
|
||||
#define GPIOIC (GPIO_BLOCK_BASE|0x20)
|
||||
#define GPIOOMS (GPIO_BLOCK_BASE|0x24)
|
||||
#define GPIOPC (GPIO_BLOCK_BASE|0x28)
|
||||
|
||||
#define GPIOID (GPIO_BLOCK_BASE|0x30)
|
||||
|
||||
|
||||
#define WKREQ (SYSTEM_BLOCK1_BASE|0x00)
|
||||
#define CLKENB (SYSTEM_BLOCK1_BASE|0x04)
|
||||
#define DRAMPWR (SYSTEM_BLOCK1_BASE|0x08)
|
||||
#define INTMASK (SYSTEM_BLOCK1_BASE|0x0C)
|
||||
#define GPIOSEL (SYSTEM_BLOCK2_BASE|0x00)
|
||||
|
||||
struct init_table {
|
||||
unsigned int reg;
|
||||
unsigned int val;
|
||||
};
|
||||
|
||||
static struct init_table toshiba_480x640_init_table[] = {
|
||||
{ DPSET0, 0x4BEC0066 }, // # MDC.DPSET0 # Setup DPLL parameters
|
||||
{ DPSET1, 0x00000113 }, // # MDC.DPSET1
|
||||
{ DPSUS, 0x00000000 }, // # MDC.DPSUS # Set DPLL oscillation enable
|
||||
{ DPRUN, 0x00000001 }, // # MDC.DPRUN # Release reset signal for DPLL
|
||||
{ 0, 14 }, // wait_ms(14);
|
||||
{ SYSCKENA, 0x00000001 }, // # MDC.SYSCKENA # Enable system clock output
|
||||
{ CLKENB, 0x000000EF }, // # SYS.CLKENB # Enable clocks for each module (without DCLK , i2cCLK)
|
||||
{ GPIO_BLOCK_BASE, 0x03FF0000 }, // # GPI .GPIODATA # GPIO2(RESET_LCD_N) set to 0 , GPIO3(eDRAM_Power) set to 0
|
||||
{ GPIODIR, 0x0000024D }, // # GPI .GPIODIR # Select direction of GPIO port (0,2,3,6,9 output)
|
||||
{ SYSTEM_BLOCK2_BASE, 0x00000173 }, // # SYS.GPIOSEL # GPIO port multiplexing control
|
||||
{ GPIOPC, 0x03C300C0 }, // # GPI .GPIOPC # GPIO2,3 PD cut
|
||||
{ SYSTEM_BLOCK1_BASE, 0x00000000 }, // # SYS.WKREQ # Wake-up request event is VSYNC alignment
|
||||
{ GPIOIS, 0x00000000 }, // # GPI .GPIOIS # Set interrupt sense of GPIO
|
||||
{ GPIOIEV, 0x00000001 }, // # GPI .GPIOIEV # Set interrupt event of GPIO
|
||||
{ GPIOIC, 0x000003FF }, // # GPI .GPIOIC # GPIO interrupt clear
|
||||
{ GPIO_BLOCK_BASE, 0x00060006 }, // # GPI .GPIODATA # Release LCDD reset
|
||||
{ GPIO_BLOCK_BASE, 0x00080008 }, // # GPI .GPIODATA # eDRAM VD supply
|
||||
{ GPIO_BLOCK_BASE, 0x02000200 }, // # GPI .GPIODATA # TEST LED ON
|
||||
{ DRAMPWR, 0x00000001 }, // # SYS.DRAMPWR # eDRAM power up
|
||||
{ TIMER0CONTROL, 0x00000060 }, // # PWM.Timer0Control # PWM0 output stop
|
||||
{ PWM_BLOCK_BASE, 0x00001388 }, // # PWM.Timer0Load # PWM0 10kHz , Duty 99 (BackLight OFF)
|
||||
//{PWM0OFF, 0x00000001 }, // # PWM.PWM0OFF
|
||||
#if 0
|
||||
{ PWM0OFF, 0x00001387 }, // SURF 100% backlight
|
||||
{ PWM0OFF, 0x00000000 }, // FFA 100% backlight
|
||||
#endif
|
||||
{ PWM0OFF, 0x000009C3 }, // 50% BL
|
||||
{ TIMER1CONTROL, 0x00000060 }, // # PWM.Timer1Control # PWM1 output stop
|
||||
{ TIMER1LOAD, 0x00001388 }, // # PWM.Timer1Load # PWM1 10kHz , Duty 99 (BackLight OFF)
|
||||
//{PWM1OFF, 0x00000001 }, // # PWM.PWM1OFF
|
||||
{ PWM1OFF, 0x00001387 },
|
||||
{ TIMER0CONTROL, 0x000000E0 }, // # PWM.Timer0Control # PWM0 output start
|
||||
{ TIMER1CONTROL, 0x000000E0 }, // # PWM.Timer1Control # PWM1 output start
|
||||
{ PWMCR, 0x00000003 }, // # PWM.PWMCR # PWM output enable
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SPI_BLOCK_BASE, 0x00000799 }, // # SPI .SSICTL # SPI operation mode setting
|
||||
{ SSITIME, 0x00000100 }, // # SPI .SSITIME # SPI serial interface timing setting
|
||||
{ SPI_BLOCK_BASE, 0x0000079b }, // # SPI .SSICTL # Set SPI active mode
|
||||
|
||||
{ SSITX, 0x00000000 }, // # SPI.SSITX # Release from Deep Stanby mode
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SSITX, 0x00000000 }, // # SPI.SSITX
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SSITX, 0x00000000 }, // # SPI.SSITX
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SSITX, 0x000800BA }, // # SPI.SSITX *NOTE 1 # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # Display mode setup(1) : Normaly Black
|
||||
{ SSITX, 0x00080036 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Memory access control
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800BB }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Display mode setup(2)
|
||||
{ SSITX, 0x0008003A }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000160 }, // # RGB Interface data format
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800BF }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Drivnig method
|
||||
{ SSITX, 0x000800B1 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0000015D }, // # Booster operation setup
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000133 }, // # Booster mode setup
|
||||
{ SSITX, 0x000800B3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000122 }, // # Booster frequencies setup
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000102 }, // # OP-amp capability/System clock freq. division setup
|
||||
{ SSITX, 0x000800B5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0000011F }, // # VCS Voltage adjustment (1C->1F for Rev 2)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000128 }, // # VCOM Voltage adjustment
|
||||
{ SSITX, 0x000800B7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000103 }, // # Configure an external display signal
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B9 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000120 }, // # DCCK/DCEV timing setup
|
||||
{ SSITX, 0x000800BD }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000102 }, // # ASW signal control
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800BE }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Dummy display (white/black) count setup for QUAD Data operation
|
||||
{ SSITX, 0x000800C0 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # wait_ms(-out FR count setup (A)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C1 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # wait_ms(-out FR count setup (B)
|
||||
{ SSITX, 0x000800C2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # wait_ms(-out FR count setup (C)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0008010A }, // # wait_ms(-in line clock count setup (D)
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080160 }, // # Seep-in line clock count setup (E)
|
||||
{ SSITX, 0x00000160 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080160 }, // # wait_ms(-in line clock count setup (F)
|
||||
{ SSITX, 0x00000160 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080160 }, // # wait_ms(-in line clock setup (G)
|
||||
{ SSITX, 0x00000160 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080133 }, // # Gamma 1 fine tuning (1)
|
||||
{ SSITX, 0x00000143 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C8 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000144 }, // # Gamma 1 fine tuning (2)
|
||||
{ SSITX, 0x000800C9 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000133 }, // # Gamma 1 inclination adjustment
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800CA }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Gamma 1 blue offset adjustment
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800EC }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080102 }, // # Total number of horizontal clock cycles (1) [PCLK Sync. VGA setting]
|
||||
{ SSITX, 0x00000118 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800CF }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # Blanking period control (1) [PCLK Sync. Table1 for VGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D0 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080110 }, // # Blanking period control (2) [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x00000104 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D1 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # CKV timing control on/off [PCLK Sync. Table1 for VGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # CKV1,2 timing control [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x0000013A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # OEV timing control [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x0000013A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080124 }, // # ASW timing control (1) [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x0000016E }, //
|
||||
{ 0, 1 }, // wait_ms(1); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000124 }, // # ASW timing control (2) [PCLK Sync. Table1 for VGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800ED }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080101 }, // # Total number of horizontal clock cycles (2) [PCLK Sync. Table1 for QVGA ]
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # Blanking period control (1) [PCLK Sync. Table2 for QVGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080110 }, // # Blanking period control (2) [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D8 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # CKV timing control on/off [PCLK Sync. Table2 for QVGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D9 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # CKV1,2 timing control [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x00000114 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800DE }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # OEV timing control [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x00000114 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800DF }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080112 }, // # ASW timing control (1) [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x0000013F }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E0 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0000010B }, // # ASW timing control (2) [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x000800E2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # Built-in oscillator frequency division setup [Frequency division ratio : 2 (60Hq)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000136 }, // # Built-in oscillator clock count setup
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # CKV timing control for using build-in osc
|
||||
{ SSITX, 0x00000103 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080102 }, // # OEV timing control for using build-in osc
|
||||
{ SSITX, 0x00000104 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000103 }, // # DCEV timing control for using build-in osc
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080104 }, // # ASW timing setup for using build-in osc(1)
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E8 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000104 }, // # ASW timing setup for using build-in osc(2)
|
||||
|
||||
|
||||
{ CLKENB, 0x000001EF }, // # SYS.CLKENB # DCLK enable
|
||||
{ START, 0x00000000 }, // # LCD.START # LCDC wait_ms( mode
|
||||
{ WRSTB, 0x0000003F }, // # LCD.WRSTB # write_client_reg( strobe
|
||||
{ RDSTB, 0x00000432 }, // # LCD.RDSTB # Read strobe
|
||||
{ PORT_ENB, 0x00000002 }, // # LCD.PORT_ENB # Asynchronous port enable
|
||||
{ VSYNIF, 0x00000000 }, // # LCD.VSYNCIF # VSYNC I/F mode set
|
||||
{ ASY_DATA, 0x80000000 }, // # LCD.ASY_DATx # Index setting of SUB LCDD
|
||||
{ ASY_DATB, 0x00000001 }, // # Oscillator start
|
||||
{ ASY_CMDSET, 0x00000005 }, // # LCD.ASY_CMDSET # Direct command transfer enable
|
||||
{ ASY_CMDSET, 0x00000004 }, // # LCD.ASY_CMDSET # Direct command transfer disable
|
||||
{ 0, 10 }, // wait_ms(10);
|
||||
{ ASY_DATA, 0x80000000 }, // # LCD.ASY_DATx # DUMMY write_client_reg(<28>@*NOTE2
|
||||
{ ASY_DATB, 0x80000000 }, //
|
||||
{ ASY_DATC, 0x80000000 }, //
|
||||
{ ASY_DATD, 0x80000000 }, //
|
||||
{ ASY_CMDSET, 0x00000009 }, // # LCD.ASY_CMDSET
|
||||
{ ASY_CMDSET, 0x00000008 }, // # LCD.ASY_CMDSET
|
||||
{ ASY_DATA, 0x80000007 }, // # LCD.ASY_DATx # Index setting of SUB LCDD
|
||||
{ ASY_DATB, 0x00004005 }, // # LCD driver control
|
||||
{ ASY_CMDSET, 0x00000005 }, // # LCD.ASY_CMDSET # Direct command transfer enable
|
||||
{ ASY_CMDSET, 0x00000004 }, // # LCD.ASY_CMDSET # Direct command transfer disable
|
||||
{ 0, 20 }, // wait_ms(20);
|
||||
{ ASY_DATA, 0x80000059 }, // # LCD.ASY_DATx # Index setting of SUB LCDD
|
||||
{ ASY_DATB, 0x00000000 }, // # LTPS I/F control
|
||||
{ ASY_CMDSET, 0x00000005 }, // # LCD.ASY_CMDSET # Direct command transfer enable
|
||||
{ ASY_CMDSET, 0x00000004 }, // # LCD.ASY_CMDSET # Direct command transfer disable
|
||||
|
||||
{ VSYNIF, 0x00000001 }, // # LCD.VSYNCIF # VSYNC I/F mode OFF
|
||||
{ PORT_ENB, 0x00000001 }, // # LCD.PORT_ENB # SYNC I/F output select
|
||||
|
||||
/******************************/
|
||||
|
||||
{ VSYNIF, 0x00000001 }, // VSYNC I/F mode OFF
|
||||
{ PORT_ENB, 0x00000001 }, // SYNC I/F mode ON
|
||||
|
||||
{ BITMAP1, 0x01E000F0 }, // MDC.BITMAP2 ); // Setup of PITCH size to Frame buffer1
|
||||
{ BITMAP2, 0x01E000F0 }, // MDC.BITMAP3 ); // Setup of PITCH size to Frame buffer2
|
||||
{ BITMAP3, 0x01E000F0 }, // MDC.BITMAP4 ); // Setup of PITCH size to Frame buffer3
|
||||
{ BITMAP4, 0x00DC00B0 }, // MDC.BITMAP5 ); // Setup of PITCH size to Frame buffer4
|
||||
{ CLKENB, 0x000001EF }, // SYS.CLKENB ); // DCLK supply
|
||||
{ PORT_ENB, 0x00000001 }, // LCD.PORT_ENB ); // Synchronous port enable
|
||||
{ PORT, 0x00000004 }, // LCD.PORT ); // Polarity of DE is set to high active
|
||||
{ PXL, 0x00000002 }, // LCD.PXL ); // ACTMODE 2 set (1st frame black data output)
|
||||
{ MPLFBUF, 0x00000000 }, // LCD.MPLFBUF ); // Select the reading buffer
|
||||
{ HCYCLE, 0x0000010b }, // LCD.HCYCLE ); // Setup to VGA size
|
||||
{ HSW, 0x00000003 }, // LCD.HSW
|
||||
{ HDE_START, 0x00000007 }, // LCD.HDE_START
|
||||
{ HDE_SIZE, 0x000000EF }, // LCD.HDE_SIZE
|
||||
{ VCYCLE, 0x00000285 }, // LCD.VCYCLE
|
||||
{ VSW, 0x00000001 }, // LCD.VSW
|
||||
{ VDE_START, 0x00000003 }, // LCD.VDE_START
|
||||
{ VDE_SIZE, 0x0000027F }, // LCD.VDE_SIZE
|
||||
|
||||
{ START, 0x00000001 }, // LCD.START ); // LCDC - Pixel data transfer start
|
||||
|
||||
{ 0, 10 }, // wait_ms( 10 );
|
||||
{ SSITX, 0x000800BC }, // SPI.SSITX ); // Command setting of SPI block
|
||||
{ SSITX, 0x00000180 }, // Display data setup
|
||||
{ SSITX, 0x0008003B }, // Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // Quad Data configuration - VGA
|
||||
{ 0, 1 }, // wait_ms( 1 ); // Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B0 }, // Command setting of SPI block
|
||||
{ SSITX, 0x00000116 }, // Power supply ON/OFF control
|
||||
{ 0, 1 }, // wait_ms( 1 ); // Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B8 }, // Command setting of SPI block
|
||||
{ SSITX, 0x000801FF }, // Output control
|
||||
{ SSITX, 0x000001F5 },
|
||||
{ 0, 1 }, // wait_ms( 1); // Wait SPI fifo empty
|
||||
{ SSITX, 0x00000011 }, // wait_ms(-out (Command only)
|
||||
{ SSITX, 0x00000029 }, // Display on (Command only)
|
||||
|
||||
{ SYSTEM_BLOCK1_BASE, 0x00000002 }, // # wakeREQ -> GPIO
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static void _panel_init(struct init_table *init_table)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
dprintf(INFO, "panel_init()\n");
|
||||
|
||||
n = 0;
|
||||
while (init_table[n].reg != 0 || init_table[n].val != 0) {
|
||||
if (init_table[n].reg != 0)
|
||||
mddi_remote_write(init_table[n].val, init_table[n].reg);
|
||||
else
|
||||
thread_sleep(init_table[n].val);//mdelay(init_table[n].val);
|
||||
n++;
|
||||
}
|
||||
|
||||
dprintf(INFO, "panel_init() done\n");
|
||||
}
|
||||
|
||||
void panel_init(struct mddi_client_caps *client_caps)
|
||||
{
|
||||
switch(client_caps->manufacturer_name) {
|
||||
case 0xd263: // Toshiba
|
||||
dprintf(INFO, "Found Toshiba panel\n");
|
||||
_panel_init(toshiba_480x640_init_table);
|
||||
break;
|
||||
case 0x4474: //??
|
||||
if (client_caps->product_code == 0xc065)
|
||||
dprintf(INFO, "Found WVGA panel\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void panel_poweron(void)
|
||||
{
|
||||
gpio_set(88, 0);
|
||||
gpio_config(88, GPIO_OUTPUT);
|
||||
thread_sleep(1); //udelay(10);
|
||||
gpio_set(88, 1);
|
||||
thread_sleep(10); //mdelay(10);
|
||||
|
||||
//mdelay(1000); // uncomment for second stage boot
|
||||
}
|
||||
|
||||
void panel_backlight(int on)
|
||||
{}
|
@ -1,40 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := msm7x30
|
||||
|
||||
MEMBASE := 0x00000000 # EBI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := 0x08008000
|
||||
FASTBOOT_BUF_SIZE := 0x07800000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_TYPE_MDDI=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR) \
|
||||
FASTBOOT_BUF_SIZE=$(FASTBOOT_BUF_SIZE)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/keypad.o
|
@ -1,41 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
|
||||
appsboot.mbn: appsboothd.mbn $(OUTBIN)
|
||||
cat $(APPSBOOTHEADER_DIR)/appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
rm -f $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: emmc_appsboothd.mbn $(OUTBIN)
|
||||
cat $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
rm -f $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn unified-boot
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} -DMEMBASE=$(MEMBASE) $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
|
@ -1,91 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
#if MEMBASE
|
||||
base = MEMBASE;
|
||||
#else
|
||||
base = 0;
|
||||
#endif
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00500000; /* 5M for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,130 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
#include <debug.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define EBI1_ADDR_128M 0x08000000
|
||||
#define SIZE_256M 0x10000000
|
||||
#define SIZE_128M 0x08000000
|
||||
#define SIZE_1M 0x00100000
|
||||
|
||||
static int scratch_addr = -1;
|
||||
int smem_ram_ptable_init(struct smem_ram_ptable *);
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
struct smem_ram_ptable ram_ptable;
|
||||
unsigned i = 0;
|
||||
|
||||
if (smem_ram_ptable_init(&ram_ptable))
|
||||
{
|
||||
for (i = 0; i < ram_ptable.len; i++)
|
||||
{
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].type == APPS_MEMORY))
|
||||
{
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
// Tag EBI-1 memory as unstable.
|
||||
if(ram_ptable.parts[i].category == EBI1_CS0) {
|
||||
// if EBI-1 CS-0 is 256Mb then this is a 2x256 target and
|
||||
// the kernel can reserve this mem region as unstable.
|
||||
// This memory region can be activated when the kernel
|
||||
// receives a request from Android init scripts.
|
||||
if(ram_ptable.parts[i].size == SIZE_256M)
|
||||
*ptr++ = 0x5441000A; //Deep-Power-Down Tag.
|
||||
|
||||
//if EBI-1 CS-0 s 128Mb then this is a 2x128 target.
|
||||
//Android + Kernel + PMEM regions account for more than
|
||||
//128Mb and the target will not be able to boot with just
|
||||
//one memory bank active and the second memory bank is reserved.
|
||||
//In the case of 2x128 the tag is set to SelfRefresh Only.
|
||||
else if(ram_ptable.parts[i].size == SIZE_128M)
|
||||
*ptr++ = 0x5441000B; //Self-Refresh Tag.
|
||||
}
|
||||
else
|
||||
*ptr++ = 0x54410002;
|
||||
|
||||
*ptr++ = ram_ptable.parts[i].size;
|
||||
*ptr++ = ram_ptable.parts[i].start;
|
||||
}
|
||||
|
||||
/* Check for modem bootloader memory that can be reclaimed */
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].type == BOOT_REGION_MEMORY1))
|
||||
{
|
||||
/* ATAG_MEM_OSBL */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x5441000C;
|
||||
*ptr++ = ram_ptable.parts[i].size;
|
||||
*ptr++ = ram_ptable.parts[i].start;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: Unable to read RAM partition\n");
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *target_get_scratch_address(void)
|
||||
{
|
||||
struct smem_ram_ptable ram_ptable;
|
||||
unsigned i = 0;
|
||||
|
||||
if (smem_ram_ptable_init(&ram_ptable))
|
||||
{
|
||||
for (i = 0; i < ram_ptable.len; i++)
|
||||
{
|
||||
if ((ram_ptable.parts[i].attr == READWRITE)
|
||||
&& (ram_ptable.parts[i].domain == APPS_DOMAIN)
|
||||
&& (ram_ptable.parts[i].start != 0x0))
|
||||
{
|
||||
if (ram_ptable.parts[i].size >= FASTBOOT_BUF_SIZE)
|
||||
{
|
||||
scratch_addr = ram_ptable.parts[i].start;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: Unable to read RAM partition\n");
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
return (void *)((scratch_addr == -1) ? EBI1_ADDR_128M : scratch_addr);
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_MSM7630_SURF_DISPLAY_H
|
||||
#define _TARGET_MSM7630_SURF_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 480
|
||||
#define TARGET_YRES 800
|
||||
|
||||
#define LCDC_FB_WIDTH 480
|
||||
#define LCDC_FB_HEIGHT 800
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 8
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 184
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 4
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 1
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 2
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 3
|
||||
|
||||
#endif
|
@ -1,378 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
#include <reg.h>
|
||||
#include <platform/iomap.h>
|
||||
|
||||
#define LINUX_MACHTYPE_7x30_SURF 2679
|
||||
#define LINUX_MACHTYPE_7x30_FFA 2707
|
||||
#define LINUX_MACHTYPE_7x30_FLUID 2741
|
||||
#define LINUX_MACHTYPE_8x55_SURF 2768
|
||||
#define LINUX_MACHTYPE_8x55_FFA 2769
|
||||
#define LINUX_MACHTYPE_8x55_SVLTE_FFA 2863
|
||||
#define LINUX_MACHTYPE_8x55_SVLTE_SURF 2864
|
||||
|
||||
#define MSM8255_ID 74
|
||||
#define MSM8655_ID 75
|
||||
#define APQ8055_ID 85
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static unsigned mmc_sdc_base[] = { MSM_SDC1_BASE, MSM_SDC2_BASE, MSM_SDC3_BASE, MSM_SDC4_BASE};
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
static int hw_platform_type = -1;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 120 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 30 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 3 /* In MB */,
|
||||
.name = "persist",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
unsigned smem_read_alloc_entry_offset(smem_mem_type_t, void *, int, int);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
static int emmc_boot = -1; /* set to uninitialized */
|
||||
int target_is_emmc_boot(void);
|
||||
static int platform_version = -1;
|
||||
static int target_msm_id = -1;
|
||||
static int interleaved_mode_enabled = -1;
|
||||
void enable_interleave_mode(int);
|
||||
|
||||
int target_is_interleaved_mode(void)
|
||||
{
|
||||
struct smem_board_info_v4 board_info_v4;
|
||||
unsigned int board_info_len = 0;
|
||||
unsigned smem_status;
|
||||
char *build_type;
|
||||
unsigned format = 0;
|
||||
|
||||
if (interleaved_mode_enabled != -1)
|
||||
{
|
||||
return interleaved_mode_enabled;
|
||||
}
|
||||
|
||||
smem_status = smem_read_alloc_entry_offset(SMEM_BOARD_INFO_LOCATION,
|
||||
&format, sizeof(format), 0);
|
||||
if(!smem_status)
|
||||
{
|
||||
if ((format == 3) || (format == 4))
|
||||
{
|
||||
if (format == 4)
|
||||
board_info_len = sizeof(board_info_v4);
|
||||
else
|
||||
board_info_len = sizeof(board_info_v4.board_info_v3);
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION,
|
||||
&board_info_v4, board_info_len);
|
||||
if(!smem_status)
|
||||
{
|
||||
build_type = (char *)(board_info_v4.board_info_v3.build_id) + 9;
|
||||
|
||||
interleaved_mode_enabled = 0;
|
||||
|
||||
if (*build_type == 'C')
|
||||
{
|
||||
interleaved_mode_enabled = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return interleaved_mode_enabled;
|
||||
}
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
unsigned base_addr;
|
||||
unsigned char slot;
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
|
||||
if (target_is_emmc_boot())
|
||||
{
|
||||
/* Trying Slot 2 first */
|
||||
slot = 2;
|
||||
base_addr = mmc_sdc_base[slot-1];
|
||||
if(mmc_boot_main(slot, base_addr))
|
||||
{
|
||||
/* Trying Slot 4 next */
|
||||
slot = 4;
|
||||
base_addr = mmc_sdc_base[slot-1];
|
||||
if(mmc_boot_main(slot, base_addr))
|
||||
{
|
||||
dprintf(CRITICAL, "mmc init failed!");
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
enable_interleave_mode(target_is_interleaved_mode());
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
if(target_is_interleaved_mode()) {
|
||||
ptable_add(&flash_ptable, ptn->name, offset + (ptn->start / 2),
|
||||
(len / 2), ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
else {
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
int target_platform_version(void)
|
||||
{
|
||||
return platform_version;
|
||||
}
|
||||
|
||||
int target_is_msm8x55(void)
|
||||
{
|
||||
if ((target_msm_id == MSM8255_ID) ||
|
||||
(target_msm_id == MSM8655_ID) ||
|
||||
(target_msm_id == APQ8055_ID))
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
struct smem_board_info_v4 board_info_v4;
|
||||
unsigned int board_info_len = 0;
|
||||
enum platform platform_type = 0;
|
||||
unsigned smem_status;
|
||||
unsigned format = 0;
|
||||
if(hw_platform_type != -1)
|
||||
return hw_platform_type;
|
||||
|
||||
smem_status = smem_read_alloc_entry_offset(SMEM_BOARD_INFO_LOCATION,
|
||||
&format, sizeof(format), 0);
|
||||
if(!smem_status)
|
||||
{
|
||||
if ((format == 3) || (format == 4))
|
||||
{
|
||||
if (format == 4)
|
||||
board_info_len = sizeof(board_info_v4);
|
||||
else
|
||||
board_info_len = sizeof(board_info_v4.board_info_v3);
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION,
|
||||
&board_info_v4, board_info_len);
|
||||
if(!smem_status)
|
||||
{
|
||||
if(format == 4)
|
||||
platform_version = board_info_v4.platform_version;
|
||||
|
||||
platform_type = board_info_v4.board_info_v3.hw_platform;
|
||||
target_msm_id = board_info_v4.board_info_v3.msm_id;
|
||||
switch (platform_type)
|
||||
{
|
||||
case HW_PLATFORM_SURF:
|
||||
hw_platform_type = ((target_is_msm8x55()) ?
|
||||
LINUX_MACHTYPE_8x55_SURF : LINUX_MACHTYPE_7x30_SURF); break;
|
||||
case HW_PLATFORM_FFA:
|
||||
hw_platform_type = ((target_is_msm8x55()) ?
|
||||
LINUX_MACHTYPE_8x55_FFA : LINUX_MACHTYPE_7x30_FFA); break;
|
||||
case HW_PLATFORM_FLUID:
|
||||
hw_platform_type = LINUX_MACHTYPE_7x30_FLUID; break;
|
||||
case HW_PLATFORM_SVLTE:
|
||||
hw_platform_type = LINUX_MACHTYPE_8x55_SVLTE_FFA; break;
|
||||
default:
|
||||
hw_platform_type = ((target_is_msm8x55()) ?
|
||||
LINUX_MACHTYPE_8x55_SURF : LINUX_MACHTYPE_7x30_SURF); break;
|
||||
}
|
||||
return hw_platform_type;
|
||||
}
|
||||
}
|
||||
}
|
||||
hw_platform_type = LINUX_MACHTYPE_7x30_SURF;
|
||||
return hw_platform_type;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
static unsigned target_check_power_on_reason(void)
|
||||
{
|
||||
unsigned power_on_status = 0;
|
||||
unsigned int status_len = sizeof(power_on_status);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_POWER_ON_STATUS_INFO,
|
||||
&power_on_status, status_len);
|
||||
|
||||
if (!smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for power on reason\n");
|
||||
}
|
||||
|
||||
return power_on_status;
|
||||
}
|
||||
|
||||
unsigned target_pause_for_battery_charge(void)
|
||||
{
|
||||
//check power on reason only for fluid devices
|
||||
if( hw_platform_type != LINUX_MACHTYPE_7x30_FLUID)
|
||||
return 0;
|
||||
|
||||
if (target_check_power_on_reason() == PWR_ON_EVENT_USB_CHG)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
}
|
@ -1,66 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
#define BITS_IN_ELEMENT(x) (sizeof(x)[0] * 8)
|
||||
|
||||
static unsigned char qwerty_keys_old[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static unsigned char qwerty_keys_new[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#define KEYMAP_INDEX(row, col) (row)* BITS_IN_ELEMENT(qwerty_keys_new) + (col)
|
||||
|
||||
static unsigned int qwerty_keymap[] = {
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_BACK, /* -L on SURF & FFA */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_HOME, /* +R on SURF & FFA */
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_CLEAR, /* '-' of left side switch on FLUID */
|
||||
};
|
||||
|
||||
static struct qwerty_keypad_info qwerty_keypad = {
|
||||
.keymap = qwerty_keymap,
|
||||
.old_keys = qwerty_keys_old,
|
||||
.rec_keys = qwerty_keys_new,
|
||||
.rows = 5,
|
||||
.columns = 5,
|
||||
.num_of_reads = 6,
|
||||
.rd_func = &i2c_ssbi_read_bytes,
|
||||
.wr_func = &i2c_ssbi_write_bytes,
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
ssbi_keypad_init(&qwerty_keypad);
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared -I$(LK_TOP_DIR)/platform/msm7x30
|
||||
|
||||
PLATFORM := msm7x30
|
||||
|
||||
MEMBASE := 0x00000000 # EBI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := 0x08008000
|
||||
FASTBOOT_BUF_SIZE := 0x07800000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_SPLASH_SCREEN=0
|
||||
DEFINES += DISPLAY_TYPE_MDDI=0
|
||||
DEFINES += DISPLAY_TYPE_LCDC=0
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR) \
|
||||
FASTBOOT_BUF_SIZE=$(FASTBOOT_BUF_SIZE)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/keypad.o \
|
@ -1,45 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
|
||||
appsboot.mbn: appsboothd.mbn $(OUTBIN)
|
||||
cp $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboot.raw
|
||||
cat $(APPSBOOTHEADER_DIR)/appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
rm -f $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: emmc_appsboothd.mbn $(OUTBIN)
|
||||
cp $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboot.raw
|
||||
cat $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
cat $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/emmc_appsboot.mbn
|
||||
rm -f $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} -DMEMBASE=$(MEMBASE) $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
cp $(SRC_DIR)/mkheader $(APPSBOOTHEADER_DIR)/mkheader
|
||||
|
@ -1,316 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int print_usage(){
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr> <none|unified-boot>\n");
|
||||
fprintf(stderr," mkheader <bin> <hdr> <unsecure-boot> <outbin>\n");
|
||||
fprintf(stderr," mkheader <bin> <hdr> <secure-boot> <outbin> <maxsize>\n");
|
||||
fprintf(stderr," mkheader <bin> <hdr> <secure-boot> <outbin> <maxsize> <certchain> <files...>\n\n");
|
||||
fprintf(stderr,"bin: Input raw appsbl binary\n");
|
||||
fprintf(stderr,"hdr: Output of appsbl header location\n");
|
||||
fprintf(stderr,"outbin: Output of the signed or unsigned apps boot location\n");
|
||||
fprintf(stderr,"maxsize: Maximum size for certificate chain\n");
|
||||
fprintf(stderr,"certchain: Output of the certchain location\n");
|
||||
fprintf(stderr,"files: Input format <bin signature> <certifcate file(s) for certificate chain>...\n");
|
||||
fprintf(stderr,"certificate chain: Files will be concatenated in order to create the certificate chain\n\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cat(FILE * in, FILE * out, unsigned size, unsigned buff_size){
|
||||
unsigned bytes_left = size;
|
||||
char buf[buff_size];
|
||||
int ret = 0;
|
||||
|
||||
while(bytes_left){
|
||||
fread(buf, sizeof(char), buff_size, in);
|
||||
if(!feof(in)){
|
||||
bytes_left -= fwrite(buf, sizeof(char), buff_size, out);
|
||||
}else
|
||||
bytes_left = 0;
|
||||
}
|
||||
ret = ferror(in) | ferror(out);
|
||||
if(ret)
|
||||
fprintf(stderr, "ERROR: Occured during file concatenation\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
unsigned cert_chain_size = 0;
|
||||
unsigned signature_size = 0;
|
||||
int secure_boot = 0;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
return print_usage();
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}else if(!strcmp("secure-boot",argv[3])){
|
||||
fprintf(stderr,
|
||||
"ERROR: Missing arguments: [outbin maxsize] | [outbin, maxsize, certchain, signature + certifcate(s)]\n");
|
||||
return print_usage();
|
||||
}
|
||||
else if(!strcmp("unsecure-boot",argv[3])){
|
||||
fprintf(stderr,"ERROR: Missing arguments: outbin directory\n");
|
||||
return print_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 4) {
|
||||
if(!strcmp("secure-boot",argv[3])) {
|
||||
if(argc < 9 && argc != 6){
|
||||
fprintf(stderr,
|
||||
"ERROR: Missing argument(s): [outbin maxsize] | [outbin, maxsize, certchain, signature + certifcate(s)]\n");
|
||||
return print_usage();
|
||||
}
|
||||
secure_boot = 1;
|
||||
signature_size = 256; //Support SHA 256
|
||||
cert_chain_size = atoi(argv[5]);
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
#if MEMBASE
|
||||
base = MEMBASE;
|
||||
#else
|
||||
base = 0;
|
||||
#endif
|
||||
|
||||
printf("Image Destination Pointer: 0x%x\n", base);
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000003; //Flash_partition_version /* nand */
|
||||
magic[2] = 0x00000000; //image source pointer
|
||||
magic[3] = base; //image destination pointer
|
||||
magic[4] = size + cert_chain_size + signature_size; //image size
|
||||
magic[5] = size; //code size
|
||||
magic[6] = base + size;
|
||||
magic[7] = signature_size;
|
||||
magic[8] = size + base + signature_size;
|
||||
magic[9] = cert_chain_size;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00000000; /* not setting size for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
if (secure_boot && argc > 6){
|
||||
FILE * input_file;
|
||||
FILE * output_file;
|
||||
unsigned buff_size = 1;
|
||||
char buf[buff_size];
|
||||
unsigned bytes_left;
|
||||
unsigned current_cert_chain_size = 0;
|
||||
int padding_size = 0;
|
||||
int i;
|
||||
|
||||
if((output_file = fopen(argv[6], "wb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
printf("Certificate Chain Output File: %s\n", argv[6]);
|
||||
|
||||
for (i = 8; i < argc; i++){
|
||||
if((input_file = fopen(argv[i], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[i], &s);
|
||||
bytes_left = s.st_size;
|
||||
current_cert_chain_size += bytes_left;
|
||||
if (cat(input_file, output_file, bytes_left, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
}
|
||||
|
||||
//Pad certifcate chain to the max expected size from input
|
||||
memset(buf, 0xFF, sizeof(buf));
|
||||
padding_size = cert_chain_size - current_cert_chain_size;
|
||||
|
||||
if(padding_size <0){
|
||||
fprintf(stderr, "ERROR: Input certificate chain (Size=%d) is larger than the maximum specified (Size=%d)\n",
|
||||
current_cert_chain_size, cert_chain_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bytes_left = (padding_size > 0) ? padding_size : 0;
|
||||
while(bytes_left){
|
||||
if(!ferror(output_file))
|
||||
bytes_left -= fwrite(buf, sizeof(buf), buff_size, output_file);
|
||||
else{
|
||||
fprintf(stderr, "ERROR: Occured during certifcate chain padding\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fclose(output_file);
|
||||
|
||||
//Concat and combine to signed image. Format [HDR][RAW APPSBOOT][PADDED CERT CHAIN]
|
||||
if((output_file = fopen(argv[4], "wb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
printf("Image Output File: %s\n", argv[4]);
|
||||
|
||||
//Header
|
||||
if((input_file = fopen(argv[2], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[2], &s);
|
||||
if (cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Raw Appsbl
|
||||
if((input_file = fopen(argv[1], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[1], &s);
|
||||
if(cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Signature
|
||||
if((input_file = fopen(argv[7], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[7], &s);
|
||||
if(cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Certifcate Chain
|
||||
if((input_file = fopen(argv[6], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
if(cat(input_file, output_file, (current_cert_chain_size + padding_size), buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
fclose(output_file);
|
||||
|
||||
}else if(argc == 5 || argc == 6){
|
||||
FILE * input_file;
|
||||
FILE * output_file;
|
||||
unsigned buff_size = 1;
|
||||
char buf[buff_size];
|
||||
|
||||
//Concat and combine to unsigned image. Format [HDR][RAW APPSBOOT]
|
||||
if((output_file = fopen(argv[4], "wb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
printf("Image Output File: %s\n", argv[4]);
|
||||
|
||||
//Header
|
||||
if((input_file = fopen(argv[2], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[2], &s);
|
||||
if (cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Raw Appsbl
|
||||
if((input_file = fopen(argv[1], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[1], &s);
|
||||
if(cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
fclose(output_file);
|
||||
}
|
||||
|
||||
printf("Done execution\n");
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
#include <debug.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define SIZE_45M 0x02D00000 // 45M
|
||||
#define EBI1_ADDR_1026M 0x40200000
|
||||
|
||||
#define SIZE_128M 0x08000000 // 128M
|
||||
#define EBI1_ADDR_1152M 0x48000000
|
||||
|
||||
#define SIZE_256M 0x10000000 // 256M
|
||||
#define EBI1_ADDR_1280M 0x50000000
|
||||
|
||||
#define SIZE_768M 0x30000000 // 256M + 512M
|
||||
|
||||
#define EBI1_CS1_ADDR_BASE 0x00A40024
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
unsigned value = 0;
|
||||
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = SIZE_45M;
|
||||
*ptr++ = EBI1_ADDR_1026M;
|
||||
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = SIZE_128M;
|
||||
*ptr++ = EBI1_ADDR_1152M;
|
||||
|
||||
value = readl(EBI1_CS1_ADDR_BASE);
|
||||
value = (value >> 8) & 0xFF;
|
||||
|
||||
if (value == 0x50)
|
||||
{
|
||||
/* For 512MB RAM*/
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = SIZE_256M;
|
||||
*ptr++ = EBI1_ADDR_1280M;
|
||||
}
|
||||
else if (value == 0x60)
|
||||
{
|
||||
/* For 1GB RAM*/
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = SIZE_768M;
|
||||
*ptr++ = EBI1_ADDR_1280M;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void *target_get_scratch_address(void)
|
||||
{
|
||||
return ((void *)SCRATCH_ADDR);
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_QSD8660_SURF_DISPLAY_H
|
||||
#define _TARGET_QSD8660_SURF_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 1024
|
||||
#define TARGET_YRES 600
|
||||
|
||||
#define LCDC_FB_WIDTH 1024
|
||||
#define LCDC_FB_HEIGHT 600
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 32
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 80
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 48
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 1
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 4
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 3
|
||||
|
||||
/* Toshiba MIPI panel */
|
||||
#define TSH_MIPI_FB_WIDTH 480
|
||||
#define TSH_MIPI_FB_HEIGHT 854
|
||||
|
||||
/* NOVATEK MIPI panel */
|
||||
#define NOV_MIPI_FB_WIDTH 540
|
||||
#define NOV_MIPI_FB_HEIGHT 960
|
||||
|
||||
#define MIPI_HSYNC_PULSE_WIDTH 50
|
||||
#define MIPI_HSYNC_BACK_PORCH_DCLK 500
|
||||
#define MIPI_HSYNC_FRONT_PORCH_DCLK 500
|
||||
|
||||
#define MIPI_VSYNC_PULSE_WIDTH 5
|
||||
#define MIPI_VSYNC_BACK_PORCH_LINES 20
|
||||
#define MIPI_VSYNC_FRONT_PORCH_LINES 20
|
||||
|
||||
#endif
|
@ -1,233 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
#include <platform/iomap.h>
|
||||
#include <reg.h>
|
||||
|
||||
#define LINUX_MACHTYPE_8660_SURF 2755
|
||||
#define LINUX_MACHTYPE_8660_FFA 3017
|
||||
#define LINUX_MACHTYPE_8660_FLUID 3124
|
||||
#define LINUX_MACHTYPE_8660_CHARM_SURF 3181
|
||||
#define LINUX_MACHTYPE_8660_CHARM_FFA 3199
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
static int emmc_boot = -1; /* set to uninitialized */
|
||||
int target_is_emmc_boot(void);
|
||||
void debug_led_write(char);
|
||||
char debug_led_read();
|
||||
uint32_t platform_id_read (void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
setup_fpga();
|
||||
|
||||
/* Setting Debug LEDs ON */
|
||||
debug_led_write(0xFF);
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
if(mmc_boot_main(MMC_SLOT,MSM_SDC1_BASE))
|
||||
{
|
||||
dprintf(CRITICAL, "mmc init failed!");
|
||||
ASSERT(0);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
struct smem_board_info_v5 board_info_v5;
|
||||
unsigned int board_info_len = 0;
|
||||
unsigned smem_status = 0;
|
||||
unsigned format = 0;
|
||||
unsigned id = 0;
|
||||
unsigned hw_platform = 0;
|
||||
unsigned fused_chip = 0;
|
||||
unsigned mach_id = LINUX_MACHTYPE_8660_FFA;
|
||||
|
||||
/* Detect external msm if this is a "fusion" */
|
||||
smem_status = smem_read_alloc_entry_offset(SMEM_BOARD_INFO_LOCATION,
|
||||
&format, sizeof(format), 0);
|
||||
if(!smem_status)
|
||||
{
|
||||
if (format >= 5)
|
||||
{
|
||||
board_info_len = sizeof(board_info_v5);
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_BOARD_INFO_LOCATION,
|
||||
&board_info_v5, board_info_len);
|
||||
if(!smem_status)
|
||||
{
|
||||
fused_chip = board_info_v5.fused_chip;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Detect SURF v/s FFA v/s Fluid */
|
||||
id = board_info_v5.board_info_v3.hw_platform;
|
||||
switch(id)
|
||||
{
|
||||
case 0x1:
|
||||
hw_platform = HW_PLATFORM_SURF;
|
||||
break;
|
||||
case 0x2:
|
||||
hw_platform = HW_PLATFORM_FFA;
|
||||
break;
|
||||
case 0x3:
|
||||
hw_platform = HW_PLATFORM_FLUID;
|
||||
break;
|
||||
default:
|
||||
/* Writing to Debug LED register and reading back to auto detect
|
||||
SURF and FFA. If we read back, it is SURF */
|
||||
debug_led_write(0xA5);
|
||||
|
||||
if((debug_led_read() & 0xFF) == 0xA5)
|
||||
{
|
||||
debug_led_write(0);
|
||||
hw_platform = HW_PLATFORM_SURF;
|
||||
}
|
||||
else
|
||||
hw_platform = HW_PLATFORM_FFA;
|
||||
};
|
||||
|
||||
/* Use hw_platform and fused_chip information to determine machine id */
|
||||
switch(fused_chip)
|
||||
{
|
||||
case UNKNOWN:
|
||||
if (hw_platform == HW_PLATFORM_SURF)
|
||||
mach_id = LINUX_MACHTYPE_8660_SURF;
|
||||
else if (hw_platform == HW_PLATFORM_FFA)
|
||||
mach_id = LINUX_MACHTYPE_8660_FFA;
|
||||
else if (hw_platform == HW_PLATFORM_FLUID)
|
||||
mach_id = LINUX_MACHTYPE_8660_FLUID;
|
||||
break;
|
||||
|
||||
case MDM9200:
|
||||
case MDM9600:
|
||||
if (hw_platform == HW_PLATFORM_SURF)
|
||||
mach_id = LINUX_MACHTYPE_8660_CHARM_SURF;
|
||||
else if (hw_platform == HW_PLATFORM_FFA)
|
||||
mach_id = LINUX_MACHTYPE_8660_CHARM_FFA;
|
||||
break;
|
||||
|
||||
default:
|
||||
mach_id = LINUX_MACHTYPE_8660_FFA;
|
||||
}
|
||||
|
||||
return mach_id;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
/* Reset WDG0 counter */
|
||||
writel(1,MSM_WDT0_RST);
|
||||
/* Disable WDG0 */
|
||||
writel(0,MSM_WDT0_EN);
|
||||
/* Set WDG0 bark time */
|
||||
writel(0x31F3,MSM_WDT0_BT);
|
||||
/* Enable WDG0 */
|
||||
writel(3,MSM_WDT0_EN);
|
||||
dmb();
|
||||
/* Enable WDG output */
|
||||
writel(3,MSM_TCSR_BASE + TCSR_WDOG_CFG);
|
||||
mdelay(10000);
|
||||
dprintf (CRITICAL, "Rebooting failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned restart_reason = 0;
|
||||
void *restart_reason_addr = 0x401FFFFC;
|
||||
|
||||
/* Read reboot reason and scrub it */
|
||||
restart_reason = readl(restart_reason_addr);
|
||||
writel(0x00, restart_reason_addr);
|
||||
|
||||
return restart_reason;
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
}
|
||||
|
||||
void setup_fpga()
|
||||
{
|
||||
writel(0x147, GPIO_CFG133_ADDR);
|
||||
writel(0x144, GPIO_CFG135_ADDR);
|
||||
writel(0x144, GPIO_CFG136_ADDR);
|
||||
writel(0x144, GPIO_CFG137_ADDR);
|
||||
writel(0x144, GPIO_CFG138_ADDR);
|
||||
writel(0x144, GPIO_CFG139_ADDR);
|
||||
writel(0x144, GPIO_CFG140_ADDR);
|
||||
writel(0x144, GPIO_CFG141_ADDR);
|
||||
writel(0x144, GPIO_CFG142_ADDR);
|
||||
writel(0x144, GPIO_CFG143_ADDR);
|
||||
writel(0x144, GPIO_CFG144_ADDR);
|
||||
writel(0x144, GPIO_CFG145_ADDR);
|
||||
writel(0x144, GPIO_CFG146_ADDR);
|
||||
writel(0x144, GPIO_CFG147_ADDR);
|
||||
writel(0x144, GPIO_CFG148_ADDR);
|
||||
writel(0x144, GPIO_CFG149_ADDR);
|
||||
writel(0x144, GPIO_CFG150_ADDR);
|
||||
writel(0x147, GPIO_CFG151_ADDR);
|
||||
writel(0x147, GPIO_CFG152_ADDR);
|
||||
writel(0x147, GPIO_CFG153_ADDR);
|
||||
writel(0x3, GPIO_CFG154_ADDR);
|
||||
writel(0x147, GPIO_CFG155_ADDR);
|
||||
writel(0x147, GPIO_CFG156_ADDR);
|
||||
writel(0x147, GPIO_CFG157_ADDR);
|
||||
writel(0x3, GPIO_CFG158_ADDR);
|
||||
|
||||
writel(0x00000B31, EBI2_CHIP_SELECT_CFG0);
|
||||
writel(0xA3030020, EBI2_XMEM_CS3_CFG1);
|
||||
}
|
||||
|
||||
void debug_led_write(char val)
|
||||
{
|
||||
writeb(val,SURF_DEBUG_LED_ADDR);
|
||||
}
|
||||
|
||||
char debug_led_read()
|
||||
{
|
||||
return readb(SURF_DEBUG_LED_ADDR);
|
||||
}
|
@ -1,60 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define BITS_IN_ELEMENT(x) (sizeof(x)[0] * 8)
|
||||
|
||||
static unsigned char qwerty_keys_old[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
static unsigned char qwerty_keys_new[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
|
||||
|
||||
#define KEYMAP_INDEX(row, col) (row)* BITS_IN_ELEMENT(qwerty_keys_new) + (col)
|
||||
|
||||
static unsigned int qwerty_keymap[] = {
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_BACK, /* Volume down key */
|
||||
};
|
||||
|
||||
static struct qwerty_keypad_info qwerty_keypad = {
|
||||
.keymap = qwerty_keymap,
|
||||
.old_keys = qwerty_keys_old,
|
||||
.rec_keys = qwerty_keys_new,
|
||||
.rows = 6,
|
||||
.columns = 5,
|
||||
.num_of_reads = 6,
|
||||
.rd_func = &pa1_ssbi2_read_bytes,
|
||||
.wr_func = &pa1_ssbi2_write_bytes,
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
ssbi_keypad_init(&qwerty_keypad);
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := msm8x60
|
||||
|
||||
MEMBASE := 0x40100000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x40200000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := 0x48000000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_SPLASH_SCREEN=1
|
||||
DEFINES += DISPLAY_TYPE_LCDC=1
|
||||
DEFINES += DISPLAY_TYPE_MIPI=0
|
||||
DEFINES += DISPLAY_MIPI_PANEL_NOVATEK_BLUE=0
|
||||
DEFINES += DISPLAY_MIPI_PANEL_TOSHIBA=0
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/keypad.o
|
@ -1,44 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(EMMC_BOOT), 1)
|
||||
APPSBOOTHDR_FILES := EMMCBOOT.MBN
|
||||
else
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn
|
||||
endif
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
|
||||
appsboot.mbn: appsboothd.mbn $(OUTBIN)
|
||||
cp $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboot.raw
|
||||
cat $(APPSBOOTHEADER_DIR)/appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
rm -f $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
EMMCBOOT.MBN: emmc_appsboothd.mbn $(OUTBIN)
|
||||
cp $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboot.raw
|
||||
cat $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/EMMCBOOT.MBN
|
||||
cat $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/emmc_appsboot.mbn
|
||||
rm -f $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn
|
||||
|
||||
emmc_appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/emmc_appsboothd.mbn
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} -DMEMBASE=$(MEMBASE) $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
cp $(SRC_DIR)/mkheader $(APPSBOOTHEADER_DIR)/mkheader
|
@ -1,316 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2007, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int print_usage(){
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr> <none|unified-boot>\n");
|
||||
fprintf(stderr," mkheader <bin> <hdr> <unsecure-boot> <outbin>\n");
|
||||
fprintf(stderr," mkheader <bin> <hdr> <secure-boot> <outbin> <maxsize>\n");
|
||||
fprintf(stderr," mkheader <bin> <hdr> <secure-boot> <outbin> <maxsize> <certchain> <files...>\n\n");
|
||||
fprintf(stderr,"bin: Input raw appsbl binary\n");
|
||||
fprintf(stderr,"hdr: Output of appsbl header location\n");
|
||||
fprintf(stderr,"outbin: Output of the signed or unsigned apps boot location\n");
|
||||
fprintf(stderr,"maxsize: Maximum size for certificate chain\n");
|
||||
fprintf(stderr,"certchain: Output of the certchain location\n");
|
||||
fprintf(stderr,"files: Input format <bin signature> <certifcate file(s) for certificate chain>...\n");
|
||||
fprintf(stderr,"certificate chain: Files will be concatenated in order to create the certificate chain\n\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int cat(FILE * in, FILE * out, unsigned size, unsigned buff_size){
|
||||
unsigned bytes_left = size;
|
||||
char buf[buff_size];
|
||||
int ret = 0;
|
||||
|
||||
while(bytes_left){
|
||||
fread(buf, sizeof(char), buff_size, in);
|
||||
if(!feof(in)){
|
||||
bytes_left -= fwrite(buf, sizeof(char), buff_size, out);
|
||||
}else
|
||||
bytes_left = 0;
|
||||
}
|
||||
ret = ferror(in) | ferror(out);
|
||||
if(ret)
|
||||
fprintf(stderr, "ERROR: Occured during file concatenation\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
int unified_boot = 0;
|
||||
unsigned unified_boot_magic[20];
|
||||
unsigned non_unified_boot_magic[10];
|
||||
unsigned magic_len = 0;
|
||||
unsigned *magic;
|
||||
unsigned cert_chain_size = 0;
|
||||
unsigned signature_size = 0;
|
||||
int secure_boot = 0;
|
||||
int fd;
|
||||
|
||||
if(argc < 3) {
|
||||
return print_usage();
|
||||
}
|
||||
|
||||
if (argc == 4) {
|
||||
if(!strcmp("unified-boot",argv[3])) {
|
||||
unified_boot = 1;
|
||||
}else if(!strcmp("secure-boot",argv[3])){
|
||||
fprintf(stderr,
|
||||
"ERROR: Missing arguments: [outbin maxsize] | [outbin, maxsize, certchain, signature + certifcate(s)]\n");
|
||||
return print_usage();
|
||||
}
|
||||
else if(!strcmp("unsecure-boot",argv[3])){
|
||||
fprintf(stderr,"ERROR: Missing arguments: outbin directory\n");
|
||||
return print_usage();
|
||||
}
|
||||
}
|
||||
|
||||
if (argc > 4) {
|
||||
if(!strcmp("secure-boot",argv[3])) {
|
||||
if(argc < 9 && argc != 6){
|
||||
fprintf(stderr,
|
||||
"ERROR: Missing argument(s): [outbin maxsize] | [outbin, maxsize, certchain, signature + certifcate(s)]\n");
|
||||
return print_usage();
|
||||
}
|
||||
secure_boot = 1;
|
||||
signature_size = 256; //Support SHA 256
|
||||
cert_chain_size = atoi(argv[5]);
|
||||
}
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(unified_boot) {
|
||||
magic = unified_boot_magic;
|
||||
magic_len = sizeof(unified_boot_magic);
|
||||
} else {
|
||||
magic = non_unified_boot_magic;
|
||||
magic_len = sizeof(non_unified_boot_magic);
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
#if MEMBASE
|
||||
base = MEMBASE;
|
||||
#else
|
||||
base = 0;
|
||||
#endif
|
||||
|
||||
printf("Image Destination Pointer: 0x%x\n", base);
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000003; //Flash_partition_version /* nand */
|
||||
magic[2] = 0x00000000; //image source pointer
|
||||
magic[3] = base; //image destination pointer
|
||||
magic[4] = size + cert_chain_size + signature_size; //image size
|
||||
magic[5] = size; //code size
|
||||
magic[6] = base + size;
|
||||
magic[7] = signature_size;
|
||||
magic[8] = size + base + signature_size;
|
||||
magic[9] = cert_chain_size;
|
||||
|
||||
if (unified_boot == 1)
|
||||
{
|
||||
magic[10] = 0x33836685; /* cookie magic number */
|
||||
magic[11] = 0x00000001; /* cookie version */
|
||||
magic[12] = 0x00000002; /* file formats */
|
||||
magic[13] = 0x00000000;
|
||||
magic[14] = 0x00000000; /* not setting size for boot.img */
|
||||
magic[15] = 0x00000000;
|
||||
magic[16] = 0x00000000;
|
||||
magic[17] = 0x00000000;
|
||||
magic[18] = 0x00000000;
|
||||
magic[19] = 0x00000000;
|
||||
}
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, magic_len) != magic_len) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
if (secure_boot && argc > 6){
|
||||
FILE * input_file;
|
||||
FILE * output_file;
|
||||
unsigned buff_size = 1;
|
||||
char buf[buff_size];
|
||||
unsigned bytes_left;
|
||||
unsigned current_cert_chain_size = 0;
|
||||
int padding_size = 0;
|
||||
int i;
|
||||
|
||||
if((output_file = fopen(argv[6], "wb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
printf("Certificate Chain Output File: %s\n", argv[6]);
|
||||
|
||||
for (i = 8; i < argc; i++){
|
||||
if((input_file = fopen(argv[i], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[i], &s);
|
||||
bytes_left = s.st_size;
|
||||
current_cert_chain_size += bytes_left;
|
||||
if (cat(input_file, output_file, bytes_left, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
}
|
||||
|
||||
//Pad certifcate chain to the max expected size from input
|
||||
memset(buf, 0xFF, sizeof(buf));
|
||||
padding_size = cert_chain_size - current_cert_chain_size;
|
||||
|
||||
if(padding_size <0){
|
||||
fprintf(stderr, "ERROR: Input certificate chain (Size=%d) is larger than the maximum specified (Size=%d)\n",
|
||||
current_cert_chain_size, cert_chain_size);
|
||||
return -1;
|
||||
}
|
||||
|
||||
bytes_left = (padding_size > 0) ? padding_size : 0;
|
||||
while(bytes_left){
|
||||
if(!ferror(output_file))
|
||||
bytes_left -= fwrite(buf, sizeof(buf), buff_size, output_file);
|
||||
else{
|
||||
fprintf(stderr, "ERROR: Occured during certifcate chain padding\n");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
fclose(output_file);
|
||||
|
||||
//Concat and combine to signed image. Format [HDR][RAW APPSBOOT][PADDED CERT CHAIN]
|
||||
if((output_file = fopen(argv[4], "wb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
printf("Image Output File: %s\n", argv[4]);
|
||||
|
||||
//Header
|
||||
if((input_file = fopen(argv[2], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[2], &s);
|
||||
if (cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Raw Appsbl
|
||||
if((input_file = fopen(argv[1], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[1], &s);
|
||||
if(cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Signature
|
||||
if((input_file = fopen(argv[7], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[7], &s);
|
||||
if(cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Certifcate Chain
|
||||
if((input_file = fopen(argv[6], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
if(cat(input_file, output_file, (current_cert_chain_size + padding_size), buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
fclose(output_file);
|
||||
|
||||
}else if(argc == 5 || argc == 6){
|
||||
FILE * input_file;
|
||||
FILE * output_file;
|
||||
unsigned buff_size = 1;
|
||||
char buf[buff_size];
|
||||
|
||||
//Concat and combine to unsigned image. Format [HDR][RAW APPSBOOT]
|
||||
if((output_file = fopen(argv[4], "wb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
printf("Image Output File: %s\n", argv[4]);
|
||||
|
||||
//Header
|
||||
if((input_file = fopen(argv[2], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[2], &s);
|
||||
if (cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
|
||||
//Raw Appsbl
|
||||
if((input_file = fopen(argv[1], "rb"))==NULL){
|
||||
perror("ERROR: Occured during fopen");
|
||||
return -1;
|
||||
}
|
||||
stat(argv[1], &s);
|
||||
if(cat(input_file, output_file, s.st_size, buff_size))
|
||||
return -1;
|
||||
fclose(input_file);
|
||||
fclose(output_file);
|
||||
}
|
||||
|
||||
printf("Done execution\n");
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
#include <err.h>
|
||||
#include <debug.h>
|
||||
#include <target.h>
|
||||
#include <compiler.h>
|
||||
#include <dev/net/smc91c96.h>
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
smc91c96_init();
|
||||
}
|
||||
|
@ -1,17 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
PLATFORM := omap5912
|
||||
|
||||
MODULES += \
|
||||
dev/net/smc91c96
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o
|
||||
|
||||
MEMSIZE := 0x02000000 # 32MB
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
SMC91C96_BASE_ADDR=0x04800300 \
|
||||
SMC91C96_IRQ=0
|
||||
|
@ -1,7 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
PLATFORM := integrator
|
||||
|
||||
MEMBASE := 0x10000 # this is where qemu loads us
|
||||
MEMSIZE := 0x08000000 # 128MB
|
||||
|
@ -1,82 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
|
||||
#define EBI1_SIZE1 0x0E800000 //232MB for 256/512/1024MB RAM
|
||||
#define EBI1_ADDR1 0x20000000
|
||||
|
||||
#define EBI1_SIZE2_512M 0x10000000 //256MB for 512MB RAM
|
||||
#define EBI1_SIZE2_1G 0x30000000 //768MB for 1GB RAM
|
||||
#define EBI1_ADDR2 0x30000000
|
||||
|
||||
static unsigned check_1gb_mem()
|
||||
{
|
||||
// check for 1GB
|
||||
unsigned adr1 = 0x57000000;
|
||||
unsigned adr2 = 0x5F000000;
|
||||
unsigned value1 = 0x55555555;
|
||||
unsigned value2 = 0xAAAAAAAA;
|
||||
|
||||
writel(value1, adr1);
|
||||
writel(value2, adr2);
|
||||
|
||||
return ((value1 == readl(adr1)) && (value2 == readl(adr2)));
|
||||
}
|
||||
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
unsigned size;
|
||||
|
||||
/* ATAG_MEM */
|
||||
/* 1st segment */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = EBI1_SIZE1;
|
||||
*ptr++ = EBI1_ADDR1;
|
||||
|
||||
/* 2nd segment */
|
||||
#ifdef USE_512M_RAM
|
||||
size = EBI1_SIZE2_512M;
|
||||
#else
|
||||
size = 0;
|
||||
#endif
|
||||
if (check_1gb_mem()) {
|
||||
size = EBI1_SIZE2_1G;
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = size;
|
||||
*ptr++ = EBI1_ADDR2;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_QSD8250_FFA_DISPLAY_H
|
||||
#define _TARGET_QSD8250_FFA_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 480
|
||||
#define TARGET_YRES 800
|
||||
|
||||
#define LCDC_FB_WIDTH 800
|
||||
#define LCDC_FB_HEIGHT 480
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 20
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 27
|
||||
|
||||
#endif
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2710
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 100 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 30 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
void usb_charger_change_state(void);
|
||||
void usb_charger_reset(void);
|
||||
void usb_stop_charging(unsigned);
|
||||
void keypad_init(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
if(disconnect){
|
||||
usb_charger_reset();
|
||||
return;
|
||||
}
|
||||
else
|
||||
usb_stop_charging(!enable);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
thread_sleep(10);
|
||||
usb_charger_change_state();
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 36
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 38, 39, 40, 41, 42 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_VOLUMEDOWN,
|
||||
/*[KEYMAP_INDEX(0, 1)] = ,*/
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_8,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_5,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_4,
|
||||
/*[KEYMAP_INDEX(1, 3)] = ,*/
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_HOME, /* A */
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_BACK, /* B */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_0,
|
||||
[KEYMAP_INDEX(2, 3)] = 228, /* KEY_SHARP */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_9,
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_3,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_VOLUMEUP,
|
||||
/*[KEYMAP_INDEX(3, 3)] = ,*/
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_6,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = 232, /* OK */
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_SOUND,
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_SEND,
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_LEFT,
|
||||
|
||||
/*[KEYMAP_INDEX(5, 0)] = ,*/
|
||||
[KEYMAP_INDEX(5, 1)] = 227, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = 230, /* (SOFT2)2 */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_MENU, /* 1 */
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := qsd8k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x20000000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x04000000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += ENABLE_BATTERY_CHARGING=1
|
||||
DEFINES += DISPLAY_SPLASH_SCREEN=1
|
||||
DEFINES += DISPLAY_TYPE_MDDI=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/keypad.o
|
@ -1,30 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
|
||||
appsboot.mbn: appsboothd.mbn $(OUTBIN)
|
||||
cat $(APPSBOOTHEADER_DIR)/appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
rm -rf $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
|
@ -1,55 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
unsigned magic[10];
|
||||
int fd;
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, sizeof(magic)) != sizeof(magic)) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,82 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
|
||||
#define EBI1_SIZE1 0x0E800000 //232MB for 256/512/1024MB RAM
|
||||
#define EBI1_ADDR1 0x20000000
|
||||
|
||||
#define EBI1_SIZE2_512M 0x10000000 //256MB for 512MB RAM
|
||||
#define EBI1_SIZE2_1G 0x30000000 //768MB for 1GB RAM
|
||||
#define EBI1_ADDR2 0x30000000
|
||||
|
||||
static unsigned check_1gb_mem()
|
||||
{
|
||||
// check for 1GB
|
||||
unsigned adr1 = 0x57000000;
|
||||
unsigned adr2 = 0x5F000000;
|
||||
unsigned value1 = 0x55555555;
|
||||
unsigned value2 = 0xAAAAAAAA;
|
||||
|
||||
writel(value1, adr1);
|
||||
writel(value2, adr2);
|
||||
|
||||
return ((value1 == readl(adr1)) && (value2 == readl(adr2)));
|
||||
}
|
||||
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
unsigned size;
|
||||
|
||||
/* ATAG_MEM */
|
||||
/* 1st segment */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = EBI1_SIZE1;
|
||||
*ptr++ = EBI1_ADDR1;
|
||||
|
||||
/* 2nd segment */
|
||||
#ifdef USE_512M_RAM
|
||||
size = EBI1_SIZE2_512M;
|
||||
#else
|
||||
size = 0;
|
||||
#endif
|
||||
if (check_1gb_mem()) {
|
||||
size = EBI1_SIZE2_1G;
|
||||
}
|
||||
|
||||
if (size > 0) {
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = size;
|
||||
*ptr++ = EBI1_ADDR2;
|
||||
}
|
||||
|
||||
return ptr;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_QSD8250_SURF_DISPLAY_H
|
||||
#define _TARGET_QSD8250_SURF_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 800
|
||||
#define TARGET_YRES 480
|
||||
|
||||
#define LCDC_FB_WIDTH 800
|
||||
#define LCDC_FB_HEIGHT 480
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 20
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 27
|
||||
|
||||
#endif
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2708
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 100 /* In MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 30 /* In MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 1 /* In MB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 5 /* In MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
void usb_charger_change_state(void);
|
||||
void usb_charger_reset(void);
|
||||
void usb_stop_charging(unsigned);
|
||||
void keypad_init(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
unsigned blocks_per_1MB = 8; /* Default value of 2k page size on 256MB flash drive*/
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
blocks_per_1MB = (1 << 20) / (flash_info->block_size);
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ((ptn->length) * blocks_per_1MB);
|
||||
|
||||
if(ptn->start != 0)
|
||||
ASSERT(ptn->start == DIFF_START_ADDR);
|
||||
|
||||
ptn->start = next_ptr_start_adr;
|
||||
|
||||
if(ptn->length == VARIABLE_LENGTH)
|
||||
{
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += ((temp_ptn->length) * blocks_per_1MB);
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
}
|
||||
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
if(disconnect){
|
||||
usb_charger_reset();
|
||||
return;
|
||||
}
|
||||
else
|
||||
usb_stop_charging(!enable);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
thread_sleep(10);
|
||||
usb_charger_change_state();
|
||||
}
|
||||
}
|
@ -1,112 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_SOFT1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_6,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_0,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_SEND,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, /* FA */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_F8, /* QCHT */
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_F6, /* R+ */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_F7, /* R- */
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_SOFT2, /* SOFT2 */
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_CENTER, /* KEY_CENTER */
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_BACK, /* FB */
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_STAR, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_MAIL, /* MESG */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_3,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := qsd8k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x20000000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x04000000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += ENABLE_BATTERY_CHARGING=1
|
||||
DEFINES += DISPLAY_SPLASH_SCREEN=1
|
||||
DEFINES += DISPLAY_TYPE_LCDC=1
|
||||
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/keypad.o
|
@ -1,30 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
|
||||
appsboot.mbn: appsboothd.mbn $(OUTBIN)
|
||||
cat $(APPSBOOTHEADER_DIR)/appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
rm -rf $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
|
@ -1,55 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
unsigned magic[10];
|
||||
int fd;
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, sizeof(magic)) != sizeof(magic)) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
|
||||
#define EBI1_SIZE1 0x0E000000 //224M
|
||||
#define EBI1_ADDR1 0x00000000
|
||||
|
||||
#define EBI1_SIZE2 0x30000000 //768M
|
||||
#define EBI1_ADDR2 0x10000000
|
||||
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
unsigned size;
|
||||
|
||||
/* ATAG_MEM */
|
||||
/* 1st segment */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = EBI1_SIZE1;
|
||||
*ptr++ = EBI1_ADDR1;
|
||||
|
||||
/* 2nd segment */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = EBI1_SIZE2;
|
||||
*ptr++ = EBI1_ADDR2;
|
||||
|
||||
return ptr;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following
|
||||
* disclaimer in the documentation and/or other materials provided
|
||||
* with the distribution.
|
||||
* * Neither the name of Code Aurora Forum, Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived
|
||||
* from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
|
||||
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
||||
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
||||
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
||||
* IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
#ifndef _TARGET_QSD8650A_ST1X_DISPLAY_H
|
||||
#define _TARGET_QSD8650A_ST1X_DISPLAY_H
|
||||
|
||||
#define TARGET_XRES 800
|
||||
#define TARGET_YRES 480
|
||||
|
||||
#define LCDC_FB_WIDTH 800
|
||||
#define LCDC_FB_HEIGHT 480
|
||||
|
||||
#define LCDC_HSYNC_PULSE_WIDTH_DCLK 60
|
||||
#define LCDC_HSYNC_BACK_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_FRONT_PORCH_DCLK 81
|
||||
#define LCDC_HSYNC_SKEW_DCLK 0
|
||||
|
||||
#define LCDC_VSYNC_PULSE_WIDTH_LINES 2
|
||||
#define LCDC_VSYNC_BACK_PORCH_LINES 20
|
||||
#define LCDC_VSYNC_FRONT_PORCH_LINES 27
|
||||
|
||||
#endif
|
@ -1,200 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
#include <smem.h>
|
||||
|
||||
#define LINUX_MACHTYPE 2627
|
||||
|
||||
#define VARIABLE_LENGTH 0x10101010
|
||||
#define DIFF_START_ADDR 0xF0F0F0F0
|
||||
#define NUM_PAGES_PER_BLOCK 0x40
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 40 /* 5MB */,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = 40,
|
||||
.length = 800 /* 100MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = 840,
|
||||
.length = 240 /* 30MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = 1080,
|
||||
.length = 3 /* 384KB */,
|
||||
.name = "misc",
|
||||
},
|
||||
{
|
||||
.start = 1083,
|
||||
.length = VARIABLE_LENGTH,
|
||||
.name = "userdata",
|
||||
},
|
||||
{
|
||||
.start = DIFF_START_ADDR,
|
||||
.length = 40 /* 5MB */,
|
||||
.name = "recovery",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
void usb_charger_change_state(void);
|
||||
void usb_charger_reset(void);
|
||||
void usb_stop_charging(unsigned);
|
||||
void keypad_init(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
unsigned total_num_of_blocks;
|
||||
bool start_addr_changed = false;
|
||||
unsigned next_ptr_start_adr = 0;
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
#if (!ENABLE_NANDWRITE)
|
||||
keys_init();
|
||||
keypad_init();
|
||||
#endif
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
while(1);
|
||||
|
||||
total_num_of_blocks = flash_info->num_blocks;
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ptn->length;
|
||||
|
||||
if(len == VARIABLE_LENGTH)
|
||||
{
|
||||
start_addr_changed = true;
|
||||
unsigned length_for_prt = 0;
|
||||
unsigned j;
|
||||
for (j = i+1; j < num_parts; j++)
|
||||
{
|
||||
struct ptentry *temp_ptn = &board_part_list[j];
|
||||
ASSERT(temp_ptn->length != VARIABLE_LENGTH);
|
||||
length_for_prt += temp_ptn->length;
|
||||
}
|
||||
len = (total_num_of_blocks - 1) - (offset + ptn->start + length_for_prt);
|
||||
ASSERT(len >= 0);
|
||||
next_ptr_start_adr = ptn->start + len;
|
||||
}
|
||||
if((ptn->start == DIFF_START_ADDR) && (start_addr_changed))
|
||||
{
|
||||
ASSERT(next_ptr_start_adr);
|
||||
ptn->start = next_ptr_start_adr;
|
||||
next_ptr_start_adr = ptn->start + ptn->length;
|
||||
}
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags, TYPE_APPS_PARTITION, PERM_WRITEABLE);
|
||||
}
|
||||
|
||||
smem_add_modem_partitions(&flash_ptable);
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
||||
|
||||
void reboot_device(unsigned reboot_reason)
|
||||
{
|
||||
reboot(reboot_reason);
|
||||
}
|
||||
|
||||
unsigned check_reboot_mode(void)
|
||||
{
|
||||
unsigned mode[2] = {0, 0};
|
||||
unsigned int mode_len = sizeof(mode);
|
||||
unsigned smem_status;
|
||||
|
||||
smem_status = smem_read_alloc_entry(SMEM_APPS_BOOT_MODE,
|
||||
&mode, mode_len );
|
||||
if(smem_status)
|
||||
{
|
||||
dprintf(CRITICAL, "ERROR: unable to read shared memory for reboot mode\n");
|
||||
return 0;
|
||||
}
|
||||
return mode[0];
|
||||
}
|
||||
|
||||
void target_battery_charging_enable(unsigned enable, unsigned disconnect)
|
||||
{
|
||||
if(disconnect){
|
||||
usb_charger_reset();
|
||||
return;
|
||||
}
|
||||
else
|
||||
usb_stop_charging(!enable);
|
||||
|
||||
for(;;)
|
||||
{
|
||||
thread_sleep(10);
|
||||
usb_charger_change_state();
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include -I$(LK_TOP_DIR)/platform/msm_shared
|
||||
|
||||
PLATFORM := qsd8650a
|
||||
|
||||
MEMBASE := 0xE0000000 # SMI
|
||||
MEMSIZE := 0x00100000 # 1MB
|
||||
|
||||
BASE_ADDR := 0x00000000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00008000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x04000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x00008000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += ENABLE_BATTERY_CHARGING=0
|
||||
DEFINES += NO_KEYPAD_DRIVER=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/keypad.o
|
@ -1,30 +0,0 @@
|
||||
#Makefile to generate appsboot.mbn
|
||||
|
||||
ifeq ($(BOOTLOADER_OUT),.)
|
||||
APPSBOOTHEADER_DIR := $(BUILDDIR)
|
||||
else
|
||||
APPSBOOTHEADER_DIR := $(BOOTLOADER_OUT)/../../
|
||||
endif
|
||||
|
||||
SRC_DIR := target/$(TARGET)/tools
|
||||
COMPILER := gcc
|
||||
|
||||
ifeq ($(BUILD_NANDWRITE), 1)
|
||||
APPSBOOTHDR_FILES :=
|
||||
else
|
||||
APPSBOOTHDR_FILES := appsboot.mbn
|
||||
endif
|
||||
|
||||
APPSBOOTHEADER: $(APPSBOOTHDR_FILES)
|
||||
|
||||
|
||||
appsboot.mbn: appsboothd.mbn $(OUTBIN)
|
||||
cat $(APPSBOOTHEADER_DIR)/appsboothd.mbn $(OUTBIN) > $(APPSBOOTHEADER_DIR)/appsboot.mbn
|
||||
rm -rf $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
appsboothd.mbn: mkheader $(OUTBIN)
|
||||
$(SRC_DIR)/mkheader $(OUTBIN) $(APPSBOOTHEADER_DIR)/appsboothd.mbn
|
||||
|
||||
mkheader: $(SRC_DIR)/mkheader.c
|
||||
${COMPILER} $(SRC_DIR)/mkheader.c -o $(SRC_DIR)/mkheader
|
||||
|
@ -1,55 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
struct stat s;
|
||||
unsigned size, base;
|
||||
unsigned magic[10];
|
||||
int fd;
|
||||
|
||||
if(argc != 3) {
|
||||
fprintf(stderr,"usage: mkheader <bin> <hdr>\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(stat(argv[1], &s)) {
|
||||
perror("cannot stat binary");
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = s.st_size;
|
||||
base = 0xE0000000;
|
||||
|
||||
magic[0] = 0x00000005; /* appsbl */
|
||||
magic[1] = 0x00000002; /* nand */
|
||||
magic[2] = 0x00000000;
|
||||
magic[3] = base;
|
||||
magic[4] = size;
|
||||
magic[5] = size;
|
||||
magic[6] = size + base;
|
||||
magic[7] = 0x00000000;
|
||||
magic[8] = size + base;
|
||||
magic[9] = 0x00000000;
|
||||
|
||||
fd = open(argv[2], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if(fd < 0) {
|
||||
perror("cannot open header for writing");
|
||||
return -1;
|
||||
}
|
||||
if(write(fd, magic, sizeof(magic)) != sizeof(magic)) {
|
||||
perror("cannot write header");
|
||||
close(fd);
|
||||
unlink(argv[2]);
|
||||
return -1;
|
||||
}
|
||||
close(fd);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,6 +0,0 @@
|
||||
Olimex SAM7-EX256 Board
|
||||
http://olimex.com/dev/sam7-ex256.html
|
||||
http://olimex.com/dev/images/sam7-ex256-sch.gif
|
||||
|
||||
This platform is a specialization of the generic platform/at91sam7
|
||||
|
@ -1,9 +0,0 @@
|
||||
# debug uart
|
||||
#
|
||||
PA27 DRXD
|
||||
PA28 DTXD
|
||||
|
||||
# CAN
|
||||
#
|
||||
PA19 CANRX
|
||||
PA20 CANTX
|
@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining
|
||||
* a copy of this software and associated documentation files
|
||||
* (the "Software"), to deal in the Software without restriction,
|
||||
* including without limitation the rights to use, copy, modify, merge,
|
||||
* publish, distribute, sublicense, and/or sell copies of the Software,
|
||||
* and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be
|
||||
* included in all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
/* DO NOT EDIT -- AUTOGENERATED FROM 'include/platform/mux.def' */
|
||||
|
||||
#ifndef __BOARD_DEFINITION_FILE__
|
||||
#define __BOARD_DEFINITION_FILE__
|
||||
|
||||
#define PIN_DRXD (1 << 27)
|
||||
#define PIN_DTXD (1 << 28)
|
||||
#define PIN_CANRX (1 << 19)
|
||||
#define PIN_CANTX (1 << 20)
|
||||
|
||||
#define BOARD_OUTPUT_DISABLE 0xffffffff
|
||||
#define BOARD_OUTPUT_ENABLE 0x00000000
|
||||
#define BOARD_PULLUP_DISABLE 0x18180000
|
||||
#define BOARD_PULLUP_ENABLE 0xe7e7ffff
|
||||
#define BOARD_PIO_DISABLE 0x18180000
|
||||
#define BOARD_PIO_ENABLE 0xe7e7ffff
|
||||
#define BOARD_SELECT_A 0x18180000
|
||||
#define BOARD_SELECT_B 0x00000000
|
||||
|
||||
#endif
|
@ -1 +0,0 @@
|
||||
../../platform/at91sam7/mkboard.py ../../platform/at91sam7/at91sam7x.pins include/platform/mux.def
|
@ -1,10 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
AT91CHIP := sam7x256
|
||||
|
||||
PLATFORM := at91sam7
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include
|
||||
|
||||
OBJS +=
|
||||
|
@ -1,43 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
|
||||
#define EBI1_SIZE1 0x0CB00000 //203MB for 256 RAM
|
||||
#define EBI1_ADDR1 0x00200000
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = EBI1_SIZE1;
|
||||
*ptr++ = EBI1_ADDR1;
|
||||
|
||||
return ptr;
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
|
||||
#define BOARD_FLASH_OFFSET 378
|
||||
|
||||
#define LINUX_MACHTYPE 0x0000059F
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 40,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = 56,
|
||||
.length = 608 /* 76MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = 664,
|
||||
.length = 608 /* 76MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = 1272,
|
||||
.length = 0,
|
||||
.name = "userdata",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
keys_init();
|
||||
keypad_init();
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
offset = BOARD_FLASH_OFFSET;
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ptn->length;
|
||||
|
||||
if ((len == 0) && (i == num_parts - 1))
|
||||
len = flash_info->num_blocks - offset - ptn->start;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags);
|
||||
}
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
@ -1,111 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
|
||||
|
||||
/* don't turn this on without updating the ffa support */
|
||||
#define SCAN_FUNCTION_KEYS 0
|
||||
|
||||
static unsigned int halibut_row_gpios[] = {
|
||||
31, 32, 33, 34, 35, 41
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
, 42
|
||||
#endif
|
||||
};
|
||||
|
||||
static unsigned int halibut_col_gpios[] = { 36, 37, 38, 39, 40 };
|
||||
|
||||
#define KEYMAP_INDEX(row, col) ((row)*ARRAY_SIZE(halibut_col_gpios) + (col))
|
||||
|
||||
static const unsigned short halibut_keymap[ARRAY_SIZE(halibut_col_gpios) * ARRAY_SIZE(halibut_row_gpios)] = {
|
||||
[KEYMAP_INDEX(0, 0)] = KEY_5,
|
||||
[KEYMAP_INDEX(0, 1)] = KEY_9,
|
||||
[KEYMAP_INDEX(0, 2)] = KEY_SOFT1,
|
||||
[KEYMAP_INDEX(0, 3)] = KEY_6,
|
||||
[KEYMAP_INDEX(0, 4)] = KEY_LEFT,
|
||||
|
||||
[KEYMAP_INDEX(1, 0)] = KEY_0,
|
||||
[KEYMAP_INDEX(1, 1)] = KEY_RIGHT,
|
||||
[KEYMAP_INDEX(1, 2)] = KEY_1,
|
||||
[KEYMAP_INDEX(1, 3)] = KEY_SHARP,
|
||||
[KEYMAP_INDEX(1, 4)] = KEY_SEND,
|
||||
|
||||
[KEYMAP_INDEX(2, 0)] = KEY_VOLUMEUP,
|
||||
[KEYMAP_INDEX(2, 1)] = KEY_HOME, /* FA */
|
||||
[KEYMAP_INDEX(2, 2)] = KEY_F8, /* QCHT */
|
||||
[KEYMAP_INDEX(2, 3)] = KEY_F6, /* R+ */
|
||||
[KEYMAP_INDEX(2, 4)] = KEY_F7, /* R- */
|
||||
|
||||
[KEYMAP_INDEX(3, 0)] = KEY_UP,
|
||||
[KEYMAP_INDEX(3, 1)] = KEY_CLEAR,
|
||||
[KEYMAP_INDEX(3, 2)] = KEY_4,
|
||||
[KEYMAP_INDEX(3, 3)] = KEY_MUTE, /* SPKR */
|
||||
[KEYMAP_INDEX(3, 4)] = KEY_2,
|
||||
|
||||
[KEYMAP_INDEX(4, 0)] = KEY_SOFT2, /* SOFT2 */
|
||||
[KEYMAP_INDEX(4, 1)] = KEY_CENTER, /* KEY_CENTER */
|
||||
[KEYMAP_INDEX(4, 2)] = KEY_DOWN,
|
||||
[KEYMAP_INDEX(4, 3)] = KEY_BACK, /* FB */
|
||||
[KEYMAP_INDEX(4, 4)] = KEY_8,
|
||||
|
||||
[KEYMAP_INDEX(5, 0)] = KEY_VOLUMEDOWN,
|
||||
[KEYMAP_INDEX(5, 1)] = KEY_STAR, /* KEY_STAR */
|
||||
[KEYMAP_INDEX(5, 2)] = KEY_MAIL, /* MESG */
|
||||
[KEYMAP_INDEX(5, 3)] = KEY_3,
|
||||
[KEYMAP_INDEX(5, 4)] = KEY_7,
|
||||
|
||||
#if SCAN_FUNCTION_KEYS
|
||||
[KEYMAP_INDEX(6, 0)] = KEY_F5,
|
||||
[KEYMAP_INDEX(6, 1)] = KEY_F4,
|
||||
[KEYMAP_INDEX(6, 2)] = KEY_F3,
|
||||
[KEYMAP_INDEX(6, 3)] = KEY_F2,
|
||||
[KEYMAP_INDEX(6, 4)] = KEY_F1
|
||||
#endif
|
||||
};
|
||||
|
||||
static struct gpio_keypad_info halibut_keypad_info = {
|
||||
.keymap = halibut_keymap,
|
||||
.output_gpios = halibut_row_gpios,
|
||||
.input_gpios = halibut_col_gpios,
|
||||
.noutputs = ARRAY_SIZE(halibut_row_gpios),
|
||||
.ninputs = ARRAY_SIZE(halibut_col_gpios),
|
||||
.settle_time = 5 /* msec */,
|
||||
.poll_time = 20 /* msec */,
|
||||
.flags = GPIOKPF_DRIVE_INACTIVE,
|
||||
};
|
||||
|
||||
void keypad_init(void)
|
||||
{
|
||||
gpio_keypad_init(&halibut_keypad_info);
|
||||
}
|
@ -1,471 +0,0 @@
|
||||
/* Copyright 2007, Google Inc. */
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/gpio.h>
|
||||
#include <kernel/thread.h>
|
||||
#include <platform/mddi.h>
|
||||
|
||||
#define MDDI_CLIENT_CORE_BASE 0x108000
|
||||
#define LCD_CONTROL_BLOCK_BASE 0x110000
|
||||
#define SPI_BLOCK_BASE 0x120000
|
||||
#define I2C_BLOCK_BASE 0x130000
|
||||
#define PWM_BLOCK_BASE 0x140000
|
||||
#define GPIO_BLOCK_BASE 0x150000
|
||||
#define SYSTEM_BLOCK1_BASE 0x160000
|
||||
#define SYSTEM_BLOCK2_BASE 0x170000
|
||||
|
||||
|
||||
#define MDDICAP0 (MDDI_CLIENT_CORE_BASE|0x00)
|
||||
#define MDDICAP1 (MDDI_CLIENT_CORE_BASE|0x04)
|
||||
#define MDDICAP2 (MDDI_CLIENT_CORE_BASE|0x08)
|
||||
#define MDDICAP3 (MDDI_CLIENT_CORE_BASE|0x0C)
|
||||
#define MDCAPCHG (MDDI_CLIENT_CORE_BASE|0x10)
|
||||
#define MDCRCERC (MDDI_CLIENT_CORE_BASE|0x14)
|
||||
#define TTBUSSEL (MDDI_CLIENT_CORE_BASE|0x18)
|
||||
#define DPSET0 (MDDI_CLIENT_CORE_BASE|0x1C)
|
||||
#define DPSET1 (MDDI_CLIENT_CORE_BASE|0x20)
|
||||
#define DPSUS (MDDI_CLIENT_CORE_BASE|0x24)
|
||||
#define DPRUN (MDDI_CLIENT_CORE_BASE|0x28)
|
||||
#define SYSCKENA (MDDI_CLIENT_CORE_BASE|0x2C)
|
||||
#define TESTMODE (MDDI_CLIENT_CORE_BASE|0x30)
|
||||
#define FIFOMONI (MDDI_CLIENT_CORE_BASE|0x34)
|
||||
#define INTMONI (MDDI_CLIENT_CORE_BASE|0x38)
|
||||
#define MDIOBIST (MDDI_CLIENT_CORE_BASE|0x3C)
|
||||
#define MDIOPSET (MDDI_CLIENT_CORE_BASE|0x40)
|
||||
#define BITMAP0 (MDDI_CLIENT_CORE_BASE|0x44)
|
||||
#define BITMAP1 (MDDI_CLIENT_CORE_BASE|0x48)
|
||||
#define BITMAP2 (MDDI_CLIENT_CORE_BASE|0x4C)
|
||||
#define BITMAP3 (MDDI_CLIENT_CORE_BASE|0x50)
|
||||
#define BITMAP4 (MDDI_CLIENT_CORE_BASE|0x54)
|
||||
|
||||
|
||||
#define SRST (LCD_CONTROL_BLOCK_BASE|0x00)
|
||||
#define PORT_ENB (LCD_CONTROL_BLOCK_BASE|0x04)
|
||||
#define START (LCD_CONTROL_BLOCK_BASE|0x08)
|
||||
#define PORT (LCD_CONTROL_BLOCK_BASE|0x0C)
|
||||
#define CMN (LCD_CONTROL_BLOCK_BASE|0x10)
|
||||
#define GAMMA (LCD_CONTROL_BLOCK_BASE|0x14)
|
||||
#define INTFLG (LCD_CONTROL_BLOCK_BASE|0x18)
|
||||
#define INTMSK (LCD_CONTROL_BLOCK_BASE|0x1C)
|
||||
#define MPLFBUF (LCD_CONTROL_BLOCK_BASE|0x20)
|
||||
#define HDE_LEFT (LCD_CONTROL_BLOCK_BASE|0x24)
|
||||
#define VDE_TOP (LCD_CONTROL_BLOCK_BASE|0x28)
|
||||
|
||||
#define PXL (LCD_CONTROL_BLOCK_BASE|0x30)
|
||||
#define HCYCLE (LCD_CONTROL_BLOCK_BASE|0x34)
|
||||
#define HSW (LCD_CONTROL_BLOCK_BASE|0x38)
|
||||
#define HDE_START (LCD_CONTROL_BLOCK_BASE|0x3C)
|
||||
#define HDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x40)
|
||||
#define VCYCLE (LCD_CONTROL_BLOCK_BASE|0x44)
|
||||
#define VSW (LCD_CONTROL_BLOCK_BASE|0x48)
|
||||
#define VDE_START (LCD_CONTROL_BLOCK_BASE|0x4C)
|
||||
#define VDE_SIZE (LCD_CONTROL_BLOCK_BASE|0x50)
|
||||
#define WAKEUP (LCD_CONTROL_BLOCK_BASE|0x54)
|
||||
#define WSYN_DLY (LCD_CONTROL_BLOCK_BASE|0x58)
|
||||
#define REGENB (LCD_CONTROL_BLOCK_BASE|0x5C)
|
||||
#define VSYNIF (LCD_CONTROL_BLOCK_BASE|0x60)
|
||||
#define WRSTB (LCD_CONTROL_BLOCK_BASE|0x64)
|
||||
#define RDSTB (LCD_CONTROL_BLOCK_BASE|0x68)
|
||||
#define ASY_DATA (LCD_CONTROL_BLOCK_BASE|0x6C)
|
||||
#define ASY_DATB (LCD_CONTROL_BLOCK_BASE|0x70)
|
||||
#define ASY_DATC (LCD_CONTROL_BLOCK_BASE|0x74)
|
||||
#define ASY_DATD (LCD_CONTROL_BLOCK_BASE|0x78)
|
||||
#define ASY_DATE (LCD_CONTROL_BLOCK_BASE|0x7C)
|
||||
#define ASY_DATF (LCD_CONTROL_BLOCK_BASE|0x80)
|
||||
#define ASY_DATG (LCD_CONTROL_BLOCK_BASE|0x84)
|
||||
#define ASY_DATH (LCD_CONTROL_BLOCK_BASE|0x88)
|
||||
#define ASY_CMDSET (LCD_CONTROL_BLOCK_BASE|0x8C)
|
||||
|
||||
#define MONI (LCD_CONTROL_BLOCK_BASE|0xB0)
|
||||
|
||||
#define Current (LCD_CONTROL_BLOCK_BASE|0xC0)
|
||||
#define LCD (LCD_CONTROL_BLOCK_BASE|0xC4)
|
||||
#define COMMAND (LCD_CONTROL_BLOCK_BASE|0xC8)
|
||||
|
||||
|
||||
#define SSICTL (SPI_BLOCK_BASE|0x00)
|
||||
#define SSITIME (SPI_BLOCK_BASE|0x04)
|
||||
#define SSITX (SPI_BLOCK_BASE|0x08)
|
||||
#define SSIRX (SPI_BLOCK_BASE|0x0C)
|
||||
#define SSIINTC (SPI_BLOCK_BASE|0x10)
|
||||
#define SSIINTS (SPI_BLOCK_BASE|0x14)
|
||||
#define SSIDBG1 (SPI_BLOCK_BASE|0x18)
|
||||
#define SSIDBG2 (SPI_BLOCK_BASE|0x1C)
|
||||
#define SSIID (SPI_BLOCK_BASE|0x20)
|
||||
|
||||
|
||||
#define I2CSETUP (I2C_BLOCK_BASE|0x00)
|
||||
#define I2CCTRL (I2C_BLOCK_BASE|0x04)
|
||||
|
||||
|
||||
#define TIMER0LOAD (PWM_BLOCK_BASE|0x00)
|
||||
#define TIMER0VALUE (PWM_BLOCK_BASE|0x04)
|
||||
#define TIMER0CONTROL (PWM_BLOCK_BASE|0x08)
|
||||
#define TIMER0INTCLR (PWM_BLOCK_BASE|0x0C)
|
||||
#define TIMER0RIS (PWM_BLOCK_BASE|0x10)
|
||||
#define TIMER0MIS (PWM_BLOCK_BASE|0x14)
|
||||
#define TIMER0BGLOAD (PWM_BLOCK_BASE|0x18)
|
||||
#define PWM0OFF (PWM_BLOCK_BASE|0x1C)
|
||||
#define TIMER1LOAD (PWM_BLOCK_BASE|0x20)
|
||||
#define TIMER1VALUE (PWM_BLOCK_BASE|0x24)
|
||||
#define TIMER1CONTROL (PWM_BLOCK_BASE|0x28)
|
||||
#define TIMER1INTCLR (PWM_BLOCK_BASE|0x2C)
|
||||
#define TIMER1RIS (PWM_BLOCK_BASE|0x30)
|
||||
#define TIMER1MIS (PWM_BLOCK_BASE|0x34)
|
||||
#define TIMER1BGLOAD (PWM_BLOCK_BASE|0x38)
|
||||
#define PWM1OFF (PWM_BLOCK_BASE|0x3C)
|
||||
#define TIMERITCR (PWM_BLOCK_BASE|0x60)
|
||||
#define TIMERITOP (PWM_BLOCK_BASE|0x64)
|
||||
#define PWMCR (PWM_BLOCK_BASE|0x68)
|
||||
#define PWMID (PWM_BLOCK_BASE|0x6C)
|
||||
#define PWMMON (PWM_BLOCK_BASE|0x70)
|
||||
|
||||
|
||||
#define GPIODATA (GPIO_BLOCK_BASE|0x00)
|
||||
#define GPIODIR (GPIO_BLOCK_BASE|0x04)
|
||||
#define GPIOIS (GPIO_BLOCK_BASE|0x08)
|
||||
#define GPIOIBE (GPIO_BLOCK_BASE|0x0C)
|
||||
#define GPIOIEV (GPIO_BLOCK_BASE|0x10)
|
||||
#define GPIOIE (GPIO_BLOCK_BASE|0x14)
|
||||
#define GPIORIS (GPIO_BLOCK_BASE|0x18)
|
||||
#define GPIOMIS (GPIO_BLOCK_BASE|0x1C)
|
||||
#define GPIOIC (GPIO_BLOCK_BASE|0x20)
|
||||
#define GPIOOMS (GPIO_BLOCK_BASE|0x24)
|
||||
#define GPIOPC (GPIO_BLOCK_BASE|0x28)
|
||||
|
||||
#define GPIOID (GPIO_BLOCK_BASE|0x30)
|
||||
|
||||
|
||||
#define WKREQ (SYSTEM_BLOCK1_BASE|0x00)
|
||||
#define CLKENB (SYSTEM_BLOCK1_BASE|0x04)
|
||||
#define DRAMPWR (SYSTEM_BLOCK1_BASE|0x08)
|
||||
#define INTMASK (SYSTEM_BLOCK1_BASE|0x0C)
|
||||
#define GPIOSEL (SYSTEM_BLOCK2_BASE|0x00)
|
||||
|
||||
struct init_table {
|
||||
unsigned int reg;
|
||||
unsigned int val;
|
||||
};
|
||||
|
||||
static struct init_table toshiba_480x640_init_table[] = {
|
||||
{ DPSET0, 0x4BEC0066 }, // # MDC.DPSET0 # Setup DPLL parameters
|
||||
{ DPSET1, 0x00000113 }, // # MDC.DPSET1
|
||||
{ DPSUS, 0x00000000 }, // # MDC.DPSUS # Set DPLL oscillation enable
|
||||
{ DPRUN, 0x00000001 }, // # MDC.DPRUN # Release reset signal for DPLL
|
||||
{ 0, 14 }, // wait_ms(14);
|
||||
{ SYSCKENA, 0x00000001 }, // # MDC.SYSCKENA # Enable system clock output
|
||||
{ CLKENB, 0x000000EF }, // # SYS.CLKENB # Enable clocks for each module (without DCLK , i2cCLK)
|
||||
{ GPIO_BLOCK_BASE, 0x03FF0000 }, // # GPI .GPIODATA # GPIO2(RESET_LCD_N) set to 0 , GPIO3(eDRAM_Power) set to 0
|
||||
{ GPIODIR, 0x0000024D }, // # GPI .GPIODIR # Select direction of GPIO port (0,2,3,6,9 output)
|
||||
{ SYSTEM_BLOCK2_BASE, 0x00000173 }, // # SYS.GPIOSEL # GPIO port multiplexing control
|
||||
{ GPIOPC, 0x03C300C0 }, // # GPI .GPIOPC # GPIO2,3 PD cut
|
||||
{ SYSTEM_BLOCK1_BASE, 0x00000000 }, // # SYS.WKREQ # Wake-up request event is VSYNC alignment
|
||||
{ GPIOIS, 0x00000000 }, // # GPI .GPIOIS # Set interrupt sense of GPIO
|
||||
{ GPIOIEV, 0x00000001 }, // # GPI .GPIOIEV # Set interrupt event of GPIO
|
||||
{ GPIOIC, 0x000003FF }, // # GPI .GPIOIC # GPIO interrupt clear
|
||||
{ GPIO_BLOCK_BASE, 0x00060006 }, // # GPI .GPIODATA # Release LCDD reset
|
||||
{ GPIO_BLOCK_BASE, 0x00080008 }, // # GPI .GPIODATA # eDRAM VD supply
|
||||
{ GPIO_BLOCK_BASE, 0x02000200 }, // # GPI .GPIODATA # TEST LED ON
|
||||
{ DRAMPWR, 0x00000001 }, // # SYS.DRAMPWR # eDRAM power up
|
||||
{ TIMER0CONTROL, 0x00000060 }, // # PWM.Timer0Control # PWM0 output stop
|
||||
{ PWM_BLOCK_BASE, 0x00001388 }, // # PWM.Timer0Load # PWM0 10kHz , Duty 99 (BackLight OFF)
|
||||
//{PWM0OFF, 0x00000001 }, // # PWM.PWM0OFF
|
||||
#if 0
|
||||
{ PWM0OFF, 0x00001387 }, // SURF 100% backlight
|
||||
{ PWM0OFF, 0x00000000 }, // FFA 100% backlight
|
||||
#endif
|
||||
{ PWM0OFF, 0x000009C3 }, // 50% BL
|
||||
{ TIMER1CONTROL, 0x00000060 }, // # PWM.Timer1Control # PWM1 output stop
|
||||
{ TIMER1LOAD, 0x00001388 }, // # PWM.Timer1Load # PWM1 10kHz , Duty 99 (BackLight OFF)
|
||||
//{PWM1OFF, 0x00000001 }, // # PWM.PWM1OFF
|
||||
{ PWM1OFF, 0x00001387 },
|
||||
{ TIMER0CONTROL, 0x000000E0 }, // # PWM.Timer0Control # PWM0 output start
|
||||
{ TIMER1CONTROL, 0x000000E0 }, // # PWM.Timer1Control # PWM1 output start
|
||||
{ PWMCR, 0x00000003 }, // # PWM.PWMCR # PWM output enable
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SPI_BLOCK_BASE, 0x00000799 }, // # SPI .SSICTL # SPI operation mode setting
|
||||
{ SSITIME, 0x00000100 }, // # SPI .SSITIME # SPI serial interface timing setting
|
||||
{ SPI_BLOCK_BASE, 0x0000079b }, // # SPI .SSICTL # Set SPI active mode
|
||||
|
||||
{ SSITX, 0x00000000 }, // # SPI.SSITX # Release from Deep Stanby mode
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SSITX, 0x00000000 }, // # SPI.SSITX
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SSITX, 0x00000000 }, // # SPI.SSITX
|
||||
{ 0, 1 }, // wait_ms(1);
|
||||
{ SSITX, 0x000800BA }, // # SPI.SSITX *NOTE 1 # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # Display mode setup(1) : Normaly Black
|
||||
{ SSITX, 0x00080036 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Memory access control
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800BB }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Display mode setup(2)
|
||||
{ SSITX, 0x0008003A }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000160 }, // # RGB Interface data format
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800BF }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Drivnig method
|
||||
{ SSITX, 0x000800B1 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0000015D }, // # Booster operation setup
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000133 }, // # Booster mode setup
|
||||
{ SSITX, 0x000800B3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000122 }, // # Booster frequencies setup
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000102 }, // # OP-amp capability/System clock freq. division setup
|
||||
{ SSITX, 0x000800B5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0000011F }, // # VCS Voltage adjustment (1C->1F for Rev 2)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000128 }, // # VCOM Voltage adjustment
|
||||
{ SSITX, 0x000800B7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000103 }, // # Configure an external display signal
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B9 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000120 }, // # DCCK/DCEV timing setup
|
||||
{ SSITX, 0x000800BD }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000102 }, // # ASW signal control
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800BE }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Dummy display (white/black) count setup for QUAD Data operation
|
||||
{ SSITX, 0x000800C0 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # wait_ms(-out FR count setup (A)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C1 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # wait_ms(-out FR count setup (B)
|
||||
{ SSITX, 0x000800C2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000111 }, // # wait_ms(-out FR count setup (C)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0008010A }, // # wait_ms(-in line clock count setup (D)
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080160 }, // # Seep-in line clock count setup (E)
|
||||
{ SSITX, 0x00000160 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080160 }, // # wait_ms(-in line clock count setup (F)
|
||||
{ SSITX, 0x00000160 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080160 }, // # wait_ms(-in line clock setup (G)
|
||||
{ SSITX, 0x00000160 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080133 }, // # Gamma 1 fine tuning (1)
|
||||
{ SSITX, 0x00000143 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800C8 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000144 }, // # Gamma 1 fine tuning (2)
|
||||
{ SSITX, 0x000800C9 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000133 }, // # Gamma 1 inclination adjustment
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800CA }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // # Gamma 1 blue offset adjustment
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800EC }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080102 }, // # Total number of horizontal clock cycles (1) [PCLK Sync. VGA setting]
|
||||
{ SSITX, 0x00000118 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800CF }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # Blanking period control (1) [PCLK Sync. Table1 for VGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D0 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080110 }, // # Blanking period control (2) [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x00000104 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D1 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # CKV timing control on/off [PCLK Sync. Table1 for VGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # CKV1,2 timing control [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x0000013A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # OEV timing control [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x0000013A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080124 }, // # ASW timing control (1) [PCLK Sync. Table1 for VGA]
|
||||
{ SSITX, 0x0000016E }, //
|
||||
{ 0, 1 }, // wait_ms(1); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000124 }, // # ASW timing control (2) [PCLK Sync. Table1 for VGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800ED }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080101 }, // # Total number of horizontal clock cycles (2) [PCLK Sync. Table1 for QVGA ]
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # Blanking period control (1) [PCLK Sync. Table2 for QVGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080110 }, // # Blanking period control (2) [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D8 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # CKV timing control on/off [PCLK Sync. Table2 for QVGA]
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800D9 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # CKV1,2 timing control [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x00000114 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800DE }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # OEV timing control [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x00000114 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800DF }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080112 }, // # ASW timing control (1) [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x0000013F }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E0 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x0000010B }, // # ASW timing control (2) [PCLK Sync. Table2 for QVGA]
|
||||
{ SSITX, 0x000800E2 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000101 }, // # Built-in oscillator frequency division setup [Frequency division ratio : 2 (60Hq)
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E3 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000136 }, // # Built-in oscillator clock count setup
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E4 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080100 }, // # CKV timing control for using build-in osc
|
||||
{ SSITX, 0x00000103 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E5 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080102 }, // # OEV timing control for using build-in osc
|
||||
{ SSITX, 0x00000104 }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E6 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000103 }, // # DCEV timing control for using build-in osc
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E7 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00080104 }, // # ASW timing setup for using build-in osc(1)
|
||||
{ SSITX, 0x0000010A }, //
|
||||
{ 0, 2 }, // wait_ms(2); // # Wait SPI fifo empty
|
||||
{ SSITX, 0x000800E8 }, // # Command setting of SPI block
|
||||
{ SSITX, 0x00000104 }, // # ASW timing setup for using build-in osc(2)
|
||||
|
||||
|
||||
{ CLKENB, 0x000001EF }, // # SYS.CLKENB # DCLK enable
|
||||
{ START, 0x00000000 }, // # LCD.START # LCDC wait_ms( mode
|
||||
{ WRSTB, 0x0000003F }, // # LCD.WRSTB # write_client_reg( strobe
|
||||
{ RDSTB, 0x00000432 }, // # LCD.RDSTB # Read strobe
|
||||
{ PORT_ENB, 0x00000002 }, // # LCD.PORT_ENB # Asynchronous port enable
|
||||
{ VSYNIF, 0x00000000 }, // # LCD.VSYNCIF # VSYNC I/F mode set
|
||||
{ ASY_DATA, 0x80000000 }, // # LCD.ASY_DATx # Index setting of SUB LCDD
|
||||
{ ASY_DATB, 0x00000001 }, // # Oscillator start
|
||||
{ ASY_CMDSET, 0x00000005 }, // # LCD.ASY_CMDSET # Direct command transfer enable
|
||||
{ ASY_CMDSET, 0x00000004 }, // # LCD.ASY_CMDSET # Direct command transfer disable
|
||||
{ 0, 10 }, // wait_ms(10);
|
||||
{ ASY_DATA, 0x80000000 }, // # LCD.ASY_DATx # DUMMY write_client_reg(<28>@*NOTE2
|
||||
{ ASY_DATB, 0x80000000 }, //
|
||||
{ ASY_DATC, 0x80000000 }, //
|
||||
{ ASY_DATD, 0x80000000 }, //
|
||||
{ ASY_CMDSET, 0x00000009 }, // # LCD.ASY_CMDSET
|
||||
{ ASY_CMDSET, 0x00000008 }, // # LCD.ASY_CMDSET
|
||||
{ ASY_DATA, 0x80000007 }, // # LCD.ASY_DATx # Index setting of SUB LCDD
|
||||
{ ASY_DATB, 0x00004005 }, // # LCD driver control
|
||||
{ ASY_CMDSET, 0x00000005 }, // # LCD.ASY_CMDSET # Direct command transfer enable
|
||||
{ ASY_CMDSET, 0x00000004 }, // # LCD.ASY_CMDSET # Direct command transfer disable
|
||||
{ 0, 20 }, // wait_ms(20);
|
||||
{ ASY_DATA, 0x80000059 }, // # LCD.ASY_DATx # Index setting of SUB LCDD
|
||||
{ ASY_DATB, 0x00000000 }, // # LTPS I/F control
|
||||
{ ASY_CMDSET, 0x00000005 }, // # LCD.ASY_CMDSET # Direct command transfer enable
|
||||
{ ASY_CMDSET, 0x00000004 }, // # LCD.ASY_CMDSET # Direct command transfer disable
|
||||
|
||||
{ VSYNIF, 0x00000001 }, // # LCD.VSYNCIF # VSYNC I/F mode OFF
|
||||
{ PORT_ENB, 0x00000001 }, // # LCD.PORT_ENB # SYNC I/F output select
|
||||
|
||||
/******************************/
|
||||
|
||||
{ VSYNIF, 0x00000001 }, // VSYNC I/F mode OFF
|
||||
{ PORT_ENB, 0x00000001 }, // SYNC I/F mode ON
|
||||
|
||||
{ BITMAP1, 0x01E000F0 }, // MDC.BITMAP2 ); // Setup of PITCH size to Frame buffer1
|
||||
{ BITMAP2, 0x01E000F0 }, // MDC.BITMAP3 ); // Setup of PITCH size to Frame buffer2
|
||||
{ BITMAP3, 0x01E000F0 }, // MDC.BITMAP4 ); // Setup of PITCH size to Frame buffer3
|
||||
{ BITMAP4, 0x00DC00B0 }, // MDC.BITMAP5 ); // Setup of PITCH size to Frame buffer4
|
||||
{ CLKENB, 0x000001EF }, // SYS.CLKENB ); // DCLK supply
|
||||
{ PORT_ENB, 0x00000001 }, // LCD.PORT_ENB ); // Synchronous port enable
|
||||
{ PORT, 0x00000004 }, // LCD.PORT ); // Polarity of DE is set to high active
|
||||
{ PXL, 0x00000002 }, // LCD.PXL ); // ACTMODE 2 set (1st frame black data output)
|
||||
{ MPLFBUF, 0x00000000 }, // LCD.MPLFBUF ); // Select the reading buffer
|
||||
{ HCYCLE, 0x0000010b }, // LCD.HCYCLE ); // Setup to VGA size
|
||||
{ HSW, 0x00000003 }, // LCD.HSW
|
||||
{ HDE_START, 0x00000007 }, // LCD.HDE_START
|
||||
{ HDE_SIZE, 0x000000EF }, // LCD.HDE_SIZE
|
||||
{ VCYCLE, 0x00000285 }, // LCD.VCYCLE
|
||||
{ VSW, 0x00000001 }, // LCD.VSW
|
||||
{ VDE_START, 0x00000003 }, // LCD.VDE_START
|
||||
{ VDE_SIZE, 0x0000027F }, // LCD.VDE_SIZE
|
||||
|
||||
{ START, 0x00000001 }, // LCD.START ); // LCDC - Pixel data transfer start
|
||||
|
||||
{ 0, 10 }, // wait_ms( 10 );
|
||||
{ SSITX, 0x000800BC }, // SPI.SSITX ); // Command setting of SPI block
|
||||
{ SSITX, 0x00000180 }, // Display data setup
|
||||
{ SSITX, 0x0008003B }, // Command setting of SPI block
|
||||
{ SSITX, 0x00000100 }, // Quad Data configuration - VGA
|
||||
{ 0, 1 }, // wait_ms( 1 ); // Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B0 }, // Command setting of SPI block
|
||||
{ SSITX, 0x00000116 }, // Power supply ON/OFF control
|
||||
{ 0, 1 }, // wait_ms( 1 ); // Wait SPI fifo empty
|
||||
{ SSITX, 0x000800B8 }, // Command setting of SPI block
|
||||
{ SSITX, 0x000801FF }, // Output control
|
||||
{ SSITX, 0x000001F5 },
|
||||
{ 0, 1 }, // wait_ms( 1); // Wait SPI fifo empty
|
||||
{ SSITX, 0x00000011 }, // wait_ms(-out (Command only)
|
||||
{ SSITX, 0x00000029 }, // Display on (Command only)
|
||||
|
||||
{ SYSTEM_BLOCK1_BASE, 0x00000002 }, // # wakeREQ -> GPIO
|
||||
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
static void _panel_init(struct init_table *init_table)
|
||||
{
|
||||
unsigned n;
|
||||
|
||||
dprintf(INFO, "panel_init()\n");
|
||||
|
||||
n = 0;
|
||||
while (init_table[n].reg != 0 || init_table[n].val != 0) {
|
||||
if (init_table[n].reg != 0)
|
||||
mddi_remote_write(init_table[n].val, init_table[n].reg);
|
||||
else
|
||||
thread_sleep(init_table[n].val);//mdelay(init_table[n].val);
|
||||
n++;
|
||||
}
|
||||
|
||||
dprintf(INFO, "panel_init() done\n");
|
||||
}
|
||||
|
||||
void panel_init(struct mddi_client_caps *client_caps)
|
||||
{
|
||||
switch(client_caps->manufacturer_name) {
|
||||
case 0xd263: // Toshiba
|
||||
dprintf(INFO, "Found Toshiba panel\n");
|
||||
_panel_init(toshiba_480x640_init_table);
|
||||
break;
|
||||
case 0x4474: //??
|
||||
if (client_caps->product_code == 0xc065)
|
||||
dprintf(INFO, "Found WVGA panel\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void panel_poweron(void)
|
||||
{
|
||||
gpio_set(88, 0);
|
||||
gpio_config(88, GPIO_OUTPUT);
|
||||
thread_sleep(1); //udelay(10);
|
||||
gpio_set(88, 1);
|
||||
thread_sleep(10); //mdelay(10);
|
||||
|
||||
//mdelay(1000); // uncomment for second stage boot
|
||||
}
|
||||
|
||||
void panel_backlight(int on)
|
||||
{}
|
@ -1,39 +0,0 @@
|
||||
LOCAL_DIR := $(GET_LOCAL_DIR)
|
||||
|
||||
INCLUDES += -I$(LOCAL_DIR)/include
|
||||
|
||||
PLATFORM := msm7k
|
||||
|
||||
MEMBASE := 0x00000000 # SMI
|
||||
MEMSIZE := 0x00800000 # 8MB
|
||||
|
||||
BASE_ADDR := 0x10000000
|
||||
|
||||
TAGS_ADDR := BASE_ADDR+0x00000100
|
||||
KERNEL_ADDR := BASE_ADDR+0x00800000
|
||||
RAMDISK_ADDR := BASE_ADDR+0x01000000
|
||||
SCRATCH_ADDR := BASE_ADDR+0x02000000
|
||||
|
||||
KEYS_USE_GPIO_KEYPAD := 1
|
||||
|
||||
DEFINES += DISPLAY_TYPE_MDDI=1
|
||||
|
||||
MODULES += \
|
||||
dev/keys \
|
||||
lib/ptable
|
||||
|
||||
DEFINES += \
|
||||
SDRAM_SIZE=$(MEMSIZE) \
|
||||
MEMBASE=$(MEMBASE) \
|
||||
BASE_ADDR=$(BASE_ADDR) \
|
||||
TAGS_ADDR=$(TAGS_ADDR) \
|
||||
KERNEL_ADDR=$(KERNEL_ADDR) \
|
||||
RAMDISK_ADDR=$(RAMDISK_ADDR) \
|
||||
SCRATCH_ADDR=$(SCRATCH_ADDR)
|
||||
|
||||
|
||||
OBJS += \
|
||||
$(LOCAL_DIR)/init.o \
|
||||
$(LOCAL_DIR)/keypad.o \
|
||||
$(LOCAL_DIR)/atags.o \
|
||||
$(LOCAL_DIR)/panel.o
|
@ -1,43 +0,0 @@
|
||||
/* Copyright (c) 2009, Code Aurora Forum. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Code Aurora nor
|
||||
* the names of its contributors may be used to endorse or promote
|
||||
* products derived from this software without specific prior written
|
||||
* permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
* NON-INFRINGEMENT ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
|
||||
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
|
||||
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
||||
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
|
||||
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
||||
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
#include <reg.h>
|
||||
|
||||
#define EBI1_SIZE1 0x0E800000 //232MB for 256MB RAM
|
||||
#define EBI1_ADDR1 0x20000000
|
||||
|
||||
unsigned* target_atag_mem(unsigned* ptr)
|
||||
{
|
||||
/* ATAG_MEM */
|
||||
*ptr++ = 4;
|
||||
*ptr++ = 0x54410002;
|
||||
*ptr++ = EBI1_SIZE1;
|
||||
*ptr++ = EBI1_ADDR1;
|
||||
|
||||
return ptr;
|
||||
}
|
@ -1,120 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2009, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google, Inc. nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
|
||||
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <debug.h>
|
||||
#include <dev/keys.h>
|
||||
#include <dev/gpio_keypad.h>
|
||||
#include <lib/ptable.h>
|
||||
#include <dev/flash.h>
|
||||
|
||||
#define BOARD_FLASH_OFFSET 378
|
||||
|
||||
#define LINUX_MACHTYPE 0x00000811
|
||||
|
||||
static struct ptable flash_ptable;
|
||||
|
||||
/* for these partitions, start will be offset by either what we get from
|
||||
* smem, or from the above offset if smem is not useful. Also, we should
|
||||
* probably have smem_ptable code populate our flash_ptable.
|
||||
*
|
||||
* When smem provides us with a full partition table, we can get rid of
|
||||
* this altogether.
|
||||
*
|
||||
*/
|
||||
static struct ptentry board_part_list[] = {
|
||||
{
|
||||
.start = 0,
|
||||
.length = 40,
|
||||
.name = "boot",
|
||||
},
|
||||
{
|
||||
.start = 56,
|
||||
.length = 608 /* 76MB */,
|
||||
.name = "system",
|
||||
},
|
||||
{
|
||||
.start = 664,
|
||||
.length = 608 /* 76MB */,
|
||||
.name = "cache",
|
||||
},
|
||||
{
|
||||
.start = 1272,
|
||||
.length = 0,
|
||||
.name = "userdata",
|
||||
},
|
||||
};
|
||||
static int num_parts = sizeof(board_part_list)/sizeof(struct ptentry);
|
||||
|
||||
void smem_ptable_init(void);
|
||||
unsigned smem_get_apps_flash_start(void);
|
||||
|
||||
void keypad_init(void);
|
||||
|
||||
void target_init(void)
|
||||
{
|
||||
unsigned offset;
|
||||
struct flash_info *flash_info;
|
||||
int i;
|
||||
|
||||
dprintf(INFO, "target_init()\n");
|
||||
|
||||
keys_init();
|
||||
keypad_init();
|
||||
|
||||
ptable_init(&flash_ptable);
|
||||
smem_ptable_init();
|
||||
|
||||
flash_init();
|
||||
flash_info = flash_get_info();
|
||||
ASSERT(flash_info);
|
||||
|
||||
offset = smem_get_apps_flash_start();
|
||||
if (offset == 0xffffffff)
|
||||
offset = BOARD_FLASH_OFFSET;
|
||||
|
||||
for (i = 0; i < num_parts; i++) {
|
||||
struct ptentry *ptn = &board_part_list[i];
|
||||
unsigned len = ptn->length;
|
||||
|
||||
if ((len == 0) && (i == num_parts - 1))
|
||||
len = flash_info->num_blocks - offset - ptn->start;
|
||||
ptable_add(&flash_ptable, ptn->name, offset + ptn->start,
|
||||
len, ptn->flags);
|
||||
}
|
||||
|
||||
ptable_dump(&flash_ptable);
|
||||
flash_set_ptable(&flash_ptable);
|
||||
}
|
||||
|
||||
unsigned board_machtype(void)
|
||||
{
|
||||
return LINUX_MACHTYPE;
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user