mirror of
https://github.com/fail0verflow/switch-linux.git
synced 2025-05-04 02:34:21 -04:00
eeprom_93cx6: Add data direction control.
Some devices need to know if the data is to be output or read, so add a data direction into the eeprom structure to tell the driver whether the data line should be driven. The user in this case is the Micrel KS8851 which has a direction control for the EEPROM data line and thus needs to know whether to drive it (writing) or to tristate it for receiving. Signed-off-by: Ben Dooks <ben@simtec.co.uk> Cc: Wolfram Sang <w.sang@pengutronix.de> Cc: Jean Delvare <khali@linux-fr.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e9008ee99c
commit
b30f8bdcfa
2 changed files with 5 additions and 0 deletions
|
@ -63,6 +63,7 @@ static void eeprom_93cx6_startup(struct eeprom_93cx6 *eeprom)
|
||||||
eeprom->reg_data_out = 0;
|
eeprom->reg_data_out = 0;
|
||||||
eeprom->reg_data_clock = 0;
|
eeprom->reg_data_clock = 0;
|
||||||
eeprom->reg_chip_select = 1;
|
eeprom->reg_chip_select = 1;
|
||||||
|
eeprom->drive_data = 1;
|
||||||
eeprom->register_write(eeprom);
|
eeprom->register_write(eeprom);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -101,6 +102,7 @@ static void eeprom_93cx6_write_bits(struct eeprom_93cx6 *eeprom,
|
||||||
*/
|
*/
|
||||||
eeprom->reg_data_in = 0;
|
eeprom->reg_data_in = 0;
|
||||||
eeprom->reg_data_out = 0;
|
eeprom->reg_data_out = 0;
|
||||||
|
eeprom->drive_data = 1;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start writing all bits.
|
* Start writing all bits.
|
||||||
|
@ -140,6 +142,7 @@ static void eeprom_93cx6_read_bits(struct eeprom_93cx6 *eeprom,
|
||||||
*/
|
*/
|
||||||
eeprom->reg_data_in = 0;
|
eeprom->reg_data_in = 0;
|
||||||
eeprom->reg_data_out = 0;
|
eeprom->reg_data_out = 0;
|
||||||
|
eeprom->drive_data = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start reading all bits.
|
* Start reading all bits.
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
* @register_write(struct eeprom_93cx6 *eeprom): handler to
|
* @register_write(struct eeprom_93cx6 *eeprom): handler to
|
||||||
* write to the eeprom register by using all reg_* fields.
|
* write to the eeprom register by using all reg_* fields.
|
||||||
* @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
|
* @width: eeprom width, should be one of the PCI_EEPROM_WIDTH_* defines
|
||||||
|
* @drive_data: Set if we're driving the data line.
|
||||||
* @reg_data_in: register field to indicate data input
|
* @reg_data_in: register field to indicate data input
|
||||||
* @reg_data_out: register field to indicate data output
|
* @reg_data_out: register field to indicate data output
|
||||||
* @reg_data_clock: register field to set the data clock
|
* @reg_data_clock: register field to set the data clock
|
||||||
|
@ -62,6 +63,7 @@ struct eeprom_93cx6 {
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
|
|
||||||
|
char drive_data;
|
||||||
char reg_data_in;
|
char reg_data_in;
|
||||||
char reg_data_out;
|
char reg_data_out;
|
||||||
char reg_data_clock;
|
char reg_data_clock;
|
||||||
|
|
Loading…
Add table
Reference in a new issue