add support for gigaset SX76X to uboot-lantiq
[openwrt.git] / package / uboot-lantiq / files / board / infineon / easy50712 / danube.c
index f9b2b76..51b7577 100644 (file)
@@ -180,6 +180,7 @@ int checkboard (void)
        switch (part_num)
        {
        case 0x129:
        switch (part_num)
        {
        case 0x129:
+       case 0x12B:
        case 0x12D:
                puts("Danube/Twinpass/Vinax-VE ");
                break;
        case 0x12D:
                puts("Danube/Twinpass/Vinax-VE ");
                break;
@@ -233,6 +234,19 @@ static int external_switch_init(void)
        unsigned short chipid0=0xdead, chipid1=0xbeef;
        static char * const name = "lq_cpe_eth";
 
        unsigned short chipid0=0xdead, chipid1=0xbeef;
        static char * const name = "lq_cpe_eth";
 
+#ifdef CONFIG_SWITCH_PORT0
+       *DANUBE_GPIO_P0_ALTSEL0 &= ~(1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P0_ALTSEL1 &= ~(1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P0_OD |= (1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P0_DIR |= (1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P0_OUT |= (1<<CONFIG_SWITCH_PIN);
+#elif defined(CONFIG_SWITCH_PORT1)
+       *DANUBE_GPIO_P1_ALTSEL0 &= ~(1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P1_ALTSEL1 &= ~(1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P1_OD |= (1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P1_DIR |= (1<<CONFIG_SWITCH_PIN);
+       *DANUBE_GPIO_P1_OUT |= (1<<CONFIG_SWITCH_PIN);
+#endif
 #ifdef CLK_OUT2_25MHZ
        *DANUBE_GPIO_P0_DIR=0x0000ae78;
        *DANUBE_GPIO_P0_ALTSEL0=0x00008078;
 #ifdef CLK_OUT2_25MHZ
        *DANUBE_GPIO_P0_DIR=0x0000ae78;
        *DANUBE_GPIO_P0_ALTSEL0=0x00008078;
@@ -245,12 +259,12 @@ static int external_switch_init(void)
        /* earlier no valid response is available, at least on Twinpass & Tantos @ 111MHz, M4530 platform */
        udelay(100000);
 
        /* earlier no valid response is available, at least on Twinpass & Tantos @ 111MHz, M4530 platform */
        udelay(100000);
 
-       debug("\nsearching for Samurai switch ... ");
+       printf("\nsearching for Samurai switch ... ");
        if ( (miiphy_read(name, PHYADDR(SAMURAI_ID_REG0), &chipid0)==0) &&
             (miiphy_read(name, PHYADDR(SAMURAI_ID_REG1), &chipid1)==0) ) {
                if (((chipid0 & 0xFFF0) == ID_SAMURAI_0) &&
                    ((chipid1 & 0x000F) == ID_SAMURAI_1)) {
        if ( (miiphy_read(name, PHYADDR(SAMURAI_ID_REG0), &chipid0)==0) &&
             (miiphy_read(name, PHYADDR(SAMURAI_ID_REG1), &chipid1)==0) ) {
                if (((chipid0 & 0xFFF0) == ID_SAMURAI_0) &&
                    ((chipid1 & 0x000F) == ID_SAMURAI_1)) {
-                       debug("found");
+                       printf("found");
 
                        /* enable "Crossover Auto Detect" + defaults */
                        /* P0 */
 
                        /* enable "Crossover Auto Detect" + defaults */
                        /* P0 */
@@ -274,10 +288,11 @@ static int external_switch_init(void)
                }
        }
 
                }
        }
 
-       debug("\nsearching for TANTOS switch ... ");
+       printf("%04X %04x\n", chipid0, chipid1);
+       printf("\nsearching for TANTOS switch ... ");
        if (miiphy_read(name, PHYADDR(0x101), &chipid0) == 0) {
                if (chipid0 == ID_TANTOS) {
        if (miiphy_read(name, PHYADDR(0x101), &chipid0) == 0) {
                if (chipid0 == ID_TANTOS) {
-                       debug("found");
+                       printf("found");
 
                        /* P5 Basic Control: Force Link Up */
                        miiphy_write(name, PHYADDR(0xA1), 0x0004);
 
                        /* P5 Basic Control: Force Link Up */
                        miiphy_write(name, PHYADDR(0xA1), 0x0004);
@@ -315,8 +330,36 @@ static int external_switch_init(void)
 }
 #endif /* CONFIG_EXTRA_SWITCH */
 
 }
 #endif /* CONFIG_EXTRA_SWITCH */
 
+int board_gpio_init(void)
+{
+#ifdef CONFIG_BUTTON_PORT0
+       *DANUBE_GPIO_P0_ALTSEL0 &= ~(1<<CONFIG_BUTTON_PIN);
+       *DANUBE_GPIO_P0_ALTSEL1 &= ~(1<<CONFIG_BUTTON_PIN);
+       *DANUBE_GPIO_P0_DIR &= ~(1<<CONFIG_BUTTON_PIN);
+       if(!!(*DANUBE_GPIO_P0_IN & (1<<CONFIG_BUTTON_PIN)) == CONFIG_BUTTON_LEVEL)
+       {
+               printf("button is pressed\n");
+               setenv("bootdelay", "0");
+               setenv("bootcmd", "httpd");
+       }
+#elif defined(CONFIG_BUTTON_PORT1)
+       *DANUBE_GPIO_P1_ALTSEL0 &= ~(1<<CONFIG_BUTTON_PIN);
+       *DANUBE_GPIO_P1_ALTSEL1 &= ~(1<<CONFIG_BUTTON_PIN);
+       *DANUBE_GPIO_P1_DIR &= ~(1<<CONFIG_BUTTON_PIN);
+       if(!!(*DANUBE_GPIO_P1_IN & (1<<CONFIG_BUTTON_PIN)) == CONFIG_BUTTON_LEVEL)
+       {
+               printf("button is pressed\n");
+               setenv("bootdelay", "0");
+               setenv("bootcmd", "httpd");
+       }
+#endif
+}
+
 int board_eth_init(bd_t *bis)
 {
 int board_eth_init(bd_t *bis)
 {
+
+       board_gpio_init();
+
 #if defined(CONFIG_IFX_ETOP)
 
        *DANUBE_PMU_PWDCR &= 0xFFFFEFDF;
 #if defined(CONFIG_IFX_ETOP)
 
        *DANUBE_PMU_PWDCR &= 0xFFFFEFDF;
@@ -340,69 +383,22 @@ int board_eth_init(bd_t *bis)
 }
 
 #if defined(CONFIG_CMD_HTTPD)
 }
 
 #if defined(CONFIG_CMD_HTTPD)
-static int image_info (ulong addr)
-{
-   void *hdr = (void *)addr;
-
-   printf ("\n## Checking Image at %08lx ...\n", addr);
-
-   switch (genimg_get_format (hdr)) {
-   case IMAGE_FORMAT_LEGACY:
-      puts ("   Legacy image found\n");
-      if (!image_check_magic (hdr)) {
-         puts ("   Bad Magic Number\n");
-         return 1;
-      }
-
-      if (!image_check_hcrc (hdr)) {
-         puts ("   Bad Header Checksum\n");
-         return 1;
-      }
-
-      image_print_contents (hdr);
-
-      puts ("   Verifying Checksum ... ");
-      if (!image_check_dcrc (hdr)) {
-         puts ("   Bad Data CRC\n");
-         return 1;
-      }
-      puts ("OK\n");
-      return 0;
-#if defined(CONFIG_FIT)
-   case IMAGE_FORMAT_FIT:
-      puts ("   FIT image found\n");
-
-      if (!fit_check_format (hdr)) {
-         puts ("Bad FIT image format!\n");
-         return 1;
-      }
-
-      fit_print_contents (hdr);
-
-      if (!fit_all_image_check_hashes (hdr)) {
-         puts ("Bad hash in FIT image!\n");
-         return 1;
-      }
-
-      return 0;
-#endif
-   default:
-      puts ("Unknown image format!\n");
-      break;
-   }
-
-   return 1;
-}
-
 int do_http_upgrade(const unsigned char *data, const ulong size)
 {
 int do_http_upgrade(const unsigned char *data, const ulong size)
 {
+       char buf[128];
+
+       if(getenv ("ram_addr") == NULL)
+               return -1;
+       if(getenv ("kernel_addr") == NULL)
+               return -1;
        /* check the image */
        /* check the image */
-       if(image_info(data)) {
+       if(run_command("imi ${ram_addr}", 0) < 0) {
                return -1;
        }
        /* write the image to the flash */
        puts("http ugrade ...\n");
                return -1;
        }
        /* write the image to the flash */
        puts("http ugrade ...\n");
-       return 0;
+       sprintf(buf, "era ${kernel_addr} +0x%x; cp.b ${ram_addr} ${kernel_addr} 0x%x", size, size);
+       return run_command(buf, 0);
 }
 
 int do_http_progress(const int state)
 }
 
 int do_http_progress(const int state)
@@ -413,6 +409,7 @@ int do_http_progress(const int state)
                puts("http start\n");
                break;
                case HTTP_PROGRESS_TIMEOUT:
                puts("http start\n");
                break;
                case HTTP_PROGRESS_TIMEOUT:
+               puts(".");
                break;
                case HTTP_PROGRESS_UPLOAD_READY:
                puts("http upload ready\n");
                break;
                case HTTP_PROGRESS_UPLOAD_READY:
                puts("http upload ready\n");
This page took 0.028128 seconds and 4 git commands to generate.