@@ -50,7 +50,7 @@ struct dw_dma_platform_data *dw_dma_parse_dt(struct platform_device *pdev)
50
50
{
51
51
struct device_node * np = pdev -> dev .of_node ;
52
52
struct dw_dma_platform_data * pdata ;
53
- u32 tmp , arr [DW_DMA_MAX_NR_MASTERS ], mb [ DW_DMA_MAX_NR_CHANNELS ] ;
53
+ u32 tmp , arr [DW_DMA_MAX_NR_MASTERS ];
54
54
u32 nr_masters ;
55
55
u32 nr_channels ;
56
56
@@ -71,41 +71,29 @@ struct dw_dma_platform_data *dw_dma_parse_dt(struct platform_device *pdev)
71
71
pdata -> nr_masters = nr_masters ;
72
72
pdata -> nr_channels = nr_channels ;
73
73
74
- if (! of_property_read_u32 (np , "chan_allocation_order" , & tmp ))
75
- pdata -> chan_allocation_order = ( unsigned char ) tmp ;
74
+ of_property_read_u32 (np , "chan_allocation_order" , & pdata -> chan_allocation_order );
75
+ of_property_read_u32 ( np , "chan_priority" , & pdata -> chan_priority ) ;
76
76
77
- if (!of_property_read_u32 (np , "chan_priority" , & tmp ))
78
- pdata -> chan_priority = tmp ;
77
+ of_property_read_u32 (np , "block_size" , & pdata -> block_size );
79
78
80
- if (!of_property_read_u32 (np , "block_size" , & tmp ))
81
- pdata -> block_size = tmp ;
82
-
83
- if (!of_property_read_u32_array (np , "data-width" , arr , nr_masters )) {
84
- for (tmp = 0 ; tmp < nr_masters ; tmp ++ )
85
- pdata -> data_width [tmp ] = arr [tmp ];
86
- } else if (!of_property_read_u32_array (np , "data_width" , arr , nr_masters )) {
79
+ /* Try deprecated property first */
80
+ if (!of_property_read_u32_array (np , "data_width" , arr , nr_masters )) {
87
81
for (tmp = 0 ; tmp < nr_masters ; tmp ++ )
88
82
pdata -> data_width [tmp ] = BIT (arr [tmp ] & 0x07 );
89
83
}
90
84
91
- if (!of_property_read_u32_array (np , "multi-block" , mb , nr_channels )) {
92
- for (tmp = 0 ; tmp < nr_channels ; tmp ++ )
93
- pdata -> multi_block [tmp ] = mb [tmp ];
94
- } else {
95
- for (tmp = 0 ; tmp < nr_channels ; tmp ++ )
96
- pdata -> multi_block [tmp ] = 1 ;
97
- }
85
+ /* If "data_width" and "data-width" both provided use the latter one */
86
+ of_property_read_u32_array (np , "data-width" , pdata -> data_width , nr_masters );
98
87
99
- if (of_property_read_u32_array (np , "snps,max-burst-len" , pdata -> max_burst ,
100
- nr_channels )) {
101
- memset32 (pdata -> max_burst , DW_DMA_MAX_BURST , nr_channels );
102
- }
88
+ memset32 (pdata -> multi_block , 1 , nr_channels );
89
+ of_property_read_u32_array (np , "multi-block" , pdata -> multi_block , nr_channels );
103
90
104
- if (!of_property_read_u32 (np , "snps,dma-protection-control" , & tmp )) {
105
- if (tmp > CHAN_PROTCTL_MASK )
106
- return NULL ;
107
- pdata -> protctl = tmp ;
108
- }
91
+ memset32 (pdata -> max_burst , DW_DMA_MAX_BURST , nr_channels );
92
+ of_property_read_u32_array (np , "snps,max-burst-len" , pdata -> max_burst , nr_channels );
93
+
94
+ of_property_read_u32 (np , "snps,dma-protection-control" , & pdata -> protctl );
95
+ if (pdata -> protctl > CHAN_PROTCTL_MASK )
96
+ return NULL ;
109
97
110
98
return pdata ;
111
99
}
0 commit comments