Пример #1
0
/* You may pass one of the PCI_PIN_* constants to use dedicated pin or
 * just pass interrupt number generated with gpio_to_irq() when
 * non-standard PIO pads are used as interrupts. */
int stx7108_pcibios_map_platform_irq(struct stm_plat_pci_config *pci_config,
		u8 pin)
{
	int irq;
	int pin_type;

	if ((pin > 4) || (pin < 1))
		return -1;

	pin_type = pci_config->pci_irq[pin - 1];

	switch (pin_type) {
	case PCI_PIN_DEFAULT:
		irq = ILC_IRQ(122 + pin - 1);
		break;
	case PCI_PIN_ALTERNATIVE:
		/* No alternative here... */
		BUG();
		irq = -1;
		break;
	case PCI_PIN_UNUSED:
		irq = -1; /* Not used */
		break;
	default:
		irq = pin_type; /* Take whatever interrupt you are told */
		break;
	}

	return irq;
}
Пример #2
0
int __init fli7510_configure_ssc_i2c(int ssc)
{
	static int i2c_busnum;
	struct platform_device *dev;
	struct stm_plat_ssc_data *plat_data;

	BUG_ON(ssc < 0 || ssc >= ARRAY_SIZE(fli7510_ssc_devices));

	BUG_ON(fli7510_ssc_configured[ssc]);
	fli7510_ssc_configured[ssc] = 1;

	dev = &fli7510_ssc_devices[ssc];

	dev->name = "i2c-stm";
	dev->id = i2c_busnum;

	plat_data = fli7510_ssc_devices[ssc].dev.platform_data;
	if (cpu_data->type != CPU_FLI7510 && ssc == 2)
		plat_data->pad_config = &fli7520_ssc2_i2c_pad_config;
	else if (cpu_data->type != CPU_FLI7510 && ssc == 4)
		plat_data->pad_config = &fli7520_ssc4_i2c_pad_config;
	else
		plat_data->pad_config = &fli7510_ssc_i2c_pad_configs[ssc];

	if (ssc == 4) {
		struct resource *res = platform_get_resource(dev,
				IORESOURCE_IRQ, 0);

		res->start = ILC_IRQ(cpu_data->type == CPU_FLI7510 ? 23 : 47);
		res->end = res->start;
	}

	/* I2C bus number reservation (to prevent any hot-plug device
	 * from using it) */
	i2c_register_board_info(i2c_busnum, NULL, 0);

	platform_device_register(dev);

	return i2c_busnum++;
}
Пример #3
0
int __init fli7510_configure_ssc_spi(int ssc,
		struct fli7510_ssc_spi_config *config)
{
	static int spi_busnum;
	struct platform_device *dev;
	struct stm_plat_ssc_data *plat_data;

	/* Only SSC4 can be used as a SPI device */
	BUG_ON(ssc != 4);

	BUG_ON(fli7510_ssc_configured[ssc]);
	fli7510_ssc_configured[ssc] = 1;

	dev = &fli7510_ssc_devices[ssc];

	dev->name = "spi-stm";
	dev->id = spi_busnum;

	if (ssc == 4) {
		struct resource *res = platform_get_resource(dev,
				IORESOURCE_IRQ, 0);

		res->start = ILC_IRQ(cpu_data->type == CPU_FLI7510 ? 23 : 47);
		res->end = res->start;
	}

	plat_data = fli7510_ssc_devices[ssc].dev.platform_data;
	if (config)
		plat_data->spi_chipselect = config->chipselect;
	if (cpu_data->type == CPU_FLI7510)
		plat_data->pad_config = &fli7510_ssc4_spi_pad_config;
	else
		plat_data->pad_config = &fli7520_ssc4_spi_pad_config;

	platform_device_register(dev);

	return spi_busnum++;
}
Пример #4
0
void __init stx7108_configure_pci(struct stm_plat_pci_config *pci_conf)
{
	struct sysconf_field *sc;
	int i;

	/* LLA clocks have these horrible names... */
	pci_conf->clk_name = "CLKA_PCI";

	/* REQ0 is actually wired to REQ3 to work around NAND problems */
	pci_conf->req0_to_req3 = 1;
	BUG_ON(pci_conf->req_gnt[3] != PCI_PIN_UNUSED);

	/* Fill in the default values */
	if (!pci_conf->ad_override_default) {
		pci_conf->ad_threshold = 5;
		pci_conf->ad_read_ahead = 1;
		pci_conf->ad_chunks_in_msg = 0;
		pci_conf->ad_pcks_in_chunk = 0;
		pci_conf->ad_trigger_mode = 1;
		pci_conf->ad_max_opcode = 5;
		pci_conf->ad_posted = 1;
	}

	/* Copy over platform specific data to driver */
	stx7108_pci_device.dev.platform_data = pci_conf;

#if defined(CONFIG_PM)
#warning TODO: PCI Power Management
#endif
	/* Claim and power up the PCI cell */
	sc = sysconf_claim(SYS_CFG_BANK2, 30, 2, 2, "PCI_PWR_DWN_REQ");
	sysconf_write(sc, 0); /* We will need to stash this somewhere
				 for power management. */
	sc = sysconf_claim(SYS_STA_BANK2, 1, 2, 2, "PCI_PWR_DWN_GRANT");
	while (sysconf_read(sc))
		cpu_relax(); /* Loop until powered up */

	/* Configure the REQ/GNT[1..2], muxed with PIOs */
	for (i = 1; i <= 2; i++) {
		switch (pci_conf->req_gnt[i]) {
		case PCI_PIN_DEFAULT:
			if (stm_pad_claim(&stx7108_pci_reqgnt_pad_config[i],
					"PCI") == NULL) {
				printk(KERN_ERR "Failed to claim REQ/GNT%d "
						"pads!\n", i);
				BUG();
			}
			break;
		case PCI_PIN_UNUSED:
			/* Unused is unused - nothing to do */
			break;
		default:
			/* No alternative here... */
			BUG();
			break;
		}
	}

	/* Configure INTA..D interrupts */
	for (i = 0; i < 4; i++) {
		switch (pci_conf->pci_irq[i]) {
		case PCI_PIN_DEFAULT:
			if (stm_pad_claim(&stx7108_pci_int_pad_config[i],
						"PCI") == NULL) {
				printk(KERN_ERR "Failed to claim INT%c pad!\n",
						'A' + i);
				BUG();
			}
			set_irq_type(ILC_IRQ(122 + i), IRQ_TYPE_LEVEL_LOW);
			break;
		case PCI_PIN_ALTERNATIVE:
			/* There is no alternative here ;-) */
			BUG();
			break;
		default:
			/* Unused or interrupt number passed, nothing to do */
			break;
		}
	}

	/* Configure the SERR interrupt (if wired up) */
	switch (pci_conf->serr_irq) {
	case PCI_PIN_DEFAULT:
		if (gpio_request(STX7108_PIO_PCI_SERR, "PCI_SERR#") == 0) {
			gpio_direction_input(STX7108_PIO_PCI_SERR);
			pci_conf->serr_irq = gpio_to_irq(STX7108_PIO_PCI_SERR);
			set_irq_type(pci_conf->serr_irq, IRQ_TYPE_LEVEL_LOW);
		} else {
			printk(KERN_WARNING "%s(): Failed to claim PCI SERR# "
					"PIO!\n", __func__);
			pci_conf->serr_irq = PCI_PIN_UNUSED;
		}
		break;
	case PCI_PIN_ALTERNATIVE:
		/* No alternative here */
		BUG();
		pci_conf->serr_irq = PCI_PIN_UNUSED;
		break;
	}
	if (pci_conf->serr_irq != PCI_PIN_UNUSED) {
		struct resource *res =
			platform_get_resource_byname(&stx7108_pci_device,
					IORESOURCE_IRQ, "pci serr");

		BUG_ON(!res);
		res->start = pci_conf->serr_irq;
		res->end = pci_conf->serr_irq;
	}

	/* LOCK is not claimed as is totally pointless, the SOCs do not
	 * support any form of coherency */

	stx7108_pci_device.dev.parent =
		bus_find_device_by_name(&platform_bus_type, NULL, "emi");
	platform_device_register(&stx7108_pci_device);
}
Пример #5
0
	.resource = (struct resource[]) {
		/* Main PCI window, 960 MB */
		STM_PLAT_RESOURCE_MEM_NAMED("pcie memory",
					    PCIE_MEM_START, PCIE_MEM_SIZE),
		/* There actually is no IO for the PCI express cell, so this
		 * is a dummy really. Must be disjoint from PCI
		 */
		{
			.name = "pcie io",
			.start = 0x1000,
			.end = 0x1fff,
			.flags = IORESOURCE_IO,
		},
		STM_PLAT_RESOURCE_MEM_NAMED("pcie cntrl", 0xfe780000, 0x1000),
		STM_PLAT_RESOURCE_MEM_NAMED("pcie ahb", 0xfe788000, 0x8),
		STM_PLAT_RESOURCE_IRQ_NAMED("pcie inta", ILC_IRQ(179), -1),
		STM_PLAT_RESOURCE_IRQ_NAMED("pcie syserr", ILC_IRQ(184), -1),
		STM_PLAT_RESOURCE_IRQ_NAMED("msi mux", ILC_IRQ(180), -1),
		{
			.start = MSI_FIRST_IRQ,
			.end  = MSI_LAST_IRQ,
			.name = "msi range",
			.flags = IORESOURCE_IRQ,
		}
	},
	.dev.platform_data = &stx7108_plat_pcie_config,
};


void __init stx7108_configure_pcie(struct stx7108_pcie_config *config)
{
Пример #6
0
        /* .ver = see snd_stm_stx7200_init() */
        .source_bus_id = "snd_pcm_player.1",
        .channel_from = 0,
        .channel_to = 1,
    },
};

/* PCM players */

static struct platform_device stx7200_pcm_player_0 = {
    .name          = "snd_pcm_player",
    .id            = 0,
    .num_resources = 2,
    .resource      = (struct resource []) {
        STM_PLAT_RESOURCE_MEM(0xfd101000, 0x28),
        STM_PLAT_RESOURCE_IRQ(ILC_IRQ(39), -1),
    },
    .dev.platform_data = &(struct snd_stm_pcm_player_info) {
        .name = "PCM player #0",
        /* .ver = see snd_stm_stx7200_init() */
        .card_device = 0,
        .clock_name = "CLKC_FS0_CH1",
        .channels = 2,
        .fdma_initiator = 0,
        .fdma_request_line = 33,
    },
};

static struct stm_pad_config stx7200_pcm_player_1_auddig0_pad_config = {
    .sysconfs_num = 1,
    .sysconfs = (struct stm_pad_sysconf []) {
Пример #7
0
		.gpios_num = 2,
		.gpios = (struct stm_pad_gpio []) {
			STM_PAD_PIO_OUT(25, 7, 0),	/* TX */
			STM_PAD_PIO_IN(25, 6, -1),	/* RX */
		},
	},
};

static struct platform_device fli7510_asc_devices[] = {
	[0] = {
		.name = "stm-asc",
		/* .id set in fli7510_configure_asc() */
		.num_resources = 4,
		.resource = (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfdb30000, 0x2c),
			STM_PLAT_RESOURCE_IRQ(ILC_IRQ(24), -1),
			STM_PLAT_RESOURCE_DMA_NAMED("rx_half_full", 5),
			STM_PLAT_RESOURCE_DMA_NAMED("tx_half_empty", 6),
		},
		.dev.platform_data = &(struct stm_plat_asc_data) {
			.pad_config = &fli7510_asc_pad_configs[0],
		},
	},
	[1] = {
		.name = "stm-asc",
		/* .id set in fli7510_configure_asc() */
		.num_resources = 4,
		.resource = (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfdb31000, 0x2c),
			STM_PLAT_RESOURCE_IRQ(ILC_IRQ(25), -1),
			STM_PLAT_RESOURCE_DMA_NAMED("rx_half_full", 7),
Пример #8
0
	.pbl = 32,
	.has_gmac = 1,
	.enh_desc = 1,
	.tx_coe = 1,
	.bugged_jumbo = 1,
	.pmt = 1,
	.init = &stmmac_claim_resource,
};

static struct platform_device stxh205_ethernet_device = {
	.name = "stmmaceth",
	.id = 0,
	.num_resources = 4,
	.resource = (struct resource[]) {
		STM_PLAT_RESOURCE_MEM(0xfda88000, 0x8000),
		STM_PLAT_RESOURCE_IRQ_NAMED("macirq", ILC_IRQ(21), -1),
		STM_PLAT_RESOURCE_IRQ_NAMED("eth_wake_irq", ILC_IRQ(22), -1),
		STM_PLAT_RESOURCE_IRQ_NAMED("eth_lpi", ILC_IRQ(23), -1),
	},
	.dev = {
		.dma_mask = &stxh205_dma_mask,
		.coherent_dma_mask = DMA_BIT_MASK(32),
		.platform_data = &stxh205_ethernet_platform_data,
	},
};

void __init stxh205_configure_ethernet(struct stxh205_ethernet_config *config)
{
	static int configured;
	struct stxh205_ethernet_config default_config;
	struct plat_stmmacenet_data *plat_data;
Пример #9
0
	.resource = (struct resource[]) {
		/* Main PCI window, 960 MB */
		STM_PLAT_RESOURCE_MEM_NAMED("pcie memory",
					    PCIE_MEM_START, PCIE_MEM_SIZE),
		/* There actually is no IO for the PCI express cell, so this
		 * is a dummy really.
		 */
		{
			.name = "pcie io",
			.start = 0x400,
			.end = 0x1fff,
			.flags = IORESOURCE_IO,
		},
		STM_PLAT_RESOURCE_MEM_NAMED("pcie cntrl", 0xfd900000, 0x1000),
		STM_PLAT_RESOURCE_MEM_NAMED("pcie ahb", 0xfd908000, 0x8),
		STM_PLAT_RESOURCE_IRQ_NAMED("pcie inta", ILC_IRQ(53), -1),
		STM_PLAT_RESOURCE_IRQ_NAMED("pcie syserr", ILC_IRQ(55), -1),
		STM_PLAT_RESOURCE_IRQ_NAMED("msi mux", ILC_IRQ(56), -1),
		{
			.start = MSI_FIRST_IRQ,
			.end  = MSI_LAST_IRQ,
			.name = "msi range",
			.flags = IORESOURCE_IRQ,
		}
	},
	.dev.platform_data = &stxh205_plat_pcie_config,
};


void __init stxh205_configure_pcie(struct stxh205_pcie_config *config)
{
Пример #10
0
		.enh_desc = 1,
		.tx_coe = 1,
		.bugged_jumbo =1,
		.pmt = 1,
		.init = &stmmac_claim_resource,
	}
};

static struct platform_device stx7108_ethernet_devices[] = {
	{
		.name = "stmmaceth",
		.id = 0,
		.num_resources = 2,
		.resource = (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfda88000, 0x8000),
			STM_PLAT_RESOURCE_IRQ_NAMED("macirq", ILC_IRQ(21), -1),
		},
		.dev.platform_data = &stx7108_ethernet_platform_data[0],
	}, {
		.name = "stmmaceth",
		.id = 1,
		.num_resources = 2,
		.resource = (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfe730000, 0x8000),
			STM_PLAT_RESOURCE_IRQ_NAMED("macirq", ILC_IRQ(23), -1),
		},
		.dev.platform_data = &stx7108_ethernet_platform_data[1],
	}
};

#define GMAC_AHB_CONFIG         0x7000
Пример #11
0
		.tx_coe = 1,
		.bugged_jumbo =1,
		.pmt = 1,
		.fix_mac_speed = stx7141_ethernet_fix_mac_speed,
		.init = &stmmac_claim_resource,
	},
};

static struct platform_device stx7141_ethernet_devices[] = {
	[0] = {
		.name = "stmmaceth",
		.id = 0,
		.num_resources = 2,
		.resource = (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfd110000, 0x8000),
			STM_PLAT_RESOURCE_IRQ_NAMED("macirq", ILC_IRQ(40), -1),
		},
		.dev.platform_data = &stx7141_ethernet_platform_data[0],
	},
	[1] = {
		.name = "stmmaceth",
		.id = 1,
		.num_resources = 2,
		.resource = (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfd118000, 0x8000),
			STM_PLAT_RESOURCE_IRQ_NAMED("macirq", ILC_IRQ(47), -1),
		},
		.dev.platform_data = &stx7141_ethernet_platform_data[1],
	},
};
static const unsigned long whitelist[] = {
    STi7111_REGISTER_BASE + STi7111_DENC_BASE,
    STi7111_REGISTER_BASE + STi7111_DENC_BASE+PAGE_SIZE,
    STi7111_REGISTER_BASE + STi7111_DENC_BASE+(PAGE_SIZE*2),
    STi7111_REGISTER_BASE + STi7111_HDMI_BASE,
    _ALIGN_DOWN(STi7111_REGISTER_BASE + STi7111_BLITTER_BASE, PAGE_SIZE),
};


/* BDisp IRQs on 7141: aq1 115, aq2 116, aq3 117, aq4 118, cq1 119, cq2 120 */
static struct stmcore_display_pipeline_data platform_data[] = {
  {
    .owner                    = THIS_MODULE,
    .name                     = "STi7141-main",
    .device                   = 0,
    .vtg_irq                  = ILC_IRQ(143),
    .blitter_irq              = ILC_IRQ(116),
    .blitter_irq_kernel       = ILC_IRQ(115),
    .hdmi_irq                 = ILC_IRQ(139),
    .hdmi_i2c_adapter_id      = 4,
    .main_output_id           = STi7111_OUTPUT_IDX_VDP0_MAIN,
    .hdmi_output_id           = STi7111_OUTPUT_IDX_VDP0_HDMI,
    .dvo_output_id            = STi7111_OUTPUT_IDX_DVO0,

    .blitter_id               = STi7111_BLITTER_IDX_VDP0_MAIN,
    .blitter_id_kernel        = STi7111_BLITTER_IDX_KERNEL,
    .blitter_type             = STMCORE_BLITTER_BDISPII,

    .preferred_graphics_plane = OUTPUT_GDP1,
    .preferred_video_plane    = OUTPUT_VID1,
    .planes                   = {
Пример #13
0
			STM_PAD_PIO_IN(14, 5, 1),	/* RX */
			STM_PAD_PIO_IN_NAMED(14, 7, 1, "CTS"),
			STM_PAD_PIO_OUT_NAMED(14, 6, 1, "RTS"),
		},
	},
	/* .pad_config for ASC3 built in stx7108_asc_config() */
};

static struct platform_device stx7108_asc_devices[] = {
	[0] = {
		.name		= "stm-asc",
		/* .id set in stx7108_configure_asc() */
		.num_resources	= 4,
		.resource	= (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfd730000, 0x100),
			STM_PLAT_RESOURCE_IRQ(ILC_IRQ(40), -1),
			STM_PLAT_RESOURCE_DMA_NAMED("rx_half_full", 11),
			STM_PLAT_RESOURCE_DMA_NAMED("tx_half_empty", 15),
		},
		.dev.platform_data = &(struct stm_plat_asc_data) {
			.pad_config = &stx7108_asc_pad_configs[0],
		},
	},
	[1] = {
		.name		= "stm-asc",
		/* .id set in stx7108_configure_asc() */
		.num_resources	= 4,
		.resource	= (struct resource[]) {
			STM_PLAT_RESOURCE_MEM(0xfd731000, 0x100),
			STM_PLAT_RESOURCE_IRQ(ILC_IRQ(41), -1),
			STM_PLAT_RESOURCE_DMA_NAMED("rx_half_full", 12),
Пример #14
0
		STM_PAD_PIO_OUT(15, 6, 1),	/* SCLK */
		STM_PAD_PIO_OUT(15, 3, 1),	/* DATA0 */
		STM_PAD_PIO_OUT(15, 7, 2),	/* DATA1 */
		STM_PAD_PIO_OUT(16, 0, 2),	/* DATA2 */
		STM_PAD_PIO_OUT(16, 1, 2),	/* DATA3 */
		STM_PAD_PIO_OUT(16, 2, 2),	/* DATA4 */
	},
};

static struct platform_device stx7141_pcm_player_0 = {
	.name          = "snd_pcm_player",
	.id            = 0,
	.num_resources = 2,
	.resource      = (struct resource []) {
		STM_PLAT_RESOURCE_MEM(0xfd101000, 0x28),
		STM_PLAT_RESOURCE_IRQ(ILC_IRQ(101), -1),
	},
	.dev.platform_data = &stx7141_pcm_player_0_info,
};

static struct snd_stm_pcm_player_info stx7141_pcm_player_1_info = {
	.name = "PCM player #1",
	.ver = 6,
	.card_device = 1,
	.channels = 2,
	.fdma_initiator = 0,
	.fdma_request_line = 40,
	/* .pad_config set by stx7141_configure_audio() */
};

static struct stm_pad_config stx7141_pcm_player_1_pad_config = {