[U-Boot] [PATCH] powerpc: add support for the Freescale P1022DS reference board

Timur Tabi timur at freescale.com
Wed May 26 23:59:16 CEST 2010


Scott Wood wrote:
> A few of those things don't belong there -- I think first_free_busno 
> should be a static variable inside the pci setup function, for example 
> (does Linux still even need separate bus number spaces on different 
> hoses?).  pcie_ep should just be a local variable.  The hose could maybe 
> just be an uninitialized member of the struct instead of a pointer to an 
> arbitrary other symbol.

I'm not sure what you mean about the 'hose'.  How about this:

static void configure_pcie(enum srds_prtcl pci,
			   u32 devdisr_mask,
			   const char *target,
			   enum law_trgt_if law,
			   phys_addr_t mem_addr,
			   enum law_size mem_size,
			   phys_addr_t io_addr,
			   enum law_size io_size,
			   struct pci_controller *hose)
{
	volatile ccsr_gur_t *gur = (void *)CONFIG_SYS_MPC85xx_GUTS_ADDR;
	struct fsl_pci_info pci_info;
	u32 devdisr;
	static int first_free_busno = 0;
	int is_endpoint;
	int num;

	devdisr = in_be32(&gur->devdisr);

	if (is_serdes_configured(pci) && !(devdisr & devdisr_mask)) {
		set_next_law(mem_addr, mem_size, law);
		set_next_law(io_addr, io_size, law);

		switch (pci) {
#ifdef CONFIG_PCIE1
		case PCIE1:
			num = 1;
			SET_STD_PCIE_INFO(pci_info, 1);
			break;
#endif
#ifdef CONFIG_PCIE2
		case PCIE2:
			num = 2;
			SET_STD_PCIE_INFO(pci_info, 2);
			break;
#endif
#ifdef CONFIG_PCIE3
		case PCIE3:
			num = 3;
			SET_STD_PCIE_INFO(pci_info, 3);
			break;
#endif
#ifdef CONFIG_PCIE4
		case PCIE4:
			num = 4;
			SET_STD_PCIE_INFO(pci_info, 4);
			break;
#endif
		default:
			break;
		}

		is_endpoint = fsl_setup_hose(hose, pci_info.regs);
		printf("    PCIE%u: connected to %s as %s (base addr %lx)\n",
		       num, target, is_endpoint ? "Endpoint" : "Root Complex",
		       pci_info.regs);

		first_free_busno = fsl_pci_init_port(&pci_info, hose, first_free_busno);
	} else {
		printf("    PCIE%u: disabled\n", num);
	}
}


-- 
Timur Tabi
Linux kernel developer at Freescale


More information about the U-Boot mailing list