memory: tegra: Add MC channels and error logging
v9 cover memory: tegra: Add MC channels and error logging
From tegra186 onward, memory controllers support multiple channels. Add memory controller channels in device tree and add support to map address spaces of these channels in tegra MC driver.
When memory controller interrupt occurs, registers from these channels are required to be read in order to get error information. Add error logging support from tegra186 onward for memory controller interrupts.
Ashish Mhetre (4):
memory: tegra: Add memory controller channels support
memory: tegra: Add MC error logging on tegra186 onward
dt-bindings: memory: tegra: Update validation for reg and reg-names
arm64: tegra: Add memory controller channels
---
Changes in v9:
- Updated data type of loop variable 'i' from int to unsigned int
- Used sizeof(*mc->ch_regs) instead of sizeof(void __iomem *)
- Updated commit message
Changes in v8:
- Updated the bindings patch commit message to reflect the ABI change and added "tegra" in subject
- Updated function name with "mc_" prefix
- Used snprintf instead of sprintf
- Set mc->bcast_ch_regs to NULL in case of old bindings and checking for NULL before accessing it
Changes in v7:
- Updated reg-names as per comments on v6
- Removed use of of_property_count_elems_of_size() and used broadcast reg for checking whether old or new DTS is getting used
- Updated variable names as per comments on v6
- Added helper function for getting global_intstatus bit from channel
- Used to_platform_device() instead of passing pdev pointer to map_regs()
- Allocated ch_regs at runtime
- Updated DT binding documentation to add validation for reg-names
Changes in v6:
- Added reg-names for each reg item of memory controller node
- Added logging for interrupts on multiple memory controller channels
- Added clearing interrupt support for global intstatus
- Updated DT binding documentation to work with existing DTS as well
- Updated function to get MC channels
- Updated variable names
Changes in v5:
- Updated patch sequence such that driver patches are before DT patches
- Fixed DT ABI break from v4
- Fixed smatch bug
- Updated description in DT binding documentation
- Updated variable names
Changes in v4:
- Added memory controller channels support
- Added newlines after every break statement of all switch cases
- Fixed compile error with W=1 build
- Fixed the interrupt mask bit logic
Changes in v3:
- Removed unnecessary ifdefs
- Grouped newly added MC registers with existing MC registers
- Removed unnecessary initialization of variables
- Updated code to use newly added field 'has_addr_hi_reg' instead of ifdefs
Changes in v2:
- Updated patch subject and commit message
- Removed separate irq handlers
- Updated tegra30_mc_handle_irq to be used for tegra186 onwards as well
.../nvidia,tegra186-mc.yaml | 80 +++++++++- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 8 +- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 24 ++- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 24 ++- drivers/memory/tegra/mc.c | 140 ++++++++++++++++-- drivers/memory/tegra/mc.h | 43 +++++- drivers/memory/tegra/tegra186.c | 43 ++++++ drivers/memory/tegra/tegra194.c | 9 ++ drivers/memory/tegra/tegra234.c | 8 + include/soc/tegra/mc.h | 7 + 10 files changed, 356 insertions(+), 30 deletions(-)
Signature · 1 line
2.17.1
PATCH v9 1/4 memory: tegra: Add memory controller channels support
From tegra186 onwards, memory controller support multiple channels. Add support for mapping address spaces of these channels. Add number of channels supported by tegra186, tegra194 and tegra234. In case of old bindings, channels won't be present. If channels are not present then print warning and continue so that backward compatibility will be preserved in driver.
During error interrupts from memory controller, appropriate registers from these channels need to be accessed for logging error info.
--- drivers/memory/tegra/mc.c | 6 ++++++ drivers/memory/tegra/tegra186.c | 34 +++++++++++++++++++++++++++++++++ drivers/memory/tegra/tegra194.c | 1 + drivers/memory/tegra/tegra234.c | 1 + include/soc/tegra/mc.h | 4 ++++ 5 files changed, 46 insertions(+)
drivers/memory/tegra/mc.c +6 -0
@@ -749,6 +749,12 @@ static int tegra_mc_probe(struct platform_device *pdev)if (IS_ERR (mc->regs))return PTR_ERR (mc->regs); +if (mc->soc->ops && mc->soc->ops->map_regs) { + err = mc->soc->ops->map_regs (mc); +if (err <0 ) +return err; + } + mc->debugfs.root =debugfs_create_dir ("mc" ,NULL );if (mc->soc->ops && mc->soc->ops->probe) {
drivers/memory/tegra/tegra186.c +34 -0
@@ -139,11 +139,44 @@ static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev)return 0 ; } +static int tegra186_mc_map_regs (struct tegra_mc *mc) +{ +struct platform_device *pdev =to_platform_device (mc->dev); +unsigned int i; + + mc->bcast_ch_regs =devm_platform_ioremap_resource_byname (pdev,"broadcast" ); +if (IS_ERR (mc->bcast_ch_regs)) { +if (PTR_ERR (mc->bcast_ch_regs) == -EINVAL ) { +dev_warn (&pdev->dev,"Broadcast channel is missing, please update your device-tree\n" ); + mc->bcast_ch_regs =NULL ; +return 0 ; + } +return PTR_ERR (mc->bcast_ch_regs); + } + + mc->ch_regs =devm_kcalloc (mc->dev, mc->soc->num_channels, +sizeof (*mc->ch_regs),GFP_KERNEL ); +if (!mc->ch_regs) +return -ENOMEM ; + +for (i =0 ; i < mc->soc->num_channels; i++) { +char name[5 ]; + +snprintf (name,sizeof (name),"ch%u" , i); + mc->ch_regs[i] =devm_platform_ioremap_resource_byname (pdev, name); +if (IS_ERR (mc->ch_regs[i])) +return PTR_ERR (mc->ch_regs[i]); + } + +return 0 ; +} +const struct tegra_mc_ops tegra186_mc_ops = { .probe = tegra186_mc_probe, .remove = tegra186_mc_remove, .resume = tegra186_mc_resume, .probe_device = tegra186_mc_probe_device, + .map_regs = tegra186_mc_map_regs, };#if defined(CONFIG_ARCH_TEGRA_186_SOC )
@@ -875,6 +908,7 @@ const struct tegra_mc_soc tegra186_mc_soc = { .num_clients = ARRAY_SIZE(tegra186_mc_clients), .clients = tegra186_mc_clients, .num_address_bits = 40, + .num_channels = 4, .ops = &tegra186_mc_ops, };#endif
drivers/memory/tegra/tegra194.c +1 -0
@@ -1347,5 +1347,6 @@ const struct tegra_mc_soc tegra194_mc_soc = { .num_clients = ARRAY_SIZE(tegra194_mc_clients), .clients = tegra194_mc_clients, .num_address_bits = 40, + .num_channels = 16, .ops = &tegra186_mc_ops, };
drivers/memory/tegra/tegra234.c +1 -0
@@ -97,5 +97,6 @@ const struct tegra_mc_soc tegra234_mc_soc = { .num_clients = ARRAY_SIZE(tegra234_mc_clients), .clients = tegra234_mc_clients, .num_address_bits = 40, + .num_channels = 16, .ops = &tegra186_mc_ops, };
include/soc/tegra/mc.h +4 -0
@@ -181,6 +181,7 @@ struct tegra_mc_ops {int (*resume)(struct tegra_mc *mc);irqreturn_t (*handle_irq)(int irq,void *data);int (*probe_device)(struct tegra_mc *mc,struct device *dev); +int (*map_regs)(struct tegra_mc *mc); };struct tegra_mc_soc {
@@ -194,6 +195,7 @@ struct tegra_mc_soc {unsigned int atom_size;u8 client_id_mask; +u8 num_channels;const struct tegra_smmu_soc *smmu;
@@ -212,6 +214,8 @@ struct tegra_mc {struct tegra_smmu *smmu;struct gart_device *gart;void __iomem *regs; +void __iomem *bcast_ch_regs; +void __iomem **ch_regs;struct clk *clk;int irq;
Signature · 1 line
2.17.1
Re: [Patch v9 1/4] memory: tegra: Add memory controller channels support
Quoted 9 lines · Ashish Mhetre
From tegra186 onwards, memory controller support multiple channels. Add support for mapping address spaces of these channels. Add number of channels supported by tegra186, tegra194 and tegra234. In case of old bindings, channels won't be present. If channels are not present then print warning and continue so that backward compatibility will be preserved in driver.
During error interrupts from memory controller, appropriate registers from these channels need to be accessed for logging error info.
Quoted 7 lines
Reviewed-by Dmitry Osipenko <[email protected]>Signed-off-by Ashish Mhetre <[email protected]>--- drivers/memory/tegra/mc.c | 6 ++++++ drivers/memory/tegra/tegra186.c | 34 +++++++++++++++++++++++++++++++++ drivers/memory/tegra/tegra194.c | 1 + drivers/memory/tegra/tegra234.c | 1 +
This does not apply, neither on my mem-ctrl-next, nor on master. Probably because tegra234 is somewhere else (Thierry?). Either you send it without tegra234 or it goes via Thierry's tree.
Best regards,
Krzysztof
Re: [Patch v9 1/4] memory: tegra: Add memory controller channels support
Quoted 18 lines · Krzysztof Kozlowski
Quoted 9 lines · Ashish Mhetre
From tegra186 onwards, memory controller support multiple channels. Add support for mapping address spaces of these channels. Add number of channels supported by tegra186, tegra194 and tegra234. In case of old bindings, channels won't be present. If channels are not present then print warning and continue so that backward compatibility will be preserved in driver.
During error interrupts from memory controller, appropriate registers from these channels need to be accessed for logging error info.Quoted 7 lines
Reviewed-by Dmitry Osipenko <[email protected]>Signed-off-by Ashish Mhetre <[email protected]>--- drivers/memory/tegra/mc.c | 6 ++++++ drivers/memory/tegra/tegra186.c | 34 +++++++++++++++++++++++++++++++++ drivers/memory/tegra/tegra194.c | 1 + drivers/memory/tegra/tegra234.c | 1 +
Quoted 3 lines
This does not apply, neither on my mem-ctrl-next, nor on master. Probably because tegra234 is somewhere else (Thierry?). Either you send it without tegra234 or it goes via Thierry's tree.
Yeah, I can apply these on top of my tree and then forward the whole batch to you or ARM SoC next week.
Thierry
Re: [Patch v9 1/4] memory: tegra: Add memory controller channels support
In reply to Ashish MhetreQuoted 29 lines · Ashish Mhetre
drivers/memory/tegra/tegra186.c +29
-0+static int tegra186_mc_map_regs (struct tegra_mc *mc) +{ +struct platform_device *pdev =to_platform_device (mc->dev); +unsigned int i; + + mc->bcast_ch_regs =devm_platform_ioremap_resource_byname (pdev,"broadcast" ); +if (IS_ERR (mc->bcast_ch_regs)) { +if (PTR_ERR (mc->bcast_ch_regs) == -EINVAL ) { +dev_warn (&pdev->dev,"Broadcast channel is missing, please update your device-tree\n" ); + mc->bcast_ch_regs =NULL ; +return 0 ; + } +return PTR_ERR (mc->bcast_ch_regs); + } + + mc->ch_regs =devm_kcalloc (mc->dev, mc->soc->num_channels, +sizeof (*mc->ch_regs),GFP_KERNEL ); +if (!mc->ch_regs) +return -ENOMEM ; + +for (i =0 ; i < mc->soc->num_channels; i++) { +char name[5 ]; + +snprintf (name,sizeof (name),"ch%u" , i); + mc->ch_regs[i] =devm_platform_ioremap_resource_byname (pdev, name); +if (IS_ERR (mc->ch_regs[i])) +return PTR_ERR (mc->ch_regs[i]); + } +
drivers/memory/tegra/tegra186.c static int tegra186_mc_probe_device(struct tegra_mc *mc, struct device *dev) · line 180
Quoted 10 lines
drivers/memory/tegra/tegra186.c +4
-0+return 0 ; +} +const struct tegra_mc_ops tegra186_mc_ops = { .probe = tegra186_mc_probe, .remove = tegra186_mc_remove, .resume = tegra186_mc_resume, .probe_device = tegra186_mc_probe_device, + .map_regs = tegra186_mc_map_regs, };
Do we really need the map_regs() callback? Could you please move it to the tegra186_mc_probe()? .. Sorry, I haven't noticed this previously.
Re: [Patch v9 1/4] memory: tegra: Add memory controller channels support
Quoted 38 lines · Dmitry Osipenko
External email: Use caution opening links or attachments
Quoted 34 lines · Ashish Mhetre
drivers/memory/tegra/tegra186.c +32
-0+static int tegra186_mc_map_regs (struct tegra_mc *mc) +{ +struct platform_device *pdev =to_platform_device (mc->dev); +unsigned int i; + + mc->bcast_ch_regs =devm_platform_ioremap_resource_byname (pdev,"broadcast" ); +if (IS_ERR (mc->bcast_ch_regs)) { +if (PTR_ERR (mc->bcast_ch_regs) == -EINVAL ) { +dev_warn (&pdev->dev,"Broadcast channel is missing, please update your device-tree\n" ); + mc->bcast_ch_regs =NULL ; +return 0 ; + } +return PTR_ERR (mc->bcast_ch_regs); + } + + mc->ch_regs =devm_kcalloc (mc->dev, mc->soc->num_channels, +sizeof (*mc->ch_regs),GFP_KERNEL ); +if (!mc->ch_regs) +return -ENOMEM ; + +for (i =0 ; i < mc->soc->num_channels; i++) { +char name[5 ]; + +snprintf (name,sizeof (name),"ch%u" , i); + mc->ch_regs[i] =devm_platform_ioremap_resource_byname (pdev, name); +if (IS_ERR (mc->ch_regs[i])) +return PTR_ERR (mc->ch_regs[i]); + } + +return 0 ; +} +const struct tegra_mc_ops tegra186_mc_ops = { .probe = tegra186_mc_probe,
Quoted 8 lines
Quoted 5 lines
.remove = tegra186_mc_remove, .resume = tegra186_mc_resume, .probe_device = tegra186_mc_probe_device,+ .map_regs =
tegra186_mc_map_regs,
};Do we really need the
map_regs()callback? Could you please move it to thetegra186_mc_probe()? .. Sorry, I haven't noticed this previously.
Okay, I'll update this.
PATCH v9 2/4 memory: tegra: Add MC error logging on tegra186 onward
In reply to Ashish MhetreAdd support for logging memory controller errors on tegra186, tegra194 and tegra234. On these SoCs, interrupts can occur on multiple channels. Add support required to read the status of interrupts across multiple channels, log and clear them.
Also add new interrupts supported on these SoCs.
--- drivers/memory/tegra/mc.c | 134 ++++++++++++++++++++++++++++---- drivers/memory/tegra/mc.h | 43 +++++++++- drivers/memory/tegra/tegra186.c | 9 +++ drivers/memory/tegra/tegra194.c | 8 ++ drivers/memory/tegra/tegra234.c | 8 ++ include/soc/tegra/mc.h | 5 +- 6 files changed, 189 insertions(+), 18 deletions(-)
drivers/memory/tegra/mc.c +118 -16
@@ -508,14 +508,54 @@ int tegra30_mc_probe(struct tegra_mc *mc)return 0 ; } -static irqreturn_t tegra30_mc_handle_irq (int irq,void *data) +const struct tegra_mc_ops tegra30_mc_ops = { + .probe = tegra30_mc_probe, + .handle_irq = tegra30_mc_handle_irq, +}; +#endif + +static int mc_global_intstatus_to_channel (const struct tegra_mc *mc,u32 status, +unsigned int *mc_channel) +{ +if ((status & mc->soc->ch_intmask) ==0 ) +return -EINVAL ; + + *mc_channel =__ffs ((status & mc->soc->ch_intmask) >> + mc->soc->global_intstatus_channel_shift); + +return 0 ; +} + +static u32 mc_channel_to_global_intstatus (const struct tegra_mc *mc, +unsigned int channel) +{ +return BIT (channel) << mc->soc->global_intstatus_channel_shift; +} + +irqreturn_t tegra30_mc_handle_irq (int irq,void *data) {struct tegra_mc *mc = data; +unsigned int bit, channel;unsigned long status; -unsigned int bit; -/* mask all interrupts to avoid flooding */ - status =mc_readl (mc,MC_INTSTATUS ) & mc->soc->intmask; +if (mc->soc->num_channels) { +u32 global_status; +int err; + + global_status =mc_ch_readl (mc,MC_BROADCAST_CHANNEL ,MC_GLOBAL_INTSTATUS ); + err =mc_global_intstatus_to_channel (mc, global_status, &channel); +if (err <0 ) { +dev_err_ratelimited (mc->dev,"unknown interrupt channel 0x%08x\n" , + global_status); +return IRQ_NONE ; + } + +/* mask all interrupts to avoid flooding */ + status =mc_ch_readl (mc, channel,MC_INTSTATUS ) & mc->soc->intmask; + }else { + status =mc_readl (mc,MC_INTSTATUS ) & mc->soc->intmask; + } +if (!status)return IRQ_NONE ;
@@ -523,18 +563,70 @@ static irqreturn_t tegra30_mc_handle_irq(int irq, void *data)const char *error = tegra_mc_status_names[bit] ?:"unknown" ;const char *client ="unknown" , *desc;const char *direction, *secure; +u32 status_reg, addr_reg; +u32 intmask =BIT (bit);phys_addr_t addr =0 ; +#ifdef CONFIG_PHYS_ADDR_T_64BIT +u32 addr_hi_reg =0 ; +#endif unsigned int i;char perm[7 ];u8 id, type;u32 value; - value =mc_readl (mc,MC_ERR_STATUS ); +switch (intmask) { +case MC_INT_DECERR_VPR : + status_reg =MC_ERR_VPR_STATUS ; + addr_reg =MC_ERR_VPR_ADR ; +break ; + +case MC_INT_SECERR_SEC : + status_reg =MC_ERR_SEC_STATUS ; + addr_reg =MC_ERR_SEC_ADR ; +break ; + +case MC_INT_DECERR_MTS : + status_reg =MC_ERR_MTS_STATUS ; + addr_reg =MC_ERR_MTS_ADR ; +break ; + +case MC_INT_DECERR_GENERALIZED_CARVEOUT : + status_reg =MC_ERR_GENERALIZED_CARVEOUT_STATUS ; + addr_reg =MC_ERR_GENERALIZED_CARVEOUT_ADR ; +break ; + +case MC_INT_DECERR_ROUTE_SANITY : + status_reg =MC_ERR_ROUTE_SANITY_STATUS ; + addr_reg =MC_ERR_ROUTE_SANITY_ADR ; +break ; + +default : + status_reg =MC_ERR_STATUS ; + addr_reg =MC_ERR_ADR ; + +#ifdef CONFIG_PHYS_ADDR_T_64BIT +if (mc->soc->has_addr_hi_reg) + addr_hi_reg =MC_ERR_ADR_HI ; +#endif +break ; + } + +if (mc->soc->num_channels) + value =mc_ch_readl (mc, channel, status_reg); +else + value =mc_readl (mc, status_reg);#ifdef CONFIG_PHYS_ADDR_T_64BIT if (mc->soc->num_address_bits >32 ) { - addr = ((value >>MC_ERR_STATUS_ADR_HI_SHIFT ) & -MC_ERR_STATUS_ADR_HI_MASK ); +if (addr_hi_reg) { +if (mc->soc->num_channels) + addr =mc_ch_readl (mc, channel, addr_hi_reg); +else + addr =mc_readl (mc, addr_hi_reg); + }else { + addr = ((value >>MC_ERR_STATUS_ADR_HI_SHIFT ) & +MC_ERR_STATUS_ADR_HI_MASK ); + } addr <<=32 ; }#endif
@@ -591,7 +683,10 @@ static irqreturn_t tegra30_mc_handle_irq(int irq, void *data)break ; } - value =mc_readl (mc,MC_ERR_ADR ); +if (mc->soc->num_channels) + value =mc_ch_readl (mc, channel, addr_reg); +else + value =mc_readl (mc, addr_reg); addr |= value; dev_err_ratelimited(mc->dev, "%s: %s%s @%pa: %s (%s%s)\n",
@@ -600,17 +695,18 @@ static irqreturn_t tegra30_mc_handle_irq(int irq, void *data) }/* clear interrupts */ -mc_writel (mc, status,MC_INTSTATUS ); +if (mc->soc->num_channels) { +mc_ch_writel (mc, channel, status,MC_INTSTATUS ); +mc_ch_writel (mc,MC_BROADCAST_CHANNEL , +mc_channel_to_global_intstatus (mc, channel), +MC_GLOBAL_INTSTATUS ); + }else { +mc_writel (mc, status,MC_INTSTATUS ); + }return IRQ_HANDLED ; } -const struct tegra_mc_ops tegra30_mc_ops = { - .probe = tegra30_mc_probe, - .handle_irq = tegra30_mc_handle_irq, -}; -#endif -const char *const tegra_mc_status_names[32 ] = { [1 ] ="External interrupt" , [6 ] ="EMEM address decode error" ,
@@ -622,6 +718,8 @@ const char *const tegra_mc_status_names[32] = { [12] = "VPR violation", [13] = "Secure carveout violation", [16] = "MTS carveout violation", + [17] = "Generalized carveout violation", + [20] = "Route Sanity error", };const char *const tegra_mc_error_names[8 ] = {
@@ -770,7 +868,11 @@ static int tegra_mc_probe(struct platform_device *pdev)WARN (!mc->soc->client_id_mask,"missing client ID mask for this SoC\n" ); -mc_writel (mc, mc->soc->intmask,MC_INTMASK ); +if (mc->soc->num_channels) +mc_ch_writel (mc,MC_BROADCAST_CHANNEL , mc->soc->intmask, +MC_INTMASK ); +else +mc_writel (mc, mc->soc->intmask,MC_INTMASK ); err =devm_request_irq (&pdev->dev, mc->irq, mc->soc->ops->handle_irq,0 ,dev_name (&pdev->dev), mc);
drivers/memory/tegra/mc.h +42 -1
67 lines not on this page · raw message
drivers/memory/tegra/tegra186.c +9 -0
@@ -16,6 +16,8 @@#include <dt-bindings/memory/tegra186-mc.h> #endif +#include "mc.h" +#define MC_SID_STREAMID_OVERRIDE_MASK GENMASK(7, 0)#define MC_SID_STREAMID_SECURITY_WRITE_ACCESS_DISABLED BIT(16)#define MC_SID_STREAMID_SECURITY_OVERRIDE BIT(8)
@@ -177,6 +179,7 @@ const struct tegra_mc_ops tegra186_mc_ops = { .resume = tegra186_mc_resume, .probe_device = tegra186_mc_probe_device, .map_regs = tegra186_mc_map_regs, + .handle_irq = tegra30_mc_handle_irq, };#if defined(CONFIG_ARCH_TEGRA_186_SOC )
@@ -909,6 +912,12 @@ const struct tegra_mc_soc tegra186_mc_soc = { .clients = tegra186_mc_clients, .num_address_bits = 40, .num_channels = 4, + .client_id_mask = 0xff, + .intmask =MC_INT_DECERR_GENERALIZED_CARVEOUT |MC_INT_DECERR_MTS | +MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | + MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, .ops = &tegra186_mc_ops, + .ch_intmask = 0x0000000f, + .global_intstatus_channel_shift = 0, };#endif
drivers/memory/tegra/tegra194.c +8 -0
@@ -1348,5 +1348,13 @@ const struct tegra_mc_soc tegra194_mc_soc = { .clients = tegra194_mc_clients, .num_address_bits = 40, .num_channels = 16, + .client_id_mask = 0xff, + .intmask =MC_INT_DECERR_ROUTE_SANITY | +MC_INT_DECERR_GENERALIZED_CARVEOUT |MC_INT_DECERR_MTS | +MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | + MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, + .has_addr_hi_reg = true, .ops = &tegra186_mc_ops, + .ch_intmask = 0x00000f00, + .global_intstatus_channel_shift = 8, };
drivers/memory/tegra/tegra234.c +8 -0
@@ -98,5 +98,13 @@ const struct tegra_mc_soc tegra234_mc_soc = { .clients = tegra234_mc_clients, .num_address_bits = 40, .num_channels = 16, + .client_id_mask = 0x1ff, + .intmask =MC_INT_DECERR_ROUTE_SANITY | +MC_INT_DECERR_GENERALIZED_CARVEOUT |MC_INT_DECERR_MTS | +MC_INT_SECERR_SEC |MC_INT_DECERR_VPR | + MC_INT_SECURITY_VIOLATION | MC_INT_DECERR_EMEM, + .has_addr_hi_reg = true, .ops = &tegra186_mc_ops, + .ch_intmask = 0x0000ff00, + .global_intstatus_channel_shift = 8, };
include/soc/tegra/mc.h +4 -1
@@ -194,12 +194,15 @@ struct tegra_mc_soc {unsigned int num_address_bits;unsigned int atom_size; -u8 client_id_mask; +u16 client_id_mask;u8 num_channels;const struct tegra_smmu_soc *smmu;u32 intmask; +u32 ch_intmask; +u32 global_intstatus_channel_shift; +bool has_addr_hi_reg;const struct tegra_mc_reset_ops *reset_ops;const struct tegra_mc_reset *resets;
Signature · 1 line
2.17.1
PATCH v9 3/4 dt-bindings: memory: tegra: Update validation for reg and reg-names
In reply to Ashish MhetreFrom tegra186 onwards, memory controller support multiple channels. Reg items are updated with address and size of these channels. Tegra186 has overall 5 memory controller channels. Tegra194 and tegra234 have overall 17 memory controller channels each.
There is 1 reg item for memory controller stream-id registers. So update the reg minItems and maxItems accordingly in tegra186 devicetree documentation. Also update validation for reg-names added for these corresponding reg items.
ABI change due to new bindings is intended but backward compatibility is preserved in driver.
--- .../nvidia,tegra186-mc.yaml | 80 +++++++++++++++++-- 1 file changed, 74 insertions(+), 6 deletions(-)
Documentation/devicetree/bindings/memory-controllers/nvidia,tegra186-mc.yaml +74 -6
@@ -34,8 +34,12 @@ properties: - nvidia,tegra234-mc reg: - minItems: 1 - maxItems: 3 + minItems: 6 + maxItems: 18 + + reg-names: + minItems: 6 + maxItems: 18 interrupts: items:
@@ -142,7 +146,18 @@ allOf: then: properties: reg: - maxItems: 1 + maxItems: 6 + description: 5 memory controller channels and 1 for stream-id registers + + reg-names: + maxItems: 6 + items: + - const: sid + - const: broadcast + - const: ch0 + - const: ch1 + - const: ch2 + - const: ch3 - if: properties:
@@ -151,7 +166,30 @@ allOf: then: properties: reg: - minItems: 3 + minItems: 18 + description: 17 memory controller channels and 1 for stream-id registers + + reg-names: + minItems: 18 + items: + - const: sid + - const: broadcast + - const: ch0 + - const: ch1 + - const: ch2 + - const: ch3 + - const: ch4 + - const: ch5 + - const: ch6 + - const: ch7 + - const: ch8 + - const: ch9 + - const: ch10 + - const: ch11 + - const: ch12 + - const: ch13 + - const: ch14 + - const: ch15 - if: properties:
@@ -160,13 +198,37 @@ allOf: then: properties: reg: - minItems: 3 + minItems: 18 + description: 17 memory controller channels and 1 for stream-id registers + + reg-names: + minItems: 18 + items: + - const: sid + - const: broadcast + - const: ch0 + - const: ch1 + - const: ch2 + - const: ch3 + - const: ch4 + - const: ch5 + - const: ch6 + - const: ch7 + - const: ch8 + - const: ch9 + - const: ch10 + - const: ch11 + - const: ch12 + - const: ch13 + - const: ch14 + - const: ch15 additionalProperties: false required: - compatible - reg + - reg-names - interrupts - "#address-cells" - "#size-cells"
@@ -182,7 +244,13 @@ examples: memory-controller@2c00000 { compatible = "nvidia,tegra186-mc"; - reg = <0x0 0x02c00000 0x0 0xb0000>; + reg = <0x0 0x02c00000 0x0 0x10000>, /* MC-SID */ + <0x0 0x02c10000 0x0 0x10000>, /* Broadcast channel */ + <0x0 0x02c20000 0x0 0x10000>, /* MC0 */ + <0x0 0x02c30000 0x0 0x10000>, /* MC1 */ + <0x0 0x02c40000 0x0 0x10000>, /* MC2 */ + <0x0 0x02c50000 0x0 0x10000>; /* MC3 */ + reg-names = "sid", "broadcast", "ch0", "ch1", "ch2", "ch3"; interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>; #address-cells = <2>;
Signature · 1 line
2.17.1
PATCH v9 4/4 arm64: tegra: Add memory controller channels
In reply to Ashish MhetreFrom tegra186 onwards, memory controller support multiple channels. During the error interrupts from memory controller, corresponding channels need to be accessed for logging error info and clearing the interrupt.
So add address and size of these channels in device tree node of tegra186, tegra194 and tegra234 memory controller. Also add reg-names for each of these reg items which are used by driver for mapping.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 8 +++++++- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 24 +++++++++++++++++++++--- arch/arm64/boot/dts/nvidia/tegra234.dtsi | 24 +++++++++++++++++++++--- 3 files changed, 49 insertions(+), 7 deletions(-)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +7 -1
@@ -521,7 +521,13 @@ mc: memory-controller@2c00000 { compatible = "nvidia,tegra186-mc"; - reg = <0x0 0x02c00000 0x0 0xb0000>; + reg = <0x0 0x02c00000 0x0 0x10000>, /* MC-SID */ + <0x0 0x02c10000 0x0 0x10000>, /* Broadcast channel */ + <0x0 0x02c20000 0x0 0x10000>, /* MC0 */ + <0x0 0x02c30000 0x0 0x10000>, /* MC1 */ + <0x0 0x02c40000 0x0 0x10000>, /* MC2 */ + <0x0 0x02c50000 0x0 0x10000>; /* MC3 */ + reg-names = "sid", "broadcast", "ch0", "ch1", "ch2", "ch3"; interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>; status = "disabled";
arch/arm64/boot/dts/nvidia/tegra194.dtsi +21 -3
@@ -604,9 +604,27 @@ mc: memory-controller@2c00000 { compatible = "nvidia,tegra194-mc"; - reg = <0x02c00000 0x100000>, - <0x02b80000 0x040000>, - <0x01700000 0x100000>; + reg = <0x02c00000 0x10000>, /* MC-SID */ + <0x02c10000 0x10000>, /* MC Broadcast*/ + <0x02c20000 0x10000>, /* MC0 */ + <0x02c30000 0x10000>, /* MC1 */ + <0x02c40000 0x10000>, /* MC2 */ + <0x02c50000 0x10000>, /* MC3 */ + <0x02b80000 0x10000>, /* MC4 */ + <0x02b90000 0x10000>, /* MC5 */ + <0x02ba0000 0x10000>, /* MC6 */ + <0x02bb0000 0x10000>, /* MC7 */ + <0x01700000 0x10000>, /* MC8 */ + <0x01710000 0x10000>, /* MC9 */ + <0x01720000 0x10000>, /* MC10 */ + <0x01730000 0x10000>, /* MC11 */ + <0x01740000 0x10000>, /* MC12 */ + <0x01750000 0x10000>, /* MC13 */ + <0x01760000 0x10000>, /* MC14 */ + <0x01770000 0x10000>; /* MC15 */ + reg-names = "sid", "broadcast", "ch0", "ch1", "ch2", "ch3", + "ch4", "ch5", "ch6", "ch7", "ch8", "ch9", "ch10", + "ch11", "ch12", "ch13", "ch14", "ch15"; interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>; #interconnect-cells = <1>; status = "disabled";
arch/arm64/boot/dts/nvidia/tegra234.dtsi +21 -3
@@ -507,9 +507,27 @@ mc: memory-controller@2c00000 { compatible = "nvidia,tegra234-mc"; - reg = <0x02c00000 0x100000>, - <0x02b80000 0x040000>, - <0x01700000 0x100000>; + reg = <0x02c00000 0x10000>, /* MC-SID */ + <0x02c10000 0x10000>, /* MC Broadcast*/ + <0x02c20000 0x10000>, /* MC0 */ + <0x02c30000 0x10000>, /* MC1 */ + <0x02c40000 0x10000>, /* MC2 */ + <0x02c50000 0x10000>, /* MC3 */ + <0x02b80000 0x10000>, /* MC4 */ + <0x02b90000 0x10000>, /* MC5 */ + <0x02ba0000 0x10000>, /* MC6 */ + <0x02bb0000 0x10000>, /* MC7 */ + <0x01700000 0x10000>, /* MC8 */ + <0x01710000 0x10000>, /* MC9 */ + <0x01720000 0x10000>, /* MC10 */ + <0x01730000 0x10000>, /* MC11 */ + <0x01740000 0x10000>, /* MC12 */ + <0x01750000 0x10000>, /* MC13 */ + <0x01760000 0x10000>, /* MC14 */ + <0x01770000 0x10000>; /* MC15 */ + reg-names = "sid", "broadcast", "ch0", "ch1", "ch2", "ch3", + "ch4", "ch5", "ch6", "ch7", "ch8", "ch9", "ch10", + "ch11", "ch12", "ch13", "ch14", "ch15"; interrupts = <GIC_SPI 223 IRQ_TYPE_LEVEL_HIGH>; #interconnect-cells = <1>; status = "okay";
Signature · 1 line
2.17.1