@@ -30,7 +30,7 @@ enum chips { sc18is602, sc18is602b, sc18is603 };
3030#define SC18IS602_MODE_CLOCK_DIV_128 0x3
3131
3232struct sc18is602 {
33- struct spi_master * master ;
33+ struct spi_controller * host ;
3434 struct device * dev ;
3535 u8 ctrl ;
3636 u32 freq ;
@@ -179,10 +179,10 @@ static int sc18is602_check_transfer(struct spi_device *spi,
179179 return 0 ;
180180}
181181
182- static int sc18is602_transfer_one (struct spi_master * master ,
182+ static int sc18is602_transfer_one (struct spi_controller * host ,
183183 struct spi_message * m )
184184{
185- struct sc18is602 * hw = spi_master_get_devdata ( master );
185+ struct sc18is602 * hw = spi_controller_get_devdata ( host );
186186 struct spi_device * spi = m -> spi ;
187187 struct spi_transfer * t ;
188188 int status = 0 ;
@@ -213,7 +213,7 @@ static int sc18is602_transfer_one(struct spi_master *master,
213213 spi_transfer_delay_exec (t );
214214 }
215215 m -> status = status ;
216- spi_finalize_current_message (master );
216+ spi_finalize_current_message (host );
217217
218218 return status ;
219219}
@@ -225,7 +225,7 @@ static size_t sc18is602_max_transfer_size(struct spi_device *spi)
225225
226226static int sc18is602_setup (struct spi_device * spi )
227227{
228- struct sc18is602 * hw = spi_master_get_devdata (spi -> master );
228+ struct sc18is602 * hw = spi_controller_get_devdata (spi -> controller );
229229
230230 /* SC18IS602 does not support CS2 */
231231 if (hw -> id == sc18is602 && (spi_get_chipselect (spi , 0 ) == 2 ))
@@ -241,17 +241,17 @@ static int sc18is602_probe(struct i2c_client *client)
241241 struct device_node * np = dev -> of_node ;
242242 struct sc18is602_platform_data * pdata = dev_get_platdata (dev );
243243 struct sc18is602 * hw ;
244- struct spi_master * master ;
244+ struct spi_controller * host ;
245245
246246 if (!i2c_check_functionality (client -> adapter , I2C_FUNC_I2C |
247247 I2C_FUNC_SMBUS_WRITE_BYTE_DATA ))
248248 return - EINVAL ;
249249
250- master = devm_spi_alloc_master (dev , sizeof (struct sc18is602 ));
251- if (!master )
250+ host = devm_spi_alloc_host (dev , sizeof (struct sc18is602 ));
251+ if (!host )
252252 return - ENOMEM ;
253253
254- hw = spi_master_get_devdata ( master );
254+ hw = spi_controller_get_devdata ( host );
255255 i2c_set_clientdata (client , hw );
256256
257257 /* assert reset and then release */
@@ -260,7 +260,7 @@ static int sc18is602_probe(struct i2c_client *client)
260260 return PTR_ERR (hw -> reset );
261261 gpiod_set_value_cansleep (hw -> reset , 0 );
262262
263- hw -> master = master ;
263+ hw -> host = host ;
264264 hw -> client = client ;
265265 hw -> dev = dev ;
266266 hw -> ctrl = 0xff ;
@@ -273,11 +273,11 @@ static int sc18is602_probe(struct i2c_client *client)
273273 switch (hw -> id ) {
274274 case sc18is602 :
275275 case sc18is602b :
276- master -> num_chipselect = 4 ;
276+ host -> num_chipselect = 4 ;
277277 hw -> freq = SC18IS602_CLOCK ;
278278 break ;
279279 case sc18is603 :
280- master -> num_chipselect = 2 ;
280+ host -> num_chipselect = 2 ;
281281 if (pdata ) {
282282 hw -> freq = pdata -> clock_frequency ;
283283 } else {
@@ -292,18 +292,18 @@ static int sc18is602_probe(struct i2c_client *client)
292292 hw -> freq = SC18IS602_CLOCK ;
293293 break ;
294294 }
295- master -> bus_num = np ? -1 : client -> adapter -> nr ;
296- master -> mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST ;
297- master -> bits_per_word_mask = SPI_BPW_MASK (8 );
298- master -> setup = sc18is602_setup ;
299- master -> transfer_one_message = sc18is602_transfer_one ;
300- master -> max_transfer_size = sc18is602_max_transfer_size ;
301- master -> max_message_size = sc18is602_max_transfer_size ;
302- master -> dev .of_node = np ;
303- master -> min_speed_hz = hw -> freq / 128 ;
304- master -> max_speed_hz = hw -> freq / 4 ;
305-
306- return devm_spi_register_master (dev , master );
295+ host -> bus_num = np ? -1 : client -> adapter -> nr ;
296+ host -> mode_bits = SPI_CPHA | SPI_CPOL | SPI_LSB_FIRST ;
297+ host -> bits_per_word_mask = SPI_BPW_MASK (8 );
298+ host -> setup = sc18is602_setup ;
299+ host -> transfer_one_message = sc18is602_transfer_one ;
300+ host -> max_transfer_size = sc18is602_max_transfer_size ;
301+ host -> max_message_size = sc18is602_max_transfer_size ;
302+ host -> dev .of_node = np ;
303+ host -> min_speed_hz = hw -> freq / 128 ;
304+ host -> max_speed_hz = hw -> freq / 4 ;
305+
306+ return devm_spi_register_controller (dev , host );
307307}
308308
309309static const struct i2c_device_id sc18is602_id [] = {
@@ -342,6 +342,6 @@ static struct i2c_driver sc18is602_driver = {
342342
343343module_i2c_driver (sc18is602_driver );
344344
345- MODULE_DESCRIPTION ("SC18IS602/603 SPI Master Driver" );
345+ MODULE_DESCRIPTION ("SC18IS602/603 SPI Host Driver" );
346346MODULE_AUTHOR ("Guenter Roeck" );
347347MODULE_LICENSE ("GPL" );
0 commit comments