|  | @@ -228,21 +228,8 @@ struct phantom_nic {
 | 
		
	
		
			
			| 228 | 228 |   */
 | 
		
	
		
			
			| 229 | 229 |  static unsigned long phantom_crb_access_128m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 230 | 230 |  					       unsigned long reg ) {
 | 
		
	
		
			
			| 231 |  | -	static const uint32_t reg_window[] = {
 | 
		
	
		
			
			| 232 |  | -		[UNM_CRB_BLK_PCIE]	= 0x0000000,
 | 
		
	
		
			
			| 233 |  | -		[UNM_CRB_BLK_CAM]	= 0x2000000,
 | 
		
	
		
			
			| 234 |  | -		[UNM_CRB_BLK_ROMUSB]	= 0x2000000,
 | 
		
	
		
			
			| 235 |  | -		[UNM_CRB_BLK_TEST]	= 0x0000000,
 | 
		
	
		
			
			| 236 |  | -	};
 | 
		
	
		
			
			| 237 |  | -	static const uint32_t reg_bases[] = {
 | 
		
	
		
			
			| 238 |  | -		[UNM_CRB_BLK_PCIE]	= 0x6100000,
 | 
		
	
		
			
			| 239 |  | -		[UNM_CRB_BLK_CAM]	= 0x6200000,
 | 
		
	
		
			
			| 240 |  | -		[UNM_CRB_BLK_ROMUSB]	= 0x7300000,
 | 
		
	
		
			
			| 241 |  | -		[UNM_CRB_BLK_TEST]	= 0x6200000,
 | 
		
	
		
			
			| 242 |  | -	};
 | 
		
	
		
			
			| 243 |  | -	unsigned int block = UNM_CRB_BLK ( reg );
 | 
		
	
		
			
			| 244 |  | -	unsigned long offset = UNM_CRB_OFFSET ( reg );
 | 
		
	
		
			
			| 245 |  | -	uint32_t window = reg_window[block];
 | 
		
	
		
			
			|  | 231 | +	unsigned long offset = ( 0x6000000 + ( reg & 0x1ffffff ) );
 | 
		
	
		
			
			|  | 232 | +	uint32_t window = ( reg & 0x2000000 );
 | 
		
	
		
			
			| 246 | 233 |  	uint32_t verify_window;
 | 
		
	
		
			
			| 247 | 234 |  
 | 
		
	
		
			
			| 248 | 235 |  	if ( phantom->crb_window != window ) {
 | 
		
	
	
		
			
			|  | @@ -258,7 +245,7 @@ static unsigned long phantom_crb_access_128m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 258 | 245 |  		phantom->crb_window = window;
 | 
		
	
		
			
			| 259 | 246 |  	}
 | 
		
	
		
			
			| 260 | 247 |  
 | 
		
	
		
			
			| 261 |  | -	return ( reg_bases[block] + offset );
 | 
		
	
		
			
			|  | 248 | +	return offset;
 | 
		
	
		
			
			| 262 | 249 |  }
 | 
		
	
		
			
			| 263 | 250 |  
 | 
		
	
		
			
			| 264 | 251 |  /**
 | 
		
	
	
		
			
			|  | @@ -270,21 +257,8 @@ static unsigned long phantom_crb_access_128m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 270 | 257 |   */
 | 
		
	
		
			
			| 271 | 258 |  static unsigned long phantom_crb_access_32m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 272 | 259 |  					      unsigned long reg ) {
 | 
		
	
		
			
			| 273 |  | -	static const uint32_t reg_window[] = {
 | 
		
	
		
			
			| 274 |  | -		[UNM_CRB_BLK_PCIE]	= 0x0000000,
 | 
		
	
		
			
			| 275 |  | -		[UNM_CRB_BLK_CAM]	= 0x2000000,
 | 
		
	
		
			
			| 276 |  | -		[UNM_CRB_BLK_ROMUSB]	= 0x2000000,
 | 
		
	
		
			
			| 277 |  | -		[UNM_CRB_BLK_TEST]	= 0x0000000,
 | 
		
	
		
			
			| 278 |  | -	};
 | 
		
	
		
			
			| 279 |  | -	static const uint32_t reg_bases[] = {
 | 
		
	
		
			
			| 280 |  | -		[UNM_CRB_BLK_PCIE]	= 0x0100000,
 | 
		
	
		
			
			| 281 |  | -		[UNM_CRB_BLK_CAM]	= 0x0200000,
 | 
		
	
		
			
			| 282 |  | -		[UNM_CRB_BLK_ROMUSB]	= 0x1300000,
 | 
		
	
		
			
			| 283 |  | -		[UNM_CRB_BLK_TEST]	= 0x0200000,
 | 
		
	
		
			
			| 284 |  | -	};
 | 
		
	
		
			
			| 285 |  | -	unsigned int block = UNM_CRB_BLK ( reg );
 | 
		
	
		
			
			| 286 |  | -	unsigned long offset = UNM_CRB_OFFSET ( reg );
 | 
		
	
		
			
			| 287 |  | -	uint32_t window = reg_window[block];
 | 
		
	
		
			
			|  | 260 | +	unsigned long offset = ( reg & 0x1ffffff );
 | 
		
	
		
			
			|  | 261 | +	uint32_t window = ( reg & 0x2000000 );
 | 
		
	
		
			
			| 288 | 262 |  	uint32_t verify_window;
 | 
		
	
		
			
			| 289 | 263 |  
 | 
		
	
		
			
			| 290 | 264 |  	if ( phantom->crb_window != window ) {
 | 
		
	
	
		
			
			|  | @@ -300,7 +274,7 @@ static unsigned long phantom_crb_access_32m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 300 | 274 |  		phantom->crb_window = window;
 | 
		
	
		
			
			| 301 | 275 |  	}
 | 
		
	
		
			
			| 302 | 276 |  
 | 
		
	
		
			
			| 303 |  | -	return ( reg_bases[block] + offset );
 | 
		
	
		
			
			|  | 277 | +	return offset;
 | 
		
	
		
			
			| 304 | 278 |  }
 | 
		
	
		
			
			| 305 | 279 |  
 | 
		
	
		
			
			| 306 | 280 |  /**
 | 
		
	
	
		
			
			|  | @@ -312,31 +286,49 @@ static unsigned long phantom_crb_access_32m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 312 | 286 |   */
 | 
		
	
		
			
			| 313 | 287 |  static unsigned long phantom_crb_access_2m ( struct phantom_nic *phantom,
 | 
		
	
		
			
			| 314 | 288 |  					     unsigned long reg ) {
 | 
		
	
		
			
			| 315 |  | -	static const uint32_t reg_window_hi[] = {
 | 
		
	
		
			
			| 316 |  | -		[UNM_CRB_BLK_PCIE]	= 0x77300000,
 | 
		
	
		
			
			| 317 |  | -		[UNM_CRB_BLK_CAM]	= 0x41600000,
 | 
		
	
		
			
			| 318 |  | -		[UNM_CRB_BLK_ROMUSB]	= 0x42100000,
 | 
		
	
		
			
			| 319 |  | -		[UNM_CRB_BLK_TEST]	= 0x29500000,
 | 
		
	
		
			
			|  | 289 | +	static const struct {
 | 
		
	
		
			
			|  | 290 | +		uint8_t block;
 | 
		
	
		
			
			|  | 291 | +		uint16_t window_hi;
 | 
		
	
		
			
			|  | 292 | +	} reg_window_hi[] = {
 | 
		
	
		
			
			|  | 293 | +		{ UNM_CRB_BLK_PCIE,	0x773 },
 | 
		
	
		
			
			|  | 294 | +		{ UNM_CRB_BLK_CAM,	0x416 },
 | 
		
	
		
			
			|  | 295 | +		{ UNM_CRB_BLK_ROMUSB,	0x421 },
 | 
		
	
		
			
			|  | 296 | +		{ UNM_CRB_BLK_TEST,	0x295 },
 | 
		
	
		
			
			| 320 | 297 |  	};
 | 
		
	
		
			
			| 321 | 298 |  	unsigned int block = UNM_CRB_BLK ( reg );
 | 
		
	
		
			
			| 322 | 299 |  	unsigned long offset = UNM_CRB_OFFSET ( reg );
 | 
		
	
		
			
			| 323 |  | -	uint32_t window = ( reg_window_hi[block] | ( offset & 0x000f0000 ) );
 | 
		
	
		
			
			|  | 300 | +	uint32_t window;
 | 
		
	
		
			
			| 324 | 301 |  	uint32_t verify_window;
 | 
		
	
		
			
			|  | 302 | +	unsigned int i;
 | 
		
	
		
			
			| 325 | 303 |  
 | 
		
	
		
			
			| 326 |  | -	if ( phantom->crb_window != window ) {
 | 
		
	
		
			
			|  | 304 | +	for ( i = 0 ; i < ( sizeof ( reg_window_hi ) /
 | 
		
	
		
			
			|  | 305 | +			    sizeof ( reg_window_hi[0] ) ) ; i++ ) {
 | 
		
	
		
			
			| 327 | 306 |  
 | 
		
	
		
			
			| 328 |  | -		/* Write to the CRB window register */
 | 
		
	
		
			
			| 329 |  | -		writel ( window, phantom->bar0 + UNM_2M_CRB_WINDOW );
 | 
		
	
		
			
			|  | 307 | +		if ( reg_window_hi[i].block != block )
 | 
		
	
		
			
			|  | 308 | +			continue;
 | 
		
	
		
			
			| 330 | 309 |  
 | 
		
	
		
			
			| 331 |  | -		/* Ensure that the write has reached the card */
 | 
		
	
		
			
			| 332 |  | -		verify_window = readl ( phantom->bar0 + UNM_2M_CRB_WINDOW );
 | 
		
	
		
			
			| 333 |  | -		assert ( verify_window == window );
 | 
		
	
		
			
			|  | 310 | +		window = ( ( reg_window_hi[i].window_hi << 20 ) |
 | 
		
	
		
			
			|  | 311 | +			   ( offset & 0x000f0000 ) );
 | 
		
	
		
			
			| 334 | 312 |  
 | 
		
	
		
			
			| 335 |  | -		/* Record new window */
 | 
		
	
		
			
			| 336 |  | -		phantom->crb_window = window;
 | 
		
	
		
			
			|  | 313 | +		if ( phantom->crb_window != window ) {
 | 
		
	
		
			
			|  | 314 | +
 | 
		
	
		
			
			|  | 315 | +			/* Write to the CRB window register */
 | 
		
	
		
			
			|  | 316 | +			writel ( window, phantom->bar0 + UNM_2M_CRB_WINDOW );
 | 
		
	
		
			
			|  | 317 | +
 | 
		
	
		
			
			|  | 318 | +			/* Ensure that the write has reached the card */
 | 
		
	
		
			
			|  | 319 | +			verify_window = readl ( phantom->bar0 +
 | 
		
	
		
			
			|  | 320 | +						UNM_2M_CRB_WINDOW );
 | 
		
	
		
			
			|  | 321 | +			assert ( verify_window == window );
 | 
		
	
		
			
			|  | 322 | +
 | 
		
	
		
			
			|  | 323 | +			/* Record new window */
 | 
		
	
		
			
			|  | 324 | +			phantom->crb_window = window;
 | 
		
	
		
			
			|  | 325 | +		}
 | 
		
	
		
			
			|  | 326 | +
 | 
		
	
		
			
			|  | 327 | +		return ( 0x1e0000 + ( offset & 0xffff ) );
 | 
		
	
		
			
			| 337 | 328 |  	}
 | 
		
	
		
			
			| 338 | 329 |  
 | 
		
	
		
			
			| 339 |  | -	return ( 0x1e0000 + ( offset & 0xffff ) );
 | 
		
	
		
			
			|  | 330 | +	assert ( 0 );
 | 
		
	
		
			
			|  | 331 | +	return 0;
 | 
		
	
		
			
			| 340 | 332 |  }
 | 
		
	
		
			
			| 341 | 333 |  
 | 
		
	
		
			
			| 342 | 334 |  /**
 |