1515#define ISP_FIRMWARE_IPC_SIZE 0x1c000
1616#define ISP_FIRMWARE_DATA_SIZE 0x28000
1717
18+ #define ISP_COPROC_IN_WFI 0x3
19+
1820static inline u32 isp_coproc_read32 (struct apple_isp * isp , u32 reg )
1921{
2022 return readl (isp -> coproc + reg );
@@ -124,17 +126,17 @@ static int isp_enable_irq(struct apple_isp *isp)
124126 return 0 ;
125127}
126128
127- static int isp_coproc_ready (struct apple_isp * isp )
129+ static int isp_reset_coproc (struct apple_isp * isp )
128130{
129131 int retries ;
130132 u32 status ;
131133
132134 isp_coproc_write32 (isp , ISP_COPROC_EDPRCR , 0x2 );
133135
134- isp_coproc_write32 (isp , ISP_COPROC_PMGR_0 , 0xff00ff );
135- isp_coproc_write32 (isp , ISP_COPROC_PMGR_1 , 0xff00ff );
136- isp_coproc_write32 (isp , ISP_COPROC_PMGR_2 , 0xff00ff );
137- isp_coproc_write32 (isp , ISP_COPROC_PMGR_3 , 0xff00ff );
136+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_0 , 0xff00ff );
137+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_1 , 0xff00ff );
138+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_2 , 0xff00ff );
139+ isp_coproc_write32 (isp , ISP_COPROC_FABRIC_3 , 0xff00ff );
138140
139141 isp_coproc_write32 (isp , ISP_COPROC_IRQ_MASK_0 , 0xffffffff );
140142 isp_coproc_write32 (isp , ISP_COPROC_IRQ_MASK_1 , 0xffffffff );
@@ -145,7 +147,7 @@ static int isp_coproc_ready(struct apple_isp *isp)
145147
146148 for (retries = 0 ; retries < ISP_FIRMWARE_MAX_TRIES ; retries ++ ) {
147149 status = isp_coproc_read32 (isp , ISP_COPROC_STATUS );
148- if (!(( status & 0x3 ) == 0 ) ) {
150+ if (status & ISP_COPROC_IN_WFI ) {
149151 isp_dbg (isp , "%d: coproc in WFI (status: 0x%x)\n" ,
150152 retries , status );
151153 break ;
@@ -169,7 +171,7 @@ static int isp_firmware_boot_stage1(struct apple_isp *isp)
169171{
170172 int err , retries ;
171173
172- err = isp_coproc_ready (isp );
174+ err = isp_reset_coproc (isp );
173175 if (err < 0 )
174176 return err ;
175177
@@ -262,7 +264,7 @@ static int isp_firmware_boot_stage2(struct apple_isp *isp)
262264 args .ipc_iova = isp -> ipc_surf -> iova ;
263265 args .ipc_size = isp -> ipc_surf -> size ;
264266 args .shared_base = isp -> fw .heap_top ;
265- args .shared_size = 0x10000000 - isp -> fw .heap_top ;
267+ args .shared_size = 0x10000000UL - isp -> fw .heap_top ;
266268 args .extra_iova = isp -> extra_surf -> iova ;
267269 args .extra_size = isp -> extra_surf -> size ;
268270 args .platform_id = isp -> hw -> platform_id ;
@@ -424,6 +426,7 @@ static int isp_firmware_boot_stage3(struct apple_isp *isp)
424426 isp_iowrite (isp , msg_iova , & msg , sizeof (msg ));
425427 }
426428 }
429+ wmb ();
427430
428431 /* Wait for ISP_GPIO_3 to 0x8042006 -> 0x0 */
429432 isp_gpio_write32 (isp , ISP_GPIO_3 , 0x8042006 );
0 commit comments