static int __init pcie_setup(struct pci_sys_data *sys) { struct resource *res; int dev; /* * Generic PCIe unit setup. */ orion_pcie_setup(PCIE_BASE, &orion5x_mbus_dram_info); /* * Check whether to apply Orion-1/Orion-NAS PCIe config * read transaction workaround. */ dev = orion_pcie_dev_id(PCIE_BASE); if (dev == MV88F5181_DEV_ID || dev == MV88F5182_DEV_ID) { printk(KERN_NOTICE "Applying Orion-1/Orion-NAS PCIe config " "read transaction workaround\n"); orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, ORION5X_PCIE_WA_SIZE); pcie_ops.read = pcie_rd_conf_wa; } /* * Request resources. */ res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL); if (!res) panic("pcie_setup unable to alloc resources"); /* * IORESOURCE_IO */ res[0].name = "PCIe I/O Space"; res[0].flags = IORESOURCE_IO; res[0].start = ORION5X_PCIE_IO_BUS_BASE; res[0].end = res[0].start + ORION5X_PCIE_IO_SIZE - 1; if (request_resource(&ioport_resource, &res[0])) panic("Request PCIe IO resource failed\n"); sys->resource[0] = &res[0]; /* * IORESOURCE_MEM */ res[1].name = "PCIe Memory Space"; res[1].flags = IORESOURCE_MEM; res[1].start = ORION5X_PCIE_MEM_PHYS_BASE; res[1].end = res[1].start + ORION5X_PCIE_MEM_SIZE - 1; if (request_resource(&iomem_resource, &res[1])) panic("Request PCIe Memory resource failed\n"); sys->resource[1] = &res[1]; sys->resource[2] = NULL; sys->io_offset = 0; return 1; }
static void __init qnap_ts209_init(void) { /* * Setup basic Orion functions. Need to be called early. */ orion5x_init(); /* * Setup flash mapping */ orion5x_setup_dev_boot_win(QNAP_TS209_NOR_BOOT_BASE, QNAP_TS209_NOR_BOOT_SIZE); /* * Open a special address decode windows for the PCIe WA. */ orion5x_setup_pcie_wa_win(ORION5X_PCIE_WA_PHYS_BASE, ORION5X_PCIE_WA_SIZE); /* * Setup Multiplexing Pins -- * MPP[0] Reserved * MPP[1] USB copy button (0 active) * MPP[2] Load defaults button (0 active) * MPP[3] GPIO RTC * MPP[4-5] Reserved * MPP[6] PCI Int A * MPP[7] PCI Int B * MPP[8-11] Reserved * MPP[12] SATA 0 presence * MPP[13] SATA 1 presence * MPP[14] SATA 0 active * MPP[15] SATA 1 active * MPP[16] UART1 RXD * MPP[17] UART1 TXD * MPP[18] SW_RST (0 active) * MPP[19] Reserved * MPP[20] PCI clock 0 * MPP[21] PCI clock 1 * MPP[22] USB 0 over current * MPP[23-25] Reserved */ orion5x_write(MPP_0_7_CTRL, 0x3); orion5x_write(MPP_8_15_CTRL, 0x55550000); orion5x_write(MPP_16_19_CTRL, 0x5500); orion5x_gpio_set_valid_pins(0x3cc0fff); /* register ts209 specific power-off method */ pm_power_off = qnap_ts209_power_off; platform_add_devices(qnap_ts209_devices, ARRAY_SIZE(qnap_ts209_devices)); /* Get RTC IRQ and register the chip */ if (gpio_request(TS209_RTC_GPIO, "rtc") == 0) { if (gpio_direction_input(TS209_RTC_GPIO) == 0) qnap_ts209_i2c_rtc.irq = gpio_to_irq(TS209_RTC_GPIO); else gpio_free(TS209_RTC_GPIO); } if (qnap_ts209_i2c_rtc.irq == 0) pr_warning("qnap_ts209_init: failed to get RTC IRQ\n"); i2c_register_board_info(0, &qnap_ts209_i2c_rtc, 1); ts209_find_mac_addr(); orion5x_eth_init(&qnap_ts209_eth_data); orion5x_sata_init(&qnap_ts209_sata_data); }