Skip to content

Commit

Permalink
Merge branch 'net-ipa-I-O-map-SMEM-and-IMEM'
Browse files Browse the repository at this point in the history
Alex Elder says:

====================
net: ipa: I/O map SMEM and IMEM

This series adds the definition of two memory regions that must be
mapped for IPA to access through an SMMU.  It requires the SMMU to
be defined in the IPA node in the SoC's Device Tree file.

There is no change since version 1 to the content of the code in
these patches, *however* this time the first patch is an update to
the binding definition rather than an update to a DTS file.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed May 4, 2020
2 parents cad5eaf + a0036bb commit 09be4c4
Show file tree
Hide file tree
Showing 8 changed files with 263 additions and 22 deletions.
10 changes: 9 additions & 1 deletion Documentation/devicetree/bindings/net/qcom,ipa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ description:
The GSI is an integral part of the IPA, but it is logically isolated
and has a distinct interrupt and a separately-defined address space.

See also soc/qcom/qcom,smp2p.txt and interconnect/interconnect.txt.
See also soc/qcom/qcom,smp2p.txt and interconnect/interconnect.txt. See
iommu/iommu.txt and iommu/arm,smmu.yaml for more information about SMMU
bindings.


- |
-------- ---------
Expand Down Expand Up @@ -54,6 +57,9 @@ properties:
- const: ipa-shared
- const: gsi

iommus:
maxItems: 1

clocks:
maxItems: 1

Expand Down Expand Up @@ -126,6 +132,7 @@ properties:

required:
- compatible
- iommus
- reg
- clocks
- interrupts
Expand Down Expand Up @@ -164,6 +171,7 @@ examples:
modem-init;
modem-remoteproc = <&mss_pil>;
iommus = <&apps_smmu 0x720 0x3>;
reg = <0 0x1e40000 0 0x7000>,
<0 0x1e47000 0 0x2000>,
<0 0x1e04000 0 0x2c000>;
Expand Down
10 changes: 10 additions & 0 deletions drivers/net/ipa/ipa.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ struct ipa_interrupt;
* @mem_offset: Offset from @mem_virt used for access to IPA memory
* @mem_size: Total size (bytes) of memory at @mem_virt
* @mem: Array of IPA-local memory region descriptors
* @imem_iova: I/O virtual address of IPA region in IMEM
* @imem_size; Size of IMEM region
* @smem_iova: I/O virtual address of IPA region in SMEM
* @smem_size; Size of SMEM region
* @zero_addr: DMA address of preallocated zero-filled memory
* @zero_virt: Virtual address of preallocated zero-filled memory
* @zero_size: Size (bytes) of preallocated zero-filled memory
Expand Down Expand Up @@ -88,6 +92,12 @@ struct ipa {
u32 mem_size;
const struct ipa_mem *mem;

unsigned long imem_iova;
size_t imem_size;

unsigned long smem_iova;
size_t smem_size;

dma_addr_t zero_addr;
void *zero_virt;
size_t zero_size;
Expand Down
14 changes: 11 additions & 3 deletions drivers/net/ipa/ipa_data-sc7180.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ static const struct ipa_resource_data ipa_resource_data = {
};

/* IPA-resident memory region configuration for the SC7180 SoC. */
static const struct ipa_mem ipa_mem_data[] = {
static const struct ipa_mem ipa_mem_local_data[] = {
[IPA_MEM_UC_SHARED] = {
.offset = 0x0000,
.size = 0x0080,
Expand Down Expand Up @@ -296,12 +296,20 @@ static const struct ipa_mem ipa_mem_data[] = {
},
};

static struct ipa_mem_data ipa_mem_data = {
.local_count = ARRAY_SIZE(ipa_mem_local_data),
.local = ipa_mem_local_data,
.imem_addr = 0x146a8000,
.imem_size = 0x00002000,
.smem_id = 497,
.smem_size = 0x00002000,
};

/* Configuration data for the SC7180 SoC. */
const struct ipa_data ipa_data_sc7180 = {
.version = IPA_VERSION_4_2,
.endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
.endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data,
.mem_count = ARRAY_SIZE(ipa_mem_data),
.mem_data = ipa_mem_data,
.mem_data = &ipa_mem_data,
};
14 changes: 11 additions & 3 deletions drivers/net/ipa/ipa_data-sdm845.c
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ static const struct ipa_resource_data ipa_resource_data = {
};

/* IPA-resident memory region configuration for the SDM845 SoC. */
static const struct ipa_mem ipa_mem_data[] = {
static const struct ipa_mem ipa_mem_local_data[] = {
[IPA_MEM_UC_SHARED] = {
.offset = 0x0000,
.size = 0x0080,
Expand Down Expand Up @@ -318,12 +318,20 @@ static const struct ipa_mem ipa_mem_data[] = {
},
};

static struct ipa_mem_data ipa_mem_data = {
.local_count = ARRAY_SIZE(ipa_mem_local_data),
.local = ipa_mem_local_data,
.imem_addr = 0x146bd000,
.imem_size = 0x00002000,
.smem_id = 497,
.smem_size = 0x00002000,
};

/* Configuration data for the SDM845 SoC. */
const struct ipa_data ipa_data_sdm845 = {
.version = IPA_VERSION_3_5_1,
.endpoint_count = ARRAY_SIZE(ipa_gsi_endpoint_data),
.endpoint_data = ipa_gsi_endpoint_data,
.resource_data = &ipa_resource_data,
.mem_count = ARRAY_SIZE(ipa_mem_data),
.mem_data = ipa_mem_data,
.mem_data = &ipa_mem_data,
};
23 changes: 14 additions & 9 deletions drivers/net/ipa/ipa_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,21 @@ struct ipa_resource_data {
};

/**
* struct ipa_mem - IPA-local memory region description
* @offset: offset in IPA memory space to base of the region
* @size: size in bytes base of the region
* @canary_count: number of 32-bit "canary" values that precede region
* struct ipa_mem - description of IPA memory regions
* @local_count: number of regions defined in the local[] array
* @local: array of IPA-local memory region descriptors
* @imem_addr: physical address of IPA region within IMEM
* @imem_size: size in bytes of IPA IMEM region
* @smem_id: item identifier for IPA region within SMEM memory
* @imem_size: size in bytes of the IPA SMEM region
*/
struct ipa_mem_data {
u32 offset;
u16 size;
u16 canary_count;
u32 local_count;
const struct ipa_mem *local;
u32 imem_addr;
u32 imem_size;
u32 smem_id;
u32 smem_size;
};

/**
Expand All @@ -270,8 +276,7 @@ struct ipa_data {
u32 endpoint_count; /* # entries in endpoint_data[] */
const struct ipa_gsi_endpoint_data *endpoint_data;
const struct ipa_resource_data *resource_data;
u32 mem_count; /* # entries in mem_data[] */
const struct ipa_mem *mem_data;
const struct ipa_mem_data *mem_data;
};

extern const struct ipa_data ipa_data_sdm845;
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/ipa/ipa_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -778,7 +778,7 @@ static int ipa_probe(struct platform_device *pdev)
if (ret)
goto err_kfree_ipa;

ret = ipa_mem_init(ipa, data->mem_count, data->mem_data);
ret = ipa_mem_init(ipa, data->mem_data);
if (ret)
goto err_reg_exit;

Expand Down
Loading

0 comments on commit 09be4c4

Please sign in to comment.