22
22
#include <linux/interrupt.h>
23
23
#include <linux/i2c.h>
24
24
#include <linux/platform_device.h>
25
- #include <linux/i2c /pca954x.h>
25
+ #include <linux/platform_data /pca954x.h>
26
26
#include "i2c-ocores.h"
27
27
#include "xcvr-cls.h"
28
28
@@ -58,7 +58,7 @@ struct i2c_bus_config {
58
58
struct resource * res ;
59
59
ssize_t num_res ;
60
60
struct ocores_i2c_platform_data pdata ;
61
- };
61
+ };
62
62
63
63
/* switchbrd_priv - switchboard private data */
64
64
struct switchbrd_priv {
@@ -73,27 +73,27 @@ struct switchbrd_priv {
73
73
/* I2C bus speed param */
74
74
static int bus_clock_master_1 = 100 ;
75
75
module_param (bus_clock_master_1 , int , 0660 );
76
- MODULE_PARM_DESC (bus_clock_master_1 ,
76
+ MODULE_PARM_DESC (bus_clock_master_1 ,
77
77
"I2C master 1 bus speed in KHz 50/80/100/200/400" );
78
78
79
79
static int bus_clock_master_2 = 100 ;
80
80
module_param (bus_clock_master_2 , int , 0660 );
81
- MODULE_PARM_DESC (bus_clock_master_2 ,
81
+ MODULE_PARM_DESC (bus_clock_master_2 ,
82
82
"I2C master 2 bus speed in KHz 50/80/100/200/400" );
83
83
84
84
static int bus_clock_master_3 = 100 ;
85
85
module_param (bus_clock_master_3 , int , 0660 );
86
- MODULE_PARM_DESC (bus_clock_master_3 ,
86
+ MODULE_PARM_DESC (bus_clock_master_3 ,
87
87
"I2C master 3 bus speed in KHz 50/80/100/200/400" );
88
88
89
89
static int bus_clock_master_4 = 100 ;
90
90
module_param (bus_clock_master_4 , int , 0660 );
91
- MODULE_PARM_DESC (bus_clock_master_4 ,
91
+ MODULE_PARM_DESC (bus_clock_master_4 ,
92
92
"I2C master 4 bus speed in KHz 50/80/100/200/400" );
93
93
94
94
static int bus_clock_master_5 = 100 ;
95
95
module_param (bus_clock_master_5 , int , 0660 );
96
- MODULE_PARM_DESC (bus_clock_master_5 ,
96
+ MODULE_PARM_DESC (bus_clock_master_5 ,
97
97
"I2C master 5 bus speed in KHz 50/80/100/200/400" );
98
98
99
99
// NOTE: Silverstone i2c channel mapping is very wierd!!!
@@ -186,54 +186,54 @@ static struct i2c_board_info i2c_info_3[] = {
186
186
static struct resource cls_i2c_res_1 [] = {
187
187
{
188
188
.start = 0x800 , .end = 0x81F ,
189
- .flags = IORESOURCE_MEM ,},
189
+ .flags = IORESOURCE_MEM ,},
190
190
};
191
191
192
192
/* Resource IOMEM for i2c bus 2 */
193
193
static struct resource cls_i2c_res_2 [] = {
194
194
{
195
195
.start = 0x820 , .end = 0x83F ,
196
- .flags = IORESOURCE_MEM ,},
196
+ .flags = IORESOURCE_MEM ,},
197
197
};
198
198
199
199
/* Resource IOMEM for i2c bus 3 */
200
200
static struct resource cls_i2c_res_3 [] = {
201
201
{
202
202
.start = 0x840 , .end = 0x85F ,
203
- .flags = IORESOURCE_MEM ,},
203
+ .flags = IORESOURCE_MEM ,},
204
204
};
205
205
206
206
/* Resource IOMEM for i2c bus 4 */
207
207
static struct resource cls_i2c_res_4 [] = {
208
208
{
209
209
.start = 0x860 , .end = 0x87F ,
210
- .flags = IORESOURCE_MEM ,},
210
+ .flags = IORESOURCE_MEM ,},
211
211
};
212
212
213
213
/* Resource IOMEM for i2c bus 5 */
214
214
static struct resource cls_i2c_res_5 [] = {
215
215
{
216
216
.start = 0x880 , .end = 0x89F ,
217
- .flags = IORESOURCE_MEM ,},
217
+ .flags = IORESOURCE_MEM ,},
218
218
};
219
219
220
220
/* Resource IOMEM for reg access */
221
221
static struct resource reg_io_res [] = {
222
- {
222
+ {
223
223
.start = 0x00 , .end = 0xFF ,
224
224
.flags = IORESOURCE_MEM ,},
225
225
};
226
226
227
227
/* Resource IOMEM for spi flash firmware upgrade */
228
228
static struct resource spi_flash_res [] = {
229
- {
229
+ {
230
230
.start = 0x1200 , .end = 0x121F ,
231
231
.flags = IORESOURCE_MEM ,},
232
232
};
233
233
234
234
/* Resource IOMEM for front panel XCVR */
235
235
static struct resource xcvr_res [] = {
236
- {
236
+ {
237
237
.start = 0x4000 , .end = 0x421F ,
238
238
.flags = IORESOURCE_MEM ,},
239
239
};
@@ -254,9 +254,9 @@ static struct i2c_bus_config i2c_bus_configs[] = {
254
254
},
255
255
},
256
256
{
257
- .id = 2 ,
258
- .res = cls_i2c_res_2 ,
259
- .num_res = ARRAY_SIZE (cls_i2c_res_2 ),
257
+ .id = 2 ,
258
+ .res = cls_i2c_res_2 ,
259
+ .num_res = ARRAY_SIZE (cls_i2c_res_2 ),
260
260
.pdata = {
261
261
.reg_shift = OCORE_REGSHIFT ,
262
262
.reg_io_width = OCORE_REG_IO_WIDTH ,
@@ -268,9 +268,9 @@ static struct i2c_bus_config i2c_bus_configs[] = {
268
268
},
269
269
},
270
270
{
271
- .id = 3 ,
272
- .res = cls_i2c_res_3 ,
273
- .num_res = ARRAY_SIZE (cls_i2c_res_3 ),
271
+ .id = 3 ,
272
+ .res = cls_i2c_res_3 ,
273
+ .num_res = ARRAY_SIZE (cls_i2c_res_3 ),
274
274
.pdata = {
275
275
.reg_shift = OCORE_REGSHIFT ,
276
276
.reg_io_width = OCORE_REG_IO_WIDTH ,
@@ -282,9 +282,9 @@ static struct i2c_bus_config i2c_bus_configs[] = {
282
282
},
283
283
},
284
284
{
285
- .id = 4 ,
286
- .res = cls_i2c_res_4 ,
287
- .num_res = ARRAY_SIZE (cls_i2c_res_4 ),
285
+ .id = 4 ,
286
+ .res = cls_i2c_res_4 ,
287
+ .num_res = ARRAY_SIZE (cls_i2c_res_4 ),
288
288
.pdata = {
289
289
.reg_shift = OCORE_REGSHIFT ,
290
290
.reg_io_width = OCORE_REG_IO_WIDTH ,
@@ -296,9 +296,9 @@ static struct i2c_bus_config i2c_bus_configs[] = {
296
296
},
297
297
},
298
298
{
299
- .id = 5 ,
300
- .res = cls_i2c_res_5 ,
301
- .num_res = ARRAY_SIZE (cls_i2c_res_5 ),
299
+ .id = 5 ,
300
+ .res = cls_i2c_res_5 ,
301
+ .num_res = ARRAY_SIZE (cls_i2c_res_5 ),
302
302
.pdata = {
303
303
.reg_shift = OCORE_REGSHIFT ,
304
304
.reg_io_width = OCORE_REG_IO_WIDTH ,
@@ -386,10 +386,10 @@ static int cls_fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
386
386
goto err_disable_device ;
387
387
}
388
388
389
- dev_dbg (& dev -> dev , "BAR%d res: 0x%lx-0x%llx\n" , MMIO_BAR ,
389
+ dev_dbg (& dev -> dev , "BAR%d res: 0x%lx-0x%llx\n" , MMIO_BAR ,
390
390
rstart , pci_resource_end (dev , MMIO_BAR ));
391
391
392
- priv = devm_kzalloc (& dev -> dev ,
392
+ priv = devm_kzalloc (& dev -> dev ,
393
393
sizeof (struct switchbrd_priv ), GFP_KERNEL );
394
394
if (!priv ){
395
395
err = - ENOMEM ;
@@ -399,8 +399,8 @@ static int cls_fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
399
399
pci_set_drvdata (dev , priv );
400
400
num_i2c_bus = ARRAY_SIZE (i2c_bus_configs );
401
401
i2cbuses_pdev = devm_kzalloc (
402
- & dev -> dev ,
403
- num_i2c_bus * sizeof (struct platform_device * ),
402
+ & dev -> dev ,
403
+ num_i2c_bus * sizeof (struct platform_device * ),
404
404
GFP_KERNEL );
405
405
406
406
reg_io_res [0 ].start += rstart ;
@@ -410,7 +410,7 @@ static int cls_fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
410
410
xcvr_res [0 ].end += rstart ;
411
411
412
412
regio_pdev = platform_device_register_resndata (
413
- & dev -> dev , "cls-swbrd-io" ,
413
+ & dev -> dev , "cls-swbrd-io" ,
414
414
-1 ,
415
415
reg_io_res , ARRAY_SIZE (reg_io_res ),
416
416
NULL , 0 );
@@ -422,12 +422,12 @@ static int cls_fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
422
422
}
423
423
424
424
xcvr_pdev = platform_device_register_resndata (
425
- NULL ,
426
- "cls-xcvr" ,
425
+ NULL ,
426
+ "cls-xcvr" ,
427
427
-1 ,
428
- xcvr_res ,
428
+ xcvr_res ,
429
429
ARRAY_SIZE (xcvr_res ),
430
- & xcvr_data ,
430
+ & xcvr_data ,
431
431
sizeof (xcvr_data ));
432
432
433
433
if (IS_ERR (xcvr_pdev )) {
@@ -462,20 +462,20 @@ static int cls_fpga_probe(struct pci_dev *dev, const struct pci_device_id *id)
462
462
}
463
463
464
464
dev_dbg (& dev -> dev , "i2c-bus.%d: 0x%llx - 0x%llx\n" ,
465
- i2c_bus_configs [i ].id ,
466
- i2c_bus_configs [i ].res [0 ].start ,
465
+ i2c_bus_configs [i ].id ,
466
+ i2c_bus_configs [i ].res [0 ].start ,
467
467
i2c_bus_configs [i ].res [0 ].end );
468
468
469
469
i2cbuses_pdev [i ] = platform_device_register_resndata (
470
- & dev -> dev , "cls-ocores-i2c" ,
470
+ & dev -> dev , "cls-ocores-i2c" ,
471
471
i2c_bus_configs [i ].id ,
472
- i2c_bus_configs [i ].res ,
472
+ i2c_bus_configs [i ].res ,
473
473
i2c_bus_configs [i ].num_res ,
474
- & i2c_bus_configs [i ].pdata ,
474
+ & i2c_bus_configs [i ].pdata ,
475
475
sizeof (i2c_bus_configs [i ].pdata ));
476
476
477
477
if (IS_ERR (i2cbuses_pdev [i ])) {
478
- dev_err (& dev -> dev , "Failed to register ocores-i2c.%d\n" ,
478
+ dev_err (& dev -> dev , "Failed to register ocores-i2c.%d\n" ,
479
479
i2c_bus_configs [i ].id );
480
480
err = PTR_ERR (i2cbuses_pdev [i ]);
481
481
goto err_unregister_ocore ;
0 commit comments