📄 embed_config.c
字号:
bd->bi_busfreq = 48000000;}#endif /* FADS */#ifdef CONFIG_8260/* Compute 8260 clock values if the rom doesn't provide them. * We can't compute the internal core frequency (I don't know how to * do that). */static voidclk_8260(bd_t *bd){ uint scmr, vco_out, clkin; uint plldf, pllmf, busdf, cpmdf; volatile cpm2_map_t *ip; ip = (cpm2_map_t *)CPM_MAP_ADDR; scmr = ip->im_clkrst.car_scmr; /* The clkin is always bus frequency. */ clkin = bd->bi_busfreq; /* Collect the bits from the scmr. */ plldf = (scmr >> 12) & 1; pllmf = scmr & 0xfff; cpmdf = (scmr >> 16) & 0x0f; busdf = (scmr >> 20) & 0x0f; /* This is arithmetic from the 8260 manual. */ vco_out = clkin / (plldf + 1); vco_out *= 2 * (pllmf + 1); bd->bi_vco = vco_out; /* Save for later */ bd->bi_cpmfreq = vco_out / 2; /* CPM Freq, in MHz */ /* Set Baud rate divisor. The power up default is divide by 16, * but we set it again here in case it was changed. */ ip->im_clkrst.car_sccr = 1; /* DIV 16 BRG */ bd->bi_brgfreq = vco_out / 16;}#endif#ifdef CONFIG_EST8260voidembed_config(bd_t **bdp){ u_char *cp; int i; bd_t *bd; bd = *bdp;#if 0 /* This is actually provided by my boot rom. I have it * here for those people that may load the kernel with * a JTAG/COP tool and not the rom monitor. */ bd->bi_baudrate = 115200; bd->bi_intfreq = 200000000; bd->bi_busfreq = 66666666; bd->bi_cpmfreq = 66666666; bd->bi_brgfreq = 33333333; bd->bi_memsize = 16 * 1024 * 1024;#else /* The boot rom passes these to us in MHz. Linux now expects * them to be in Hz. */ bd->bi_intfreq *= 1000000; bd->bi_busfreq *= 1000000; bd->bi_cpmfreq *= 1000000; bd->bi_brgfreq *= 1000000;#endif cp = (u_char *)def_enet_addr; for (i=0; i<6; i++) { bd->bi_enetaddr[i] = *cp++; }}#endif /* EST8260 */#ifdef CONFIG_SBS8260voidembed_config(bd_t **bdp){ u_char *cp; int i; bd_t *bd; /* This should provided by the boot rom. */ bd = &bdinfo; *bdp = bd; bd->bi_baudrate = 9600; bd->bi_memsize = 64 * 1024 * 1024; /* Set all of the clocks. We have to know the speed of the * external clock. The development board had 66 MHz. */ bd->bi_busfreq = 66666666; clk_8260(bd); /* I don't know how to compute this yet. */ bd->bi_intfreq = 133000000; cp = (u_char *)def_enet_addr; for (i=0; i<6; i++) { bd->bi_enetaddr[i] = *cp++; }}#endif /* SBS8260 */#ifdef CONFIG_RPX6voidembed_config(bd_t **bdp){ u_char *cp, *keyvals; bd_t *bd; keyvals = (u_char *)*bdp; bd = &bdinfo; *bdp = bd; /* This is almost identical to the RPX-Lite/Classic functions * on the 8xx boards. It would be nice to have a key lookup * function in a string, but the format of all of the fields * is slightly different. */ cp = keyvals; for (;;) { if (*cp == 'E') { cp++; if (*cp == 'A') { cp += 2; rpx_eth(bd, cp); } } if (*cp == 'S') { cp++; if (*cp == 'B') { cp += 2; bd->bi_baudrate = rpx_baseten(cp); } } if (*cp == 'D') { cp++; if (*cp == '1') { cp += 2; bd->bi_memsize = rpx_baseten(cp) * 1024 * 1024; } } if (*cp == 'X') { cp++; if (*cp == 'T') { cp += 2; bd->bi_busfreq = rpx_baseten(cp); } } if (*cp == 'N') { cp++; if (*cp == 'V') { cp += 2; bd->bi_nvsize = rpx_baseten(cp) * 1024 * 1024; } } /* Scan to the end of the record. */ while ((*cp != '\n') && (*cp != 0xff)) cp++; /* If the next character is a 0 or ff, we are done. */ cp++; if ((*cp == 0) || (*cp == 0xff)) break; } bd->bi_memstart = 0; /* The memory size includes both the 60x and local bus DRAM. * I don't want to use the local bus DRAM for real memory, * so subtract it out. It would be nice if they were separate * keys. */ bd->bi_memsize -= 32 * 1024 * 1024; /* Set all of the clocks. We have to know the speed of the * external clock. */ clk_8260(bd); /* I don't know how to compute this yet. */ bd->bi_intfreq = 200000000;}#endif /* RPX6 */#ifdef CONFIG_ADS8260voidembed_config(bd_t **bdp){ u_char *cp; int i; bd_t *bd; /* This should provided by the boot rom. */ bd = &bdinfo; *bdp = bd; bd->bi_baudrate = 9600; bd->bi_memsize = 16 * 1024 * 1024; /* Set all of the clocks. We have to know the speed of the * external clock. The development board had 66 MHz. */ bd->bi_busfreq = 66666666; clk_8260(bd); /* I don't know how to compute this yet. */ bd->bi_intfreq = 200000000; cp = (u_char *)def_enet_addr; for (i=0; i<6; i++) { bd->bi_enetaddr[i] = *cp++; }}#endif /* ADS8260 */#ifdef CONFIG_WILLOWvoidembed_config(bd_t **bdp){ u_char *cp; int i; bd_t *bd; /* Willow has Open Firmware....I should learn how to get this * information from it. */ bd = &bdinfo; *bdp = bd; bd->bi_baudrate = 9600; bd->bi_memsize = 32 * 1024 * 1024; /* Set all of the clocks. We have to know the speed of the * external clock. The development board had 66 MHz. */ bd->bi_busfreq = 66666666; clk_8260(bd); /* I don't know how to compute this yet. */ bd->bi_intfreq = 200000000; cp = (u_char *)def_enet_addr; for (i=0; i<6; i++) { bd->bi_enetaddr[i] = *cp++; }}#endif /* WILLOW */#ifdef CONFIG_IBM_OPENBIOS/* This could possibly work for all treeboot roms.*/#define BOARD_INFO_VECTOR 0xFFFE0B50voidembed_config(bd_t **bdp){ u_char *cp; int i; bd_t *bd, *treeboot_bd; bd_t *(*get_board_info)(void) = (bd_t *(*)(void))(*(unsigned long *)BOARD_INFO_VECTOR);#if !defined(CONFIG_STB03xxx) /* shut down the Ethernet controller that the boot rom * sometimes leaves running. */ mtdcr(DCRN_MALCR(DCRN_MAL_BASE), MALCR_MMSR); /* 1st reset MAL */ while (mfdcr(DCRN_MALCR(DCRN_MAL_BASE)) & MALCR_MMSR) {}; /* wait for the reset */ out_be32((u32 *)EMAC0_BASE, 0x20000000); /* then reset EMAC */ eieio();#endif bd = &bdinfo; *bdp = bd; if ((treeboot_bd = get_board_info()) != NULL) { memcpy(bd, treeboot_bd, sizeof(bd_t)); } else { /* Hmmm...better try to stuff some defaults. */ bd->bi_memsize = 16 * 1024 * 1024; cp = (u_char *)def_enet_addr; for (i=0; i<6; i++) { /* I should probably put different ones here, * hopefully only one is used. */ bd->BD_EMAC_ADDR(0,i) = *cp;#ifdef CONFIG_PCI bd->bi_pci_enetaddr[i] = *cp++;#endif } bd->bi_intfreq = 200000000; bd->bi_busfreq = 100000000;#ifdef CONFIG_PCI bd->bi_pci_busfreq = 66666666;#endif /* Yeah, this look weird, but on Redwood 4 they are * different object in the structure. When RW5 uses * OpenBIOS, it requires a special value. */#ifdef CONFIG_REDWOOD_5 bd->bi_intfreq = 200 * 1000 * 1000; bd->bi_busfreq = 0; bd->bi_tbfreq = 27 * 1000 * 1000;#elif CONFIG_REDWOOD_4 bd->bi_tbfreq = bd->bi_intfreq;#endif }}#endif#ifdef CONFIG_EP405voidembed_config(bd_t **bdp){ u_char *cp; bd_t *bd; bd = &bdinfo; *bdp = bd;#if 1 cp = (u_char *)0xF0000EE0; for (;;) { if (*cp == 'E') { cp++; if (*cp == 'A') { cp += 2; rpx_eth(bd, cp); } } if (*cp == 'D') { cp++; if (*cp == '1') { cp += 2; rpx_memsize(bd, cp); } } while ((*cp != '\n') && (*cp != 0xff)) cp++; cp++; if ((*cp == 0) || (*cp == 0xff)) break; } bd->bi_intfreq = 200000000; bd->bi_busfreq = 100000000; bd->bi_pci_busfreq= 33000000 ;#else bd->bi_memsize = 64000000; bd->bi_intfreq = 200000000; bd->bi_busfreq = 100000000; bd->bi_pci_busfreq= 33000000 ;#endif timebase_period_ns = 1000000000 / bd->bi_tbfreq;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -