static int board_dp_fill_gpios(const void *blob) { int np, ret, rev; np = fdtdec_next_compatible(blob, 0, COMPAT_NXP_PTN3460); if (np < 0) { debug("%s: Could not find COMPAT_NXP_PTN3460 (%d)\n", __func__, ret); return np; } ret = fdtdec_decode_gpio(blob, np, "powerdown-gpio", &local.dp_pd); if (ret) { debug("%s: Could not decode powerdown-gpio (%d)\n", __func__, ret); return ret; } ret = fdtdec_decode_gpio(blob, np, "reset-gpio", &local.dp_rst); if (ret) { debug("%s: Could not decode reset-gpio (%d)\n", __func__, ret); return ret; } ret = fdtdec_decode_gpio(blob, np, "hotplug-gpio", &local.dp_hpd); if (ret) { debug("%s: Could not decode hotplug (%d)\n", __func__, ret); return ret; } /* If board is older, replace pd gpio with rst gpio */ rev = board_get_revision(); if (rev >= 4 && rev != 6) { local.dp_pd = local.dp_rst; local.dp_rst.gpio = FDT_GPIO_NONE; } return 0; }
int checkboard(void) { #ifdef CONFIG_OF_CONTROL const char *board_name; board_name = fdt_getprop(gd->fdt_blob, 0, "model", NULL); printf("\nBoard: %s, rev %d\n", board_name ? board_name : "<unknown>", board_get_revision()); #else printf("\nBoard: SMDK5250\n"); #endif return 0; }
/** * Fix-up the kernel device tree so the bridge pd_n and rst_n gpios accurately * reflect the current board rev. */ static void ft_board_setup_gpios(void *blob, bd_t *bd) { int ret, rev, np, len; const struct fdt_property *prop; /* Do nothing for newer boards */ rev = board_get_revision(); if (rev < 4 || rev == 6) return; /* * If this is an older board, replace powerdown-gpio contents with that * of reset-gpio and delete reset-gpio from the dt. */ np = fdtdec_next_compatible(blob, 0, COMPAT_NXP_PTN3460); if (np < 0) { debug("%s: Could not find COMPAT_NXP_PTN3460\n", __func__); return; } prop = fdt_get_property(blob, np, "reset-gpio", &len); if (!prop) { debug("%s: Could not get property err=%d\n", __func__, len); return; } ret = fdt_setprop_inplace(blob, np, "powerdown-gpio", prop->data, len); if (ret) { debug("%s: Could not setprop inplace err=%d\n", __func__, ret); return; } ret = fdt_delprop(blob, np, "reset-gpio"); if (ret) { debug("%s: Could not delprop err=%d\n", __func__, ret); return; } }
/* * ip7160rgw_init * Called to add the devices which we have on this board */ static int __init ip7160rgw_init(void) { board_init(); /* * Rev 1.2 boards have spi in a different place than 1.1/1.0 */ if (strcmp(board_get_revision(), "1.2") == 0) { ip7160rgw_spi_gpio_data.pin_mosi = GPIO_RD_7; } ubi_gpio_init(); /* * Reserve switch SPI CS on behalf on switch driver */ if (gpio_request(ip7160rgw_bcm539x_controller_data.pin_cs, "switch-bcm539x-cs")) { printk(KERN_WARNING "Could not request cs of switch SPI I/F\n"); return -EIO; } gpio_direction_output(ip7160rgw_bcm539x_controller_data.pin_cs, 1); printk(KERN_INFO "%s: registering device resources\n", __FUNCTION__); platform_add_devices(ip7160rgw_devices, ARRAY_SIZE(ip7160rgw_devices)); printk(KERN_INFO "%s: registering SPI resources\n", __FUNCTION__); spi_register_board_info(ip7160rgw_spi_board_info, ARRAY_SIZE(ip7160rgw_spi_board_info)); #ifdef CONFIG_IP7160RGWLCD printk(KERN_INFO "%s: registering i2c resources\n", __FUNCTION__); i2c_register_board_info(0, ip7160rgwlcd_i2c_board_info, ARRAY_SIZE(ip7160rgwlcd_i2c_board_info)); printk(KERN_INFO "IP7160 RGW + LCD\n"); #else printk(KERN_INFO "IP7160 RGW\n"); #endif return 0; }
/** * Fix-up the kernel device tree so the powered-while-resumed is added to MP * device tree. */ static void ft_board_setup_tpm_resume(void *blob, bd_t *bd) { const char kernel_tpm_compat[] = "infineon,slb9635tt"; const char prop_name[] = "powered-while-suspended"; int err, node, rev; /* Only apply fixup to MP machine */ rev = board_get_revision(); if (!(rev == 0 || rev == 3)) return; node = fdt_node_offset_by_compatible(blob, 0, kernel_tpm_compat); if (node < 0) { debug("%s: fail to find %s: %d\n", __func__, kernel_tpm_compat, node); return; } err = fdt_setprop(blob, node, prop_name, NULL, 0); if (err) { debug("%s: fail to setprop: %d\n", __func__, err); return; } }