* [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM
@ 2016-08-03 2:42 Yaroslav K.
2016-08-04 1:16 ` Simon Glass
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Yaroslav K. @ 2016-08-03 2:42 UTC (permalink / raw
To: u-boot
Fix compile errors when enabling CONFIG_DM_ETH,
CONFIG_CMD_E1000 and CONFIG_E1000_SPI.
Signed-off-by: Yaroslav K. <yar444@gmail.com>
---
drivers/net/e1000.c | 6 ++++-
drivers/net/e1000_spi.c | 60 ++++++++++++++++++++++++-------------------------
2 files changed, 35 insertions(+), 31 deletions(-)
diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c
index 196989b..09d6870 100644
--- a/drivers/net/e1000.c
+++ b/drivers/net/e1000.c
@@ -5513,7 +5513,8 @@ static int do_e1000(cmd_tbl_t *cmdtp, int flag,
struct udevice *dev;
char name[30];
int ret;
-#else
+#endif
+#if !defined(CONFIG_DM_ETH) || defined(CONFIG_E1000_SPI)
struct e1000_hw *hw;
#endif
int cardnum;
@@ -5532,6 +5533,9 @@ static int do_e1000(cmd_tbl_t *cmdtp, int flag,
plat = dev_get_platdata(dev);
mac = plat->enetaddr;
}
+#ifdef CONFIG_E1000_SPI
+ hw = dev_get_priv(dev);
+#endif
#else
hw = e1000_find_card(cardnum);
if (hw)
diff --git a/drivers/net/e1000_spi.c b/drivers/net/e1000_spi.c
index 576ddb8..78f4f15 100644
--- a/drivers/net/e1000_spi.c
+++ b/drivers/net/e1000_spi.c
@@ -94,29 +94,29 @@ struct spi_slave *spi_setup_slave(unsigned int
bus, unsigned int cs,
/* Make sure it has an SPI chip */
if (hw->eeprom.type != e1000_eeprom_spi) {
- E1000_ERR(hw->nic, "No attached SPI EEPROM found!\n");
+ E1000_ERR(hw, "No attached SPI EEPROM found!\n");
return NULL;
}
/* Argument sanity checks */
if (cs != 0) {
- E1000_ERR(hw->nic, "No such SPI chip: %u\n", cs);
+ E1000_ERR(hw, "No such SPI chip: %u\n", cs);
return NULL;
}
if (mode != SPI_MODE_0) {
- E1000_ERR(hw->nic, "Only SPI MODE-0 is supported!\n");
+ E1000_ERR(hw, "Only SPI MODE-0 is supported!\n");
return NULL;
}
/* TODO: Use max_hz somehow */
- E1000_DBG(hw->nic, "EEPROM SPI access requested\n");
+ E1000_DBG(hw, "EEPROM SPI access requested\n");
return &hw->spi;
}
void spi_free_slave(struct spi_slave *spi)
{
__maybe_unused struct e1000_hw *hw = e1000_hw_from_spi(spi);
- E1000_DBG(hw->nic, "EEPROM SPI access released\n");
+ E1000_DBG(hw, "EEPROM SPI access released\n");
}
int spi_claim_bus(struct spi_slave *spi)
@@ -124,7 +124,7 @@ int spi_claim_bus(struct spi_slave *spi)
struct e1000_hw *hw = e1000_hw_from_spi(spi);
if (e1000_acquire_eeprom(hw)) {
- E1000_ERR(hw->nic, "EEPROM SPI cannot be acquired!\n");
+ E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n");
return -1;
}
@@ -342,41 +342,41 @@ static int do_e1000_spi_show(cmd_tbl_t *cmdtp,
struct e1000_hw *hw,
/* Extra sanity checks */
if (!length) {
- E1000_ERR(hw->nic, "Requested zero-sized dump!\n");
+ E1000_ERR(hw, "Requested zero-sized dump!\n");
return 1;
}
if ((0x10000 < length) || (0x10000 - length < offset)) {
- E1000_ERR(hw->nic, "Can't dump past 0xFFFF!\n");
+ E1000_ERR(hw, "Can't dump past 0xFFFF!\n");
return 1;
}
/* Allocate a buffer to hold stuff */
buffer = malloc(length);
if (!buffer) {
- E1000_ERR(hw->nic, "Out of Memory!\n");
+ E1000_ERR(hw, "Out of Memory!\n");
return 1;
}
/* Acquire the EEPROM and perform the dump */
if (e1000_acquire_eeprom(hw)) {
- E1000_ERR(hw->nic, "EEPROM SPI cannot be acquired!\n");
+ E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n");
free(buffer);
return 1;
}
err = e1000_spi_eeprom_dump(hw, buffer, offset, length, true);
e1000_release_eeprom(hw);
if (err) {
- E1000_ERR(hw->nic, "Interrupted!\n");
+ E1000_ERR(hw, "Interrupted!\n");
free(buffer);
return 1;
}
/* Now hexdump the result */
printf("%s: ===== Intel e1000 EEPROM (0x%04hX - 0x%04hX) =====",
- hw->nic->name, offset, offset + length - 1);
+ hw->name, offset, offset + length - 1);
for (i = 0; i < length; i++) {
if ((i & 0xF) == 0)
- printf("\n%s: %04hX: ", hw->nic->name, offset + i);
+ printf("\n%s: %04hX: ", hw->name, offset + i);
else if ((i & 0xF) == 0x8)
printf(" ");
printf(" %02hx", buffer[i]);
@@ -407,29 +407,29 @@ static int do_e1000_spi_dump(cmd_tbl_t *cmdtp,
struct e1000_hw *hw,
/* Extra sanity checks */
if (!length) {
- E1000_ERR(hw->nic, "Requested zero-sized dump!\n");
+ E1000_ERR(hw, "Requested zero-sized dump!\n");
return 1;
}
if ((0x10000 < length) || (0x10000 - length < offset)) {
- E1000_ERR(hw->nic, "Can't dump past 0xFFFF!\n");
+ E1000_ERR(hw, "Can't dump past 0xFFFF!\n");
return 1;
}
/* Acquire the EEPROM */
if (e1000_acquire_eeprom(hw)) {
- E1000_ERR(hw->nic, "EEPROM SPI cannot be acquired!\n");
+ E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n");
return 1;
}
/* Perform the programming operation */
if (e1000_spi_eeprom_dump(hw, dest, offset, length, true) < 0) {
- E1000_ERR(hw->nic, "Interrupted!\n");
+ E1000_ERR(hw, "Interrupted!\n");
e1000_release_eeprom(hw);
return 1;
}
e1000_release_eeprom(hw);
- printf("%s: ===== EEPROM DUMP COMPLETE =====\n", hw->nic->name);
+ printf("%s: ===== EEPROM DUMP COMPLETE =====\n", hw->name);
return 0;
}
@@ -452,19 +452,19 @@ static int do_e1000_spi_program(cmd_tbl_t
*cmdtp, struct e1000_hw *hw,
/* Acquire the EEPROM */
if (e1000_acquire_eeprom(hw)) {
- E1000_ERR(hw->nic, "EEPROM SPI cannot be acquired!\n");
+ E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n");
return 1;
}
/* Perform the programming operation */
if (e1000_spi_eeprom_program(hw, source, offset, length, true) < 0) {
- E1000_ERR(hw->nic, "Interrupted!\n");
+ E1000_ERR(hw, "Interrupted!\n");
e1000_release_eeprom(hw);
return 1;
}
e1000_release_eeprom(hw);
- printf("%s: ===== EEPROM PROGRAMMED =====\n", hw->nic->name);
+ printf("%s: ===== EEPROM PROGRAMMED =====\n", hw->name);
return 0;
}
@@ -488,19 +488,19 @@ static int do_e1000_spi_checksum(cmd_tbl_t
*cmdtp, struct e1000_hw *hw,
length = sizeof(uint16_t) * (EEPROM_CHECKSUM_REG + 1);
buffer = malloc(length);
if (!buffer) {
- E1000_ERR(hw->nic, "Unable to allocate EEPROM buffer!\n");
+ E1000_ERR(hw, "Unable to allocate EEPROM buffer!\n");
return 1;
}
/* Acquire the EEPROM */
if (e1000_acquire_eeprom(hw)) {
- E1000_ERR(hw->nic, "EEPROM SPI cannot be acquired!\n");
+ E1000_ERR(hw, "EEPROM SPI cannot be acquired!\n");
return 1;
}
/* Read the EEPROM */
if (e1000_spi_eeprom_dump(hw, buffer, 0, length, true) < 0) {
- E1000_ERR(hw->nic, "Interrupted!\n");
+ E1000_ERR(hw, "Interrupted!\n");
e1000_release_eeprom(hw);
return 1;
}
@@ -514,14 +514,14 @@ static int do_e1000_spi_checksum(cmd_tbl_t
*cmdtp, struct e1000_hw *hw,
/* Verify it! */
if (checksum_reg == checksum) {
printf("%s: INFO: EEPROM checksum is correct! (0x%04hx)\n",
- hw->nic->name, checksum);
+ hw->name, checksum);
e1000_release_eeprom(hw);
return 0;
}
/* Hrm, verification failed, print an error */
- E1000_ERR(hw->nic, "EEPROM checksum is incorrect!\n");
- E1000_ERR(hw->nic, " ...register was 0x%04hx, calculated 0x%04hx\n",
+ E1000_ERR(hw, "EEPROM checksum is incorrect!\n");
+ E1000_ERR(hw, " ...register was 0x%04hx, calculated 0x%04hx\n",
checksum_reg, checksum);
/* If they didn't ask us to update it, just return an error */
@@ -531,11 +531,11 @@ static int do_e1000_spi_checksum(cmd_tbl_t
*cmdtp, struct e1000_hw *hw,
}
/* Ok, correct it! */
- printf("%s: Reprogramming the EEPROM checksum...\n", hw->nic->name);
+ printf("%s: Reprogramming the EEPROM checksum...\n", hw->name);
buffer[i] = cpu_to_le16(checksum);
if (e1000_spi_eeprom_program(hw, &buffer[i], i * sizeof(uint16_t),
sizeof(uint16_t), true)) {
- E1000_ERR(hw->nic, "Interrupted!\n");
+ E1000_ERR(hw, "Interrupted!\n");
e1000_release_eeprom(hw);
return 1;
}
@@ -554,7 +554,7 @@ int do_e1000_spi(cmd_tbl_t *cmdtp, struct e1000_hw *hw,
/* Make sure it has an SPI chip */
if (hw->eeprom.type != e1000_eeprom_spi) {
- E1000_ERR(hw->nic, "No attached SPI EEPROM found!\n");
+ E1000_ERR(hw, "No attached SPI EEPROM found!\n");
return 1;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM
2016-08-03 2:42 [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM Yaroslav K.
@ 2016-08-04 1:16 ` Simon Glass
2016-08-04 16:39 ` Joe Hershberger
2016-08-04 16:44 ` Joe Hershberger
2 siblings, 0 replies; 6+ messages in thread
From: Simon Glass @ 2016-08-04 1:16 UTC (permalink / raw
To: u-boot
On 2 August 2016 at 20:42, Yaroslav K. <yar444@gmail.com> wrote:
> Fix compile errors when enabling CONFIG_DM_ETH,
> CONFIG_CMD_E1000 and CONFIG_E1000_SPI.
>
> Signed-off-by: Yaroslav K. <yar444@gmail.com>
> ---
> drivers/net/e1000.c | 6 ++++-
> drivers/net/e1000_spi.c | 60 ++++++++++++++++++++++++-------------------------
> 2 files changed, 35 insertions(+), 31 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM
2016-08-03 2:42 [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM Yaroslav K.
2016-08-04 1:16 ` Simon Glass
@ 2016-08-04 16:39 ` Joe Hershberger
2016-08-08 8:44 ` Alban Bedel
2016-08-04 16:44 ` Joe Hershberger
2 siblings, 1 reply; 6+ messages in thread
From: Joe Hershberger @ 2016-08-04 16:39 UTC (permalink / raw
To: u-boot
On Tue, Aug 2, 2016 at 9:42 PM, Yaroslav K. <yar444@gmail.com> wrote:
> Fix compile errors when enabling CONFIG_DM_ETH,
> CONFIG_CMD_E1000 and CONFIG_E1000_SPI.
>
> Signed-off-by: Yaroslav K. <yar444@gmail.com>
Something about this patch email is malformed and not parsed by
patchwork properly.
Another patch with the same intent was also sent just after this one:
https://patchwork.ozlabs.org/patch/655311/
With permission of you and Alban Bedel I'll add both of your SOB to
Alban's patch.
Cheers,
-Joe
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM
2016-08-03 2:42 [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM Yaroslav K.
2016-08-04 1:16 ` Simon Glass
2016-08-04 16:39 ` Joe Hershberger
@ 2016-08-04 16:44 ` Joe Hershberger
2 siblings, 0 replies; 6+ messages in thread
From: Joe Hershberger @ 2016-08-04 16:44 UTC (permalink / raw
To: u-boot
On Tue, Aug 2, 2016 at 9:42 PM, Yaroslav K. <yar444@gmail.com> wrote:
> Fix compile errors when enabling CONFIG_DM_ETH,
> CONFIG_CMD_E1000 and CONFIG_E1000_SPI.
>
> Signed-off-by: Yaroslav K. <yar444@gmail.com>
In the future please Cc me when sending network patches.
scripts/patman/patman can help you with this.
Also, please do not abbreviate your name in your SOB line.
Thanks,
-Joe
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM
2016-08-04 16:39 ` Joe Hershberger
@ 2016-08-08 8:44 ` Alban Bedel
0 siblings, 0 replies; 6+ messages in thread
From: Alban Bedel @ 2016-08-08 8:44 UTC (permalink / raw
To: u-boot
On Thu, 4 Aug 2016 11:39:49 -0500
Joe Hershberger <joe.hershberger@gmail.com> wrote:
> On Tue, Aug 2, 2016 at 9:42 PM, Yaroslav K. <yar444@gmail.com> wrote:
> > Fix compile errors when enabling CONFIG_DM_ETH,
> > CONFIG_CMD_E1000 and CONFIG_E1000_SPI.
> >
> > Signed-off-by: Yaroslav K. <yar444@gmail.com>
>
> Something about this patch email is malformed and not parsed by
> patchwork properly.
>
> Another patch with the same intent was also sent just after this one:
> https://patchwork.ozlabs.org/patch/655311/
>
> With permission of you and Alban Bedel I'll add both of your SOB to
> Alban's patch.
Please do.
Alban
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20160808/2b815ccf/attachment.sig>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM
@ 2016-08-08 8:53 Yaroslav K.
0 siblings, 0 replies; 6+ messages in thread
From: Yaroslav K. @ 2016-08-08 8:53 UTC (permalink / raw
To: u-boot
Hi Joe.
You should probably just take Alban's patch. I don't care
about my SOB.
--
Yaroslav
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-08-08 8:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-03 2:42 [U-Boot] [PATCH] net: e1000: Allow to use e1000 SPI command with DM Yaroslav K.
2016-08-04 1:16 ` Simon Glass
2016-08-04 16:39 ` Joe Hershberger
2016-08-08 8:44 ` Alban Bedel
2016-08-04 16:44 ` Joe Hershberger
-- strict thread matches above, loose matches on Subject: below --
2016-08-08 8:53 Yaroslav K.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.