提交 77824131 编写于 作者: J Johannes Stezenbach 提交者: Linus Torvalds

[PATCH] dvb: flexcop: fix MAC address reading

read MAC address directly into dvb_adapter->proposed_mac
Signed-off-by: NPatrick Boettcher <pb@linuxtv.org>
Signed-off-by: NJohannes Stezenbach <js@linuxtv.org>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 3ed8a31c
......@@ -57,7 +57,6 @@ 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;
......
......@@ -129,8 +129,6 @@ 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
*/
......@@ -139,18 +137,16 @@ 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;
}
......
......@@ -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
......
......@@ -233,16 +233,18 @@ int flexcop_device_initialize(struct flexcop_device *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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册