summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKumar Gala <galak@kernel.crashing.org>2006-04-20 12:25:10 -0500
committerKumar Gala <galak@kernel.crashing.org>2006-04-20 12:25:10 -0500
commitb86d7622b33892b1dafe761a7a9eaeeab9f3816b (patch)
tree56b1b6fc978166abce4afa8e9dee0af94bfc3cd6 /drivers
parentf8edca2e9a128f526b1fe6f997f7adb852cf5b3c (diff)
parent56a4a63c106cc317fc0fe42686a99416fc469f5b (diff)
downloadu-boot-b86d7622b33892b1dafe761a7a9eaeeab9f3816b.tar.gz
u-boot-b86d7622b33892b1dafe761a7a9eaeeab9f3816b.tar.xz
u-boot-b86d7622b33892b1dafe761a7a9eaeeab9f3816b.zip
Merge branch 'master' of rsync://rsync.denx.de/git/u-boot
Diffstat (limited to 'drivers')
-rw-r--r--drivers/cfi_flash.c71
-rw-r--r--drivers/nand/diskonchip.c5
-rw-r--r--drivers/nand/nand.c6
-rw-r--r--drivers/nand/nand_base.c6
-rw-r--r--drivers/nand/nand_bbt.c6
-rw-r--r--drivers/nand/nand_ecc.c6
-rw-r--r--drivers/nand/nand_ids.c6
-rw-r--r--drivers/nand_legacy/nand_legacy.c18
-rw-r--r--drivers/netconsole.c4
-rw-r--r--drivers/ns9750_serial.c6
-rw-r--r--drivers/ps2ser.c4
-rw-r--r--drivers/s3c4510b_uart.c4
-rw-r--r--drivers/serial.c3
-rw-r--r--drivers/serial_max3100.c3
-rw-r--r--drivers/tsec.c3
15 files changed, 92 insertions, 59 deletions
diff --git a/drivers/cfi_flash.c b/drivers/cfi_flash.c
index a989d34662..2e3748081e 100644
--- a/drivers/cfi_flash.c
+++ b/drivers/cfi_flash.c
@@ -117,6 +117,7 @@
#define FLASH_OFFSET_CFI 0x55
#define FLASH_OFFSET_CFI_RESP 0x10
#define FLASH_OFFSET_PRIMARY_VENDOR 0x13
+#define FLASH_OFFSET_EXT_QUERY_T_P_ADDR 0x15 /* extended query table primary addr */
#define FLASH_OFFSET_WTOUT 0x1F
#define FLASH_OFFSET_WBTOUT 0x20
#define FLASH_OFFSET_ETOUT 0x21
@@ -346,6 +347,10 @@ unsigned long flash_init (void)
unsigned long size = 0;
int i;
+#ifdef CFG_FLASH_PROTECTION
+ char *s = getenv("unlock");
+#endif
+
/* Init: no FLASHes known */
for (i = 0; i < CFG_MAX_FLASH_BANKS; ++i) {
flash_info[i].flash_id = FLASH_UNKNOWN;
@@ -357,15 +362,39 @@ unsigned long flash_init (void)
#endif /* CFG_FLASH_QUIET_TEST */
}
#ifdef CFG_FLASH_PROTECTION
- else {
- char *s = getenv("unlock");
+ else if ((s != NULL) && (strcmp(s, "yes") == 0)) {
+ /*
+ * Only the U-Boot image and it's environment is protected,
+ * all other sectors are unprotected (unlocked) if flash
+ * hardware protection is used (CFG_FLASH_PROTECTION) and
+ * the environment variable "unlock" is set to "yes".
+ */
+ if (flash_info[i].legacy_unlock) {
+ int k;
+
+ /*
+ * Disable legacy_unlock temporarily, since
+ * flash_real_protect would relock all other sectors
+ * again otherwise.
+ */
+ flash_info[i].legacy_unlock = 0;
- if (((s = getenv("unlock")) != NULL) && (strcmp(s, "yes") == 0)) {
/*
- * Only the U-Boot image and it's environment is protected,
- * all other sectors are unprotected (unlocked) if flash
- * hardware protection is used (CFG_FLASH_PROTECTION) and
- * the environment variable "unlock" is set to "yes".
+ * Legacy unlocking (e.g. Intel J3) -> unlock only one
+ * sector. This will unlock all sectors.
+ */
+ flash_real_protect (&flash_info[i], 0, 0);
+
+ flash_info[i].legacy_unlock = 1;
+
+ /*
+ * Manually mark other sectors as unlocked (unprotected)
+ */
+ for (k = 1; k < flash_info[i].sector_count; k++)
+ flash_info[i].protect[k] = 0;
+ } else {
+ /*
+ * No legancy unlocking -> unlock all sectors
*/
flash_protect (FLAG_PROTECT_CLEAR,
flash_info[i].start[0],
@@ -668,8 +697,12 @@ int flash_real_protect (flash_info_t * info, long sector, int prot)
prot ? "protect" : "unprotect")) == 0) {
info->protect[sector] = prot;
- /* Intel's unprotect unprotects all locking */
- if (prot == 0) {
+
+ /*
+ * On some of Intel's flash chips (marked via legacy_unlock)
+ * unprotect unprotects all locking.
+ */
+ if ((prot == 0) && (info->legacy_unlock)) {
flash_sect_t i;
for (i = 0; i < info->sector_count; i++) {
@@ -746,6 +779,10 @@ static int flash_status_check (flash_info_t * info, flash_sect_t sector,
{
ulong start;
+#if CFG_HZ != 1000
+ tout *= CFG_HZ/1000;
+#endif
+
/* Wait for command completion */
start = get_timer (0);
while (flash_is_busy (info, sector)) {
@@ -1082,6 +1119,10 @@ ulong flash_get_size (ulong base, int banknum)
uchar num_erase_regions;
int erase_region_size;
int erase_region_count;
+#ifdef CFG_FLASH_PROTECTION
+ int ext_addr;
+ info->legacy_unlock = 0;
+#endif
info->start[0] = base;
@@ -1095,6 +1136,13 @@ ulong flash_get_size (ulong base, int banknum)
case CFI_CMDSET_INTEL_EXTENDED:
default:
info->cmd_reset = FLASH_CMD_RESET;
+#ifdef CFG_FLASH_PROTECTION
+ /* read legacy lock/unlock bit from intel flash */
+ ext_addr = flash_read_ushort (info, 0,
+ FLASH_OFFSET_EXT_QUERY_T_P_ADDR);
+ info->legacy_unlock =
+ flash_read_uchar (info, ext_addr + 5) & 0x08;
+#endif
break;
case CFI_CMDSET_AMD_STANDARD:
case CFI_CMDSET_AMD_EXTENDED:
@@ -1160,8 +1208,9 @@ ulong flash_get_size (ulong base, int banknum)
info->buffer_size = (1 << flash_read_ushort (info, 0, FLASH_OFFSET_BUFFER_SIZE));
tmp = 1 << flash_read_uchar (info, FLASH_OFFSET_ETOUT);
info->erase_blk_tout = (tmp * (1 << flash_read_uchar (info, FLASH_OFFSET_EMAX_TOUT)));
- tmp = 1 << flash_read_uchar (info, FLASH_OFFSET_WBTOUT);
- info->buffer_write_tout = (tmp * (1 << flash_read_uchar (info, FLASH_OFFSET_WBMAX_TOUT)));
+ tmp = (1 << flash_read_uchar (info, FLASH_OFFSET_WBTOUT)) *
+ (1 << flash_read_uchar (info, FLASH_OFFSET_WBMAX_TOUT));
+ info->buffer_write_tout = tmp / 1000 + (tmp % 1000 ? 1 : 0); /* round up when converting to ms */
tmp = (1 << flash_read_uchar (info, FLASH_OFFSET_WTOUT)) *
(1 << flash_read_uchar (info, FLASH_OFFSET_WMAX_TOUT));
info->write_tout = tmp / 1000 + (tmp % 1000 ? 1 : 0); /* round up when converting to ms */
diff --git a/drivers/nand/diskonchip.c b/drivers/nand/diskonchip.c
index afaae834f1..e17af70d07 100644
--- a/drivers/nand/diskonchip.c
+++ b/drivers/nand/diskonchip.c
@@ -21,9 +21,7 @@
#include <common.h>
-#ifdef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY defined in a file not using the legacy NAND support!
-#endif
+#if !defined(CFG_NAND_LEGACY)
#include <linux/kernel.h>
#include <linux/init.h>
@@ -1786,3 +1784,4 @@ module_exit(cleanup_nanddoc);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("David Woodhouse <dwmw2@infradead.org>");
MODULE_DESCRIPTION("M-Systems DiskOnChip 2000, Millennium and Millennium Plus device driver\n");
+#endif
diff --git a/drivers/nand/nand.c b/drivers/nand/nand.c
index dd80026fe0..e1781fcbbf 100644
--- a/drivers/nand/nand.c
+++ b/drivers/nand/nand.c
@@ -23,11 +23,7 @@
#include <common.h>
-#ifdef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY defined in a file not using the legacy NAND support!
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include <nand.h>
diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c
index e0b406041f..b7a5d32fb3 100644
--- a/drivers/nand/nand_base.c
+++ b/drivers/nand/nand_base.c
@@ -72,11 +72,7 @@
#include <common.h>
-#ifdef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY defined in a file not using the legacy NAND support!
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include <malloc.h>
#include <watchdog.h>
diff --git a/drivers/nand/nand_bbt.c b/drivers/nand/nand_bbt.c
index ac168723e2..aaa9400e54 100644
--- a/drivers/nand/nand_bbt.c
+++ b/drivers/nand/nand_bbt.c
@@ -54,11 +54,7 @@
#include <common.h>
-#ifdef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY defined in a file not using the legacy NAND support!
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include <malloc.h>
#include <linux/mtd/compat.h>
diff --git a/drivers/nand/nand_ecc.c b/drivers/nand/nand_ecc.c
index e0d0e8bcc4..f33be9655d 100644
--- a/drivers/nand/nand_ecc.c
+++ b/drivers/nand/nand_ecc.c
@@ -37,11 +37,7 @@
#include <common.h>
-#ifdef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY defined in a file not using the legacy NAND support!
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include<linux/mtd/mtd.h>
/*
diff --git a/drivers/nand/nand_ids.c b/drivers/nand/nand_ids.c
index 3d4d372f17..8b58736bc1 100644
--- a/drivers/nand/nand_ids.c
+++ b/drivers/nand/nand_ids.c
@@ -13,11 +13,7 @@
#include <common.h>
-#ifdef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY defined in a file not using the legacy NAND support!
-#endif
-
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && !defined(CFG_NAND_LEGACY)
#include <linux/mtd/nand.h>
diff --git a/drivers/nand_legacy/nand_legacy.c b/drivers/nand_legacy/nand_legacy.c
index 3989ca2a2d..458046d41c 100644
--- a/drivers/nand_legacy/nand_legacy.c
+++ b/drivers/nand_legacy/nand_legacy.c
@@ -10,11 +10,6 @@
*/
#include <common.h>
-
-#ifndef CFG_NAND_LEGACY
-#error CFG_NAND_LEGACY not defined in a file using the legacy NAND support!
-#endif
-
#include <command.h>
#include <malloc.h>
#include <asm/io.h>
@@ -27,7 +22,7 @@
# define SHOW_BOOT_PROGRESS(arg)
#endif
-#if (CONFIG_COMMANDS & CFG_CMD_NAND)
+#if (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY)
#include <linux/mtd/nand_legacy.h>
#include <linux/mtd/nand_ids.h>
@@ -1612,4 +1607,13 @@ static int nand_correct_data (u_char *dat, u_char *read_ecc, u_char *calc_ecc)
#endif
-#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) */
+#ifdef CONFIG_JFFS2_NAND
+int read_jffs2_nand(size_t start, size_t len,
+ size_t * retlen, u_char * buf, int nanddev)
+{
+ return nand_legacy_rw(nand_dev_desc + nanddev, NANDRW_READ | NANDRW_JFFS2,
+ start, len, retlen, buf);
+}
+#endif /* CONFIG_JFFS2_NAND */
+
+#endif /* (CONFIG_COMMANDS & CFG_CMD_NAND) && defined(CFG_NAND_LEGACY) */
diff --git a/drivers/netconsole.c b/drivers/netconsole.c
index 9a0a24f3ac..69089f92ce 100644
--- a/drivers/netconsole.c
+++ b/drivers/netconsole.c
@@ -29,6 +29,8 @@
#include <devices.h>
#include <net.h>
+DECLARE_GLOBAL_DATA_PTR;
+
static char input_buffer[512];
static int input_size = 0; /* char count in input buffer */
static int input_offset = 0; /* offset to valid chars in input buffer */
@@ -105,8 +107,6 @@ int nc_input_packet (uchar * pkt, unsigned dest, unsigned src, unsigned len)
static void nc_send_packet (const char *buf, int len)
{
- DECLARE_GLOBAL_DATA_PTR;
-
struct eth_device *eth;
int inited = 0;
uchar *pkt;
diff --git a/drivers/ns9750_serial.c b/drivers/ns9750_serial.c
index aced3dae8e..8dff367745 100644
--- a/drivers/ns9750_serial.c
+++ b/drivers/ns9750_serial.c
@@ -33,6 +33,8 @@
#include "ns9750_bbus.h" /* for GPIOs */
#include "ns9750_ser.h" /* for serial configuration */
+DECLARE_GLOBAL_DATA_PTR;
+
#define CONSOLE CONFIG_CONS_INDEX
static unsigned int calcBitrateRegister( void );
@@ -183,8 +185,6 @@ void serial_setbrg( void )
static unsigned int calcBitrateRegister( void )
{
- DECLARE_GLOBAL_DATA_PTR;
-
return ( NS9750_SER_BITRATE_EBIT |
NS9750_SER_BITRATE_CLKMUX_BCLK |
NS9750_SER_BITRATE_TMODE |
@@ -204,8 +204,6 @@ static unsigned int calcBitrateRegister( void )
static unsigned int calcRxCharGapRegister( void )
{
- DECLARE_GLOBAL_DATA_PTR;
-
return NS9750_SER_RX_CHAR_TIMER_TRUN;
}
diff --git a/drivers/ps2ser.c b/drivers/ps2ser.c
index e2a38dc3dc..724fa40582 100644
--- a/drivers/ps2ser.c
+++ b/drivers/ps2ser.c
@@ -21,6 +21,8 @@
#include <asm/atomic.h>
#include <ps2mult.h>
+DECLARE_GLOBAL_DATA_PTR;
+
/* #define DEBUG */
#define PS2SER_BAUD 57600
@@ -61,8 +63,6 @@ static int ps2buf_out_idx;
#ifdef CONFIG_MPC5xxx
int ps2ser_init(void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE;
unsigned long baseclk;
int div;
diff --git a/drivers/s3c4510b_uart.c b/drivers/s3c4510b_uart.c
index 44b96a9c5e..ddcd591f84 100644
--- a/drivers/s3c4510b_uart.c
+++ b/drivers/s3c4510b_uart.c
@@ -50,6 +50,8 @@
#include <asm/hardware.h>
#include "s3c4510b_uart.h"
+DECLARE_GLOBAL_DATA_PTR;
+
static UART *uart;
/* flush serial input queue. returns 0 on success or negative error
@@ -82,8 +84,6 @@ static int serial_flush_output(void)
void serial_setbrg (void)
{
- DECLARE_GLOBAL_DATA_PTR;
-
UART_LINE_CTRL ulctrl;
UART_CTRL uctrl;
UART_BAUD_DIV ubd;
diff --git a/drivers/serial.c b/drivers/serial.c
index 057a1ab017..228781b46a 100644
--- a/drivers/serial.c
+++ b/drivers/serial.c
@@ -30,6 +30,8 @@
#include <ns87308.h>
#endif
+DECLARE_GLOBAL_DATA_PTR;
+
#if !defined(CONFIG_CONS_INDEX)
#error "No console index specified."
#elif (CONFIG_CONS_INDEX < 1) || (CONFIG_CONS_INDEX > 4)
@@ -77,7 +79,6 @@ static NS16550_t serial_ports[4] = {
static int calc_divisor (NS16550_t port)
{
- DECLARE_GLOBAL_DATA_PTR;
#ifdef CONFIG_OMAP1510
/* If can't cleanly clock 115200 set div to 1 */
if ((CFG_NS16550_CLK == 12000000) && (gd->baudrate == 115200)) {
diff --git a/drivers/serial_max3100.c b/drivers/serial_max3100.c
index bbe212b81f..35c5596985 100644
--- a/drivers/serial_max3100.c
+++ b/drivers/serial_max3100.c
@@ -28,6 +28,8 @@
#ifdef CONFIG_MAX3100_SERIAL
+DECLARE_GLOBAL_DATA_PTR;
+
/**************************************************************/
/* convienient macros */
@@ -217,7 +219,6 @@ int serial_init(void)
{
unsigned int wconf, rconf;
int i;
- DECLARE_GLOBAL_DATA_PTR;
wconf = 0;
diff --git a/drivers/tsec.c b/drivers/tsec.c
index 4c5e1b5d3a..7ec565ca67 100644
--- a/drivers/tsec.c
+++ b/drivers/tsec.c
@@ -23,6 +23,8 @@
#include "tsec.h"
#include "miiphy.h"
+DECLARE_GLOBAL_DATA_PTR;
+
#define TX_BUF_CNT 2
static uint rxIdx; /* index of the current RX buffer */
@@ -1082,7 +1084,6 @@ static void relocate_cmds(void)
struct phy_cmd **cmdlistptr;
struct phy_cmd *cmd;
int i,j,k;
- DECLARE_GLOBAL_DATA_PTR;
for(i=0; phy_info[i]; i++) {
/* First thing's first: relocate the pointers to the