From: Chee, Tien Fong <tien.fong.chee@intel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 2/5] arm: socfpga: Restructure FPGA driver in the preparation to support A10.
Date: Fri, 12 May 2017 08:10:40 +0000 [thread overview]
Message-ID: <1494576639.6027.29.camel@intel.com> (raw)
In-Reply-To: <71bcb475-991f-cf43-6928-2a79bf06794d@denx.de>
On Jum, 2017-05-12 at 09:26 +0200, Marek Vasut wrote:
> On 05/12/2017 05:45 AM, Chee, Tien Fong wrote:
> >
> > On Kha, 2017-05-11 at 14:03 +0200, Marek Vasut wrote:
> > >
> > > On 05/11/2017 11:25 AM, tien.fong.chee at intel.com wrote:
> > > >
> > > >
> > > > From: Tien Fong Chee <tien.fong.chee@intel.com>
> > > >
> > > > Move FPGA driver which is Gen5 specific code into Gen5 driver
> > > > file
> > > > and keeping common FPGA driver intact. All the changes are
> > > > still
> > > > keeping
> > > > in driver/fpga/ and no functional change. Subsequent patch
> > > > would
> > > > move
> > > > header files into include/intel_socfpga and FPGA manager driver
> > > > from
> > > > arch/arm into driver/fpga/ .
> > > >
> > > > Signed-off-by: Tien Fong Chee <tien.fong.chee@intel.com>
> > > > ---
> [...]
> >
> > >
> > > >
> > > > +int fpgamgr_test_fpga_ready(void);
> > > > +
> > > > +#define FPGA_TIMEOUT_CNT 0x1000000
> > > Does that need to be in header file ?
> > >
> > Yeah, gen5 and Arria10 driver need this macro.
> Do they share the block of code which uses this macro ? If so, maybe
> this can be factored out into common code ? Otherwise, wrap this into
> both drivers, it's not worth to have it here ...
>
Okay, i will move them into C files.
> >
> > >
> > > >
> > > > +#ifndef __ASSEMBLY__
> > > > +
> > > > +/* Common prototypes */
> > > > +int fpgamgr_dclkcnt_set(unsigned long cnt);
> > > >
> > > > +#endif /* __ASSEMBLY__ */
> > > > #endif /* _FPGA_MANAGER_H_ */
> > > [...]
> > > >
> > > >
> > > > diff --git a/drivers/fpga/socfpga.c
> > > > b/drivers/fpga/socfpga_gen5.c
> > > > similarity index 82%
> > > > copy from drivers/fpga/socfpga.c
> > > > copy to drivers/fpga/socfpga_gen5.c
> > > > index f1b2f2c..269e81e 100644
> > > > --- a/drivers/fpga/socfpga.c
> > > > +++ b/drivers/fpga/socfpga_gen5.c
> > > > @@ -1,5 +1,5 @@
> > > > /*
> > > > - * Copyright (C) 2012 Altera Corporation <www.altera.com>
> > > > + * Copyright (C) 2012-2017 Altera Corporation <www.altera.com>
> > > Removal of code doesn't extend copyright IMO.
> > >
> > Oh....okay, understood. I will revert back.
> > >
> > > >
> > > >
> > > > * All rights reserved.
> > > > *
> > > > * SPDX-License-Identifier: BSD-3-Clause
> > > > @@ -14,9 +14,6 @@
> > > >
> > > > DECLARE_GLOBAL_DATA_PTR;
> > > >
> > > > -/* Timeout count */
> > > > -#define FPGA_TIMEOUT_CNT 0x1000000
> > > > -
> > > > static struct socfpga_fpga_manager *fpgamgr_regs =
> > > > (struct socfpga_fpga_manager
> > > > *)SOCFPGA_FPGAMGRREGS_ADDRESS;
> > > > static struct socfpga_system_manager *sysmgr_regs =
> > > > @@ -30,29 +27,6 @@ static void fpgamgr_set_cd_ratio(unsigned
> > > > long
> > > > ratio)
> > > > (ratio & 0x3) <<
> > > > FPGAMGRREGS_CTRL_CDRATIO_LSB);
> > > > }
> > > >
> > > > -static int fpgamgr_dclkcnt_set(unsigned long cnt)
> > > > -{
> > > > - unsigned long i;
> > > > -
> > > > - /* Clear any existing done status */
> > > > - if (readl(&fpgamgr_regs->dclkstat))
> > > > - writel(0x1, &fpgamgr_regs->dclkstat);
> > > > -
> > > > - /* Write the dclkcnt */
> > > > - writel(cnt, &fpgamgr_regs->dclkcnt);
> > > > -
> > > > - /* Wait till the dclkcnt done */
> > > > - for (i = 0; i < FPGA_TIMEOUT_CNT; i++) {
> > > > - if (!readl(&fpgamgr_regs->dclkstat))
> > > > - continue;
> > > > -
> > > > - writel(0x1, &fpgamgr_regs->dclkstat);
> > > > - return 0;
> > > > - }
> > > > -
> > > > - return -ETIMEDOUT;
> > > > -}
> > > > -
> > > > /* Start the FPGA programming by initialize the FPGA Manager
> > > > */
> > > > static int fpgamgr_program_init(void)
> > > > {
> > > > @@ -143,34 +117,6 @@ static int fpgamgr_program_init(void)
> > > > return 0;
> > > > }
> > > >
> > > > -/* Write the RBF data to FPGA Manager */
> > > > -static void fpgamgr_program_write(const void *rbf_data,
> > > > unsigned
> > > > long rbf_size)
> > > > -{
> > > > - uint32_t src = (uint32_t)rbf_data;
> > > > - uint32_t dst = SOCFPGA_FPGAMGRDATA_ADDRESS;
> > > > -
> > > > - /* Number of loops for 32-byte long copying. */
> > > > - uint32_t loops32 = rbf_size / 32;
> > > > - /* Number of loops for 4-byte long copying + trailing
> > > > bytes */
> > > > - uint32_t loops4 = DIV_ROUND_UP(rbf_size % 32, 4);
> > > > -
> > > > - asm volatile(
> > > > - "1: ldmia %0!, {r0-r7}\n"
> > > > - " stmia %1!, {r0-r7}\n"
> > > > - " sub %1, #32\n"
> > > > - " subs %2, #1\n"
> > > > - " bne 1b\n"
> > > > - " cmp %3, #0\n"
> > > > - " beq 3f\n"
> > > > - "2: ldr %2, [%0],
> > > > #4\n
> > > > "
> > > > - " str %2, [%1]\n"
> > > > - " subs %3, #1\n"
> > > > - " bne 2b\n"
> > > > - "3: nop\n"
> > > > - : "+r"(src), "+r"(dst), "+r"(loops32),
> > > > "+r"(loops4) :
> > > > - : "r0", "r1", "r2", "r3", "r4", "r5", "r6",
> > > > "r7",
> > > > "cc");
> > > > -}
> > > > -
> > > > /* Ensure the FPGA entering config done */
> > > > static int fpgamgr_program_poll_cd(void)
> > > > {
> > > > @@ -267,7 +213,6 @@ int socfpga_load(Altera_desc *desc, const
> > > > void
> > > > *rbf_data, size_t rbf_size)
> > > > }
> > > >
> > > > /* Prior programming the FPGA, all bridges need to be
> > > > shut
> > > > off */
> > > > -
> > > Drop this bit
> > >
> > Are you means dropping "-"? Ermm... how to drop this as this is
> > generated from git.
> You deleted a line ... re-add it ... it's generated by you, not by
> git.
>
Ohh...okay, i will revert it.
> >
> > >
> > > >
> > > > /* Disable all signals from hps peripheral controller
> > > > to
> > > > fpga */
> > > > writel(0, &sysmgr_regs->fpgaintfgrp_module);
> > > >
> > > >
>
next prev parent reply other threads:[~2017-05-12 8:10 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-11 9:25 [U-Boot] [PATCH v2 0/5] Add Intel Arria 10 SoC FPGA driver tien.fong.chee at intel.com
2017-05-11 9:25 ` [U-Boot] [PATCH v2 1/5] arm: socfpga: Remove unused passing parameter of socfpga_bridges_reset tien.fong.chee at intel.com
2017-05-11 11:57 ` Marek Vasut
2017-05-12 3:46 ` Chee, Tien Fong
2017-05-11 9:25 ` [U-Boot] [PATCH v2 2/5] arm: socfpga: Restructure FPGA driver in the preparation to support A10 tien.fong.chee at intel.com
2017-05-11 12:03 ` Marek Vasut
2017-05-12 3:45 ` Chee, Tien Fong
2017-05-12 7:26 ` Marek Vasut
2017-05-12 8:10 ` Chee, Tien Fong [this message]
2017-05-11 9:25 ` [U-Boot] [PATCH v2 3/5] arm: socfpga: Move FPGA manager driver to FPGA driver tien.fong.chee at intel.com
2017-05-11 9:25 ` [U-Boot] [PATCH v2 4/5] arm: socfpga: Move the FPGA driver header from arch/arm to include/ tien.fong.chee at intel.com
2017-05-11 12:04 ` Marek Vasut
2017-05-12 3:33 ` Chee, Tien Fong
2017-05-12 7:27 ` Marek Vasut
2017-05-12 8:06 ` Chee, Tien Fong
2017-05-11 9:25 ` [U-Boot] [PATCH v2 5/5] arm: socfpga: Add FPGA driver support for Arria 10 tien.fong.chee at intel.com
2017-05-11 12:09 ` Marek Vasut
2017-05-12 3:56 ` Chee, Tien Fong
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=1494576639.6027.29.camel@intel.com \
--to=tien.fong.chee@intel.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 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.