From: Timur Tabi <timur@freescale.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 05/14] powerpc/qoirq: Add support for FMan ethernet in Independent mode
Date: Thu, 27 Jan 2011 11:40:25 -0600 [thread overview]
Message-ID: <4D41AE09.2060308@freescale.com> (raw)
In-Reply-To: <1296103972-2696-6-git-send-email-Mingkai.hu@freescale.com>
Mingkai Hu wrote:
> +LIB := $(obj)libfm.a
Libraries are now .o files, not .a files. Take a look at the other Makefiles to
see how they've recently changed.
> +u32 fm_muram_alloc(struct fm_muram *mem, u32 size, u32 align)
> +{
> + u32 ret;
> + u32 align_mask, off;
> + u32 save;
> +
> + align_mask = align - 1;
> + save = mem->alloc;
> +
> + if ((off = (save & align_mask)) != 0)
> + mem->alloc += (align - off);
> + if ((off = size & align_mask) != 0)
> + size += (align - off);
> + if ((mem->alloc + size) >= mem->top) {
> + mem->alloc = save;
> + printf("%s: run out of ram.\n", __func__);
> + }
What exactly happens here? If you run out of memory, you return a pointer
anyway? Shouldn't you return NULL here or something?
> + /* Loop through each microcode. */
> + for (i = 0; i < firmware->count; i++) {
> + const struct qe_microcode *ucode = &firmware->microcode[i];
> +
> + /* Upload a microcode if it's present */
> + if (ucode->code_offset) {
> + printf("Fman: Uploading microcode version %u.%u.%u.\n",
> + ucode->major, ucode->minor, ucode->revision);
> + fm->ucode = (void *) CONFIG_SYS_FMAN_FW_ADDR +
> + ucode->code_offset;
Just FYI, this code will only work on systems that have NOR flash mapped to I/O
space. If the customer boots from NAND and doesn't have any NOR flash on his
board, then CONFIG_SYS_FMAN_FW_ADDR will be invalid. In addition, I don't see
any code that passes the value of CONFIG_SYS_FMAN_FW_ADDR to the kernel via
"fman_ucode".
> + /* setup TxBD */
> + txbd->buf_ptr_hi = 0;
> + txbd->buf_ptr_lo = (u32)buf;
> + txbd->len = len;
> + __asm__ __volatile__ ("sync");
Why do we sometimes do "asm("sync");" and sometimes we do "__asm__ __volatile__
("sync");"? And why do we have hard-coded asm anyway? There is a sync()
function that does this already.
> + txbd->status = TxBD_READY | TxBD_LAST;
> + __asm__ __volatile__ ("sync");
> +
> + /* update TxQD, let RISC to send the packet */
> + offset_in = muram_readw(&pram->txqd.offset_in);
> + offset_in += SIZEOFBD;
> + if (offset_in >= muram_readw(&pram->txqd.bd_ring_size))
> + offset_in = 0;
> + muram_writew(&pram->txqd.offset_in, offset_in);
> + __asm__ __volatile__ ("sync");
> +
> + /* wait for buffer to be transmitted */
> + for (i = 0; txbd->status & TxBD_READY; i++) {
> + udelay(1000);
> + if (i > 0x10000) {
> + printf("%s: Tx error\n", dev->name);
> + return 0;
> + }
> + }
If you're going to do a timeout, do it the same way everyone else does. Start
with the timeout value, and decrement the variable. Something like this:
timeout = 0x10000; (why a hex number anyway?)
while (!(txbd->status & TxBD_READY) && --timeout)
udelay(1000);
> +static void
> +__def_board_ft_fman_fixup_port(void *blob, char * prop, phys_addr_t pa,
> + enum fm_port port, int offset)
> +{
> + return ;
Delete this "return ;". It doesn't do anything.
--
Timur Tabi
Linux kernel developer at Freescale
next prev parent reply other threads:[~2011-01-27 17:40 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-27 4:52 [U-Boot] [PATCH 00/14] powerpc/p4080: add support for FMan ethernet in Independent mode Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 01/14] powerpc/p4080: Add function to report which lane is used for a prtcl Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 02/14] powerpc/fman: add PHY support for dTSEC Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 03/14] powerpc/fman: add dTSEC controller support Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 04/14] powerpc/fman: add 10GEC controller and PHY support Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 05/14] powerpc/qoirq: Add support for FMan ethernet in Independent mode Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 06/14] powerpc/corenet_ds: Add fman support Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 07/14] tsec: use IO accessories to access the register Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 08/14] tsec: arrange the code to avoid useless function declaration Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 09/14] tsec: use general ethernet MII register struct(tsec_mii_t) Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 10/14] tsec: refactor the PHY code to make it reuseable Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 11/14] PHY: add some Vitesse phy support Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 12/14] PHY: add some Broadcom " Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 13/14] PHY: add some Marvell " Mingkai Hu
2011-01-27 4:52 ` [U-Boot] [PATCH 14/14] PHY: add some misc phy code support Mingkai Hu
2011-01-27 5:44 ` [U-Boot] [PATCH 13/14] PHY: add some Marvell phy support Macpaul Lin
2011-02-02 22:48 ` [U-Boot] [PATCH 08/14] tsec: arrange the code to avoid useless function declaration Andy Fleming
2011-02-05 20:26 ` Kumar Gala
2011-02-02 22:47 ` [U-Boot] [PATCH 07/14] tsec: use IO accessories to access the register Andy Fleming
2011-02-05 20:26 ` Kumar Gala
2011-01-27 17:42 ` [U-Boot] [PATCH 06/14] powerpc/corenet_ds: Add fman support Timur Tabi
2011-01-27 17:40 ` Timur Tabi [this message]
2011-01-27 6:15 ` [U-Boot] [PATCH 02/14] powerpc/fman: add PHY support for dTSEC Kumar Gala
2011-01-27 16:10 ` Timur Tabi
2011-01-27 6:04 ` [U-Boot] [PATCH 00/14] powerpc/p4080: add support for FMan ethernet in Independent mode Kumar Gala
2011-01-27 6:09 ` Hu Mingkai-B21284
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=4D41AE09.2060308@freescale.com \
--to=timur@freescale.com \
--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