diff options
| -rw-r--r-- | arch/arm/mach-ixp4xx/common.c | 21 | ||||
| -rw-r--r-- | arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h | 3 | ||||
| -rw-r--r-- | drivers/soc/ixp4xx/ixp4xx-npe.c | 36 | ||||
| -rw-r--r-- | include/linux/soc/ixp4xx/npe.h | 2 |
4 files changed, 41 insertions, 21 deletions
diff --git a/arch/arm/mach-ixp4xx/common.c b/arch/arm/mach-ixp4xx/common.c index cdcd6d6b6d3d..07c3cb312a92 100644 --- a/arch/arm/mach-ixp4xx/common.c +++ b/arch/arm/mach-ixp4xx/common.c | |||
| @@ -150,9 +150,30 @@ static struct platform_device ixp4xx_udc_device = { | |||
| 150 | }, | 150 | }, |
| 151 | }; | 151 | }; |
| 152 | 152 | ||
| 153 | static struct resource ixp4xx_npe_resources[] = { | ||
| 154 | { | ||
| 155 | .start = IXP4XX_NPEA_BASE_PHYS, | ||
| 156 | .end = IXP4XX_NPEA_BASE_PHYS + 0xfff, | ||
| 157 | .flags = IORESOURCE_MEM, | ||
| 158 | }, | ||
| 159 | { | ||
| 160 | .start = IXP4XX_NPEB_BASE_PHYS, | ||
| 161 | .end = IXP4XX_NPEB_BASE_PHYS + 0xfff, | ||
| 162 | .flags = IORESOURCE_MEM, | ||
| 163 | }, | ||
| 164 | { | ||
| 165 | .start = IXP4XX_NPEC_BASE_PHYS, | ||
| 166 | .end = IXP4XX_NPEC_BASE_PHYS + 0xfff, | ||
| 167 | .flags = IORESOURCE_MEM, | ||
| 168 | }, | ||
| 169 | |||
| 170 | }; | ||
| 171 | |||
| 153 | static struct platform_device ixp4xx_npe_device = { | 172 | static struct platform_device ixp4xx_npe_device = { |
| 154 | .name = "ixp4xx-npe", | 173 | .name = "ixp4xx-npe", |
| 155 | .id = -1, | 174 | .id = -1, |
| 175 | .num_resources = ARRAY_SIZE(ixp4xx_npe_resources), | ||
| 176 | .resource = ixp4xx_npe_resources, | ||
| 156 | }; | 177 | }; |
| 157 | 178 | ||
| 158 | static struct platform_device ixp4xx_qmgr_device = { | 179 | static struct platform_device ixp4xx_qmgr_device = { |
diff --git a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h index 459abe2eb4b5..f5d5b258c3f7 100644 --- a/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h +++ b/arch/arm/mach-ixp4xx/include/mach/ixp4xx-regs.h | |||
| @@ -132,9 +132,6 @@ | |||
| 132 | #define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000) | 132 | #define IXP4XX_INTC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x3000) |
| 133 | #define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000) | 133 | #define IXP4XX_GPIO_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x4000) |
| 134 | #define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000) | 134 | #define IXP4XX_TIMER_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x5000) |
| 135 | #define IXP4XX_NPEA_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x6000) | ||
| 136 | #define IXP4XX_NPEB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x7000) | ||
| 137 | #define IXP4XX_NPEC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x8000) | ||
| 138 | #define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000) | 135 | #define IXP4XX_EthB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0x9000) |
| 139 | #define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000) | 136 | #define IXP4XX_EthC_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xA000) |
| 140 | #define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000) | 137 | #define IXP4XX_USB_BASE_VIRT (IXP4XX_PERIPHERAL_BASE_VIRT + 0xB000) |
diff --git a/drivers/soc/ixp4xx/ixp4xx-npe.c b/drivers/soc/ixp4xx/ixp4xx-npe.c index e3294457b5de..d2dd916816d4 100644 --- a/drivers/soc/ixp4xx/ixp4xx-npe.c +++ b/drivers/soc/ixp4xx/ixp4xx-npe.c | |||
| @@ -155,16 +155,10 @@ static struct { | |||
| 155 | static struct npe npe_tab[NPE_COUNT] = { | 155 | static struct npe npe_tab[NPE_COUNT] = { |
| 156 | { | 156 | { |
| 157 | .id = 0, | 157 | .id = 0, |
| 158 | .regs = (struct npe_regs __iomem *)IXP4XX_NPEA_BASE_VIRT, | ||
| 159 | .regs_phys = IXP4XX_NPEA_BASE_PHYS, | ||
| 160 | }, { | 158 | }, { |
| 161 | .id = 1, | 159 | .id = 1, |
| 162 | .regs = (struct npe_regs __iomem *)IXP4XX_NPEB_BASE_VIRT, | ||
| 163 | .regs_phys = IXP4XX_NPEB_BASE_PHYS, | ||
| 164 | }, { | 160 | }, { |
| 165 | .id = 2, | 161 | .id = 2, |
| 166 | .regs = (struct npe_regs __iomem *)IXP4XX_NPEC_BASE_VIRT, | ||
| 167 | .regs_phys = IXP4XX_NPEC_BASE_PHYS, | ||
| 168 | } | 162 | } |
| 169 | }; | 163 | }; |
| 170 | 164 | ||
| @@ -687,23 +681,34 @@ void npe_release(struct npe *npe) | |||
| 687 | static int ixp4xx_npe_probe(struct platform_device *pdev) | 681 | static int ixp4xx_npe_probe(struct platform_device *pdev) |
| 688 | { | 682 | { |
| 689 | int i, found = 0; | 683 | int i, found = 0; |
| 684 | struct device *dev = &pdev->dev; | ||
| 685 | struct resource *res; | ||
| 690 | 686 | ||
| 691 | for (i = 0; i < NPE_COUNT; i++) { | 687 | for (i = 0; i < NPE_COUNT; i++) { |
| 692 | struct npe *npe = &npe_tab[i]; | 688 | struct npe *npe = &npe_tab[i]; |
| 689 | |||
| 690 | res = platform_get_resource(pdev, IORESOURCE_MEM, i); | ||
| 691 | if (!res) | ||
| 692 | return -ENODEV; | ||
| 693 | |||
| 693 | if (!(ixp4xx_read_feature_bits() & | 694 | if (!(ixp4xx_read_feature_bits() & |
| 694 | (IXP4XX_FEATURE_RESET_NPEA << i))) | 695 | (IXP4XX_FEATURE_RESET_NPEA << i))) { |
| 696 | dev_info(dev, "NPE%d at 0x%08x-0x%08x not available\n", | ||
| 697 | i, res->start, res->end); | ||
| 695 | continue; /* NPE already disabled or not present */ | 698 | continue; /* NPE already disabled or not present */ |
| 696 | if (!(npe->mem_res = request_mem_region(npe->regs_phys, | ||
| 697 | REGS_SIZE, | ||
| 698 | npe_name(npe)))) { | ||
| 699 | print_npe(KERN_ERR, npe, | ||
| 700 | "failed to request memory region\n"); | ||
| 701 | continue; | ||
| 702 | } | 699 | } |
| 700 | npe->regs = devm_ioremap_resource(dev, res); | ||
| 701 | if (!npe->regs) | ||
| 702 | return -ENOMEM; | ||
| 703 | 703 | ||
| 704 | if (npe_reset(npe)) | 704 | if (npe_reset(npe)) { |
| 705 | dev_info(dev, "NPE%d at 0x%08x-0x%08x does not reset\n", | ||
| 706 | i, res->start, res->end); | ||
| 705 | continue; | 707 | continue; |
| 708 | } | ||
| 706 | npe->valid = 1; | 709 | npe->valid = 1; |
| 710 | dev_info(dev, "NPE%d at 0x%08x-0x%08x registered\n", | ||
| 711 | i, res->start, res->end); | ||
| 707 | found++; | 712 | found++; |
| 708 | } | 713 | } |
| 709 | 714 | ||
| @@ -717,9 +722,8 @@ static int ixp4xx_npe_remove(struct platform_device *pdev) | |||
| 717 | int i; | 722 | int i; |
| 718 | 723 | ||
| 719 | for (i = 0; i < NPE_COUNT; i++) | 724 | for (i = 0; i < NPE_COUNT; i++) |
| 720 | if (npe_tab[i].mem_res) { | 725 | if (npe_tab[i].regs) { |
| 721 | npe_reset(&npe_tab[i]); | 726 | npe_reset(&npe_tab[i]); |
| 722 | release_resource(npe_tab[i].mem_res); | ||
| 723 | } | 727 | } |
| 724 | 728 | ||
| 725 | return 0; | 729 | return 0; |
diff --git a/include/linux/soc/ixp4xx/npe.h b/include/linux/soc/ixp4xx/npe.h index 3a980845e557..2a91f465d456 100644 --- a/include/linux/soc/ixp4xx/npe.h +++ b/include/linux/soc/ixp4xx/npe.h | |||
| @@ -16,9 +16,7 @@ struct npe_regs { | |||
| 16 | }; | 16 | }; |
| 17 | 17 | ||
| 18 | struct npe { | 18 | struct npe { |
| 19 | struct resource *mem_res; | ||
| 20 | struct npe_regs __iomem *regs; | 19 | struct npe_regs __iomem *regs; |
| 21 | u32 regs_phys; | ||
| 22 | int id; | 20 | int id; |
| 23 | int valid; | 21 | int valid; |
| 24 | }; | 22 | }; |
