99#include <linux/regmap.h>
1010#include <linux/reset-controller.h>
1111#include <dt-bindings/clock/en7523-clk.h>
12+ #include <dt-bindings/reset/airoha,en7523-reset.h>
1213#include <dt-bindings/reset/airoha,en7581-reset.h>
1314
1415#define RST_NR_PER_BANK 32
@@ -299,6 +300,53 @@ static const u16 en7581_rst_ofs[] = {
299300 REG_RST_CTRL1 ,
300301};
301302
303+ static const u16 en7523_rst_map [] = {
304+ /* RST_CTRL2 */
305+ [EN7523_XPON_PHY_RST ] = 0 ,
306+ [EN7523_XSI_MAC_RST ] = 7 ,
307+ [EN7523_XSI_PHY_RST ] = 8 ,
308+ [EN7523_NPU_RST ] = 9 ,
309+ [EN7523_I2S_RST ] = 10 ,
310+ [EN7523_TRNG_RST ] = 11 ,
311+ [EN7523_TRNG_MSTART_RST ] = 12 ,
312+ [EN7523_DUAL_HSI0_RST ] = 13 ,
313+ [EN7523_DUAL_HSI1_RST ] = 14 ,
314+ [EN7523_HSI_RST ] = 15 ,
315+ [EN7523_DUAL_HSI0_MAC_RST ] = 16 ,
316+ [EN7523_DUAL_HSI1_MAC_RST ] = 17 ,
317+ [EN7523_HSI_MAC_RST ] = 18 ,
318+ [EN7523_WDMA_RST ] = 19 ,
319+ [EN7523_WOE0_RST ] = 20 ,
320+ [EN7523_WOE1_RST ] = 21 ,
321+ [EN7523_HSDMA_RST ] = 22 ,
322+ [EN7523_I2C2RBUS_RST ] = 23 ,
323+ [EN7523_TDMA_RST ] = 24 ,
324+ /* RST_CTRL1 */
325+ [EN7523_PCM1_ZSI_ISI_RST ] = RST_NR_PER_BANK + 0 ,
326+ [EN7523_FE_PDMA_RST ] = RST_NR_PER_BANK + 1 ,
327+ [EN7523_FE_QDMA_RST ] = RST_NR_PER_BANK + 2 ,
328+ [EN7523_PCM_SPIWP_RST ] = RST_NR_PER_BANK + 4 ,
329+ [EN7523_CRYPTO_RST ] = RST_NR_PER_BANK + 6 ,
330+ [EN7523_TIMER_RST ] = RST_NR_PER_BANK + 8 ,
331+ [EN7523_PCM1_RST ] = RST_NR_PER_BANK + 11 ,
332+ [EN7523_UART_RST ] = RST_NR_PER_BANK + 12 ,
333+ [EN7523_GPIO_RST ] = RST_NR_PER_BANK + 13 ,
334+ [EN7523_GDMA_RST ] = RST_NR_PER_BANK + 14 ,
335+ [EN7523_I2C_MASTER_RST ] = RST_NR_PER_BANK + 16 ,
336+ [EN7523_PCM2_ZSI_ISI_RST ] = RST_NR_PER_BANK + 17 ,
337+ [EN7523_SFC_RST ] = RST_NR_PER_BANK + 18 ,
338+ [EN7523_UART2_RST ] = RST_NR_PER_BANK + 19 ,
339+ [EN7523_GDMP_RST ] = RST_NR_PER_BANK + 20 ,
340+ [EN7523_FE_RST ] = RST_NR_PER_BANK + 21 ,
341+ [EN7523_USB_HOST_P0_RST ] = RST_NR_PER_BANK + 22 ,
342+ [EN7523_GSW_RST ] = RST_NR_PER_BANK + 23 ,
343+ [EN7523_SFC2_PCM_RST ] = RST_NR_PER_BANK + 25 ,
344+ [EN7523_PCIE0_RST ] = RST_NR_PER_BANK + 26 ,
345+ [EN7523_PCIE1_RST ] = RST_NR_PER_BANK + 27 ,
346+ [EN7523_PCIE_HB_RST ] = RST_NR_PER_BANK + 29 ,
347+ [EN7523_XPON_MAC_RST ] = RST_NR_PER_BANK + 31 ,
348+ };
349+
302350static const u16 en7581_rst_map [] = {
303351 /* RST_CTRL2 */
304352 [EN7581_XPON_PHY_RST ] = 0 ,
@@ -357,6 +405,9 @@ static const u16 en7581_rst_map[] = {
357405 [EN7581_XPON_MAC_RST ] = RST_NR_PER_BANK + 31 ,
358406};
359407
408+ static int en7581_reset_register (struct device * dev , void __iomem * base ,
409+ const u16 * rst_map , int nr_resets );
410+
360411static u32 en7523_get_base_rate (const struct en_clk_desc * desc , u32 val )
361412{
362413 if (!desc -> base_bits )
@@ -552,7 +603,8 @@ static int en7523_clk_hw_init(struct platform_device *pdev,
552603
553604 en7523_register_clocks (& pdev -> dev , clk_data , base , np_base );
554605
555- return 0 ;
606+ return en7581_reset_register (& pdev -> dev , np_base , en7523_rst_map ,
607+ ARRAY_SIZE (en7523_rst_map ));
556608}
557609
558610static void en7581_register_clocks (struct device * dev , struct clk_hw_onecell_data * clk_data ,
@@ -652,7 +704,8 @@ static const struct reset_control_ops en7581_reset_ops = {
652704 .status = en7523_reset_status ,
653705};
654706
655- static int en7581_reset_register (struct device * dev , void __iomem * base )
707+ static int en7581_reset_register (struct device * dev , void __iomem * base ,
708+ const u16 * rst_map , int nr_resets )
656709{
657710 struct en_rst_data * rst_data ;
658711
@@ -661,10 +714,10 @@ static int en7581_reset_register(struct device *dev, void __iomem *base)
661714 return - ENOMEM ;
662715
663716 rst_data -> bank_ofs = en7581_rst_ofs ;
664- rst_data -> idx_map = en7581_rst_map ;
717+ rst_data -> idx_map = rst_map ;
665718 rst_data -> base = base ;
666719
667- rst_data -> rcdev .nr_resets = ARRAY_SIZE ( en7581_rst_map ) ;
720+ rst_data -> rcdev .nr_resets = nr_resets ;
668721 rst_data -> rcdev .of_xlate = en7523_reset_xlate ;
669722 rst_data -> rcdev .ops = & en7581_reset_ops ;
670723 rst_data -> rcdev .of_node = dev -> of_node ;
@@ -698,7 +751,8 @@ static int en7581_clk_hw_init(struct platform_device *pdev,
698751 val = readl (base + REG_NP_SCU_PCIC );
699752 writel (val | 3 , base + REG_NP_SCU_PCIC );
700753
701- return en7581_reset_register (& pdev -> dev , base );
754+ return en7581_reset_register (& pdev -> dev , base , en7581_rst_map ,
755+ ARRAY_SIZE (en7581_rst_map ));
702756}
703757
704758static int en7523_clk_probe (struct platform_device * pdev )
0 commit comments