aboutsummaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2020-03-25 18:15:46 +0100
committerMarek Vasut <marex@denx.de>2020-05-22 19:46:45 +0200
commiteb69d8bf3c043f126077e6b0905def8cca5c4723 (patch)
tree221a241057ec2a4b2277f02d6c4a82ec1cb2f549 /drivers
parent63f22f5998bc813ae5eacbf9210aa15cf80c0177 (diff)
downloadu-boot-eb69d8bf3c043f126077e6b0905def8cca5c4723.zip
u-boot-eb69d8bf3c043f126077e6b0905def8cca5c4723.tar.gz
u-boot-eb69d8bf3c043f126077e6b0905def8cca5c4723.tar.bz2
net: ks8851: Clean up chip ID readout
There is only one chip ID in the table of chip IDs for this chip. Read out the chip ID instead and mask off the last "revision" bit to check the chip ID, this works for all chips in the family. Then drop the chip ID passing around. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Eugen Hristev <eugen.hristev@microchip.com> Cc: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ks8851_mll.c21
1 files changed, 2 insertions, 19 deletions
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index 29bf40b..3e89f89 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -19,11 +19,6 @@
#define RX_BUF_SIZE 2000
-static const struct chip_id chip_ids[] = {
- {CIDER_ID, "KSZ8851"},
- {0, NULL},
-};
-
/*
* struct ks_net - KS8851 driver private data
* @bus_width : i/o bus width.
@@ -333,7 +328,7 @@ static void ks_setup_int(struct eth_device *dev)
static int ks8851_mll_detect_chip(struct eth_device *dev)
{
- unsigned short val, i;
+ unsigned short val;
ks_read_config(dev);
@@ -350,19 +345,11 @@ static int ks8851_mll_detect_chip(struct eth_device *dev)
debug("Read back KS8851 id 0x%x\n", val);
- /* only one entry in the table */
- val &= 0xfff0;
- for (i = 0; chip_ids[i].id != 0; i++) {
- if (chip_ids[i].id == val)
- break;
- }
- if (!chip_ids[i].id) {
+ if ((val & 0xfff0) != CIDER_ID) {
printf(DRIVERNAME ": Unknown chip ID %04x\n", val);
return -1;
}
- dev->priv = (void *)&chip_ids[i];
-
return 0;
}
@@ -406,10 +393,6 @@ static void ks8851_mll_enable(struct eth_device *dev)
static int ks8851_mll_init(struct eth_device *dev, bd_t *bd)
{
- struct chip_id *id = dev->priv;
-
- debug(DRIVERNAME ": detected %s controller\n", id->name);
-
if (ks_read_selftest(dev)) {
printf(DRIVERNAME ": Selftest failed\n");
return -1;