summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/common.h15
-rw-r--r--include/configs/omap3logic.h633
-rw-r--r--include/environment.h3
-rw-r--r--include/jffs2/load_kernel.h2
-rw-r--r--include/lcd.h38
-rw-r--r--include/linux/bch.h79
-rw-r--r--include/linux/mtd/compat.h10
-rw-r--r--include/linux/mtd/mtd.h4
-rw-r--r--include/linux/mtd/nand.h32
-rw-r--r--include/linux/mtd/nand_bch.h72
-rw-r--r--include/mtd_parts.h35
-rw-r--r--include/nand.h4
-rw-r--r--include/twl4030.h87
13 files changed, 976 insertions, 38 deletions
diff --git a/include/common.h b/include/common.h
index 1e21b7a3d5c..8b32431b568 100644
--- a/include/common.h
+++ b/include/common.h
@@ -307,6 +307,13 @@ void pciinfo (int, int);
int misc_init_f (void);
int misc_init_r (void);
+/* Environment/nand support functions */
+extern void nand_setup_default_ecc_method(void);
+extern void nand_switch_ecc_default(int *ecc_method);
+extern void nand_switch_ecc_method(int ecc_method);
+extern int setenv_reserved_name(const char *name);
+extern void touchup_env(void);
+
/* common/exports.c */
void jumptable_init(void);
@@ -724,6 +731,14 @@ int pcmcia_init (void);
* Board-specific Platform code can reimplement show_boot_progress () if needed
*/
void show_boot_progress(int val);
+#ifdef CONFIG_BOARD_LCD_SETMEM
+ulong board_lcd_setmem (ulong addr);
+#endif
+
+#ifdef CONFIG_LCD_PERCENT
+extern void lcd_percent_init(int total_size);
+extern void lcd_percent_update(int size);
+#endif
/* Multicore arch functions */
#ifdef CONFIG_MP
diff --git a/include/configs/omap3logic.h b/include/configs/omap3logic.h
new file mode 100644
index 00000000000..1aaf2920893
--- /dev/null
+++ b/include/configs/omap3logic.h
@@ -0,0 +1,633 @@
+/*
+ * (C) Copyright 2006-2008
+ * Texas Instruments.
+ * Author :
+ * Manikandan Pillai <mani.pillai@ti.com>
+ * Derived from Beagle Board and 3430 SDP code by
+ * Richard Woodruff <r-woodruff2@ti.com>
+ * Syed Mohammed Khasim <khasim@ti.com>
+ *
+ * Manikandan Pillai <mani.pillai@ti.com>
+ *
+ * Configuration settings for the TI OMAP3 EVM board.
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __CONFIG_H
+#define __CONFIG_H
+
+/*
+ * High Level Configuration Options
+ */
+#define CONFIG_ARMV7 1 /* This is an ARM V7 CPU core */
+#define CONFIG_OMAP 1 /* in a TI OMAP core */
+#define CONFIG_OMAP34XX 1 /* which is a 34XX */
+#define CONFIG_OMAP3430 1 /* which is in a 3430 */
+#define CONFIG_OMAP3_LOGIC 1 /* working with Logic OMAP boards */
+
+/* Define following to enable new product ID code. */
+#define CONFIG_OMAP3_LOGIC_USE_NEW_PRODUCT_ID 1
+
+#define CONFIG_SDRC /* The chip has SDRC controller */
+
+#include <asm/arch/cpu.h> /* get chip and board defs */
+#include <asm/arch/omap3.h>
+
+/*
+ * Display CPU and Board information
+ */
+#define CONFIG_DISPLAY_CPUINFO 1
+#define CONFIG_DISPLAY_BOARDINFO 1
+
+/* Clock Defines */
+#define V_OSCK 26000000 /* Clock output from T2 */
+#define V_SCLK (V_OSCK >> 1)
+
+#undef CONFIG_USE_IRQ /* no support for IRQs */
+#define CONFIG_MISC_INIT_R
+
+#define CONFIG_CMDLINE_TAG 1 /* enable passing of ATAGs */
+#define CONFIG_SETUP_MEMORY_TAGS 1
+#define CONFIG_INITRD_TAG 1
+#define CONFIG_REVISION_TAG 1
+
+#define CONFIG_CMDLINE_EDITING 1 /* cmd line edit/history */
+#define CONFIG_ZERO_BOOTDELAY_CHECK 1 /* check keypress with zero bootdelay */
+
+/*
+ * Size of malloc() pool
+ */
+#define CONFIG_ENV_SIZE (128 << 10) /* 128 KiB */
+ /* Sector */
+#define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + (6 << 20))
+
+/*
+ * Add GDB information (section starts) into bdinfo; used in gdb
+ * "add-symbol-file" to specify start of .data, .bss, .rodata sections
+ */
+#define CONFIG_GDB_SECTION_STARTS
+
+/*
+ * Hardware drivers
+ */
+
+/*
+ * NS16550 Configuration
+ */
+#define V_NS16550_CLK 48000000 /* 48MHz (APLL96/2) */
+
+#define CONFIG_SYS_NS16550
+#define CONFIG_SYS_NS16550_SERIAL
+#define CONFIG_SYS_NS16550_REG_SIZE (-4)
+#define CONFIG_SYS_NS16550_CLK V_NS16550_CLK
+
+/*
+ * select serial console configuration
+ */
+#define CONFIG_CONS_INDEX 1
+#define CONFIG_SYS_NS16550_COM1 OMAP34XX_UART1
+#define CONFIG_SERIAL1 1 /* UART1 on OMAP3 EVMOMAP Logic boards */
+
+/* allow to overwrite serial and ethaddr */
+#define CONFIG_ENV_OVERWRITE
+/* But don't allow overwriting "defaultecc" */
+#define CONFIG_CHECK_SETENV
+
+#define CONFIG_BAUDRATE 115200
+#define CONFIG_SYS_BAUDRATE_TABLE {4800, 9600, 19200, 38400, 57600,\
+ 115200}
+#define CONFIG_MMC 1
+#define CONFIG_OMAP3_MMC 1
+#define CONFIG_DOS_PARTITION 1
+
+/* DDR - I use Micron DDR */
+#define CONFIG_OMAP3_MICRON_DDR 1
+
+/* USB
+ * Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
+ * Enable CONFIG_MUSB_UDD for Device functionalities.
+ */
+#define CONFIG_USB_OMAP3 1
+#define CONFIG_MUSB_HCD 1
+/* #define CONFIG_MUSB_UDC 1 */
+
+#ifdef CONFIG_USB_OMAP3
+
+#ifdef CONFIG_MUSB_HCD
+#define CONFIG_CMD_USB
+
+#define CONFIG_USB_STORAGE
+#define CONGIG_CMD_STORAGE
+#define CONFIG_CMD_FAT
+
+#ifdef CONFIG_USB_KEYBOARD
+#define CONFIG_SYS_USB_EVENT_POLL
+// #define CONFIG_PREBOOT "usb start"
+#endif /* CONFIG_USB_KEYBOARD */
+
+#endif /* CONFIG_MUSB_HCD */
+
+#ifdef CONFIG_MUSB_UDC
+/* USB device configuration */
+#define CONFIG_USB_DEVICE 1
+#define CONFIG_USB_TTY 1
+#define CONFIG_SYS_CONSOLE_IS_IN_ENV 1
+/* Change these to suit your needs */
+#define CONFIG_USBD_VENDORID 0x0451
+#define CONFIG_USBD_PRODUCTID 0x5678
+#define CONFIG_USBD_MANUFACTURER "Texas Instruments"
+#define CONFIG_USBD_PRODUCT_NAME "EVM"
+#endif /* CONFIG_MUSB_UDC */
+
+#endif /* CONFIG_USB_OMAP3 */
+
+/* commands to include */
+#include <config_cmd_default.h>
+
+#define CONFIG_CMD_EXT2 /* EXT2 Support */
+#define CONFIG_CMD_FAT /* FAT support */
+#define CONFIG_CMD_JFFS2 /* JFFS2 Support */
+#define CONFIG_CMD_NAND_YAFFS /* YAFFS NAND Support */
+// #define CONFIG_YAFFS2 /* YAFFS2 Support */
+#define CONFIG_YAFFS2_NEW /* Newer YAFFS2 Support */
+
+#define CONFIG_CMD_I2C /* I2C serial bus support */
+#define CONFIG_CMD_MMC /* MMC support */
+#define CONFIG_CMD_NAND /* NAND support */
+#define CONFIG_MTD_DEVICE /* needed for MTD mtdparts support */
+#define CONFIG_CMD_MTDPARTS /* MTD partition support */
+#define MTDIDS_DEFAULT "nand0=omap2-nand.0"
+#define MTDPARTS_DEFAULT "mtdparts=omap2-nand.0:512k(x-loader),"\
+ "1664k(u-boot),384k(u-boot-env),"\
+ "5m(kernel),20m(ramdisk),-(fs)"
+#define CONFIG_NAND_SET_DEFAULT /* Set default NAND access method */
+#define CONFIG_NAND_MULTIPLE_ECC /* NAND has multiple ECC methods */
+#define CONFIG_TOUCHUP_ENV /* Set board-specific environment vars */
+#define CONFIG_CMD_NAND_LOCK_UNLOCK /* nand (un)lock commands */
+#define CONFIG_CMD_DHCP
+#define CONFIG_CMD_PING
+#define CONFIG_CMD_CACHE /* Cache control */
+#define CONFIG_CMD_TIME /* time command */
+
+#define CONFIG_L2_OFF 1 /* Keep L2 Cache Disabled */
+
+#define BOARD_LATE_INIT
+
+#define CONFIG_CMD_FLASH /* flinfo, erase, protect */
+#undef CONFIG_CMD_FPGA /* FPGA configuration Support */
+#undef CONFIG_CMD_IMI /* iminfo */
+#undef CONFIG_CMD_IMLS /* List all found images */
+
+#define CONFIG_CMD_GPMC_CONFIG /* gpmc_config */
+#define CONFIG_CMD_MUX_CONFIG /* mux_config */
+#define CONFIG_CMD_SDRC_CONFIG /* sdrc_config */
+
+#define CONFIG_HARD_I2C 1
+#define CONFIG_SYS_I2C_SPEED 100000
+#define CONFIG_SYS_I2C_SLAVE 1
+#define CONFIG_SYS_I2C_BUS 0
+#define CONFIG_SYS_I2C_BUS_SELECT 1
+#define CONFIG_DRIVER_OMAP34XX_I2C 1
+#define CONFIG_I2C_MULTI_BUS 1
+
+#define CONFIG_MTD_DEBUG 1
+#define CONFIG_MTD_DEBUG_VERBOSE -1
+#define CONFIG_MTD_SKIP_BBTSCAN 1 /* Skip NAND bad block scan */
+#define CONFIG_TOOL_SIGNGP 1
+
+/*
+ * TWL4030
+ */
+#define CONFIG_TWL4030_POWER 1
+#define CONFIG_TWL4030_GPIO 1
+#define CONFIG_TWL4030_PWM 1
+#define CONFIG_TWL4030_CHARGING 1
+
+/* Charge the batter unless $disablecharging == "yes" */
+#define CONFIG_ENABLE_TWL4030_CHARGING 1
+
+/*
+ * Board NAND Info.
+ */
+#define CONFIG_SYS_NAND_ADDR NAND_BASE /* physical address */
+ /* to access nand */
+#define CONFIG_SYS_NAND_BASE NAND_BASE /* physical address */
+ /* to access */
+ /* nand at CS0 */
+
+#define CONFIG_SYS_MAX_NAND_DEVICE 1 /* Max number of */
+ /* NAND devices */
+#define CONFIG_JFFS2_NAND
+/* nand device jffs2 lives on */
+#define CONFIG_JFFS2_DEV "nand0"
+/* start of jffs2 partition */
+#define CONFIG_JFFS2_PART_OFFSET 0x680000
+#define CONFIG_JFFS2_PART_SIZE 0xf980000 /* sz of jffs2 part */
+
+/* Environment information */
+#define CONFIG_BOOTDELAY 3
+
+#define CONFIG_BOOTFILE uImage
+
+#define CONFIG_PREBOOT \
+ "echo ; " \
+ "echo =================================== NOTICE ===================================;" \
+ "echo \"The U-Boot environment was not found. If the display is not set properly \";"\
+ "echo \"linux will not have video support.\";" \
+ "echo ; " \
+ "echo \"Valid display options are:\";" \
+ "echo \" 2 == LQ121S1DG31 TFT SVGA (12.1) Sharp\";" \
+ "echo \" 3 == LQ036Q1DA01 TFT QVGA (3.6) Sharp w/ASIC\";" \
+ "echo \" 5 == LQ064D343 TFT VGA (6.4) Sharp\";" \
+ "echo \" 7 == LQ10D368 TFT VGA (10.4) Sharp\";" \
+ "echo \" 15 == LQ043T1DG01 TFT WQVGA (4.3) Sharp (DEFAULT)\";" \
+ "echo \" vga[-16 OR -24] LCD VGA 640x480\";" \
+ "echo \" svga[-16 OR -24] LCD SVGA 800x600\";" \
+ "echo \" xga[-16 OR -24] LCD XGA 1024x768\";" \
+ "echo \" 720p[-16 OR -24] LCD 720P 1280x720\";" \
+ "echo \" sxga[-16 OR -24] LCD SXGA 1280x1024\";" \
+ "echo \" uxga[-16 OR -24] LCD UXGA 1600x1200\";" \
+ "echo ; " \
+ "echo \"Default `display` environment variable is now being set to: 15\";" \
+ "setenv display 15;" \
+ "setenv preboot;" \
+ "echo ; " \
+ "echo \"At the U-Boot prompt type commands: `setenv display <num>`, then type\";" \
+ "echo \"`saveenv` to save the environment to NAND flash. This will avoid seeing\";" \
+ "echo \"this notice on future boots\" ; " \
+ "echo =================================== NOTICE ===================================;" \
+ "echo ; "
+
+#ifdef CONFIG_USB_TTY
+#define OMAP3LOGIC_USBTTY "usbtty=cdc_acm\0"
+#else
+#define OMAP3LOGIC_USBTTY
+#endif
+
+#define CONFIG_BOOTCOMMAND \
+ "run autoboot"
+
+#define CONFIG_MMC_BOOTSCRIPT_NAME \
+ "boot.scr"
+
+/*****************************************************************************/
+/* Default Environment */
+/* */
+/* When reconfiguring the boot environment, be sure to set the environment */
+/* variables as indicated below for a successful boot. */
+/* */
+/* - $kernel_location */
+/* Must always be set. Values can be ram, nand, mmc, or tftp. */
+/* */
+/* - $rootfs_location */
+/* Must always be set. Values can be ram, tftp, /dev, nfs, mmc, or nand. */
+/* */
+/* - $rootfs_type */
+/* Must always be set. Values can be ramdisk, jffs, yaffs, ext3, or nfs. */
+/* */
+/* - $loadaddr */
+/* Must always be set. */
+/* */
+/* - If booting from /dev based file system, then $rootfs_device must be */
+/* set. */
+/* - If booting from a ramdisk image, then $ramdisksize, and $ramdiskaddr */
+/* must be set. */
+/* - If booting from an nfs location, then $serverip, $nfsrootpath, and */
+/* $nfsoptions must be set. */
+/* - If booting from nand, $ramdisk_nand_offset, $ramdisk_nand_size, */
+/* $kernel_nand_offset, and $kernel_nand_size must be set. */
+/* - If booting from a file system, $ramdiskimage, and $kernelimage must be */
+/* set. */
+/* - Optionally, a boot script named "boot.scr" can be placed in SD to */
+/* override any other boot scripts. */
+/*****************************************************************************/
+#define CONFIG_EXTRA_ENV_SETTINGS \
+ OMAP3LOGIC_USBTTY \
+ "bootargs=\0" \
+ "otherbootargs=ignore_loglevel early_printk no_console_suspend \0" \
+ "consoledevice=ttyO0\0" \
+ "setconsole=setenv console ${consoledevice},${baudrate}n8\0" \
+ "mtdids=" MTDIDS_DEFAULT "\0" \
+ "mtdparts=" MTDPARTS_DEFAULT "\0" \
+ "disablecharging=no\0" \
+ "mmc_bootscript_addr=0x80FF0000\0" \
+ "disablecharging no\0" \
+ "display=15\0" \
+ "loadaddr=0x81000000\0" \
+ "kernel_location=mmc \0" \
+ "rootfs_location=mmc \0" \
+ "rootfs_type=ramdisk \0" \
+ "rootfs_device=/dev/mtdblock4 \0" \
+ "ramdisksize=64000\0" \
+ "ramdiskaddr=0x82000000\0" \
+ "ramdiskimage=rootfs.ext2.gz.uboot\0" \
+ "ramdisk_nand_offset=0x00680000\0" \
+ "ramdisk_nand_size=0x00d40000\0" \
+ "kernel_nand_offset=0x00280000 \0" \
+ "kernel_nand_size=0x00400000 \0" \
+ "kernelimage=uImage \0" \
+ "serverip=192.168.3.5\0" \
+ "nfsrootpath=/opt/nfs-exports/ltib-omap\0" \
+ "nfsoptions=,wsize=1500,rsize=1500\0" \
+ "rotation=0\0" \
+ "autoboot=echo \"\n== Checking mmc1 for alternate boot script " CONFIG_MMC_BOOTSCRIPT_NAME " ==\"; " \
+ "if mmc init; then " \
+ "if run loadbootscript; then " \
+ "echo \"\"; " \
+ "echo \"== Found script on mmc 1, starting ==\"; " \
+ "run bootscript; " \
+ "else " \
+ "echo \"\"; " \
+ "echo \"== Script not found on mmc 1, proceeding with defaultboot ==\"; " \
+ "run defaultboot;" \
+ "fi; " \
+ "else run defaultboot; fi\0" \
+ "loadbootscript=fatload mmc 1 $mmc_bootscript_addr " CONFIG_MMC_BOOTSCRIPT_NAME "\0" \
+ "bootscript=source ${mmc_bootscript_addr}\0" \
+ "vrfb_arg=if itest ${rotation} -ne 0; then " \
+ "setenv bootargs ${bootargs} omapfb.vrfb=y omapfb.rotate=${rotation}; " \
+ "fi\0" \
+ "dump_bootargs=echo \"\"; echo \"== Kernel bootargs ==\"; echo $bootargs; echo \"\"; \0" \
+ "dump_boot_sources=echo \"kernel_location: $kernel_location, " \
+ "rootfs_location: $rootfs_location, " \
+ "rootfs_type: $rootfs_type\"; " \
+ "echo \"\"; " \
+ "\0" \
+ "load_kernel=if test $kernel_location = 'ram'; then " \
+ "echo \"== kernel located at $loadaddr ==\"; " \
+ "echo \"\"; " \
+ "setenv bootm_arg1 ${loadaddr};" \
+ "else if test $kernel_location = 'nand'; then " \
+ "echo \"== Loading kernel from nand to $loadaddr ==\"; " \
+ "nand read.i $loadaddr $kernel_nand_offset $kernel_nand_size; " \
+ "echo \"\"; " \
+ "setenv bootm_arg1 ${loadaddr};" \
+ "else if test $kernel_location = 'mmc'; then " \
+ "echo \"== Loading kernel file $kernelimage to $loadaddr ==\"; " \
+ "mmc init; " \
+ "fatload mmc 1 $loadaddr $kernelimage; " \
+ "echo \"\"; " \
+ "setenv bootm_arg1 ${loadaddr};" \
+ "else if test $kernel_location = 'tftp'; then " \
+ "echo \"== Loading kernel file $kernelimage to $loadaddr ==\"; " \
+ "tftpboot $loadaddr $kernelimage; " \
+ "echo \"\"; " \
+ "setenv bootm_arg1 ${loadaddr};" \
+ "else "\
+ "echo \"== kernel_location must be set to ram, nand, mmc, or tftp!! ==\"; " \
+ "echo \"\"; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi " \
+ "\0" \
+ "load_rootfs=if test $rootfs_location = 'ram'; then " \
+ "echo \"== rootfs located at $ramdiskaddr ==\"; " \
+ "echo \"\"; " \
+ "setenv bootm_arg2 ${ramdiskaddr}; " \
+ "else if test $rootfs_location = 'tftp'; then " \
+ "echo \"== Loading rootfs file $ramdiskimage to $ramdiskaddr ==\"; " \
+ "tftpboot $ramdiskaddr $ramdiskimage;" \
+ "echo \"\"; " \
+ "setenv bootm_arg2 ${ramdiskaddr}; " \
+ "else if test $rootfs_location = '/dev'; then " \
+ "echo \"== rootfs located in $rootfs_device ==\"; " \
+ "echo \"\"; " \
+ "setenv bootargs ${bootargs} root=${rootfs_device}; " \
+ "setenv bootm_arg2; " \
+ "else if test $rootfs_location = 'nfs'; then " \
+ "echo \"== rootfs located at $nfs_root_path on server $serverip ==\"; " \
+ "echo \"\"; " \
+ "setenv bootargs ${bootargs} root=/dev/nfs; " \
+ "setenv bootm_arg2; " \
+ "else if test $rootfs_location = 'mmc'; then " \
+ "echo \"== Loading rootfs file $ramdiskimage to $ramdiskaddr ==\"; " \
+ "fatload mmc 1 ${ramdiskaddr} ${ramdiskimage}; "\
+ "setenv bootm_arg2 ${ramdiskaddr}; " \
+ "else if test $rootfs_location = 'nand'; then " \
+ "echo \"== Loading rootfs from nand to $ramdiskaddr ==\"; " \
+ "nand read.i $ramdiskaddr $ramdisk_nand_offset $ramdisk_nand_size; " \
+ "setenv bootm_arg2 ${ramdiskaddr}; " \
+ "else "\
+ "echo \"== rootfs_location must be set to ram, tftp, /dev, nfs, mmc, or nand!! == \"; " \
+ "echo \"\"; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi " \
+ "\0" \
+ "set_rootfs_type=if test $rootfs_type = 'ramdisk'; then " \
+ "setenv bootargs ${bootargs} root=/dev/ram rw ramdisk_size=${ramdisksize}; " \
+ "else if test $rootfs_type = 'jffs'; then " \
+ "setenv bootargs ${bootargs} rw rootfstype=jffs2;" \
+ "else if test $rootfs_type = 'yaffs'; then " \
+ "setenv bootargs ${bootargs} rw rootfstype=yaffs2;" \
+ "else if test $rootfs_type = 'ext3'; then " \
+ "setenv bootargs ${bootargs} rw rootfstype=ext3 rootwait; " \
+ "else if test $rootfs_type = 'nfs'; then " \
+ "setenv bootargs ${bootargs} rw nfsroot=${serverip}:${nfsrootpath}${nfsoptions} ip=dhcp; " \
+ "else "\
+ "echo \"$rootfs_type must be set to ramdisk, jffs, yaffs, ext3, or nfs\"; " \
+ "echo \"\"; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi; " \
+ "fi " \
+ "\0" \
+ "addmtdparts=setenv bootargs ${bootargs} ${mtdparts} \0" \
+ "common_bootargs=" \
+ " setenv bootargs ${bootargs} display=${display} ${otherbootargs}; " \
+ " run addmtdparts; " \
+ " run vrfb_arg; " \
+ " \0" \
+ "dump_run_bootm=" \
+ " echo \"bootm $bootm_arg1 $bootm_arg2\"; " \
+ " echo \"\"; " \
+ " bootm $bootm_arg1 $bootm_arg2\0" \
+ "defaultboot=" \
+ " run dump_boot_sources; " \
+ " run setconsole; setenv bootargs console=${console}; " \
+ " run common_bootargs; " \
+ " run load_kernel; " \
+ " run load_rootfs; " \
+ " run set_rootfs_type; " \
+ " run dump_bootargs; " \
+ " run dump_run_bootm; " \
+ "\0"
+
+
+#define CONFIG_AUTO_COMPLETE 1
+/*
+ * Miscellaneous configurable options
+ */
+#define CONFIG_SYS_LONGHELP /* undef to save memory */
+#define CONFIG_SYS_HUSH_PARSER /* use "hush" command parser */
+#define CONFIG_SYS_PROMPT_HUSH_PS2 "> "
+#define CONFIG_SYS_PROMPT "OMAP Logic # "
+#define CONFIG_SYS_CBSIZE 256 /* Console I/O Buffer Size */
+/* Print Buffer Size */
+#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
+ sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_MAXARGS 64 /* max number of command */
+ /* args */
+/* Boot Argument Buffer Size */
+#define CONFIG_SYS_BARGSIZE (CONFIG_SYS_CBSIZE)
+/* memtest works on */
+#define CONFIG_SYS_MEMTEST_START (OMAP34XX_SDRC_CS0)
+#define CONFIG_SYS_MEMTEST_END (OMAP34XX_SDRC_CS0 + \
+ 0x01F00000) /* 31MB */
+
+#define CONFIG_SYS_LOAD_ADDR (OMAP34XX_SDRC_CS0) /* default load */
+ /* address */
+
+/*
+ * OMAP3 has 12 GP timers, they can be driven by the system clock
+ * (12/13/16.8/19.2/38.4MHz) or by 32KHz clock. We use 13MHz (V_SCLK).
+ * This rate is divided by a local divisor.
+ */
+#define CONFIG_SYS_TIMERBASE OMAP34XX_GPT2
+#define CONFIG_SYS_PTV 2 /* Divisor: 2^(PTV+1) => 8 */
+#define CONFIG_SYS_HZ 1000
+
+/*-----------------------------------------------------------------------
+ * Stack sizes
+ *
+ * The stack sizes are set up in start.S using the settings below
+ */
+#define CONFIG_STACKSIZE (128 << 10) /* regular stack 128 KiB */
+#ifdef CONFIG_USE_IRQ
+#define CONFIG_STACKSIZE_IRQ (4 << 10) /* IRQ stack 4 KiB */
+#define CONFIG_STACKSIZE_FIQ (4 << 10) /* FIQ stack 4 KiB */
+#endif
+
+/*-----------------------------------------------------------------------
+ * Physical Memory Map
+ */
+#define CONFIG_NR_DRAM_BANKS 2 /* CS1 may or may not be populated */
+#define PHYS_SDRAM_1 OMAP34XX_SDRC_CS0
+#define PHYS_SDRAM_1_SIZE (32 << 20) /* at least 32 MiB */
+#define PHYS_SDRAM_2 OMAP34XX_SDRC_CS1
+
+/* SDRAM Bank Allocation method */
+#define SDRC_R_B_C 1
+
+/*-----------------------------------------------------------------------
+ * FLASH and environment organization
+ */
+
+/* variable that's non-zero if flash exists */
+#define CONFIG_SYS_FLASH_PRESENCE omap3logic_flash_exists
+#ifndef __ASSEMBLY__
+extern int omap3logic_flash_exists;
+#endif
+#define CONFIG_SYS_FLASH_BASE 0x10000000 /* FLASH base address */
+#define CONFIG_SYS_FLASH_SIZE 8 /* 8MB */
+#define CONFIG_SYS_MAX_FLASH_SECT (64+8) /* 8MB/128K */
+#define CONFIG_SYS_MAX_FLASH_BANKS 1
+#define CONFIG_SYS_FLASH_USE_BUFFER_WRITE
+#undef CONFIG_SYS_FLASH_CHECKSUM
+#define CONFIG_SYS_FLASH_CFI /* use the Common Flash Interface */
+#define CONFIG_FLASH_CFI_DRIVER /* use the CFI driver */
+
+
+/* **** PISMO SUPPORT *** */
+
+/* Configure the PISMO */
+#define PISMO1_NAND_SIZE GPMC_SIZE_128M
+
+#define CONFIG_SYS_MONITOR_LEN (256 << 10) /* Reserve 2 sectors */
+
+/* Monitor at start of flash */
+#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_FLASH_BASE
+
+#define SMNAND_ENV_OFFSET 0x220000 /* environment starts here */
+
+#if defined(CONFIG_CMD_NAND)
+#define CONFIG_NAND_OMAP_GPMC
+#define CONFIG_MTD_NAND_BCH
+#define CONFIG_MTD_NAND_ECC_BCH
+#define CONFIG_BCH
+#define GPMC_NAND_ECC_LP_x16_LAYOUT 1
+#define CONFIG_ENV_IS_IN_NAND
+#define CONFIG_ENV_OFFSET SMNAND_ENV_OFFSET
+#endif
+
+#define CONFIG_ENV_ADDR CONFIG_ENV_OFFSET
+#define CONFIG_ENV_RANGE (3 * CONFIG_ENV_SIZE)
+
+/*
+ * Support for relocation
+ */
+#define CONFIG_SYS_SDRAM_BASE PHYS_SDRAM_1
+#define CONFIG_SYS_INIT_RAM_ADDR 0x4020f800
+#define CONFIG_SYS_INIT_RAM_SIZE 0x800
+#define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR + \
+ CONFIG_SYS_INIT_RAM_SIZE - \
+ GENERATED_GBL_DATA_SIZE)
+
+/*
+ * Define the board revision statically
+ */
+/* #define CONFIG_STATIC_BOARD_REV OMAP3EVM_BOARD_GEN_2 */
+
+/*----------------------------------------------------------------------------
+ * SMSC9115 Ethernet from SMSC9118 family
+ *----------------------------------------------------------------------------
+ */
+#if defined(CONFIG_CMD_NET)
+
+#define CONFIG_NET_MULTI
+#define CONFIG_SMC911X
+#define CONFIG_SMC911X_16_BIT
+#define CONFIG_SMC911X_BASE 0x08000000
+
+#endif /* (CONFIG_CMD_NET) */
+
+/*
+ * BOOTP fields
+ */
+
+#define CONFIG_BOOTP_SUBNETMASK 0x00000001
+#define CONFIG_BOOTP_GATEWAY 0x00000002
+#define CONFIG_BOOTP_HOSTNAME 0x00000004
+#define CONFIG_BOOTP_BOOTPATH 0x00000010
+
+/* Add graphics support */
+#define CONFIG_VIDEO_OMAP3
+#define CONFIG_LCD
+#define LCD_BPP LCD_COLOR16
+#define CONFIG_CMD_BMP
+#define CONFIG_BMP_16BPP
+#define CONFIG_VIDEO_BMP_GZIP
+#define CONFIG_SYS_VIDEO_LOGO_MAX_SIZE (2 << 20)
+#define CONFIG_SPLASH_SCREEN
+#define CONFIG_SPLASH_SCREEN_ALIGN 1
+#define CONFIG_SYS_WHITE_ON_BLACK /* White characters on black background */
+
+/* Have board_set_lcdmem() function */
+#define CONFIG_BOARD_LCD_SETMEM
+
+/* Have percent ouptut function for LCD */
+#define CONFIG_LCD_PERCENT
+
+#endif /* __CONFIG_H */
diff --git a/include/environment.h b/include/environment.h
index 53d92df1f29..5180320b62a 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -172,6 +172,9 @@ void set_default_env(const char *s);
/* Import from binary representation into hash table */
int env_import(const char *buf, int check);
+/* Check a read environment to see if its valid */
+int env_check_valid(const char *buf);
+
#endif
#endif /* _ENVIRONMENT_H_ */
diff --git a/include/jffs2/load_kernel.h b/include/jffs2/load_kernel.h
index 906eb3d3cdb..7d549d957fe 100644
--- a/include/jffs2/load_kernel.h
+++ b/include/jffs2/load_kernel.h
@@ -77,7 +77,7 @@ struct mtdids {
/* common/cmd_jffs2.c */
extern int mtdparts_init(void);
extern int find_dev_and_part(const char *id, struct mtd_device **dev,
- u8 *part_num, struct part_info **part);
+ u8 *part_num, struct part_info **part, int quiet);
extern struct mtd_device *device_find(u8 type, u8 num);
#endif /* load_kernel_h */
diff --git a/include/lcd.h b/include/lcd.h
index 0e098d925ec..f01cba71810 100644
--- a/include/lcd.h
+++ b/include/lcd.h
@@ -34,6 +34,7 @@ extern char lcd_is_enabled;
extern int lcd_line_length;
extern int lcd_color_fg;
extern int lcd_color_bg;
+extern int console_color_black, console_color_white;
/*
* Frame buffer memory information
@@ -235,6 +236,7 @@ void lcd_show_board_info(void);
#define LCD_COLOR4 2
#define LCD_COLOR8 3
#define LCD_COLOR16 4
+#define LCD_COLOR24 5
/*----------------------------------------------------------------------*/
#if defined(CONFIG_LCD_INFO_BELOW_LOGO)
@@ -261,42 +263,6 @@ void lcd_show_board_info(void);
#define NCOLORS(bit_code) (1 << NBITS(bit_code))
/************************************************************************/
-/* ** CONSOLE CONSTANTS */
-/************************************************************************/
-#if LCD_BPP == LCD_MONOCHROME
-
-/*
- * Simple black/white definitions
- */
-# define CONSOLE_COLOR_BLACK 0
-# define CONSOLE_COLOR_WHITE 1 /* Must remain last / highest */
-
-#elif LCD_BPP == LCD_COLOR8
-
-/*
- * 8bpp color definitions
- */
-# define CONSOLE_COLOR_BLACK 0
-# define CONSOLE_COLOR_RED 1
-# define CONSOLE_COLOR_GREEN 2
-# define CONSOLE_COLOR_YELLOW 3
-# define CONSOLE_COLOR_BLUE 4
-# define CONSOLE_COLOR_MAGENTA 5
-# define CONSOLE_COLOR_CYAN 6
-# define CONSOLE_COLOR_GREY 14
-# define CONSOLE_COLOR_WHITE 15 /* Must remain last / highest */
-
-#else
-
-/*
- * 16bpp color definitions
- */
-# define CONSOLE_COLOR_BLACK 0x0000
-# define CONSOLE_COLOR_WHITE 0xffff /* Must remain last / highest */
-
-#endif /* color definitions */
-
-/************************************************************************/
#ifndef PAGE_SIZE
# define PAGE_SIZE 4096
#endif
diff --git a/include/linux/bch.h b/include/linux/bch.h
new file mode 100644
index 00000000000..295b4ef153b
--- /dev/null
+++ b/include/linux/bch.h
@@ -0,0 +1,79 @@
+/*
+ * Generic binary BCH encoding/decoding library
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ * more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * this program; if not, write to the Free Software Foundation, Inc., 51
+ * Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Copyright © 2011 Parrot S.A.
+ *
+ * Author: Ivan Djelic <ivan.djelic@parrot.com>
+ *
+ * Description:
+ *
+ * This library provides runtime configurable encoding/decoding of binary
+ * Bose-Chaudhuri-Hocquenghem (BCH) codes.
+*/
+#ifndef _BCH_H
+#define _BCH_H
+
+#include <linux/types.h>
+
+/**
+ * struct bch_control - BCH control structure
+ * @m: Galois field order
+ * @n: maximum codeword size in bits (= 2^m-1)
+ * @t: error correction capability in bits
+ * @ecc_bits: ecc exact size in bits, i.e. generator polynomial degree (<=m*t)
+ * @ecc_bytes: ecc max size (m*t bits) in bytes
+ * @a_pow_tab: Galois field GF(2^m) exponentiation lookup table
+ * @a_log_tab: Galois field GF(2^m) log lookup table
+ * @mod8_tab: remainder generator polynomial lookup tables
+ * @ecc_buf: ecc parity words buffer
+ * @ecc_buf2: ecc parity words buffer
+ * @xi_tab: GF(2^m) base for solving degree 2 polynomial roots
+ * @syn: syndrome buffer
+ * @cache: log-based polynomial representation buffer
+ * @elp: error locator polynomial
+ * @poly_2t: temporary polynomials of degree 2t
+ */
+struct bch_control {
+ unsigned int m;
+ unsigned int n;
+ unsigned int t;
+ unsigned int ecc_bits;
+ unsigned int ecc_bytes;
+/* private: */
+ uint16_t *a_pow_tab;
+ uint16_t *a_log_tab;
+ uint32_t *mod8_tab;
+ uint32_t *ecc_buf;
+ uint32_t *ecc_buf2;
+ unsigned int *xi_tab;
+ unsigned int *syn;
+ int *cache;
+ struct gf_poly *elp;
+ struct gf_poly *poly_2t[4];
+};
+
+struct bch_control *init_bch(int m, int t, unsigned int prim_poly);
+
+void free_bch(struct bch_control *bch);
+
+void encode_bch(struct bch_control *bch, const uint8_t *data,
+ unsigned int len, uint8_t *ecc);
+
+int decode_bch(struct bch_control *bch, const uint8_t *data, unsigned int len,
+ const uint8_t *recv_ecc, const uint8_t *calc_ecc,
+ const unsigned int *syn, unsigned int *errloc);
+
+#endif /* _BCH_H */
diff --git a/include/linux/mtd/compat.h b/include/linux/mtd/compat.h
index 39c693f7a8c..8727a36707d 100644
--- a/include/linux/mtd/compat.h
+++ b/include/linux/mtd/compat.h
@@ -17,11 +17,21 @@
#define KERN_INFO
#define KERN_DEBUG
+#ifndef kmalloc
#define kmalloc(size, flags) malloc(size)
+#endif
+#ifndef kzalloc
#define kzalloc(size, flags) calloc(size, 1)
+#endif
+#ifndef vmalloc
#define vmalloc(size) malloc(size)
+#endif
+#ifndef kfree
#define kfree(ptr) free(ptr)
+#endif
+#ifndef vfree
#define vfree(ptr) free(ptr)
+#endif
#define DECLARE_WAITQUEUE(...) do { } while (0)
#define add_wait_queue(...) do { } while (0)
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index 3b18d7d6886..74ef50737f8 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -293,11 +293,13 @@ static inline void mtd_erase_callback(struct erase_info *instr)
#define MTD_DEBUG_LEVEL1 (1) /* Audible */
#define MTD_DEBUG_LEVEL2 (2) /* Loud */
#define MTD_DEBUG_LEVEL3 (3) /* Noisy */
+#define MTD_DEBUG_LEVEL4 (4) /* Picky */
#ifdef CONFIG_MTD_DEBUG
+extern int mtd_debug_verbose;
#define MTDDEBUG(n, args...) \
do { \
- if (n <= CONFIG_MTD_DEBUG_VERBOSE) \
+ if (n <= mtd_debug_verbose) \
printk(KERN_INFO args); \
} while(0)
#else /* CONFIG_MTD_DEBUG */
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 987a2ec85d1..d2032b47c50 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -88,6 +88,8 @@ extern void nand_wait_ready(struct mtd_info *mtd);
#define NAND_CMD_READID 0x90
#define NAND_CMD_PARAM 0xec
#define NAND_CMD_ERASE2 0xd0
+#define NAND_CMD_SETFEATURE 0xee
+#define NAND_CMD_GETFEATURE 0xef
#define NAND_CMD_RESET 0xff
/* Extended commands for large page devices */
@@ -95,6 +97,11 @@ extern void nand_wait_ready(struct mtd_info *mtd);
#define NAND_CMD_RNDOUTSTART 0xE0
#define NAND_CMD_CACHEDPROG 0x15
+/* Extended commands for ONFI devices */
+#define NAND_CMD_READ_PARAM 0xec
+#define NAND_CMD_GET_FEATURES 0xee
+#define NAND_CMD_SET_FEATURES 0xef
+
/* Extended commands for AG-AND device */
/*
* Note: the command for NAND_CMD_DEPLETE1 is really 0x00 but
@@ -132,6 +139,9 @@ typedef enum {
NAND_ECC_HW,
NAND_ECC_HW_SYNDROME,
NAND_ECC_HW_OOB_FIRST,
+ NAND_ECC_CHIP, /* ECC hardware in-chip */
+ NAND_ECC_SOFT_BCH, /* Soft BCH ECC engine */
+ NAND_ECC_HW_BCH, /* If NAND uses soft-BCH instead of ECC_CHIP */
} nand_ecc_modes_t;
/*
@@ -308,6 +318,7 @@ struct nand_hw_control {
* @prepad: padding information for syndrome based ecc generators
* @postpad: padding information for syndrome based ecc generators
* @layout: ECC layout control struct pointer
+ * @priv: pointer to private ecc control data
* @hwctl: function to control hardware ecc generator. Must only
* be provided if an hardware ECC is available
* @calculate: function for ecc calculation or readback from ecc hardware
@@ -328,6 +339,7 @@ struct nand_ecc_ctrl {
int prepad;
int postpad;
struct nand_ecclayout *layout;
+ void *priv;
void (*hwctl)(struct mtd_info *mtd, int mode);
int (*calculate)(struct mtd_info *mtd,
const uint8_t *dat,
@@ -438,6 +450,10 @@ struct nand_chip {
void __iomem *IO_ADDR_R;
void __iomem *IO_ADDR_W;
+ uint8_t maf_id, dev_id; /* manufacturer/device identifier */
+ uint8_t has_chip_ecc; /* !0 if chip has intern ECC engine */
+ uint8_t ecc_status; /* status of read w/ECC */
+
uint8_t (*read_byte)(struct mtd_info *mtd);
u16 (*read_word)(struct mtd_info *mtd);
void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
@@ -623,4 +639,20 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd)
return chip->priv;
}
+extern int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
+ uint8_t *buf, int page);
+extern int nand_read_subpage(struct mtd_info *mtd, struct nand_chip *chip,
+ uint32_t data_offs, uint32_t readlen, uint8_t *bufpoi);
+extern void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
+ const uint8_t *buf);
+extern int nand_read_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
+ uint8_t *buf, int page);
+extern void nand_write_page_raw(struct mtd_info *mtd, struct nand_chip *chip,
+ const uint8_t *buf);
+extern int nand_read_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
+ int page, int sndcmd);
+extern int nand_write_oob_std(struct mtd_info *mtd, struct nand_chip *chip,
+ int page);
+
+
#endif /* __LINUX_MTD_NAND_H */
diff --git a/include/linux/mtd/nand_bch.h b/include/linux/mtd/nand_bch.h
new file mode 100644
index 00000000000..74acf536755
--- /dev/null
+++ b/include/linux/mtd/nand_bch.h
@@ -0,0 +1,72 @@
+/*
+ * Copyright © 2011 Ivan Djelic <ivan.djelic@parrot.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This file is the header for the NAND BCH ECC implementation.
+ */
+
+#ifndef __MTD_NAND_BCH_H__
+#define __MTD_NAND_BCH_H__
+
+struct mtd_info;
+struct nand_bch_control;
+
+#if defined(CONFIG_MTD_NAND_ECC_BCH)
+
+static inline int mtd_nand_has_bch(void) { return 1; }
+
+/*
+ * Calculate BCH ecc code
+ */
+int nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+ u_char *ecc_code);
+
+/*
+ * Detect and correct bit errors
+ */
+int nand_bch_correct_data(struct mtd_info *mtd, u_char *dat, u_char *read_ecc,
+ u_char *calc_ecc);
+/*
+ * Initialize BCH encoder/decoder
+ */
+struct nand_bch_control *
+nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
+ unsigned int eccbytes, struct nand_ecclayout **ecclayout);
+/*
+ * Release BCH encoder/decoder resources
+ */
+void nand_bch_free(struct nand_bch_control *nbc);
+
+#else /* !CONFIG_MTD_NAND_ECC_BCH */
+
+static inline int mtd_nand_has_bch(void) { return 0; }
+
+static inline int
+nand_bch_calculate_ecc(struct mtd_info *mtd, const u_char *dat,
+ u_char *ecc_code)
+{
+ return -1;
+}
+
+static inline int
+nand_bch_correct_data(struct mtd_info *mtd, unsigned char *buf,
+ unsigned char *read_ecc, unsigned char *calc_ecc)
+{
+ return -1;
+}
+
+static inline struct nand_bch_control *
+nand_bch_init(struct mtd_info *mtd, unsigned int eccsize,
+ unsigned int eccbytes, struct nand_ecclayout **ecclayout)
+{
+ return NULL;
+}
+
+static inline void nand_bch_free(struct nand_bch_control *nbc) {}
+
+#endif /* CONFIG_MTD_NAND_ECC_BCH */
+
+#endif /* __MTD_NAND_BCH_H__ */
diff --git a/include/mtd_parts.h b/include/mtd_parts.h
new file mode 100644
index 00000000000..87e2882c697
--- /dev/null
+++ b/include/mtd_parts.h
@@ -0,0 +1,35 @@
+/*
+ * (C) Copyright 2011
+ * Logic Product Devleopemnt <www.logicpd.com>
+ * Peter Barada <peter.barada@logicpd.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#ifndef __MTD_PARTS_H__
+#define __MTD_PARTS_H__
+extern int mtd_get_part_priv(const char *partname, int *idx,
+ struct mtd_device **dev, loff_t *off,
+ loff_t *size, void **cookie, void **priv, int quiet);
+
+extern void mtd_set_part_priv(void *cookie, void *priv);
+
+extern int mtd_id_parse(const char *id, const char **ret_id,
+ u8 *dev_type, u8 *dev_num, int quiet);
+extern int mtdparts_init(void);
+#endif
diff --git a/include/nand.h b/include/nand.h
index 7459bd0330a..f7b0a60b8ab 100644
--- a/include/nand.h
+++ b/include/nand.h
@@ -25,6 +25,7 @@
#define _NAND_H_
extern void nand_init(void);
+extern int nand_set_dev(int idx);
#include <linux/mtd/compat.h>
#include <linux/mtd/mtd.h>
@@ -126,6 +127,9 @@ int nand_lock( nand_info_t *meminfo, int tight );
int nand_unlock( nand_info_t *meminfo, ulong start, ulong length );
int nand_get_lock_status(nand_info_t *meminfo, loff_t offset);
+int nand_get_features( nand_info_t *meminfo, uint8_t faddr, uint8_t *features);
+int nand_set_features( nand_info_t *meminfo, uint8_t faddr, uint8_t *features);
+
#ifdef CONFIG_SYS_NAND_SELECT_DEVICE
void board_nand_select_device(struct nand_chip *nand, int chip);
#endif
diff --git a/include/twl4030.h b/include/twl4030.h
index 930c285c26f..6d5bb1553ac 100644
--- a/include/twl4030.h
+++ b/include/twl4030.h
@@ -356,6 +356,22 @@
#define TWL4030_KEYPAD_CTRL_SOFTMODEN (1 << 1)
#define TWL4030_KEYPAD_CTRL_SOFT_NRST (1 << 0)
+/* Main charge */
+#define TWL4030_MAIN_CHARGE_BCIMFKEY 0x85
+#define TWL4030_MAIN_CHARGE_BCIMFEN1 0x86
+#define TWL4030_MAIN_CHARGE_BCIMFTH1 0x8A
+
+#define TWL4030_MAIN_CHARGE_BCIMFKEY_MFKEY1 0x57
+#define TWL4030_MAIN_CHARGE_BCIMFKEY_MFKEY5 0xD2
+#define TWL4030_MAIN_CHARGE_BCIMFEN1_VBATOV1EN (1 << 7)
+#define TWL4030_MAIN_CHARGE_BCIMFTH1_VBATOV1TH_MASK 0x0F
+#define TWL4030_MAIN_CHARGE_BCIMFTH1_VBATOV1TH_2636_mV 0x00
+
+/* INTBR */
+#define TWL4030_INTBR_GPBR1 0x91
+#define TWL4030_INTBR_GPBR1_MADC_HFCLK_EN 0x80
+#define TWL4030_INTBR_GPBR1_DEFAULT_MADC_CLK_EN 0x10
+
/* USB */
#define TWL4030_USB_VENDOR_ID_LO 0x00
#define TWL4030_USB_VENDOR_ID_HI 0x01
@@ -482,6 +498,58 @@
#define TWL4030_USB_PHY_CLK_CTRL_STS 0xFF
/*
+ * GPIO Block Register offsets (use TWL4030_CHIP_GPIO)
+ */
+
+#define REG_GPIODATAIN1 0x0
+#define REG_GPIODATAIN2 0x1
+#define REG_GPIODATAIN3 0x2
+#define REG_GPIODATADIR1 0x3
+#define REG_GPIODATADIR2 0x4
+#define REG_GPIODATADIR3 0x5
+#define REG_GPIODATAOUT1 0x6
+#define REG_GPIODATAOUT2 0x7
+#define REG_GPIODATAOUT3 0x8
+#define REG_CLEARGPIODATAOUT1 0x9
+#define REG_CLEARGPIODATAOUT2 0xA
+#define REG_CLEARGPIODATAOUT3 0xB
+#define REG_SETGPIODATAOUT1 0xC
+#define REG_SETGPIODATAOUT2 0xD
+#define REG_SETGPIODATAOUT3 0xE
+#define REG_GPIO_DEBEN1 0xF
+#define REG_GPIO_DEBEN2 0x10
+#define REG_GPIO_DEBEN3 0x11
+#define REG_GPIO_CTRL 0x12
+#define REG_GPIOPUPDCTR1 0x13
+#define REG_GPIOPUPDCTR2 0x14
+#define REG_GPIOPUPDCTR3 0x15
+#define REG_GPIOPUPDCTR4 0x16
+#define REG_GPIOPUPDCTR5 0x17
+#define REG_GPIO_ISR1A 0x19
+#define REG_GPIO_ISR2A 0x1A
+#define REG_GPIO_ISR3A 0x1B
+#define REG_GPIO_IMR1A 0x1C
+#define REG_GPIO_IMR2A 0x1D
+#define REG_GPIO_IMR3A 0x1E
+#define REG_GPIO_ISR1B 0x1F
+#define REG_GPIO_ISR2B 0x20
+#define REG_GPIO_ISR3B 0x21
+#define REG_GPIO_IMR1B 0x22
+#define REG_GPIO_IMR2B 0x23
+#define REG_GPIO_IMR3B 0x24
+#define REG_GPIO_EDR1 0x28
+#define REG_GPIO_EDR2 0x29
+#define REG_GPIO_EDR3 0x2A
+#define REG_GPIO_EDR4 0x2B
+#define REG_GPIO_EDR5 0x2C
+#define REG_GPIO_SIH_CTRL 0x2D
+
+/* Up to 18 signals are available as GPIOs, when their
+ * pins are not assigned to another use (such as ULPI/USB).
+ */
+#define TWL4030_GPIO_MAX 18
+
+/*
* Convience functions to read and write from TWL4030
*
* chip_no is the i2c address, it must be one of the chip addresses
@@ -511,6 +579,8 @@ static inline int twl4030_i2c_read_u8(u8 chip_no, u8 *val, u8 reg)
/* For hardware resetting */
void twl4030_power_reset_init(void);
+/* For power down */
+void twl4030_power_off(void);
/* For setting device group and voltage */
void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val,
u8 dev_grp, u8 dev_grp_sel);
@@ -518,6 +588,8 @@ void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val,
void twl4030_power_init(void);
/* For initializing mmc power */
void twl4030_power_mmc_init(void);
+/* For charging */
+int twl4030_enable_charging(void);
/*
* LED
@@ -529,4 +601,19 @@ void twl4030_led_init(unsigned char ledon_mask);
*/
int twl4030_usb_ulpi_init(void);
+/*
+ * GPIO
+ */
+extern int twl4030_set_gpio_direction(unsigned int gpio, unsigned int is_input);
+extern int twl4030_set_gpio_dataout(unsigned int gpio, unsigned int enable);
+extern int twl4030_get_gpio_datain(unsigned int gpio);
+extern int twl4030_request_gpio(unsigned int gpio);
+extern void twl4030_free_gpio(unsigned int gpio);
+
+/*
+ * PWM
+ */
+extern int twl4030_set_pwm0(int level, int max_brightness);
+extern void twl4030_dump_pwm0(void);
+
#endif /* TWL4030_H */