//Get dev struct for the LPC device. The GPIO BAR is located in the
//LPC device config space
pdev = pci_get_device(SPI_VENDOR_ID, SPI_DEVICE_ID, NULL);
if ( !pdev )
{
SPI_ERR("%s:spi_char_init-Could not find pci device/n", DRIVERNAME);
goto Exit_Error;
}
//Get base address from the LPC configuration space.
pci_read_config_dword(pdev, CRBA_BAR, &(spi_char.mem_base));
SPI_DBG("base addr1 %08x/n", spi_char.mem_base);
//Get BIOS Contrl address
pci_read_config_byte(pdev, BIOS_CTRL, &(spi_char.bios_ctrl_addr));
SPI_DBG("bios ctrl addr %08x/n", spi_char.bios_ctrl_addr);
/* Get own base address */
spi_char.mem_base &= 0xFFFFC000;
SPI_DBG("base addr11 %08x/n", spi_char.mem_base);
spi_char.mem_base += SPI_BAR_OFFSET;
SPI_DBG("base addr21 %08x/n", spi_char.mem_base);
//release reference to device
pci_dev_put(pdev);
//obtain memory space
if ( !request_mem_region(spi_char.mem_base, SPI_MEM_SIZE, DRIVERNAME) )
{
spi_char.iomem_ready = 0;
SPI_ERR("%s:spi_init-IO memory region has been reserved?/n", DRIVERNAME);
}
else
{
spi_char.iomem_ready = 1;
}
spi_char.mem_virt = ioremap(spi_char.mem_base, SPI_MEM_SIZE);
SPI_DBG("virtual addr %08x/n", spi_char.mem_virt);
//indicate memory space reserved
spi_char.mem_ready = 1;
//do some special initiation
EP80579_spi_init(spi_char.mem_virt);