public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Andrew May <acmay@acmay.homeip.net>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] for Xilinx's ml300 board
Date: Wed, 30 Jun 2004 10:50:12 -0700	[thread overview]
Message-ID: <1088617812.22334.37.camel@mud> (raw)
In-Reply-To: <40E2CEA0.8080103@xilinx.com>

On Wed, 2004-06-30 at 07:30, Peter Ryser wrote:
> >The whole xparameters.h file is really annoying. It makes the IPIF code
> >impossible to use on more than one board type without a recompile. That
> >may be OK for U-boot but it is horrible in the Linux kernel.
> >
> Unfortunately, we have not yet found a good way to store the hardware 
> information (let's call it CROM) as part of the bitstream in a way that 
> it becomes easily available to the software. The hardware system is very 
> flexible, i.e. the location where such information is stored may be 
> different for various boards (bitstreams).
>
> One solution might be to pass the location of the CROM as part of the 
> boot parameters to the Linux kernel or even go one step further and pass 
> the whole HW configuration as a boot parameter to the Linux kernel. A 
> similar technique might be doable for u-boot.

My problem isn't really that I want to get the entire config from
hardware, but with the way the xparamters.h file is compiled into
static arrays.
So the whole point of the doing the get the device by the ID is wasted.

Here is a walk through of the current code.

In xparameters.h the defines.
===================================
#define XPAR_XEMAC_NUM_INSTANCES 1
#define XPAR_OPB_ETHERNET_0_BASEADDR 0x60000000
#define XPAR_OPB_ETHERNET_0_HIGHADDR 0x60003FFF
#define XPAR_OPB_ETHERNET_0_DEVICE_ID 0
===================================
Then the eth_init() which calls this init
Result = XEmac_Initialize(&Emac, XPAR_EMAC_0_DEVICE_ID);
===================================
which calls this lookup
XEmac_LookupConfig(DeviceId);
===================================
and then the lookup uses the table
XEmac_Config *
XEmac_LookupConfig(u16 DeviceId)
{
	XEmac_Config *CfgPtr = NULL;
	int i;

	for (i = 0; i < XPAR_XEMAC_NUM_INSTANCES; i++) {
		if (XEmac_ConfigTable[i].DeviceId == DeviceId) {
			CfgPtr = &XEmac_ConfigTable[i];
			break;
		}
	}

	return CfgPtr;
}
===================================
and then in a seperate file the actual table is statically
defined with same values from the xparmeters.h

XEmac_Config XEmac_ConfigTable[] = {
	{
	 XPAR_OPB_ETHERNET_0_DEVICE_ID,
	 XPAR_OPB_ETHERNET_0_BASEADDR,
	 XPAR_OPB_ETHERNET_0_ERR_COUNT_EXIST,
	 XPAR_OPB_ETHERNET_0_DMA_PRESENT,
	 XPAR_OPB_ETHERNET_0_MII_EXIST}
};
===================================
Now for u-boot you could really argue the whole chain of calls is a
complete waste of space. You are just using one define to get a set
of them that are compiled into the code, when it would just be as easy
to use defines directly in the XEmac_Initialize() call without going
through the middle man/functions.

Again for u-boot this is probably overkill, but for Linux it would
really help to be able to use one image on more than one board easily.

A simple change that would go a long way to help is to have the
XEmac_ConfigTable be set at run time.
something like
XEmac_Config *XEmac_ConfigTable;

XEmac_LookupConfig(u16 DeviceId)
{
	if( XEmac_ConfigTable == NULL ){
		int bt;
		bt = get_board_type();/*Checks simple HW reg or env var*/
		if( bt == 2 ){
			XEmac_ConfigTable = XEmac_table_2mac;
		}else{
			XEmac_ConfigTable = XEmac_table_1mac;
		}
	}
	/*Fixup table to be null terminated or move the size into
	 *a wrapping struct instead of the constant.
	 */
	.....
}
Since I don't think it is really a u-boot issue we can try to take this
off to another list.

  reply	other threads:[~2004-06-30 17:50 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-06-29 16:06 [U-Boot-Users] [PATCH] for Xilinx's ml300 board Sean Chang
2004-06-29 18:31 ` Andrew May
2004-06-30  0:41   ` sean chang
2004-06-30 14:30   ` Peter Ryser
2004-06-30 17:50     ` Andrew May [this message]
2004-07-11 16:26 ` Wolfgang Denk
2004-07-13 20:05   ` Andrew May
2004-07-13 21:12     ` Sean Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1088617812.22334.37.camel@mud \
    --to=acmay@acmay.homeip.net \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox