]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
General indent and whitespace cleanups.
authorJon Loeliger <jdl@freescale.com>
Tue, 22 Aug 2006 17:25:27 +0000 (12:25 -0500)
committerJon Loeliger <jdl@freescale.com>
Tue, 22 Aug 2006 17:25:27 +0000 (12:25 -0500)
board/mpc8641hpcn/mpc8641hpcn.c
board/mpc8641hpcn/pixis.c
board/mpc8641hpcn/sys_eeprom.c

index 5023c1c97aec67f659e4813a8450a7572be1a4e7..b2cf4a9566d5a65f38208a33d2be5e548b797782 100644 (file)
@@ -50,12 +50,12 @@ void sdram_init(void);
 long int fixed_sdram(void);
 
 
-int board_early_init_f (void)
+int board_early_init_f(void)
 {
        return 0;
 }
 
-int checkboard (void)
+int checkboard(void)
 {
        puts("Board: MPC8641HPCN\n");
 
@@ -68,7 +68,7 @@ int checkboard (void)
        uint devdisr = gur->devdisr;
        uint io_sel = (gur->pordevsr & MPC86xx_PORDEVSR_IO_SEL) >> 16;
        uint host1_agent = (gur->porbmsr & MPC86xx_PORBMSR_HA) >> 17;
-       uint pex1_agent =  (host1_agent == 0) || (host1_agent == 1);
+       uint pex1_agent = (host1_agent == 0) || (host1_agent == 1);
 
        if ((io_sel == 2 || io_sel == 3 || io_sel == 5
             || io_sel == 6 || io_sel == 7 || io_sel == 0xF)
@@ -80,7 +80,7 @@ int checkboard (void)
                        debug(" with errors.  Clearing.  Now 0x%08x",
                              pex1->pme_msg_det);
                }
-               debug ("\n");
+               debug("\n");
        } else {
                puts("PCI-EXPRESS 1: Disabled\n");
        }
@@ -99,9 +99,9 @@ initdram(int board_type)
        long dram_size = 0;
 
 #if defined(CONFIG_SPD_EEPROM)
-       dram_size = spd_sdram ();
+       dram_size = spd_sdram();
 #else
-       dram_size = fixed_sdram ();
+       dram_size = fixed_sdram();
 #endif
 
 #if defined(CFG_RAMBOOT)
@@ -122,7 +122,8 @@ initdram(int board_type)
 
 
 #if defined(CFG_DRAM_TEST)
-int testdram(void)
+int
+testdram(void)
 {
        uint *pstart = (uint *) CFG_MEMTEST_START;
        uint *pend = (uint *) CFG_MEMTEST_END;
@@ -134,7 +135,7 @@ int testdram(void)
 
        for (p = pstart; p < pend; p++) {
                if (*p != 0xaaaaaaaa) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
+                       printf("SDRAM test fails at: %08x\n", (uint) p);
                        return 1;
                }
        }
@@ -145,7 +146,7 @@ int testdram(void)
 
        for (p = pstart; p < pend; p++) {
                if (*p != 0x55555555) {
-                       printf ("SDRAM test fails at: %08x\n", (uint) p);
+                       printf("SDRAM test fails at: %08x\n", (uint) p);
                        return 1;
                }
        }
@@ -160,11 +161,12 @@ int testdram(void)
 /*
  * Fixed sdram init -- doesn't use serial presence detect.
  */
-long int fixed_sdram(void)
+long int
+fixed_sdram(void)
 {
 #if !defined(CFG_RAMBOOT)
-       volatile immap_t *immap = (immap_t *)CFG_IMMR;
-       volatile ccsr_ddr_t *ddr= &immap->im_ddr1;
+       volatile immap_t *immap = (immap_t *) CFG_IMMR;
+       volatile ccsr_ddr_t *ddr = &immap->im_ddr1;
 
        ddr->cs0_bnds = CFG_DDR_CS0_BNDS;
        ddr->cs0_config = CFG_DDR_CS0_CONFIG;
@@ -211,28 +213,25 @@ long int fixed_sdram(void)
 
 #ifndef CONFIG_PCI_PNP
 static struct pci_config_table pci_fsl86xxads_config_table[] = {
-    { PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
-      PCI_IDSEL_NUMBER, PCI_ANY_ID,
-      pci_cfgfunc_config_device, { PCI_ENET0_IOADDR,
-                                  PCI_ENET0_MEMADDR,
-                                  PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER
-      } },
-    { }
+       {PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID, PCI_ANY_ID,
+        PCI_IDSEL_NUMBER, PCI_ANY_ID,
+        pci_cfgfunc_config_device, {PCI_ENET0_IOADDR,
+                                    PCI_ENET0_MEMADDR,
+                                    PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER}},
+       {}
 };
 #endif
 
 
 static struct pci_controller hose = {
 #ifndef CONFIG_PCI_PNP
-       config_table: pci_mpc86xxcts_config_table,
+      config_table:pci_mpc86xxcts_config_table,
 #endif
 };
 
-#endif /* CONFIG_PCI */
-
+#endif /* CONFIG_PCI */
 
-void
-pci_init_board(void)
+void pci_init_board(void)
 {
 #ifdef CONFIG_PCI
        extern void pci_mpc86xx_init(struct pci_controller *hose);
@@ -260,7 +259,7 @@ ft_board_setup(void *blob, bd_t *bd)
 
 
 void
-mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+mpc8641_reset_board(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
        char cmd;
        ulong val;
@@ -276,7 +275,7 @@ mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        cmd = argv[1][1];
        switch (cmd) {
-       case 'f':    /* reset with frequency changed */
+       case 'f':               /* reset with frequency changed */
                if (argc < 5)
                        goto my_usage;
                read_from_px_regs(0);
@@ -294,7 +293,7 @@ mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                } else
                        goto my_usage;
 
-               while (1); /* Not reached */
+               while (1) ;     /* Not reached */
 
        case 'l':
                if (argv[2][1] == 'f') {
@@ -305,7 +304,8 @@ mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
                        corepll = strfractoint(argv[4]);
                        val = val + set_px_corepll(corepll);
-                       val = val + set_px_mpxpll(simple_strtoul(argv[5], NULL, 10));
+                       val = val + set_px_mpxpll(simple_strtoul(argv[5],
+                                                                NULL, 10));
                        if (val == 3) {
                                puts("Setting registers VCFGEN0, VCFGEN1, VBOOT, and VCTL\n");
                                set_altbank();
@@ -316,9 +316,9 @@ mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        } else
                                goto my_usage;
 
-                       while(1); /* Not reached */
+                       while (1) ;     /* Not reached */
 
-               } else if(argv[2][1] == 'd'){
+               } else if (argv[2][1] == 'd') {
                        /*
                         * Reset from alternate bank without changing
                         * frequencies but with watchdog timer enabled.
@@ -330,7 +330,7 @@ mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                        read_from_px_regs_altbank(1);
                        puts("Enabling watchdog timer on the FPGA and resetting board to boot from the other bank....\n");
                        set_px_go_with_watchdog();
-                       while(1); /* Not reached */
+                       while (1) ;     /* Not reached */
 
                } else {
                        /*
@@ -339,7 +339,7 @@ mpc8641_reset_board(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                         */
                        read_from_px_regs(0);
                        read_from_px_regs_altbank(0);
-                       if(argc > 2)
+                       if (argc > 2)
                                goto my_usage;
                        puts("Setting registers VCFGNE1, VBOOT, and VCTL\n");
                        set_altbank();
@@ -360,12 +360,14 @@ my_usage:
        puts("See MPC8641HPCN Design Workbook for valid values of command line parameters.\n");
 }
 
+
 /*
  * get_board_sys_clk
  *      Reads the FPGA on board for CONFIG_SYS_CLK_FREQ
  */
 
-unsigned long get_board_sys_clk(ulong dummy)
+unsigned long
+get_board_sys_clk(ulong dummy)
 {
        u8 i, go_bit, rd_clks;
        ulong val = 0;
@@ -422,4 +424,3 @@ unsigned long get_board_sys_clk(ulong dummy)
 
        return val;
 }
-
index f226b3e8dd3fdad699e399ee4714ac6217eeaae8..964a17ca0801ab8847c5c00864e3e5f2e6763111 100644 (file)
@@ -92,13 +92,13 @@ int set_px_sysclk(ulong sysclk)
                return 0;
        }
 
-       vclkh = (sysclk_s << 5) | sysclk_r ;
+       vclkh = (sysclk_s << 5) | sysclk_r;
        vclkl = sysclk_v;
 
        out8(PIXIS_BASE + PIXIS_VCLKH, vclkh);
        out8(PIXIS_BASE + PIXIS_VCLKL, vclkl);
 
-       out8(PIXIS_BASE + PIXIS_AUX,sysclk_aux);
+       out8(PIXIS_BASE + PIXIS_AUX, sysclk_aux);
 
        return 1;
 }
@@ -118,7 +118,7 @@ int set_px_mpxpll(ulong mpxpll)
        case 12:
        case 14:
        case 16:
-               val = (u8)mpxpll;
+               val = (u8) mpxpll;
                break;
        default:
                printf("Unsupported MPXPLL ratio.\n");
@@ -245,19 +245,16 @@ int disable_watchdog(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
        /* setting VCTL[WDEN] to 0 to disable watch dog */
        tmp = in8(PIXIS_BASE + PIXIS_VCTL);
-       tmp &= ~ 0x08;
+       tmp &= ~0x08;
        out8(PIXIS_BASE + PIXIS_VCTL, tmp);
 
        return 0;
 }
 
-
 U_BOOT_CMD(
-       diswd, 1, 0, disable_watchdog,
-       "diswd  - Disable watchdog timer \n",
-       NULL
-);
-
+          diswd, 1, 0, disable_watchdog,
+          "diswd       - Disable watchdog timer \n",
+          NULL);
 
 /*
  * This function takes the non-integral cpu:mpx pll ratio
@@ -295,11 +292,11 @@ ulong strfractoint(uchar *strptr)
 
        if (no_dec) {
                /* Currently needed only for single digit corepll ratios */
-               mulconst=10;
+               mulconst = 10;
                decval = 0;
        } else {
                j = 0;
-               i++; /* Skipping the decimal point */
+               i++;            /* Skipping the decimal point */
                while ((strptr[i] > 47) && (strptr[i] < 58)) {
                        decarr[j] = strptr[i];
                        i++;
index 733a57f93f736086a549101cd26e7343efed0a69..74e2a3d46ffd9cf6a0ba66d0b88a7a9927f43426 100644 (file)
 
 #ifdef CFG_ID_EEPROM
 typedef struct {
-       unsigned char id[4];    /* 0x0000 - 0x0003 */
-       unsigned char sn[12];   /* 0x0004 - 0x000F */
-       unsigned char errata[5];/* 0x0010 - 0x0014 */
-       unsigned char date[7];  /* 0x0015 - 0x001a */
-       unsigned char res_1[37];/* 0x001b - 0x003f */
-       unsigned char tab_size; /* 0x0040 */
-       unsigned char tab_flag; /* 0x0041 */
-       unsigned char mac[8][6];/* 0x0042 - 0x0071 */
-       unsigned char res_2[126];/* 0x0072 - 0x00ef */
-       unsigned int  crc;      /* 0x00f0 - 0x00f3 crc32 checksum */
+       unsigned char id[4];            /* 0x0000 - 0x0003 */
+       unsigned char sn[12];           /* 0x0004 - 0x000F */
+       unsigned char errata[5];        /* 0x0010 - 0x0014 */
+       unsigned char date[7];          /* 0x0015 - 0x001a */
+       unsigned char res_1[37];        /* 0x001b - 0x003f */
+       unsigned char tab_size;         /* 0x0040 */
+       unsigned char tab_flag;         /* 0x0041 */
+       unsigned char mac[8][6];        /* 0x0042 - 0x0071 */
+       unsigned char res_2[126];       /* 0x0072 - 0x00ef */
+       unsigned int crc;               /* 0x00f0 - 0x00f3 crc32 checksum */
 } EEPROM_data;
 
 static EEPROM_data mac_data;
@@ -48,30 +48,34 @@ int mac_show(void)
        int i;
        unsigned char ethaddr[8][18];
 
-       printf("ID %c%c%c%c\n", mac_data.id[0],\
-                               mac_data.id[1],\
-                               mac_data.id[2],\
-                               mac_data.id[3]);
-       printf("Errata %c%c%c%c%c\n",   mac_data.errata[0],\
-                               mac_data.errata[1],\
-                               mac_data.errata[2],\
-                               mac_data.errata[3],\
-                               mac_data.errata[4]);
-       printf("Date %c%c%c%c%c%c%c\n", mac_data.date[0],\
-                               mac_data.date[1],\
-                               mac_data.date[2],\
-                               mac_data.date[3],\
-                               mac_data.date[4],\
-                               mac_data.date[5],\
-                               mac_data.date[6]);
+       printf("ID %c%c%c%c\n",
+              mac_data.id[0],
+              mac_data.id[1],
+              mac_data.id[2],
+              mac_data.id[3]);
+       printf("Errata %c%c%c%c%c\n",
+              mac_data.errata[0],
+              mac_data.errata[1],
+              mac_data.errata[2],
+              mac_data.errata[3],
+              mac_data.errata[4]);
+       printf("Date %c%c%c%c%c%c%c\n",
+              mac_data.date[0],
+              mac_data.date[1],
+              mac_data.date[2],
+              mac_data.date[3],
+              mac_data.date[4],
+              mac_data.date[5],
+              mac_data.date[6]);
        for (i = 0; i < 8; i++) {
-               sprintf(ethaddr[i],"%02x:%02x:%02x:%02x:%02x:%02x",\
-                                       mac_data.mac[i][0],\
-                                       mac_data.mac[i][1],\
-                                       mac_data.mac[i][2],\
-                                       mac_data.mac[i][3],\
-                                       mac_data.mac[i][4],\
-                                       mac_data.mac[i][5]);
+               sprintf(ethaddr[i],
+                       "%02x:%02x:%02x:%02x:%02x:%02x",
+                       mac_data.mac[i][0],
+                       mac_data.mac[i][1],
+                       mac_data.mac[i][2],
+                       mac_data.mac[i][3],
+                       mac_data.mac[i][4],
+                       mac_data.mac[i][5]);
                printf("MAC %d %s\n", i, ethaddr[i]);
        }
 
@@ -85,7 +89,7 @@ int mac_show(void)
 
 int mac_read(void)
 {
-       int ret,length;
+       int ret, length;
        unsigned int crc = 0;
        unsigned char dev = ID_EEPROM_ADDR, *data;
 
@@ -98,12 +102,12 @@ int mac_read(void)
 
        data = (unsigned char *)(&mac_data);
        printf("Check CRC on reading ...");
-       crc = crc32(crc, data, length-4);
+       crc = crc32(crc, data, length - 4);
        if (crc != mac_data.crc) {
-               printf("CRC checksum is invalid, in EEPROM CRC is %x, calculated CRC is %x\n",mac_data.crc,crc);
+               printf("CRC checksum is invalid, in EEPROM CRC is %x, calculated CRC is %x\n",
+                    mac_data.crc, crc);
                return -1;
-       }
-       else {
+       } else {
                printf("CRC OK\n");
                mac_show();
        }
@@ -114,94 +118,97 @@ int mac_prog(void)
 {
        int ret, i, length;
        unsigned int crc = 0;
-       unsigned char dev = ID_EEPROM_ADDR,*ptr;
-       unsigned char * eeprom_data = (unsigned char *)(&mac_data);
+       unsigned char dev = ID_EEPROM_ADDR, *ptr;
+       unsigned char *eeprom_data = (unsigned char *)(&mac_data);
 
        for (i = 0; i < sizeof(mac_data.res_1); i++)
                mac_data.res_1[i] = 0;
-       for (i = 0;i < sizeof(mac_data.res_2); i++)
+       for (i = 0; i < sizeof(mac_data.res_2); i++)
                mac_data.res_2[i] = 0;
        length = sizeof(EEPROM_data);
-       crc = crc32 (crc, eeprom_data, length-4);
+       crc = crc32(crc, eeprom_data, length - 4);
        mac_data.crc = crc;
        for (i = 0, ptr = eeprom_data; i < length; i += 8, ptr += 8) {
-               ret = i2c_write(dev, i, 1, ptr, (length-i) <8 ? (length-i) : 8);
-               udelay(5000);           /* 5ms write cycle timing */
+               ret =
+                   i2c_write(dev, i, 1, ptr,
+                             (length - i) < 8 ? (length - i) : 8);
+               udelay(5000);   /* 5ms write cycle timing */
                if (ret)
                        break;
        }
        if (ret) {
                printf("Programming failed.\n");
                return -1;
-       }
-       else {
-               printf("Programming %d bytes. Reading back ...\n",length);
+       } else {
+               printf("Programming %d bytes. Reading back ...\n", length);
                mac_read();
        }
        return 0;
 }
 
-int do_mac (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+int do_mac(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 {
        int i;
        char cmd = 's';
        unsigned long long mac_val;
 
-       if(i2c_probe(ID_EEPROM_ADDR) != 0)
+       if (i2c_probe(ID_EEPROM_ADDR) != 0)
                return -1;
 
-       if(argc>1) {
+       if (argc > 1) {
                cmd = argv[1][0];
                switch (cmd) {
-                       case 'r':       /* display */
-                               mac_read();
-                               break;
-                       case 's':       /* save */
-                               mac_prog();
-                               break;
-                       case 'i':       /* id */
-                               for (i=0; i<4; i++) {
-                                       mac_data.id[i] = argv[2][i];
-                               }
-                               break;
-                       case 'n':       /* serial number */
-                               for (i=0; i<12; i++) {
-                                       mac_data.sn[i] = argv[2][i];
-                               }
-                               break;
-                       case 'e':       /* errata */
-                               for (i=0; i<5; i++) {
-                                       mac_data.errata[i] = argv[2][i];
-                               }
-                               break;
-                       case 'd':       /* date */
-                               for (i=0; i<7; i++) {
-                                       mac_data.date[i] = argv[2][i];
-                               }
-                               break;
-                       case 'p':       /* number of ports */
-                               mac_data.tab_size = (unsigned char)simple_strtoul(argv[2],NULL,16);
-                               break;
-                       case '0':       /* mac 0 */
-                       case '1':       /* mac 1 */
-                       case '2':       /* mac 2 */
-                       case '3':       /* mac 3 */
-                       case '4':       /* mac 4 */
-                       case '5':       /* mac 5 */
-                       case '6':       /* mac 6 */
-                       case '7':       /* mac 7 */
-                               mac_val = simple_strtoull(argv[2],NULL,16);
-                               for (i=0; i<6; i++) {
-                                       mac_data.mac[cmd-'0'][i] = *((unsigned char *)(((unsigned int)(&mac_val))+i+2));
-                               }
-                               break;
-                       case 'h':       /* help */
-                       default:
-                               printf ("Usage:\n%s\n", cmdtp->usage);
-                               break;
+               case 'r':       /* display */
+                       mac_read();
+                       break;
+               case 's':       /* save */
+                       mac_prog();
+                       break;
+               case 'i':       /* id */
+                       for (i = 0; i < 4; i++) {
+                               mac_data.id[i] = argv[2][i];
+                       }
+                       break;
+               case 'n':       /* serial number */
+                       for (i = 0; i < 12; i++) {
+                               mac_data.sn[i] = argv[2][i];
+                       }
+                       break;
+               case 'e':       /* errata */
+                       for (i = 0; i < 5; i++) {
+                               mac_data.errata[i] = argv[2][i];
+                       }
+                       break;
+               case 'd':       /* date */
+                       for (i = 0; i < 7; i++) {
+                               mac_data.date[i] = argv[2][i];
+                       }
+                       break;
+               case 'p':       /* number of ports */
+                       mac_data.tab_size =
+                           (unsigned char)simple_strtoul(argv[2], NULL, 16);
+                       break;
+               case '0':       /* mac 0 */
+               case '1':       /* mac 1 */
+               case '2':       /* mac 2 */
+               case '3':       /* mac 3 */
+               case '4':       /* mac 4 */
+               case '5':       /* mac 5 */
+               case '6':       /* mac 6 */
+               case '7':       /* mac 7 */
+                       mac_val = simple_strtoull(argv[2], NULL, 16);
+                       for (i = 0; i < 6; i++) {
+                               mac_data.mac[cmd - '0'][i] =
+                                   *((unsigned char *)
+                                     (((unsigned int)(&mac_val)) + i + 2));
+                       }
+                       break;
+               case 'h':       /* help */
+               default:
+                       printf("Usage:\n%s\n", cmdtp->usage);
+                       break;
                }
-       }
-       else {
+       } else {
                mac_show();
        }
        return 0;
@@ -209,36 +216,41 @@ int do_mac (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 
 int mac_read_from_eeprom(void)
 {
-       int length,i;
-       unsigned char dev = ID_EEPROM_ADDR, *data, ethaddr[4][18], enetvar[32];
+       int length, i;
+       unsigned char dev = ID_EEPROM_ADDR;
+       unsigned char *data;
+       unsigned char ethaddr[4][18];
+       unsigned char enetvar[32];
        unsigned int crc = 0;
 
        length = sizeof(EEPROM_data);
-       if(i2c_read (dev, 0, 1, (unsigned char *)(&mac_data), length)) {
+       if (i2c_read(dev, 0, 1, (unsigned char *)(&mac_data), length)) {
                printf("Read failed.\n");
                return -1;
        }
 
        data = (unsigned char *)(&mac_data);
-       crc = crc32(crc, data, length-4);
+       crc = crc32(crc, data, length - 4);
        if (crc != mac_data.crc) {
                return -1;
-       }
-       else {
-               for(i=0; i<4; i++) {
-                       if(memcmp(&mac_data.mac[i], "\0\0\0\0\0\0", 6)) {
-                               sprintf(ethaddr[i], "%02x:%02x:%02x:%02x:%02x:%02x", \
-                                       mac_data.mac[i][0], \
-                                       mac_data.mac[i][1], \
-                                       mac_data.mac[i][2], \
-                                       mac_data.mac[i][3], \
-                                       mac_data.mac[i][4], \
+       } else {
+               for (i = 0; i < 4; i++) {
+                       if (memcmp(&mac_data.mac[i], "\0\0\0\0\0\0", 6)) {
+                               sprintf(ethaddr[i],
+                                       "%02x:%02x:%02x:%02x:%02x:%02x",
+                                       mac_data.mac[i][0],
+                                       mac_data.mac[i][1],
+                                       mac_data.mac[i][2],
+                                       mac_data.mac[i][3],
+                                       mac_data.mac[i][4],
                                        mac_data.mac[i][5]);
-                               sprintf(enetvar, i ? "eth%daddr" : "ethaddr", i);
+                               sprintf(enetvar,
+                                       i ? "eth%daddr" : "ethaddr",
+                                       i);
                                setenv(enetvar, ethaddr[i]);
                        }
                }
        }
        return 0;
 }
-#endif  /* CFG_ID_EEPROM */
+#endif /* CFG_ID_EEPROM */