static void __init ambarella_init_hyacinth(void)
{
	int i;

	ambarella_init_machine("Hyacinth_0");

#ifdef CONFIG_OUTER_CACHE
	ambcache_l2_enable();
#endif
	/* Config ETH */
	ambarella_eth0_platform_info.mii_id = 0;
	ambarella_eth0_platform_info.phy_id = 0x001cc915;
	ambarella_eth0_platform_info.default_tx_ring_size = 128;
	ambarella_eth0_platform_info.default_rx_ring_size = 64;
	ambarella_eth0_platform_info.default_dma_opmode |= ETH_DMA_OPMODE_TSF;

	if (AMBARELLA_BOARD_TYPE(system_rev) == AMBARELLA_BOARD_TYPE_VENDOR) {

		int rev = AMBARELLA_BOARD_REV(system_rev);
		int vendor = (rev & 0xff0) >> 4;
		int board = rev & 0xf;

		printk("Hyacinth_0: vendor 0x%02x, board 0x%01x\n", vendor, board);

		switch (vendor) {
		case 0x48:
		    platform_device_register(&ambarella_uart2);

		    /* Phy-less, fixed-link */
		    ambarella_eth0_platform_info.mii_fixed_speed = SPEED_1000;
		    ambarella_eth0_platform_info.mii_fixed_duplex = DUPLEX_FULL;
		    break;

		case 0x4D:
		    platform_device_register(&ambarella_uart2);
		    platform_device_register(&ambarella_uart3);
		    break;

		default:
		    break;
		}
	}
Example #2
0
/* ==========================================================================*/
static void __init ambarella_init_boss(void)
{
	int					i;
	int					use_bub_default = 1;
	int					wm8994_inited = 0;
	ambarella_init_machine("Boss");
	if (AMBARELLA_BOARD_TYPE(system_rev) == AMBARELLA_BOARD_TYPE_EVK) {
		switch (AMBARELLA_BOARD_REV(system_rev)) {
			case 'C':
				wm8994_inited = 1;
			case 'B':
#if !defined(CONFIG_AMBARELLA_IPC)
				ambarella_platform_sd_controller1.slot[0].ext_power.gpio_id = GPIO(111);
#endif
				ambarella_platform_sd_controller1.slot[0].ext_power.active_level = GPIO_HIGH;
				ambarella_platform_sd_controller1.slot[0].ext_power.active_delay = 300;
				if(0 == wm8994_inited) {
					/* the cs_pin of spi0.1 is used to determine wm8994's
					 * I2C address, and the cs_pin of spi0.4, spi0,5, spi0.6
					 * spi0.7 are used as I2S signals, so we need to prevent
					 * them from be modified by SPI driver */
					ambarella_spi0_cs_pins[1] = -1;
					ambarella_spi0_cs_pins[4] = -1;
					ambarella_spi0_cs_pins[5] = -1;
					ambarella_spi0_cs_pins[6] = -1;
					ambarella_spi0_cs_pins[7] = -1;
					ambarella_init_wm8994();
				}
			case 'A':
				ambarella_board_generic.touch_panel_irq.irq_gpio = GPIO(44);
				ambarella_board_generic.touch_panel_irq.irq_line = gpio_to_irq(44);
				ambarella_board_generic.touch_panel_irq.irq_type = IRQF_TRIGGER_FALLING;
				ambarella_board_generic.touch_panel_irq.irq_gpio_val = GPIO_LOW;
				ambarella_board_generic.touch_panel_irq.irq_gpio_mode = GPIO_FUNC_SW_INPUT;

				ambarella_board_generic.wifi_power.gpio_id = GPIO(109);
				ambarella_board_generic.wifi_power.active_level = GPIO_HIGH;
				ambarella_board_generic.wifi_power.active_delay = 300;
				ambarella_board_generic.wifi_sd_bus = 0;
				ambarella_board_generic.wifi_sd_slot = 1;

				ambarella_board_generic.pmic_irq.irq_gpio = GPIO(54);
				ambarella_board_generic.pmic_irq.irq_line = gpio_to_irq(54);
				ambarella_board_generic.pmic_irq.irq_type = IRQF_TRIGGER_FALLING;
				ambarella_board_generic.pmic_irq.irq_gpio_val = GPIO_LOW;
				ambarella_board_generic.pmic_irq.irq_gpio_mode = GPIO_FUNC_SW_INPUT;

				ambarella_board_generic.power_control.gpio_id = GPIO(120);
				ambarella_board_generic.power_control.active_level = GPIO_LOW;

				memcpy(ambarella_spi_devices[12].modalias, "wm8310", 6);
				ambarella_spi_devices[12].max_speed_hz = 500000;
				ambarella_spi_devices[12].platform_data = &boss_wm8310_pdata;

				ambarella_platform_sd_controller0.clk_limit = 24000000;
				ambarella_platform_sd_controller0.slot[0].use_bounce_buffer = 1;
				ambarella_platform_sd_controller0.slot[0].max_blk_sz = SD_BLK_SZ_128KB;
				ambarella_platform_sd_controller0.slot[0].cd_delay = 100;
				ambarella_platform_sd_controller0.slot[0].fixed_cd = 0;
				ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_gpio = -1;
				ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_line = -1;
				ambarella_platform_sd_controller0.slot[0].fixed_wp = 0;
				ambarella_platform_sd_controller0.slot[0].gpio_wp.gpio_id = -1;
				ambarella_platform_sd_controller0.slot[0].ext_power.gpio_id = GPIO(157);
				ambarella_platform_sd_controller0.slot[0].ext_power.active_level = GPIO_HIGH;
				ambarella_platform_sd_controller0.slot[0].ext_power.active_delay = 300;
				ambarella_platform_sd_controller0.slot[1].use_bounce_buffer = 1;
				ambarella_platform_sd_controller0.slot[1].max_blk_sz = SD_BLK_SZ_128KB;
				ambarella_platform_sd_controller0.slot[1].cd_delay = 100;
				ambarella_platform_sd_controller0.slot[1].fixed_cd = 0;
				ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_gpio = -1;
				ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_line = -1;
				ambarella_platform_sd_controller0.slot[1].fixed_wp = 0;
				ambarella_platform_sd_controller0.slot[1].gpio_wp.gpio_id = -1;
				ambarella_platform_sd_controller1.clk_limit = 25000000;
				ambarella_platform_sd_controller1.slot[0].cd_delay = 100;
				ambarella_platform_sd_controller1.slot[0].use_bounce_buffer = 1;
				ambarella_platform_sd_controller1.slot[0].max_blk_sz = SD_BLK_SZ_128KB;
				ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_gpio = GPIO(129);
				ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_line = gpio_to_irq(129);
				ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_type = IRQ_TYPE_EDGE_BOTH;
				ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_gpio_val  = GPIO_LOW,
				ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_gpio_mode = GPIO_FUNC_SW_INPUT,
				ambarella_platform_sd_controller1.slot[0].gpio_wp.gpio_id = GPIO(128);

				boss_board_input_info.pkeymap = boss_keymap_evk;
				ambarella_tm1726_board_info.irq = ambarella_board_generic.touch_panel_irq.irq_line;
				i2c_register_board_info(2, &ambarella_tm1726_board_info, 1);

				use_bub_default = 0;
				break;
			default:
				pr_warn("%s: Unknown EVK Rev[%d]\n", __func__, AMBARELLA_BOARD_REV(system_rev));
				break;
		}
		platform_add_devices(ambarella_devices, ARRAY_SIZE(ambarella_devices));
		for (i = 0; i < ARRAY_SIZE(ambarella_devices); i++) {
			device_set_wakeup_capable(&ambarella_devices[i]->dev, 1);
			device_set_wakeup_enable(&ambarella_devices[i]->dev, 0);
		}
	}

	if (use_bub_default) {
		/* Config SD*/
		ambarella_platform_sd_controller0.clk_limit = 25000000;
		ambarella_platform_sd_controller0.slot[0].use_bounce_buffer = 1;
		ambarella_platform_sd_controller0.slot[0].max_blk_sz = SD_BLK_SZ_128KB;
		ambarella_platform_sd_controller0.slot[0].cd_delay = 1000;
		ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_gpio = GPIO(67);
		ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_line = gpio_to_irq(67);
		ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_type = IRQ_TYPE_EDGE_BOTH;
		ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_gpio_val	= GPIO_LOW,
		ambarella_platform_sd_controller0.slot[0].gpio_cd.irq_gpio_mode	= GPIO_FUNC_SW_INPUT,
		ambarella_platform_sd_controller0.slot[0].gpio_wp.gpio_id = GPIO(68);
		ambarella_platform_sd_controller0.slot[1].use_bounce_buffer = 1;
		ambarella_platform_sd_controller0.slot[1].max_blk_sz = SD_BLK_SZ_128KB;
		ambarella_platform_sd_controller0.slot[1].cd_delay = 1000;
		ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_gpio = GPIO(75);
		ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_line = gpio_to_irq(75);
		ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_type = IRQ_TYPE_EDGE_BOTH;
		ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_gpio_val	= GPIO_LOW,
		ambarella_platform_sd_controller0.slot[1].gpio_cd.irq_gpio_mode	= GPIO_FUNC_SW_INPUT,
		ambarella_platform_sd_controller0.slot[1].gpio_wp.gpio_id = GPIO(76);
		ambarella_platform_sd_controller1.clk_limit = 25000000;
		ambarella_platform_sd_controller1.slot[0].cd_delay = 100;
		ambarella_platform_sd_controller1.slot[0].use_bounce_buffer = 1;
		ambarella_platform_sd_controller1.slot[0].max_blk_sz = SD_BLK_SZ_128KB;
#if !defined(CONFIG_AMBARELLA_IPC)
		ambarella_platform_sd_controller1.slot[0].ext_power.gpio_id = GPIO(106);
#endif
		ambarella_platform_sd_controller1.slot[0].ext_power.active_level = GPIO_HIGH;
		ambarella_platform_sd_controller1.slot[0].ext_power.active_delay = 300;
		ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_gpio = GPIO(129);
		ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_line = gpio_to_irq(129);
		ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_type = IRQ_TYPE_EDGE_BOTH;
		ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_gpio_val	= GPIO_LOW,
		ambarella_platform_sd_controller1.slot[0].gpio_cd.irq_gpio_mode	= GPIO_FUNC_SW_INPUT,
		ambarella_platform_sd_controller1.slot[0].gpio_wp.gpio_id = GPIO(128);
#if defined(CONFIG_AMBARELLA_IPC)
		ambarella_platform_sd_controller0.slot[0].caps |= MMC_CAP_8_BIT_DATA;
		ambarella_platform_sd_controller1.slot[0].caps |= MMC_CAP_8_BIT_DATA;

		ambarella_platform_sd_controller0.slot[0].caps |= MMC_CAP_BUS_WIDTH_TEST;
		ambarella_platform_sd_controller0.slot[1].caps |= MMC_CAP_BUS_WIDTH_TEST;
		ambarella_platform_sd_controller1.slot[0].caps |= MMC_CAP_BUS_WIDTH_TEST;
#endif

		platform_add_devices(ambarella_devices, ARRAY_SIZE(ambarella_devices));
		for (i = 0; i < ARRAY_SIZE(ambarella_devices); i++) {
			device_set_wakeup_capable(&ambarella_devices[i]->dev, 1);
			device_set_wakeup_enable(&ambarella_devices[i]->dev, 0);
		}
	}
	spi_register_board_info(ambarella_spi_devices, ARRAY_SIZE(ambarella_spi_devices));
	platform_device_register(&boss_board_input);
	platform_device_register(&boss_bt_rfkill);  // for BT
}