trying to read and write to a specific register of ethernet switch using uboot

Viewed 445

I am a new to linux/u-boot and just generally reading and writing to specific registers.

I have a KSZ9897 Ethernet switch, and my goal is to use u-boot i2c commands to set bits [15:13] to 001 to put the switch in the proper test mode.

The following screenshot is of the register that I am trying to read/write to:

KSZ9897 datasheet

The slave address of this part is 1011_111 = 0x5F

The address of the 16 bit register I am trying to read/write from is [0xN112-0xN113]

The PHY register is 0x09 (I am not sure how this fits in to the picture, but that may be the reason I am having issues)

using u-boot, I am sending the following command:

 #i2c md 0x5F 0xN112.2 0x10

It reads back the following:

0000: 00 98 97 00 00 00 00 00 00 00 00 00 00 00 00 4c ...............L

My suspicion is that this is just reading the first 16 addr values starting at 0x0000. I know this because the 98 and 97 values match up with the default values that should be at address 0x0001 and 0x0002.

Can anyone tell me what I am doing wrong here and how I can access register 0x09? I think i am using the proper u-boot syntax, but clearly something is not right here. any help would be much appreciated.

1 Answers

The i2c command is wrong, because the third parameter must be a hexadecimal number and N is not hexa, the switch datasheet tells that:

Address field “N” specifies the portnumber. Valid values for “N” are 1 to 7 for some registers, 6 to 7 for MAC port specific registers, and 0 to 5 for PHYspecific registers.

You should be writing something like this: i2c md 0x5f 0x1112 1 , the last parameter is the number of bytes you read.

Related