drm/panfrost: add Amlogic integration quirks
v2 cover drm/panfrost: add Amlogic integration quirks
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time.
This serie adds the necessary quirks for the Amlogic integrated GPUs only.
Changes since v1 at [1]:
- removed the BROKEN_SH quirk after [2] was sent by robin
- rebased on top of [3] by steven and moved the vendor quirk in the proper quirk function
- added PWR_KEY unlock definition, and cleaned definition
[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]
Neil Armstrong (3):
drm/panfrost: add support for vendor quirk drm/panfrost: add amlogic reset quirk callback drm/panfrost: add Amlogic GPU integration quirks
drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 5 files changed, 35 insertions(+)
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 1/3 drm/panfrost: add support for vendor quirk
The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers after each reset.
This adds a callback in the device compatible struct of permit this.
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/panfrost/panfrost_device.h +3 -0
@@ -70,6 +70,9 @@ struct panfrost_compatible {int num_pm_domains;/* Only required if num_pm_domains > 1. */ const char *const *pm_domain_names; + +/* Vendor implementation quirks callback */ +void (*vendor_quirk)(struct panfrost_device *pfdev); };struct panfrost_device {
drivers/gpu/drm/panfrost/panfrost_gpu.c +4 -0
@@ -136,6 +136,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)if (quirks)gpu_write (pfdev,GPU_JM_CONFIG , quirks); + +/* Here goes platform specific quirks */ +if (pfdev->comp->vendor_quirk) + pfdev->comp->vendor_quirk (pfdev); }#define MAX_HW_REVS 6
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 1/3] drm/panfrost: add support for vendor quirk
Quoted 1 line · Neil Armstrong
The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B
NIT: s/integratewd/integrated/
Quoted 5 lines
SoCs needs a quirk in the PWR registers after each reset.
This adds a callback in the device compatible struct of permit this.
Signed-off-by Neil Armstrong <[email protected]>
Quoted 25 lines
--- drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 4 ++++ 2 files changed, 7 insertions(+)drivers/gpu/drm/panfrost/panfrost_device.h +3
-0@@ -70,6 +70,9 @@ struct panfrost_compatible {int num_pm_domains;/* Only required if num_pm_domains > 1. */ const char *const *pm_domain_names; + +/* Vendor implementation quirks callback */ +void (*vendor_quirk)(struct panfrost_device *pfdev); };struct panfrost_device {drivers/gpu/drm/panfrost/panfrost_gpu.c +0
-0
drivers/gpu/drm/panfrost/panfrost_gpu.c static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev) · line 145
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c +4
-0@@ -136,6 +136,10 @@ static void panfrost_gpu_init_quirks(struct panfrost_device *pfdev)if (quirks)gpu_write (pfdev,GPU_JM_CONFIG , quirks); + +/* Here goes platform specific quirks */ +if (pfdev->comp->vendor_quirk) + pfdev->comp->vendor_quirk (pfdev); }#define MAX_HW_REVS 6
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 2/3 drm/panfrost: add amlogic reset quirk callback
In reply to Neil ArmstrongThe T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time.
Since the Amlogic's integration of the GPU cores with the SoC is not publicly documented we do not know what does these
values, but they permit having a fully functional GPU running with Panfrost.
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 3 files changed, 17 insertions(+)
drivers/gpu/drm/panfrost/panfrost_gpu.c +11 -0
@@ -76,6 +76,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)return 0 ; } +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev) +{ +/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order +* to operate correctly. +*/ +gpu_write (pfdev,GPU_PWR_KEY ,GPU_PWR_KEY_UNLOCK ); +gpu_write (pfdev,GPU_PWR_OVERRIDE1 ,0xfff | (0x20 <<16 )); +} +static void panfrost_gpu_init_quirks (struct panfrost_device *pfdev) {u32 quirks =0 ;
drivers/gpu/drm/panfrost/panfrost_gpu.h +2 -0
@@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);void panfrost_gpu_power_on (struct panfrost_device *pfdev);void panfrost_gpu_power_off (struct panfrost_device *pfdev); +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev); +#endif
drivers/gpu/drm/panfrost/panfrost_regs.h +4 -0
@@ -51,6 +51,10 @@#define GPU_STATUS 0x34#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x50/* (WO) Power manager key register */ +#define GPU_PWR_KEY_UNLOCK 0x2968A819 +#define GPU_PWR_OVERRIDE0 0x54/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x58/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C#define GPU_FAULT_ADDRESS_LO 0x40#define GPU_FAULT_ADDRESS_HI 0x44
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 2/3] drm/panfrost: add amlogic reset quirk callback
Quoted 1 line · Neil Armstrong
The T820, G31 & G52 GPUs integratewd by Amlogic in the respective GXM, G12A/SM1 & G12B
NIT: s/integratewd/integrated/
Quoted 7 lines
SoCs needs a quirk in the PWR registers at the GPU reset time.
Since the Amlogic's integration of the GPU cores with the SoC is not publicly documented we do not know what does these
values, but they permit having a fully functional GPU running with Panfrost.Signed-off-by Neil Armstrong <[email protected]>
Quoted 45 lines
--- drivers/gpu/drm/panfrost/panfrost_gpu.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 3 files changed, 17 insertions(+)drivers/gpu/drm/panfrost/panfrost_gpu.c +11
-0@@ -76,6 +76,17 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev)return 0 ; } +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev) +{ +/* +* The Amlogic integrated Mali-T820, Mali-G31 & Mali-G52 needs +* these undocumented bits in GPU_PWR_OVERRIDE1 to be set in order +* to operate correctly. +*/ +gpu_write (pfdev,GPU_PWR_KEY ,GPU_PWR_KEY_UNLOCK ); +gpu_write (pfdev,GPU_PWR_OVERRIDE1 ,0xfff | (0x20 <<16 )); +} +static void panfrost_gpu_init_quirks (struct panfrost_device *pfdev) {u32 quirks =0 ;drivers/gpu/drm/panfrost/panfrost_gpu.h +2
-0@@ -16,4 +16,6 @@ int panfrost_gpu_soft_reset(struct panfrost_device *pfdev);void panfrost_gpu_power_on (struct panfrost_device *pfdev);void panfrost_gpu_power_off (struct panfrost_device *pfdev); +void panfrost_gpu_amlogic_quirk (struct panfrost_device *pfdev); +#endif drivers/gpu/drm/panfrost/panfrost_regs.h +0
-0
drivers/gpu/drm/panfrost/panfrost_regs.h line 60
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_regs.h +4
-0@@ -51,6 +51,10 @@#define GPU_STATUS 0x34#define GPU_STATUS_PRFCNT_ACTIVE BIT(2)#define GPU_LATEST_FLUSH_ID 0x38 +#define GPU_PWR_KEY 0x50/* (WO) Power manager key register */ +#define GPU_PWR_KEY_UNLOCK 0x2968A819 +#define GPU_PWR_OVERRIDE0 0x54/* (RW) Power manager override settings */ +#define GPU_PWR_OVERRIDE1 0x58/* (RW) Power manager override settings */ #define GPU_FAULT_STATUS 0x3C#define GPU_FAULT_ADDRESS_LO 0x40#define GPU_FAULT_ADDRESS_HI 0x44
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
PATCH v2 3/3 drm/panfrost: add Amlogic GPU integration quirks
In reply to Neil ArmstrongThis adds the required GPU quirks, including the quirk in the PWR registers at the GPU reset time and the IOMMU quirk for shareability issues observed on G52 in Amlogic G12B SoCs.
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/gpu/drm/panfrost/panfrost_drv.c +11 -0
@@ -658,7 +658,18 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +static const struct panfrost_compatible amlogic_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_quirk = panfrost_gpu_amlogic_quirk, +}; +static const struct of_device_id dt_match[] = { +/* Set first to probe before the generic compatibles */ + { .compatible ="amlogic,meson-gxm-mali" , + .data = &amlogic_data, }, + { .compatible ="amlogic,meson-g12a-mali" , + .data = &amlogic_data, }, { .compatible ="arm,mali-t604" , .data = &default_data, }, { .compatible ="arm,mali-t624" , .data = &default_data, }, { .compatible ="arm,mali-t628" , .data = &default_data, },
Signature · 6 lines
2.22.0 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Re: [PATCH v2 3/3] drm/panfrost: add Amlogic GPU integration quirks
Quoted 4 lines · Neil Armstrong
This adds the required GPU quirks, including the quirk in the PWR registers at the GPU reset time and the IOMMU quirk for shareability issues observed on G52 in Amlogic G12B SoCs.
Signed-off-by Neil Armstrong <[email protected]>
Quoted 18 lines
--- drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ 1 file changed, 11 insertions(+)drivers/gpu/drm/panfrost/panfrost_drv.c +5
-0@@ -658,7 +658,18 @@ static const struct panfrost_compatible default_data = { .pm_domain_names = NULL, }; +static const struct panfrost_compatible amlogic_data = { + .num_supplies =ARRAY_SIZE (default_supplies), + .supply_names = default_supplies, + .vendor_quirk = panfrost_gpu_amlogic_quirk, +};
drivers/gpu/drm/panfrost/panfrost_drv.c static const struct panfrost_compatible default_data = { · line 675
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_drv.c +6
-0+static const struct of_device_id dt_match[] = { +/* Set first to probe before the generic compatibles */ + { .compatible ="amlogic,meson-gxm-mali" , + .data = &amlogic_data, }, + { .compatible ="amlogic,meson-g12a-mali" , + .data = &amlogic_data, }, { .compatible ="arm,mali-t604" , .data = &default_data, }, { .compatible ="arm,mali-t624" , .data = &default_data, }, { .compatible ="arm,mali-t628" , .data = &default_data, },
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
series r-b, nice!
Quoted 19 lines · Neil Armstrong
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time.
This serie adds the necessary quirks for the Amlogic integrated GPUs only.
Changes since v1 at [1]:
- removed theBROKEN_SHquirk after [2] was sent by robin
- rebased on top of [3] by steven and moved the vendor quirk in the proper quirk function
- addedPWR_KEYunlock definition, and cleaned definition[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]Neil Armstrong (3):
drm/panfrost: add support for vendor quirk drm/panfrost: add amlogic reset quirk callback drm/panfrost: add Amlogic GPU integration quirks
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 5 files changed, 35 insertions(+)Signature · 1 line
2.22.0
_______________________________________________
linux-amlogic mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-amlogic
Hi Steven, Rob,
Should I send a v3 with the commit log fixes ?
Neil
Quoted 26 lines · Neil Armstrong
The T820, G31 & G52 GPUs integrated by Amlogic in the respective GXM, G12A/SM1 & G12B SoCs needs a quirk in the PWR registers at the GPU reset time.
This serie adds the necessary quirks for the Amlogic integrated GPUs only.
Changes since v1 at [1]:
- removed theBROKEN_SHquirk after [2] was sent by robin
- rebased on top of [3] by steven and moved the vendor quirk in the proper quirk function
- addedPWR_KEYunlock definition, and cleaned definition[1] https://lkml.kernel.org/r/[email protected]
[2] https://lkml.kernel.org/r/[email protected]
[3] https://lkml.kernel.org/r/[email protected]Neil Armstrong (3):
drm/panfrost: add support for vendor quirk drm/panfrost: add amlogic reset quirk callback drm/panfrost: add Amlogic GPU integration quirksdrivers/gpu/drm/panfrost/panfrost_device.h | 3 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 11 +++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.c | 15 +++++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 2 ++ drivers/gpu/drm/panfrost/panfrost_regs.h | 4 ++++ 5 files changed, 35 insertions(+)
Steven Price
maintainerQuoted 3 lines · Neil Armstrong
Hi Steven, Rob,
Should I send a v3 with the commit log fixes ?
No need, I've fixed it up and pushed to drm-misc-next.
Thanks,
Steve