All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
@ 2008-04-07 13:16 Sander Vermin
  2008-04-07 13:49 ` Stelian Pop
  0 siblings, 1 reply; 12+ messages in thread
From: Sander Vermin @ 2008-04-07 13:16 UTC (permalink / raw)
  To: u-boot

Hello,

I'm trying to build a U-Boot from your git tree with the AT91 patches. 
My board is a custom board with a KS8721 instead of the DM9161 network 
PHY chip. This is the same chip as Olimex used on their development board.

Olimex build a U-Boot for their board, they did some code hacking on 
u-boot. As far as I know they did the following to get the ethernet up 
and running. [1] This is in the board/at91sam9260ek/dm9161a.c file

On the latest git version with the AT91 patches the ethernet driver is 
called macb??!!

Do you know how I can get this working? (as hack and in the future more 
clean)

Kind regards,

Sander Vermin

[1]
static unsigned int dm9161a_IsPhyConnected (AT91PS_EMAC p_mac)
{
    unsigned short Id1, Id2;

    at91_EmacEnableMDIO (p_mac);
    at91_EmacReadPhy (p_mac, SAM9260EK_PHY_ADDRESS, DM9161_PHYID1, &Id1);
    at91_EmacReadPhy (p_mac, SAM9260EK_PHY_ADDRESS, DM9161_PHYID2, &Id2);
    at91_EmacDisableMDIO (p_mac);
   
    /*printf(" Id1 0x%04x\n", Id1);
    printf(" Id1 0x%04x\n", Id2);*/
   

    if ((Id1 == (DM9161_PHYID1_OUI >> 6)) &&
        ((Id2 >> 10) == (DM9161_PHYID1_OUI & DM9161_LSB_MASK))) {
      printf("DM9161A PHY Detected\n\r");
      return TRUE;
    }
   
    if ((Id1 == MICREL_ID_1) && (Id2 == MICREL_ID_2)) {
        printf("KS8721 PHY Detected\n\r");
        return TRUE;
    }
   
    return FALSE;
}

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 13:16 [U-Boot-Users] AT91SAM9260EK with KS8721 PHY Sander Vermin
@ 2008-04-07 13:49 ` Stelian Pop
  2008-04-07 13:54   ` Eric BENARD
  2008-04-07 14:14   ` Sander Vermin
  0 siblings, 2 replies; 12+ messages in thread
From: Stelian Pop @ 2008-04-07 13:49 UTC (permalink / raw)
  To: u-boot


Le lundi 07 avril 2008 ? 15:16 +0200, Sander Vermin a ?crit :
> Hello,
> 
> I'm trying to build a U-Boot from your git tree with the AT91 patches. 
> My board is a custom board with a KS8721 instead of the DM9161 network 
> PHY chip. This is the same chip as Olimex used on their development board.
> 
> Olimex build a U-Boot for their board, they did some code hacking on 
> u-boot. As far as I know they did the following to get the ethernet up 
> and running. [1] This is in the board/at91sam9260ek/dm9161a.c file

Are the changes limited to recognizing the MICREL_* phy id 
> 
> On the latest git version with the AT91 patches the ethernet driver is 
> called macb??!!

Yes.

> Do you know how I can get this working? (as hack and in the future more 
> clean)

Did you test it as is ? From what I see in the code, the macb driver
doesn't care much about the PHY type...

Stelian.
-- 
Stelian Pop <stelian@popies.net>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 13:49 ` Stelian Pop
@ 2008-04-07 13:54   ` Eric BENARD
  2008-04-07 14:14   ` Sander Vermin
  1 sibling, 0 replies; 12+ messages in thread
From: Eric BENARD @ 2008-04-07 13:54 UTC (permalink / raw)
  To: u-boot

Stelian Pop a ?crit :
> Le lundi 07 avril 2008 ? 15:16 +0200, Sander Vermin a ?crit :
>> Hello,
>>
>> I'm trying to build a U-Boot from your git tree with the AT91 patches. 
>> My board is a custom board with a KS8721 instead of the DM9161 network 
>> PHY chip. This is the same chip as Olimex used on their development board.
>>
>> Olimex build a U-Boot for their board, they did some code hacking on 
>> u-boot. As far as I know they did the following to get the ethernet up 
>> and running. [1] This is in the board/at91sam9260ek/dm9161a.c file
> 
> Are the changes limited to recognizing the MICREL_* phy id 

from memory, on AT91RM9200 with KS8721SL, it was necessary to tweak some 
bits in order to change the "isolate" setting of the PHY.

Eric

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 13:49 ` Stelian Pop
  2008-04-07 13:54   ` Eric BENARD
@ 2008-04-07 14:14   ` Sander Vermin
  2008-04-07 20:00     ` Stelian Pop
  1 sibling, 1 reply; 12+ messages in thread
From: Sander Vermin @ 2008-04-07 14:14 UTC (permalink / raw)
  To: u-boot

Stelian Pop schreef:
> Le lundi 07 avril 2008 ? 15:16 +0200, Sander Vermin a ?crit :
>   
>> Hello,
>>
>> I'm trying to build a U-Boot from your git tree with the AT91 patches. 
>> My board is a custom board with a KS8721 instead of the DM9161 network 
>> PHY chip. This is the same chip as Olimex used on their development board.
>>
>> Olimex build a U-Boot for their board, they did some code hacking on 
>> u-boot. As far as I know they did the following to get the ethernet up 
>> and running. [1] This is in the board/at91sam9260ek/dm9161a.c file
>>     
>
> Are the changes limited to recognizing the MICREL_* phy id 
>   
>> On the latest git version with the AT91 patches the ethernet driver is 
>> called macb??!!
>>     
>
> Yes.
>
>   
>> Do you know how I can get this working? (as hack and in the future more 
>> clean)
>>     
>
> Did you test it as is ? From what I see in the code, the macb driver
> doesn't care much about the PHY type...
>
> Stelian.
>   
I did test it, u-boot says no PHY present. I had to change from RMII 
mode to MII mode due to my hardware design.

Regards,

Sander

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 14:14   ` Sander Vermin
@ 2008-04-07 20:00     ` Stelian Pop
  2008-04-07 20:23       ` Eric BENARD
  0 siblings, 1 reply; 12+ messages in thread
From: Stelian Pop @ 2008-04-07 20:00 UTC (permalink / raw)
  To: u-boot


Le lundi 07 avril 2008 ? 16:14 +0200, Sander Vermin a ?crit :

> > Did you test it as is ? From what I see in the code, the macb driver
> > doesn't care much about the PHY type...

> I did test it, u-boot says no PHY present. I had to change from RMII 
> mode to MII mode due to my hardware design.

Ok, so there must be something else in the code which was changed to
support your PHY (look for some "isolate" setting like Eric said).
You'll need to find out what it is...

-- 
Stelian Pop <stelian@popies.net>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 20:00     ` Stelian Pop
@ 2008-04-07 20:23       ` Eric BENARD
  2008-04-07 20:49         ` Stelian Pop
  0 siblings, 1 reply; 12+ messages in thread
From: Eric BENARD @ 2008-04-07 20:23 UTC (permalink / raw)
  To: u-boot

Stelian Pop a ?crit :
> Le lundi 07 avril 2008 ? 16:14 +0200, Sander Vermin a ?crit :
> 
>>> Did you test it as is ? From what I see in the code, the macb driver
>>> doesn't care much about the PHY type...
> 
>> I did test it, u-boot says no PHY present. I had to change from RMII 
>> mode to MII mode due to my hardware design.
> 
> Ok, so there must be something else in the code which was changed to
> support your PHY (look for some "isolate" setting like Eric said).
> You'll need to find out what it is...
> 
please find attached a quick and dirty hacked ks8721.c  and the 
corresponding .h
It works on an AT91RM9200 with u-boot 1.3.2.

Eric

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ks8721.c
Type: text/x-csrc
Size: 7208 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080407/a34ed1bf/attachment.c 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ks8721.h
Type: text/x-chdr
Size: 5093 bytes
Desc: not available
Url : http://lists.denx.de/pipermail/u-boot/attachments/20080407/a34ed1bf/attachment.h 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 20:23       ` Eric BENARD
@ 2008-04-07 20:49         ` Stelian Pop
  2008-04-07 20:55           ` Eric BENARD
  0 siblings, 1 reply; 12+ messages in thread
From: Stelian Pop @ 2008-04-07 20:49 UTC (permalink / raw)
  To: u-boot


Le lundi 07 avril 2008 ? 22:23 +0200, Eric BENARD a ?crit :
> Stelian Pop a ?crit :
> > Le lundi 07 avril 2008 ? 16:14 +0200, Sander Vermin a ?crit :
> > 
> >>> Did you test it as is ? From what I see in the code, the macb driver
> >>> doesn't care much about the PHY type...
> > 
> >> I did test it, u-boot says no PHY present. I had to change from RMII 
> >> mode to MII mode due to my hardware design.
> > 
> > Ok, so there must be something else in the code which was changed to
> > support your PHY (look for some "isolate" setting like Eric said).
> > You'll need to find out what it is...
> > 
> please find attached a quick and dirty hacked ks8721.c  and the 
> corresponding .h
> It works on an AT91RM9200 with u-boot 1.3.2.

Hmm, if I sed:
	s/KS8721/DM9161/g
and
	s/ks8721/dm9161/g

on your files I find almost no change with regard to the original
version, except:

#define PHY_ADDRESS (1<<5)

and a #if 0 commenting out a bit of the initialisation sequence...

This makes me think it may only be a PHY_ADDRESS issue: what happens if
you change in cpu/arm926ejs/at91sam9/ether.c :

macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);

to

macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);

Stelian.
-- 
Stelian Pop <stelian@popies.net>

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 20:49         ` Stelian Pop
@ 2008-04-07 20:55           ` Eric BENARD
  2008-04-08  7:58             ` Sander Vermin
  0 siblings, 1 reply; 12+ messages in thread
From: Eric BENARD @ 2008-04-07 20:55 UTC (permalink / raw)
  To: u-boot

Stelian Pop a ?crit :
> Hmm, if I sed:
> 	s/KS8721/DM9161/g
> and
> 	s/ks8721/dm9161/g
> 
> on your files I find almost no change with regard to the original
> version, except:
> 
> #define PHY_ADDRESS (1<<5)
> 
> and a #if 0 commenting out a bit of the initialisation sequence...
> 
yes, goal was to make a clean driver starting from dm9161 with 
PHY_ADDRESS in the config file ... but I didn't had time to progress on 
it :-(
Isolate problem can happen depending on the pullup/down configuration I 
think (I didn't check in tthe datasheet, but I once met the problem).

> This makes me think it may only be a PHY_ADDRESS issue: what happens if
> you change in cpu/arm926ejs/at91sam9/ether.c :
> 
> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);
> 
> to
> 
> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);
> 
It's not running on a 9260 so I can't test but it should work (and this 
may be the problem Sander have).

Eric

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-07 20:55           ` Eric BENARD
@ 2008-04-08  7:58             ` Sander Vermin
  2008-04-08  8:36               ` Eric BENARD
  0 siblings, 1 reply; 12+ messages in thread
From: Sander Vermin @ 2008-04-08  7:58 UTC (permalink / raw)
  To: u-boot

Eric BENARD schreef:
> Stelian Pop a ?crit :
>> Hmm, if I sed:
>>     s/KS8721/DM9161/g
>> and
>>     s/ks8721/dm9161/g
>>
>> on your files I find almost no change with regard to the original
>> version, except:
>>
>> #define PHY_ADDRESS (1<<5)
>>
>> and a #if 0 commenting out a bit of the initialisation sequence...
>>
> yes, goal was to make a clean driver starting from dm9161 with 
> PHY_ADDRESS in the config file ... but I didn't had time to progress 
> on it :-(
> Isolate problem can happen depending on the pullup/down configuration 
> I think (I didn't check in tthe datasheet, but I once met the problem).
>
>> This makes me think it may only be a PHY_ADDRESS issue: what happens if
>> you change in cpu/arm926ejs/at91sam9/ether.c :
>>
>> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);
>>
>> to
>>
>> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);
>>
> It's not running on a 9260 so I can't test but it should work (and 
> this may be the problem Sander have).
>
> Eric
I did a new build with:

macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);

in stead of:

macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);

But still no PHY detected :-(

The files that Eric send were for a AT91RM9200? and don't work on my 
AT91SAM9260?

Sander

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-08  7:58             ` Sander Vermin
@ 2008-04-08  8:36               ` Eric BENARD
  2008-04-08  9:09                 ` Sander Vermin
  2008-04-08  9:09                 ` michael
  0 siblings, 2 replies; 12+ messages in thread
From: Eric BENARD @ 2008-04-08  8:36 UTC (permalink / raw)
  To: u-boot

Sander Vermin a ?crit :
> I did a new build with:
> 
> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);
> 
> in stead of:
> 
> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);
> 
> But still no PHY detected :-(
> 
You need to check your schematic, and the PHY datasheet in order to know 
what could be the address of your PHY (set by pull up/down resistors on 
several pins of the PHY at reset of the PHY).

Or you can try a loop on the PHY address and see if it answers at any 
address ...

Eric

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-08  8:36               ` Eric BENARD
@ 2008-04-08  9:09                 ` Sander Vermin
  2008-04-08  9:09                 ` michael
  1 sibling, 0 replies; 12+ messages in thread
From: Sander Vermin @ 2008-04-08  9:09 UTC (permalink / raw)
  To: u-boot

Eric BENARD schreef:
> Sander Vermin a ?crit :
>> I did a new build with:
>>
>> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);
>>
>> in stead of:
>>
>> macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);
>>
>> But still no PHY detected :-(
>>
> You need to check your schematic, and the PHY datasheet in order to 
> know what could be the address of your PHY (set by pull up/down 
> resistors on several pins of the PHY at reset of the PHY).
>
> Or you can try a loop on the PHY address and see if it answers at any 
> address ...
>
> Eric
It works!!

The detection of the PHY works, the base address was 0x01 instead of  0x00.

Wen I try to enable RII mode (CONFIG_CMD_MII) I get all kinds of errors 
about variable not being found:

macb.c: In function 'miiphy_read':
macb.c:528: error: 'macb' undeclared (first use in this function)
macb.c:528: error: (Each undeclared identifier is reported only once
macb.c:528: error: for each function it appears in.)
macb.c:528: error: 'MACB_EMACB_NCR' undeclared (first use in this function)
macb.c:539: error: 'MACB_EMACB_MAN' undeclared (first use in this function)
macb.c:542: error: 'MACB_EMACB_NSR' undeclared (first use in this function)
macb.c: In function 'miiphy_write':
macb.c:566: error: 'macb' undeclared (first use in this function)
macb.c:566: error: 'MACB_EMACB_NCR' undeclared (first use in this function)
macb.c:578: error: 'MACB_EMACB_MAN' undeclared (first use in this function)
macb.c:581: error: 'MACB_EMACB_NSR' undeclared (first use in this function)
make[1]: *** [macb.o] Error 1

Looking at the code I see that macb should be a pointer to "struct 
macb_device *macb" how should this code work? I don't see any functions 
point to the miiphy_read an write functions.

Sander

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [U-Boot-Users] AT91SAM9260EK with KS8721 PHY
  2008-04-08  8:36               ` Eric BENARD
  2008-04-08  9:09                 ` Sander Vermin
@ 2008-04-08  9:09                 ` michael
  1 sibling, 0 replies; 12+ messages in thread
From: michael @ 2008-04-08  9:09 UTC (permalink / raw)
  To: u-boot

Hi,
> Sander Vermin a ?crit :> I did a new build with:> > macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 1<<5);> > in stead of:> > macb_eth_initialize(0, (void *)AT91_BASE_EMAC, 0x00);> > But still no PHY detected :-(> You need to check your schematic, and the PHY datasheet in order to know what could be the address of your PHY (set by pull up/down resistors on several pins of the PHY at reset of the PHY).
> Or you can try a loop on the PHY address and see if it answers at any address ...
>   
Try this code to do the loop test.

#if defined(CONFIG_YOURBOARD)
#define MAX_PHY_ADDR    64
        for (i = 0 ; i < MAX_PHY_ADDR; i++) {
                macb->phy_addr = i;
                phy_id = macb_mdio_read(macb, MII_PHYSID1);
                if (phy_id != 0xffff)
                        break;
        }
        printf("phy_id %x found at %d\n", phy_id, i);
#else
        phy_id = macb_mdio_read(macb, MII_PHYSID1);
#endif

Michael

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-04-08  9:09 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-07 13:16 [U-Boot-Users] AT91SAM9260EK with KS8721 PHY Sander Vermin
2008-04-07 13:49 ` Stelian Pop
2008-04-07 13:54   ` Eric BENARD
2008-04-07 14:14   ` Sander Vermin
2008-04-07 20:00     ` Stelian Pop
2008-04-07 20:23       ` Eric BENARD
2008-04-07 20:49         ` Stelian Pop
2008-04-07 20:55           ` Eric BENARD
2008-04-08  7:58             ` Sander Vermin
2008-04-08  8:36               ` Eric BENARD
2008-04-08  9:09                 ` Sander Vermin
2008-04-08  9:09                 ` michael

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.