diff options
Diffstat (limited to 'drivers/parisc')
-rw-r--r-- | drivers/parisc/sba_iommu.c | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/parisc/sba_iommu.c b/drivers/parisc/sba_iommu.c index e0d6fbc66efd..5fbc11e4bc5d 100644 --- a/drivers/parisc/sba_iommu.c +++ b/drivers/parisc/sba_iommu.c | |||
@@ -117,9 +117,17 @@ | |||
117 | #define SBA_FUNC_ID 0x0000 /* function id */ | 117 | #define SBA_FUNC_ID 0x0000 /* function id */ |
118 | #define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */ | 118 | #define SBA_FCLASS 0x0008 /* function class, bist, header, rev... */ |
119 | 119 | ||
120 | #define IS_ASTRO(id) ((id)->hversion == ASTRO_RUNWAY_PORT) | 120 | static inline int IS_ASTRO(struct parisc_device *d) { |
121 | #define IS_IKE(id) ((id)->hversion == IKE_MERCED_PORT) | 121 | return d->id.hversion == ASTRO_RUNWAY_PORT; |
122 | #define IS_PLUTO(id) ((id)->hversion == PLUTO_MCKINLEY_PORT) | 122 | } |
123 | |||
124 | static inline int IS_IKE(struct parisc_device *d) { | ||
125 | return d->id.hversion == IKE_MERCED_PORT; | ||
126 | } | ||
127 | |||
128 | static inline int IS_PLUTO(struct parisc_device *d) { | ||
129 | return d->id.hversion == PLUTO_MCKINLEY_PORT; | ||
130 | } | ||
123 | 131 | ||
124 | #define SBA_FUNC_SIZE 4096 /* SBA configuration function reg set */ | 132 | #define SBA_FUNC_SIZE 4096 /* SBA configuration function reg set */ |
125 | 133 | ||
@@ -269,7 +277,6 @@ struct ioc { | |||
269 | struct sba_device { | 277 | struct sba_device { |
270 | struct sba_device *next; /* list of SBA's in system */ | 278 | struct sba_device *next; /* list of SBA's in system */ |
271 | struct parisc_device *dev; /* dev found in bus walk */ | 279 | struct parisc_device *dev; /* dev found in bus walk */ |
272 | struct parisc_device_id *iodc; /* data about dev from firmware */ | ||
273 | const char *name; | 280 | const char *name; |
274 | void __iomem *sba_hpa; /* base address */ | 281 | void __iomem *sba_hpa; /* base address */ |
275 | spinlock_t sba_lock; | 282 | spinlock_t sba_lock; |
@@ -1698,7 +1705,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1698 | } | 1705 | } |
1699 | #endif | 1706 | #endif |
1700 | 1707 | ||
1701 | if (!IS_PLUTO(sba_dev->iodc)) { | 1708 | if (!IS_PLUTO(sba_dev->dev)) { |
1702 | ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); | 1709 | ioc_ctl = READ_REG(sba_dev->sba_hpa+IOC_CTRL); |
1703 | DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", | 1710 | DBG_INIT("%s() hpa 0x%lx ioc_ctl 0x%Lx ->", |
1704 | __FUNCTION__, sba_dev->sba_hpa, ioc_ctl); | 1711 | __FUNCTION__, sba_dev->sba_hpa, ioc_ctl); |
@@ -1715,7 +1722,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1715 | #endif | 1722 | #endif |
1716 | } /* if !PLUTO */ | 1723 | } /* if !PLUTO */ |
1717 | 1724 | ||
1718 | if (IS_ASTRO(sba_dev->iodc)) { | 1725 | if (IS_ASTRO(sba_dev->dev)) { |
1719 | int err; | 1726 | int err; |
1720 | sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, ASTRO_IOC_OFFSET); | 1727 | sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, ASTRO_IOC_OFFSET); |
1721 | num_ioc = 1; | 1728 | num_ioc = 1; |
@@ -1726,7 +1733,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1726 | err = request_resource(&iomem_resource, &(sba_dev->chip_resv)); | 1733 | err = request_resource(&iomem_resource, &(sba_dev->chip_resv)); |
1727 | BUG_ON(err < 0); | 1734 | BUG_ON(err < 0); |
1728 | 1735 | ||
1729 | } else if (IS_PLUTO(sba_dev->iodc)) { | 1736 | } else if (IS_PLUTO(sba_dev->dev)) { |
1730 | int err; | 1737 | int err; |
1731 | 1738 | ||
1732 | sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, PLUTO_IOC_OFFSET); | 1739 | sba_dev->ioc[0].ioc_hpa = ioc_remap(sba_dev, PLUTO_IOC_OFFSET); |
@@ -1766,7 +1773,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1766 | * Overrides bit 1 in DMA Hint Sets. | 1773 | * Overrides bit 1 in DMA Hint Sets. |
1767 | * Improves netperf UDP_STREAM by ~10% for bcm5701. | 1774 | * Improves netperf UDP_STREAM by ~10% for bcm5701. |
1768 | */ | 1775 | */ |
1769 | if (IS_PLUTO(sba_dev->iodc)) { | 1776 | if (IS_PLUTO(sba_dev->dev)) { |
1770 | void __iomem *rope_cfg; | 1777 | void __iomem *rope_cfg; |
1771 | unsigned long cfg_val; | 1778 | unsigned long cfg_val; |
1772 | 1779 | ||
@@ -1795,7 +1802,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%x 0x%x 0x%x\n", PAGE0->mem_boot.hpa, | |||
1795 | READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400) | 1802 | READ_REG(sba_dev->ioc[i].ioc_hpa + 0x400) |
1796 | ); | 1803 | ); |
1797 | 1804 | ||
1798 | if (IS_PLUTO(sba_dev->iodc)) { | 1805 | if (IS_PLUTO(sba_dev->dev)) { |
1799 | sba_ioc_init_pluto(sba_dev->dev, &(sba_dev->ioc[i]), i); | 1806 | sba_ioc_init_pluto(sba_dev->dev, &(sba_dev->ioc[i]), i); |
1800 | } else { | 1807 | } else { |
1801 | sba_ioc_init(sba_dev->dev, &(sba_dev->ioc[i]), i); | 1808 | sba_ioc_init(sba_dev->dev, &(sba_dev->ioc[i]), i); |
@@ -2059,7 +2066,7 @@ sba_driver_callback(struct parisc_device *dev) | |||
2059 | /* Read HW Rev First */ | 2066 | /* Read HW Rev First */ |
2060 | func_class = READ_REG(sba_addr + SBA_FCLASS); | 2067 | func_class = READ_REG(sba_addr + SBA_FCLASS); |
2061 | 2068 | ||
2062 | if (IS_ASTRO(&dev->id)) { | 2069 | if (IS_ASTRO(dev)) { |
2063 | unsigned long fclass; | 2070 | unsigned long fclass; |
2064 | static char astro_rev[]="Astro ?.?"; | 2071 | static char astro_rev[]="Astro ?.?"; |
2065 | 2072 | ||
@@ -2070,11 +2077,11 @@ sba_driver_callback(struct parisc_device *dev) | |||
2070 | astro_rev[8] = '0' + (char) ((fclass & 0x18) >> 3); | 2077 | astro_rev[8] = '0' + (char) ((fclass & 0x18) >> 3); |
2071 | version = astro_rev; | 2078 | version = astro_rev; |
2072 | 2079 | ||
2073 | } else if (IS_IKE(&dev->id)) { | 2080 | } else if (IS_IKE(dev)) { |
2074 | static char ike_rev[] = "Ike rev ?"; | 2081 | static char ike_rev[] = "Ike rev ?"; |
2075 | ike_rev[8] = '0' + (char) (func_class & 0xff); | 2082 | ike_rev[8] = '0' + (char) (func_class & 0xff); |
2076 | version = ike_rev; | 2083 | version = ike_rev; |
2077 | } else if (IS_PLUTO(&dev->id)) { | 2084 | } else if (IS_PLUTO(dev)) { |
2078 | static char pluto_rev[]="Pluto ?.?"; | 2085 | static char pluto_rev[]="Pluto ?.?"; |
2079 | pluto_rev[6] = '0' + (char) ((func_class & 0xf0) >> 4); | 2086 | pluto_rev[6] = '0' + (char) ((func_class & 0xf0) >> 4); |
2080 | pluto_rev[8] = '0' + (char) (func_class & 0x0f); | 2087 | pluto_rev[8] = '0' + (char) (func_class & 0x0f); |
@@ -2089,7 +2096,7 @@ sba_driver_callback(struct parisc_device *dev) | |||
2089 | global_ioc_cnt = count_parisc_driver(&sba_driver); | 2096 | global_ioc_cnt = count_parisc_driver(&sba_driver); |
2090 | 2097 | ||
2091 | /* Astro and Pluto have one IOC per SBA */ | 2098 | /* Astro and Pluto have one IOC per SBA */ |
2092 | if ((!IS_ASTRO(&dev->id)) || (!IS_PLUTO(&dev->id))) | 2099 | if ((!IS_ASTRO(dev)) || (!IS_PLUTO(dev))) |
2093 | global_ioc_cnt *= 2; | 2100 | global_ioc_cnt *= 2; |
2094 | } | 2101 | } |
2095 | 2102 | ||
@@ -2109,7 +2116,6 @@ sba_driver_callback(struct parisc_device *dev) | |||
2109 | 2116 | ||
2110 | sba_dev->dev = dev; | 2117 | sba_dev->dev = dev; |
2111 | sba_dev->hw_rev = func_class; | 2118 | sba_dev->hw_rev = func_class; |
2112 | sba_dev->iodc = &dev->id; | ||
2113 | sba_dev->name = dev->name; | 2119 | sba_dev->name = dev->name; |
2114 | sba_dev->sba_hpa = sba_addr; | 2120 | sba_dev->sba_hpa = sba_addr; |
2115 | 2121 | ||