/* pci_parse_of_flags - Parse the flags cell of a device tree PCI address @addr0: value of 1st cell of a device tree PCI address. @bridge: Set this flag if the address is from a bridge 'ranges' property  */
unsigned int pci_parse_of_flags(u32 addr0, int bridge)
/* pci_parse_of_flags - Parse the flags cell of a device tree PCI address @addr0: value of 1st cell of a device tree PCI address. @bridge: Set this flag if the address is from a bridge 'ranges' property  */
unsigned int pci_parse_of_flags(u32 addr0, int bridge)
{
	unsigned int flags = 0;
	if (addr0 & 0x02000000) {
		flags = IORESOURCE_MEM | PCI_BASE_ADDRESS_SPACE_MEMORY;
		flags |= (addr0 >> 22) & PCI_BASE_ADDRESS_MEM_TYPE_64;
		flags |= (addr0 >> 28) & PCI_BASE_ADDRESS_MEM_TYPE_1M;
		if (addr0 & 0x40000000)
			flags |= IORESOURCE_PREFETCH
				 | PCI_BASE_ADDRESS_MEM_PREFETCH;
		if (!bridge && (addr0 & 0xff) == 0x30)
			flags |= IORESOURCE_READONLY;
	} else if (addr0 & 0x01000000)
		flags = IORESOURCE_IO | PCI_BASE_ADDRESS_SPACE_IO;
	if (flags)
		flags |= IORESOURCE_SIZEALIGN;
	return flags;
}