aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pcmcia/yenta_socket.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pcmcia/yenta_socket.c')
-rw-r--r--drivers/pcmcia/yenta_socket.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 0347a29f297b..271a52b7c2e6 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -667,7 +667,7 @@ static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
667 return 0; 667 return 0;
668} 668}
669 669
670static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end) 670static int yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
671{ 671{
672 struct resource *root, *res; 672 struct resource *root, *res;
673 struct pci_bus_region region; 673 struct pci_bus_region region;
@@ -676,7 +676,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
676 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr; 676 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
677 /* Already allocated? */ 677 /* Already allocated? */
678 if (res->parent) 678 if (res->parent)
679 return; 679 return 0;
680 680
681 /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */ 681 /* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
682 mask = ~0xfff; 682 mask = ~0xfff;
@@ -692,7 +692,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
692 pcibios_bus_to_resource(socket->dev, res, &region); 692 pcibios_bus_to_resource(socket->dev, res, &region);
693 root = pci_find_parent_resource(socket->dev, res); 693 root = pci_find_parent_resource(socket->dev, res);
694 if (root && (request_resource(root, res) == 0)) 694 if (root && (request_resource(root, res) == 0))
695 return; 695 return 0;
696 printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n", 696 printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n",
697 pci_name(socket->dev), nr); 697 pci_name(socket->dev), nr);
698 } 698 }
@@ -700,35 +700,27 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
700 if (type & IORESOURCE_IO) { 700 if (type & IORESOURCE_IO) {
701 if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) || 701 if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) ||
702 (yenta_search_res(socket, res, BRIDGE_IO_ACC)) || 702 (yenta_search_res(socket, res, BRIDGE_IO_ACC)) ||
703 (yenta_search_res(socket, res, BRIDGE_IO_MIN))) { 703 (yenta_search_res(socket, res, BRIDGE_IO_MIN)))
704 config_writel(socket, addr_start, res->start); 704 return 1;
705 config_writel(socket, addr_end, res->end);
706 return;
707 }
708 } else { 705 } else {
709 if (type & IORESOURCE_PREFETCH) { 706 if (type & IORESOURCE_PREFETCH) {
710 if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || 707 if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
711 (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || 708 (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
712 (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { 709 (yenta_search_res(socket, res, BRIDGE_MEM_MIN)))
713 config_writel(socket, addr_start, res->start); 710 return 1;
714 config_writel(socket, addr_end, res->end);
715 return;
716 }
717 /* Approximating prefetchable by non-prefetchable */ 711 /* Approximating prefetchable by non-prefetchable */
718 res->flags = IORESOURCE_MEM; 712 res->flags = IORESOURCE_MEM;
719 } 713 }
720 if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) || 714 if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
721 (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) || 715 (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
722 (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { 716 (yenta_search_res(socket, res, BRIDGE_MEM_MIN)))
723 config_writel(socket, addr_start, res->start); 717 return 1;
724 config_writel(socket, addr_end, res->end);
725 return;
726 }
727 } 718 }
728 719
729 printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n", 720 printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n",
730 pci_name(socket->dev), type); 721 pci_name(socket->dev), type);
731 res->start = res->end = res->flags = 0; 722 res->start = res->end = res->flags = 0;
723 return 0;
732} 724}
733 725
734/* 726/*
@@ -736,14 +728,17 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ
736 */ 728 */
737static void yenta_allocate_resources(struct yenta_socket *socket) 729static void yenta_allocate_resources(struct yenta_socket *socket)
738{ 730{
739 yenta_allocate_res(socket, 0, IORESOURCE_IO, 731 int program = 0;
732 program += yenta_allocate_res(socket, 0, IORESOURCE_IO,
740 PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0); 733 PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0);
741 yenta_allocate_res(socket, 1, IORESOURCE_IO, 734 program += yenta_allocate_res(socket, 1, IORESOURCE_IO,
742 PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1); 735 PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1);
743 yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH, 736 program += yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH,
744 PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0); 737 PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0);
745 yenta_allocate_res(socket, 3, IORESOURCE_MEM, 738 program += yenta_allocate_res(socket, 3, IORESOURCE_MEM,
746 PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1); 739 PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1);
740 if (program)
741 pci_setup_cardbus(socket->dev->subordinate);
747} 742}
748 743
749 744
@@ -758,7 +753,7 @@ static void yenta_free_resources(struct yenta_socket *socket)
758 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i; 753 res = socket->dev->resource + PCI_BRIDGE_RESOURCES + i;
759 if (res->start != 0 && res->end != 0) 754 if (res->start != 0 && res->end != 0)
760 release_resource(res); 755 release_resource(res);
761 res->start = res->end = 0; 756 res->start = res->end = res->flags = 0;
762 } 757 }
763} 758}
764 759