diff mbox

[U-Boot,4/5] e1000: Export core EEPROM access functions for SPI support

Message ID 1318971929-1160-5-git-send-email-Kyle.D.Moffett@boeing.com
State Accepted
Commit 2326a94db10d9b6c0bf322c6536cafcac8e85522
Headers show

Commit Message

Kyle Moffett Oct. 18, 2011, 9:05 p.m. UTC
A followup patch will be adding a configurable feature to enable
programming of E1000 EEPROMs from the command line or via the generic
U-Boot SPI interface.

In order for it to work it needs access to certain E1000-internal
functions, so export those in the e1000.h header file.

Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
Cc: Ben Warren <biggerbadderben@gmail.com>
---
 drivers/net/e1000.c |   22 +++++-----------------
 drivers/net/e1000.h |   19 +++++++++++++++++++
 2 files changed, 24 insertions(+), 17 deletions(-)

Comments

Wolfgang Denk Oct. 27, 2011, 10:35 p.m. UTC | #1
Dear Kyle Moffett,

In message <1318971929-1160-5-git-send-email-Kyle.D.Moffett@boeing.com> you wrote:
> A followup patch will be adding a configurable feature to enable
> programming of E1000 EEPROMs from the command line or via the generic
> U-Boot SPI interface.
> 
> In order for it to work it needs access to certain E1000-internal
> functions, so export those in the e1000.h header file.
> 
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> Cc: Ben Warren <biggerbadderben@gmail.com>
> ---
>  drivers/net/e1000.c |   22 +++++-----------------
>  drivers/net/e1000.h |   19 +++++++++++++++++++
>  2 files changed, 24 insertions(+), 17 deletions(-)

Applied, thanks.

Best regards,

Wolfgang Denk
Tabi Timur-B04825 Nov. 1, 2011, 3:22 p.m. UTC | #2
On Tue, Oct 18, 2011 at 4:05 PM, Kyle Moffett <Kyle.D.Moffett@boeing.com> wrote:
> A followup patch will be adding a configurable feature to enable
> programming of E1000 EEPROMs from the command line or via the generic
> U-Boot SPI interface.
>
> In order for it to work it needs access to certain E1000-internal
> functions, so export those in the e1000.h header file.
>
> Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> Cc: Ben Warren <biggerbadderben@gmail.com>

This patches causes a ton of build warnings:

/home/b04825/vslick/bin/vsbuild -signal 39610 -command make -s -j 3
O=1022 && syncp 1022/u-boot.bin /tftpboot/timur/1022/
VSLICKERRORPATH=/home/b04825/git/u-boot.jerry
make -s -j 3 O=1022
Generating /home/b04825/git/u-boot.jerry/1022/include/generated/asm-offsets.h
e1000.c: In function 'e1000_raise_ee_clk':
e1000.c:155:2: warning: unused variable 'x'
e1000.c: In function 'e1000_lower_ee_clk':
e1000.c:172:2: warning: unused variable 'x'
e1000.c: In function 'e1000_shift_out_ee_bits':
e1000.c:208:3: warning: unused variable 'x'
e1000.c: In function 'e1000_standby_eeprom':
e1000.c:279:3: warning: unused variable 'x'
e1000.c:285:3: warning: unused variable 'x'
e1000.c:291:3: warning: unused variable 'x'
e1000.c:297:3: warning: unused variable 'x'
e1000.c:303:3: warning: unused variable 'x'
e1000.c:307:3: warning: unused variable 'x'
e1000.c: In function 'e1000_release_eeprom':
e1000.c:689:3: warning: unused variable 'x'
e1000.c:695:3: warning: unused variable 'x'
e1000.c: In function 'e1000_reset_hw':
e1000.c:1401:2: warning: unused variable 'x'
e1000.c:1428:3: warning: unused variable 'x'
e1000.c: In function 'e1000_init_hw':
e1000.c:1635:3: warning: unused variable 'x'
e1000.c:1647:3: warning: unused variable 'x'
e1000.c:1661:3: warning: unused variable 'x'
e1000.c: In function 'e1000_setup_fiber_link':
e1000.c:2029:2: warning: unused variable 'x'
e1000.c: In function 'e1000_config_collision_dist':
e1000.c:3235:2: warning: unused variable 'x'
e1000.c: In function 'e1000_raise_mdi_clk':
e1000.c:3960:2: warning: unused variable 'x'
e1000.c: In function 'e1000_lower_mdi_clk':
e1000.c:3977:2: warning: unused variable 'x'
e1000.c: In function 'e1000_shift_out_mdi_bits':
e1000.c:4020:3: warning: unused variable 'x'
e1000.c: In function 'e1000_shift_in_mdi_bits':
e1000.c:4059:2: warning: unused variable 'x'
e1000.c: In function 'e1000_phy_hw_reset':
e1000.c:4341:3: warning: unused variable 'x'
e1000.c:4349:3: warning: unused variable 'x'
e1000.c:4362:3: warning: unused variable 'x'
e1000.c:4366:3: warning: unused variable 'x'
e1000.c: In function 'e1000_configure_rx':
e1000.c:4991:3: warning: unused variable 'x'
e1000.c: In function 'e1000_transmit':
e1000.c:5049:2: warning: unused variable 'x'
e1000.c: In function 'e1000_initialize':
e1000.c:869:14: warning: 'checksum' may be used uninitialized in this function

The problem is this macro:

#define E1000_WRITE_FLUSH(a) \
       do { uint32_t x = E1000_READ_REG(a, STATUS); } while (0)

The 'x' is never used.
Mike Frysinger Nov. 1, 2011, 3:30 p.m. UTC | #3
On Tuesday 01 November 2011 11:22:09 Tabi Timur-B04825 wrote:
> On Tue, Oct 18, 2011 at 4:05 PM, Kyle Moffett wrote:
> > A followup patch will be adding a configurable feature to enable
> > programming of E1000 EEPROMs from the command line or via the generic
> > U-Boot SPI interface.
> > 
> > In order for it to work it needs access to certain E1000-internal
> > functions, so export those in the e1000.h header file.
> > 
> > Signed-off-by: Kyle Moffett <Kyle.D.Moffett@boeing.com>
> > Cc: Ben Warren <biggerbadderben@gmail.com>
> 
> This patches causes a ton of build warnings:

wolfgang has already posted a patch for this
-mike
diff mbox

Patch

diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 0fe3723..0c74685 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -135,13 +135,6 @@  static void e1000_set_media_type(struct e1000_hw *hw);
 
 static int32_t e1000_swfw_sync_acquire(struct e1000_hw *hw, uint16_t mask);
 static int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
-#define E1000_WRITE_REG(a, reg, value) (writel((value), ((a)->hw_addr + E1000_##reg)))
-#define E1000_READ_REG(a, reg) (readl((a)->hw_addr + E1000_##reg))
-#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) (\
-			writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))))
-#define E1000_READ_REG_ARRAY(a, reg, offset) ( \
-	readl((a)->hw_addr + E1000_##reg + ((offset) << 2)))
-#define E1000_WRITE_FLUSH(a) {uint32_t x; x = E1000_READ_REG(a, STATUS);}
 
 #ifndef CONFIG_AP1000 /* remove for warnings */
 static int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,
@@ -153,8 +146,7 @@  static int32_t e1000_read_eeprom(struct e1000_hw *hw, uint16_t offset,
  * hw - Struct containing variables accessed by shared code
  * eecd - EECD's current value
  *****************************************************************************/
-static void
-e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t * eecd)
+void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t * eecd)
 {
 	/* Raise the clock input to the EEPROM (by setting the SK bit), and then
 	 * wait 50 microseconds.
@@ -171,8 +163,7 @@  e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t * eecd)
  * hw - Struct containing variables accessed by shared code
  * eecd - EECD's current value
  *****************************************************************************/
-static void
-e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t * eecd)
+void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t * eecd)
 {
 	/* Lower the clock input to the EEPROM (by clearing the SK bit), and then
 	 * wait 50 microseconds.
@@ -276,8 +267,7 @@  e1000_shift_in_ee_bits(struct e1000_hw *hw, uint16_t count)
  *
  * hw - Struct containing variables accessed by shared code
  *****************************************************************************/
-static void
-e1000_standby_eeprom(struct e1000_hw *hw)
+void e1000_standby_eeprom(struct e1000_hw *hw)
 {
 	struct e1000_eeprom_info *eeprom = &hw->eeprom;
 	uint32_t eecd;
@@ -355,8 +345,7 @@  static boolean_t e1000_is_onboard_nvm_eeprom(struct e1000_hw *hw)
  * Lowers EEPROM clock. Clears input pin. Sets the chip select pin. This
  * function should be called before issuing a command to the EEPROM.
  *****************************************************************************/
-static int32_t
-e1000_acquire_eeprom(struct e1000_hw *hw)
+int32_t e1000_acquire_eeprom(struct e1000_hw *hw)
 {
 	struct e1000_eeprom_info *eeprom = &hw->eeprom;
 	uint32_t eecd, i = 0;
@@ -672,8 +661,7 @@  e1000_read_eeprom_eerd(struct e1000_hw *hw,
 	return error;
 }
 
-static void
-e1000_release_eeprom(struct e1000_hw *hw)
+void e1000_release_eeprom(struct e1000_hw *hw)
 {
 	uint32_t eecd;
 
diff --git a/drivers/net/e1000.h b/drivers/net/e1000.h
index b4e9cf2..fc5ed57 100644
--- a/drivers/net/e1000.h
+++ b/drivers/net/e1000.h
@@ -55,10 +55,29 @@ 
 #define DEBUGOUT(fmt, args...)	do { } while (0)
 #endif
 
+/* I/O wrapper functions */
+#define E1000_WRITE_REG(a, reg, value) \
+	(writel((value), ((a)->hw_addr + E1000_##reg)))
+#define E1000_READ_REG(a, reg) \
+	(readl((a)->hw_addr + E1000_##reg))
+#define E1000_WRITE_REG_ARRAY(a, reg, offset, value) \
+	(writel((value), ((a)->hw_addr + E1000_##reg + ((offset) << 2))))
+#define E1000_READ_REG_ARRAY(a, reg, offset) \
+	(readl((a)->hw_addr + E1000_##reg + ((offset) << 2)))
+#define E1000_WRITE_FLUSH(a) \
+	do { uint32_t x = E1000_READ_REG(a, STATUS); } while (0)
+
 /* Forward declarations of structures used by the shared code */
 struct e1000_hw;
 struct e1000_hw_stats;
 
+/* Internal E1000 helper functions */
+int32_t e1000_acquire_eeprom(struct e1000_hw *hw);
+void e1000_standby_eeprom(struct e1000_hw *hw);
+void e1000_release_eeprom(struct e1000_hw *hw);
+void e1000_raise_ee_clk(struct e1000_hw *hw, uint32_t *eecd);
+void e1000_lower_ee_clk(struct e1000_hw *hw, uint32_t *eecd);
+
 typedef enum {
 	FALSE = 0,
 	TRUE = 1