Skip to contentSkip to conversation

How to find I/O registers, base address of ASIX ethernet chip?

PXA320 Dennis Semakin 5 participants 23 messages Feb 4, 2010 – Feb 8, 2010

lore
Share & tools
lore
#0 lore raw

Hello all

Configuration:
Computer module is Toradex Colibri PXA320.
Board is Colibri Evaluation Board.

Obviously, to access the I/O register of network card, we need to map them into memory, using the ioremap() function.
To do this driver (ax88796.c) use platform_get_resource() function to get the physical address of the I/O registers from the board definition (arch/arm/mach-pxa/colibri-pxa320.c). This function returns a pointer to a struct resource, which contains two interesting fields : start and end (both are physical address). Then call ioremap function to remap the memory area returned by platform_get_resource.
Right?

Ok. When I start kernel on my board, kernel loading stops on network initialization during call to the address resource.start. So, what could I do if the address (field start in resource structure) is not valid?
Can I find it? (I mean address) Maybe I should ask something: where are ethernet chip I/O registers mapped in the memory?

Thanks
Best regards
Dennis Semakin

#1 lore raw
Quoted 6 lines · Dennis Semakin

Hello all

Configuration:
Computer module is Toradex Colibri PXA320.
Board is Colibri Evaluation Board.

Quoted 6 lines

Obviously, to access the I/O register of network card, we need to map them into memory, using the ioremap() function.
To do this driver (ax88796.c) use platform_get_resource() function to get the physical address of the I/O registers from the board definition (arch/arm/mach-pxa/colibri-pxa320.c). This function returns a pointer to a struct resource, which contains two interesting fields : start and end (both are physical address). Then call ioremap function to remap the memory area returned by platform_get_resource.
Right?

Ok. When I start kernel on my board, kernel loading stops on network initialization during call to the address resource.start.

By 'call', my understanding is 'access' here right?

Quoted 3 lines

So, what could I do if the address (field start in resource structure) is not valid?
Can I find it? (I mean address) Maybe I should ask something: where are ethernet chip I/O registers mapped in the memory?

Well, I guess you have to ask Toradex then :-)

Sometimes the registers range is offset by some value, possibly due to compatibility with ISA I/O range, so you can also check if you have a correct offset there in the resource definitions.

#2 lore raw
Quoted 2 lines

By 'call', my understanding is 'access' here right?

Yes, you're right

#5 lore raw
In reply to Dennis Semakin
Quoted 4 lines · Dennis Semakin

Configuration:
Computer module is Toradex Colibri PXA320.
Board is Colibri Evaluation Board.

Quoted 8 lines

Obviously, to access the I/O register of network card, we need to map them into memory, using the ioremap() function.
To do this driver (ax88796.c) use platform_get_resource() function to get the physical address of the I/O registers from the board definition (arch/arm/mach-pxa/colibri-pxa320.c). This function returns a pointer to a struct resource, which contains two interesting fields : start and end (both are physical address). Then call ioremap function to remap the memory area returned by platform_get_resource.
Right?

Ok. When I start kernel on my board, kernel loading stops on network initialization during call to the address resource.start. So, what could I do if the address (field start in resource structure) is not valid?
Can I find it? (I mean address) Maybe I should ask something: where are ethernet chip I/O registers mapped in the memory?

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

Also see http://openpxa.sourceforge.net/ for patches to U-Boot and more information about replacing the native bootloader the modules ships with.

Daniel

#6 lore raw

Hi Daniel,

Quoted 14 lines · Daniel Mack
Quoted 4 lines · Dennis Semakin

Configuration:
Computer module is Toradex Colibri PXA320.
Board is Colibri Evaluation Board.

Quoted 8 lines

Obviously, to access the I/O register of network card, we need to map them into memory, using the ioremap() function.
To do this driver (ax88796.c) use platform_get_resource() function to get the physical address of the I/O registers from the board definition (arch/arm/mach-pxa/colibri-pxa320.c). This function returns a pointer to a struct resource, which contains two interesting fields : start and end (both are physical address). Then call ioremap function to remap the memory area returned by platform_get_resource.
Right?

Ok. When I start kernel on my board, kernel loading stops on network initialization during call to the address resource.start. So, what could I do if the address (field start in resource structure) is not valid?
Can I find it? (I mean address) Maybe I should ask something: where are ethernet chip I/O registers mapped in the memory?

Quoted 7 lines

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

I would prefer if Linux didn't rely on the boot loader for that. It's not expensive or difficult to set this register in machine setup code, is it?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
#7 lore raw
Quoted 5 lines · Uwe Kleine-K?nig
Quoted 4 lines · Daniel Mack

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

Quoted 7 lines
Quoted 3 lines

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

I would prefer if Linux didn't rely on the boot loader for that. It's not expensive or difficult to set this register in machine setup code, is it?

The boarsds I've been working on need to set this register from the bootloader anyway they use Ethernet for TFTP downloads. But you're right, in general, there should be a way to set such registers from kernel space as well. Eric, any such plans?

Daniel

#8 lore raw

2010/2/7 Daniel Mack <[email protected]>:

Quoted 14 lines · Uwe Kleine-K?nig
Quoted 5 lines · Daniel Mack
Quoted 4 lines

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

Quoted 7 lines
Quoted 3 lines

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

I would prefer if Linux didn't rely on the boot loader for that. ?It's not expensive or difficult to set this register in machine setup code, is it?

Quoted 5 lines

The boarsds I've been working on need to set this register from the bootloader anyway they use Ethernet for TFTP downloads. But you're right, in general, there should be a way to set such registers from kernel space as well. Eric, any such plans?

I think so, the setting of CSADRCFGx and others is really something like SMEMC initialization, provided we have a smemc.c, we might be able to have something generic there.

Quoted 2 lines

Daniel

#9 lore raw
In reply to Daniel Mack

Hello

I use u-boot.

Quoted 9 lines

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

Quoted 6 lines

Also see http://openpxa.sourceforge.net/ for patches to U-Boot and more information about replacing the native bootloader the modules ships with.

Daniel

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................

As I think everythig is right and corresponds to a code

int board_init (void)
{
/* arch number for linux kernel */
gd->bd->bi_arch_number = MACH_TYPE_COLIBRI320;

/* adress of boot parameters */
gd->bd->bi_boot_params = 0x80000100;

/* configuration for ethernet chip */
CKENB |= CKENB_7_GPIO;
GPIO3 = 0x00001c01;
MSC1 = 0x779;
CSADRCFG2 = 0x0032C809;

return 0;
}

Thanks
Best regards
Dennis Semakin

#10 lore raw
Quoted 24 lines · Dennis Semakin
Quoted 8 lines

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

Quoted 6 lines

Also see http://openpxa.sourceforge.net/ for patches to U-Boot and more information about replacing the native bootloader the modules ships with.

Daniel

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
Quoted 7 lines

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................

Can you access 0x1000_0000 from U-Boot? Did you switch on the clock for the static bus? This is also not done by the kernel currently.

Daniel

#11 lore raw

Hello

Quoted 17 lines
Quoted 9 lines

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
Quoted 7 lines

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................
Quoted 6 lines

Can you access 0x1000_0000 from U-Boot? Did you switch on the clock for the static bus? This is also not done by the kernel currently.

Daniel

No, I cannot access 0x1000_0000 from U-Boot. The system hangs, when I access to this address

#12 lore raw
In reply to Daniel Mack

Hello

Quoted 17 lines
Quoted 9 lines

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
Quoted 7 lines

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................
Quoted 6 lines

Can you access 0x1000_0000 from U-Boot? Did you switch on the clock for the static bus? This is also not done by the kernel currently.

Daniel

No, I cannot access 0x1000_0000 from U-Boot. The system hangs, when I access to this address

#13 lore raw
Quoted 19 lines · Dennis Semakin

Hello

Quoted 17 lines
Quoted 16 lines

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................
Quoted 8 lines
Quoted 6 lines

Can you access 0x1000_0000 from U-Boot? Did you switch on the clock for the static bus? This is also not done by the kernel currently.

Daniel

No, I cannot access 0x1000_0000 from U-Boot. The system hangs, when I access to this address

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |
#14 lore raw

Hello

Quoted 4 lines
Quoted 1 line

No, I cannot access 0x1000_0000 from U-Boot. The system hangs, when I access to this address

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

Well... I yet do not know to do this... :(

Thanks
Best regards
Dennis Semakin

#15 lore raw
In reply to Uwe Kleine-König

08.02.10, 10:13, "Uwe Kleine-K?nig" <[email protected]>:

Quoted 31 lines · Dennis Semakin
Quoted 19 lines

Hello

Quoted 17 lines
Quoted 16 lines

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................
Quoted 8 lines
Quoted 6 lines

Can you access 0x1000_0000 from U-Boot? Did you switch on the clock for the static bus? This is also not done by the kernel currently.

Daniel

No, I cannot access 0x1000_0000 from U-Boot. The system hangs, when I access to this address

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

Quoted 8 lines

Best regards
Uwe

--

 Pengutronix e.K.                              | Uwe Kleine-K?nig            |
 Industrial Linux Solutions                    | http://www.pengutronix.de/  |

Well... I yet do not know how to do this...

#16 lore raw
Quoted 6 lines · Dennis Semakin

08.02.10, 10:13, "Uwe Kleine-K?nig" <[email protected]>:

Quoted 3 lines

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

Well... I yet do not know how to do this...

Try adding this sniplet to your lowlevel_init function in U-Boot:

/* enable clocks for NAND and static memory */
ldr r0, =CKENA
ldr r1, [r0]
orr r1, r1, #(CKENA_4_NAND | CKENA_9_SMC)
str r1, [r0]
ldr r1, [r0]

Daniel

#17 lore raw

Dear Daniel
Thank you very much for code. It works fine.
If you will be in Moscow, I'll buy you a pints of beer :)

It is necessary to ask only: why in u-boot git-repository I didn't see this code?

08.02.10, 11:15, "Daniel Mack" <[email protected]>:

Quoted 10 lines · Dennis Semakin
Quoted 6 lines

08.02.10, 10:13, "Uwe Kleine-K?nig" :

Quoted 3 lines

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

Well... I yet do not know how to do this...

Try adding this sniplet to your lowlevel_init function in U-Boot:

Quoted 9 lines

/* enable clocks for NAND and static memory */
ldr r0, =CKENA
ldr r1, [r0]
orr r1, r1, #(CKENA_4_NAND | CKENA_9_SMC)
str r1, [r0]
ldr r1, [r0]

Daniel

Thanks
Best regards
Dennis Semakin

#18 lore raw
Quoted 1 line · Dennis Semakin

It is necessary to ask only: why in u-boot git-repository I didn't see this code?

It did see this code, but it wasn't taken for upstream, for reasons I cannot remember.

You should have a look at the openpxa patches provided by Marek and see if they work for you. If they don't, help fixing them.

Best regards,
Daniel

#19 lore raw
Quoted 9 lines

It did see this code, but it wasn't taken for upstream, for reasons I cannot remember.

You should have a look at the openpxa patches provided by Marek and see if they work for you. If they don't, help fixing them.

Best regards,
Daniel

Daniel,
I applied all patches from Marek's web site (openpxa). But net works only with your addings.

#20 lore raw
In reply to Daniel Mack

Dear Daniel
Thank you very much for code. It works fine.
If you will be in Moscow, I'll buy you a pints of beer :)

It is necessary to ask only: why in u-boot git-repository I didn't see this code?

08.02.10, 11:15, "Daniel Mack" <[email protected]>:

Quoted 10 lines · Dennis Semakin
Quoted 6 lines

08.02.10, 10:13, "Uwe Kleine-K?nig" :

Quoted 3 lines

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

Well... I yet do not know how to do this...

Try adding this sniplet to your lowlevel_init function in U-Boot:

Quoted 9 lines

/* enable clocks for NAND and static memory */
ldr r0, =CKENA
ldr r1, [r0]
orr r1, r1, #(CKENA_4_NAND | CKENA_9_SMC)
str r1, [r0]
ldr r1, [r0]

Daniel

Thanks
Best regards
Dennis Semakin

#21 lore raw
In reply to Uwe Kleine-König
Quoted 5 lines
Quoted 2 lines

No, I cannot access 0x1000_0000 from U-Boot. The system hangs, when I access to this address

This sounds like a missing clock. Ah, and Daniel already asked that,
too: "Did you switch on the clock for the static bus?"

If you asked about Clock Configuration Register (MEMCLKCGF), then Its value is 0x30003.

In U-Boot:

$ md.l 0x4a000068
4a000068: 00030003 00000000 00000000 00000000    ................
4a000078: 00000000 00000000 00020000 00020000    ................

How else can I switch on the clock for the static bus?

Thanks
Best regards
Dennis Semakin

#22 lore raw
In reply to Dennis Semakin
Quoted 47 lines · Dennis Semakin

Hello

I use u-boot.

Quoted 9 lines

The addresses passed to the driver is the I/O area of the chip select signal used for the Ethernet chip. This setting should be alright, as it worked well for me.

If your kernel hangs when accessing this area, you most probably haven't set up your static bus correctly. The bootloader is in charge of doing this, and the correct value for CSADRCFG2 is 0x0032C809.

Quoted 6 lines

Also see http://openpxa.sourceforge.net/ for patches to U-Boot and more information about replacing the native bootloader the modules ships with.

Daniel

In U-BOOT:

MSC1 (address 0x4a00000c) - 0x0779

$ md.w 0x4a00000c
4a00000c: 0779 0000 0000 0000 0000 0000 0000 0000 y...............
4a00001c: 0008 0000 0000 0000 0000 0000 0000 0000 ................
4a00002c: 0000 0000 0000 0000 0000 0000 0000 0000 ................
4a00003c: 0000 0000 0000 0000 0000 0000 0000 0000 ................

CSADRCFG2 (address 0x4a000088) - 0032c809

$ md.l 0x4a000088
4a000088: 0032c809 00020000 00020000 00000000 ..2.............
4a000098: 00000000 00000000 00000000 00000000 ................
4a0000a8: 00000000 00000000 00000000 00000000 ................
4a0000b8: 00000000 00000000 00000000 00000000 ................
4a0000c8: 00000000 00000000 00000000 00000000 ................

As I think everythig is right and corresponds to a code

int board_init (void)
{
/* arch number for linux kernel */
gd->bd->bi_arch_number = MACH_TYPE_COLIBRI320;

/* adress of boot parameters */
gd->bd->bi_boot_params = 0x80000100;

Quoted 9 lines

/* configuration for ethernet chip */
CKENB |= CKENB_7_GPIO;
GPIO3 = 0x00001c01;
MSC1 = 0x779;
CSADRCFG2 = 0x0032C809;

return 0;
}

As far as I remember I had to set CSMSADRCFG to allow access CS1 region on PXA300. Probably that's the bit that is missing in your setup as well. The PXA300 developer manual states that "The Chip Select Configuration Register (CSMSADRCFG) ... must be programmed with 0x02." It does not explain anything, but without explicit setting of this bit I had no CS1 activity at all ...

Quoted 8 lines

Thanks
Best regards
Dennis Semakin

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Signature · 2 lines
Sincerely yours,
Mike.