summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorPatrick Boettcher <devnull@localhost>2005-03-31 18:54:13 +0000
committerPatrick Boettcher <devnull@localhost>2005-03-31 18:54:13 +0000
commit4ae33e4f5ab7230b6a4650fc00536f17ee5875a4 (patch)
tree0df680fb59d89a1de08902121b7b612787f6a053 /linux
parentffc743c9033fec93aaa735d39a7d927448db2818 (diff)
downloadmediapointer-dvb-s2-4ae33e4f5ab7230b6a4650fc00536f17ee5875a4.tar.gz
mediapointer-dvb-s2-4ae33e4f5ab7230b6a4650fc00536f17ee5875a4.tar.bz2
reading MAC address directly into dvb_adapter->proposed_mac
Diffstat (limited to 'linux')
-rw-r--r--linux/drivers/media/dvb/b2c2/flexcop-common.h17
-rw-r--r--linux/drivers/media/dvb/b2c2/flexcop-eeprom.c14
-rw-r--r--linux/drivers/media/dvb/b2c2/flexcop-usb.c37
-rw-r--r--linux/drivers/media/dvb/b2c2/flexcop.c38
4 files changed, 52 insertions, 54 deletions
diff --git a/linux/drivers/media/dvb/b2c2/flexcop-common.h b/linux/drivers/media/dvb/b2c2/flexcop-common.h
index 6a910ad42..534876d61 100644
--- a/linux/drivers/media/dvb/b2c2/flexcop-common.h
+++ b/linux/drivers/media/dvb/b2c2/flexcop-common.h
@@ -2,7 +2,7 @@
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* flexcop-common.h - common header file for device-specific source files also.
- *
+ *
* see flexcop.c for copyright information.
*/
#ifndef __FLEXCOP_COMMON_H__
@@ -57,13 +57,12 @@ struct flexcop_device {
int init_state;
/* device information */
- u8 mac_address[6];
int has_32_hw_pid_filter;
flexcop_revision_t rev;
flexcop_device_type_t dev_type;
flexcop_bus_t bus_type;
-
- /* dvb stuff */
+
+ /* dvb stuff */
struct dvb_adapter dvb_adapter;
struct dvb_frontend *fe;
struct dvb_net dvbnet;
@@ -72,22 +71,22 @@ struct flexcop_device {
struct dmx_frontend hw_frontend;
struct dmx_frontend mem_frontend;
int (*fe_sleep) (struct dvb_frontend *);
-
+
struct i2c_adapter i2c_adap;
struct semaphore i2c_sem;
/* options and status */
int feedcount;
int pid_filtering;
-
+
/* bus specific callbacks */
flexcop_ibi_value (*read_ibi_reg) (struct flexcop_device *, flexcop_ibi_register);
int (*write_ibi_reg) (struct flexcop_device *, flexcop_ibi_register, flexcop_ibi_value);
-
+
int (*i2c_request) (struct flexcop_device*, flexcop_access_op_t, flexcop_i2c_port_t, u8 chipaddr, u8 addr, u8 *buf, u16 len);
int (*stream_control) (struct flexcop_device*, int);
-
+
int (*get_mac_addr) (struct flexcop_device *fc, int extended);
void *bus_specific;
@@ -123,7 +122,7 @@ int flexcop_eeprom_check_mac_addr(struct flexcop_device *fc, int extended);
/* from flexcop-i2c.c */
/* the PCI part uses this a i2c_request callback, whereas the usb part has its own
* one. We have it in flexcop-i2c.c, because it is going via the actual
- * I2C-channel of the flexcop.
+ * I2C-channel of the flexcop.
*/
int flexcop_i2c_request(struct flexcop_device*, flexcop_access_op_t,
flexcop_i2c_port_t, u8 chipaddr, u8 addr, u8 *buf, u16 len);
diff --git a/linux/drivers/media/dvb/b2c2/flexcop-eeprom.c b/linux/drivers/media/dvb/b2c2/flexcop-eeprom.c
index dcf117382..bbcf070a1 100644
--- a/linux/drivers/media/dvb/b2c2/flexcop-eeprom.c
+++ b/linux/drivers/media/dvb/b2c2/flexcop-eeprom.c
@@ -2,7 +2,7 @@
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* flexcop-eeprom.c - eeprom access methods (currently only MAC address reading is used)
- *
+ *
* see flexcop.c for copyright information.
*/
#include "flexcop.h"
@@ -129,28 +129,24 @@ static int flexcop_eeprom_lrc_read(struct flexcop_device *fc, u16 addr, u8 *buf,
return ret;
}
-/* TODO how is it handled in USB */
-
/* 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)
{
u8 buf[8];
int ret = 0;
- memset(fc->mac_address,0,6);
-
if ((ret = flexcop_eeprom_lrc_read(fc,0x3f8,buf,8,4)) == 0) {
if (extended != 0) {
err("TODO: extended (EUI64) MAC addresses aren't completely supported yet");
ret = -EINVAL;
-/* memcpy(fc->mac_address,buf,3);
+/* memcpy(fc->dvb_adapter.proposed_mac,buf,3);
mac[3] = 0xfe;
mac[4] = 0xff;
- memcpy(&fc->mac_address[3],&buf[5],3); */
+ memcpy(&fc->dvb_adapter.proposed_mac[3],&buf[5],3); */
} else
- memcpy(fc->mac_address,buf,6);
+ memcpy(fc->dvb_adapter.proposed_mac,buf,6);
}
return ret;
}
diff --git a/linux/drivers/media/dvb/b2c2/flexcop-usb.c b/linux/drivers/media/dvb/b2c2/flexcop-usb.c
index 8a9cc74c1..9d05be88c 100644
--- a/linux/drivers/media/dvb/b2c2/flexcop-usb.c
+++ b/linux/drivers/media/dvb/b2c2/flexcop-usb.c
@@ -2,7 +2,7 @@
* This file is part of linux driver the digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* flexcop-usb.c - covers the USB part.
- *
+ *
* see flexcop.c for copyright information.
*/
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "set debugging level (1=info,ts=2,ctrl=4,i2c=8,v8mem=16
#define B2C2_FLEX_INTERNALADDR_TO_PCIOFFSET(ucAddr) (u16) (((ucAddr & 0x07) << 2) + ((ucAddr & 0x70) << 4))
/*
- * DKT 020228
+ * DKT 020228
* - forget about this VENDOR_BUFFER_SIZE, read and write register
* deal with DWORD or 4 bytes, that should be should from now on
* - from now on, we don't support anything older than firm 1.00
@@ -85,7 +85,7 @@ static int flexcop_usb_readwrite_dw(struct flexcop_device *fc, u16 wRegOffsPCI,
err("error while %s dword from %d (%d).",read ? "reading" : "writing",
wAddress,wRegOffsPCI);
return -EIO;
- }
+ }
return 0;
}
@@ -129,7 +129,7 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb,
}
deb_v8("v8mem: %02x %02x %04x %04x, len: %d\n",request_type,req,
wAddress,wIndex,buflen);
-
+
len = usb_control_msg(fc_usb->udev,pipe,
req,
request_type,
@@ -138,9 +138,9 @@ static int flexcop_usb_v8_memory_req(struct flexcop_usb *fc_usb,
pbBuffer,
buflen,
nWaitTime * HZ);
-
+
debug_dump(pbBuffer,len,deb_v8);
-
+
return len == buflen ? 0 : -EIO;
}
@@ -171,7 +171,7 @@ static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb,flexcop_usb_request
(addr & V8_MEMORY_PAGE_MASK) | (V8_MEMORY_EXTENDED*extended),
&buf[i],pagechunk)) < 0)
return ret;
-
+
addr += pagechunk;
len -= pagechunk;
}
@@ -180,7 +180,8 @@ static int flexcop_usb_memory_req(struct flexcop_usb *fc_usb,flexcop_usb_request
static int flexcop_usb_get_mac_addr(struct flexcop_device *fc, int extended)
{
- return flexcop_usb_memory_req(fc->bus_specific,B2C2_USB_READ_V8_MEM,V8_MEMORY_PAGE_FLASH,0x1f010,1,fc->mac_address,6);
+ return flexcop_usb_memory_req(fc->bus_specific,B2C2_USB_READ_V8_MEM,
+ V8_MEMORY_PAGE_FLASH,0x1f010,1,fc->dvb_adapter.proposed_mac,6);
}
#if 0
@@ -199,7 +200,7 @@ static int flexcop_usb_utility_req(struct flexcop_usb *fc_usb, int set,
len = usb_control_msg(fc_usb->udev,pipe,
B2C2_USB_UTILITY,
- request_type,
+ request_type,
wValue,
wIndex,
pvBuffer,
@@ -246,7 +247,7 @@ static int flexcop_usb_i2c_req(struct flexcop_usb *fc_usb,
deb_i2c("i2c %2d: %02x %02x %02x %02x %02x %02x\n",func,request_type,req,
((wValue && 0xff) << 8),wValue >> 8,((wIndex && 0xff) << 8),wIndex >> 8);
-
+
len = usb_control_msg(fc_usb->udev,pipe,
req,
request_type,
@@ -273,7 +274,7 @@ static int flexcop_usb_write_ibi_reg(struct flexcop_device *fc, flexcop_ibi_regi
return flexcop_usb_readwrite_dw(fc,reg, &val.raw, 0);
}
-static int flexcop_usb_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op,
+static int flexcop_usb_i2c_request(struct flexcop_device *fc, flexcop_access_op_t op,
flexcop_i2c_port_t port, u8 chipaddr, u8 addr, u8 *buf, u16 len)
{
if (op == FC_READ)
@@ -306,8 +307,8 @@ static void flexcop_usb_process_frame(struct flexcop_usb *fc_usb, u8 *buffer, in
if ( *(b+2) == 0x47 )
flexcop_pass_dmx_packets(fc_usb->fc_dev, b+2, 1);
else
- deb_ts("not ts packet %02x %02x %02x %02x \n", *(b+2), *(b+3), *(b+4), *(b+5) );
-
+ deb_ts("not ts packet %02x %02x %02x %02x \n", *(b+2), *(b+3), *(b+4), *(b+5) );
+
b += 190;
l -= 190;
break;
@@ -342,7 +343,7 @@ static void flexcop_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
if (urb->iso_frame_desc[i].actual_length > 0) {
deb_ts("passed %d bytes to the demux\n",urb->iso_frame_desc[i].actual_length);
- flexcop_usb_process_frame(fc_usb,
+ flexcop_usb_process_frame(fc_usb,
urb->transfer_buffer + urb->iso_frame_desc[i].offset,
urb->iso_frame_desc[i].actual_length);
}
@@ -431,7 +432,7 @@ static int flexcop_usb_transfer_init(struct flexcop_usb *fc_usb)
FC_SRAM_DEST_CAO | FC_SRAM_DEST_CAI, FC_SRAM_DEST_TARGET_WAN_USB);
flexcop_wan_set_speed(fc_usb->fc_dev,FC_WAN_SPEED_8MBITS);
flexcop_sram_ctrl(fc_usb->fc_dev,1,1,1);
-
+
ret = 0;
goto success;
urb_error:
@@ -490,12 +491,12 @@ static int flexcop_usb_probe(struct usb_interface *intf,
fc->write_ibi_reg = flexcop_usb_write_ibi_reg;
fc->i2c_request = flexcop_usb_i2c_request;
fc->get_mac_addr = flexcop_usb_get_mac_addr;
-
+
fc->stream_control = flexcop_usb_stream_control;
fc->pid_filtering = 1;
fc->bus_type = FC_USB;
-
+
fc->dev = &udev->dev;
/* bus specific part */
@@ -511,7 +512,7 @@ static int flexcop_usb_probe(struct usb_interface *intf,
/* xfer init */
if ((ret = flexcop_usb_transfer_init(fc_usb)) != 0)
goto err_fc_exit;
-
+
info("%s successfully initialized and connected.",DRIVER_NAME);
ret = 0;
goto success;
diff --git a/linux/drivers/media/dvb/b2c2/flexcop.c b/linux/drivers/media/dvb/b2c2/flexcop.c
index 4b2b414e0..ad5908750 100644
--- a/linux/drivers/media/dvb/b2c2/flexcop.c
+++ b/linux/drivers/media/dvb/b2c2/flexcop.c
@@ -2,17 +2,17 @@
* flexcop.c - driver for digital TV devices equipped with B2C2 FlexcopII(b)/III
*
* Copyright (C) 2004-5 Patrick Boettcher <patrick.boettcher@desy.de>
- *
- * based on the skystar2-driver
+ *
+ * based on the skystar2-driver
* Copyright (C) 2003 Vadim Catana, skystar@moldova.cc
*
* Acknowledgements:
* John Jurrius from BBTI, Inc. for extensive support with
* code examples and data books
- *
+ *
* 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)
* Roberto Ragusa, r.ragusa at libero.it (polishing, restyling the code)
* Niklas Peinecke, peinecke at gdv.uni-hannover.de (hardware pid/mac filtering)
@@ -81,7 +81,7 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
fc->demux.start_feed = flexcop_dvb_start_feed;
fc->demux.stop_feed = flexcop_dvb_stop_feed;
fc->demux.write_to_decoder = NULL;
-
+
if ((ret = dvb_dmx_init(&fc->demux)) < 0) {
err("dvb_dmx failed: error %d",ret);
goto err_dmx;
@@ -96,7 +96,7 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
err("dvb_dmxdev_init failed: error %d",ret);
goto err_dmx_dev;
}
-
+
if ((ret = fc->demux.dmx.add_frontend(&fc->demux.dmx, &fc->hw_frontend)) < 0) {
err("adding hw_frontend to dmx failed: error %d",ret);
goto err_dmx_add_hw_frontend;
@@ -117,7 +117,7 @@ static int flexcop_dvb_init(struct flexcop_device *fc)
fc->init_state |= FC_STATE_DVB_INIT;
goto success;
-
+
err_connect_frontend:
fc->demux.dmx.remove_frontend(&fc->demux.dmx,&fc->mem_frontend);
err_dmx_add_mem_frontend:
@@ -129,7 +129,7 @@ err_dmx_dev:
err_dmx:
dvb_unregister_adapter(&fc->dvb_adapter);
return ret;
-
+
success:
return 0;
}
@@ -178,7 +178,7 @@ static void flexcop_reset(struct flexcop_device *fc)
fc->write_ibi_reg(fc,sw_reset_210,v210);
/* reset the periphical devices */
-
+
v204 = fc->read_ibi_reg(fc,misc_204);
v204.misc_204.Per_reset_sig = 0;
fc->write_ibi_reg(fc,misc_204,v204);
@@ -199,7 +199,7 @@ struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len)
return NULL;
}
memset(fc, 0, sizeof(struct flexcop_device));
-
+
bus = kmalloc(bus_specific_len, GFP_KERNEL);
if (!bus) {
err("no memory");
@@ -230,28 +230,30 @@ int flexcop_device_initialize(struct flexcop_device *fc)
flexcop_determine_revision(fc);
flexcop_sram_init(fc);
flexcop_hw_filter_init(fc);
-
+
flexcop_smc_ctrl(fc, 0);
+ if ((ret = flexcop_dvb_init(fc)))
+ goto error;
+
+ /* do the MAC address reading after initializing the dvb_adapter */
if (fc->get_mac_addr(fc, 0) == 0) {
- u8 *b = fc->mac_address;
+ u8 *b = fc->dvb_adapter.proposed_mac;
info("MAC address = %02x:%02x:%02x:%02x:%02x:%02x", b[0],b[1],b[2],b[3],b[4],b[5]);
- flexcop_set_mac_filter(fc,fc->mac_address);
+ flexcop_set_mac_filter(fc,b);
flexcop_mac_filter_ctrl(fc,1);
} else
warn("reading of MAC address failed.\n");
- if ((ret = flexcop_dvb_init(fc)))
- goto error;
if ((ret = flexcop_i2c_init(fc)))
goto error;
-
+
if ((ret = flexcop_frontend_init(fc)))
goto error;
flexcop_device_name(fc,"initialization of","complete");
-
+
ret = 0;
goto success;
error: