nrhw20: cleanup board file
This commit is contained in:
parent
6613d7ce9c
commit
7406ebe7fe
|
|
@ -144,6 +144,7 @@ static struct ctrl_dev *cdev = (struct ctrl_dev *)CTRL_DEVICE_BASE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#define I2C_BD_EEPROM_BUS (2)
|
||||||
#define BD_EEPROM_ADDR (0x50) /* CPU BD EEPROM (8kByte) is at 50 (A0) */
|
#define BD_EEPROM_ADDR (0x50) /* CPU BD EEPROM (8kByte) is at 50 (A0) */
|
||||||
#define BD_ADDRESS (0x0000) /* Board descriptor at beginning of EEPROM */
|
#define BD_ADDRESS (0x0000) /* Board descriptor at beginning of EEPROM */
|
||||||
#define PD_ADDRESS (0x0200) /* Product descriptor */
|
#define PD_ADDRESS (0x0200) /* Product descriptor */
|
||||||
|
|
@ -159,9 +160,8 @@ static int _bd_init(void)
|
||||||
{
|
{
|
||||||
int old_bus;
|
int old_bus;
|
||||||
|
|
||||||
/* TODO: Use a define for bus number */
|
|
||||||
old_bus = i2c_get_bus_num();
|
old_bus = i2c_get_bus_num();
|
||||||
i2c_set_bus_num(2);
|
i2c_set_bus_num(I2C_BD_EEPROM_BUS);
|
||||||
|
|
||||||
if (bd_get_context(&bdctx[0], BD_EEPROM_ADDR, BD_ADDRESS) != 0) {
|
if (bd_get_context(&bdctx[0], BD_EEPROM_ADDR, BD_ADDRESS) != 0) {
|
||||||
printf("%s() no valid bd found\n", __func__);
|
printf("%s() no valid bd found\n", __func__);
|
||||||
|
|
@ -215,6 +215,7 @@ static void set_indicator(unsigned led, int red, int green)
|
||||||
|
|
||||||
if (!red)
|
if (!red)
|
||||||
led_val |= led_red_mask;
|
led_val |= led_red_mask;
|
||||||
|
|
||||||
if (!green)
|
if (!green)
|
||||||
led_val |= led_green_mask;
|
led_val |= led_green_mask;
|
||||||
|
|
||||||
|
|
@ -283,9 +284,9 @@ static struct emif_regs ddr3_emif_reg_data = {
|
||||||
|
|
||||||
#define OSC (V_OSCK/1000000)
|
#define OSC (V_OSCK/1000000)
|
||||||
|
|
||||||
/* TODO: Rename */
|
struct dpll_params dpll_ddr_nrhw20 = {
|
||||||
struct dpll_params dpll_ddr_nbhw16= {
|
DDR3_CLOCK_FREQUENCY, OSC-1, 1, -1, -1, -1, -1
|
||||||
DDR3_CLOCK_FREQUENCY, OSC-1, 1, -1, -1, -1, -1};
|
};
|
||||||
|
|
||||||
|
|
||||||
void am33xx_spl_board_init(void)
|
void am33xx_spl_board_init(void)
|
||||||
|
|
@ -317,8 +318,8 @@ void am33xx_spl_board_init(void)
|
||||||
|
|
||||||
const struct dpll_params *get_dpll_ddr_params(void)
|
const struct dpll_params *get_dpll_ddr_params(void)
|
||||||
{
|
{
|
||||||
dpll_ddr_nbhw16.n = (get_osclk() / 1000000) - 1;
|
dpll_ddr_nrhw20.n = (get_osclk() / 1000000) - 1;
|
||||||
return &dpll_ddr_nbhw16;
|
return &dpll_ddr_nrhw20;
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_uart_mux_conf(void)
|
void set_uart_mux_conf(void)
|
||||||
|
|
@ -673,15 +674,6 @@ int board_init(void)
|
||||||
mdelay(1200);
|
mdelay(1200);
|
||||||
gpio_set_value(NETBIRD_GPIO_PWR_GSM, 0);
|
gpio_set_value(NETBIRD_GPIO_PWR_GSM, 0);
|
||||||
|
|
||||||
#if 0
|
|
||||||
/* TODO: Move to pinmux? Required??? RMII2 not used! */
|
|
||||||
/* There are two functions on the same mux mode for MMC2_DAT7 we want
|
|
||||||
* to use RMII2_CRS_DV so we need to set SMA2 Register to 1
|
|
||||||
* See SPRS717J site 49 (10)*/
|
|
||||||
#define SMA2_REGISTER (CTRL_BASE + 0x1320)
|
|
||||||
writel(0x01, SMA2_REGISTER); /* Select RMII2_CRS_DV instead of MMC2_DAT7 */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
printf("OSC: %lu MHz\n", get_osclk()/1000000);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -727,8 +719,7 @@ static void set_devicetree_name(void)
|
||||||
|
|
||||||
/* add hardware versions to environment */
|
/* add hardware versions to environment */
|
||||||
if (bd_get_devicetree(devicetreename, sizeof(devicetreename)) != 0) {
|
if (bd_get_devicetree(devicetreename, sizeof(devicetreename)) != 0) {
|
||||||
printf("Devicetree name not found, using legacy name\n");
|
printf("Devicetree name not found, using default name\n");
|
||||||
/* TODO: Check naming convention */
|
|
||||||
strcpy(devicetreename, "am335x-nrhw20-prod1.dtb");
|
strcpy(devicetreename, "am335x-nrhw20-prod1.dtb");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -739,12 +730,12 @@ static void get_hw_version(void)
|
||||||
{
|
{
|
||||||
int hw_ver, hw_rev;
|
int hw_ver, hw_rev;
|
||||||
char hw_versions[16];
|
char hw_versions[16];
|
||||||
char new_env[256]; /* TODO: Check size, have also seen 512 */
|
char new_env[256]; /* current bootargs = 84 bytes */
|
||||||
|
|
||||||
/* add hardware versions to environment */
|
|
||||||
bd_get_hw_version(&hw_ver, &hw_rev);
|
bd_get_hw_version(&hw_ver, &hw_rev);
|
||||||
printf("HW20: V%d.%d\n", hw_ver, hw_rev);
|
printf("HW20: V%d.%d\n", hw_ver, hw_rev);
|
||||||
|
|
||||||
|
/* add hardware versions to environment */
|
||||||
snprintf(hw_versions, sizeof(hw_versions), "CP=%d.%d", hw_ver, hw_rev);
|
snprintf(hw_versions, sizeof(hw_versions), "CP=%d.%d", hw_ver, hw_rev);
|
||||||
snprintf(new_env, sizeof(new_env), "setenv bootargs $bootargs %s", hw_versions);
|
snprintf(new_env, sizeof(new_env), "setenv bootargs $bootargs %s", hw_versions);
|
||||||
setenv("add_version_bootargs", new_env);
|
setenv("add_version_bootargs", new_env);
|
||||||
|
|
@ -757,14 +748,21 @@ static void check_fct(void)
|
||||||
* Clear the bootcmd, so that test system can easily connect.
|
* Clear the bootcmd, so that test system can easily connect.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
int old_bus;
|
||||||
|
|
||||||
|
old_bus = i2c_get_bus_num();
|
||||||
|
i2c_set_bus_num(I2C_BD_EEPROM_BUS);
|
||||||
|
|
||||||
/* If probe fails we are sure no eeprom is connected */
|
/* If probe fails we are sure no eeprom is connected */
|
||||||
if (i2c_probe(0x51) == 0) {
|
if (i2c_probe(0x51) == 0) {
|
||||||
printf("Entering fct mode\n");
|
printf("Entering fct mode\n");
|
||||||
setenv ("bootcmd", "");
|
setenv ("bootcmd", "");
|
||||||
}
|
}
|
||||||
/* TODO: needs to test on bus 2 ! */
|
|
||||||
|
i2c_set_bus_num(old_bus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void set_fdtshieldcmd(const char *fdt_cmd)
|
static void set_fdtshieldcmd(const char *fdt_cmd)
|
||||||
{
|
{
|
||||||
setenv("fdtshieldcmd", fdt_cmd);
|
setenv("fdtshieldcmd", fdt_cmd);
|
||||||
|
|
@ -838,8 +836,9 @@ static void shield_config(void)
|
||||||
cmd->init();
|
cmd->init();
|
||||||
shieldcmd = cmd->default_shieldcmd;
|
shieldcmd = cmd->default_shieldcmd;
|
||||||
|
|
||||||
/* If a shield configuration set by linux take it without bd check, we asume that Linux knows
|
/* If a shield configuration is set by Linux, take it without bd check.
|
||||||
* what to do. */
|
* We asume that Linux knows what to do.
|
||||||
|
*/
|
||||||
len = read_file("/root/boot/shieldcmd", shieldcmd_linux, MAX_SHIELD_CMD_LEN);
|
len = read_file("/root/boot/shieldcmd", shieldcmd_linux, MAX_SHIELD_CMD_LEN);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
debug("Shield command found in file, using it\n");
|
debug("Shield command found in file, using it\n");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue