1616#define ISP_FIRMWARE_IPC_SIZE 0x1c000
1717#define ISP_FIRMWARE_DATA_SIZE 0x28000
1818
19+ #define ISP_COPROC_IN_WFI 0x3
20+
1921static inline u32 isp_coproc_read32 (struct apple_isp * isp , u32 reg )
2022{
2123 return readl (isp -> coproc + reg );
@@ -125,17 +127,17 @@ static int isp_enable_irq(struct apple_isp *isp)
125127 return 0 ;
126128}
127129
128- static int isp_coproc_ready (struct apple_isp * isp )
130+ static int isp_reset_coproc (struct apple_isp * isp )
129131{
130132 int retries ;
131133 u32 status ;
132134
133135 isp_coproc_write32 (isp , ISP_COPROC_EDPRCR , 0x2 );
134136
135- isp_coproc_write32 (isp , ISP_COPROC_PMGR_0 , 0xff00ff );
136- isp_coproc_write32 (isp , ISP_COPROC_PMGR_1 , 0xff00ff );
137- isp_coproc_write32 (isp , ISP_COPROC_PMGR_2 , 0xff00ff );
138- isp_coproc_write32 (isp , ISP_COPROC_PMGR_3 , 0xff00ff );
137+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_0 , 0xff00ff );
138+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_1 , 0xff00ff );
139+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_2 , 0xff00ff );
140+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_3 , 0xff00ff );
139141
140142 isp_coproc_write32 (isp , ISP_COPROC_IRQ_MASK_0 , 0xffffffff );
141143 isp_coproc_write32 (isp , ISP_COPROC_IRQ_MASK_1 , 0xffffffff );
@@ -146,7 +148,7 @@ static int isp_coproc_ready(struct apple_isp *isp)
146148
147149 for (retries = 0 ; retries < ISP_FIRMWARE_MAX_TRIES ; retries ++ ) {
148150 status = isp_coproc_read32 (isp , ISP_COPROC_STATUS );
149- if (!(( status & 0x3 ) == 0 ) ) {
151+ if (status & ISP_COPROC_IN_WFI ) {
150152 isp_dbg (isp , "%d: coproc in WFI (status: 0x%x)\n" ,
151153 retries , status );
152154 break ;
@@ -170,7 +172,7 @@ static int isp_firmware_boot_stage1(struct apple_isp *isp)
170172{
171173 int err , retries ;
172174
173- err = isp_coproc_ready (isp );
175+ err = isp_reset_coproc (isp );
174176 if (err < 0 )
175177 return err ;
176178
@@ -263,7 +265,7 @@ static int isp_firmware_boot_stage2(struct apple_isp *isp)
263265 args .ipc_iova = isp -> ipc_surf -> iova ;
264266 args .ipc_size = isp -> ipc_surf -> size ;
265267 args .shared_base = isp -> fw .heap_top ;
266- args .shared_size = 0x10000000 - isp -> fw .heap_top ;
268+ args .shared_size = 0x10000000UL - isp -> fw .heap_top ;
267269 args .extra_iova = isp -> extra_surf -> iova ;
268270 args .extra_size = isp -> extra_surf -> size ;
269271 args .platform_id = isp -> hw -> platform_id ;
@@ -425,6 +427,7 @@ static int isp_firmware_boot_stage3(struct apple_isp *isp)
425427 isp_iowrite (isp , msg_iova , & msg , sizeof (msg ));
426428 }
427429 }
430+ wmb ();
428431
429432 /* Wait for ISP_GPIO_3 to 0x8042006 -> 0x0 */
430433 isp_gpio_write32 (isp , ISP_GPIO_3 , 0x8042006 );
0 commit comments