Skip to content

Commit a7860a5

Browse files
Alex Elderdavem330
authored andcommitted
net: ipa: move some GSI setup functions
Move gsi_irq_setup() and gsi_ring_setup() so they're defined right above gsi_setup() where they're called. This is a trivial movement of code to prepare for upcoming patches. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 4a4ba48 commit a7860a5

File tree

1 file changed

+71
-71
lines changed

1 file changed

+71
-71
lines changed

drivers/net/ipa/gsi.c

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -198,77 +198,6 @@ static void gsi_irq_type_disable(struct gsi *gsi, enum gsi_irq_type_id type_id)
198198
gsi_irq_type_update(gsi, gsi->type_enabled_bitmap & ~BIT(type_id));
199199
}
200200

201-
/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */
202-
static void gsi_irq_setup(struct gsi *gsi)
203-
{
204-
/* Disable all interrupt types */
205-
gsi_irq_type_update(gsi, 0);
206-
207-
/* Clear all type-specific interrupt masks */
208-
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
209-
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
210-
iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
211-
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
212-
213-
/* The inter-EE interrupts are not supported for IPA v3.0-v3.1 */
214-
if (gsi->version > IPA_VERSION_3_1) {
215-
u32 offset;
216-
217-
/* These registers are in the non-adjusted address range */
218-
offset = GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET;
219-
iowrite32(0, gsi->virt_raw + offset);
220-
offset = GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET;
221-
iowrite32(0, gsi->virt_raw + offset);
222-
}
223-
224-
iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
225-
}
226-
227-
/* Get # supported channel and event rings; there is no gsi_ring_teardown() */
228-
static int gsi_ring_setup(struct gsi *gsi)
229-
{
230-
struct device *dev = gsi->dev;
231-
u32 count;
232-
u32 val;
233-
234-
if (gsi->version < IPA_VERSION_3_5_1) {
235-
/* No HW_PARAM_2 register prior to IPA v3.5.1, assume the max */
236-
gsi->channel_count = GSI_CHANNEL_COUNT_MAX;
237-
gsi->evt_ring_count = GSI_EVT_RING_COUNT_MAX;
238-
239-
return 0;
240-
}
241-
242-
val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET);
243-
244-
count = u32_get_bits(val, NUM_CH_PER_EE_FMASK);
245-
if (!count) {
246-
dev_err(dev, "GSI reports zero channels supported\n");
247-
return -EINVAL;
248-
}
249-
if (count > GSI_CHANNEL_COUNT_MAX) {
250-
dev_warn(dev, "limiting to %u channels; hardware supports %u\n",
251-
GSI_CHANNEL_COUNT_MAX, count);
252-
count = GSI_CHANNEL_COUNT_MAX;
253-
}
254-
gsi->channel_count = count;
255-
256-
count = u32_get_bits(val, NUM_EV_PER_EE_FMASK);
257-
if (!count) {
258-
dev_err(dev, "GSI reports zero event rings supported\n");
259-
return -EINVAL;
260-
}
261-
if (count > GSI_EVT_RING_COUNT_MAX) {
262-
dev_warn(dev,
263-
"limiting to %u event rings; hardware supports %u\n",
264-
GSI_EVT_RING_COUNT_MAX, count);
265-
count = GSI_EVT_RING_COUNT_MAX;
266-
}
267-
gsi->evt_ring_count = count;
268-
269-
return 0;
270-
}
271-
272201
/* Event ring commands are performed one at a time. Their completion
273202
* is signaled by the event ring control GSI interrupt type, which is
274203
* only enabled when we issue an event ring command. Only the event
@@ -1878,6 +1807,77 @@ static void gsi_channel_teardown(struct gsi *gsi)
18781807
gsi_irq_disable(gsi);
18791808
}
18801809

1810+
/* Turn off all GSI interrupts initially; there is no gsi_irq_teardown() */
1811+
static void gsi_irq_setup(struct gsi *gsi)
1812+
{
1813+
/* Disable all interrupt types */
1814+
gsi_irq_type_update(gsi, 0);
1815+
1816+
/* Clear all type-specific interrupt masks */
1817+
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_CH_IRQ_MSK_OFFSET);
1818+
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_EV_CH_IRQ_MSK_OFFSET);
1819+
iowrite32(0, gsi->virt + GSI_CNTXT_GLOB_IRQ_EN_OFFSET);
1820+
iowrite32(0, gsi->virt + GSI_CNTXT_SRC_IEOB_IRQ_MSK_OFFSET);
1821+
1822+
/* The inter-EE interrupts are not supported for IPA v3.0-v3.1 */
1823+
if (gsi->version > IPA_VERSION_3_1) {
1824+
u32 offset;
1825+
1826+
/* These registers are in the non-adjusted address range */
1827+
offset = GSI_INTER_EE_SRC_CH_IRQ_MSK_OFFSET;
1828+
iowrite32(0, gsi->virt_raw + offset);
1829+
offset = GSI_INTER_EE_SRC_EV_CH_IRQ_MSK_OFFSET;
1830+
iowrite32(0, gsi->virt_raw + offset);
1831+
}
1832+
1833+
iowrite32(0, gsi->virt + GSI_CNTXT_GSI_IRQ_EN_OFFSET);
1834+
}
1835+
1836+
/* Get # supported channel and event rings; there is no gsi_ring_teardown() */
1837+
static int gsi_ring_setup(struct gsi *gsi)
1838+
{
1839+
struct device *dev = gsi->dev;
1840+
u32 count;
1841+
u32 val;
1842+
1843+
if (gsi->version < IPA_VERSION_3_5_1) {
1844+
/* No HW_PARAM_2 register prior to IPA v3.5.1, assume the max */
1845+
gsi->channel_count = GSI_CHANNEL_COUNT_MAX;
1846+
gsi->evt_ring_count = GSI_EVT_RING_COUNT_MAX;
1847+
1848+
return 0;
1849+
}
1850+
1851+
val = ioread32(gsi->virt + GSI_GSI_HW_PARAM_2_OFFSET);
1852+
1853+
count = u32_get_bits(val, NUM_CH_PER_EE_FMASK);
1854+
if (!count) {
1855+
dev_err(dev, "GSI reports zero channels supported\n");
1856+
return -EINVAL;
1857+
}
1858+
if (count > GSI_CHANNEL_COUNT_MAX) {
1859+
dev_warn(dev, "limiting to %u channels; hardware supports %u\n",
1860+
GSI_CHANNEL_COUNT_MAX, count);
1861+
count = GSI_CHANNEL_COUNT_MAX;
1862+
}
1863+
gsi->channel_count = count;
1864+
1865+
count = u32_get_bits(val, NUM_EV_PER_EE_FMASK);
1866+
if (!count) {
1867+
dev_err(dev, "GSI reports zero event rings supported\n");
1868+
return -EINVAL;
1869+
}
1870+
if (count > GSI_EVT_RING_COUNT_MAX) {
1871+
dev_warn(dev,
1872+
"limiting to %u event rings; hardware supports %u\n",
1873+
GSI_EVT_RING_COUNT_MAX, count);
1874+
count = GSI_EVT_RING_COUNT_MAX;
1875+
}
1876+
gsi->evt_ring_count = count;
1877+
1878+
return 0;
1879+
}
1880+
18811881
/* Setup function for GSI. GSI firmware must be loaded and initialized */
18821882
int gsi_setup(struct gsi *gsi)
18831883
{

0 commit comments

Comments
 (0)