Example #1
0
static void ek_usb_add_device_mci(void)
{
	if (machine_is_at91sam9g20ek())
		ek_mci_data.detect_pin = AT91_PIN_PC9;

	at91_add_device_mci(0, &ek_mci_data);
}
Example #2
0
static void ek_set_board_type(void)
{
	if (machine_is_at91sam9g20ek()) {
		armlinux_set_architecture(MACH_TYPE_AT91SAM9G20EK);
		if (IS_ENABLED(CONFIG_AT91_HAVE_2MMC))
			armlinux_set_revision(HAVE_2MMC);
	} else {
		armlinux_set_architecture(MACH_TYPE_AT91SAM9260EK);
	}
}
Example #3
0
static void ek_usb_add_device_mci(void)
{
	if (!IS_ENABLED(CONFIG_MCI_ATMEL))
		return;

	if (machine_is_at91sam9g20ek())
		ek_mci_data.detect_pin = AT91_PIN_PC9;

	at91_add_device_mci(0, &ek_mci_data);
}
Example #4
0
static void ek_add_device_nand(void)
{
	struct sam9_smc_config *smc;

	if (machine_is_at91sam9g20ek())
		smc = &ek_9g20_nand_smc_config;
	else
		smc = &ek_9260_nand_smc_config;

	/* setup bus-width (8 or 16) */
	if (nand_pdata.bus_width_16)
		smc->mode |= AT91_SMC_DBW_16;
	else
		smc->mode |= AT91_SMC_DBW_8;

	/* configure chip-select 3 (NAND) */
	sam9_smc_configure(0, 3, smc);

	at91_add_device_nand(&nand_pdata);
}
Example #5
0
static void ek_add_device_nand(void)
{
	struct sam9_smc_config *smc;

	if (machine_is_at91sam9g20ek())
		smc = &ek_9g20_nand_smc_config;
	else
		smc = &ek_9260_nand_smc_config;

	/* setup bus-width (8 or 16) */
	if (IS_ENABLED(CONFIG_MTD_NAND_ATMEL_BUSWIDTH_16)) {
		nand_pdata.bus_width_16 = 1;
		smc->mode |= AT91_SMC_DBW_16;
	} else {
		smc->mode |= AT91_SMC_DBW_8;
	}

	/* configure chip-select 3 (NAND) */
	sam9_smc_configure(0, 3, smc);

	at91_add_device_nand(&nand_pdata);
}
Example #6
0
static int __init at91sam9g20ek_init(void)
{
	struct clk *pllb;
	int ret;

	if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
		return -ENODEV;

	ret = atmel_ssc_set_audio(0);
	if (ret != 0) {
		pr_err("Failed to set SSC 0 for audio: %d\n", ret);
		return ret;
	}

	/*
	 * Codec MCLK is supplied by PCK0 - set it up.
	 */
	mclk = clk_get(NULL, "pck0");
	if (IS_ERR(mclk)) {
		printk(KERN_ERR "ASoC: Failed to get MCLK\n");
		ret = PTR_ERR(mclk);
		goto err;
	}

	pllb = clk_get(NULL, "pllb");
	if (IS_ERR(pllb)) {
		printk(KERN_ERR "ASoC: Failed to get PLLB\n");
		ret = PTR_ERR(pllb);
		goto err_mclk;
	}
	ret = clk_set_parent(mclk, pllb);
	clk_put(pllb);
	if (ret != 0) {
		printk(KERN_ERR "ASoC: Failed to set MCLK parent\n");
		goto err_mclk;
	}

	clk_set_rate(mclk, MCLK_RATE);

	at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
	if (!at91sam9g20ek_snd_device) {
		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
		ret = -ENOMEM;
		goto err_mclk;
	}

	platform_set_drvdata(at91sam9g20ek_snd_device,
			&snd_soc_at91sam9g20ek);

	ret = platform_device_add(at91sam9g20ek_snd_device);
	if (ret) {
		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
		goto err_device_add;
	}

	return ret;

err_device_add:
	platform_device_put(at91sam9g20ek_snd_device);
err_mclk:
	clk_put(mclk);
	mclk = NULL;
err:
	return ret;
}
static int __init at91sam9g20ek_init(void)
{
	struct atmel_ssc_info *ssc_p = at91sam9g20ek_dai.cpu_dai->private_data;
	struct ssc_device *ssc = NULL;
	struct clk *pllb;
	int ret;

	if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc()))
		return -ENODEV;

	/*
	 * Codec MCLK is supplied by PCK0 - set it up.
	 */
	mclk = clk_get(NULL, "pck0");
	if (IS_ERR(mclk)) {
		printk(KERN_ERR "ASoC: Failed to get MCLK\n");
		ret = PTR_ERR(mclk);
		goto err;
	}

	pllb = clk_get(NULL, "pllb");
	if (IS_ERR(mclk)) {
		printk(KERN_ERR "ASoC: Failed to get PLLB\n");
		ret = PTR_ERR(mclk);
		goto err_mclk;
	}
	ret = clk_set_parent(mclk, pllb);
	clk_put(pllb);
	if (ret != 0) {
		printk(KERN_ERR "ASoC: Failed to set MCLK parent\n");
		goto err_mclk;
	}

	clk_set_rate(mclk, MCLK_RATE);

	/*
	 * Request SSC device
	 */
	ssc = ssc_request(0);
	if (IS_ERR(ssc)) {
		printk(KERN_ERR "ASoC: Failed to request SSC 0\n");
		ret = PTR_ERR(ssc);
		ssc = NULL;
		goto err_ssc;
	}
	ssc_p->ssc = ssc;

	at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1);
	if (!at91sam9g20ek_snd_device) {
		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
		ret = -ENOMEM;
	}

	platform_set_drvdata(at91sam9g20ek_snd_device,
			&at91sam9g20ek_snd_devdata);
	at91sam9g20ek_snd_devdata.dev = &at91sam9g20ek_snd_device->dev;

	ret = platform_device_add(at91sam9g20ek_snd_device);
	if (ret) {
		printk(KERN_ERR "ASoC: Platform device allocation failed\n");
		platform_device_put(at91sam9g20ek_snd_device);
	}

	return ret;

err_ssc:
	ssc_free(ssc);
	ssc_p->ssc = NULL;
err_mclk:
	clk_put(mclk);
	mclk = NULL;
err:
	return ret;
}
Example #8
0
static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
{
	struct device_node *np = pdev->dev.of_node;
	struct device_node *codec_np, *cpu_np;
	struct snd_soc_card *card = &snd_soc_at91sam9g20ek;
	int ret;

	if (!np) {
		if (!(machine_is_at91sam9g20ek() ||
			machine_is_at91sam9g20ek_2mmc()))
			return -ENODEV;
	}

	ret = atmel_ssc_set_audio(0);
	if (ret) {
		dev_err(&pdev->dev, "ssc channel is not valid\n");
		return -EINVAL;
	}

	card->dev = &pdev->dev;

	/* Parse device node info */
	if (np) {
		ret = snd_soc_of_parse_card_name(card, "atmel,model");
		if (ret)
			goto err;

		ret = snd_soc_of_parse_audio_routing(card,
			"atmel,audio-routing");
		if (ret)
			goto err;

		/* Parse codec info */
		at91sam9g20ek_dai.codec_name = NULL;
		codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
		if (!codec_np) {
			dev_err(&pdev->dev, "codec info missing\n");
			return -EINVAL;
		}
		at91sam9g20ek_dai.codec_of_node = codec_np;

		/* Parse dai and platform info */
		at91sam9g20ek_dai.cpu_dai_name = NULL;
		at91sam9g20ek_dai.platform_name = NULL;
		cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0);
		if (!cpu_np) {
			dev_err(&pdev->dev, "dai and pcm info missing\n");
			return -EINVAL;
		}
		at91sam9g20ek_dai.cpu_of_node = cpu_np;
		at91sam9g20ek_dai.platform_of_node = cpu_np;

		of_node_put(codec_np);
		of_node_put(cpu_np);
	}

	ret = snd_soc_register_card(card);
	if (ret) {
		printk(KERN_ERR "ASoC: snd_soc_register_card() failed\n");
	}

	return ret;

err:
	atmel_ssc_put_audio(0);
	return ret;
}