]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Update i386 code (sc520_cdp)
authorGraeme Russ <graeme.russ@gmail.com>
Sat, 6 Sep 2008 21:08:42 +0000 (07:08 +1000)
committerWolfgang Denk <wd@denx.de>
Tue, 9 Sep 2008 09:48:53 +0000 (11:48 +0200)
Attempt to bring i386 / sc520 inline with master

Signed-off-by: Graeme Russ <graeme.russ@gmail.com>
13 files changed:
board/sc520_cdp/sc520_cdp.c
drivers/mtd/mw_eeprom.c
examples/82559_eeprom.c
include/asm-i386/byteorder.h
include/asm-i386/global_data.h
include/asm-i386/ic/ssi.h [new file with mode: 0644]
include/asm-i386/pci.h
include/asm-i386/string.h
include/configs/sc520_cdp.h
lib_i386/bios_setup.c
lib_i386/board.c
lib_i386/bootm.c
lib_i386/video_bios.c

index f21c73002fc9d621d97bdd87061fb17a8346d0fa..99debde50ee6c27a972b45ca50e30a7fb6923a24 100644 (file)
@@ -114,7 +114,7 @@ static void irq_init(void)
 
 }
 
-
+#ifdef CONFIG_PCI
 /* PCI stuff */
 static void pci_sc520_cdp_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
 {
@@ -129,7 +129,7 @@ static void pci_sc520_cdp_fixup_irq(struct pci_controller *hose, pci_dev_t dev)
        };
        static int next_irq_index=0;
 
-       char tmp_pin;
+       uchar tmp_pin;
        int pin;
 
        pci_hose_read_config_byte(hose, dev, PCI_INTERRUPT_PIN, &tmp_pin);
@@ -193,7 +193,7 @@ void pci_init_board(void)
 {
        pci_sc520_init(&sc520_cdp_hose);
 }
-
+#endif
 
 static void silence_uart(int port)
 {
@@ -563,12 +563,12 @@ void spi_eeprom_probe(int x)
 {
 }
 
-int spi_eeprom_read(int x, int offset, char *buffer, int len)
+int spi_eeprom_read(int x, int offset, uchar *buffer, int len)
 {
        return 0;
 }
 
-int spi_eeprom_write(int x, int offset, char *buffer, int len)
+int spi_eeprom_write(int x, int offset, uchar *buffer, int len)
 {
        return 0;
 }
index f32ced4c2e083b939bf3effccaf582c1b7fb2b2f..f7791b51a046d663082934dcd360bfdd160b09b8 100644 (file)
@@ -1,7 +1,7 @@
 /* Three-wire (MicroWire) serial eeprom driver (for 93C46 and compatibles) */
 
 #include <common.h>
-#include <ssi.h>
+#include <asm/ic/ssi.h>
 
 /*
  * Serial EEPROM opcodes, including start bit
index 1a121d42874e771be1858e1432c817e3314f1b24..d99af26fe4930f4d4e8653bf92df403b13a05d36 100644 (file)
@@ -51,13 +51,17 @@ static inline unsigned short swap16(unsigned short x)
 }
 
 
-static inline void *memcpy(void *dst, const void *src, unsigned int len)
+void * memcpy(void * dest,const void *src,size_t count)
 {
-       void * ret = dst;
-       while (len-- > 0) *((char *)dst)++ = *((char *)src)++;
-       return ret;
+       char *tmp = (char *) dest, *s = (char *) src;
+
+       while (count--)
+               *tmp++ = *s++;
+
+       return dest;
 }
 
+
 /* The EEPROM commands include the alway-set leading bit. */
 #define EE_WRITE_CMD   (5)
 #define EE_READ_CMD            (6)
@@ -156,7 +160,7 @@ static int reset_eeprom(unsigned long ioaddr, unsigned char *hwaddr)
        int size_test;
        int i;
 
-       printf("Resetting i82559 EEPROM @ 0x%08x ... ", ioaddr);
+       printf("Resetting i82559 EEPROM @ 0x%08lx ... ", ioaddr);
 
        size_test = do_eeprom_cmd(ioaddr, (EE_READ_CMD << 8) << 16, 27);
        eeprom_addr_size = (size_test & 0xffe0000) == 0xffe0000 ? 8 : 6;
@@ -305,7 +309,7 @@ write_config_word(int bus, int dev, int func, int reg, u16 data)
 int main (int argc, char *argv[])
 {
        unsigned char *eth_addr;
-       char buf[6];
+       uchar buf[6];
        int instance;
 
        app_startup(argv);
index a9c69d5b1f288a8bde95206f9a41360bae92711d..7dfeb8bbed2b4cdc69a0e4c3943b4ad0e9d241ed 100644 (file)
@@ -6,7 +6,7 @@
 #ifdef __GNUC__
 
 
-static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
+static __inline__ __u32 ___arch__swab32(__u32 x)
 {
 #ifdef CONFIG_X86_BSWAP
        __asm__("bswap %0" : "=r" (x) : "0" (x));
@@ -20,7 +20,7 @@ static __inline__ __const__ __u32 ___arch__swab32(__u32 x)
        return x;
 }
 
-static __inline__ __const__ __u16 ___arch__swab16(__u16 x)
+static __inline__ __u16 ___arch__swab16(__u16 x)
 {
        __asm__("xchgb %b0,%h0"         /* swap bytes           */ \
                : "=q" (x) \
index 35bad23c17c95beb1d7ff6e07b8d737fe9faf547..cc30689d210e9e37aaa5f1e98d099b6b663b77ba 100644 (file)
@@ -59,8 +59,8 @@ typedef       struct {
 #define        GD_FLG_LOGINIT  0x00020         /* Log Buffer has been initialized      */
 #define GD_FLG_DISABLE_CONSOLE 0x00040         /* Disable console (in & out)    */
 
-extern gd_t *global_data;
+extern gd_t *gd;
 
-#define DECLARE_GLOBAL_DATA_PTR     gd_t *gd = global_data
+#define DECLARE_GLOBAL_DATA_PTR
 
 #endif /* __ASM_GBL_DATA_H */
diff --git a/include/asm-i386/ic/ssi.h b/include/asm-i386/ic/ssi.h
new file mode 100644 (file)
index 0000000..bd48eab
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * (C) Copyright 2008
+ * Graeme Russ <graeme.russ@gmail.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 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 _ASM_IC_SSI_H_
+#define _ASM_IC_SSI_H_ 1
+
+int ssi_set_interface(int, int, int, int);
+void ssi_chip_select(int);
+u8 ssi_txrx_byte(u8);
+void ssi_tx_byte(u8);
+u8 ssi_rx_byte(void);
+
+
+#endif
index bde95509a4b61c08f9faec9c37336a9d26690873..050a2bb8683ed0df47dd358ebb3563691963bbef 100644 (file)
@@ -31,5 +31,4 @@ int pci_enable_legacy_video_ports(struct pci_controller* hose);
 int pci_shadow_rom(pci_dev_t dev, unsigned char *dest);
 void pci_remove_rom_window(struct pci_controller* hose, u32 addr);
 u32 pci_get_rom_window(struct pci_controller* hose, int size);
-
 #endif
index 91a23f951cad977077684355757e0c0c8d396081..3643a79fdfc1c014d25d3aade1c8f3a13164c411 100644 (file)
@@ -5,6 +5,8 @@
  * We don't do inline string functions, since the
  * optimised inline asm versions are not small.
  */
+#undef __HAVE_ARCH_STRNCPY
+extern char *strncpy(char *__dest, __const__ char *__src, __kernel_size_t __n);
 
 #undef __HAVE_ARCH_STRRCHR
 extern char * strrchr(const char * s, int c);
index e29655e6362eb186bb784cebd6e2756de9d31095..dfe7b7d3e498e83d55536017546a3af8465c1041 100644 (file)
@@ -28,6 +28,7 @@
 #ifndef __CONFIG_H
 #define __CONFIG_H
 
+#define GRUSS_TESTING
 /*
  * High Level Configuration Options
  * (easy to change)
 #include <config_cmd_default.h>
 
 #define CONFIG_CMD_PCI
+#ifndef GRUSS_TESTING
 #define CONFIG_CMD_SATA
+#else
+#undef CONFIG_CMD_SATA
+#endif
 #define CONFIG_CMD_JFFS2
 #define CONFIG_CMD_NET
 #define CONFIG_CMD_EEPROM
 /************************************************************
 *SATA/Native Stuff
 ************************************************************/
+#ifndef GRUSS_TESTING
 #define CFG_SATA_MAXBUS         2       /*Max Sata buses supported */
 #define CFG_SATA_DEVS_PER_BUS   2      /*Max no. of devices per bus/port */
 #define CFG_SATA_MAX_DEVICE     (CFG_SATA_MAXBUS* CFG_SATA_DEVS_PER_BUS)
 #define CONFIG_ATA_PIIX                1       /*Supports ata_piix driver */
+#else
+#undef CFG_SATA_MAXBUS
+#undef CFG_SATA_DEVS_PER_BUS
+#undef CFG_SATA_MAX_DEVICE
+#undef CONFIG_ATA_PIIX
+#endif
+
 
 /************************************************************
  * DISK Partition support
 /************************************************************
  * Video/Keyboard support
  ************************************************************/
+#ifndef GRUSS_TESTING
 #define CONFIG_VIDEO                   /* To enable video controller support */
+#else
+#undef CONFIG_VIDEO
+#endif
 #define CONFIG_I8042_KBD
 #define CFG_ISA_IO 0
 
 /*
  * PCI stuff
  */
+#ifndef GRUSS_TESTING
 #define CONFIG_PCI                                /* include pci support */
 #define CONFIG_PCI_PNP                            /* pci plug-and-play */
 #define CONFIG_PCI_SCAN_SHOW
 #define        CFG_SECOND_PCI_IRQ  9
 #define CFG_THIRD_PCI_IRQ   11
 #define        CFG_FORTH_PCI_IRQ   15
+#else
+#undef CONFIG_PCI
+#undef CONFIG_PCI_PNP
+#undef CONFIG_PCI_SCAN_SHOW
+#endif
+
 
 #endif /* __CONFIG_H */
index 75f04a01fe637cc3aac4e79b203802c28a30fd91..33c842c6a0aba7e8c54f12b7196b48776282575b 100644 (file)
@@ -140,8 +140,9 @@ int bios_setup(void)
 {
        static int done=0;
        int vector;
+#ifdef CONFIG_PCI
        struct pci_controller *pri_hose;
-
+#endif
        if (done) {
                return 0;
        }
@@ -223,12 +224,13 @@ int bios_setup(void)
         * (This, ofcause break on multi hose systems,
         *  but our PCI BIOS only support one hose anyway)
         */
+#ifdef CONFIG_PCI
        pri_hose = pci_bus_to_hose(0);
        if (NULL != pri_hose) {
                /* fill in last pci bus number for use by the realmode
                 * PCI BIOS */
                RELOC_16_BYTE(0xf000, pci_last_bus) = pri_hose->last_busno;
        }
-
+#endif
        return 0;
 }
index 55fa42af424bb53e30ffcbde99547d0ddd663747..f3da0a292c2f63d14a0a11567d448949db041a13 100644 (file)
@@ -213,7 +213,7 @@ init_fnc_t *init_sequence[] = {
        NULL,
 };
 
-gd_t *global_data;
+gd_t *gd;
 
 void start_i386boot (void)
 {
@@ -226,7 +226,7 @@ void start_i386boot (void)
 
        show_boot_progress(0x21);
 
-       gd = global_data = &gd_data;
+       gd = &gd_data;
        /* compiler optimization barrier needed for GCC >= 3.4 */
        __asm__ __volatile__("": : :"memory");
 
@@ -266,7 +266,7 @@ void start_i386boot (void)
                int i;
                ulong reg;
                char *s, *e;
-               uchar tmp[64];
+               char tmp[64];
 
                i = getenv_r ("ethaddr", tmp, sizeof (tmp));
                s = (i > 0) ? tmp : NULL;
@@ -412,7 +412,10 @@ void hang (void)
 unsigned long do_go_exec (ulong (*entry)(int, char *[]), int argc, char *argv[])
 {
        /*
-        * Nios function pointers are address >> 1
+        * TODO: Test this function - changed to fix compiler error.
+        * Original code was:
+        *   return (entry >> 1) (argc, argv);
+        * with a comment about Nios function pointers are address >> 1
         */
-       return (entry >> 1) (argc, argv);
+       return (entry) (argc, argv);
 }
index 522d7ad8ee8e048bf4f20c7571f29194875c963f..613e339a5f2fe2e3d7b93225d413acf35fa43b5d 100644 (file)
@@ -34,7 +34,7 @@ int do_bootm_linux(int flag, int argc, char *argv[], bootm_headers_t *images)
        void            *base_ptr;
        ulong           os_data, os_len;
        image_header_t  *hdr;
-       int             ret;
+
 #if defined(CONFIG_FIT)
        const void      *data;
        size_t          len;
index 45f78e22faa5fc7edd6465b01adf207de2bf2ac1..ce96a3e058f77e7d36353117c523ec22d70c2dcf 100644 (file)
@@ -136,6 +136,8 @@ static u32 probe_pci_video(void)
 
 #endif
 
+#ifdef CONFIG_VIDEO
+
 static int probe_isa_video(void)
 {
        u32 ptr;
@@ -217,3 +219,4 @@ int video_bios_init(void)
        return 1;
 
 }
+#endif