diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2008-10-21 07:00:00 -0700 |
commit | 4205b865141ff2e255fe1d3bd16de18e217ef06a (patch) | |
tree | 37f362d54d4df0567b6ee2ad4526b2a58836232b /include | |
download | legacy-4205b865141ff2e255fe1d3bd16de18e217ef06a.tar.gz |
Initial Contributionandroid-1.0release-1.0cdma-import
Diffstat (limited to 'include')
-rw-r--r-- | include/boot/arm.h | 50 | ||||
-rw-r--r-- | include/boot/board.h | 51 | ||||
-rw-r--r-- | include/boot/boot.h | 147 | ||||
-rw-r--r-- | include/boot/bootimg.h | 97 | ||||
-rw-r--r-- | include/boot/flash.h | 60 | ||||
-rw-r--r-- | include/boot/font5x12.h | 126 | ||||
-rw-r--r-- | include/boot/gpio.h | 36 | ||||
-rw-r--r-- | include/boot/gpio_keypad.h | 47 | ||||
-rw-r--r-- | include/boot/tags.h | 48 | ||||
-rw-r--r-- | include/boot/uart.h | 40 | ||||
-rw-r--r-- | include/boot/usb.h | 89 | ||||
-rw-r--r-- | include/boot/usb_descriptors.h | 163 | ||||
-rw-r--r-- | include/msm7k/dmov.h | 161 | ||||
-rw-r--r-- | include/msm7k/gpio.h | 105 | ||||
-rw-r--r-- | include/msm7k/gpt.h | 55 | ||||
-rw-r--r-- | include/msm7k/hsusb.h | 169 | ||||
-rw-r--r-- | include/msm7k/irqs.h | 88 | ||||
-rw-r--r-- | include/msm7k/mddi.h | 272 | ||||
-rw-r--r-- | include/msm7k/mdp.h | 113 | ||||
-rw-r--r-- | include/msm7k/nand.h | 86 | ||||
-rw-r--r-- | include/msm7k/shared.h | 135 | ||||
-rw-r--r-- | include/msm7k/uart.h | 119 | ||||
-rw-r--r-- | include/msm7k/vic.h | 65 |
23 files changed, 2322 insertions, 0 deletions
diff --git a/include/boot/arm.h b/include/boot/arm.h new file mode 100644 index 0000000..13b64f2 --- /dev/null +++ b/include/boot/arm.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _ARM_H +#define _ARM_H + +#define PSR_N 0x80000000 +#define PSR_C 0x40000000 +#define PSR_Z 0x20000000 +#define PSR_V 0x10000000 + +#define PSR_I 0x00000080 +#define PSR_F 0x00000040 +#define PSR_T 0x00000020 + +#define PSR_MODE_MASK 0x0000001F +#define PSR_USR 0x00000010 +#define PSR_FIQ 0x00000011 +#define PSR_IRQ 0x00000012 +#define PSR_SVC 0x00000013 +#define PSR_ABT 0x00000017 +#define PSR_UND 0x0000001B +#define PSR_SYS 0x0000001F + +#endif diff --git a/include/boot/board.h b/include/boot/board.h new file mode 100644 index 0000000..19b5c5e --- /dev/null +++ b/include/boot/board.h @@ -0,0 +1,51 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _BOARD_H_ +#define _BOARD_H_ + +/* low-level init and partition table setup */ +void board_init(void); +void board_reboot(void); +void board_getvar(const char *name, char *value); + +/* keypad init */ +void keypad_init(void); + +/* return a linux kernel commandline */ +const char *board_cmdline(void); +unsigned board_machtype(void); + +/* lcd panel initialization */ +struct mddi_client_caps; + +void panel_poweron(void); +void panel_init(struct mddi_client_caps *caps); +void panel_backlight(int on); + +#endif diff --git a/include/boot/boot.h b/include/boot/boot.h new file mode 100644 index 0000000..d4a4d64 --- /dev/null +++ b/include/boot/boot.h @@ -0,0 +1,147 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _BOOT_H_ +#define _BOOT_H_ + +static inline void DWB(void) /* drain write buffer */ +{ + asm volatile ( + "mcr p15, 0, %0, c7, c10, 4\n" : : "r" (0) + ); +} + +static inline void writel(unsigned val, unsigned addr) +{ + DWB(); + (*(volatile unsigned *) (addr)) = (val); + DWB(); +} + +static inline void writeb(unsigned val, unsigned addr) +{ + DWB(); + (*(volatile unsigned char *) (addr)) = (val); + DWB(); +} + +static inline unsigned readl(unsigned addr) +{ + return (*(volatile unsigned *) (addr)); +} + +int dcc_putc(unsigned c); +int dcc_getc(); + +void enable_irq(void); + +/* main.c */ +enum boot_keys { + BOOT_KEY_STOP_BOOT = 1, + BOOT_KEY_CONTINUE_BOOT = 2, +}; +extern void key_changed(unsigned int key, unsigned int is_down) __attribute__ ((weak)); + +/* manage a list of functions to call */ +void boot_register_poll_func(void (*func)(void)); +void boot_poll(void); + +/* console.c */ +void dcc_init(); + +void dprintf(const char *fmt, ...); +void dprintf_set_putc(void (*func)(unsigned)); +void dprintf_set_flush(void (*func)(void)); + +/* gpio */ +void gpio_output_enable(unsigned n, unsigned out); +void gpio_write(unsigned n, unsigned on); +int gpio_read(unsigned n); + +/* misc.c */ +void *alloc(unsigned sz); /* alloc 32byte aligned memory */ +void *alloc_page_aligned(unsigned sz); + +void *memcpy(void *dst, const void *src, unsigned len); +void *memset(void *dst, unsigned val, unsigned len); +char *strcpy(char *dst, const char *src); +int strcmp(const char *s1, const char *s2); +int memcmp(const void *a, const void *b, unsigned len); +char *strstr(const char *s1, const char *s2); +int strlen(const char *s); + +/* clock */ +unsigned cycles_per_second(void); +void print_cpu_speed(void); +void arm11_clock_init(void); +void mdelay(unsigned msecs); +void udelay(unsigned usecs); + +/* LCD */ +void console_init(void); +void console_set_colors(unsigned bg, unsigned fg); +void console_clear(void); +void console_putc(unsigned n); +void console_flush(void); + +void cprintf(const char *fmt, ...); + +void mddi_init(void); +void mddi_start_update(void); +int mddi_update_done(void); +void *mddi_framebuffer(void); +void mddi_remote_write(unsigned val, unsigned reg); +extern unsigned fb_width; +extern unsigned fb_height; + +/* provided by board files */ +void set_led(int on); + +/* provided by jtag.c */ +void jtag_okay(const char *msg); +void jtag_fail(const char *msg); +void jtag_dputc(unsigned ch); +void jtag_cmd_loop(void (*do_cmd)(const char *, unsigned, unsigned, unsigned)); + +typedef void (*irq_handler)(unsigned n); + + +#define DIGEST_SIZE 20 +#define SIGNATURE_SIZE 256 + +void compute_digest(void *data, unsigned len, void *digest_out); +int is_signature_okay(void *digest, void *signature, void *pubkey); + +#if 0 +#define __attr_used __attribute__((used)) +#define __attr_init __attribute__((__section__(".init.func.0"))) +#define boot_init_hook(func) \ +static int (*__boot_init_hook__)(void) __attr_used __attr_init = func +#endif + +#endif diff --git a/include/boot/bootimg.h b/include/boot/bootimg.h new file mode 100644 index 0000000..44fde92 --- /dev/null +++ b/include/boot/bootimg.h @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _BOOT_IMAGE_H_ +#define _BOOT_IMAGE_H_ + +typedef struct boot_img_hdr boot_img_hdr; + +#define BOOT_MAGIC "ANDROID!" +#define BOOT_MAGIC_SIZE 8 +#define BOOT_NAME_SIZE 16 +#define BOOT_ARGS_SIZE 512 + +struct boot_img_hdr +{ + unsigned char magic[BOOT_MAGIC_SIZE]; + + unsigned kernel_size; /* size in bytes */ + unsigned kernel_addr; /* physical load addr */ + + unsigned ramdisk_size; /* size in bytes */ + unsigned ramdisk_addr; /* physical load addr */ + + unsigned second_size; /* size in bytes */ + unsigned second_addr; /* physical load addr */ + + unsigned tags_addr; /* physical addr for kernel tags */ + unsigned page_size; /* flash page size we assume */ + unsigned unused[2]; /* future expansion: should be 0 */ + + unsigned char name[BOOT_NAME_SIZE]; /* asciiz product name */ + + unsigned char cmdline[BOOT_ARGS_SIZE]; + + unsigned id[8]; /* timestamp / checksum / sha1 / etc */ +}; + +/* +** +-----------------+ +** | boot header | 1 page +** +-----------------+ +** | kernel | n pages +** +-----------------+ +** | ramdisk | m pages +** +-----------------+ +** | second stage | o pages +** +-----------------+ +** +** n = (kernel_size + page_size - 1) / page_size +** m = (ramdisk_size + page_size - 1) / page_size +** o = (second_size + page_size - 1) / page_size +** +** 0. all entities are page_size aligned in flash +** 1. kernel and ramdisk are required (size != 0) +** 2. second is optional (second_size == 0 -> no second) +** 3. load each element (kernel, ramdisk, second) at +** the specified physical address (kernel_addr, etc) +** 4. prepare tags at tag_addr. kernel_args[] is +** appended to the kernel commandline in the tags. +** 5. r0 = 0, r1 = MACHINE_TYPE, r2 = tags_addr +** 6. if second_size != 0: jump to second_addr +** else: jump to kernel_addr +*/ + +boot_img_hdr *mkbootimg(void *kernel, unsigned kernel_size, + void *ramdisk, unsigned ramdisk_size, + void *second, unsigned second_size, + unsigned page_size, + unsigned *bootimg_size); + +void bootimg_set_cmdline(boot_img_hdr *hdr, const char *cmdline); +#endif diff --git a/include/boot/flash.h b/include/boot/flash.h new file mode 100644 index 0000000..c746415 --- /dev/null +++ b/include/boot/flash.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _INCLUDE_BOOT_FLASH_H_ +#define _INCLUDE_BOOT_FLASH_H_ + +typedef struct flash_ops flash_ops; +typedef struct ptentry ptentry; + +/* flash partitions are defined in terms of blocks +** (flash erase units) +*/ +struct ptentry +{ + char name[16]; + unsigned start; + unsigned length; + unsigned flags; +}; + +/* tools to populate and query the partition table */ +void flash_add_ptn(ptentry *ptn); +ptentry *flash_find_ptn(const char *name); +ptentry *flash_get_ptn(unsigned n); +unsigned flash_get_ptn_count(void); +void flash_dump_ptn(void); + +int flash_init(void); +int flash_erase(ptentry *ptn); +int flash_read_ext(ptentry *ptn, unsigned extra_per_page, unsigned offset, + void *data, unsigned bytes); +#define flash_read(ptn, offset, data, bytes) flash_read_ext(ptn, 0, offset, data, bytes) +int flash_write(ptentry *ptn, unsigned extra_per_page, + const void *data, unsigned bytes); +#endif diff --git a/include/boot/font5x12.h b/include/boot/font5x12.h new file mode 100644 index 0000000..e033bf6 --- /dev/null +++ b/include/boot/font5x12.h @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +unsigned font5x12[] = { + 0x00000000, 0x00000000, + 0x08421080, 0x00020084, + 0x00052940, 0x00000000, + 0x15f52800, 0x0000295f, + 0x1c52f880, 0x00023e94, + 0x08855640, 0x0004d542, + 0x04528800, 0x000b2725, + 0x00021080, 0x00000000, + 0x04211088, 0x00821042, + 0x10841082, 0x00221108, + 0x09575480, 0x00000000, + 0x3e420000, 0x00000084, + 0x00000000, 0x00223000, + 0x3e000000, 0x00000000, + 0x00000000, 0x00471000, + 0x08844200, 0x00008442, + 0x2318a880, 0x00022a31, + 0x08429880, 0x000f9084, + 0x1108c5c0, 0x000f8444, + 0x1c4443e0, 0x00074610, + 0x14a62100, 0x000423e9, + 0x26d087e0, 0x00074610, + 0x1e10c5c0, 0x00074631, + 0x088443e0, 0x00010844, + 0x1d18c5c0, 0x00074631, + 0x3d18c5c0, 0x00074610, + 0x08e20000, 0x00471000, + 0x08e20000, 0x00223000, + 0x02222200, 0x00082082, + 0x01f00000, 0x000003e0, + 0x20820820, 0x00008888, + 0x1108c5c0, 0x00020084, + 0x2b98c5c0, 0x000f05b5, + 0x2318a880, 0x0008c63f, + 0x1d2949e0, 0x0007ca52, + 0x0210c5c0, 0x00074421, + 0x252949e0, 0x0007ca52, + 0x1e1087e0, 0x000f8421, + 0x1e1087e0, 0x00008421, + 0x0210c5c0, 0x00074639, + 0x3f18c620, 0x0008c631, + 0x084211c0, 0x00071084, + 0x10842380, 0x00032508, + 0x0654c620, 0x0008c525, + 0x02108420, 0x000f8421, + 0x2b5dc620, 0x0008c631, + 0x2b59ce20, 0x0008c739, + 0x2318c5c0, 0x00074631, + 0x1f18c5e0, 0x00008421, + 0x2318c5c0, 0x01075631, + 0x1f18c5e0, 0x0008c525, + 0x1c10c5c0, 0x00074610, + 0x084213e0, 0x00021084, + 0x2318c620, 0x00074631, + 0x1518c620, 0x0002114a, + 0x2b18c620, 0x000556b5, + 0x08a54620, 0x0008c54a, + 0x08a54620, 0x00021084, + 0x088443e0, 0x000f8442, + 0x0421084e, 0x00e10842, + 0x08210420, 0x00084108, + 0x1084210e, 0x00e42108, + 0x0008a880, 0x00000000, + 0x00000000, 0x01f00000, + 0x00000104, 0x00000000, + 0x20e00000, 0x000b663e, + 0x22f08420, 0x0007c631, + 0x22e00000, 0x00074421, + 0x23e84200, 0x000f4631, + 0x22e00000, 0x0007443f, + 0x1e214980, 0x00010842, + 0x22e00000, 0x1d187a31, + 0x26d08420, 0x0008c631, + 0x08601000, 0x00071084, + 0x10c02000, 0x0c94a108, + 0x0a908420, 0x0008a4a3, + 0x084210c0, 0x00071084, + 0x2ab00000, 0x0008d6b5, + 0x26d00000, 0x0008c631, + 0x22e00000, 0x00074631, + 0x22f00000, 0x0210be31, + 0x23e00000, 0x21087a31, + 0x26d00000, 0x00008421, + 0x22e00000, 0x00074506, + 0x04f10800, 0x00064842, + 0x23100000, 0x000b6631, + 0x23100000, 0x00022951, + 0x23100000, 0x000556b5, + 0x15100000, 0x0008a884, + 0x23100000, 0x1d185b31, + 0x11f00000, 0x000f8444, + 0x06421098, 0x01821084, + 0x08421080, 0x00021084, + 0x30421083, 0x00321084, + 0x0004d640, 0x00000000, + 0x00000000, 0x00000000, +}; diff --git a/include/boot/gpio.h b/include/boot/gpio.h new file mode 100644 index 0000000..78db64b --- /dev/null +++ b/include/boot/gpio.h @@ -0,0 +1,36 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _GPIO_H_ +#define _GPIO_H_ + +void gpio_dir(int nr, int out); +void gpio_set(int nr, int set); +int gpio_get(int nr); + +#endif diff --git a/include/boot/gpio_keypad.h b/include/boot/gpio_keypad.h new file mode 100644 index 0000000..11edf45 --- /dev/null +++ b/include/boot/gpio_keypad.h @@ -0,0 +1,47 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _GPIO_KEYPAD_H_ +#define _GPIO_KEYPAD_H_ + +typedef struct { + unsigned int *input_gpios; + unsigned int *output_gpios; + unsigned int ninputs; + unsigned int noutputs; + unsigned int *key_map; + unsigned int settle_time; // micro seconds to wait before reading inputs after driving each output + int polarity : 1; // 0: drive active column low, 1: drive active column high + int drive_inactive_outputs : 1; + unsigned long long state; +} gpio_keypad_info; + +int gpio_keypad_init(gpio_keypad_info *keypad); +void gpio_keypad_scan_keys(gpio_keypad_info *keypad); + +#endif diff --git a/include/boot/tags.h b/include/boot/tags.h new file mode 100644 index 0000000..1fc0237 --- /dev/null +++ b/include/boot/tags.h @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _INCLUDE_BOOT_TAGS_H_ +#define _INCLUDE_BOOT_TAGS_H_ + +/* tools to deal with Linux ARM boot tags */ + +struct tag_handler +{ + unsigned type; + void (*func)(unsigned type, void *data, unsigned bytes, void *cookie); + void *cookie; +}; + +void tags_parse(void *tags, struct tag_handler *h, unsigned count); + +/* convenience function */ +void tags_import_partitions(void *tags); +unsigned tags_get_revision(void *tags); +void tags_get_serialno(void *tags, void *sn); /* sn is 64bits */ +const char *tags_get_cmdline(void *tags); +#endif diff --git a/include/boot/uart.h b/include/boot/uart.h new file mode 100644 index 0000000..90a8a67 --- /dev/null +++ b/include/boot/uart.h @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _INCLUDE_BOOT_UART_H_ +#define _INCLUDE_BOOT_UART_H_ + +void uart_init(unsigned uart_number); + +void uart_putc(unsigned); +int uart_tx_ready(void); + +/* returns -1 if no character available, otherwise 0x00-0xff */ +int uart_getc(void); + +#endif diff --git a/include/boot/usb.h b/include/boot/usb.h new file mode 100644 index 0000000..73637c2 --- /dev/null +++ b/include/boot/usb.h @@ -0,0 +1,89 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +#ifndef _USB_COMMON_DEFINES_H +#define _USB_COMMON_DEFINES_H + +#define GET_STATUS 0 +#define CLEAR_FEATURE 1 +#define SET_FEATURE 3 +#define SET_ADDRESS 5 +#define GET_DESCRIPTOR 6 +#define SET_DESCRIPTOR 7 +#define GET_CONFIGURATION 8 +#define SET_CONFIGURATION 9 +#define GET_INTERFACE 10 +#define SET_INTERFACE 11 +#define SYNCH_FRAME 12 + +#define TYPE_DEVICE 1 +#define TYPE_CONFIGURATION 2 +#define TYPE_STRING 3 +#define TYPE_INTERFACE 4 +#define TYPE_ENDPOINT 5 + +#define DEVICE_READ 0x80 +#define DEVICE_WRITE 0x00 +#define INTERFACE_READ 0x81 +#define INTERFACE_WRITE 0x01 +#define ENDPOINT_READ 0x82 +#define ENDPOINT_WRITE 0x02 + +typedef struct +{ + unsigned char type; + unsigned char request; + unsigned short value; + unsigned short index; + unsigned short length; +} __attribute__ ((packed)) setup_packet; + + +struct usb_request +{ + struct ept_queue_item *item; + + void *buf; + unsigned length; + + void (*complete)(struct usb_request *req, unsigned actual, int status); + void *context; +}; + +struct usb_request *usb_request_alloc(); +struct usb_endpoint *usb_endpoint_alloc(unsigned num, unsigned in, unsigned maxpkt); +int usb_queue_req(struct usb_endpoint *ept, struct usb_request *req); + +void usb_init(void); +void usb_shutdown(void); +void usb_poll(void); + +/* called to indicate online/offline status */ +void usb_status(unsigned online, unsigned highspeed); + +#endif diff --git a/include/boot/usb_descriptors.h b/include/boot/usb_descriptors.h new file mode 100644 index 0000000..434fcab --- /dev/null +++ b/include/boot/usb_descriptors.h @@ -0,0 +1,163 @@ +/* + * Copyright (C) 2008 The Android Open Source Project + * 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. + * + * 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. + */ + +static unsigned short manufacturer_string[] = { + (TYPE_STRING << 8) | (12 * 2), + 'G', 'o', 'o', 'g', 'l', 'e', ',', ' ', 'I', 'n', 'c', +}; + +static unsigned short product_string[] = { + (TYPE_STRING << 8) | (12 * 2), + 'A', 'n', 'd', 'r', 'o', 'i', 'd', ' ', '1', '.', '0', +}; + +static unsigned short default_string[] = { + (TYPE_STRING << 8) | (8 * 2), + 'd', 'e', 'f', 'a', 'u', 'l', 't', +}; + +static unsigned short language_table[] = { + (TYPE_STRING << 8) | 4, + 0x0409, // LANGID for US English +}; + +static unsigned char device_desc[] = { + 18, // length + TYPE_DEVICE, // type + 0x10, 0x02, // usb spec rev 1.00 + 0x00, // class + 0x00, // subclass + 0x00, // protocol + 0x40, // max packet size + 0xD1, 0x18, // vendor id + 0x0D, 0xD0, // product id + 0x00, 0x01, // version 1.0 + 0x01, // manufacturer str idx + 0x02, // product str idx + 0x00, // serial number index + 0x01, // number of configs, +}; + +static unsigned char config_desc[] = { + 0x09, // length + TYPE_CONFIGURATION, + 0x20, 0x00, // total length + 0x01, // # interfaces + 0x01, // config value + 0x00, // config string + 0x80, // attributes + 0x80, // XXX max power (250ma) + + 0x09, // length + TYPE_INTERFACE, + 0x00, // interface number + 0x00, // alt number + 0x02, // # endpoints + 0xFF, + 0x42, + 0x03, + 0x00, // interface string + + 0x07, // length + TYPE_ENDPOINT, + 0x81, // in, #1 + 0x02, // bulk + 0x00, 0x02, // max packet 512 + 0x00, // interval + + 0x07, // length + TYPE_ENDPOINT, + 0x01, // out, #1 + 0x02, // bulk + 0x00, 0x02, // max packet 512 + 0x01, // interval +}; + +static unsigned char config_desc_fs[] = { + 0x09, // length + TYPE_CONFIGURATION, + 0x20, 0x00, // total length + 0x01, // # interfaces + 0x01, // config value + 0x00, // config string + 0x80, // attributes + 0x80, // XXX max power (250ma) + + 0x09, // length + TYPE_INTERFACE, + 0x00, // interface number + 0x00, // alt number + 0x02, // # endpoints + 0xFF, + 0x42, + 0x03, + 0x00, // interface string + + 0x07, // length + TYPE_ENDPOINT, + 0x81, // in, #1 + 0x02, // bulk + 0x40, 0x00, // max packet 64 + 0x00, // interval + + 0x07, // length + TYPE_ENDPOINT, + 0x01, // out, #1 + 0x02, // bulk + 0x40, 0x00, // max packet 64 + 0x00, // interval +}; + +typedef struct +{ + void *data; + unsigned short length; + unsigned short id; +} dtable; + +#define ID(type,num) ((type << 8) | num) + +static dtable descr_hs[] = { + { device_desc, sizeof(device_desc), ID(TYPE_DEVICE, 0) }, + { config_desc, sizeof(config_desc), ID(TYPE_CONFIGURATION, 0) }, + { manufacturer_string, sizeof(manufacturer_string), ID(TYPE_STRING, 1) }, + { product_string, sizeof(product_string), ID(TYPE_STRING, 2) }, + { default_string, sizeof(default_string), ID(TYPE_STRING, 4) }, + { language_table, sizeof(language_table), ID(TYPE_STRING, 0) }, + { 0, 0, 0 }, +}; + +static dtable descr_fs[] = { + { device_desc, sizeof(device_desc), ID(TYPE_DEVICE, 0) }, + { config_desc_fs, sizeof(config_desc), ID(TYPE_CONFIGURATION, 0) }, + { manufacturer_string, sizeof(manufacturer_string), ID(TYPE_STRING, 1) }, + { product_string, sizeof(product_string), ID(TYPE_STRING, 2) }, + { default_string, sizeof(default_string), ID(TYPE_STRING, 4) }, + { language_table, sizeof(language_table), ID(TYPE_STRING, 0) }, + { 0, 0, 0 }, +}; diff --git a/include/msm7k/dmov.h b/include/msm7k/dmov.h new file mode 100644 index 0000000..b151289 --- /dev/null +++ b/include/msm7k/dmov.h @@ -0,0 +1,161 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_DMOV_H +#define __ASM_ARCH_MSM7200_DMOV_H + +#define MSM_DMOV_BASE 0xA9700000 + +/* see 80-VA736-2 C pp 415-439 */ + +#define DMOV_SD0(off, ch) (MSM_DMOV_BASE + 0x0000 + (off) + ((ch) << 2)) +#define DMOV_SD1(off, ch) (MSM_DMOV_BASE + 0x0400 + (off) + ((ch) << 2)) +#define DMOV_SD2(off, ch) (MSM_DMOV_BASE + 0x0800 + (off) + ((ch) << 2)) +#define DMOV_SD3(off, ch) (MSM_DMOV_BASE + 0x0C00 + (off) + ((ch) << 2)) + +/* only security domain 3 is available to the ARM11 +** +** SD0 -> mARM trusted, SD1 -> mARM nontrusted, SD2 -> aDSP, SD3 -> aARM +** +*/ + +#define DMOV_CMD_PTR(ch) DMOV_SD3(0x000, ch) +#define DMOV_CMD_LIST (0 << 29) /* does not work */ +#define DMOV_CMD_PTR_LIST (1 << 29) /* works */ +#define DMOV_CMD_INPUT_CFG (2 << 29) /* untested */ +#define DMOV_CMD_OUTPUT_CFG (3 << 29) /* untested */ +#define DMOV_CMD_ADDR(addr) ((addr) >> 3) + +#define DMOV_RSLT(ch) DMOV_SD3(0x040, ch) +#define DMOV_RSLT_VALID (1 << 31) /* 0 == host has empties result fifo */ +#define DMOV_RSLT_ERROR (1 << 3) +#define DMOV_RSLT_FLUSH (1 << 2) +#define DMOV_RSLT_DONE (1 << 1) /* top pointer done */ +#define DMOV_RSLT_USER (1 << 0) /* command with FR force result */ + +#define DMOV_FLUSH0(ch) DMOV_SD3(0x080, ch) +#define DMOV_FLUSH1(ch) DMOV_SD3(0x0C0, ch) +#define DMOV_FLUSH2(ch) DMOV_SD3(0x100, ch) +#define DMOV_FLUSH3(ch) DMOV_SD3(0x140, ch) +#define DMOV_FLUSH4(ch) DMOV_SD3(0x180, ch) +#define DMOV_FLUSH5(ch) DMOV_SD3(0x1C0, ch) + +#define DMOV_STATUS(ch) DMOV_SD3(0x200, ch) +#define DMOV_STATUS_RSLT_COUNT(n) (((n) >> 29)) +#define DMOV_STATUS_CMD_COUNT(n) (((n) >> 27) & 3) +#define DMOV_STATUS_RSLT_VALID (1 << 1) +#define DMOV_STATUS_CMD_PTR_RDY (1 << 0) + +#define DMOV_ISR DMOV_SD3(0x380, 0) + +#define DMOV_CONFIG(ch) DMOV_SD3(0x300, ch) +#define DMOV_CONFIG_FORCE_TOP_PTR_RSLT (1 << 2) +#define DMOV_CONFIG_FOREC_FLUSH_RSLT (1 << 1) +#define DMOV_CONFIG_IRQ_EN (1 << 0) + +/* channel assignments - from qc/dmov_7500.h */ + +#define DMOV_NAND_CHAN 7 +#define DMOV_NAND_CRCI_CMD 5 +#define DMOV_NAND_CRCI_DATA 4 + +#define DMOV_SDC1_CHAN 8 +#define DMOV_SDC1_CRCI 6 + +#define DMOV_SDC2_CHAN 8 +#define DMOV_SDC2_CRCI 7 + +#define DMOV_TSIF_CHAN 10 +#define DMOV_TSIF_CRCI 10 + +#define DMOV_USB_CHAN 11 + +/* no client rate control ifc (eg, ram) */ +#define DMOV_NONE_CRCI 0 + + +/* If the CMD_PTR register has CMD_PTR_LIST selected, the data mover +** is going to walk a list of 32bit pointers as described below. Each +** pointer points to a *array* of dmov_s, etc structs. The last pointer +** in the list is marked with CMD_PTR_LP. The last struct in each array +** is marked with CMD_LC (see below). +*/ +#define CMD_PTR_ADDR(addr) ((addr) >> 3) +#define CMD_PTR_LP (1 << 31) /* last pointer */ +#define CMD_PTR_PT (3 << 29) /* ? */ + + +/* Single Item Mode -- seems to work as expected */ +typedef struct { + unsigned cmd; + unsigned src; + unsigned dst; + unsigned len; +} dmov_s; + +/* Scatter/Gather Mode -- does this work?*/ +typedef struct { + unsigned cmd; + unsigned src_dscr; + unsigned dst_dscr; + unsigned _reserved; +} dmov_sg; + +/* bits for the cmd field of the above structures */ + +#define CMD_LC (1 << 31) /* last command */ +#define CMD_FR (1 << 22) /* force result -- does not work? */ +#define CMD_OCU (1 << 21) /* other channel unblock */ +#define CMD_OCB (1 << 20) /* other channel block */ +#define CMD_TCB (1 << 19) /* ? */ +#define CMD_DAH (1 << 18) /* destination address hold -- does not work?*/ +#define CMD_SAH (1 << 17) /* source address hold -- does not work? */ + +#define CMD_MODE_SINGLE (0 << 0) /* dmov_s structure used */ +#define CMD_MODE_SG (1 << 0) /* untested */ +#define CMD_MODE_IND_SG (2 << 0) /* untested */ +#define CMD_MODE_BOX (3 << 0) /* untested */ + +#define CMD_DST_SWAP_BYTES (1 << 14) /* exchange each byte n with byte n+1 */ +#define CMD_DST_SWAP_SHORTS (1 << 15) /* exchange each short n with short n+1 */ +#define CMD_DST_SWAP_WORDS (1 << 16) /* exchange each word n with word n+1 */ + +#define CMD_SRC_SWAP_BYTES (1 << 11) /* exchange each byte n with byte n+1 */ +#define CMD_SRC_SWAP_SHORTS (1 << 12) /* exchange each short n with short n+1 */ +#define CMD_SRC_SWAP_WORDS (1 << 13) /* exchange each word n with word n+1 */ + +#define CMD_DST_CRCI(n) (((n) & 15) << 7) +#define CMD_SRC_CRCI(n) (((n) & 15) << 3) + + +/* NOTES: +** +** Looks like Channels 4, 5, 6, 7, 8, 10, 11 are available to the ARM11 +** +*/ +#endif diff --git a/include/msm7k/gpio.h b/include/msm7k/gpio.h new file mode 100644 index 0000000..8d56a03 --- /dev/null +++ b/include/msm7k/gpio.h @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_GPIO_H +#define __ASM_ARCH_MSM7200_GPIO_H + +#define MSM_GPIO1_BASE 0xA9200000 +#define MSM_GPIO2_BASE 0xA9300000 + +/* see 80-VA736-2 Rev C pp 695-751 +** +** These are actually the *shadow* gpio registers, since the +** real ones (which allow full access) are only available to the +** ARM9 side of the world. +** +** Since the _BASE need to be page-aligned when we're mapping them +** to virtual addresses, adjust for the additional offset in these +** macros. +*/ + +#define GPIO1_REG(off) (MSM_GPIO1_BASE + 0x800 + (off)) +#define GPIO2_REG(off) (MSM_GPIO2_BASE + 0xC00 + (off)) + +/* output value */ +#define GPIO_OUT_0 GPIO1_REG(0x00) /* gpio 15-0 */ +#define GPIO_OUT_1 GPIO2_REG(0x00) /* gpio 42-16 */ +#define GPIO_OUT_2 GPIO1_REG(0x04) /* gpio 67-43 */ +#define GPIO_OUT_3 GPIO1_REG(0x08) /* gpio 94-68 */ +#define GPIO_OUT_4 GPIO1_REG(0x0C) /* gpio 106-95 */ + +/* same pin map as above, output enable */ +#define GPIO_OE_0 GPIO1_REG(0x10) +#define GPIO_OE_1 GPIO2_REG(0x08) +#define GPIO_OE_2 GPIO1_REG(0x14) +#define GPIO_OE_3 GPIO1_REG(0x18) +#define GPIO_OE_4 GPIO1_REG(0x1C) + +/* same pin map as above, input read */ +#define GPIO_IN_0 GPIO1_REG(0x34) +#define GPIO_IN_1 GPIO2_REG(0x20) +#define GPIO_IN_2 GPIO1_REG(0x38) +#define GPIO_IN_3 GPIO1_REG(0x3C) +#define GPIO_IN_4 GPIO1_REG(0x40) + +/* same pin map as above, 1=edge 0=level interrup */ +#define GPIO_INT_EDGE_0 GPIO1_REG(0x60) +#define GPIO_INT_EDGE_1 GPIO2_REG(0x50) +#define GPIO_INT_EDGE_2 GPIO1_REG(0x64) +#define GPIO_INT_EDGE_3 GPIO1_REG(0x68) +#define GPIO_INT_EDGE_4 GPIO1_REG(0x6C) + +/* same pin map as above, 1=positive 0=negative */ +#define GPIO_INT_POS_0 GPIO1_REG(0x70) +#define GPIO_INT_POS_1 GPIO2_REG(0x58) +#define GPIO_INT_POS_2 GPIO1_REG(0x74) +#define GPIO_INT_POS_3 GPIO1_REG(0x78) +#define GPIO_INT_POS_4 GPIO1_REG(0x7C) + +/* same pin map as above, interrupt enable */ +#define GPIO_INT_EN_0 GPIO1_REG(0x80) +#define GPIO_INT_EN_1 GPIO2_REG(0x60) +#define GPIO_INT_EN_2 GPIO1_REG(0x84) +#define GPIO_INT_EN_3 GPIO1_REG(0x88) +#define GPIO_INT_EN_4 GPIO1_REG(0x8C) + +/* same pin map as above, write 1 to clear interrupt */ +#define GPIO_INT_CLEAR_0 GPIO1_REG(0x90) +#define GPIO_INT_CLEAR_1 GPIO2_REG(0x68) +#define GPIO_INT_CLEAR_2 GPIO1_REG(0x94) +#define GPIO_INT_CLEAR_3 GPIO1_REG(0x98) +#define GPIO_INT_CLEAR_4 GPIO1_REG(0x9C) + +/* same pin map as above, 1=interrupt pending */ +#define GPIO_INT_STATUS_0 GPIO1_REG(0xA0) +#define GPIO_INT_STATUS_1 GPIO2_REG(0x70) +#define GPIO_INT_STATUS_2 GPIO1_REG(0xA4) +#define GPIO_INT_STATUS_3 GPIO1_REG(0xA8) +#define GPIO_INT_STATUS_4 GPIO1_REG(0xAC) + +#endif diff --git a/include/msm7k/gpt.h b/include/msm7k/gpt.h new file mode 100644 index 0000000..69211ca --- /dev/null +++ b/include/msm7k/gpt.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_GPT_H +#define __ASM_ARCH_MSM7200_GPT_H + +#define MSM_GPT_BASE 0xC0100000 + +#define GPT_REG(off) (MSM_GPT_BASE + (off)) + +/* See 80-VE113-1 A, pp 229-231 */ + +#define GPT_MATCH_VAL GPT_REG(0x0000) +#define GPT_COUNT_VAL GPT_REG(0x0004) +#define GPT_ENABLE GPT_REG(0x0008) +#define GPT_ENABLE_CLR_ON_MATCH_EN 2 +#define GPT_ENABLE_EN 1 +#define GPT_CLEAR GPT_REG(0x000C) + +#define DGT_MATCH_VAL GPT_REG(0x0010) +#define DGT_COUNT_VAL GPT_REG(0x0014) +#define DGT_ENABLE GPT_REG(0x0018) +#define DGT_ENABLE_CLR_ON_MATCH_EN 2 +#define DGT_ENABLE_EN 1 +#define DGT_CLEAR GPT_REG(0x001C) + +#define CSR_PROTECTION GPT_REG(0x0020) +#define CSR_PROTECTION_EN 1 + +#endif diff --git a/include/msm7k/hsusb.h b/include/msm7k/hsusb.h new file mode 100644 index 0000000..5420d14 --- /dev/null +++ b/include/msm7k/hsusb.h @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef _MSM7200_USB_H_ +#define _MSM7200_USB_H_ + +#define MSM_USB_BASE 0xA0800000 + + +#define USB_ID (MSM_USB_BASE + 0x0000) +#define USB_HWGENERAL (MSM_USB_BASE + 0x0004) +#define USB_HWHOST (MSM_USB_BASE + 0x0008) +#define USB_HWDEVICE (MSM_USB_BASE + 0x000C) +#define USB_HWTXBUF (MSM_USB_BASE + 0x0010) +#define USB_HWRXBUF (MSM_USB_BASE + 0x0014) +#define USB_SBUSCFG (MSM_USB_BASE + 0x0090) + +#define USB_CAPLENGTH (MSM_USB_BASE + 0x0100) /* 8 bit */ +#define USB_HCIVERSION (MSM_USB_BASE + 0x0102) /* 16 bit */ +#define USB_HCSPARAMS (MSM_USB_BASE + 0x0104) +#define USB_HCCPARAMS (MSM_USB_BASE + 0x0108) +#define USB_DCIVERSION (MSM_USB_BASE + 0x0120) /* 16 bit */ +#define USB_USBCMD (MSM_USB_BASE + 0x0140) +#define USB_USBSTS (MSM_USB_BASE + 0x0144) +#define USB_USBINTR (MSM_USB_BASE + 0x0148) +#define USB_FRINDEX (MSM_USB_BASE + 0x014C) +#define USB_DEVICEADDR (MSM_USB_BASE + 0x0154) +#define USB_ENDPOINTLISTADDR (MSM_USB_BASE + 0x0158) +#define USB_BURSTSIZE (MSM_USB_BASE + 0x0160) +#define USB_TXFILLTUNING (MSM_USB_BASE + 0x0164) +#define USB_ULPI_VIEWPORT (MSM_USB_BASE + 0x0170) +#define USB_ENDPTNAK (MSM_USB_BASE + 0x0178) +#define USB_ENDPTNAKEN (MSM_USB_BASE + 0x017C) +#define USB_PORTSC (MSM_USB_BASE + 0x0184) +#define USB_OTGSC (MSM_USB_BASE + 0x01A4) +#define USB_USBMODE (MSM_USB_BASE + 0x01A8) +#define USB_ENDPTSETUPSTAT (MSM_USB_BASE + 0x01AC) +#define USB_ENDPTPRIME (MSM_USB_BASE + 0x01B0) +#define USB_ENDPTFLUSH (MSM_USB_BASE + 0x01B4) +#define USB_ENDPTSTAT (MSM_USB_BASE + 0x01B8) +#define USB_ENDPTCOMPLETE (MSM_USB_BASE + 0x01BC) +#define USB_ENDPTCTRL(n) (MSM_USB_BASE + 0x01C0 + (4 * (n))) + + +#define USBCMD_RESET 2 +#define USBCMD_ATTACH 1 + +#define USBMODE_DEVICE 2 +#define USBMODE_HOST 3 + +struct ept_queue_head +{ + unsigned config; + unsigned current; /* read-only */ + + unsigned next; + unsigned info; + unsigned page0; + unsigned page1; + unsigned page2; + unsigned page3; + unsigned page4; + unsigned reserved_0; + + unsigned char setup_data[8]; + + unsigned reserved_1; + unsigned reserved_2; + unsigned reserved_3; + unsigned reserved_4; +}; + +#define CONFIG_MAX_PKT(n) ((n) << 16) +#define CONFIG_ZLT (1 << 29) /* stop on zero-len xfer */ +#define CONFIG_IOS (1 << 15) /* IRQ on setup */ + +struct ept_queue_item +{ + unsigned next; + unsigned info; + unsigned page0; + unsigned page1; + unsigned page2; + unsigned page3; + unsigned page4; + unsigned reserved; +}; + +#define TERMINATE 1 + +#define INFO_BYTES(n) ((n) << 16) +#define INFO_IOC (1 << 15) +#define INFO_ACTIVE (1 << 7) +#define INFO_HALTED (1 << 6) +#define INFO_BUFFER_ERROR (1 << 5) +#define INFO_TX_ERROR (1 << 3) + + +#define STS_NAKI (1 << 16) /* */ +#define STS_SLI (1 << 8) /* R/WC - suspend state entered */ +#define STS_SRI (1 << 7) /* R/WC - SOF recv'd */ +#define STS_URI (1 << 6) /* R/WC - RESET recv'd - write to clear */ +#define STS_FRI (1 << 3) /* R/WC - Frame List Rollover */ +#define STS_PCI (1 << 2) /* R/WC - Port Change Detect */ +#define STS_UEI (1 << 1) /* R/WC - USB Error */ +#define STS_UI (1 << 0) /* R/WC - USB Transaction Complete */ + + +/* bits used in all the endpoint status registers */ +#define EPT_TX(n) (1 << ((n) + 16)) +#define EPT_RX(n) (1 << (n)) + + +#define CTRL_TXE (1 << 23) +#define CTRL_TXR (1 << 22) +#define CTRL_TXI (1 << 21) +#define CTRL_TXD (1 << 17) +#define CTRL_TXS (1 << 16) +#define CTRL_RXE (1 << 7) +#define CTRL_RXR (1 << 6) +#define CTRL_RXI (1 << 5) +#define CTRL_RXD (1 << 1) +#define CTRL_RXS (1 << 0) + +#define CTRL_TXT_CTRL (0 << 18) +#define CTRL_TXT_ISOCH (1 << 18) +#define CTRL_TXT_BULK (2 << 18) +#define CTRL_TXT_INT (3 << 18) + +#define CTRL_RXT_CTRL (0 << 2) +#define CTRL_RXT_ISOCH (1 << 2) +#define CTRL_RXT_BULK (2 << 2) +#define CTRL_RXT_INT (3 << 2) + +#define ULPI_WAKEUP (1 << 31) +#define ULPI_RUN (1 << 30) +#define ULPI_WRITE (1 << 29) +#define ULPI_READ (0 << 29) +#define ULPI_STATE_NORMAL (1 << 27) +#define ULPI_ADDR(n) (((n) & 255) << 16) +#define ULPI_DATA(n) ((n) & 255) +#define ULPI_DATA_READ(n) (((n) >> 8) & 255) + +#endif diff --git a/include/msm7k/irqs.h b/include/msm7k/irqs.h new file mode 100644 index 0000000..d37d50d --- /dev/null +++ b/include/msm7k/irqs.h @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_IRQS_H + +/* MSM7200 ARM11 Interrupt Numbers */ +/* See 80-VE113-1 A, pp219-221 */ + +#define INT_A9_M2A_0 0 +#define INT_A9_M2A_1 1 +#define INT_A9_M2A_2 2 +#define INT_A9_M2A_3 3 +#define INT_A9_M2A_4 4 +#define INT_A9_M2A_5 5 +#define INT_A9_M2A_6 6 +#define INT_GP_TIMER_EXP 7 +#define INT_DEBUG_TIMER_EXP 8 +#define INT_UART1 9 +#define INT_UART2 10 +#define INT_UART3 11 +#define INT_UART1_RX 12 +#define INT_UART2_RX 13 +#define INT_UART3_RX 14 +#define INT_USB_OTG 15 +#define INT_MDDI_PRI 16 +#define INT_MDDI_EXT 17 +#define INT_MDDI_CLIENT 18 +#define INT_MDP 19 +#define INT_GRAPHICS 20 +#define INT_ADM_AARM 21 +#define INT_ADSP_A11 22 +#define INT_ADSP_A9_A11 23 +#define INT_SDC1_0 24 +#define INT_SDC1_1 25 +#define INT_SDC2_0 26 +#define INT_SDC2_1 27 +#define INT_KEYSENSE 28 +#define INT_TCHSCRN_SSBI 29 +#define INT_TCHSCRN1 30 +#define INT_TCHSCRN2 31 + +#define INT_GPIO_GROUP1 (32 + 0) +#define INT_GPIO_GROUP2 (32 + 1) +#define INT_PWB_I2C (32 + 2) +#define INT_NAND_WR_ER_DONE (32 + 3) +#define INT_NAND_OP_DONE (32 + 4) +#define INT_SOFTRESET (32 + 5) +#define INT_PBUS_ARM11 (32 + 6) +#define INT_AXI_MPU_SMI (32 + 7) +#define INT_AXI_MPU_EBI1 (32 + 8) +#define INT_AD_HSSD (32 + 9) +#define INT_ARM11_PM (32 + 10) +#define INT_ARM11_DMA (32 + 11) +#define INT_TSIF_IRQ (32 + 12) +#define INT_UART1DM_IRQ (32 + 13) +#define INT_UART1DM_RX (32 + 14) +#define INT_SPARE0 (32 + 15) + +#define MSM_IRQ_BIT(irq) (1 << ((irq) & 31)) + +#define NR_IRQS 48 + +#endif diff --git a/include/msm7k/mddi.h b/include/msm7k/mddi.h new file mode 100644 index 0000000..619655e --- /dev/null +++ b/include/msm7k/mddi.h @@ -0,0 +1,272 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_MDDI_H +#define __ASM_ARCH_MSM7200_MDDI_H + +#define MSM_MDDI_BASE 0xAA600000 + +/* see 80-VA736-2 C pp 776-787 */ + +#define MDDI_REG(off) (MSM_MDDI_BASE + (off)) + +#define MDDI_CMD MDDI_REG(0x0000) +#define MDDI_VERSION MDDI_REG(0x0004) +#define MDDI_PRI_PTR MDDI_REG(0x0008) +#define MDDI_SEC_PTR MDDI_REG(0x000C) +#define MDDI_BPS MDDI_REG(0x0010) +#define MDDI_SPM MDDI_REG(0x0014) +#define MDDI_INT MDDI_REG(0x0018) + +#define MDDI_INT_PRI_PTR_READ (1 << 0) +#define MDDI_INT_SEC_PTR_READ (1 << 1) +#define MDDI_INT_REV_DATA_AVAIL (1 << 2) +#define MDDI_INT_DISP_REQ (1 << 3) +#define MDDI_INT_PRI_UNDERFLOW (1 << 4) +#define MDDI_INT_SEC_UNDERFLOW (1 << 5) +#define MDDI_INT_REV_OVERFLOW (1 << 6) +#define MDDI_INT_CRC_ERROR (1 << 7) +#define MDDI_INT_MDDI_IN (1 << 8) +#define MDDI_INT_PRI_OVERWRITE (1 << 9) +#define MDDI_INT_SEC_OVERWRITE (1 << 10) +#define MDDI_INT_REV_OVERWRITE (1 << 11) +#define MDDI_INT_DMA_FAILURE (1 << 12) +#define MDDI_INT_LINK_ACTIVE (1 << 13) +#define MDDI_INT_IN_HIBERNATION (1 << 14) +#define MDDI_INT_PRI_LINK_LIST_DONE (1 << 15) +#define MDDI_INT_SEC_LINK_LIST_DONE (1 << 16) +#define MDDI_INT_NO_REQ_PKTS_PENDING (1 << 17) +#define MDDI_INT_RTD_FAILURE (1 << 18) +#define MDDI_INT_REV_PKT_RECEIVED (1 << 19) +#define MDDI_INT_REV_PKTS_AVAIL (1 << 20) + +#define MDDI_INTEN MDDI_REG(0x001C) +#define MDDI_REV_PTR MDDI_REG(0x0020) +#define MDDI_REV_SIZE MDDI_REG(0x0024) +#define MDDI_STAT MDDI_REG(0x0028) + +#define MDDI_STAT_LINK_ACTIVE (1 << 0) +#define MDDI_STAT_NEW_REV_PTR (1 << 1) +#define MDDI_STAT_NEW_PRI_PTR (1 << 2) +#define MDDI_STAT_NEW_SEC_PTR (1 << 3) +#define MDDI_STAT_IN_HIBERNATION (1 << 4) +#define MDDI_STAT_PRI_LINK_LIST_DONE (1 << 5) +#define MDDI_STAT_SEC_LINK_LIST_DONE (1 << 6) +#define MDDI_STAT_SEND_TIMING_PKT (1 << 7) +#define MDDI_STAT_SEND_REV_ENCAP_WITH_FLAGS (1 << 8) +#define MDDI_STAT_SEND_POWER_DOWN (1 << 9) +#define MDDI_STAT_DO_HANDSHAKE (1 << 10) +#define MDDI_STAT_RTD_MEAS_FAIL (1 << 11) +#define MDDI_STAT_CLIENT_WAKEUP_REQ (1 << 12) +#define MDDI_STAT_DMA_ABORT (1 << 13) +#define MDDI_STAT_REV_OVERFLOW_RESET (1 << 14) +#define MDDI_STAT_FORCE_NEW_REV_PTR (1 << 15) +#define MDDI_STAT_CRC_ERRORS (1 << 16) + +#define MDDI_REV_RATE_DIV MDDI_REG(0x002C) +#define MDDI_REV_CRC_ERR MDDI_REG(0x0030) +#define MDDI_TA1_LEN MDDI_REG(0x0034) +#define MDDI_TA2_LEN MDDI_REG(0x0038) +#define MDDI_TEST_BUS MDDI_REG(0x003C) +#define MDDI_TEST MDDI_REG(0x0040) +#define MDDI_REV_PKT_CNT MDDI_REG(0x0044) +#define MDDI_DRIVE_HI MDDI_REG(0x0048) +#define MDDI_DRIVE_LO MDDI_REG(0x004C) +#define MDDI_DISP_WAKE MDDI_REG(0x0050) +#define MDDI_REV_ENCAP_SZ MDDI_REG(0x0054) +#define MDDI_RTD_VAL MDDI_REG(0x0058) +#define MDDI_MDP_VID_FMT_DES MDDI_REG(0x005C) +#define MDDI_MDP_VID_PIX_ATTR MDDI_REG(0x0060) +#define MDDI_MDP_VID_CLIENTID MDDI_REG(0x0064) +#define MDDI_PAD_CTL MDDI_REG(0x0068) +#define MDDI_DRIVER_START_CNT MDDI_REG(0x006C) +#define MDDI_NEXT_PRI_PTR MDDI_REG(0x0070) +#define MDDI_NEXT_SEC_PTR MDDI_REG(0x0074) +#define MDDI_MISR_CTL MDDI_REG(0x0078) +#define MDDI_MISR_DATA MDDI_REG(0x007C) +#define MDDI_SF_CNT MDDI_REG(0x0080) +#define MDDI_MF_CNT MDDI_REG(0x0084) +#define MDDI_CURR_REV_PTR MDDI_REG(0x0088) +#define MDDI_CORE_VER MDDI_REG(0x008C) + +#define CMD_POWER_DOWN 0x0100 +#define CMD_POWER_UP 0x0200 +#define CMD_HIBERNATE 0x0300 +#define CMD_RESET 0x0400 +#define CMD_IGNORE 0x0500 +#define CMD_REV_ENC_REQ 0x0600 +#define CMD_RTD_MEASURE 0x0700 +#define CMD_LINK_ACTIVE 0x0900 +#define CMD_PERIODIC_REV_ENC 0x0A00 +#define CMD_FORCE_NEW_REV_PTR 0x0C00 + +#define CMD_GET_CLIENT_CAP 0x0601 +#define CMD_GET_CLIENT_STATUS 0x0602 + +#if 1 +#define FORMAT_18BPP 0x5666 +#define FORMAT_24BPP 0x5888 +#define FORMAT_16BPP 0x5565 +#else +#define FORMAT_MONOCHROME (0 << 13) +#define FORMAT_PALETTE (1 << 13) +#define FORMAT_RGB (2 << 13) +#define FORMAT_YCBCR422 (3 << 13) +#define FORMAT_BAYER (4 << 13) +#endif + +#define PIXATTR_BOTH_EYES 3 +#define PIXATTR_LEFT_EYE 2 +#define PIXATTR_RIGHT_EYE 1 +#define PIXATTR_ALT_DISPLAY 0 + +#define PIXATTR_PROGRESSIVE 0 +#define PIXATTR_INTERLACED (1 << 2) +#define PIXATTR_ALTERNATE (1 << 3) + +#define PIXATTR_IGNORE_LRTB (1 << 5) + +#define PIXATTR_TO_REFRESH (0 << 6) +#define PIXATTR_TO_OFFLINE (1 << 6) +#define PIXATTR_TO_ALL (3 << 6) + +#define PIXATTR_LAST_ROW (1 << 15) + +#define TYPE_VIDEO_STREAM 16 +#define TYPE_CLIENT_CAPS 66 +#define TYPE_REGISTER_ACCESS 146 +#define TYPE_CLIENT_STATUS 70 + +typedef struct mddi_video_stream mddi_video_stream; +typedef struct mddi_register_access mddi_register_access; +typedef struct mddi_client_caps mddi_client_caps; + +typedef struct mddi_llentry mddi_llentry; + +struct __attribute__((packed)) mddi_video_stream +{ + unsigned short length; /* length in bytes excluding this field */ + unsigned short type; /* MDDI_TYPE_VIDEO_STREAM */ + unsigned short client_id; /* set to zero */ + + unsigned short format; + unsigned short pixattr; + + unsigned short left; + unsigned short top; + unsigned short right; + unsigned short bottom; + + unsigned short start_x; + unsigned short start_y; + + unsigned short pixels; + + unsigned short crc; + unsigned short reserved; +}; + +struct __attribute__((packed)) mddi_register_access +{ + unsigned short length; + unsigned short type; + unsigned short client_id; + + unsigned short rw_info; /* flag below | count of reg_data */ +#define MDDI_WRITE (0 << 14) +#define MDDI_READ (2 << 14) +#define MDDI_READ_RESP (3 << 14) + + unsigned reg_addr; + unsigned short crc; /* 16 bit crc of the above */ + + unsigned reg_data; /* "list" of 3byte data values */ +}; + +struct __attribute__((packed)) mddi_llentry { + unsigned short flags; + unsigned short header_count; + unsigned short data_count; + void *data; + mddi_llentry *next; + unsigned short reserved; + union { + mddi_video_stream v; + mddi_register_access r; + unsigned _[12]; + } u; +}; + +struct __attribute__((packed)) mddi_client_caps +{ + unsigned short length; + unsigned short type; + unsigned short client_id; + + unsigned short protocol_ver; + unsigned short min_protocol_ver; + unsigned short data_rate_cap; + unsigned char interface_type_cap; + unsigned char num_alt_displays; + unsigned short postcal_data_rate; + unsigned short bitmap_width; + unsigned short bitmap_height; + unsigned short display_window_width; + unsigned short display_window_height; + unsigned cmap_size; + unsigned short cmap_rgb_width; + unsigned short rgb_cap; + unsigned char mono_cap; + unsigned char reserved1; + unsigned short ycbcr_cap; + unsigned short bayer_cap; + unsigned short alpha_cursor_planes; + unsigned client_feature_cap; + unsigned char max_video_frame_rate_cap; + unsigned char min_video_frame_rate_cap; + unsigned short min_sub_frame_rate; + unsigned short audio_buf_depth; + unsigned short audio_channel_cap; + unsigned short audio_sampe_rate_rap; + unsigned char audio_sample_res; + unsigned char mic_audio_sample_res; + unsigned short mic_sample_rate_cap; + unsigned char keyboard_data_fmt; + unsigned char pointing_device_data_fmt; + unsigned short content_protection_type; + unsigned short manufacturer_name; + unsigned short product_code; + unsigned short reserved3; + unsigned serial_no; + unsigned char week_of_manufacture; + unsigned char year_of_manufacture; + + unsigned short crc; +}; + +#endif diff --git a/include/msm7k/mdp.h b/include/msm7k/mdp.h new file mode 100644 index 0000000..11f05e8 --- /dev/null +++ b/include/msm7k/mdp.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_MDP_H +#define __ASM_ARCH_MSM7200_MDP_H + +#define MSM_MDP_BASE1 0xAA200000 +#define MSM_MDP_BASE2 0xAA210100 + +/* see 80-VA736-2 C pp 587-627 */ + +#define MDP_REG1(off) (MSM_MDP_BASE1 + (off)) +#define MDP_REG(off) (MSM_MDP_BASE2 + (off)) + + +#define MDP_SYNC_CONFIG_0 MDP_REG1(0x0000) +#define MDP_SYNC_CONFIG_1 MDP_REG1(0x0004) +#define MDP_SYNC_CONFIG_2 MDP_REG1(0x0008) +#define MDP_SYNC_VSYNC_EN (1 << 17) +#define MDP_SYNC_SYNC_EN (1 << 16) +#define MDP_SYNC_DIV_CNT(n) ((n) & 0xffff) + +#define MDP_SYNC_STATUS_0 MDP_REG1(0x000C) +#define MDP_SYNC_STATUS_1 MDP_REG1(0x0010) +#define MDP_SYNC_STATUS_2 MDP_REG1(0x0014) +#define MDP_SYNC_FRAME_COUNT(n) (((n) >> 16) & 0xfff) +#define MDP_SYNC_LINE_COUNT(n) ((n) & 0x3ff) + +#define MDP_SYNC_THRESH_0 MDP_REG1(0x0018) +#define MDP_SYNC_SEC_ABOVE(n) (((n) & 0xFF) << 24) +#define MDP_SYNC_SEC_BELOW(n) (((n) & 0xFF) << 16) +#define MDP_SYNC_PRIM_ABOVE(n) (((n) & 0xFF) << 8) +#define MDP_SYNC_PRIM_BELOW(n) ((n) & 0xFF) + +#define MDP_SYNC_THRESH_1 MDP_REG1(0x001C) +#define MDP_SYNC_EXT_ABOVE(n) (((n) & 0xFF) << 8) +#define MDP_SYNC_EXT_BELOW(n) ((n) & 0xFF) + +#define MDP_INTR_ENABLE MDP_REG1(0x0020) +#define MDP_INTR_STATUS MDP_REG1(0x0024) +#define MDP_INTR_CLEAR MDP_REG1(0x0028) +#define MDP_INTR_LIST0_DONE (1 << 0) +#define MDP_INTR_LIST1_DONE (1 << 1) +#define MDP_INTR_DMA_DONE (1 << 2) +#define MDP_INTR_TV_DONE (1 << 3) +#define MDP_INTR_CONFIG_ERR (1 << 4) +#define MDP_INTR_ROI_ERR (1 << 5) +#define MDP_INTR_TV_UNDERRUN (1 << 6) + +#define MDP_HW_VERSION MDP_REG1(0x0070) + + +#define MDP_EDGE_CONFIG MDP_REG(0x0000) +#define MDP_TILE_CONFIG MDP_REG(0x0004) + +/* BLT controls */ +#define MDP_SRC_ROI MDP_REG(0x0008) +#define MDP_SRCP0_ADDR MDP_REG(0x000C) +#define MDP_SRCP1_ADDR MDP_REG(0x0010) +#define MDP_SRCP2_ADDR MDP_REG(0x0014) +#define MDP_SRCP3_ADDR MDP_REG(0x0018) +#define MDP_SRCP01_STRIDE MDP_REG(0x001C) +#define MDP_SRCP23_STRIDE MDP_REG(0x0020) +#define MDP_SRC_CONFIG MDP_REG(0x0024) +#define MDP_UNPACK_PATTERN0 MDP_REG(0x0028) +#define MDP_UNPACK_PATTERN1 MDP_REG(0x002C) +#define MDP_UNPACK_PATTERN2 MDP_REG(0x0030) +#define MDP_UNPACK_PATTERN3 MDP_REG(0x0034) +#define MDP_PPP_CONFIG MDP_REG(0x0038) +#define MDP_PHASEX_INIT MDP_REG(0x003C) +#define MDP_PHASEY_INIT MDP_REG(0x0040) +#define MDP_PHASEX_STEP MDP_REG(0x0044) +#define MDP_PHASEY_STEP MDP_REG(0x0048) +#define MDP_ALPHA_CONFIG MDP_REG(0x004C) +#define MDP_DST_CONFIG MDP_REG(0x0050) +#define MDP_PACK_PATTERN0 MDP_REG(0x0054) +#define MDP_PACK_PATTERN1 MDP_REG(0x0058) +#define MDP_PACK_PATTERN2 MDP_REG(0x005C) +#define MDP_PACK_PATTERN3 MDP_REG(0x0060) +#define MDP_DST_ROI MDP_REG(0x0064) +#define MDP_DSTP0_ADDR MDP_REG(0x0068) +#define MDP_DSTP1_ADDR MDP_REG(0x006C) +#define MDP_DSTP2_ADDR MDP_REG(0x0070) +#define MDP_DSTP3_ADDR MDP_REG(0x0074) +#define MDP_DSTP01_STRIDE MDP_REG(0x0078) +#define MDP_DSTP23_STRIDE MDP_REG(0x007C) + +#endif diff --git a/include/msm7k/nand.h b/include/msm7k/nand.h new file mode 100644 index 0000000..12f2f9a --- /dev/null +++ b/include/msm7k/nand.h @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_NAND_H +#define __ASM_ARCH_MSM7200_NAND_H + +#define MSM_NAND_BASE 0xA0A00000 + +/* see 80-VA736-2 C pp 354-414 */ + +#define NAND_REG(off) (MSM_NAND_BASE + (off)) + +#define NAND_FLASH_CMD NAND_REG(0x0000) +#define NAND_ADDR0 NAND_REG(0x0004) +#define NAND_ADDR1 NAND_REG(0x0008) +#define NAND_FLASH_CHIP_SELECT NAND_REG(0x000C) +#define NAND_EXEC_CMD NAND_REG(0x0010) +#define NAND_FLASH_STATUS NAND_REG(0x0014) +#define NAND_BUFFER_STATUS NAND_REG(0x0018) +#define NAND_DEV0_CFG0 NAND_REG(0x0020) +#define NAND_DEV0_CFG1 NAND_REG(0x0024) +#define NAND_DEV1_CFG0 NAND_REG(0x0030) +#define NAND_DEV1_CFG1 NAND_REG(0x0034) +#define NAND_READ_ID NAND_REG(0x0040) +#define NAND_READ_STATUS NAND_REG(0x0044) +#define NAND_CONFIG_DATA NAND_REG(0x0050) +#define NAND_CONFIG NAND_REG(0x0054) +#define NAND_CONFIG_MODE NAND_REG(0x0058) +#define NAND_CONFIG_STATUS NAND_REG(0x0060) +#define NAND_MACRO1_REG NAND_REG(0x0064) +#define NAND_XFR_STEP1 NAND_REG(0x0070) +#define NAND_XFR_STEP2 NAND_REG(0x0074) +#define NAND_XFR_STEP3 NAND_REG(0x0078) +#define NAND_XFR_STEP4 NAND_REG(0x007C) +#define NAND_XFR_STEP5 NAND_REG(0x0080) +#define NAND_XFR_STEP6 NAND_REG(0x0084) +#define NAND_XFR_STEP7 NAND_REG(0x0088) +#define NAND_DEV_CMD0 NAND_REG(0x00A0) +#define NAND_DEV_CMD1 NAND_REG(0x00A4) +#define NAND_DEV_CMD2 NAND_REG(0x00A8) +#define NAND_DEV_CMD_VLD NAND_REG(0x00AC) +#define NAND_EBI2_MISR_SIG_REG NAND_REG(0x00B0) +#define NAND_EBI2_ECC_BUF_CFG NAND_REG(0x00F0) +#define NAND_FLASH_BUFFER NAND_REG(0x0100) + +/* device commands */ + +#define NAND_CMD_SOFT_RESET 0x01 +#define NAND_CMD_PAGE_READ 0x32 +#define NAND_CMD_PAGE_READ_ECC 0x33 +#define NAND_CMD_PAGE_READ_ALL 0x34 +#define NAND_CMD_SEQ_PAGE_READ 0x15 +#define NAND_CMD_PRG_PAGE 0x36 +#define NAND_CMD_PRG_PAGE_ECC 0x37 +#define NAND_CMD_PRG_PAGE_ALL 0x39 +#define NAND_CMD_BLOCK_ERASE 0x3A +#define NAND_CMD_FETCH_ID 0x0B +#define NAND_CMD_STATUS 0x0C +#define NAND_CMD_RESET 0x0D + +#endif diff --git a/include/msm7k/shared.h b/include/msm7k/shared.h new file mode 100644 index 0000000..b81732b --- /dev/null +++ b/include/msm7k/shared.h @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef MSM7K_SHARED_H +#define MSM7K_SHARED_H + +#define MSM7K_SHARED_PHYS 0x01F00000 + +#define MSM7K_VERSION (MSM7K_SHARED_PHYS + 0x40) + +#define VERSION_QDSP6 4 +#define VERSION_APPS_SBL 6 +#define VERSION_MODEM_SBL 7 +#define VERSION_APPS 8 +#define VERSION_MODEM 9 + +void get_version_modem(char *s); +void get_version_modem_sbl(char *s); + + +#define ACPU_CLK 0 /* Applications processor clock */ +#define ADM_CLK 1 /* Applications data mover clock */ +#define ADSP_CLK 2 /* ADSP clock */ +#define EBI1_CLK 3 /* External bus interface 1 clock */ +#define EBI2_CLK 4 /* External bus interface 2 clock */ +#define ECODEC_CLK 5 /* External CODEC clock */ +#define EMDH_CLK 6 /* External MDDI host clock */ +#define GP_CLK 7 /* General purpose clock */ +#define GRP_CLK 8 /* Graphics clock */ +#define I2C_CLK 9 /* I2C clock */ +#define ICODEC_RX_CLK 10 /* Internal CODEX RX clock */ +#define ICODEC_TX_CLK 11 /* Internal CODEX TX clock */ +#define IMEM_CLK 12 /* Internal graphics memory clock */ +#define MDC_CLK 13 /* MDDI client clock */ +#define MDP_CLK 14 /* Mobile display processor clock */ +#define PBUS_CLK 15 /* Peripheral bus clock */ +#define PCM_CLK 16 /* PCM clock */ +#define PMDH_CLK 17 /* Primary MDDI host clock */ +#define SDAC_CLK 18 /* Stereo DAC clock */ +#define SDC1_CLK 19 /* Secure Digital Card clocks */ +#define SDC1_PCLK 20 +#define SDC2_CLK 21 +#define SDC2_PCLK 22 +#define SDC3_CLK 23 +#define SDC3_PCLK 24 +#define SDC4_CLK 25 +#define SDC4_PCLK 26 +#define TSIF_CLK 27 /* Transport Stream Interface clocks */ +#define TSIF_REF_CLK 28 +#define TV_DAC_CLK 29 /* TV clocks */ +#define TV_ENC_CLK 30 +#define UART1_CLK 31 /* UART clocks */ +#define UART2_CLK 32 +#define UART3_CLK 33 +#define UART1DM_CLK 34 +#define UART2DM_CLK 35 +#define USB_HS_CLK 36 /* High speed USB core clock */ +#define USB_HS_PCLK 37 /* High speed USB pbus clock */ +#define USB_OTG_CLK 38 /* Full speed USB clock */ +#define VDC_CLK 39 /* Video controller clock */ +#define VFE_CLK 40 /* Camera / Video Front End clock */ +#define VFE_MDC_CLK 41 /* VFE MDDI client clock */ + +enum +{ + VREG_MSMA_ID, + VREG_MSMP_ID, + VREG_MSME1_ID, /* Not supported in Panoramix */ + VREG_MSMC1_ID, /* Not supported in PM6620 */ + VREG_MSMC2_ID, /* Supported in PM7500 only */ + VREG_GP3_ID, /* Supported in PM7500 only */ + VREG_MSME2_ID, /* Supported in PM7500 and Panoramix only */ + VREG_GP4_ID, /* Supported in PM7500 only */ + VREG_GP1_ID, /* Supported in PM7500 only */ + VREG_TCXO_ID, + VREG_PA_ID, + VREG_RFTX_ID, + VREG_RFRX1_ID, + VREG_RFRX2_ID, + VREG_SYNT_ID, + VREG_WLAN_ID, + VREG_USB_ID, + VREG_BOOST_ID, + VREG_MMC_ID, + VREG_RUIM_ID, + VREG_MSMC0_ID, /* Supported in PM6610 only */ + VREG_GP2_ID, /* Supported in PM7500 only */ + VREG_GP5_ID, /* Supported in PM7500 only */ + VREG_GP6_ID, /* Supported in PM7500 only */ + VREG_RF_ID, + VREG_RF_VCO_ID, + VREG_MPLL_ID, + VREG_S2_ID, + VREG_S3_ID, + VREG_RFUBM_ID, + VREG_NCP_ID, +}; + +int clock_enable(unsigned id); +int clock_disable(unsigned id); +int clock_set_rate(unsigned id, unsigned hz); +int clock_get_rate(unsigned id); + +int vreg_enable(unsigned id); +int vreg_disable(unsigned id); +int vreg_set_level(unsigned id, unsigned mv); + +void reboot(void); + +#endif diff --git a/include/msm7k/uart.h b/include/msm7k/uart.h new file mode 100644 index 0000000..cbcd960 --- /dev/null +++ b/include/msm7k/uart.h @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_UART_H +#define __ASM_ARCH_MSM7200_UART_H + +#define MSM_UART1_BASE 0xA9A00000 +#define MSM_UART2_BASE 0xA9B00000 +#define MSM_UART3_BASE 0xA9C00000 + +#define UART_MR1 0x0000 + +#define UART_MR1_AUTO_RFR_LEVEL0(n) (((n) & 0x3f) << 8) +#define UART_MR1_RX_RDY_CTL (1 << 7) +#define UART_MR1_CTS_CTL (1 << 6) +#define UART_MR1_AUTO_RFR_LEVEL1(n) ((n) & 0x3f) + +#define UART_MR2 0x0004 +#define UART_MR2_ERROR_MODE (1 << 6) +#define UART_MR2_BITS_PER_CHAR_5 (0 << 4) +#define UART_MR2_BITS_PER_CHAR_6 (1 << 4) +#define UART_MR2_BITS_PER_CHAR_7 (2 << 4) +#define UART_MR2_BITS_PER_CHAR_8 (3 << 4) +#define UART_MR2_STOP_BIT_LEN_0563 (0 << 2) +#define UART_MR2_STOP_BIT_LEN_1000 (1 << 2) +#define UART_MR2_STOP_BIT_LEN_1563 (2 << 2) +#define UART_MR2_STOP_BIT_LEN_2000 (3 << 2) +#define UART_MR2_PARITY_MODE_NONE (0) +#define UART_MR2_PARITY_MODE_ODD (1) +#define UART_MR2_PARITY_MODE_EVEN (2) +#define UART_MR2_PARITY_MODE_SPACE (3) + +#define UART_CSR 0x0008 +#define UART_CSR_115200 0xFF +#define UART_CSR_57600 0xEE +#define UART_CSR_38400 0xDD +#define UART_CSR_19200 0xBB + +#define UART_TF 0x000C + +#define UART_CR 0x0010 +#define UART_CR_CMD_NULL (0 << 4) +#define UART_CR_CMD_RESET_RX (1 << 4) +#define UART_CR_CMD_RESET_TX (2 << 4) +#define UART_CR_CMD_RESET_ERR (3 << 4) +#define UART_CR_CMD_RESET_BCI (4 << 4) +#define UART_CR_CMD_START_BREAK (5 << 4) +#define UART_CR_CMD_STOP_BREAK (6 << 4) +#define UART_CR_CMD_RESET_CTS_N (7 << 4) +#define UART_CR_CMD_PACKET_MODE (9 << 4) +#define UART_CR_CMD_MODE_RESET (12<< 4) +#define UART_CR_CMD_SET_RFR_N (13<< 4) +#define UART_CR_CMD_RESET_RFR_ND (14<< 4) +#define UART_CR_TX_DISABLE (1 << 3) +#define UART_CR_TX_ENABLE (1 << 3) +#define UART_CR_RX_DISABLE (1 << 3) +#define UART_CR_RX_ENABLE (1 << 3) + +#define UART_IMR 0x0014 +#define UART_IMR_RXLEV (1 << 4) +#define UART_IMR_TXLEV (1 << 0) + +#define UART_IPR 0x0018 +#define UART_TFWR 0x001C +#define UART_RFWR 0x0020 +#define UART_HCR 0x0024 + +#define UART_MREG 0x0028 +#define UART_NREG 0x002C +#define UART_DREG 0x0030 +#define UART_MNDREG 0x0034 +#define UART_IRDA 0x0038 +#define UART_MISR_MODE 0x0040 +#define UART_MISR_RESET 0x0044 +#define UART_MISR_EXPORT 0x0048 +#define UART_MISR_VAL 0x004C +#define UART_TEST_CTRL 0x0050 + +#define UART_SR 0x0008 +#define UART_SR_HUNT_CHAR (1 << 7) +#define UART_SR_RX_BREAK (1 << 6) +#define UART_SR_PAR_FRAME_ERR (1 << 5) +#define UART_SR_OVERRUN (1 << 4) +#define UART_SR_TX_EMPTY (1 << 3) +#define UART_SR_TX_READY (1 << 2) +#define UART_SR_RX_FULL (1 << 1) +#define UART_SR_RX_READY (1 << 0) + +#define UART_RF 0x000C +#define UART_MISR 0x0010 +#define UART_ISR 0x0014 + + +#endif diff --git a/include/msm7k/vic.h b/include/msm7k/vic.h new file mode 100644 index 0000000..46f3adf --- /dev/null +++ b/include/msm7k/vic.h @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2008, 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. + * + * 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. + */ + +#ifndef __ASM_ARCH_MSM7200_VIC_H +#define __ASM_ARCH_MSM7200_VIC_H + +#define MSM_VIC_BASE 0xC0000000 + +#define VIC_REG(off) (MSM_VIC_BASE + (off)) + +/* See 80-VE113-1 A, pp 218-228 */ + +#define VIC_IRQ_STATUS0 VIC_REG(0x0000) +#define VIC_IRQ_STATUS1 VIC_REG(0x0004) +#define VIC_FIQ_STATUS0 VIC_REG(0x0008) +#define VIC_FIQ_STATUS1 VIC_REG(0x000C) +#define VIC_RAW_STATUS0 VIC_REG(0x0010) +#define VIC_RAW_STATUS1 VIC_REG(0x0014) +#define VIC_INT_CLEAR0 VIC_REG(0x0018) +#define VIC_INT_CLEAR1 VIC_REG(0x001C) +#define VIC_INT_SELECT0 VIC_REG(0x0020) /* 1: FIQ, 0: IRQ */ +#define VIC_INT_SELECT1 VIC_REG(0x0024) /* 1: FIQ, 0: IRQ */ +#define VIC_INT_EN0 VIC_REG(0x0028) +#define VIC_INT_EN1 VIC_REG(0x002C) +#define VIC_INT_ENCLEAR0 VIC_REG(0x0040) +#define VIC_INT_ENCLEAR1 VIC_REG(0x0044) +#define VIC_SOFTINT0 VIC_REG(0x0050) +#define VIC_SOFTINT1 VIC_REG(0x0054) +#define VIC_INT_MASTEREN VIC_REG(0x0060) /* 1: IRQ, 2: FIQ */ +#define VIC_PROTECTION VIC_REG(0x0064) /* 1: ENABLE */ +#define VIC_CONFIG VIC_REG(0x0068) /* 1: USE ARM1136 VIC */ +#define VIC_INT_TYPE0 VIC_REG(0x0070) /* 1: EDGE, 0: LEVEL */ +#define VIC_INT_TYPE1 VIC_REG(0x0074) /* 1: EDGE, 0: LEVEL */ +#define VIC_IRQ_VEC_RD VIC_REG(0x0F00) /* pending int # */ +#define VIC_IRQ_VEC_PEND_RD VIC_REG(0x0F20) /* pending vector addr */ + +#define VIC_VECTADDR(n) VIC_REG(0x0100+((n) * 4)) +#define VIC_VECTPRIORITY(n) VIC_REG(0x0200+((n) * 4)) + +#endif |