Пример #1
0
static int __devexit snd_stm_stih415_remove(struct platform_device *pdev)
{
	dev_dbg(&pdev->dev, "%s()", __func__);

	sysconf_release(snd_stm_stih415_pcmp_valid_sel);
	sysconf_release(snd_stm_stih415_voip);
	sysconf_release(snd_stm_stih415_biphase_idle_value);
	sysconf_release(snd_stm_stih415_pcm_clk_sel);

	return 0;
}
Пример #2
0
int __init device_init_stb840_promSvyaz(int ver)
{
	struct sysconf_field *sc;

	stx7105_configure_sata(0);

	/* Set SPI Boot pads as inputs to avoid contention with SSC1 */
	gpio_request(stm_gpio(15, 0), "SPI Boot CLK");
	gpio_direction_input(stm_gpio(15, 0));
	gpio_request(stm_gpio(15, 1), "SPI Boot DOUT");
	gpio_direction_input(stm_gpio(15, 1));
	gpio_request(stm_gpio(15, 2), "SPI Boot NOTCS");
	gpio_direction_input(stm_gpio(15, 2));
	gpio_request(stm_gpio(15, 3), "SPI Boot DIN");
	gpio_direction_input(stm_gpio(15, 3));

	/*
	 * Fix the reset chain so it correct to start with in case the
	 * watchdog expires or we trigger a reset.
	 */
	sc = sysconf_claim(SYS_CFG, 9, 27, 28, "reset_chain");
	sysconf_write(sc, 0);
	/* Release the sysconf bits so the coprocessor driver can claim them */
	sysconf_release(sc);

	/* I2C_xxxA - HDMI */
	stx7105_configure_ssc_i2c(0, &(struct stx7105_ssc_config) {
			.routing.ssc0.sclk = stx7105_ssc0_sclk_pio2_2,
			.routing.ssc0.mtsr = stx7105_ssc0_mtsr_pio2_3, });
Пример #3
0
void __init stx7106_configure_spifsm(struct stm_plat_spifsm_data *data)
{
	struct sysconf_field *sc;

	/* Not available on stx7105 */
	BUG_ON(cpu_data->type == CPU_STX7105);

	stx7106_spifsm_device.dev.platform_data = data;

	sc = sysconf_claim(SYS_STA, 1, 5, 8, "boot-device");

	/* SoC/IP Capabilities */
	data->capabilities.quad_mode = 0;
	data->capabilities.no_write_repeat = 1;
	data->capabilities.read_status_bug = spifsm_no_read_status;
	data->capabilities.boot_from_spi = (sysconf_read(sc) == 0xa) ? 1 : 0;

	/* Dual mode not possible due to pad configurations issues */
	data->capabilities.dual_mode = 0;
	data->pads = &stx7106_spifsm_pad_config;

	if (cpu_data->cut_major == 1) {
		data->capabilities.no_clk_div_4 = 1;
		data->capabilities.dummy_on_write = 1;
		data->capabilities.no_sw_reset = 1;
	} else if (cpu_data->cut_major == 3) {
		data->capabilities.no_poll_mode_change = 1;
	}

	sysconf_release(sc);
	platform_device_register(&stx7106_spifsm_device);
}
Пример #4
0
static int __init fli7510_suspend_setup(void)
{

	struct sysconf_field *sc[2];
	int i;

	sc[0] = sysconf_claim(CKG_DDR_CTL_PLL_DDR_FREQ, 0, 0, "PM");
	sc[1] = sysconf_claim(CKG_DDR_STATUS_PLL_DDR, 0, 0, "PM");

	for (i = ARRAY_SIZE(sc)-1; i; --i)
		if (!sc[i])
			goto error;

	cga = ioremap(CGA, 0x1000);

	ca_ic_100_clk = clk_get(NULL, "comms_clk");
	ca_pll_clk = ca_ic_100_clk->parent;
	ca_ref_clk = ca_pll_clk->parent;

	return stm_suspend_register(&fli7510_suspend);

error:

	for (i = ARRAY_SIZE(sc)-1; i; --i)
		if (sc[i])
			sysconf_release(sc[i]);

	pr_err("[STM][PM] Error on Standby initialization\n");
	return 0;
}
Пример #5
0
void stmcore_cleanup_device(void)
{
  if(hotplug_pio)
    stpio_free_pin(hotplug_pio);

  if (syscfg2_27)
    sysconf_release (syscfg2_27);
}
Пример #6
0
static int stm_miphy_tap_remove(struct platform_device *pdev)
{

	stm_tap_disable(tap_dev->tap);
	stm_tap_free(tap_dev->tap);

	miphy_if_unregister(&tap_dev->miphy_dev);
	/* free the memory and sysconf */
	sysconf_release(tap_dev->tck);
	sysconf_release(tap_dev->tms);
	sysconf_release(tap_dev->tdi);
	sysconf_release(tap_dev->tdo);

	kfree(tap_dev);
	tap_dev = NULL;

	return 0;
}
Пример #7
0
static void __stm_device_exit(struct stm_device_state *state)
{
	struct stm_device_config *config = state->config;
	int i;

	stm_device_power(state, stm_device_power_off);

	if (config->pad_config)
		stm_pad_release(state->pad_state);

	if (config->exit)
		config->exit(state);

	for (i = 0; i < config->sysconfs_num; i++)
		sysconf_release(state->sysconf_fields[i]);
}
static int __init stxh205_suspend_setup(void)
{
	struct sysconf_field *sc[2];
	int i;

	sc[0] = sysconf_claim(SYSCONF(169), 2, 2, "PM");
	/* ClockGen_D.Pll lock status */
	sc[1] = sysconf_claim(SYSCONF(154), 2, 2, "PM");


	for (i = 0; i < ARRAY_SIZE(sc); ++i)
		if (!sc[i])
			goto error;

	a0_ic_lp_on_clk = clk_get(NULL, "CLK_A0_IC_REG_LP_ON");
	a0_ref_clk = clk_get(NULL, "CLK_A0_REF");

	a1_pll0_hs_clk = clk_get(NULL, "CLK_A1_PLL0HS");
	a1_ddr_clk = clk_get(NULL, "CLK_A1_IC_DDRCTRL");
	a1_pll1_ls_clk = clk_get(NULL, "CLK_A1_PLL1LS");
	a1_eth_phy_clk = clk_get(NULL, "CLK_A1_ETH_PHY");

	if (a0_ref_clk == ERR_PTR(-ENOENT) ||
	    a0_ic_lp_on_clk == ERR_PTR(-ENOENT) ||
	    a1_pll0_hs_clk == ERR_PTR(-ENOENT) ||
	    a1_pll0_hs_clk == ERR_PTR(-ENOENT) ||
	    a1_pll1_ls_clk == ERR_PTR(-ENOENT) ||
	    a1_eth_phy_clk == ERR_PTR(-ENOENT))
		goto error;

	cga0 = ioremap_nocache(0xfde98000, 0x1000);
	cga1 = ioremap_nocache(0xfdab8000, 0x1000);

	return stm_suspend_register(&stxh205_suspend);

error:
	pr_err("[STM][PM] Error to acquire the sysconf registers\n");
	for (i = 0; i < ARRAY_SIZE(sc); ++i)
		if (sc[i])
			sysconf_release(sc[i]);

	return -EBUSY;
}
Пример #9
0
static int __stm_device_init(struct stm_device_state *state,
		struct stm_device_config *config, struct device *dev)
{
	int i;

	state->dev = dev;
	state->config = config;
	state->power_state = stm_device_power_off;

	for (i = 0; i < config->sysconfs_num; i++) {
		struct stm_device_sysconf *sysconf = &config->sysconfs[i];

		state->sysconf_fields[i] = sysconf_claim(sysconf->regtype,
				sysconf->regnum, sysconf->lsb, sysconf->msb,
				dev_name(dev));
		if (!state->sysconf_fields[i])
			goto sysconf_error;
	}

	if (config->init && config->init(state))
		goto sysconf_error;

	if (config->pad_config &&
	    (state->pad_state = stm_pad_claim(config->pad_config,
					      dev_name(dev))) == NULL)
		goto pad_error;

	stm_device_power(state, stm_device_power_on);

	return 0;

pad_error:
	if (config->exit)
		config->exit(state);

sysconf_error:
	for (i--; i>=0; i--)
		sysconf_release(state->sysconf_fields[i]);

	return -EBUSY;
}
Пример #10
0
static int __init stx5206_suspend_setup(void)
{
	int i;
	struct sysconf_field *sc[7];

	sc[0] = sysconf_claim(SYS_CFG, 4, 2, 2, "LMI - PM");
	sc[1] = sysconf_claim(SYS_CFG, 11, 12, 12, "LMI - PM");
	sc[2] = sysconf_claim(SYS_CFG, 11, 27, 27, "LMI - PM");
	sc[3] = sysconf_claim(SYS_CFG, 12, 10, 10, "LMI - PM");
	sc[4] = sysconf_claim(SYS_CFG, 38, 20, 20, "LMI - PM");

	sc[5] = sysconf_claim(SYS_STA, 3, 0, 0, "LMI - PM");
	sc[6] = sysconf_claim(SYS_STA, 4, 0, 0, "LMI - PM");

	for (i = 0; i < ARRAY_SIZE(sc); ++i)
		if (!sc[i])
			goto error;

	cga = ioremap(CGA, 0x1000);
	lmi = ioremap(LMI_BASE, 0x1000);

	ca_ref_clk = clk_get(NULL, "CLKA_REF");
	ca_pll1_clk = clk_get(NULL, "CLKA_PLL1");
	ca_ic_if_100_clk = clk_get(NULL, "CLKA_IC_IF_100");
	ca_eth_phy_clk = clk_get(NULL, "CLKA_ETH_PHY");

	if (!ca_ref_clk || !ca_pll1_clk ||
	    !ca_ic_if_100_clk || !ca_eth_phy_clk)
		goto error;

	return stm_suspend_register(&stx5206_suspend);
error:
	pr_err("[STM][PM] Error to acquire the sysconf registers\n");
	for (i = 0; i > ARRAY_SIZE(sc); ++i)
		if (sc[i])
			sysconf_release(sc[i]);

	return -1;
}
Пример #11
0
static int __init stx7111_suspend_setup(void)
{
	struct sysconf_field *sc[7];
	int i;

	sc[0] = sysconf_claim(SYS_STA, 4, 0, 0, "PM");
	sc[1] = sysconf_claim(SYS_STA, 3, 0, 0, "PM");
	sc[2] = sysconf_claim(SYS_CFG, 4, 2, 2, "PM");
	sc[3] = sysconf_claim(SYS_CFG, 11, 12, 12, "PM");
	sc[4] = sysconf_claim(SYS_CFG, 11, 27, 27, "PM");
	sc[5] = sysconf_claim(SYS_CFG, 12, 10, 10, "PM");
	sc[6] = sysconf_claim(SYS_CFG, 38, 20, 20, "PM");

	for (i = ARRAY_SIZE(sc)-1; i; --i)
		if (!sc[i])
			goto error;

	cga = ioremap(CGA, 0x1000);

	ca_ref_clk = clk_get(NULL, "CLKA_REF");
	ca_pll1_clk = clk_get(NULL, "CLKA_PLL1");
	ca_ic_if_100_clk = clk_get(NULL, "CLKA_IC_IF_100");
	ca_eth_phy_clk = clk_get(NULL, "CLKA_ETH_PHY");

	if (!ca_ref_clk || !ca_pll1_clk ||
	    !ca_ic_if_100_clk || !ca_eth_phy_clk)
		goto error;

	return stm_suspend_register(&stx7111_suspend);

error:
	for (i = ARRAY_SIZE(sc)-1; i; --i)
		if (sc[i])
			sysconf_release(sc[i]);
	pr_err("[STM][PM] Error on Standby initialization\n");

	return 0;
}
Пример #12
0
void __init stx5206_configure_spifsm(struct stm_plat_spifsm_data *data)
{
	struct sysconf_field *sc;

	stx5206_spifsm_device.dev.platform_data = data;

	sc = sysconf_claim(SYS_STA, 1, 16, 17, "boot-device");

	/* Pads not shared with PIO (although potential conflict with PCI
	 * alternative routing) */
	data->pads = NULL;

	/* SoC/IP Capabilities */
	data->capabilities.quad_mode = 0;
	data->capabilities.no_read_repeat = 1;
	data->capabilities.no_write_repeat = 1;
	data->capabilities.no_clk_div_4 = 1;
	data->capabilities.read_status_bug = spifsm_no_read_status;
	data->capabilities.boot_from_spi = (sysconf_read(sc) == 0x2) ? 1 : 0;

	sysconf_release(sc);
	platform_device_register(&stx5206_spifsm_device);
}
Пример #13
0
static int __init stx7105_suspend_setup(void)
{

	struct sysconf_field *sc[7];
	int i;

	sc[0] = sysconf_claim(SYS_STA, 4, 0, 0, "pm");
	sc[1] = sysconf_claim(SYS_STA, 3, 0, 0, "pm");
	sc[2] = sysconf_claim(SYS_CFG, 4, 2, 2, "pm");
	sc[3] = sysconf_claim(SYS_CFG, 11, 12, 12, "pm");
	sc[4] = sysconf_claim(SYS_CFG, 11, 27, 27, "pm");
	sc[5] = sysconf_claim(SYS_CFG, 12, 10, 10, "pm");
	sc[6] = sysconf_claim(SYS_CFG, 38, 20, 20, "pm");

	for (i = ARRAY_SIZE(sc)-1; i; --i)
		if (!sc[i])
			goto error;

	cga = ioremap(CGA, 0x1000);
	lmi = ioremap(LMI_BASE, 0x1000);

	ca_ref_clk = clk_get(NULL, "CLKA_REF");
	ca_pll1_clk = clk_get(NULL, "CLKA_PLL1");
	ca_ic_if_100_clk = clk_get(NULL, "CLKA_IC_IF_100");

	if (!ca_ref_clk || !ca_pll1_clk || !ca_ic_if_100_clk)
		goto error;

	return stm_suspend_register(&stx7105_suspend);

error:
	for (i = ARRAY_SIZE(sc)-1; i; --i)
		if (sc[i])
			sysconf_release(sc[i]);
	return 0;
}
Пример #14
0
static int snd_stm_conv_dac_sc_remove(struct platform_device *pdev)
{
	struct snd_stm_conv_dac_sc *conv_dac_sc = platform_get_drvdata(pdev);

	BUG_ON(!conv_dac_sc);
	BUG_ON(!snd_stm_magic_valid(conv_dac_sc));

	snd_stm_conv_unregister_converter(conv_dac_sc->converter);

	sysconf_release(conv_dac_sc->nrst);
	sysconf_release(conv_dac_sc->mode);
	sysconf_release(conv_dac_sc->nsb);
	sysconf_release(conv_dac_sc->softmute);
	sysconf_release(conv_dac_sc->pdana);
	sysconf_release(conv_dac_sc->pndbg);

	snd_stm_magic_clear(conv_dac_sc);
	kfree(conv_dac_sc);

	return 0;
}
Пример #15
0
void stih415_gmac1_release(struct stm_pad_state *state, void *priv)
{
	sysconf_release(gbit_sc[1]);
}
Пример #16
0
static int __init snd_stm_stih415_probe(struct platform_device *pdev)
{
	int result;

	dev_dbg(&pdev->dev, "%s()", __func__);

	if (!stm_soc_is_stih415()) {
		dev_err(&pdev->dev, "Unsupported (not STiH415) SOC detected!");
		return -EINVAL;
	}

	/* Claim external pcm clock sysconf */
	snd_stm_stih415_pcm_clk_sel = sysconf_claim(SYSCONF(331), 8, 11,
						       "PCM_CLK_SEL");
	if (!snd_stm_stih415_pcm_clk_sel) {
		dev_err(&pdev->dev, "Failed to claim PCM_CLK_SEL");
		return -EBUSY;
	}

	/* Claim bi-phase idle value sysconf */
	snd_stm_stih415_biphase_idle_value = sysconf_claim(SYSCONF(331), 7, 7,
						       "BIPHASE_IDLE_VALUE");
	if (!snd_stm_stih415_biphase_idle_value) {
		dev_err(&pdev->dev, "Failed to claim BIPHASE_IDLE_VALUE");
		result = -EBUSY;
		goto error_sysconf_claim_biphase_idle_value;
	}

	/* Claim voip sysconf */
	snd_stm_stih415_voip = sysconf_claim(SYSCONF(331), 2, 5, "VOIP");
	if (!snd_stm_stih415_voip) {
		dev_err(&pdev->dev, "Failed to claim VOIP");
		result = -EBUSY;
		goto error_sysconf_claim_voip;
	}

	/* Claim pcm player routing sysconf */
	snd_stm_stih415_pcmp_valid_sel = sysconf_claim(SYSCONF(331), 0, 1,
						       "PCMP_VALID_SEL");
	if (!snd_stm_stih415_pcmp_valid_sel) {
		dev_err(&pdev->dev, "Failed to claim PCMP_VALID_SEL");
		result = -EBUSY;
		goto error_sysconf_claim_pcmp_valid_sel;
	}

	/* Set the sysconf values */
	snd_stm_stih415_setup();

	/* Register the sound card */
	result = snd_stm_card_register();
	if (result) {
		dev_err(&pdev->dev, "Failed to register ALSA cards!");
		goto error_card_register;
	}

	/* Register a procfs file */
	result = snd_stm_info_register(&snd_stm_stih415_proc_entry,
			dev_name(&pdev->dev), snd_stm_stih415_procfs, NULL);
	if (result) {
		dev_err(&pdev->dev, "Failed to register with procfs");
		goto error_info_register;
	}

	return 0;

error_info_register:
error_card_register:
	sysconf_release(snd_stm_stih415_pcmp_valid_sel);
error_sysconf_claim_pcmp_valid_sel:
	sysconf_release(snd_stm_stih415_voip);
error_sysconf_claim_voip:
	sysconf_release(snd_stm_stih415_biphase_idle_value);
error_sysconf_claim_biphase_idle_value:
	sysconf_release(snd_stm_stih415_pcm_clk_sel);
	return result;
}