示例#1
0
文件: common.c 项目: 274914765/C
int __init oprofile_arch_init(struct oprofile_operations *ops)
{
#ifdef CONFIG_HARDWARE_PM
    unsigned int dspid;

    mutex_init(&pfmon_lock);

    dspid = bfin_read_DSPID();

    printk(KERN_INFO "Oprofile got the cpu id is 0x%x. \n", dspid);

    switch (dspid) {
    case BFIN_533_ID:
        model = &op_model_bfin533;
        model->num_counters = 2;
        break;
    case BFIN_537_ID:
        model = &op_model_bfin533;
        model->num_counters = 2;
        break;
    default:
        return -ENODEV;
    }

    ops->cpu_type = model->name;
    ops->create_files = op_bfin_create_files;
    ops->setup = op_bfin_setup;
    ops->shutdown = op_bfin_shutdown;
    ops->start = op_bfin_start;
    ops->stop = op_bfin_stop;

    printk(KERN_INFO "oprofile: using %s performance monitoring.\n",
           ops->cpu_type);

    return 0;
#else
    return -1;
#endif
}
示例#2
0
/* Board Init  function --------------------------------------------------------------------------------------- */
static int __init ip0x_init(void)
{
        u_int i, j;

        printk(KERN_INFO "%s(): chip_id=%08lX,dspid=%08X\n", __FUNCTION__, *((volatile unsigned long *)CHIPID), bfin_read_DSPID());

	printk(KERN_INFO "%s(): registering device resources\n", __FUNCTION__);
	bfin_plat_nand_init();
	platform_add_devices(ip0x_devices, ARRAY_SIZE(ip0x_devices));
#if defined(CONFIG_SPI_BFIN) || defined(CONFIG_SPI_BFIN_MODULE)
        for (i = 0; i < ARRAY_SIZE(bfin_spi_board_info); i ++) {
               j = 1 << bfin_spi_board_info [i]. chip_select;
               // set spi cs to 1
               bfin_write_FIO_DIR (bfin_read_FIO_DIR() | j);
               bfin_write_FIO_FLAG_S (j);
        }
	spi_register_board_info(bfin_spi_board_info, ARRAY_SIZE(bfin_spi_board_info));
#endif
	return 0;
}