Commit 1589a993 authored by Uwe Bugla's avatar Uwe Bugla Committed by Mauro Carvalho Chehab

V4L/DVB (11287): Code cleanup (passes checkpatch now) of the b2c2-flexcop-drivers 1/2

This patch cleans up the source code of the b2c2 flexcop-driver. It is the first of a total of two.

The code is now passing the checkpatch-script.
Signed-off-by: default avatarUwe Bugla <uwe.bugla@gmx.de>
Signed-off-by: default avatarPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 7def728f
...@@ -2,7 +2,6 @@ b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \ ...@@ -2,7 +2,6 @@ b2c2-flexcop-objs = flexcop.o flexcop-fe-tuner.o flexcop-i2c.o \
flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o flexcop-sram.o flexcop-eeprom.o flexcop-misc.o flexcop-hw-filter.o
obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o obj-$(CONFIG_DVB_B2C2_FLEXCOP) += b2c2-flexcop.o
ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),) ifneq ($(CONFIG_DVB_B2C2_FLEXCOP_PCI),)
b2c2-flexcop-objs += flexcop-dma.o b2c2-flexcop-objs += flexcop-dma.o
endif endif
......
...@@ -28,11 +28,14 @@ ...@@ -28,11 +28,14 @@
/* Steal from usb.h */ /* Steal from usb.h */
#undef err #undef err
#define err(format, arg...) printk(KERN_ERR FC_LOG_PREFIX ": " format "\n" , ## arg) #define err(format, arg...) \
printk(KERN_ERR FC_LOG_PREFIX ": " format "\n" , ## arg)
#undef info #undef info
#define info(format, arg...) printk(KERN_INFO FC_LOG_PREFIX ": " format "\n" , ## arg) #define info(format, arg...) \
printk(KERN_INFO FC_LOG_PREFIX ": " format "\n" , ## arg)
#undef warn #undef warn
#define warn(format, arg...) printk(KERN_WARNING FC_LOG_PREFIX ": " format "\n" , ## arg) #define warn(format, arg...) \
printk(KERN_WARNING FC_LOG_PREFIX ": " format "\n" , ## arg)
struct flexcop_dma { struct flexcop_dma {
struct pci_dev *pdev; struct pci_dev *pdev;
...@@ -91,16 +94,14 @@ struct flexcop_device { ...@@ -91,16 +94,14 @@ struct flexcop_device {
int fullts_streaming_state; int fullts_streaming_state;
/* bus specific callbacks */ /* bus specific callbacks */
flexcop_ibi_value (*read_ibi_reg) (struct flexcop_device *, flexcop_ibi_register); flexcop_ibi_value(*read_ibi_reg) (struct flexcop_device *,
int (*write_ibi_reg) (struct flexcop_device *, flexcop_ibi_register, flexcop_ibi_value); flexcop_ibi_register);
int (*write_ibi_reg) (struct flexcop_device *,
flexcop_ibi_register, flexcop_ibi_value);
int (*i2c_request) (struct flexcop_i2c_adapter*, int (*i2c_request) (struct flexcop_i2c_adapter *,
flexcop_access_op_t, u8 chipaddr, u8 addr, u8 *buf, u16 len); flexcop_access_op_t, u8 chipaddr, u8 addr, u8 *buf, u16 len);
int (*stream_control) (struct flexcop_device*, int); int (*stream_control) (struct flexcop_device *, int);
int (*get_mac_addr) (struct flexcop_device *fc, int extended); int (*get_mac_addr) (struct flexcop_device *fc, int extended);
void *bus_specific; void *bus_specific;
}; };
...@@ -111,22 +112,28 @@ void flexcop_pass_dmx_data(struct flexcop_device *fc, u8 *buf, u32 len); ...@@ -111,22 +112,28 @@ void flexcop_pass_dmx_data(struct flexcop_device *fc, u8 *buf, u32 len);
void flexcop_pass_dmx_packets(struct flexcop_device *fc, u8 *buf, u32 no); void flexcop_pass_dmx_packets(struct flexcop_device *fc, u8 *buf, u32 no);
struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len); struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len);
void flexcop_device_kfree(struct flexcop_device*); void flexcop_device_kfree(struct flexcop_device *);
int flexcop_device_initialize(struct flexcop_device*); int flexcop_device_initialize(struct flexcop_device *);
void flexcop_device_exit(struct flexcop_device *fc); void flexcop_device_exit(struct flexcop_device *fc);
void flexcop_reset_block_300(struct flexcop_device *fc); void flexcop_reset_block_300(struct flexcop_device *fc);
/* from flexcop-dma.c */ /* from flexcop-dma.c */
int flexcop_dma_allocate(struct pci_dev *pdev, struct flexcop_dma *dma, u32 size); int flexcop_dma_allocate(struct pci_dev *pdev,
struct flexcop_dma *dma, u32 size);
void flexcop_dma_free(struct flexcop_dma *dma); void flexcop_dma_free(struct flexcop_dma *dma);
int flexcop_dma_control_timer_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); int flexcop_dma_control_timer_irq(struct flexcop_device *fc,
int flexcop_dma_control_size_irq(struct flexcop_device *fc, flexcop_dma_index_t no, int onoff); flexcop_dma_index_t no, int onoff);
int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma, flexcop_dma_index_t dma_idx); int flexcop_dma_control_size_irq(struct flexcop_device *fc,
int flexcop_dma_xfer_control(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index, int onoff); flexcop_dma_index_t no, int onoff);
int flexcop_dma_config_timer(struct flexcop_device *fc, flexcop_dma_index_t dma_idx, u8 cycles); int flexcop_dma_config(struct flexcop_device *fc, struct flexcop_dma *dma,
flexcop_dma_index_t dma_idx);
int flexcop_dma_xfer_control(struct flexcop_device *fc,
flexcop_dma_index_t dma_idx, flexcop_dma_addr_index_t index,
int onoff);
int flexcop_dma_config_timer(struct flexcop_device *fc,
flexcop_dma_index_t dma_idx, u8 cycles);
/* from flexcop-eeprom.c */ /* from flexcop-eeprom.c */
/* the PCI part uses this call to get the MAC address, the USB part has its own */ /* the PCI part uses this call to get the MAC address, the USB part has its own */
...@@ -141,13 +148,15 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter*, flexcop_access_op_t, ...@@ -141,13 +148,15 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter*, flexcop_access_op_t,
u8 chipaddr, u8 addr, u8 *buf, u16 len); u8 chipaddr, u8 addr, u8 *buf, u16 len);
/* from flexcop-sram.c */ /* from flexcop-sram.c */
int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest, flexcop_sram_dest_target_t target); int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest,
flexcop_sram_dest_target_t target);
void flexcop_wan_set_speed(struct flexcop_device *fc, flexcop_wan_speed_t s); void flexcop_wan_set_speed(struct flexcop_device *fc, flexcop_wan_speed_t s);
void flexcop_sram_ctrl(struct flexcop_device *fc, int usb_wan, int sramdma, int maximumfill); void flexcop_sram_ctrl(struct flexcop_device *fc,
int usb_wan, int sramdma, int maximumfill);
/* global prototypes for the flexcop-chip */ /* global prototypes for the flexcop-chip */
/* from flexcop-fe-tuner.c */ /* from flexcop-fe-tuner.c */
int flexcop_frontend_init(struct flexcop_device *card); int flexcop_frontend_init(struct flexcop_device *fc);
void flexcop_frontend_exit(struct flexcop_device *fc); void flexcop_frontend_exit(struct flexcop_device *fc);
/* from flexcop-i2c.c */ /* from flexcop-i2c.c */
...@@ -159,11 +168,14 @@ int flexcop_sram_init(struct flexcop_device *fc); ...@@ -159,11 +168,14 @@ int flexcop_sram_init(struct flexcop_device *fc);
/* from flexcop-misc.c */ /* from flexcop-misc.c */
void flexcop_determine_revision(struct flexcop_device *fc); void flexcop_determine_revision(struct flexcop_device *fc);
void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const char *suffix); void flexcop_device_name(struct flexcop_device *fc,
void flexcop_dump_reg(struct flexcop_device *fc, flexcop_ibi_register reg, int num); const char *prefix, const char *suffix);
void flexcop_dump_reg(struct flexcop_device *fc,
flexcop_ibi_register reg, int num);
/* from flexcop-hw-filter.c */ /* from flexcop-hw-filter.c */
int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *dvbdmxfeed, int onoff); int flexcop_pid_feed_control(struct flexcop_device *fc,
struct dvb_demux_feed *dvbdmxfeed, int onoff);
void flexcop_hw_filter_init(struct flexcop_device *fc); void flexcop_hw_filter_init(struct flexcop_device *fc);
void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff); void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff);
......
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop-dma.c - configuring and controlling the DMA of the FlexCop
* flexcop-dma.c - methods for configuring and controlling the DMA of the FlexCop. * see flexcop.c for copyright information
*
* see flexcop.c for copyright information.
*/ */
#include "flexcop.h" #include "flexcop.h"
int flexcop_dma_allocate(struct pci_dev *pdev, struct flexcop_dma *dma, u32 size) int flexcop_dma_allocate(struct pci_dev *pdev,
struct flexcop_dma *dma, u32 size)
{ {
u8 *tcpu; u8 *tcpu;
dma_addr_t tdma = 0; dma_addr_t tdma = 0;
...@@ -32,7 +31,8 @@ EXPORT_SYMBOL(flexcop_dma_allocate); ...@@ -32,7 +31,8 @@ EXPORT_SYMBOL(flexcop_dma_allocate);
void flexcop_dma_free(struct flexcop_dma *dma) void flexcop_dma_free(struct flexcop_dma *dma)
{ {
pci_free_consistent(dma->pdev, dma->size*2,dma->cpu_addr0, dma->dma_addr0); pci_free_consistent(dma->pdev, dma->size*2,
dma->cpu_addr0, dma->dma_addr0);
memset(dma,0,sizeof(struct flexcop_dma)); memset(dma,0,sizeof(struct flexcop_dma));
} }
EXPORT_SYMBOL(flexcop_dma_free); EXPORT_SYMBOL(flexcop_dma_free);
...@@ -44,8 +44,8 @@ int flexcop_dma_config(struct flexcop_device *fc, ...@@ -44,8 +44,8 @@ int flexcop_dma_config(struct flexcop_device *fc,
flexcop_ibi_value v0x0,v0x4,v0xc; flexcop_ibi_value v0x0,v0x4,v0xc;
v0x0.raw = v0x4.raw = v0xc.raw = 0; v0x0.raw = v0x4.raw = v0xc.raw = 0;
v0x0.dma_0x0.dma_address0 = dma->dma_addr0 >> 2; v0x0.dma_0x0.dma_address0 = dma->dma_addr0 >> 2;
v0xc.dma_0xc.dma_address1 = dma->dma_addr1 >> 2; v0xc.dma_0xc.dma_address1 = dma->dma_addr1 >> 2;
v0x4.dma_0x4_write.dma_addr_size = dma->size / 4; v0x4.dma_0x4_write.dma_addr_size = dma->size / 4;
if ((dma_idx & FC_DMA_1) == dma_idx) { if ((dma_idx & FC_DMA_1) == dma_idx) {
...@@ -57,7 +57,8 @@ int flexcop_dma_config(struct flexcop_device *fc, ...@@ -57,7 +57,8 @@ int flexcop_dma_config(struct flexcop_device *fc,
fc->write_ibi_reg(fc,dma2_014,v0x4); fc->write_ibi_reg(fc,dma2_014,v0x4);
fc->write_ibi_reg(fc,dma2_01c,v0xc); fc->write_ibi_reg(fc,dma2_01c,v0xc);
} else { } else {
err("either DMA1 or DMA2 can be configured at the within one flexcop_dma_config call."); err("either DMA1 or DMA2 can be configured within one "
"flexcop_dma_config call.");
return -EINVAL; return -EINVAL;
} }
...@@ -81,7 +82,8 @@ int flexcop_dma_xfer_control(struct flexcop_device *fc, ...@@ -81,7 +82,8 @@ int flexcop_dma_xfer_control(struct flexcop_device *fc,
r0x0 = dma2_010; r0x0 = dma2_010;
r0xc = dma2_01c; r0xc = dma2_01c;
} else { } else {
err("either transfer DMA1 or DMA2 can be started within one flexcop_dma_xfer_control call."); err("either transfer DMA1 or DMA2 can be started within one "
"flexcop_dma_xfer_control call.");
return -EINVAL; return -EINVAL;
} }
...@@ -154,8 +156,7 @@ EXPORT_SYMBOL(flexcop_dma_control_timer_irq); ...@@ -154,8 +156,7 @@ EXPORT_SYMBOL(flexcop_dma_control_timer_irq);
/* 1 cycles = 1.97 msec */ /* 1 cycles = 1.97 msec */
int flexcop_dma_config_timer(struct flexcop_device *fc, int flexcop_dma_config_timer(struct flexcop_device *fc,
flexcop_dma_index_t dma_idx, flexcop_dma_index_t dma_idx, u8 cycles)
u8 cycles)
{ {
flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014; flexcop_ibi_register r = (dma_idx & FC_DMA_1) ? dma1_004 : dma2_014;
flexcop_ibi_value v = fc->read_ibi_reg(fc,r); flexcop_ibi_value v = fc->read_ibi_reg(fc,r);
......
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop-eeprom.c - eeprom access methods (currently only MAC address reading)
* flexcop-eeprom.c - eeprom access methods (currently only MAC address reading is used) * see flexcop.c for copyright information
*
* see flexcop.c for copyright information.
*/ */
#include "flexcop.h" #include "flexcop.h"
...@@ -14,17 +12,17 @@ static int eeprom_write(struct adapter *adapter, u16 addr, u8 *buf, u16 len) ...@@ -14,17 +12,17 @@ static int eeprom_write(struct adapter *adapter, u16 addr, u8 *buf, u16 len)
return flex_i2c_write(adapter, 0x20000000, 0x50, addr, buf, len); return flex_i2c_write(adapter, 0x20000000, 0x50, addr, buf, len);
} }
static int eeprom_lrc_write(struct adapter *adapter, u32 addr, u32 len, u8 *wbuf, u8 *rbuf, int retries) static int eeprom_lrc_write(struct adapter *adapter, u32 addr,
u32 len, u8 *wbuf, u8 *rbuf, int retries)
{ {
int i; int i;
for (i = 0; i < retries; i++) { for (i = 0; i < retries; i++) {
if (eeprom_write(adapter, addr, wbuf, len) == len) { if (eeprom_write(adapter, addr, wbuf, len) == len) {
if (eeprom_lrc_read(adapter, addr, len, rbuf, retries) == 1) if (eeprom_lrc_read(adapter, addr, len, rbuf, retries) == 1)
return 1; return 1;
} }
} }
return 0; return 0;
} }
...@@ -39,12 +37,10 @@ static int eeprom_writeKey(struct adapter *adapter, u8 *key, u32 len) ...@@ -39,12 +37,10 @@ static int eeprom_writeKey(struct adapter *adapter, u8 *key, u32 len)
return 0; return 0;
memcpy(wbuf, key, len); memcpy(wbuf, key, len);
wbuf[16] = 0; wbuf[16] = 0;
wbuf[17] = 0; wbuf[17] = 0;
wbuf[18] = 0; wbuf[18] = 0;
wbuf[19] = calc_lrc(wbuf, 19); wbuf[19] = calc_lrc(wbuf, 19);
return eeprom_lrc_write(adapter, 0x3e4, 20, wbuf, rbuf, 4); return eeprom_lrc_write(adapter, 0x3e4, 20, wbuf, rbuf, 4);
} }
...@@ -59,7 +55,6 @@ static int eeprom_readKey(struct adapter *adapter, u8 *key, u32 len) ...@@ -59,7 +55,6 @@ static int eeprom_readKey(struct adapter *adapter, u8 *key, u32 len)
return 0; return 0;
memcpy(key, buf, len); memcpy(key, buf, len);
return 1; return 1;
} }
...@@ -74,9 +69,7 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac) ...@@ -74,9 +69,7 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac)
tmp[3] = mac[5]; tmp[3] = mac[5];
tmp[4] = mac[6]; tmp[4] = mac[6];
tmp[5] = mac[7]; tmp[5] = mac[7];
} else { } else {
tmp[0] = mac[0]; tmp[0] = mac[0];
tmp[1] = mac[1]; tmp[1] = mac[1];
tmp[2] = mac[2]; tmp[2] = mac[2];
...@@ -90,11 +83,11 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac) ...@@ -90,11 +83,11 @@ static char eeprom_set_mac_addr(struct adapter *adapter, char type, u8 *mac)
if (eeprom_write(adapter, 0x3f8, tmp, 8) == 8) if (eeprom_write(adapter, 0x3f8, tmp, 8) == 8)
return 1; return 1;
return 0; return 0;
} }
static int flexcop_eeprom_read(struct flexcop_device *fc, u16 addr, u8 *buf, u16 len) static int flexcop_eeprom_read(struct flexcop_device *fc,
u16 addr, u8 *buf, u16 len)
{ {
return fc->i2c_request(fc,FC_READ,FC_I2C_PORT_EEPROM,0x50,addr,buf,len); return fc->i2c_request(fc,FC_READ,FC_I2C_PORT_EEPROM,0x50,addr,buf,len);
} }
...@@ -110,7 +103,8 @@ static u8 calc_lrc(u8 *buf, int len) ...@@ -110,7 +103,8 @@ static u8 calc_lrc(u8 *buf, int len)
return sum; return sum;
} }
static int flexcop_eeprom_request(struct flexcop_device *fc, flexcop_access_op_t op, u16 addr, u8 *buf, u16 len, int retries) static int flexcop_eeprom_request(struct flexcop_device *fc,
flexcop_access_op_t op, u16 addr, u8 *buf, u16 len, int retries)
{ {
int i,ret = 0; int i,ret = 0;
u8 chipaddr = 0x50 | ((addr >> 8) & 3); u8 chipaddr = 0x50 | ((addr >> 8) & 3);
...@@ -123,7 +117,8 @@ static int flexcop_eeprom_request(struct flexcop_device *fc, flexcop_access_op_t ...@@ -123,7 +117,8 @@ static int flexcop_eeprom_request(struct flexcop_device *fc, flexcop_access_op_t
return ret; return ret;
} }
static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf, u16 len, int retries) static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr,
u8 *buf, u16 len, int retries)
{ {
int ret = flexcop_eeprom_request(fc, FC_READ, addr, buf, len, retries); int ret = flexcop_eeprom_request(fc, FC_READ, addr, buf, len, retries);
if (ret == 0) if (ret == 0)
...@@ -133,8 +128,7 @@ static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf, ...@@ -133,8 +128,7 @@ static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf,
} }
/* JJ's comment about extended == 1: it is not presently used anywhere but was /* JJ's comment about extended == 1: it is not presently used anywhere but was
* added to the low-level functions for possible support of EUI64 * added to the low-level functions for possible support of EUI64 */
*/
int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended) int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended)
{ {
u8 buf[8]; u8 buf[8];
...@@ -142,12 +136,9 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended) ...@@ -142,12 +136,9 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended)
if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) { if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) {
if (extended != 0) { if (extended != 0) {
err("TODO: extended (EUI64) MAC addresses aren't completely supported yet"); err("TODO: extended (EUI64) MAC addresses aren't "
"completely supported yet");
ret = -EINVAL; ret = -EINVAL;
/* memcpy(fc->dvb_adapter.proposed_mac,buf,3);
mac[3] = 0xfe;
mac[4] = 0xff;
memcpy(&fc->dvb_adapter.proposed_mac[3],&buf[5],3); */
} else } else
memcpy(fc->dvb_adapter.proposed_mac,buf,6); memcpy(fc->dvb_adapter.proposed_mac,buf,6);
} }
......
...@@ -592,14 +592,14 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -592,14 +592,14 @@ int flexcop_frontend_init(struct flexcop_device *fc)
fc->fe_sleep = ops->sleep; fc->fe_sleep = ops->sleep;
ops->sleep = flexcop_sleep; ops->sleep = flexcop_sleep;
fc->dev_type = FC_SKY; fc->dev_type = FC_SKY_REV26;
goto fe_found; goto fe_found;
} }
/* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */ /* try the air dvb-t (mt352/Samsung tdtc9251dh0(??)) */
fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, i2c); fc->fe = dvb_attach(mt352_attach, &samsung_tdtc9251dh0_config, i2c);
if (fc->fe != NULL) { if (fc->fe != NULL) {
fc->dev_type = FC_AIR_DVB; fc->dev_type = FC_AIR_DVBT;
fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs; fc->fe->ops.tuner_ops.calc_regs = samsung_tdtc9251dh0_calc_regs;
goto fe_found; goto fe_found;
} }
...@@ -653,7 +653,7 @@ int flexcop_frontend_init(struct flexcop_device *fc) ...@@ -653,7 +653,7 @@ int flexcop_frontend_init(struct flexcop_device *fc)
fc->fe_sleep = ops->sleep; fc->fe_sleep = ops->sleep;
ops->sleep = flexcop_sleep; ops->sleep = flexcop_sleep;
fc->dev_type = FC_SKY_OLD; fc->dev_type = FC_SKY_REV23;
goto fe_found; goto fe_found;
} }
......
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop-hw-filter.c - pid and mac address filtering and control functions
* flexcop-hw-filter.c - pid and mac address filtering and corresponding control functions. * see flexcop.c for copyright information
*
* see flexcop.c for copyright information.
*/ */
#include "flexcop.h" #include "flexcop.h"
static void flexcop_rcv_data_ctrl(struct flexcop_device *fc, int onoff) static void flexcop_rcv_data_ctrl(struct flexcop_device *fc, int onoff)
{ {
flexcop_set_ibi_value(ctrl_208,Rcv_Data_sig,onoff); flexcop_set_ibi_value(ctrl_208, Rcv_Data_sig, onoff);
deb_ts("rcv_data is now: '%s'\n", onoff ? "on" : "off");
deb_ts("rcv_data is now: '%s'\n",onoff ? "on" : "off");
} }
void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff) void flexcop_smc_ctrl(struct flexcop_device *fc, int onoff)
{ {
flexcop_set_ibi_value(ctrl_208,SMC_Enable_sig,onoff); flexcop_set_ibi_value(ctrl_208, SMC_Enable_sig, onoff);
} }
static void flexcop_null_filter_ctrl(struct flexcop_device *fc, int onoff) static void flexcop_null_filter_ctrl(struct flexcop_device *fc, int onoff)
{ {
flexcop_set_ibi_value(ctrl_208,Null_filter_sig,onoff); flexcop_set_ibi_value(ctrl_208, Null_filter_sig, onoff);
} }
void flexcop_set_mac_filter(struct flexcop_device *fc, u8 mac[6]) void flexcop_set_mac_filter(struct flexcop_device *fc, u8 mac[6])
{ {
flexcop_ibi_value v418,v41c; flexcop_ibi_value v418, v41c;
v41c = fc->read_ibi_reg(fc,mac_address_41c); v41c = fc->read_ibi_reg(fc, mac_address_41c);
v418.mac_address_418.MAC1 = mac[0]; v418.mac_address_418.MAC1 = mac[0];
v418.mac_address_418.MAC2 = mac[1]; v418.mac_address_418.MAC2 = mac[1];
...@@ -36,27 +33,28 @@ void flexcop_set_mac_filter(struct flexcop_device *fc, u8 mac[6]) ...@@ -36,27 +33,28 @@ void flexcop_set_mac_filter(struct flexcop_device *fc, u8 mac[6])
v41c.mac_address_41c.MAC7 = mac[4]; v41c.mac_address_41c.MAC7 = mac[4];
v41c.mac_address_41c.MAC8 = mac[5]; v41c.mac_address_41c.MAC8 = mac[5];
fc->write_ibi_reg(fc,mac_address_418,v418); fc->write_ibi_reg(fc, mac_address_418, v418);
fc->write_ibi_reg(fc,mac_address_41c,v41c); fc->write_ibi_reg(fc, mac_address_41c, v41c);
} }
void flexcop_mac_filter_ctrl(struct flexcop_device *fc, int onoff) void flexcop_mac_filter_ctrl(struct flexcop_device *fc, int onoff)
{ {
flexcop_set_ibi_value(ctrl_208,MAC_filter_Mode_sig,onoff); flexcop_set_ibi_value(ctrl_208, MAC_filter_Mode_sig, onoff);
} }
static void flexcop_pid_group_filter(struct flexcop_device *fc, u16 pid, u16 mask) static void flexcop_pid_group_filter(struct flexcop_device *fc,
u16 pid, u16 mask)
{ {
/* index_reg_310.extra_index_reg need to 0 or 7 to work */ /* index_reg_310.extra_index_reg need to 0 or 7 to work */
flexcop_ibi_value v30c; flexcop_ibi_value v30c;
v30c.pid_filter_30c_ext_ind_0_7.Group_PID = pid; v30c.pid_filter_30c_ext_ind_0_7.Group_PID = pid;
v30c.pid_filter_30c_ext_ind_0_7.Group_mask = mask; v30c.pid_filter_30c_ext_ind_0_7.Group_mask = mask;
fc->write_ibi_reg(fc,pid_filter_30c,v30c); fc->write_ibi_reg(fc, pid_filter_30c, v30c);
} }
static void flexcop_pid_group_filter_ctrl(struct flexcop_device *fc, int onoff) static void flexcop_pid_group_filter_ctrl(struct flexcop_device *fc, int onoff)
{ {
flexcop_set_ibi_value(ctrl_208,Mask_filter_sig,onoff); flexcop_set_ibi_value(ctrl_208, Mask_filter_sig, onoff);
} }
/* this fancy define reduces the code size of the quite similar PID controlling of /* this fancy define reduces the code size of the quite similar PID controlling of
...@@ -65,91 +63,112 @@ static void flexcop_pid_group_filter_ctrl(struct flexcop_device *fc, int onoff) ...@@ -65,91 +63,112 @@ static void flexcop_pid_group_filter_ctrl(struct flexcop_device *fc, int onoff)
#define pid_ctrl(vregname,field,enablefield,trans_field,transval) \ #define pid_ctrl(vregname,field,enablefield,trans_field,transval) \
flexcop_ibi_value vpid = fc->read_ibi_reg(fc, vregname), \ flexcop_ibi_value vpid = fc->read_ibi_reg(fc, vregname), \
v208 = fc->read_ibi_reg(fc, ctrl_208); \ v208 = fc->read_ibi_reg(fc, ctrl_208); \
\ vpid.vregname.field = onoff ? pid : 0x1fff; \
vpid.vregname.field = onoff ? pid : 0x1fff; \ vpid.vregname.trans_field = transval; \
vpid.vregname.trans_field = transval; \ v208.ctrl_208.enablefield = onoff; \
v208.ctrl_208.enablefield = onoff; \ fc->write_ibi_reg(fc, vregname, vpid); \
\ fc->write_ibi_reg(fc, ctrl_208, v208);
fc->write_ibi_reg(fc,vregname,vpid); \
fc->write_ibi_reg(fc,ctrl_208,v208);
static void flexcop_pid_Stream1_PID_ctrl(struct flexcop_device *fc, u16 pid, int onoff) static void flexcop_pid_Stream1_PID_ctrl(struct flexcop_device *fc,
u16 pid, int onoff)
{ {
pid_ctrl(pid_filter_300,Stream1_PID,Stream1_filter_sig,Stream1_trans,0); pid_ctrl(pid_filter_300, Stream1_PID, Stream1_filter_sig,
Stream1_trans, 0);
} }
static void flexcop_pid_Stream2_PID_ctrl(struct flexcop_device *fc, u16 pid, int onoff) static void flexcop_pid_Stream2_PID_ctrl(struct flexcop_device *fc,
u16 pid, int onoff)
{ {
pid_ctrl(pid_filter_300,Stream2_PID,Stream2_filter_sig,Stream2_trans,0); pid_ctrl(pid_filter_300, Stream2_PID, Stream2_filter_sig,
Stream2_trans, 0);
} }
static void flexcop_pid_PCR_PID_ctrl(struct flexcop_device *fc, u16 pid, int onoff) static void flexcop_pid_PCR_PID_ctrl(struct flexcop_device *fc,
u16 pid, int onoff)
{ {
pid_ctrl(pid_filter_304,PCR_PID,PCR_filter_sig,PCR_trans,0); pid_ctrl(pid_filter_304, PCR_PID, PCR_filter_sig, PCR_trans, 0);
} }
static void flexcop_pid_PMT_PID_ctrl(struct flexcop_device *fc, u16 pid, int onoff) static void flexcop_pid_PMT_PID_ctrl(struct flexcop_device *fc,
u16 pid, int onoff)
{ {
pid_ctrl(pid_filter_304,PMT_PID,PMT_filter_sig,PMT_trans,0); pid_ctrl(pid_filter_304, PMT_PID, PMT_filter_sig, PMT_trans, 0);
} }
static void flexcop_pid_EMM_PID_ctrl(struct flexcop_device *fc, u16 pid, int onoff) static void flexcop_pid_EMM_PID_ctrl(struct flexcop_device *fc,
u16 pid, int onoff)
{ {
pid_ctrl(pid_filter_308,EMM_PID,EMM_filter_sig,EMM_trans,0); pid_ctrl(pid_filter_308, EMM_PID, EMM_filter_sig, EMM_trans, 0);
} }
static void flexcop_pid_ECM_PID_ctrl(struct flexcop_device *fc, u16 pid, int onoff) static void flexcop_pid_ECM_PID_ctrl(struct flexcop_device *fc,
u16 pid, int onoff)
{ {
pid_ctrl(pid_filter_308,ECM_PID,ECM_filter_sig,ECM_trans,0); pid_ctrl(pid_filter_308, ECM_PID, ECM_filter_sig, ECM_trans, 0);
} }
static void flexcop_pid_control(struct flexcop_device *fc, int index, u16 pid,int onoff) static void flexcop_pid_control(struct flexcop_device *fc,
int index, u16 pid, int onoff)
{ {
if (pid == 0x2000) if (pid == 0x2000)
return; return;
deb_ts("setting pid: %5d %04x at index %d '%s'\n",pid,pid,index,onoff ? "on" : "off"); deb_ts("setting pid: %5d %04x at index %d '%s'\n",
pid, pid, index, onoff ? "on" : "off");
/* We could use bit magic here to reduce source code size. /* We could use bit magic here to reduce source code size.
* I decided against it, but to use the real register names */ * I decided against it, but to use the real register names */
switch (index) { switch (index) {
case 0: flexcop_pid_Stream1_PID_ctrl(fc,pid,onoff); break; case 0:
case 1: flexcop_pid_Stream2_PID_ctrl(fc,pid,onoff); break; flexcop_pid_Stream1_PID_ctrl(fc, pid, onoff);
case 2: flexcop_pid_PCR_PID_ctrl(fc,pid,onoff); break; break;
case 3: flexcop_pid_PMT_PID_ctrl(fc,pid,onoff); break; case 1:
case 4: flexcop_pid_EMM_PID_ctrl(fc,pid,onoff); break; flexcop_pid_Stream2_PID_ctrl(fc, pid, onoff);
case 5: flexcop_pid_ECM_PID_ctrl(fc,pid,onoff); break; break;
default: case 2:
if (fc->has_32_hw_pid_filter && index < 38) { flexcop_pid_PCR_PID_ctrl(fc, pid, onoff);
flexcop_ibi_value vpid,vid; break;
case 3:
/* set the index */ flexcop_pid_PMT_PID_ctrl(fc, pid, onoff);
vid = fc->read_ibi_reg(fc,index_reg_310); break;
vid.index_reg_310.index_reg = index - 6; case 4:
fc->write_ibi_reg(fc,index_reg_310, vid); flexcop_pid_EMM_PID_ctrl(fc, pid, onoff);
break;
vpid = fc->read_ibi_reg(fc,pid_n_reg_314); case 5:
vpid.pid_n_reg_314.PID = onoff ? pid : 0x1fff; flexcop_pid_ECM_PID_ctrl(fc, pid, onoff);
vpid.pid_n_reg_314.PID_enable_bit = onoff; break;
fc->write_ibi_reg(fc,pid_n_reg_314, vpid); default:
} if (fc->has_32_hw_pid_filter && index < 38) {
break; flexcop_ibi_value vpid, vid;
/* set the index */
vid = fc->read_ibi_reg(fc, index_reg_310);
vid.index_reg_310.index_reg = index - 6;
fc->write_ibi_reg(fc, index_reg_310, vid);
vpid = fc->read_ibi_reg(fc, pid_n_reg_314);
vpid.pid_n_reg_314.PID = onoff ? pid : 0x1fff;
vpid.pid_n_reg_314.PID_enable_bit = onoff;
fc->write_ibi_reg(fc, pid_n_reg_314, vpid);
}
break;
} }
} }
static int flexcop_toggle_fullts_streaming(struct flexcop_device *fc,int onoff) static int flexcop_toggle_fullts_streaming(struct flexcop_device *fc, int onoff)
{ {
if (fc->fullts_streaming_state != onoff) { if (fc->fullts_streaming_state != onoff) {
deb_ts("%s full TS transfer\n",onoff ? "enabling" : "disabling"); deb_ts("%s full TS transfer\n",onoff ? "enabling" : "disabling");
flexcop_pid_group_filter(fc, 0, 0x1fe0 * (!onoff)); flexcop_pid_group_filter(fc, 0, 0x1fe0 * (!onoff));
flexcop_pid_group_filter_ctrl(fc,onoff); flexcop_pid_group_filter_ctrl(fc, onoff);
fc->fullts_streaming_state = onoff; fc->fullts_streaming_state = onoff;
} }
return 0; return 0;
} }
int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *dvbdmxfeed, int onoff) int flexcop_pid_feed_control(struct flexcop_device *fc,
struct dvb_demux_feed *dvbdmxfeed, int onoff)
{ {
int max_pid_filter = 6 + fc->has_32_hw_pid_filter*32; int max_pid_filter = 6 + fc->has_32_hw_pid_filter*32;
...@@ -164,24 +183,25 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d ...@@ -164,24 +183,25 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d
* - or the requested pid is 0x2000 */ * - or the requested pid is 0x2000 */
if (!fc->pid_filtering && fc->feedcount == onoff) if (!fc->pid_filtering && fc->feedcount == onoff)
flexcop_toggle_fullts_streaming(fc,onoff); flexcop_toggle_fullts_streaming(fc, onoff);
if (fc->pid_filtering) { if (fc->pid_filtering) {
flexcop_pid_control(fc,dvbdmxfeed->index,dvbdmxfeed->pid,onoff); flexcop_pid_control \
(fc, dvbdmxfeed->index, dvbdmxfeed->pid, onoff);
if (fc->extra_feedcount > 0) if (fc->extra_feedcount > 0)
flexcop_toggle_fullts_streaming(fc,1); flexcop_toggle_fullts_streaming(fc, 1);
else if (dvbdmxfeed->pid == 0x2000) else if (dvbdmxfeed->pid == 0x2000)
flexcop_toggle_fullts_streaming(fc,onoff); flexcop_toggle_fullts_streaming(fc, onoff);
else else
flexcop_toggle_fullts_streaming(fc,0); flexcop_toggle_fullts_streaming(fc, 0);
} }
/* if it was the first or last feed request change the stream-status */ /* if it was the first or last feed request change the stream-status */
if (fc->feedcount == onoff) { if (fc->feedcount == onoff) {
flexcop_rcv_data_ctrl(fc,onoff); flexcop_rcv_data_ctrl(fc, onoff);
if (fc->stream_control) /* device specific stream control */ if (fc->stream_control) /* device specific stream control */
fc->stream_control(fc,onoff); fc->stream_control(fc, onoff);
/* feeding stopped -> reset the flexcop filter*/ /* feeding stopped -> reset the flexcop filter*/
if (onoff == 0) { if (onoff == 0) {
...@@ -189,7 +209,6 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d ...@@ -189,7 +209,6 @@ int flexcop_pid_feed_control(struct flexcop_device *fc, struct dvb_demux_feed *d
flexcop_hw_filter_init(fc); flexcop_hw_filter_init(fc);
} }
} }
return 0; return 0;
} }
EXPORT_SYMBOL(flexcop_pid_feed_control); EXPORT_SYMBOL(flexcop_pid_feed_control);
...@@ -199,15 +218,15 @@ void flexcop_hw_filter_init(struct flexcop_device *fc) ...@@ -199,15 +218,15 @@ void flexcop_hw_filter_init(struct flexcop_device *fc)
int i; int i;
flexcop_ibi_value v; flexcop_ibi_value v;
for (i = 0; i < 6 + 32*fc->has_32_hw_pid_filter; i++) for (i = 0; i < 6 + 32*fc->has_32_hw_pid_filter; i++)
flexcop_pid_control(fc,i,0x1fff,0); flexcop_pid_control(fc, i, 0x1fff, 0);
flexcop_pid_group_filter(fc, 0, 0x1fe0); flexcop_pid_group_filter(fc, 0, 0x1fe0);
flexcop_pid_group_filter_ctrl(fc,0); flexcop_pid_group_filter_ctrl(fc, 0);
v = fc->read_ibi_reg(fc,pid_filter_308); v = fc->read_ibi_reg(fc, pid_filter_308);
v.pid_filter_308.EMM_filter_4 = 1; v.pid_filter_308.EMM_filter_4 = 1;
v.pid_filter_308.EMM_filter_6 = 0; v.pid_filter_308.EMM_filter_6 = 0;
fc->write_ibi_reg(fc,pid_filter_308,v); fc->write_ibi_reg(fc, pid_filter_308, v);
flexcop_null_filter_ctrl(fc, 1); flexcop_null_filter_ctrl(fc, 1);
} }
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* flexcop-i2c.c - flexcop internal 2Wire bus (I2C) and dvb i2c initialization * flexcop-i2c.c - flexcop internal 2Wire bus (I2C) and dvb i2c initialization
* * see flexcop.c for copyright information
* see flexcop.c for copyright information.
*/ */
#include "flexcop.h" #include "flexcop.h"
#define FC_MAX_I2C_RETRIES 100000 #define FC_MAX_I2C_RETRIES 100000
/* #define DUMP_I2C_MESSAGES */ static int flexcop_i2c_operation(struct flexcop_device *fc,
flexcop_ibi_value *r100)
static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r100)
{ {
int i; int i;
flexcop_ibi_value r; flexcop_ibi_value r;
...@@ -26,7 +23,7 @@ static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r ...@@ -26,7 +23,7 @@ static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r
r = fc->read_ibi_reg(fc, tw_sm_c_100); r = fc->read_ibi_reg(fc, tw_sm_c_100);
if (!r.tw_sm_c_100.no_base_addr_ack_error) { if (!r.tw_sm_c_100.no_base_addr_ack_error) {
if (r.tw_sm_c_100.st_done) { /* && !r.tw_sm_c_100.working_start */ if (r.tw_sm_c_100.st_done) {
*r100 = r; *r100 = r;
deb_i2c("i2c success\n"); deb_i2c("i2c success\n");
return 0; return 0;
...@@ -36,15 +33,17 @@ static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r ...@@ -36,15 +33,17 @@ static int flexcop_i2c_operation(struct flexcop_device *fc, flexcop_ibi_value *r
return -EREMOTEIO; return -EREMOTEIO;
} }
} }
deb_i2c("tried %d times i2c operation, never finished or too many ack errors.\n",i); deb_i2c("tried %d times i2c operation, "
"never finished or too many ack errors.\n", i);
return -EREMOTEIO; return -EREMOTEIO;
} }
static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c, static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c,
flexcop_ibi_value r100, u8 *buf) flexcop_ibi_value r100, u8 *buf)
{ {
flexcop_ibi_value r104; flexcop_ibi_value r104;
int len = r100.tw_sm_c_100.total_bytes, /* remember total_bytes is buflen-1 */ int len = r100.tw_sm_c_100.total_bytes,
/* remember total_bytes is buflen-1 */
ret; ret;
/* work-around to have CableStar2 and SkyStar2 rev 2.7 work /* work-around to have CableStar2 and SkyStar2 rev 2.7 work
...@@ -81,11 +80,11 @@ static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c, ...@@ -81,11 +80,11 @@ static int flexcop_i2c_read4(struct flexcop_i2c_adapter *i2c,
if (len > 1) buf[2] = r104.tw_sm_c_104.data3_reg; if (len > 1) buf[2] = r104.tw_sm_c_104.data3_reg;
if (len > 2) buf[3] = r104.tw_sm_c_104.data4_reg; if (len > 2) buf[3] = r104.tw_sm_c_104.data4_reg;
} }
return 0; return 0;
} }
static int flexcop_i2c_write4(struct flexcop_device *fc, flexcop_ibi_value r100, u8 *buf) static int flexcop_i2c_write4(struct flexcop_device *fc,
flexcop_ibi_value r100, u8 *buf)
{ {
flexcop_ibi_value r104; flexcop_ibi_value r104;
int len = r100.tw_sm_c_100.total_bytes; /* remember total_bytes is buflen-1 */ int len = r100.tw_sm_c_100.total_bytes; /* remember total_bytes is buflen-1 */
...@@ -93,7 +92,6 @@ static int flexcop_i2c_write4(struct flexcop_device *fc, flexcop_ibi_value r100, ...@@ -93,7 +92,6 @@ static int flexcop_i2c_write4(struct flexcop_device *fc, flexcop_ibi_value r100,
/* there is at least one byte, otherwise we wouldn't be here */ /* there is at least one byte, otherwise we wouldn't be here */
r100.tw_sm_c_100.data1_reg = buf[0]; r100.tw_sm_c_100.data1_reg = buf[0];
r104.tw_sm_c_104.data2_reg = len > 0 ? buf[1] : 0; r104.tw_sm_c_104.data2_reg = len > 0 ? buf[1] : 0;
r104.tw_sm_c_104.data3_reg = len > 1 ? buf[2] : 0; r104.tw_sm_c_104.data3_reg = len > 1 ? buf[2] : 0;
r104.tw_sm_c_104.data4_reg = len > 2 ? buf[3] : 0; r104.tw_sm_c_104.data4_reg = len > 2 ? buf[3] : 0;
...@@ -106,7 +104,7 @@ static int flexcop_i2c_write4(struct flexcop_device *fc, flexcop_ibi_value r100, ...@@ -106,7 +104,7 @@ static int flexcop_i2c_write4(struct flexcop_device *fc, flexcop_ibi_value r100,
} }
int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c, int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len) flexcop_access_op_t op, u8 chipaddr, u8 addr, u8 *buf, u16 len)
{ {
int ret; int ret;
...@@ -129,7 +127,6 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c, ...@@ -129,7 +127,6 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
printk("rd("); printk("rd(");
else else
printk("wr("); printk("wr(");
printk("%02x): %02x ", chipaddr, addr); printk("%02x): %02x ", chipaddr, addr);
#endif #endif
...@@ -175,7 +172,8 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c, ...@@ -175,7 +172,8 @@ int flexcop_i2c_request(struct flexcop_i2c_adapter *i2c,
EXPORT_SYMBOL(flexcop_i2c_request); EXPORT_SYMBOL(flexcop_i2c_request);
/* master xfer callback for demodulator */ /* master xfer callback for demodulator */
static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs[], int num) static int flexcop_master_xfer(struct i2c_adapter *i2c_adap,
struct i2c_msg msgs[], int num)
{ {
struct flexcop_i2c_adapter *i2c = i2c_get_adapdata(i2c_adap); struct flexcop_i2c_adapter *i2c = i2c_get_adapdata(i2c_adap);
int i, ret = 0; int i, ret = 0;
...@@ -194,12 +192,13 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs ...@@ -194,12 +192,13 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
/* reading */ /* reading */
if (i+1 < num && (msgs[i+1].flags == I2C_M_RD)) { if (i+1 < num && (msgs[i+1].flags == I2C_M_RD)) {
ret = i2c->fc->i2c_request(i2c, FC_READ, msgs[i].addr, ret = i2c->fc->i2c_request(i2c, FC_READ, msgs[i].addr,
msgs[i].buf[0], msgs[i+1].buf, msgs[i+1].len); msgs[i].buf[0], msgs[i+1].buf,
msgs[i+1].len);
i++; /* skip the following message */ i++; /* skip the following message */
} else /* writing */ } else /* writing */
ret = i2c->fc->i2c_request(i2c, FC_WRITE, msgs[i].addr, ret = i2c->fc->i2c_request(i2c, FC_WRITE, msgs[i].addr,
msgs[i].buf[0], &msgs[i].buf[1], msgs[i].buf[0], &msgs[i].buf[1],
msgs[i].len - 1); msgs[i].len - 1);
if (ret < 0) { if (ret < 0) {
err("i2c master_xfer failed"); err("i2c master_xfer failed");
break; break;
...@@ -226,23 +225,21 @@ static struct i2c_algorithm flexcop_algo = { ...@@ -226,23 +225,21 @@ static struct i2c_algorithm flexcop_algo = {
int flexcop_i2c_init(struct flexcop_device *fc) int flexcop_i2c_init(struct flexcop_device *fc)
{ {
int ret; int ret;
mutex_init(&fc->i2c_mutex); mutex_init(&fc->i2c_mutex);
fc->fc_i2c_adap[0].fc = fc; fc->fc_i2c_adap[0].fc = fc;
fc->fc_i2c_adap[1].fc = fc; fc->fc_i2c_adap[1].fc = fc;
fc->fc_i2c_adap[2].fc = fc; fc->fc_i2c_adap[2].fc = fc;
fc->fc_i2c_adap[0].port = FC_I2C_PORT_DEMOD; fc->fc_i2c_adap[0].port = FC_I2C_PORT_DEMOD;
fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM; fc->fc_i2c_adap[1].port = FC_I2C_PORT_EEPROM;
fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER; fc->fc_i2c_adap[2].port = FC_I2C_PORT_TUNER;
strlcpy(fc->fc_i2c_adap[0].i2c_adap.name, "B2C2 FlexCop I2C to demod", strlcpy(fc->fc_i2c_adap[0].i2c_adap.name, "B2C2 FlexCop I2C to demod",
sizeof(fc->fc_i2c_adap[0].i2c_adap.name)); sizeof(fc->fc_i2c_adap[0].i2c_adap.name));
strlcpy(fc->fc_i2c_adap[1].i2c_adap.name, "B2C2 FlexCop I2C to eeprom", strlcpy(fc->fc_i2c_adap[1].i2c_adap.name, "B2C2 FlexCop I2C to eeprom",
sizeof(fc->fc_i2c_adap[1].i2c_adap.name)); sizeof(fc->fc_i2c_adap[1].i2c_adap.name));
strlcpy(fc->fc_i2c_adap[2].i2c_adap.name, "B2C2 FlexCop I2C to tuner", strlcpy(fc->fc_i2c_adap[2].i2c_adap.name, "B2C2 FlexCop I2C to tuner",
sizeof(fc->fc_i2c_adap[2].i2c_adap.name)); sizeof(fc->fc_i2c_adap[2].i2c_adap.name));
i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]); i2c_set_adapdata(&fc->fc_i2c_adap[0].i2c_adap, &fc->fc_i2c_adap[0]);
i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]); i2c_set_adapdata(&fc->fc_i2c_adap[1].i2c_adap, &fc->fc_i2c_adap[1]);
...@@ -280,7 +277,6 @@ int flexcop_i2c_init(struct flexcop_device *fc) ...@@ -280,7 +277,6 @@ int flexcop_i2c_init(struct flexcop_device *fc)
i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap);
adap_1_failed: adap_1_failed:
i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap);
return ret; return ret;
} }
...@@ -291,6 +287,5 @@ void flexcop_i2c_exit(struct flexcop_device *fc) ...@@ -291,6 +287,5 @@ void flexcop_i2c_exit(struct flexcop_device *fc)
i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap); i2c_del_adapter(&fc->fc_i2c_adap[1].i2c_adap);
i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap); i2c_del_adapter(&fc->fc_i2c_adap[0].i2c_adap);
} }
fc->init_state &= ~FC_STATE_I2C_INIT; fc->init_state &= ~FC_STATE_I2C_INIT;
} }
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop-misc.c - miscellaneous functions
* flexcop-misc.c - miscellaneous functions. * see flexcop.c for copyright information
*
* see flexcop.c for copyright information.
*/ */
#include "flexcop.h" #include "flexcop.h"
...@@ -12,39 +10,43 @@ void flexcop_determine_revision(struct flexcop_device *fc) ...@@ -12,39 +10,43 @@ void flexcop_determine_revision(struct flexcop_device *fc)
flexcop_ibi_value v = fc->read_ibi_reg(fc,misc_204); flexcop_ibi_value v = fc->read_ibi_reg(fc,misc_204);
switch (v.misc_204.Rev_N_sig_revision_hi) { switch (v.misc_204.Rev_N_sig_revision_hi) {
case 0x2: case 0x2:
deb_info("found a FlexCopII.\n"); deb_info("found a FlexCopII.\n");
fc->rev = FLEXCOP_II; fc->rev = FLEXCOP_II;
break; break;
case 0x3: case 0x3:
deb_info("found a FlexCopIIb.\n"); deb_info("found a FlexCopIIb.\n");
fc->rev = FLEXCOP_IIB; fc->rev = FLEXCOP_IIB;
break; break;
case 0x0: case 0x0:
deb_info("found a FlexCopIII.\n"); deb_info("found a FlexCopIII.\n");
fc->rev = FLEXCOP_III; fc->rev = FLEXCOP_III;
break; break;
default: default:
err("unkown FlexCop Revision: %x. Please report the linux-dvb@linuxtv.org.",v.misc_204.Rev_N_sig_revision_hi); err("unknown FlexCop Revision: %x. Please report this to "
break; "linux-dvb@linuxtv.org.",
v.misc_204.Rev_N_sig_revision_hi);
break;
} }
if ((fc->has_32_hw_pid_filter = v.misc_204.Rev_N_sig_caps)) if ((fc->has_32_hw_pid_filter = v.misc_204.Rev_N_sig_caps))
deb_info("this FlexCop has the additional 32 hardware pid filter.\n"); deb_info("this FlexCop has "
"the additional 32 hardware pid filter.\n");
else else
deb_info("this FlexCop has only the 6 basic main hardware pid filter.\n"); deb_info("this FlexCop has "
"the 6 basic main hardware pid filter.\n");
/* bus parts have to decide if hw pid filtering is used or not. */ /* bus parts have to decide if hw pid filtering is used or not. */
} }
static const char *flexcop_revision_names[] = { static const char *flexcop_revision_names[] = {
"Unkown chip", "Unknown chip",
"FlexCopII", "FlexCopII",
"FlexCopIIb", "FlexCopIIb",
"FlexCopIII", "FlexCopIII",
}; };
static const char *flexcop_device_names[] = { static const char *flexcop_device_names[] = {
"Unkown device", "Unknown device",
"Air2PC/AirStar 2 DVB-T", "Air2PC/AirStar 2 DVB-T",
"Air2PC/AirStar 2 ATSC 1st generation", "Air2PC/AirStar 2 ATSC 1st generation",
"Air2PC/AirStar 2 ATSC 2nd generation", "Air2PC/AirStar 2 ATSC 2nd generation",
...@@ -61,21 +63,23 @@ static const char *flexcop_bus_names[] = { ...@@ -61,21 +63,23 @@ static const char *flexcop_bus_names[] = {
"PCI", "PCI",
}; };
void flexcop_device_name(struct flexcop_device *fc,const char *prefix,const void flexcop_device_name(struct flexcop_device *fc,
char *suffix) const char *prefix, const char *suffix)
{ {
info("%s '%s' at the '%s' bus controlled by a '%s' %s",prefix, info("%s '%s' at the '%s' bus controlled by a '%s' %s",
flexcop_device_names[fc->dev_type],flexcop_bus_names[fc->bus_type], prefix, flexcop_device_names[fc->dev_type],
flexcop_revision_names[fc->rev],suffix); flexcop_bus_names[fc->bus_type],
flexcop_revision_names[fc->rev], suffix);
} }
void flexcop_dump_reg(struct flexcop_device *fc, flexcop_ibi_register reg, int num) void flexcop_dump_reg(struct flexcop_device *fc,
flexcop_ibi_register reg, int num)
{ {
flexcop_ibi_value v; flexcop_ibi_value v;
int i; int i;
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
v = fc->read_ibi_reg(fc,reg+4*i); v = fc->read_ibi_reg(fc, reg+4*i);
deb_rdump("0x%03x: %08x, ",reg+4*i, v.raw); deb_rdump("0x%03x: %08x, ", reg+4*i, v.raw);
} }
deb_rdump("\n"); deb_rdump("\n");
} }
......
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* flexcop-reg.h - register abstraction for FlexCopII, FlexCopIIb and FlexCopIII * flexcop-reg.h - register abstraction for FlexCopII, FlexCopIIb and FlexCopIII
* * see flexcop.c for copyright information
* see flexcop.c for copyright information.
*/ */
#ifndef __FLEXCOP_REG_H__ #ifndef __FLEXCOP_REG_H__
#define __FLEXCOP_REG_H__ #define __FLEXCOP_REG_H__
typedef enum { typedef enum {
FLEXCOP_UNK = 0, FLEXCOP_UNK = 0,
FLEXCOP_II, FLEXCOP_II,
...@@ -18,13 +15,13 @@ typedef enum { ...@@ -18,13 +15,13 @@ typedef enum {
typedef enum { typedef enum {
FC_UNK = 0, FC_UNK = 0,
FC_AIR_DVB, FC_CABLE,
FC_AIR_DVBT,
FC_AIR_ATSC1, FC_AIR_ATSC1,
FC_AIR_ATSC2, FC_AIR_ATSC2,
FC_SKY,
FC_SKY_OLD,
FC_CABLE,
FC_AIR_ATSC3, FC_AIR_ATSC3,
FC_SKY_REV23,
FC_SKY_REV26,
FC_SKY_REV27, FC_SKY_REV27,
FC_SKY_REV28, FC_SKY_REV28,
} flexcop_device_type_t; } flexcop_device_type_t;
...@@ -36,12 +33,12 @@ typedef enum { ...@@ -36,12 +33,12 @@ typedef enum {
/* FlexCop IBI Registers */ /* FlexCop IBI Registers */
#if defined(__LITTLE_ENDIAN) #if defined(__LITTLE_ENDIAN)
#include "flexcop_ibi_value_le.h" #include "flexcop_ibi_value_le.h"
#else #else
#if defined(__BIG_ENDIAN) #if defined(__BIG_ENDIAN)
#include "flexcop_ibi_value_be.h" #include "flexcop_ibi_value_be.h"
#else #else
#error no endian defined #error no endian defined
#endif #endif
#endif #endif
......
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop-sram.c - functions for controlling the SRAM
* flexcop-sram.c - functions for controlling the SRAM. * see flexcop.c for copyright information
*
* see flexcop.c for copyright information.
*/ */
#include "flexcop.h" #include "flexcop.h"
static void flexcop_sram_set_chip (struct flexcop_device *fc, flexcop_sram_type_t type) static void flexcop_sram_set_chip(struct flexcop_device *fc,
flexcop_sram_type_t type)
{ {
flexcop_set_ibi_value(wan_ctrl_reg_71c,sram_chip,type); flexcop_set_ibi_value(wan_ctrl_reg_71c, sram_chip, type);
} }
int flexcop_sram_init(struct flexcop_device *fc) int flexcop_sram_init(struct flexcop_device *fc)
{ {
switch (fc->rev) { switch (fc->rev) {
case FLEXCOP_II: case FLEXCOP_II:
case FLEXCOP_IIB: case FLEXCOP_IIB:
flexcop_sram_set_chip(fc,FC_SRAM_1_32KB); flexcop_sram_set_chip(fc, FC_SRAM_1_32KB);
break; break;
case FLEXCOP_III: case FLEXCOP_III:
flexcop_sram_set_chip(fc,FC_SRAM_1_48KB); flexcop_sram_set_chip(fc, FC_SRAM_1_48KB);
break; break;
default: default:
return -EINVAL; return -EINVAL;
} }
return 0; return 0;
} }
int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest, flexcop_sram_dest_target_t target) int flexcop_sram_set_dest(struct flexcop_device *fc, flexcop_sram_dest_t dest,
flexcop_sram_dest_target_t target)
{ {
flexcop_ibi_value v; flexcop_ibi_value v;
v = fc->read_ibi_reg(fc, sram_dest_reg_714);
v = fc->read_ibi_reg(fc,sram_dest_reg_714);
if (fc->rev != FLEXCOP_III && target == FC_SRAM_DEST_TARGET_FC3_CA) { if (fc->rev != FLEXCOP_III && target == FC_SRAM_DEST_TARGET_FC3_CA) {
err("SRAM destination target to available on FlexCopII(b)\n"); err("SRAM destination target to available on FlexCopII(b)\n");
return -EINVAL; return -EINVAL;
} }
deb_sram("sram dest: %x target: %x\n", dest, target);
deb_sram("sram dest: %x target: %x\n",dest, target);
if (dest & FC_SRAM_DEST_NET) if (dest & FC_SRAM_DEST_NET)
v.sram_dest_reg_714.NET_Dest = target; v.sram_dest_reg_714.NET_Dest = target;
...@@ -154,14 +152,12 @@ static void sram_write_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len ...@@ -154,14 +152,12 @@ static void sram_write_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len
else else
bank = 0x10000000; bank = 0x10000000;
} }
flex_sram_write(adapter, bank, addr & 0x7fff, buf, len); flex_sram_write(adapter, bank, addr & 0x7fff, buf, len);
} }
static void sram_read_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len) static void sram_read_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len)
{ {
u32 bank; u32 bank;
bank = 0; bank = 0;
if (adapter->dw_sram_type == 0x20000) { if (adapter->dw_sram_type == 0x20000) {
...@@ -174,26 +170,22 @@ static void sram_read_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len) ...@@ -174,26 +170,22 @@ static void sram_read_chunk(struct adapter *adapter, u32 addr, u8 *buf, u16 len)
else else
bank = 0x10000000; bank = 0x10000000;
} }
flex_sram_read(adapter, bank, addr & 0x7fff, buf, len); flex_sram_read(adapter, bank, addr & 0x7fff, buf, len);
} }
static void sram_read(struct adapter *adapter, u32 addr, u8 *buf, u32 len) static void sram_read(struct adapter *adapter, u32 addr, u8 *buf, u32 len)
{ {
u32 length; u32 length;
while (len != 0) { while (len != 0) {
length = len; length = len;
/* check if the address range belongs to the same
// check if the address range belongs to the same * 32K memory chip. If not, the data is read
// 32K memory chip. If not, the data is read from * from one chip at a time */
// one chip at a time.
if ((addr >> 0x0f) != ((addr + len - 1) >> 0x0f)) { if ((addr >> 0x0f) != ((addr + len - 1) >> 0x0f)) {
length = (((addr >> 0x0f) + 1) << 0x0f) - addr; length = (((addr >> 0x0f) + 1) << 0x0f) - addr;
} }
sram_read_chunk(adapter, addr, buf, length); sram_read_chunk(adapter, addr, buf, length);
addr = addr + length; addr = addr + length;
buf = buf + length; buf = buf + length;
len = len - length; len = len - length;
...@@ -203,19 +195,17 @@ static void sram_read(struct adapter *adapter, u32 addr, u8 *buf, u32 len) ...@@ -203,19 +195,17 @@ static void sram_read(struct adapter *adapter, u32 addr, u8 *buf, u32 len)
static void sram_write(struct adapter *adapter, u32 addr, u8 *buf, u32 len) static void sram_write(struct adapter *adapter, u32 addr, u8 *buf, u32 len)
{ {
u32 length; u32 length;
while (len != 0) { while (len != 0) {
length = len; length = len;
// check if the address range belongs to the same /* check if the address range belongs to the same
// 32K memory chip. If not, the data is written to * 32K memory chip. If not, the data is
// one chip at a time. * written to one chip at a time */
if ((addr >> 0x0f) != ((addr + len - 1) >> 0x0f)) { if ((addr >> 0x0f) != ((addr + len - 1) >> 0x0f)) {
length = (((addr >> 0x0f) + 1) << 0x0f) - addr; length = (((addr >> 0x0f) + 1) << 0x0f) - addr;
} }
sram_write_chunk(adapter, addr, buf, length); sram_write_chunk(adapter, addr, buf, length);
addr = addr + length; addr = addr + length;
buf = buf + length; buf = buf + length;
len = len - length; len = len - length;
...@@ -224,39 +214,29 @@ static void sram_write(struct adapter *adapter, u32 addr, u8 *buf, u32 len) ...@@ -224,39 +214,29 @@ static void sram_write(struct adapter *adapter, u32 addr, u8 *buf, u32 len)
static void sram_set_size(struct adapter *adapter, u32 mask) static void sram_set_size(struct adapter *adapter, u32 mask)
{ {
write_reg_dw(adapter, 0x71c, (mask | (~0x30000 & read_reg_dw(adapter, 0x71c)))); write_reg_dw(adapter, 0x71c,
(mask | (~0x30000 & read_reg_dw(adapter, 0x71c))));
} }
static void sram_init(struct adapter *adapter) static void sram_init(struct adapter *adapter)
{ {
u32 tmp; u32 tmp;
tmp = read_reg_dw(adapter, 0x71c); tmp = read_reg_dw(adapter, 0x71c);
write_reg_dw(adapter, 0x71c, 1); write_reg_dw(adapter, 0x71c, 1);
if (read_reg_dw(adapter, 0x71c) != 0) { if (read_reg_dw(adapter, 0x71c) != 0) {
write_reg_dw(adapter, 0x71c, tmp); write_reg_dw(adapter, 0x71c, tmp);
adapter->dw_sram_type = tmp & 0x30000; adapter->dw_sram_type = tmp & 0x30000;
ddprintk("%s: dw_sram_type = %x\n", __func__, adapter->dw_sram_type); ddprintk("%s: dw_sram_type = %x\n", __func__, adapter->dw_sram_type);
} else { } else {
adapter->dw_sram_type = 0x10000; adapter->dw_sram_type = 0x10000;
ddprintk("%s: dw_sram_type = %x\n", __func__, adapter->dw_sram_type); ddprintk("%s: dw_sram_type = %x\n", __func__, adapter->dw_sram_type);
} }
/* return value is never used? */
/* return adapter->dw_sram_type; */
} }
static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr)
{ {
u8 tmp1, tmp2; u8 tmp1, tmp2;
dprintk("%s: mask = %x, addr = %x\n", __func__, mask, addr); dprintk("%s: mask = %x, addr = %x\n", __func__, mask, addr);
sram_set_size(adapter, mask); sram_set_size(adapter, mask);
...@@ -269,7 +249,6 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) ...@@ -269,7 +249,6 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr)
sram_write(adapter, addr + 4, &tmp1, 1); sram_write(adapter, addr + 4, &tmp1, 1);
tmp2 = 0; tmp2 = 0;
mdelay(20); mdelay(20);
sram_read(adapter, addr, &tmp2, 1); sram_read(adapter, addr, &tmp2, 1);
...@@ -287,7 +266,6 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) ...@@ -287,7 +266,6 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr)
sram_write(adapter, addr + 4, &tmp1, 1); sram_write(adapter, addr + 4, &tmp1, 1);
tmp2 = 0; tmp2 = 0;
mdelay(20); mdelay(20);
sram_read(adapter, addr, &tmp2, 1); sram_read(adapter, addr, &tmp2, 1);
...@@ -297,26 +275,24 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr) ...@@ -297,26 +275,24 @@ static int sram_test_location(struct adapter *adapter, u32 mask, u32 addr)
if (tmp2 != 0x5a) if (tmp2 != 0x5a)
return 0; return 0;
return 1; return 1;
} }
static u32 sram_length(struct adapter *adapter) static u32 sram_length(struct adapter *adapter)
{ {
if (adapter->dw_sram_type == 0x10000) if (adapter->dw_sram_type == 0x10000)
return 32768; // 32K return 32768; /* 32K */
if (adapter->dw_sram_type == 0x00000) if (adapter->dw_sram_type == 0x00000)
return 65536; // 64K return 65536; /* 64K */
if (adapter->dw_sram_type == 0x20000) if (adapter->dw_sram_type == 0x20000)
return 131072; // 128K return 131072; /* 128K */
return 32768; /* 32K */
return 32768; // 32K
} }
/* FlexcopII can work with 32K, 64K or 128K of external SRAM memory. /* FlexcopII can work with 32K, 64K or 128K of external SRAM memory.
- for 128K there are 4x32K chips at bank 0,1,2,3. - for 128K there are 4x32K chips at bank 0,1,2,3.
- for 64K there are 2x32K chips at bank 1,2. - for 64K there are 2x32K chips at bank 1,2.
- for 32K there is one 32K chip at bank 0. - for 32K there is one 32K chip at bank 0.
FlexCop works only with one bank at a time. The bank is selected FlexCop works only with one bank at a time. The bank is selected
by bits 28-29 of the 0x700 register. by bits 28-29 of the 0x700 register.
...@@ -324,24 +300,18 @@ static u32 sram_length(struct adapter *adapter) ...@@ -324,24 +300,18 @@ static u32 sram_length(struct adapter *adapter)
bank 0 covers addresses 0x00000-0x07fff bank 0 covers addresses 0x00000-0x07fff
bank 1 covers addresses 0x08000-0x0ffff bank 1 covers addresses 0x08000-0x0ffff
bank 2 covers addresses 0x10000-0x17fff bank 2 covers addresses 0x10000-0x17fff
bank 3 covers addresses 0x18000-0x1ffff bank 3 covers addresses 0x18000-0x1ffff */
*/
static int flexcop_sram_detect(struct flexcop_device *fc) static int flexcop_sram_detect(struct flexcop_device *fc)
{ {
flexcop_ibi_value r208,r71c_0,vr71c_1; flexcop_ibi_value r208, r71c_0, vr71c_1;
r208 = fc->read_ibi_reg(fc, ctrl_208); r208 = fc->read_ibi_reg(fc, ctrl_208);
fc->write_ibi_reg(fc, ctrl_208, ibi_zero); fc->write_ibi_reg(fc, ctrl_208, ibi_zero);
r71c_0 = fc->read_ibi_reg(fc, wan_ctrl_reg_71c); r71c_0 = fc->read_ibi_reg(fc, wan_ctrl_reg_71c);
write_reg_dw(adapter, 0x71c, 1); write_reg_dw(adapter, 0x71c, 1);
tmp3 = read_reg_dw(adapter, 0x71c); tmp3 = read_reg_dw(adapter, 0x71c);
dprintk("%s: tmp3 = %x\n", __func__, tmp3); dprintk("%s: tmp3 = %x\n", __func__, tmp3);
write_reg_dw(adapter, 0x71c, tmp2); write_reg_dw(adapter, 0x71c, tmp2);
// check for internal SRAM ??? // check for internal SRAM ???
...@@ -350,9 +320,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) ...@@ -350,9 +320,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc)
sram_set_size(adapter, 0x10000); sram_set_size(adapter, 0x10000);
sram_init(adapter); sram_init(adapter);
write_reg_dw(adapter, 0x208, tmp); write_reg_dw(adapter, 0x208, tmp);
dprintk("%s: sram size = 32K\n", __func__); dprintk("%s: sram size = 32K\n", __func__);
return 32; return 32;
} }
...@@ -360,9 +328,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) ...@@ -360,9 +328,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc)
sram_set_size(adapter, 0x20000); sram_set_size(adapter, 0x20000);
sram_init(adapter); sram_init(adapter);
write_reg_dw(adapter, 0x208, tmp); write_reg_dw(adapter, 0x208, tmp);
dprintk("%s: sram size = 128K\n", __func__); dprintk("%s: sram size = 128K\n", __func__);
return 128; return 128;
} }
...@@ -370,9 +336,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc) ...@@ -370,9 +336,7 @@ static int flexcop_sram_detect(struct flexcop_device *fc)
sram_set_size(adapter, 0x00000); sram_set_size(adapter, 0x00000);
sram_init(adapter); sram_init(adapter);
write_reg_dw(adapter, 0x208, tmp); write_reg_dw(adapter, 0x208, tmp);
dprintk("%s: sram size = 64K\n", __func__); dprintk("%s: sram size = 64K\n", __func__);
return 64; return 64;
} }
...@@ -380,18 +344,14 @@ static int flexcop_sram_detect(struct flexcop_device *fc) ...@@ -380,18 +344,14 @@ static int flexcop_sram_detect(struct flexcop_device *fc)
sram_set_size(adapter, 0x10000); sram_set_size(adapter, 0x10000);
sram_init(adapter); sram_init(adapter);
write_reg_dw(adapter, 0x208, tmp); write_reg_dw(adapter, 0x208, tmp);
dprintk("%s: sram size = 32K\n", __func__); dprintk("%s: sram size = 32K\n", __func__);
return 32; return 32;
} }
sram_set_size(adapter, 0x10000); sram_set_size(adapter, 0x10000);
sram_init(adapter); sram_init(adapter);
write_reg_dw(adapter, 0x208, tmp); write_reg_dw(adapter, 0x208, tmp);
dprintk("%s: SRAM detection failed. Set to 32K \n", __func__); dprintk("%s: SRAM detection failed. Set to 32K \n", __func__);
return 0; return 0;
} }
......
/*
* Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* flexcop-usb.h - header file for the USB part
* see flexcop.c for copyright information
*/
#ifndef __FLEXCOP_USB_H_INCLUDED__ #ifndef __FLEXCOP_USB_H_INCLUDED__
#define __FLEXCOP_USB_H_INCLUDED__ #define __FLEXCOP_USB_H_INCLUDED__
#include <linux/usb.h> #include <linux/usb.h>
/* transfer parameters */ /* transfer parameters */
#define B2C2_USB_FRAMES_PER_ISO 4 #define B2C2_USB_FRAMES_PER_ISO 4
#define B2C2_USB_NUM_ISO_URB 4 #define B2C2_USB_NUM_ISO_URB 4
#define B2C2_USB_CTRL_PIPE_IN usb_rcvctrlpipe(fc_usb->udev,0) #define B2C2_USB_CTRL_PIPE_IN usb_rcvctrlpipe(fc_usb->udev, 0)
#define B2C2_USB_CTRL_PIPE_OUT usb_sndctrlpipe(fc_usb->udev,0) #define B2C2_USB_CTRL_PIPE_OUT usb_sndctrlpipe(fc_usb->udev, 0)
#define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev,0x81) #define B2C2_USB_DATA_PIPE usb_rcvisocpipe(fc_usb->udev, 0x81)
struct flexcop_usb { struct flexcop_usb {
struct usb_device *udev; struct usb_device *udev;
...@@ -18,8 +23,8 @@ struct flexcop_usb { ...@@ -18,8 +23,8 @@ struct flexcop_usb {
u8 *iso_buffer; u8 *iso_buffer;
int buffer_size; int buffer_size;
dma_addr_t dma_addr; dma_addr_t dma_addr;
struct urb *iso_urb[B2C2_USB_NUM_ISO_URB];
struct urb *iso_urb[B2C2_USB_NUM_ISO_URB];
struct flexcop_device *fc_dev; struct flexcop_device *fc_dev;
u8 tmp_buffer[1023+190]; u8 tmp_buffer[1023+190];
...@@ -30,14 +35,6 @@ struct flexcop_usb { ...@@ -30,14 +35,6 @@ struct flexcop_usb {
/* request types TODO What is its use?*/ /* request types TODO What is its use?*/
typedef enum { typedef enum {
/* something is wrong with this part
RTYPE_READ_DW = (1 << 6),
RTYPE_WRITE_DW_1 = (3 << 6),
RTYPE_READ_V8_MEMORY = (6 << 6),
RTYPE_WRITE_V8_MEMORY = (7 << 6),
RTYPE_WRITE_V8_FLASH = (8 << 6),
RTYPE_GENERIC = (9 << 6),
*/
} flexcop_usb_request_type_t; } flexcop_usb_request_type_t;
#endif #endif
...@@ -47,7 +44,6 @@ typedef enum { ...@@ -47,7 +44,6 @@ typedef enum {
B2C2_USB_READ_V8_MEM = 0x05, B2C2_USB_READ_V8_MEM = 0x05,
B2C2_USB_READ_REG = 0x08, B2C2_USB_READ_REG = 0x08,
B2C2_USB_WRITE_REG = 0x0A, B2C2_USB_WRITE_REG = 0x0A,
/* B2C2_USB_WRITEREGLO = 0x0A, */
B2C2_USB_WRITEREGHI = 0x0B, B2C2_USB_WRITEREGHI = 0x0B,
B2C2_USB_FLASH_BLOCK = 0x10, B2C2_USB_FLASH_BLOCK = 0x10,
B2C2_USB_I2C_REQUEST = 0x11, B2C2_USB_I2C_REQUEST = 0x11,
...@@ -62,15 +58,13 @@ typedef enum { ...@@ -62,15 +58,13 @@ typedef enum {
USB_FUNC_I2C_REPEATWRITE = 0x04, USB_FUNC_I2C_REPEATWRITE = 0x04,
USB_FUNC_GET_DESCRIPTOR = 0x05, USB_FUNC_GET_DESCRIPTOR = 0x05,
USB_FUNC_I2C_REPEATREAD = 0x06, USB_FUNC_I2C_REPEATREAD = 0x06,
/* DKT 020208 - add this to support special case of DiSEqC */ /* DKT 020208 - add this to support special case of DiSEqC */
USB_FUNC_I2C_CHECKWRITE = 0x07, USB_FUNC_I2C_CHECKWRITE = 0x07,
USB_FUNC_I2C_CHECKRESULT = 0x08, USB_FUNC_I2C_CHECKRESULT = 0x08,
} flexcop_usb_i2c_function_t; } flexcop_usb_i2c_function_t;
/* /* function definition for UTILITY request 0x12
* function definition for UTILITY request 0x12 * DKT 020304 - new utility function */
* DKT 020304 - new utility function
*/
typedef enum { typedef enum {
UTILITY_SET_FILTER = 0x01, UTILITY_SET_FILTER = 0x01,
UTILITY_DATA_ENABLE = 0x02, UTILITY_DATA_ENABLE = 0x02,
...@@ -84,7 +78,7 @@ typedef enum { ...@@ -84,7 +78,7 @@ typedef enum {
UTILITY_DATA_RESET = 0x0A, UTILITY_DATA_RESET = 0x0A,
UTILITY_GET_DATA_STATUS = 0x10, UTILITY_GET_DATA_STATUS = 0x10,
UTILITY_GET_V8_REG = 0x11, UTILITY_GET_V8_REG = 0x11,
/* DKT 020326 - add function for v1.14 */ /* DKT 020326 - add function for v1.14 */
UTILITY_SRAM_WRITE = 0x12, UTILITY_SRAM_WRITE = 0x12,
UTILITY_SRAM_READ = 0x13, UTILITY_SRAM_READ = 0x13,
UTILITY_SRAM_TESTFILL = 0x14, UTILITY_SRAM_TESTFILL = 0x14,
...@@ -92,13 +86,13 @@ typedef enum { ...@@ -92,13 +86,13 @@ typedef enum {
UTILITY_SRAM_TESTVERIFY = 0x16, UTILITY_SRAM_TESTVERIFY = 0x16,
} flexcop_usb_utility_function_t; } flexcop_usb_utility_function_t;
#define B2C2_WAIT_FOR_OPERATION_RW 1*HZ /* 1 s */ #define B2C2_WAIT_FOR_OPERATION_RW (1*HZ)
#define B2C2_WAIT_FOR_OPERATION_RDW 3*HZ /* 3 s */ #define B2C2_WAIT_FOR_OPERATION_RDW (3*HZ)
#define B2C2_WAIT_FOR_OPERATION_WDW 1*HZ /* 1 s */ #define B2C2_WAIT_FOR_OPERATION_WDW (1*HZ)
#define B2C2_WAIT_FOR_OPERATION_V8READ 3*HZ /* 3 s */ #define B2C2_WAIT_FOR_OPERATION_V8READ (3*HZ)
#define B2C2_WAIT_FOR_OPERATION_V8WRITE 3*HZ /* 3 s */ #define B2C2_WAIT_FOR_OPERATION_V8WRITE (3*HZ)
#define B2C2_WAIT_FOR_OPERATION_V8FLASH 3*HZ /* 3 s */ #define B2C2_WAIT_FOR_OPERATION_V8FLASH (3*HZ)
typedef enum { typedef enum {
V8_MEMORY_PAGE_DVB_CI = 0x20, V8_MEMORY_PAGE_DVB_CI = 0x20,
...@@ -107,13 +101,11 @@ typedef enum { ...@@ -107,13 +101,11 @@ typedef enum {
V8_MEMORY_PAGE_FLASH = 0x80 V8_MEMORY_PAGE_FLASH = 0x80
} flexcop_usb_mem_page_t; } flexcop_usb_mem_page_t;
#define V8_MEMORY_EXTENDED (1 << 15) #define V8_MEMORY_EXTENDED (1 << 15)
#define USB_MEM_READ_MAX 32
#define USB_MEM_READ_MAX 32 #define USB_MEM_WRITE_MAX 1
#define USB_MEM_WRITE_MAX 1 #define USB_FLASH_MAX 8
#define USB_FLASH_MAX 8 #define V8_MEMORY_PAGE_SIZE 0x8000 /* 32K */
#define V8_MEMORY_PAGE_MASK 0x7FFF
#define V8_MEMORY_PAGE_SIZE 0x8000 // 32K
#define V8_MEMORY_PAGE_MASK 0x7FFF
#endif #endif
/* /*
* flexcop.c - driver for digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop.c - main module part
* Copyright (C) 2004-5 Patrick Boettcher <patrick.boettcher@desy.de> * Copyright (C) 2004-9 Patrick Boettcher <patrick.boettcher@desy.de>
* * based on skystar2-driver Copyright (C) 2003 Vadim Catana, skystar@moldova.cc
* based on the skystar2-driver
* Copyright (C) 2003 Vadim Catana, skystar@moldova.cc
* *
* Acknowledgements: * Acknowledgements:
* John Jurrius from BBTI, Inc. for extensive support with * John Jurrius from BBTI, Inc. for extensive support
* code examples and data books * with code examples and data books
* * Bjarne Steinsbo, bjarne at steinsbo.com (some ideas for rewriting)
* Bjarne Steinsbo, bjarne at steinsbo.com (some ideas for rewriting)
* *
* Contributions to the skystar2-driver have been done by * Contributions to the skystar2-driver have been done by
* Vincenzo Di Massa, hawk.it at tiscalinet.it (several DiSEqC fixes) * Vincenzo Di Massa, hawk.it at tiscalinet.it (several DiSEqC fixes)
* Roberto Ragusa, r.ragusa at libero.it (polishing, restyling the code) * Roberto Ragusa, r.ragusa at libero.it (polishing, restyling the code)
* Niklas Peinecke, peinecke at gdv.uni-hannover.de (hardware pid/mac filtering) * Uwe Bugla, uwe.bugla at gmx.de (doing tests, restyling code, writing docu)
* * Niklas Peinecke, peinecke at gdv.uni-hannover.de (hardware pid/mac
* filtering)
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License * modify it under the terms of the GNU Lesser General Public License
...@@ -46,7 +44,10 @@ ...@@ -46,7 +44,10 @@
int b2c2_flexcop_debug; int b2c2_flexcop_debug;
module_param_named(debug, b2c2_flexcop_debug, int, 0644); module_param_named(debug, b2c2_flexcop_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debug level (1=info,2=tuner,4=i2c,8=ts,16=sram,32=reg (|-able))." DEBSTATUS); MODULE_PARM_DESC(debug,
"set debug level (1=info,2=tuner,4=i2c,8=ts,"
"16=sram,32=reg (|-able))."
DEBSTATUS);
#undef DEBSTATUS #undef DEBSTATUS
DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
...@@ -57,37 +58,36 @@ flexcop_ibi_value ibi_zero; ...@@ -57,37 +58,36 @@ flexcop_ibi_value ibi_zero;
static int flexcop_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed) static int flexcop_dvb_start_feed(struct dvb_demux_feed *dvbdmxfeed)
{ {
struct flexcop_device *fc = dvbdmxfeed->demux->priv; struct flexcop_device *fc = dvbdmxfeed->demux->priv;
return flexcop_pid_feed_control(fc,dvbdmxfeed,1); return flexcop_pid_feed_control(fc, dvbdmxfeed, 1);
} }
static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed) static int flexcop_dvb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
{ {
struct flexcop_device *fc = dvbdmxfeed->demux->priv; struct flexcop_device *fc = dvbdmxfeed->demux->priv;
return flexcop_pid_feed_control(fc,dvbdmxfeed,0); return flexcop_pid_feed_control(fc, dvbdmxfeed, 0);
} }
static int flexcop_dvb_init(struct flexcop_device *fc) static int flexcop_dvb_init(struct flexcop_device *fc)
{ {
int ret = dvb_register_adapter(&fc->dvb_adapter, int ret = dvb_register_adapter(&fc->dvb_adapter,
"FlexCop Digital TV device", fc->owner, "FlexCop Digital TV device", fc->owner,
fc->dev, adapter_nr); fc->dev, adapter_nr);
if (ret < 0) { if (ret < 0) {
err("error registering DVB adapter"); err("error registering DVB adapter");
return ret; return ret;
} }
fc->dvb_adapter.priv = fc; fc->dvb_adapter.priv = fc;
fc->demux.dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING | DMX_MEMORY_BASED_FILTERING); fc->demux.dmx.capabilities = (DMX_TS_FILTERING | DMX_SECTION_FILTERING
| DMX_MEMORY_BASED_FILTERING);
fc->demux.priv = fc; fc->demux.priv = fc;
fc->demux.filternum = fc->demux.feednum = FC_MAX_FEED; fc->demux.filternum = fc->demux.feednum = FC_MAX_FEED;
fc->demux.start_feed = flexcop_dvb_start_feed; fc->demux.start_feed = flexcop_dvb_start_feed;
fc->demux.stop_feed = flexcop_dvb_stop_feed; fc->demux.stop_feed = flexcop_dvb_stop_feed;
fc->demux.write_to_decoder = NULL; fc->demux.write_to_decoder = NULL;
if ((ret = dvb_dmx_init(&fc->demux)) < 0) { if ((ret = dvb_dmx_init(&fc->demux)) < 0) {
err("dvb_dmx failed: error %d",ret); err("dvb_dmx failed: error %d", ret);
goto err_dmx; goto err_dmx;
} }
...@@ -97,23 +97,23 @@ static int flexcop_dvb_init(struct flexcop_device *fc) ...@@ -97,23 +97,23 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
fc->dmxdev.demux = &fc->demux.dmx; fc->dmxdev.demux = &fc->demux.dmx;
fc->dmxdev.capabilities = 0; fc->dmxdev.capabilities = 0;
if ((ret = dvb_dmxdev_init(&fc->dmxdev, &fc->dvb_adapter)) < 0) { if ((ret = dvb_dmxdev_init(&fc->dmxdev, &fc->dvb_adapter)) < 0) {
err("dvb_dmxdev_init failed: error %d",ret); err("dvb_dmxdev_init failed: error %d", ret);
goto err_dmx_dev; goto err_dmx_dev;
} }
if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) { if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) {
err("adding hw_frontend to dmx failed: error %d",ret); err("adding hw_frontend to dmx failed: error %d", ret);
goto err_dmx_add_hw_frontend; goto err_dmx_add_hw_frontend;
} }
fc->mem_frontend.source = DMX_MEMORY_FE; fc->mem_frontend.source = DMX_MEMORY_FE;
if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->mem_frontend)) < 0) { if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->mem_frontend)) < 0) {
err("adding mem_frontend to dmx failed: error %d",ret); err("adding mem_frontend to dmx failed: error %d", ret);
goto err_dmx_add_mem_frontend; goto err_dmx_add_mem_frontend;
} }
if ((ret = fc->demux.dmx.connect_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) { if ((ret = fc->demux.dmx.connect_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) {
err("connect frontend failed: error %d",ret); err("connect frontend failed: error %d", ret);
goto err_connect_frontend; goto err_connect_frontend;
} }
...@@ -123,9 +123,9 @@ static int flexcop_dvb_init(struct flexcop_device *fc) ...@@ -123,9 +123,9 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
return 0; return 0;
err_connect_frontend: err_connect_frontend:
fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->mem_frontend); fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->mem_frontend);
err_dmx_add_mem_frontend: err_dmx_add_mem_frontend:
fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->hw_frontend); fc->demux.dmx.remove_frontend(&fc->demux.dmx, &fc->hw_frontend);
err_dmx_add_hw_frontend: err_dmx_add_hw_frontend:
dvb_dmxdev_release(&fc->dmxdev); dvb_dmxdev_release(&fc->dmxdev);
err_dmx_dev: err_dmx_dev:
...@@ -141,12 +141,13 @@ static void flexcop_dvb_exit(struct flexcop_device *fc) ...@@ -141,12 +141,13 @@ static void flexcop_dvb_exit(struct flexcop_device *fc)
dvb_net_release(&fc->dvbnet); dvb_net_release(&fc->dvbnet);
fc->demux.dmx.close(&fc->demux.dmx); fc->demux.dmx.close(&fc->demux.dmx);
fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->mem_frontend); fc->demux.dmx.remove_frontend(&fc->demux.dmx,
fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->hw_frontend); &fc->mem_frontend);
fc->demux.dmx.remove_frontend(&fc->demux.dmx,
&fc->hw_frontend);
dvb_dmxdev_release(&fc->dmxdev); dvb_dmxdev_release(&fc->dmxdev);
dvb_dmx_release(&fc->demux); dvb_dmx_release(&fc->demux);
dvb_unregister_adapter(&fc->dvb_adapter); dvb_unregister_adapter(&fc->dvb_adapter);
deb_info("deinitialized dvb stuff\n"); deb_info("deinitialized dvb stuff\n");
} }
fc->init_state &= ~FC_STATE_DVB_INIT; fc->init_state &= ~FC_STATE_DVB_INIT;
...@@ -168,9 +169,9 @@ EXPORT_SYMBOL(flexcop_pass_dmx_packets); ...@@ -168,9 +169,9 @@ EXPORT_SYMBOL(flexcop_pass_dmx_packets);
static void flexcop_reset(struct flexcop_device *fc) static void flexcop_reset(struct flexcop_device *fc)
{ {
flexcop_ibi_value v210,v204; flexcop_ibi_value v210, v204;
/* reset the flexcop itself */ /* reset the flexcop itself */
fc->write_ibi_reg(fc,ctrl_208,ibi_zero); fc->write_ibi_reg(fc,ctrl_208,ibi_zero);
v210.raw = 0; v210.raw = 0;
...@@ -183,13 +184,11 @@ static void flexcop_reset(struct flexcop_device *fc) ...@@ -183,13 +184,11 @@ static void flexcop_reset(struct flexcop_device *fc)
v210.sw_reset_210.reset_block_600 = 1; v210.sw_reset_210.reset_block_600 = 1;
v210.sw_reset_210.reset_block_700 = 1; v210.sw_reset_210.reset_block_700 = 1;
v210.sw_reset_210.Block_reset_enable = 0xb2; v210.sw_reset_210.Block_reset_enable = 0xb2;
v210.sw_reset_210.Special_controls = 0xc259; v210.sw_reset_210.Special_controls = 0xc259;
fc->write_ibi_reg(fc,sw_reset_210,v210); fc->write_ibi_reg(fc,sw_reset_210,v210);
msleep(1); msleep(1);
/* reset the periphical devices */ /* reset the periphical devices */
v204 = fc->read_ibi_reg(fc,misc_204); v204 = fc->read_ibi_reg(fc,misc_204);
v204.misc_204.Per_reset_sig = 0; v204.misc_204.Per_reset_sig = 0;
...@@ -201,11 +200,10 @@ static void flexcop_reset(struct flexcop_device *fc) ...@@ -201,11 +200,10 @@ static void flexcop_reset(struct flexcop_device *fc)
void flexcop_reset_block_300(struct flexcop_device *fc) void flexcop_reset_block_300(struct flexcop_device *fc)
{ {
flexcop_ibi_value v208_save = fc->read_ibi_reg(fc,ctrl_208), flexcop_ibi_value v208_save = fc->read_ibi_reg(fc, ctrl_208),
v210 = fc->read_ibi_reg(fc,sw_reset_210); v210 = fc->read_ibi_reg(fc, sw_reset_210);
deb_rdump("208: %08x, 210: %08x\n",v208_save.raw,v210.raw);
deb_rdump("208: %08x, 210: %08x\n", v208_save.raw, v210.raw);
fc->write_ibi_reg(fc,ctrl_208,ibi_zero); fc->write_ibi_reg(fc,ctrl_208,ibi_zero);
v210.sw_reset_210.reset_block_300 = 1; v210.sw_reset_210.reset_block_300 = 1;
...@@ -218,7 +216,8 @@ void flexcop_reset_block_300(struct flexcop_device *fc) ...@@ -218,7 +216,8 @@ void flexcop_reset_block_300(struct flexcop_device *fc)
struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len)
{ {
void *bus; void *bus;
struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), GFP_KERNEL); struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device),
GFP_KERNEL);
if (!fc) { if (!fc) {
err("no memory"); err("no memory");
return NULL; return NULL;
...@@ -253,7 +252,6 @@ int flexcop_device_initialize(struct flexcop_device *fc) ...@@ -253,7 +252,6 @@ int flexcop_device_initialize(struct flexcop_device *fc)
flexcop_determine_revision(fc); flexcop_determine_revision(fc);
flexcop_sram_init(fc); flexcop_sram_init(fc);
flexcop_hw_filter_init(fc); flexcop_hw_filter_init(fc);
flexcop_smc_ctrl(fc, 0); flexcop_smc_ctrl(fc, 0);
if ((ret = flexcop_dvb_init(fc))) if ((ret = flexcop_dvb_init(fc)))
...@@ -278,7 +276,6 @@ int flexcop_device_initialize(struct flexcop_device *fc) ...@@ -278,7 +276,6 @@ int flexcop_device_initialize(struct flexcop_device *fc)
goto error; goto error;
flexcop_device_name(fc,"initialization of","complete"); flexcop_device_name(fc,"initialization of","complete");
return 0; return 0;
error: error:
......
/* /*
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III * Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
* * flexcop.h - private header file for all flexcop-chip-source files
* flexcop.h - private header file for all flexcop-chip-source files. * see flexcop.c for copyright information
*
* see flexcop.c for copyright information.
*/ */
#ifndef __FLEXCOP_H__ #ifndef __FLEXCOP_H__
#define __FLEXCOP_H___ #define __FLEXCOP_H___
...@@ -21,11 +19,11 @@ extern int b2c2_flexcop_debug; ...@@ -21,11 +19,11 @@ extern int b2c2_flexcop_debug;
#define dprintk(level,args...) #define dprintk(level,args...)
#endif #endif
#define deb_info(args...) dprintk(0x01,args) #define deb_info(args...) dprintk(0x01, args)
#define deb_tuner(args...) dprintk(0x02,args) #define deb_tuner(args...) dprintk(0x02, args)
#define deb_i2c(args...) dprintk(0x04,args) #define deb_i2c(args...) dprintk(0x04, args)
#define deb_ts(args...) dprintk(0x08,args) #define deb_ts(args...) dprintk(0x08, args)
#define deb_sram(args...) dprintk(0x10,args) #define deb_sram(args...) dprintk(0x10, args)
#define deb_rdump(args...) dprintk(0x20,args) #define deb_rdump(args...) dprintk(0x20, args)
#endif #endif
/* This file is part of linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III /* Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* register descriptions * register descriptions
* * see flexcop.c for copyright information
* see flexcop.c for copyright information.
*/ */
/* This file is automatically generated, do not edit things here. */ /* This file is automatically generated, do not edit things here. */
#ifndef __FLEXCOP_IBI_VALUE_INCLUDED__ #ifndef __FLEXCOP_IBI_VALUE_INCLUDED__
#define __FLEXCOP_IBI_VALUE_INCLUDED__ #define __FLEXCOP_IBI_VALUE_INCLUDED__
......
/* This file is part of linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III /* Linux driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* register descriptions * register descriptions
* * see flexcop.c for copyright information
* see flexcop.c for copyright information.
*/ */
/* This file is automatically generated, do not edit things here. */ /* This file is automatically generated, do not edit things here. */
#ifndef __FLEXCOP_IBI_VALUE_INCLUDED__ #ifndef __FLEXCOP_IBI_VALUE_INCLUDED__
#define __FLEXCOP_IBI_VALUE_INCLUDED__ #define __FLEXCOP_IBI_VALUE_INCLUDED__
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment