ipa_endpoint.c (6833a09673001f7767b1d61875cf84af6209c0ab) ipa_endpoint.c (716a115b4f5c78c2919437bf875fc3ba46087c57)
1// SPDX-License-Identifier: GPL-2.0
2
3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2020 Linaro Ltd.
5 */
6
7#include <linux/types.h>
8#include <linux/device.h>

--- 1531 unchanged lines hidden (view full) ---

1540 u32 val;
1541
1542 /* Find out about the endpoints supplied by the hardware, and ensure
1543 * the highest one doesn't exceed the number we support.
1544 */
1545 val = ioread32(ipa->reg_virt + IPA_REG_FLAVOR_0_OFFSET);
1546
1547 /* Our RX is an IPA producer */
1// SPDX-License-Identifier: GPL-2.0
2
3/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4 * Copyright (C) 2019-2020 Linaro Ltd.
5 */
6
7#include <linux/types.h>
8#include <linux/device.h>

--- 1531 unchanged lines hidden (view full) ---

1540 u32 val;
1541
1542 /* Find out about the endpoints supplied by the hardware, and ensure
1543 * the highest one doesn't exceed the number we support.
1544 */
1545 val = ioread32(ipa->reg_virt + IPA_REG_FLAVOR_0_OFFSET);
1546
1547 /* Our RX is an IPA producer */
1548 rx_base = u32_get_bits(val, BAM_PROD_LOWEST_FMASK);
1549 max = rx_base + u32_get_bits(val, BAM_MAX_PROD_PIPES_FMASK);
1548 rx_base = u32_get_bits(val, IPA_PROD_LOWEST_FMASK);
1549 max = rx_base + u32_get_bits(val, IPA_MAX_PROD_PIPES_FMASK);
1550 if (max > IPA_ENDPOINT_MAX) {
1551 dev_err(dev, "too many endpoints (%u > %u)\n",
1552 max, IPA_ENDPOINT_MAX);
1553 return -EINVAL;
1554 }
1555 rx_mask = GENMASK(max - 1, rx_base);
1556
1557 /* Our TX is an IPA consumer */
1550 if (max > IPA_ENDPOINT_MAX) {
1551 dev_err(dev, "too many endpoints (%u > %u)\n",
1552 max, IPA_ENDPOINT_MAX);
1553 return -EINVAL;
1554 }
1555 rx_mask = GENMASK(max - 1, rx_base);
1556
1557 /* Our TX is an IPA consumer */
1558 max = u32_get_bits(val, BAM_MAX_CONS_PIPES_FMASK);
1558 max = u32_get_bits(val, IPA_MAX_CONS_PIPES_FMASK);
1559 tx_mask = GENMASK(max - 1, 0);
1560
1561 ipa->available = rx_mask | tx_mask;
1562
1563 /* Check for initialized endpoints not supported by the hardware */
1564 if (ipa->initialized & ~ipa->available) {
1565 dev_err(dev, "unavailable endpoint id(s) 0x%08x\n",
1566 ipa->initialized & ~ipa->available);

--- 104 unchanged lines hidden ---
1559 tx_mask = GENMASK(max - 1, 0);
1560
1561 ipa->available = rx_mask | tx_mask;
1562
1563 /* Check for initialized endpoints not supported by the hardware */
1564 if (ipa->initialized & ~ipa->available) {
1565 dev_err(dev, "unavailable endpoint id(s) 0x%08x\n",
1566 ipa->initialized & ~ipa->available);

--- 104 unchanged lines hidden ---