diff mbox series

[2/3] irqchip/stm32-exti: add STM32MP13 support

Message ID 20211208130456.4002-3-alexandre.torgue@foss.st.com (mailing list archive)
State New, archived
Headers show
Series Add STM32MP13 EXTI support | expand

Commit Message

Alexandre TORGUE Dec. 8, 2021, 1:04 p.m. UTC
Enhance stm32-exti driver to support STM32MP13 SoC. This SoC uses the same
hardware version than STM32MP15. Only EXTI line mapping is changed and
following EXTI lines are supported: GPIO, RTC, I2C[1-5], UxART[1-8],
USBH_EHCI, USBH_OHCI, USB_OTG, LPTIM[1-5], ETH[1-2].

Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>

Comments

Marc Zyngier Dec. 8, 2021, 1:41 p.m. UTC | #1
On Wed, 08 Dec 2021 13:04:55 +0000,
Alexandre Torgue <alexandre.torgue@foss.st.com> wrote:
> 
> Enhance stm32-exti driver to support STM32MP13 SoC. This SoC uses the same
> hardware version than STM32MP15. Only EXTI line mapping is changed and
> following EXTI lines are supported: GPIO, RTC, I2C[1-5], UxART[1-8],
> USBH_EHCI, USBH_OHCI, USB_OTG, LPTIM[1-5], ETH[1-2].
> 
> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
> 
> diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
> index b7cb2da71888..9d18f47040eb 100644
> --- a/drivers/irqchip/irq-stm32-exti.c
> +++ b/drivers/irqchip/irq-stm32-exti.c
> @@ -214,6 +214,48 @@ static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
>  	{ .exti = 73, .irq_parent = 129, .chip = &stm32_exti_h_chip },
>  };
>  
> +static const struct stm32_desc_irq stm32mp13_desc_irq[] = {
> +	{ .exti = 0, .irq_parent = 6, .chip = &stm32_exti_h_chip },
> +	{ .exti = 1, .irq_parent = 7, .chip = &stm32_exti_h_chip },
> +	{ .exti = 2, .irq_parent = 8, .chip = &stm32_exti_h_chip },
> +	{ .exti = 3, .irq_parent = 9, .chip = &stm32_exti_h_chip },
> +	{ .exti = 4, .irq_parent = 10, .chip = &stm32_exti_h_chip },
> +	{ .exti = 5, .irq_parent = 24, .chip = &stm32_exti_h_chip },
> +	{ .exti = 6, .irq_parent = 65, .chip = &stm32_exti_h_chip },
> +	{ .exti = 7, .irq_parent = 66, .chip = &stm32_exti_h_chip },
> +	{ .exti = 8, .irq_parent = 67, .chip = &stm32_exti_h_chip },
> +	{ .exti = 9, .irq_parent = 68, .chip = &stm32_exti_h_chip },
> +	{ .exti = 10, .irq_parent = 41, .chip = &stm32_exti_h_chip },
> +	{ .exti = 11, .irq_parent = 43, .chip = &stm32_exti_h_chip },
> +	{ .exti = 12, .irq_parent = 77, .chip = &stm32_exti_h_chip },
> +	{ .exti = 13, .irq_parent = 78, .chip = &stm32_exti_h_chip },
> +	{ .exti = 14, .irq_parent = 106, .chip = &stm32_exti_h_chip },
> +	{ .exti = 15, .irq_parent = 109, .chip = &stm32_exti_h_chip },
> +	{ .exti = 16, .irq_parent = 1, .chip = &stm32_exti_h_chip },
> +	{ .exti = 19, .irq_parent = 3, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 21, .irq_parent = 32, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 22, .irq_parent = 34, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 23, .irq_parent = 73, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 24, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 25, .irq_parent = 114, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 26, .irq_parent = 38, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 27, .irq_parent = 39, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 28, .irq_parent = 40, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 29, .irq_parent = 72, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 30, .irq_parent = 53, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 31, .irq_parent = 54, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 32, .irq_parent = 83, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 33, .irq_parent = 84, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 44, .irq_parent = 96, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 47, .irq_parent = 92, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 48, .irq_parent = 116, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 50, .irq_parent = 117, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 52, .irq_parent = 118, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 53, .irq_parent = 119, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 68, .irq_parent = 63, .chip = &stm32_exti_h_chip_direct },
> +	{ .exti = 70, .irq_parent = 98, .chip = &stm32_exti_h_chip_direct },
> +};

Why does the driver need to carry these tables? This sort of
information should really come from DT, instead of being hardcoded in
the driver and bloating it for no reason. This all has a funny taste
of the board files we used to have pre-DT.

	M.
Alexandre TORGUE Dec. 8, 2021, 1:58 p.m. UTC | #2
Hi Marc

On 12/8/21 2:41 PM, Marc Zyngier wrote:
> On Wed, 08 Dec 2021 13:04:55 +0000,
> Alexandre Torgue <alexandre.torgue@foss.st.com> wrote:
>>
>> Enhance stm32-exti driver to support STM32MP13 SoC. This SoC uses the same
>> hardware version than STM32MP15. Only EXTI line mapping is changed and
>> following EXTI lines are supported: GPIO, RTC, I2C[1-5], UxART[1-8],
>> USBH_EHCI, USBH_OHCI, USB_OTG, LPTIM[1-5], ETH[1-2].
>>
>> Signed-off-by: Alexandre Torgue <alexandre.torgue@foss.st.com>
>>
>> diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
>> index b7cb2da71888..9d18f47040eb 100644
>> --- a/drivers/irqchip/irq-stm32-exti.c
>> +++ b/drivers/irqchip/irq-stm32-exti.c
>> @@ -214,6 +214,48 @@ static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
>>   	{ .exti = 73, .irq_parent = 129, .chip = &stm32_exti_h_chip },
>>   };
>>   
>> +static const struct stm32_desc_irq stm32mp13_desc_irq[] = {
>> +	{ .exti = 0, .irq_parent = 6, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 1, .irq_parent = 7, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 2, .irq_parent = 8, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 3, .irq_parent = 9, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 4, .irq_parent = 10, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 5, .irq_parent = 24, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 6, .irq_parent = 65, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 7, .irq_parent = 66, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 8, .irq_parent = 67, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 9, .irq_parent = 68, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 10, .irq_parent = 41, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 11, .irq_parent = 43, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 12, .irq_parent = 77, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 13, .irq_parent = 78, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 14, .irq_parent = 106, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 15, .irq_parent = 109, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 16, .irq_parent = 1, .chip = &stm32_exti_h_chip },
>> +	{ .exti = 19, .irq_parent = 3, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 21, .irq_parent = 32, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 22, .irq_parent = 34, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 23, .irq_parent = 73, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 24, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 25, .irq_parent = 114, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 26, .irq_parent = 38, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 27, .irq_parent = 39, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 28, .irq_parent = 40, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 29, .irq_parent = 72, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 30, .irq_parent = 53, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 31, .irq_parent = 54, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 32, .irq_parent = 83, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 33, .irq_parent = 84, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 44, .irq_parent = 96, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 47, .irq_parent = 92, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 48, .irq_parent = 116, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 50, .irq_parent = 117, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 52, .irq_parent = 118, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 53, .irq_parent = 119, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 68, .irq_parent = 63, .chip = &stm32_exti_h_chip_direct },
>> +	{ .exti = 70, .irq_parent = 98, .chip = &stm32_exti_h_chip_direct },
>> +};
> 
> Why does the driver need to carry these tables? This sort of
> information should really come from DT, instead of being hardcoded in
> the driver and bloating it for no reason. This all has a funny taste
> of the board files we used to have pre-DT.
>

There are absolutely no reason to have it in driver. Honestly It has 
been done in this way to have minimal changes adding this new SoC 
support (and it's not smart, I agree).

I think it is better to abandon this series. I will create a new one 
which moves mapping table for MP15 and adds MP13 support to.

thanks
Alex



> 	M.
>
Marc Zyngier Dec. 8, 2021, 2:22 p.m. UTC | #3
Hi Alexandre,

On Wed, 08 Dec 2021 13:58:46 +0000,
Alexandre TORGUE <alexandre.torgue@foss.st.com> wrote:
> 
> > Why does the driver need to carry these tables? This sort of
> > information should really come from DT, instead of being hardcoded in
> > the driver and bloating it for no reason. This all has a funny taste
> > of the board files we used to have pre-DT.
> > 
> 
> There are absolutely no reason to have it in driver. Honestly It has
> been done in this way to have minimal changes adding this new SoC
> support (and it's not smart, I agree).
> 
> I think it is better to abandon this series. I will create a new one
> which moves mapping table for MP15 and adds MP13 support to.

I'm afraid you'll have to keep the in-kernel table for MP15, since the
driver needs to work with old DTs. For new SoCs (such as MP13), moving
the table into DT would be good.

Thanks,

	M.
Alexandre TORGUE Dec. 8, 2021, 2:51 p.m. UTC | #4
On 12/8/21 3:22 PM, Marc Zyngier wrote:
> Hi Alexandre,
> 
> On Wed, 08 Dec 2021 13:58:46 +0000,
> Alexandre TORGUE <alexandre.torgue@foss.st.com> wrote:
>>
>>> Why does the driver need to carry these tables? This sort of
>>> information should really come from DT, instead of being hardcoded in
>>> the driver and bloating it for no reason. This all has a funny taste
>>> of the board files we used to have pre-DT.
>>>
>>
>> There are absolutely no reason to have it in driver. Honestly It has
>> been done in this way to have minimal changes adding this new SoC
>> support (and it's not smart, I agree).
>>
>> I think it is better to abandon this series. I will create a new one
>> which moves mapping table for MP15 and adds MP13 support to.
> 
> I'm afraid you'll have to keep the in-kernel table for MP15, since the
> driver needs to work with old DTs. For new SoCs (such as MP13), moving
> the table into DT would be good.

I can try to have both for MP15:use new mechanism as MP13 and keep the 
table inside the driver as a fallback if DT mapping is not provided (for 
old DT).

Thanks

> 
> Thanks,
> 
> 	M.
>
diff mbox series

Patch

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index b7cb2da71888..9d18f47040eb 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -214,6 +214,48 @@  static const struct stm32_desc_irq stm32mp1_desc_irq[] = {
 	{ .exti = 73, .irq_parent = 129, .chip = &stm32_exti_h_chip },
 };
 
+static const struct stm32_desc_irq stm32mp13_desc_irq[] = {
+	{ .exti = 0, .irq_parent = 6, .chip = &stm32_exti_h_chip },
+	{ .exti = 1, .irq_parent = 7, .chip = &stm32_exti_h_chip },
+	{ .exti = 2, .irq_parent = 8, .chip = &stm32_exti_h_chip },
+	{ .exti = 3, .irq_parent = 9, .chip = &stm32_exti_h_chip },
+	{ .exti = 4, .irq_parent = 10, .chip = &stm32_exti_h_chip },
+	{ .exti = 5, .irq_parent = 24, .chip = &stm32_exti_h_chip },
+	{ .exti = 6, .irq_parent = 65, .chip = &stm32_exti_h_chip },
+	{ .exti = 7, .irq_parent = 66, .chip = &stm32_exti_h_chip },
+	{ .exti = 8, .irq_parent = 67, .chip = &stm32_exti_h_chip },
+	{ .exti = 9, .irq_parent = 68, .chip = &stm32_exti_h_chip },
+	{ .exti = 10, .irq_parent = 41, .chip = &stm32_exti_h_chip },
+	{ .exti = 11, .irq_parent = 43, .chip = &stm32_exti_h_chip },
+	{ .exti = 12, .irq_parent = 77, .chip = &stm32_exti_h_chip },
+	{ .exti = 13, .irq_parent = 78, .chip = &stm32_exti_h_chip },
+	{ .exti = 14, .irq_parent = 106, .chip = &stm32_exti_h_chip },
+	{ .exti = 15, .irq_parent = 109, .chip = &stm32_exti_h_chip },
+	{ .exti = 16, .irq_parent = 1, .chip = &stm32_exti_h_chip },
+	{ .exti = 19, .irq_parent = 3, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 21, .irq_parent = 32, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 22, .irq_parent = 34, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 23, .irq_parent = 73, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 24, .irq_parent = 93, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 25, .irq_parent = 114, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 26, .irq_parent = 38, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 27, .irq_parent = 39, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 28, .irq_parent = 40, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 29, .irq_parent = 72, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 30, .irq_parent = 53, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 31, .irq_parent = 54, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 32, .irq_parent = 83, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 33, .irq_parent = 84, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 44, .irq_parent = 96, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 47, .irq_parent = 92, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 48, .irq_parent = 116, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 50, .irq_parent = 117, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 52, .irq_parent = 118, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 53, .irq_parent = 119, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 68, .irq_parent = 63, .chip = &stm32_exti_h_chip_direct },
+	{ .exti = 70, .irq_parent = 98, .chip = &stm32_exti_h_chip_direct },
+};
+
 static const struct stm32_exti_drv_data stm32mp1_drv_data = {
 	.exti_banks = stm32mp1_exti_banks,
 	.bank_nr = ARRAY_SIZE(stm32mp1_exti_banks),
@@ -221,6 +263,13 @@  static const struct stm32_exti_drv_data stm32mp1_drv_data = {
 	.irq_nr = ARRAY_SIZE(stm32mp1_desc_irq),
 };
 
+static const struct stm32_exti_drv_data stm32mp13_drv_data = {
+	.exti_banks = stm32mp1_exti_banks,
+	.bank_nr = ARRAY_SIZE(stm32mp1_exti_banks),
+	.desc_irqs = stm32mp13_desc_irq,
+	.irq_nr = ARRAY_SIZE(stm32mp13_desc_irq),
+};
+
 static const struct
 stm32_desc_irq *stm32_exti_get_desc(const struct stm32_exti_drv_data *drv_data,
 				    irq_hw_number_t hwirq)
@@ -922,6 +971,7 @@  static int stm32_exti_probe(struct platform_device *pdev)
 /* platform driver only for MP1 */
 static const struct of_device_id stm32_exti_ids[] = {
 	{ .compatible = "st,stm32mp1-exti", .data = &stm32mp1_drv_data},
+	{ .compatible = "st,stm32mp13-exti", .data = &stm32mp13_drv_data},
 	{},
 };
 MODULE_DEVICE_TABLE(of, stm32_exti_ids);