Re: [U-Boot] [T1040] Boot location and NOR flash memory mapping

2016-03-24 Thread Valentin Longchamp
York,

Thanks a lot for your answer and precisions.

On 23/03/16 16:56, york sun wrote:
> Valentin,
> 
> Your understand is correct. Please see my answers below to your questions.
> 
> On 03/23/2016 12:46 AM, Valentin Longchamp wrote:
>> Hello,
>>
>> We are currently designing a board based on the T1040 CPU from 
>> Freescale/NXP. I
>> am preparing its u-boot support and bring-up tools (JTAG) as well as
>> contributing to the hardware design. We base our work (both HW and SW) on the
>> 1040RDB dev board as our reference design. We want to use a parallel
>> ("classical", not SPI) NOR Flash to boot from and to store our RCW/PBL and 
>> u-boot.
>>
>> I have a question regarding the Boot location address when booting from the 
>> NOR
>> flash. From the documentation, it is clear that the RCW and PBL instructions 
>> are
>> read from the NOR (when cfg_rcw_src and RCW[PBI_SRC] are defined accordingly)
>> through CS0 at from the address 0x_ (RM 27.5.1, PBL Starting 
>> addresses).
>> I have not found a clear indication about this in the doc, but I guess that 
>> the
>> PBL manages to minimally configure the IFC NOR controller to make sure the
>> addresses it accesses trigger the CS0 and drives the address lines to access
>> address 0 and counting up. My understanding is that we must thus make sure 
>> that
>> the NOR Flash's CS is connected to the CS0.
>>
>> For the actual boot location (i.e. when the cores start to execute code, 
>> after
>> the RCW/PBL sequence), as stated in section 4.3.3 in the RM (Boot Space
>> Translation), the cores execute the code that is located in the 4K page 
>> located
>> at address 0x0__F000, starting with the reset vector at address
>> 0x0__FFFC, which are located in the default boot location (0x0_FF80_ 
>> to
>> 0x0__). My conclusion is that somehow, the IFC NOR controller is 
>> again
>> configured so that the accesses to this memory range will trigger the CS0 NOR
>> access (in the T1040RDB RCW/PBL, I have seen no indication that another boot
>> window than the default one is use, since the boot space translation 
>> capability
>> is unused). But since the NOR boot section (24.6.1) does not give any 
>> details, I
>> have no idea how this works.
>>
>> Now u-boot, for its T1040RDB support, uses a memory mapping for the NOR Flash
>> that is not aligned with the above boot location mapping. The 128 MB of the 
>> NOR
>> flash are mapped from 0xE800_ to 0xEFFF_. My guess about this 
>> "change"
>> it that it is to avoid the memory conflict with CCSR that is located at
>> 0x0_FE00_ by default when the NOR is bigger than 16 MB. I think this 
>> mapping
>> is only relevant later in the u-boot boot sequence, when the TLBs and LAWs 
>> are
>> configured but not at boot time.
>>
>> I have two questions about this NOR boot mechanism:
>> - how are the NOR accesses really happening (or how is the IFC NOR 
>> configured)
>> at boot time to read the RCW/PBL and the boot code at boot location ? I ask 
>> this
>> in order to make sure that our HW design will allow us to boot from the NOR
>> Flash (i.e. how we connect the NOR address bus to the IFC)
> 
> When IFC NOR flash is used for RCW_SRC (configured by hardware pins), the IFC
> defaults some registers to enable accessing to CS0. You can read the notes for
> CSPR0, CSOR0, AMASK0, etc. Basically they are set to default values based on 
> the
> RCW_SRC and 4G space is mapped to CS0. So you can see any reading accessing is
> mapped to CS0. Because we don't have NOR flash with 4GB, and we don't have 32
> address pins on NOR flash chip, you can expect to get RCW image from the
> beginning of NOR flash at multiple addresses, including zero. You can also
> expect to get reset vector at multiple addresses, including 0xfffc. So in
> short, these default settings guarantee the RCW and reset vectors are
> accessible, regardless the size of NOR flash chip.

OK, the precision about the 4G address space was the part I was missing. From
then on it's clear that you can expect the reset vector at different addresses
since not all the 32 pins are connected to the NOR chip indeed.

> 
>> - what about CONFIG_SYS_TEXT_BASE ? I see that it defined according the later
>> "u-boot" memory mapping. Why this one and not the "boot time" one ?
> 
> Since we have 128MB NOR flash chip, and other devices on IFC, the default 
> memory
> map is not enough. We need to remap them to avoid conflicts and make room. It 
> is
> done by calling ini

[U-Boot] [T1040] Boot location and NOR flash memory mapping

2016-03-23 Thread Valentin Longchamp
Hello,

We are currently designing a board based on the T1040 CPU from Freescale/NXP. I
am preparing its u-boot support and bring-up tools (JTAG) as well as
contributing to the hardware design. We base our work (both HW and SW) on the
1040RDB dev board as our reference design. We want to use a parallel
("classical", not SPI) NOR Flash to boot from and to store our RCW/PBL and 
u-boot.

I have a question regarding the Boot location address when booting from the NOR
flash. From the documentation, it is clear that the RCW and PBL instructions are
read from the NOR (when cfg_rcw_src and RCW[PBI_SRC] are defined accordingly)
through CS0 at from the address 0x_ (RM 27.5.1, PBL Starting addresses).
I have not found a clear indication about this in the doc, but I guess that the
PBL manages to minimally configure the IFC NOR controller to make sure the
addresses it accesses trigger the CS0 and drives the address lines to access
address 0 and counting up. My understanding is that we must thus make sure that
the NOR Flash's CS is connected to the CS0.

For the actual boot location (i.e. when the cores start to execute code, after
the RCW/PBL sequence), as stated in section 4.3.3 in the RM (Boot Space
Translation), the cores execute the code that is located in the 4K page located
at address 0x0__F000, starting with the reset vector at address
0x0__FFFC, which are located in the default boot location (0x0_FF80_ to
0x0__). My conclusion is that somehow, the IFC NOR controller is again
configured so that the accesses to this memory range will trigger the CS0 NOR
access (in the T1040RDB RCW/PBL, I have seen no indication that another boot
window than the default one is use, since the boot space translation capability
is unused). But since the NOR boot section (24.6.1) does not give any details, I
have no idea how this works.

Now u-boot, for its T1040RDB support, uses a memory mapping for the NOR Flash
that is not aligned with the above boot location mapping. The 128 MB of the NOR
flash are mapped from 0xE800_ to 0xEFFF_. My guess about this "change"
it that it is to avoid the memory conflict with CCSR that is located at
0x0_FE00_ by default when the NOR is bigger than 16 MB. I think this mapping
is only relevant later in the u-boot boot sequence, when the TLBs and LAWs are
configured but not at boot time.

I have two questions about this NOR boot mechanism:
- how are the NOR accesses really happening (or how is the IFC NOR configured)
at boot time to read the RCW/PBL and the boot code at boot location ? I ask this
in order to make sure that our HW design will allow us to boot from the NOR
Flash (i.e. how we connect the NOR address bus to the IFC)
- what about CONFIG_SYS_TEXT_BASE ? I see that it defined according the later
"u-boot" memory mapping. Why this one and not the "boot time" one ?

Thanks your answers

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v1] kirkwood_spi: move all pin multiplexing to spi_claim

2015-11-25 Thread Valentin Longchamp
The pin multiplexing for the chip select pin was until now done in
spi_setup_slave/spi_free_slave. If an SPI slave was probed, its chip
select pin was never configured back to the possible alternate pin usage
until spi_free_slave was called, even if the bus was released and the
pins give back to the alternate function at the end of the accesses.

This is now regrouped with the pin multiplexing for the MISO/MOSI/SCK
signals in the spi_claim_bus/spi_release_bus. It allows to make sure
that the pin multiplexing in working correctly even if an SPI slave
remains "probed/active".

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 drivers/spi/kirkwood_spi.c | 39 ---
 1 file changed, 20 insertions(+), 19 deletions(-)

diff --git a/drivers/spi/kirkwood_spi.c b/drivers/spi/kirkwood_spi.c
index e7b0982..a95ce78 100644
--- a/drivers/spi/kirkwood_spi.c
+++ b/drivers/spi/kirkwood_spi.c
@@ -21,22 +21,11 @@
 static struct kwspi_registers *spireg =
(struct kwspi_registers *)MVEBU_SPI_BASE;
 
-#ifdef CONFIG_KIRKWOOD
-static u32 cs_spi_mpp_back[2];
-#endif
-
 struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
 {
struct spi_slave *slave;
u32 data;
-#ifdef CONFIG_KIRKWOOD
-   static const u32 kwspi_mpp_config[2][2] = {
-   { MPP0_SPI_SCn, 0 }, /* if cs == 0 */
-   { MPP7_SPI_SCn, 0 } /* if cs != 0 */
-   };
-#endif
-
if (!spi_cs_is_valid(bus, cs))
return NULL;
 
@@ -58,19 +47,11 @@ struct spi_slave *spi_setup_slave(unsigned int bus, 
unsigned int cs,
writel(KWSPI_SMEMRDIRQ, >irq_cause);
writel(KWSPI_IRQMASK, >irq_mask);
 
-#ifdef CONFIG_KIRKWOOD
-   /* program mpp registers to select  SPI_CSn */
-   kirkwood_mpp_conf(kwspi_mpp_config[cs ? 1 : 0], cs_spi_mpp_back);
-#endif
-
return slave;
 }
 
 void spi_free_slave(struct spi_slave *slave)
 {
-#ifdef CONFIG_KIRKWOOD
-   kirkwood_mpp_conf(cs_spi_mpp_back, NULL);
-#endif
free(slave);
 }
 
@@ -83,8 +64,20 @@ __attribute__((weak)) int board_spi_claim_bus(struct 
spi_slave *slave)
return 0;
 }
 
+#ifdef CONFIG_KIRKWOOD
+static u32 cs_spi_mpp_back[2];
+#endif
+
 int spi_claim_bus(struct spi_slave *slave)
 {
+#ifdef CONFIG_KIRKWOOD
+   static const u32 kwspi_mpp_config[2][2] = {
+   { MPP0_SPI_SCn, 0 }, /* if cs == 0 */
+   { MPP7_SPI_SCn, 0 } /* if cs != 0 */
+   };
+   unsigned int cs = slave->cs;
+#endif
+
 #if defined(CONFIG_SYS_KW_SPI_MPP)
u32 config;
u32 spi_mpp_config[4];
@@ -113,6 +106,11 @@ int spi_claim_bus(struct spi_slave *slave)
kirkwood_mpp_conf(spi_mpp_config, spi_mpp_backup);
 #endif
 
+#ifdef CONFIG_KIRKWOOD
+   /* program mpp registers to select  SPI_CSn */
+   kirkwood_mpp_conf(kwspi_mpp_config[cs ? 1 : 0], cs_spi_mpp_back);
+#endif
+
return board_spi_claim_bus(slave);
 }
 
@@ -126,6 +124,9 @@ void spi_release_bus(struct spi_slave *slave)
kirkwood_mpp_conf(spi_mpp_backup, NULL);
 #endif
 
+#ifdef CONFIG_KIRKWOOD
+   kirkwood_mpp_conf(cs_spi_mpp_back, NULL);
+#endif
board_spi_release_bus(slave);
 }
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command

2015-11-24 Thread Valentin Longchamp
On 25/11/2015 04:52, Stefan Roese wrote:
> Hi Valentine,
> 
> On 24.11.2015 17:02, Valentin Longchamp wrote:
> 
> 
> 
>>>>> Does your board use driver model from SPI and SPI flash? If not I
>>>>> think that should be the first step.
>>>>>
>>>>
>>>> No we don't. Could you please elaborate on how this would cover this use 
>>>> case
>>>> and should be the first step ?
>>>>
>>>> I am open to other ways to cover this use case of ours, especially since 
>>>> this
>>>> was done more than 2 years ago and u-boot has changed since then. However I
>>>> don't see the direct link between the driver model and how it would allow 
>>>> to
>>>> make sure spi_flash_free() is called in our u-boot env scripts.
>>>
>>> In driver model you would have a remove() method for your SPI driver
>>> which does the required pinmux changing.
>>
>> OK, when looking at SPI flash, SPI controller driver and the driver model, I
>> have found out why we require this "release" command.
>>
>> So the SPI subsystem and its drivers (with or without DM support) make sure 
>> that
>> spi_claim_bus/release_bus are called before/after the accesses. This should
>> cover the pinmux configuration stuff.
>>
>> In our case, it was not sufficient since drivers/spi/kirkwood_spi.c does the
>> pinmux configuration at 2 places: spi_claim_bus/release_bus for the IO
>> (MOSI/MISO/CLK) AND spi_setup_slave/free_slave for the chip select.
>>
>> Since spi_free_slave is not always called after spi_setup_slave (for instance
>> after a sf probe command on the u-boot prompt), the CS pin was not always 
>> given
>> back to the NAND flash controller that's why there was a need for a sf 
>> release
>> command in our case.
>>
>> I have now moved all the pinmux configuration for kirkwood_spi into
>> spi_claim_bus/release_bus and the need for this sf release command is not
>> necessary anymore.
>>
>> I am going to test this a bit more and send a new patch series which will not
>> require this release command.
>>
>>>
>>> There is a detailed howto in doc/driver-model showing how to port your
>>> driver over. Please let me know if you need any help/ideas.
>>
>> I have had a look at it and it is a great help on porting a driver to this
>> model. That's something we plan to do for our boards eventually.
> 
> So did you already port the kirkwood SPI driver to DM? I'm asking, since
> I also do have a patch for this in the queue. I'll hopefully be able
> to post it by end of this week.

No I didn't. I was just looking at what should be done for that. For my above
problem I want to send a patch to the current driver without porting it at all.

> 
> BTW: I would love to see the Kirkwood platform to be moved over to
> arch-mvebu at some time, which already supports DM.
> 

Tell me if you're doing something in this area, I may give some help or test a
few things, according to the remaining time besides my current projects. The
Kirkwood platform would definitely be better if this was done.

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command

2015-11-24 Thread Valentin Longchamp
On 24/11/2015 02:49, Simon Glass wrote:
> Hi Valentine,
> 
> On 23 November 2015 at 02:19, Valentin Longchamp
> <valentin.longch...@keymile.com> wrote:
>> Hi Simon,
>>
>> On 20/11/2015 18:19, Simon Glass wrote:
>>> Hi,
>>>
>>> On 20 November 2015 at 03:13, Valentin Longchamp
>>> <valentin.longch...@keymile.com> wrote:
>>>> On 19/11/2015 17:57, Jagan Teki wrote:
>>>>> On 13 November 2015 at 18:55, Valentin Longchamp
>>>>> <valentin.longch...@keymile.com> wrote:
>>>>>> The release command is the pendant of the probe command. This command
>>>>>> allows to call spi_flash_free from the command line. This may be
>>>>>> necessary for some boards where sf probe does change the state of the
>>>>>> hardware (like with some pin multiplexing changes for instance).
>>>>>
>>>>> So you want to change the state of pin multiplexing on your board with
>>>>> connected slave devices example: spi nor flash is it? what exactly the
>>>>> need of releasing? why can't we use pin multiplexing changes like
>>>>> selecting or deselecting particular lines through driver or from board
>>>>> files itself.
>>>>
>>>> That's our use case yes. Let me explain you it again in detail. Some of the
>>>> signals used to access the NAND Flash and the SPI NOR are shared. At 
>>>> reset, they
>>>> are available for the SPI NOR, since u-boot is in there and the CPU then
>>>> accesses it.
>>>>
>>>> In an usual boot sequence, the SPI NOR is accessed first (copying u-boot 
>>>> to the
>>>> RAM, reading out the environment) and so the pins are configured in 
>>>> hardware at
>>>> boot time for accessing the SPI NOR. After that, they are configured to 
>>>> access
>>>> the NAND where the kernel and filesystem are stored to boot Linux thanks to
>>>> env_relocate_spec() calling spi_flash_free() on exit in conjunction with 
>>>> [1]
>>>>
>>>> Now in the case where the boot sequence is interrupted and some accesses 
>>>> are
>>>> done to the SPI NOR, the pins are changed again to SPI NOR to perform these
>>>> accesses. But we have to make sure that the pins are configured back to 
>>>> NAND by
>>>> calling spi_flash_free() after these accesses and that's why I introduced 
>>>> the
>>>> release() function.
>>>>
>>>> In our case, there are 2 types of such accesses:
>>>> - environment variables write: this is the first patch of the series. It 
>>>> simply
>>>> adds calls to spi_flash_free() at function exit no only in 
>>>> env_relocate_spec()
>>>> but also in saveenv() so that the behavior here is coherent for the whole 
>>>> env_sf
>>>> file (spi_flash_probe() at function start, spi_flash_free() at function 
>>>> exit).
>>>> - updating u-boot: this is solved for us with the last 2 patches of the 
>>>> series.
>>>> The first one just adds a sf release command that does the 
>>>> opposite/cleanup to
>>>> sf probe and the second patch just calls this command in our scripts where
>>>> u-boot is updated/the SPI NOR is written.
>>>>
>>>> We are *indeed* using pin multiplexing changes, in our case, they are
>>>> implemented in the spi controller driver: drivers/spi/kirkwood_spi.c. To 
>>>> be very
>>>> specific, in our case this sf release command allows to explicitely call
>>>> spi_flash_free() which calls spi_free_slave(), which in our case
>>>> (kirkwood_spi.c) sets the pins back to their previous configuration.
>>>
>>> Does your board use driver model from SPI and SPI flash? If not I
>>> think that should be the first step.
>>>
>>
>> No we don't. Could you please elaborate on how this would cover this use case
>> and should be the first step ?
>>
>> I am open to other ways to cover this use case of ours, especially since this
>> was done more than 2 years ago and u-boot has changed since then. However I
>> don't see the direct link between the driver model and how it would allow to
>> make sure spi_flash_free() is called in our u-boot env scripts.
> 
> In driver model you would have a remove() method for your SPI driver
> which does the required pinmux changing.

OK, when looking at SPI flash, SPI controller driver and t

Re: [U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command

2015-11-23 Thread Valentin Longchamp
Hi Simon,

On 20/11/2015 18:19, Simon Glass wrote:
> Hi,
> 
> On 20 November 2015 at 03:13, Valentin Longchamp
> <valentin.longch...@keymile.com> wrote:
>> On 19/11/2015 17:57, Jagan Teki wrote:
>>> On 13 November 2015 at 18:55, Valentin Longchamp
>>> <valentin.longch...@keymile.com> wrote:
>>>> The release command is the pendant of the probe command. This command
>>>> allows to call spi_flash_free from the command line. This may be
>>>> necessary for some boards where sf probe does change the state of the
>>>> hardware (like with some pin multiplexing changes for instance).
>>>
>>> So you want to change the state of pin multiplexing on your board with
>>> connected slave devices example: spi nor flash is it? what exactly the
>>> need of releasing? why can't we use pin multiplexing changes like
>>> selecting or deselecting particular lines through driver or from board
>>> files itself.
>>
>> That's our use case yes. Let me explain you it again in detail. Some of the
>> signals used to access the NAND Flash and the SPI NOR are shared. At reset, 
>> they
>> are available for the SPI NOR, since u-boot is in there and the CPU then
>> accesses it.
>>
>> In an usual boot sequence, the SPI NOR is accessed first (copying u-boot to 
>> the
>> RAM, reading out the environment) and so the pins are configured in hardware 
>> at
>> boot time for accessing the SPI NOR. After that, they are configured to 
>> access
>> the NAND where the kernel and filesystem are stored to boot Linux thanks to
>> env_relocate_spec() calling spi_flash_free() on exit in conjunction with [1]
>>
>> Now in the case where the boot sequence is interrupted and some accesses are
>> done to the SPI NOR, the pins are changed again to SPI NOR to perform these
>> accesses. But we have to make sure that the pins are configured back to NAND 
>> by
>> calling spi_flash_free() after these accesses and that's why I introduced the
>> release() function.
>>
>> In our case, there are 2 types of such accesses:
>> - environment variables write: this is the first patch of the series. It 
>> simply
>> adds calls to spi_flash_free() at function exit no only in 
>> env_relocate_spec()
>> but also in saveenv() so that the behavior here is coherent for the whole 
>> env_sf
>> file (spi_flash_probe() at function start, spi_flash_free() at function 
>> exit).
>> - updating u-boot: this is solved for us with the last 2 patches of the 
>> series.
>> The first one just adds a sf release command that does the opposite/cleanup 
>> to
>> sf probe and the second patch just calls this command in our scripts where
>> u-boot is updated/the SPI NOR is written.
>>
>> We are *indeed* using pin multiplexing changes, in our case, they are
>> implemented in the spi controller driver: drivers/spi/kirkwood_spi.c. To be 
>> very
>> specific, in our case this sf release command allows to explicitely call
>> spi_flash_free() which calls spi_free_slave(), which in our case
>> (kirkwood_spi.c) sets the pins back to their previous configuration.
> 
> Does your board use driver model from SPI and SPI flash? If not I
> think that should be the first step.
> 

No we don't. Could you please elaborate on how this would cover this use case
and should be the first step ?

I am open to other ways to cover this use case of ours, especially since this
was done more than 2 years ago and u-boot has changed since then. However I
don't see the direct link between the driver model and how it would allow to
make sure spi_flash_free() is called in our u-boot env scripts.

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] U-boot broken on e500v2 soc

2015-11-23 Thread Valentin Longchamp
Hi York,

On 21/11/2015 07:33, York Sun wrote:
> Valentin,
> 
> Can you refresh my memory why you needed this
> commitac337168ad81a18e768e5e3cfff8d229adeb2b25 (patch
> http://patchwork.ozlabs.org/patch/455439)?
> Today I bisect an issue back to this commit.

In the patch description, there is a link to another patch that introduced some
problems with the bootcounter driver
(http://patchwork.ozlabs.org/patch/448849/). On the Keymile boards, we use this
bootcounter functionality that must call dcache_flush after the above change.
Tom suggested that powerpc required the kernel's corresponding cache function
from arch/powerpc/kernel/misc_32.S ported over to u-boot. That's what I did and
it allowed to solve the bootcounter problem.

Unfortunately, we don't have e500v2 CPUs at Keymile, only e300 and e500mc so
this patch was not tested from my side on e500v2 either.

Valentin

> 
> Scott,
> 
> Can you help to examine this u-boot commit? Before this commit,
> 512x/5xxx/83xx/85xx do nothing on function invalidate_dcache_range() and
> flush_dcache_range(). With this patch, I found e500v2 is broken on Intel e1000
> card when testing v2016-rc1. I didn't catch this issue when testing this 
> patch.
> 
> I wonder if this code is not safe for e500v2, or because the cache line size
> should be determined by reading L1CFG0. Why didn't we see any issue with Linux
> with the same code.
> 
> Log for testing on e500v2
> 
> P1023RDB
> 
> U-Boot 2016.01-rc1-00115-g2b24e09 (Nov 20 2015 - 22:01:56 -0800)
> 
> CPU0:  P1023E, Version: 1.1, (0x80fe0011)
> Core:  e500, Version: 5.1, (0x80212151)
> Clock Configuration:
>CPU0:500  MHz, CPU1:500  MHz,
>CCB:333.333 MHz,
>DDR:333.333 MHz (666.667 MT/s data rate) (Asynchronous), LBC:41.667 MHz
>FMAN1: 333.333 MHz
>QMAN:  0 MHz
> L1:D-cache 32 KiB enabled
>I-cache 32 KiB enabled
> Board: P1023 RDB
> I2C:   ready
> DRAM:  DIMM 0: is not a DDR3 SPD.
> SPD error on controller 0! Trying fallback to raw timing calculation
> Detected UDIMM Fixed DDR on board
> 512 MiB (DDR3, 32-bit, CL=5, ECC off)
> Flash: 64 MiB
> L2:256 KiB enabled
> NAND:  128 MiB
> EEPROM: CRC mismatch (a7fdad5b != )
> PCIe1: Root Complex of Slot 1, no link, regs @ 0xff60a000
> PCIe1: Bus 00 - 00
> PCIe2: Root Complex of Slot 2, x1 gen1, regs @ 0xff609000
>   02:00.0 - 8086:107d - Network controller
> PCIe2: Bus 01 - 02
> PCIe3: Root Complex of Slot 3, x1 gen1, regs @ 0xff60b000
>   04:00.0 - 168c:0030 - Network controller
> PCIe3: Bus 03 - 04
> In:serial
> Out:   serial
> Err:   serial
> Net:   Fman1: Uploading microcode version 160.0.18
> e1000: 00:15:17:8e:7b:8d
>FM1@DTSEC1, FM1@DTSEC2, e1000#0 [PRIME]
> Warning: e1000#0 MAC addresses don't match:
> Address in SROM is 00:15:17:8e:7b:8d
> Address in environment is  00:e0:0c:00:06:02
> 
> => ping $serverip
> Using e1000#0 device
> Bad trap at PC: 1ffc6f10, SR: 6049434, vector=e00
> NIP: 1FFC6F10 XER:  LR: 1FEF0B6C REGS: 1f8eda70 TRAP: 0e00 DAR: 
> 2000
> MSR: 06049434 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
> 
> GPR00: 1FF457D4 1F8EDB60 1F8EDF14 2000 0002 001F  1F8EDAB8
> GPR08: A0003818 4000 0003 1F8EDB80 1FF457D4 EC662032 1FFC8D50 1FFC6F24
> GPR16: 1FFB0074 1FFB005C 1FF59701 1FF5971F 1FF49C37 1FFB0068  1FFC6F10
> GPR24: 1FFB00CC 1FF48D60  1F8F3D70 1FFC5600 0040 1FF5C610 0040
> Call backtrace:
> 1FF2F350 1FF457D4 1FF06888 1FF13AF8 1FEFA180 1FEFA7FC 1FEF9A90
> 1FEFA124 1FEFA7FC 1FEFAA1C 1FF12B54 1FEFB140 1FF3AA7C 1FEFB454
> 1FEF0F4C
> Exception in kernel pc 1ffc6f10 signal 0
> ### ERROR ### Please RESET the board ###
> 
> 
> P1022DS log
> 
> U-Boot 2016.01-rc1-00115-g2b24e09 (Nov 20 2015 - 22:17:10 -0800)
> 
> CPU0:  P1022E, Version: 1.0, (0x80ee0010)
> Core:  e500, Version: 5.0, (0x80211050)
> Clock Configuration:
>CPU0:999.990 MHz, CPU1:999.990 MHz,
>CCB:499.995 MHz,
>DDR:333.330 MHz (666.660 MT/s data rate) (Asynchronous), LBC:31.250 MHz
> L1:D-cache 32 KiB enabled
>I-cache 32 KiB enabled
> Board: P1022DS Sys ID: 0x19, Sys Ver: 0x03, FPGA Ver: 0x09, vBank: 0
> I2C:   ready
> SPI:   ready
> DRAM:  Detected RDIMM 18JSF51272PDZ1G4D1
> Detected 4 GiB of memory
>This U-Boot only supports < 4G of DDR
>You could rebuild it with CONFIG_PHYS_64BIT
>2 GiB (DDR3, 64-bit, CL=5, ECC off)
> Flash: 128 MiB
> L2:256 KiB enabled
> NAND:  1024 MiB
> MMC:   FSL_SDHC: 0
> EEPROM: NXID v0
> PCIe1: Root Complex of Slot 1, no link, regs @ 0xffe0a000
> PCIe1: Bus 00 - 00
> PCIe2: Root Complex of Slot 3, x1 gen1, regs @ 0xffe09000
>   02:00.0 - 8086:10b9 - Network controller
> PCIe2: Bus 01 - 02
> PCIe3: Root Complex of Slot 2, no link, regs @ 0xffe0b000
> PCIe3: Bus 03 - 03
> In:serial
> Out:   serial
> Err:   serial
> Net:   e1000: 00:15:17:0b:8c:74
>eTSEC1, eTSEC2, e1000#0 [PRIME]
> Hit any key to stop autoboot:  0
> => ping $serverip
> Using e1000#0 device
> 

Re: [U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command

2015-11-20 Thread Valentin Longchamp
On 19/11/2015 17:57, Jagan Teki wrote:
> On 13 November 2015 at 18:55, Valentin Longchamp
> <valentin.longch...@keymile.com> wrote:
>> The release command is the pendant of the probe command. This command
>> allows to call spi_flash_free from the command line. This may be
>> necessary for some boards where sf probe does change the state of the
>> hardware (like with some pin multiplexing changes for instance).
> 
> So you want to change the state of pin multiplexing on your board with
> connected slave devices example: spi nor flash is it? what exactly the
> need of releasing? why can't we use pin multiplexing changes like
> selecting or deselecting particular lines through driver or from board
> files itself.

That's our use case yes. Let me explain you it again in detail. Some of the
signals used to access the NAND Flash and the SPI NOR are shared. At reset, they
are available for the SPI NOR, since u-boot is in there and the CPU then
accesses it.

In an usual boot sequence, the SPI NOR is accessed first (copying u-boot to the
RAM, reading out the environment) and so the pins are configured in hardware at
boot time for accessing the SPI NOR. After that, they are configured to access
the NAND where the kernel and filesystem are stored to boot Linux thanks to
env_relocate_spec() calling spi_flash_free() on exit in conjunction with [1]

Now in the case where the boot sequence is interrupted and some accesses are
done to the SPI NOR, the pins are changed again to SPI NOR to perform these
accesses. But we have to make sure that the pins are configured back to NAND by
calling spi_flash_free() after these accesses and that's why I introduced the
release() function.

In our case, there are 2 types of such accesses:
- environment variables write: this is the first patch of the series. It simply
adds calls to spi_flash_free() at function exit no only in env_relocate_spec()
but also in saveenv() so that the behavior here is coherent for the whole env_sf
file (spi_flash_probe() at function start, spi_flash_free() at function exit).
- updating u-boot: this is solved for us with the last 2 patches of the series.
The first one just adds a sf release command that does the opposite/cleanup to
sf probe and the second patch just calls this command in our scripts where
u-boot is updated/the SPI NOR is written.

We are *indeed* using pin multiplexing changes, in our case, they are
implemented in the spi controller driver: drivers/spi/kirkwood_spi.c. To be very
specific, in our case this sf release command allows to explicitely call
spi_flash_free() which calls spi_free_slave(), which in our case
(kirkwood_spi.c) sets the pins back to their previous configuration.

> 
>>
>> Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
>> ---
>>
>> Changes in v3:
>> - Rebased on v2015.10
>>
>> Changes in v2:
>> - Rebased on v2014.10
>>
>>  common/cmd_sf.c | 11 +++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/common/cmd_sf.c b/common/cmd_sf.c
>> index ac7f5df..9c51dca 100644
>> --- a/common/cmd_sf.c
>> +++ b/common/cmd_sf.c
>> @@ -152,6 +152,14 @@ static int do_spi_flash_probe(int argc, char * const 
>> argv[])
>> return 0;
>>  }
>>
>> +static int do_spi_flash_release(int argc, char * const argv[])
>> +{
>> +   if (flash)
>> +   spi_flash_free(flash);
>> +   flash = NULL;
>> +
>> +   return 0;
>> +}
>>  /**
>>   * Write a block of data to SPI flash, first checking if it is different 
>> from
>>   * what is already there.
>> @@ -540,6 +548,8 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int 
>> argc,
>> ret = do_spi_flash_read_write(argc, argv);
>> else if (strcmp(cmd, "erase") == 0)
>> ret = do_spi_flash_erase(argc, argv);
>> +   else if (strcmp(cmd, "release") == 0)
>> +   ret = do_spi_flash_release(argc, argv);
>>  #ifdef CONFIG_CMD_SF_TEST
>> else if (!strcmp(cmd, "test"))
>> ret = do_spi_flash_test(argc, argv);
>> @@ -579,5 +589,6 @@ U_BOOT_CMD(
>> "sf update addr offset|partition len- erase and write `len' 
>> bytes from memory\n"
>> " at `addr' to flash at 
>> `offset'\n"
>> " or to start of mtd 
>> `partition'\n"
>> +   "sf release - release the current flash 
>> device\n"
>> SF_TEST_HELP
>>  );
>> --
>> 1.8.3.1
>>
>> ___
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
> 
> 
> 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH V2 06/12] board: keymile: Move common headers to board-common directory

2015-11-18 Thread Valentin Longchamp
On 13/11/2015 06:43, Nishanth Menon wrote:
> Header files can be located in a generic location without
> needing to reference them with ../common/
> 
> Generated with the following script
> 
>  #!/bin/bash
> vendor=board/keymile
> common=$vendor/common
> 
> cfiles=`git grep "../common" $vendor|grep "#include"|cut -d '"' -f2|sort 
> -u|grep c$`
> headers=`git grep "../common" $vendor|grep "#include"|cut -d '"' -f2|sort 
> -u|grep h$`
> 
> mkdir -p $common/include/board-common
> set -x
> for header in $headers
> do
>   echo "processing $header in $common"
>   hbase=`basename $header`
>   git mv $common/$hbase $common/include/board-common
>   sed -i -e "s/\"..\/common\/$hbase\"/<board-common\/$hbase>/g" 
> $vendor/*/*.[chS]
>   sed -i -e "s/\"$hbase\"/<board-common\/$hbase>/g" $vendor/common/*.[chS]
> done
> 
> Cc: Valentin Longchamp <valentin.longch...@keymile.com>
> Cc: Holger Brunck <holger.bru...@keymile.com>
> 
> Signed-off-by: Nishanth Menon <n...@ti.com>

This was successfully tested on several Keymile boards and it is good that the
Keymile boards also follow this new board/common include scheme.

Acked-by: Valentin Longchamp <valentin.longch...@keymile.com>

> ---
>  board/keymile/common/common.c| 2 +-
>  board/keymile/common/{ => include/board-common}/common.h | 0
>  board/keymile/common/ivm.c   | 2 +-
>  board/keymile/km82xx/km82xx.c| 2 +-
>  board/keymile/km83xx/km83xx.c| 2 +-
>  board/keymile/km83xx/km83xx_i2c.c| 2 +-
>  board/keymile/km_arm/km_arm.c| 2 +-
>  board/keymile/kmp204x/kmp204x.c  | 2 +-
>  board/keymile/kmp204x/qrio.c | 2 +-
>  9 files changed, 8 insertions(+), 8 deletions(-)
>  rename board/keymile/common/{ => include/board-common}/common.h (100%)
> 
> diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
> index b9aff1a84dcb..4f8b68ee5ccd 100644
> --- a/board/keymile/common/common.c
> +++ b/board/keymile/common/common.c
> @@ -21,7 +21,7 @@
>  #if defined(CONFIG_POST)
>  #include "post.h"
>  #endif
> -#include "common.h"
> +#include 
>  #include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
> diff --git a/board/keymile/common/common.h 
> b/board/keymile/common/include/board-common/common.h
> similarity index 100%
> rename from board/keymile/common/common.h
> rename to board/keymile/common/include/board-common/common.h
> diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
> index 42db54221bb3..4d2963ad5f84 100644
> --- a/board/keymile/common/ivm.c
> +++ b/board/keymile/common/ivm.c
> @@ -8,7 +8,7 @@
>  #include 
>  #include 
>  #include 
> -#include "common.h"
> +#include 
>  
>  #define MAC_STR_SZ   20
>  
> diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
> index c599b4093626..73d22dc6ac19 100644
> --- a/board/keymile/km82xx/km82xx.c
> +++ b/board/keymile/km82xx/km82xx.c
> @@ -16,7 +16,7 @@
>  #endif
>  
>  #include 
> -#include "../common/common.h"
> +#include 
>  
>  static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
>  
> diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
> index 89e9e1e57c38..83deca56aebc 100644
> --- a/board/keymile/km83xx/km83xx.c
> +++ b/board/keymile/km83xx/km83xx.c
> @@ -26,7 +26,7 @@
>  #include 
>  #include 
>  
> -#include "../common/common.h"
> +#include 
>  
>  static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
>  
> diff --git a/board/keymile/km83xx/km83xx_i2c.c 
> b/board/keymile/km83xx/km83xx_i2c.c
> index c961937530ac..e702a5cf86e2 100644
> --- a/board/keymile/km83xx/km83xx_i2c.c
> +++ b/board/keymile/km83xx/km83xx_i2c.c
> @@ -9,7 +9,7 @@
>  #include 
>  #include 
>  #include 
> -#include "../common/common.h"
> +#include 
>  
>  static void i2c_write_start_seq(void)
>  {
> diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
> index 2938861f368f..82fa31c2208d 100644
> --- a/board/keymile/km_arm/km_arm.c
> +++ b/board/keymile/km_arm/km_arm.c
> @@ -23,7 +23,7 @@
>  #include 
>  #include 
>  
> -#include "../common/common.h"
> +#include 
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
> index eebb47fc21f1..fbe6d98af6ce 100644
> --- a/board/keymile/kmp204

[U-Boot] [PATCH v2 15/15] km/powerpc: fix ft_board_setup prototype for km82xx & km83xx

2015-11-17 Thread Valentin Longchamp
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>

---

Changes in v2:
- Removed support for kmvect1_p1a: not relevant anymore

 board/keymile/km82xx/km82xx.c | 2 +-
 board/keymile/km83xx/km83xx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 9e285ec..c2a7a5f 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -447,7 +447,7 @@ int get_scl(void)
return get_pin(SCL_MASK, 3);
 }
 
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 1164c2e..154f974 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -361,7 +361,7 @@ int checkboard(void)
return 0;
 }
 
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 11/15] board/keymile/km82xx: setting dip_switch 3 and 4 will run bootloader

2015-11-17 Thread Valentin Longchamp
From: Bagavathiannan Palanisamy <bagavathiannan.palanis...@keymile.com>

Setting dip_switch 3 and 4 also will run bootloader in COGE3 and COGE6
It is required remove local mgmt IP address, when DIP Switch PIN3 is
enabled. DIP Switch 4 also enabled to avoid u-boot update in future
for DIP switch enhancements.

Signed-off-by: Bagavathiannan Palanisamy <bagavathiannan.palanis...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 board/keymile/km82xx/km82xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 01a3c20..9e285ec 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -329,8 +329,8 @@ int last_stage_init(void)
 
dip_switch = in_8(>mswitch);
dip_switch &= BFTICU_DIPSWITCH_MASK;
-   /* dip switch 'full reset' or 'db erase' */
-   if (dip_switch & 0x1 || dip_switch & 0x2) {
+   /* dip switch 'full reset' or 'db erase' or 'Local mgmt IP' or any */
+   if (dip_switch != 0) {
/* start bootloader */
puts("DIP:   Enabled\n");
setenv("actual_bank", "0");
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 09/15] powerpc/km8309: define CONFIG_SYS_DDRCDR

2015-11-17 Thread Valentin Longchamp
For consistency with all the other km83xx plaforms, this should also be
defined for km8309. The same settings as for km8321 are taken.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 include/configs/km/km8309-common.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/km/km8309-common.h 
b/include/configs/km/km8309-common.h
index ec133f9..d7f6cb1 100644
--- a/include/configs/km/km8309-common.h
+++ b/include/configs/km/km8309-common.h
@@ -99,6 +99,12 @@
HRCWH_BIG_ENDIAN | \
HRCWH_LALE_NORMAL)
 
+#define CONFIG_SYS_DDRCDR (\
+   DDRCDR_EN | \
+   DDRCDR_PZ_MAXZ | \
+   DDRCDR_NZ_MAXZ | \
+   DDRCDR_M_ODR)
+
 #define CONFIG_SYS_DDR_CS0_BNDS0x007f
 #define CONFIG_SYS_DDR_SDRAM_CFG   (SDRAM_CFG_SDRAM_TYPE_DDR2 | \
 SDRAM_CFG_32_BE | \
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 14/15] powerpc/83xx: add support for kmtegr1 board

2015-11-17 Thread Valentin Longchamp
This board uses the same CPU (8309) as VECT1. The memory however is
different since it has NAND Flash, the NOR Flash partitioning is
different and of course the FPGAs as well.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
Signed-off-by: Christoph Dietrich <christoph.dietr...@keymile.com>
---

Changes in v2: None

 board/keymile/km83xx/MAINTAINERS |  1 +
 configs/kmtegr1_defconfig|  4 +++
 include/configs/suvd3.h  | 65 +---
 3 files changed, 66 insertions(+), 4 deletions(-)
 create mode 100644 configs/kmtegr1_defconfig

diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS
index c4c3183..63b0651 100644
--- a/board/keymile/km83xx/MAINTAINERS
+++ b/board/keymile/km83xx/MAINTAINERS
@@ -9,6 +9,7 @@ F:  include/configs/tuxx1.h
 F: configs/kmopti2_defconfig
 F: configs/kmtepr2_defconfig
 F: include/configs/suvd3.h
+F: configs/kmtegr1_defconfig
 F: configs/kmvect1_defconfig
 F: configs/suvd3_defconfig
 F: configs/tuge1_defconfig
diff --git a/configs/kmtegr1_defconfig b/configs/kmtegr1_defconfig
new file mode 100644
index 000..aee9886
--- /dev/null
+++ b/configs/kmtegr1_defconfig
@@ -0,0 +1,4 @@
+CONFIG_SYS_EXTRA_OPTIONS="KMTEGR1"
+CONFIG_PPC=y
+CONFIG_MPC83xx=y
+CONFIG_TARGET_SUVD3=y
diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h
index fddba92..af8730a 100644
--- a/include/configs/suvd3.h
+++ b/include/configs/suvd3.h
@@ -29,13 +29,48 @@
 #define CONFIG_KM_BOARD_NAME   "suvd3"
 /* include common defines/options for all 8321 Keymile boards */
 #include "km/km8321-common.h"
+
 #elif defined(CONFIG_KMVECT1)   /* VECT1 board specific */
 #define CONFIG_HOSTNAMEkmvect1
 #define CONFIG_KM_BOARD_NAME   "kmvect1"
+/* at end of uboot partition, before env */
+#define CONFIG_SYS_QE_FW_ADDR   0xF00B
+/* include common defines/options for all 8309 Keymile boards */
+#include "km/km8309-common.h"
+
+#elif defined(CONFIG_KMTEGR1)   /* TEGR1 board specific */
+#define CONFIG_HOSTNAME   kmtegr1
+#define CONFIG_KM_BOARD_NAME   "kmtegr1"
+#define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
+#define CONFIG_KM_UBI_PARTITION_NAME_APP   "ubi1"
+#define MTDIDS_DEFAULT "nor0=boot,nand0=app"
+#define MTDPARTS_DEFAULT   "mtdparts=" \
+   "boot:" \
+   "768k(u-boot)," \
+   "256k(qe-fw),"  \
+   "128k(env),"\
+   "128k(envred)," \
+   "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ");" \
+   "app:"  \
+   "-(" CONFIG_KM_UBI_PARTITION_NAME_APP ");"
+
+#define CONFIG_ENV_ADDR0xF010
+#define CONFIG_ENV_OFFSET  0x10
+
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ECC_BCH
+#define CONFIG_BCH
+#define CONFIG_NAND_KMETER1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define NAND_MAX_CHIPS 1
+
 /* include common defines/options for all 8309 Keymile boards */
 #include "km/km8309-common.h"
+/* must be after the include because KMBEC_FPGA is otherwise undefined */
+#define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */
+
 #else
-#error Supported boards are: SUVD3, KMVECT1
+#error Supported boards are: SUVD3, KMVECT1, KMTEGR1
 #endif
 
 #define CONFIG_SYS_APP1_BASE   0xA000
@@ -56,6 +91,7 @@
  *
  */
 
+#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1)
 /*
  * APP1 on the local bus CS2
  */
@@ -82,14 +118,26 @@
 0xc000 | \
 MxMR_WLFx_2X)
 
+#elif defined(CONFIG_KMTEGR1)
+#define CONFIG_SYS_BR3_PRELIM (CONFIG_SYS_APP2_BASE | \
+BR_PS_16 | \
+BR_MS_GPCM | \
+BR_V)
+
+#define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_APP2_SIZE) | \
+OR_GPCM_SCY_5 | \
+OR_GPCM_TRLX_CLEAR | \
+OR_GPCM_EHTR_CLEAR)
+
+#endif /* CONFIG_KMTEGR1 */
+
 #define CONFIG_SYS_LBLAWBAR3_PRELIMCONFIG_SYS_APP2_BASE
 #define CONFIG_SYS_LBLAWAR3_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
 
 /*
  * MMU Setup
  */
-
-
+#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1)
 /* APP1:  icache cacheable, but dcache-inhibit and guarded */
 #define CONFIG_SYS_IBAT5L  (CONFIG_SYS_APP1_BASE | BATL_PP_RW | \
 BATL_MEMCOHER

[U-Boot] [PATCH v2 04/15] km/powerpc: increase space for kernel imange and FDT blob

2015-11-17 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

128kByte and 3,986MB may be in the future too little for kernel the fdt
blob respectively the kernel image. So increase the reserved areas here,
we have the space for this.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 include/configs/km/km-powerpc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index eb85a74..8121e5c 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -63,9 +63,9 @@
  * is not valid yet, which is the case for when u-boot copies itself to RAM */
 #define CONFIG_PRAM((CONFIG_KM_PNVRAM + CONFIG_KM_PHRAM)>>10)
 
-#define CONFIG_KM_CRAMFS_ADDR  0x80
-#define CONFIG_KM_KERNEL_ADDR  0x40/* 3968Kbytes */
-#define CONFIG_KM_FDT_ADDR 0x7E/* 128Kbytes */
+#define CONFIG_KM_CRAMFS_ADDR  0xC0
+#define CONFIG_KM_KERNEL_ADDR  0x40/* 7680Kbytes */
+#define CONFIG_KM_FDT_ADDR 0xB8/* 512Kbytes */
 
 /* architecture specific default bootargs */
 #define CONFIG_KM_DEF_BOOT_ARGS_CPU""
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 13/15] km8309: change the default QE_FW address

2015-11-17 Thread Valentin Longchamp
It should be after the u-boot reserved sectors and before the env
sectors, since the solution used for kmvect1 (tell the linker to put the
firmware into the u-boot produced binary, at the end of the area) should
be the exception.

The #define is only "conditional" so that we can still support kmvect1.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 include/configs/km/km8309-common.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km8309-common.h 
b/include/configs/km/km8309-common.h
index d7f6cb1..a69fdf1 100644
--- a/include/configs/km/km8309-common.h
+++ b/include/configs/km/km8309-common.h
@@ -29,8 +29,10 @@
 
 /* QE microcode/firmware address */
 #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
-/* at end of uboot partition, before env */
-#define CONFIG_SYS_QE_FW_ADDR   0xF00B
+/* between the u-boot partition and env */
+#ifndef CONFIG_SYS_QE_FW_ADDR
+#define CONFIG_SYS_QE_FW_ADDR   0xF00C
+#endif
 
 /*
  * System IO Config
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 10/15] powerpc/km8360: fix the ODT parameters for CS0

2015-11-17 Thread Valentin Longchamp
The ODT parameters for km8360 set the ODT_WR_ACS bit in u-boot KM-2011.09
that is used in the release bootpackage for kmcoge5ne. During the
transition from the kmeter1 to km8360 this was changed to
ODT_RD_ONLY_CURRENT, which is uncorrect and causes faulty RAM accesses at
low temperatures.

This is now changed to ODT_WR_ONLY_CURRENT which is the equivalent of
ODT_WR_ACS.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>

---

Changes in v2:
- Rewritten commit message to get rid of internal git commit reference

 include/configs/km8360.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/km8360.h b/include/configs/km8360.h
index 04cde46..5034fda 100644
--- a/include/configs/km8360.h
+++ b/include/configs/km8360.h
@@ -100,7 +100,7 @@
 #define CONFIG_SYS_DDR_CS0_CONFIG (\
CSCONFIG_EN | \
CSCONFIG_AP | \
-   CSCONFIG_ODT_RD_ONLY_CURRENT | \
+   CSCONFIG_ODT_WR_ONLY_CURRENT | \
CSCONFIG_BANK_BIT_3 | \
CSCONFIG_ROW_BIT_13 | \
CSCONFIG_COL_BIT_10)
@@ -108,7 +108,7 @@
 #define CONFIG_SYS_DDR_CS0_CONFIG  (CSCONFIG_EN | CSCONFIG_AP | \
 CSCONFIG_ROW_BIT_13 | \
 CSCONFIG_COL_BIT_10 | \
-CSCONFIG_ODT_RD_ONLY_CURRENT)
+CSCONFIG_ODT_WR_ONLY_CURRENT)
 #endif
 
 #define CONFIG_SYS_DDR_CLK_CNTL (\
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 06/15] km/powerpc: remove unneeded defines

2015-11-17 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

We use CONFIG_OF_LIBFDT and CONFIG_OF_BOARD_SETUP on all our powerpc
targets, so there is no need to check these defines within our C code.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>

---

Changes in v2:
- Removed merge conflict files in commit message

 board/keymile/km82xx/km82xx.c | 8 ++--
 board/keymile/km83xx/km83xx.c | 4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index cc9a7c9..70f816b 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -11,10 +11,7 @@
 #include 
 #include 
 
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
 #include 
-#endif
-
 #include 
 #include "../common/common.h"
 
@@ -465,14 +462,13 @@ static void setports(int gpio)
}
 }
 #endif
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-int ft_board_setup(void *blob, bd_t *bd)
+
+void ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
return 0;
 }
-#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
 
 #if defined(CONFIG_MGCOGE3NE)
 int get_testpin(void)
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 89e9e1e..1164c2e 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -361,14 +361,12 @@ int checkboard(void)
return 0;
 }
 
-#if defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, bd_t *bd)
+void ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
return 0;
 }
-#endif
 
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 01/15] powerpc/83xx: add support for kmtepr2 board

2015-11-17 Thread Valentin Longchamp
From: Christoph Dietrich <christoph.dietr...@keymile.com>

This board is similar to TUXX1, but it has differend FPGAs.

Signed-off-by: Christoph Dietrich <christoph.dietr...@keymile.com>
Signed-off-by: Andreas Huber <andreas.hu...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 board/keymile/km83xx/MAINTAINERS |  1 +
 configs/kmtepr2_defconfig|  4 
 include/configs/tuxx1.h  | 43 +---
 3 files changed, 41 insertions(+), 7 deletions(-)
 create mode 100644 configs/kmtepr2_defconfig

diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS
index cee7e08..c4c3183 100644
--- a/board/keymile/km83xx/MAINTAINERS
+++ b/board/keymile/km83xx/MAINTAINERS
@@ -7,6 +7,7 @@ F:  configs/kmcoge5ne_defconfig
 F: configs/kmeter1_defconfig
 F: include/configs/tuxx1.h
 F: configs/kmopti2_defconfig
+F: configs/kmtepr2_defconfig
 F: include/configs/suvd3.h
 F: configs/kmvect1_defconfig
 F: configs/suvd3_defconfig
diff --git a/configs/kmtepr2_defconfig b/configs/kmtepr2_defconfig
new file mode 100644
index 000..5cffd53
--- /dev/null
+++ b/configs/kmtepr2_defconfig
@@ -0,0 +1,4 @@
+CONFIG_SYS_EXTRA_OPTIONS="KMTEPR2"
+CONFIG_PPC=y
+CONFIG_MPC83xx=y
+CONFIG_TARGET_TUXX1=y
diff --git a/include/configs/tuxx1.h b/include/configs/tuxx1.h
index 08ead7f..e2ca9e3 100644
--- a/include/configs/tuxx1.h
+++ b/include/configs/tuxx1.h
@@ -36,6 +36,9 @@
 #elif defined(CONFIG_KMOPTI2)
 #define CONFIG_KM_BOARD_NAME   "kmopti2"
 #define CONFIG_HOSTNAMEkmopti2
+#elif defined(CONFIG_KMTEPR2)
+#define CONFIG_KM_BOARD_NAME"kmtepr2"
+#define CONFIG_HOSTNAME kmtepr2
 #else
 #error ("Board not supported")
 #endif
@@ -47,21 +50,45 @@
 
 #define CONFIG_SYS_APP1_BASE   0xA000/* PAXG */
 #defineCONFIG_SYS_APP1_SIZE256 /* Megabytes */
-#if defined(CONFIG_TUXX1) || defined(CONFIG_KMOPTI2)
+#if defined(CONFIG_TUXX1) || defined(CONFIG_KMOPTI2) || defined(CONFIG_KMTEPR2)
 #define CONFIG_SYS_APP2_BASE   0xB000/* PINC3 */
 #defineCONFIG_SYS_APP2_SIZE256 /* Megabytes */
 #endif
 
 /*
  * Init Local Bus Memory Controller:
- *   Device on
- * Bank Bus Machine PortSz  Size  TUDA1  TUXA1  TUGE1  KMSUPX4 KMOPTI2
- *  --- --- --  - ---
- *  2   Local   GPCM8 bit  256MB  PAXG  LPXF   PAXI LPXF   PAXE
- *  3   Local   GPCM8 bit  256MB  PINC3 PINC2  unused  unused  OPI2(16 bit)
+ *   Device on board
+ * Bank Bus Machine PortSz Size   TUDA1  TUXA1  TUGE1   KMSUPX4 KMOPTI2
+ * 
-
+ *  2   Local   GPCM8 bit  256MB  PAXG   LPXF   PAXILPXFPAXE
+ *  3   Local   GPCM8 bit  256MB  PINC3  PINC2  unused  unused  OPI2(16 
bit)
  *
+ *   Device on board (continued)
+ * Bank Bus Machine PortSz Size   KMTEPR2
+ * 
-
+ *  2   Local   GPCM8 bit  256MB  NVRAM
+ *  3   Local   GPCM8 bit  256MB  TEP2 (16 bit)
  */
 
+#if defined(CONFIG_KMTEPRO2)
+/*
+ * Configuration for C2 (NVRAM) on the local bus
+ */
+#define CONFIG_SYS_LBLAWBAR2_PRELIMCONFIG_SYS_APP1_BASE
+#define CONFIG_SYS_LBLAWAR2_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
+#define CONFIG_SYS_BR2_PRELIM  (CONFIG_SYS_APP1_BASE | \
+   BR_PS_8 | \
+   BR_MS_GPCM | \
+   BR_V)
+#define CONFIG_SYS_OR2_PRELIM  (MEG_TO_AM(CONFIG_SYS_APP1_SIZE) | \
+   OR_GPCM_CSNT | \
+   OR_GPCM_ACS_DIV2 | \
+   OR_GPCM_XACS | \
+   OR_GPCM_SCY_2 | \
+   OR_GPCM_TRLX_SET | \
+   OR_GPCM_EHTR_SET | \
+   OR_GPCM_EAD)
+#else
 /*
  * Configuration for C2 on the local bus
  */
@@ -82,6 +109,8 @@
 OR_GPCM_TRLX_SET | \
 OR_GPCM_EHTR_CLEAR | \
 OR_GPCM_EAD)
+#endif
+
 #if defined(CONFIG_TUXX1)
 /*
  * Configuration for C3 on the local bus
@@ -108,7 +137,7 @@
 MxMR_WLFx_2X)
 #endif
 
-#if defined(CONFIG_KMOPTI2)
+#if defined(CONFIG_KMOPTI2) || defined(CONFIG_KMTEPR2)
 /*
  * Configuration for C3 on the local bus
  */
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 07/15] km/powerpc82xx: remove unused function

2015-11-17 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

commit 0a4f88b98 removed the usage of our setports function, but the
function itself were not removed. So toss it it's dead code.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 board/keymile/km82xx/km82xx.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 70f816b..01a3c20 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -447,22 +447,6 @@ int get_scl(void)
return get_pin(SCL_MASK, 3);
 }
 
-#if defined(CONFIG_HARD_I2C)
-static void setports(int gpio)
-{
-   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
-
-   if (gpio) {
-   clrbits_be32(>ppar, (SDA_MASK | SCL_MASK));
-   clrbits_be32(>podr, (SDA_MASK | SCL_MASK));
-   } else {
-   setbits_be32(>ppar, (SDA_MASK | SCL_MASK));
-   clrbits_be32(>pdir, (SDA_MASK | SCL_MASK));
-   setbits_be32(>podr, (SDA_MASK | SCL_MASK));
-   }
-}
-#endif
-
 void ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 05/15] km/powerpc: move open firmware defines to km-powerpc.h

2015-11-17 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

We use the same settings for open firmware defines on all our powerpc
targets, so move them from the CPU specific headers to the common
powerpc header.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 include/configs/km/km-powerpc.h| 4 
 include/configs/km/km83xx-common.h | 3 ---
 include/configs/km82xx.h   | 3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index 8121e5c..cf4a91c 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -17,6 +17,10 @@
 #define CONFIG_CMD_DTT
 #define CONFIG_JFFS2_CMDLINE
 
+/* Pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_BOARD_SETUP
+
 /* standard km ethernet_present for piggy */
 #define CONFIG_KM_COMMON_ETH_INIT
 
diff --git a/include/configs/km/km83xx-common.h 
b/include/configs/km/km83xx-common.h
index 94e..2325451 100644
--- a/include/configs/km/km83xx-common.h
+++ b/include/configs/km/km83xx-common.h
@@ -153,9 +153,6 @@
 #define CONFIG_SYS_NS16550_COM1(CONFIG_SYS_IMMR+0x4500)
 #define CONFIG_SYS_NS16550_COM2(CONFIG_SYS_IMMR+0x4600)
 
-/* Pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT
-#define CONFIG_OF_BOARD_SETUP
 #define CONFIG_OF_STDOUT_VIA_ALIAS
 
 /*
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 12f9d42..8c06dc1 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -431,10 +431,7 @@ int get_scl(void);
 
 #defineCONFIG_SYS_RESET_ADDRESS 0xFDFC /* "bad" address */
 
-/* pass open firmware flat tree */
 #define CONFIG_FIT 1
-#define CONFIG_OF_LIBFDT   1
-#define CONFIG_OF_BOARD_SETUP  1
 
 #define OF_TBCLK   (bd->bi_busfreq / 4)
 #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 08/15] powerpc/km8321: define CONFIG_SYS_DDRCDR

2015-11-17 Thread Valentin Longchamp
On the km8321 boards is CONFIG_SYS_DDRCDR not defined, which leads to
the DDRCDR not being configured at startup and still containing the
reset value.

The required settings for our km8321 hardware designs are different than
the reset value and must be set with CONFIG_SYS_DDRCDR, that is used
by mpc83xx's cpu_init_f function at early CPU initialization.

The important settings are the DDR2 internal voltage level and the
half-strength "drivers".

In our case where the DRAM chips are soldered on board and the routing
for these signals under control, half-strength is sufficient as a few
measurements done in the lasts have shown. Since all the hardware
qualification tests have been performed with half strength, the nominal
strength settings are removed in favor of the default reset half
strength settings.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>

---

Changes in v2:
- Squashed commit 9/17 and 10/17 together into a single commit

 include/configs/km/km8321-common.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/km/km8321-common.h 
b/include/configs/km/km8321-common.h
index 058b0ab..b2e68e3 100644
--- a/include/configs/km/km8321-common.h
+++ b/include/configs/km/km8321-common.h
@@ -65,6 +65,12 @@
HRCWH_BIG_ENDIAN | \
HRCWH_LALE_NORMAL)
 
+#define CONFIG_SYS_DDRCDR (\
+   DDRCDR_EN | \
+   DDRCDR_PZ_MAXZ | \
+   DDRCDR_NZ_MAXZ | \
+   DDRCDR_M_ODR)
+
 #define CONFIG_SYS_DDR_CS0_BNDS0x007f
 #define CONFIG_SYS_DDR_SDRAM_CFG   (SDRAM_CFG_SDRAM_TYPE_DDR2 | \
 SDRAM_CFG_32_BE | \
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 02/15] powerpc/82xx: make set/get_pin for km82xx more flexible

2015-11-17 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

The get_pin and set_pin funciton was only used for pins on Port D and
therefore the value was hard coded in the function. Enhance this with a
parameter, that we are able to use this functions for other ports too.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 board/keymile/km82xx/km82xx.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c599b40..03cd10c 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -343,7 +343,7 @@ int last_stage_init(void)
 }
 
 #ifdef CONFIG_MGCOGE3NE
-static void set_pin(int state, unsigned long mask);
+static void set_pin(int state, unsigned long mask, int port);
 
 /*
  * For mgcoge3ne boards, the mgcoge3un control is controlled from
@@ -357,11 +357,11 @@ static void handle_mgcoge3un_reset(void)
if (bobcatreset) {
if (strcmp(bobcatreset, "true") == 0) {
puts("Forcing bobcat reset\n");
-   set_pin(0, 0x0004); /* clear PD29 to reset arm */
+   set_pin(0, 0x0004, 3); /* clear PD29 (reset arm) */
udelay(1000);
-   set_pin(1, 0x0004);
+   set_pin(1, 0x0004, 3);
} else
-   set_pin(1, 0x0004); /* set PD29 to not reset arm */
+   set_pin(1, 0x0004, 3); /* don't reset arm */
}
 }
 #endif
@@ -410,9 +410,9 @@ int hush_init_var(void)
 #define SDA_MASK   0x0001
 #define SCL_MASK   0x0002
 
-static void set_pin(int state, unsigned long mask)
+static void set_pin(int state, unsigned long mask, int port)
 {
-   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
+   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
 
if (state)
setbits_be32(>pdat, mask);
@@ -422,9 +422,9 @@ static void set_pin(int state, unsigned long mask)
setbits_be32(>pdir, mask);
 }
 
-static int get_pin(unsigned long mask)
+static int get_pin(unsigned long mask, int port)
 {
-   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
+   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
 
clrbits_be32(>pdir, mask);
return 0 != (in_be32(>pdat) & mask);
@@ -432,22 +432,22 @@ static int get_pin(unsigned long mask)
 
 void set_sda(int state)
 {
-   set_pin(state, SDA_MASK);
+   set_pin(state, SDA_MASK, 3);
 }
 
 void set_scl(int state)
 {
-   set_pin(state, SCL_MASK);
+   set_pin(state, SCL_MASK, 3);
 }
 
 int get_sda(void)
 {
-   return get_pin(SDA_MASK);
+   return get_pin(SDA_MASK, 3);
 }
 
 int get_scl(void)
 {
-   return get_pin(SCL_MASK);
+   return get_pin(SCL_MASK, 3);
 }
 
 #if defined(CONFIG_HARD_I2C)
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 03/15] powerpc/82xx/km: add testpin detection for mgcoge3ne

2015-11-17 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

On mgcoge3ne we also want to start the test application if the testpin
is asserted. But we don't have a full POST test support yet. So simply
add a function to read the testpin value.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 board/keymile/common/common.c | 5 -
 board/keymile/common/common.h | 2 ++
 board/keymile/km82xx/km82xx.c | 9 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index b9aff1a..8de129d 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -354,8 +354,11 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, 
int argc,
 
 #if defined(CONFIG_POST)
testpin = post_hotkeys_pressed();
-   s = getenv("test_bank");
 #endif
+#if defined(CONFIG_MGCOGE3NE)
+   testpin = get_testpin();
+#endif
+   s = getenv("test_bank");
/* when test_bank is not set, act as if testpin is not asserted */
testboot = (testpin != 0) && (s);
if (verbose) {
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index dcfefc4..c74f569 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -134,6 +134,8 @@ int wait_for_fpga_config(void);
 int fpga_reset(void);
 int toggle_eeprom_spi_bus(void);
 
+int get_testpin(void);
+
 int set_km_env(void);
 int fdt_set_node_and_value(void *blob,
char *nodename,
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 03cd10c..cc9a7c9 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -473,3 +473,12 @@ int ft_board_setup(void *blob, bd_t *bd)
return 0;
 }
 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
+
+#if defined(CONFIG_MGCOGE3NE)
+int get_testpin(void)
+{
+   /* Testpin is Port C pin 29 - enable = low */
+   int testpin = !get_pin(0x0004, 2);
+   return testpin;
+}
+#endif
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 12/15] km83xx: use CONFIG_ENV_ADDR for the newenv env command

2015-11-17 Thread Valentin Longchamp
The hardcoded value are bad, since the address could change between
different boards.

Furthermore, the relevant #defines are set only if #undefined here, so
that they can be changed by some boards if required.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v2: None

 include/configs/km/km83xx-common.h | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km83xx-common.h 
b/include/configs/km/km83xx-common.h
index 2325451..27b47d7 100644
--- a/include/configs/km/km83xx-common.h
+++ b/include/configs/km/km83xx-common.h
@@ -182,10 +182,14 @@
 
 #ifndef CONFIG_SYS_RAMBOOT
 #define CONFIG_ENV_IS_IN_FLASH
+#ifndef CONFIG_ENV_ADDR
 #define CONFIG_ENV_ADDR(CONFIG_SYS_MONITOR_BASE + \
CONFIG_SYS_MONITOR_LEN)
+#endif
 #define CONFIG_ENV_SECT_SIZE   0x2 /* 128K(one sector) for env */
+#ifndef CONFIG_ENV_OFFSET
 #define CONFIG_ENV_OFFSET  (CONFIG_SYS_MONITOR_LEN)
+#endif
 
 /* Address and size of Redundant Environment Sector*/
 #define CONFIG_ENV_OFFSET_REDUND   (CONFIG_ENV_OFFSET + \
@@ -320,8 +324,8 @@
CONFIG_KM_DEF_ENV   \
CONFIG_KM_DEF_ARCH  \
"newenv="   \
-   "prot off 0xF00C +0x4 && "  \
-   "era 0xF00C +0x4\0" \
+   "prot off "__stringify(CONFIG_ENV_ADDR)" +0x4 && "  \
+   "era "__stringify(CONFIG_ENV_ADDR)" +0x4\0" \
"unlock=yes\0"  \
""
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 00/15] km/powerpc: various bugfixes and support for 3 new boards

2015-11-17 Thread Valentin Longchamp
A few bugfixes have been done for the km_kirkwood bards in the last
months and this series collects them all to be sumbitted to mainline.
Furthermore, support for 2 new Keymile ppc boards are added:
- kmtepr2: based on a 8321, this is another variation of tuxx1
- kmtegr1: based on 8309, similarly to kmvect1 but with a lot of
  different peripherals

Changes in v2:
- Removed merge conflict files in commit message
- Squashed commit 9/17 and 10/17 together into a single commit
- Rewritten commit message to get rid of internal git commit reference
- Removed support for kmvect1_p1a: not relevant anymore

Bagavathiannan Palanisamy (1):
  board/keymile/km82xx: setting dip_switch 3 and 4 will run bootloader

Christoph Dietrich (1):
  powerpc/83xx: add support for kmtepr2 board

Holger Brunck (6):
  powerpc/82xx: make set/get_pin for km82xx more flexible
  powerpc/82xx/km: add testpin detection for mgcoge3ne
  km/powerpc: increase space for kernel imange and FDT blob
  km/powerpc: move open firmware defines to km-powerpc.h
  km/powerpc: remove unneeded defines
  km/powerpc82xx: remove unused function

Valentin Longchamp (7):
  powerpc/km8321: define CONFIG_SYS_DDRCDR
  powerpc/km8309: define CONFIG_SYS_DDRCDR
  powerpc/km8360: fix the ODT parameters for CS0
  km83xx: use CONFIG_ENV_ADDR for the newenv env command
  km8309: change the default QE_FW address
  powerpc/83xx: add support for kmtegr1 board
  km/powerpc: fix ft_board_setup prototype for km82xx & km83xx

 board/keymile/common/common.c  |  5 ++-
 board/keymile/common/common.h  |  2 ++
 board/keymile/km82xx/km82xx.c  | 57 ++---
 board/keymile/km83xx/MAINTAINERS   |  2 ++
 board/keymile/km83xx/km83xx.c  |  2 --
 configs/kmtegr1_defconfig  |  4 +++
 configs/kmtepr2_defconfig  |  4 +++
 include/configs/km/km-powerpc.h| 10 --
 include/configs/km/km8309-common.h | 12 +--
 include/configs/km/km8321-common.h |  6 
 include/configs/km/km83xx-common.h | 11 ---
 include/configs/km82xx.h   |  3 --
 include/configs/km8360.h   |  4 +--
 include/configs/suvd3.h| 65 +++---
 include/configs/tuxx1.h| 43 +
 15 files changed, 167 insertions(+), 63 deletions(-)
 create mode 100644 configs/kmtegr1_defconfig
 create mode 100644 configs/kmtepr2_defconfig

-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 10/17] powerpc/km8321: set the DDRCDR impedance settings back to half strength

2015-11-16 Thread Valentin Longchamp
On 16/11/2015 14:34, Tom Rini wrote:
> On Mon, Nov 16, 2015 at 01:26:53PM +0100, Holger Brunck wrote:
>> Hi Valentin,
>>
>> On 13/11/15 15:59, Valentin Longchamp wrote:
>>> The impedance settings have been changed with commit
>>> 2ea8ae99595ca11dd228726e854ebc6268208601 (whose goal was to set
>>> the internal voltage level to the DDR2 value - and not DDR1).
>>>
>>
>> you are referencing the previous patch 09/17 here, shouldn't these two then 
>> not
>> be squashed?
> 
> It's bad form to reference commit IDs of previous parts of a series as
> they will not match what happens when commited to the tree so please say
> the commit subject instead.  And as Holger suggests, if this reference
> patch 9/17 here, just squash the two together and v2 just that patch
> please (assuming no further feedback on the series), thanks!
> 

Sure, I will squash the 2 commits together and avoid all the internal commit
references.

Thanks

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 09/17] powerpc/km8321: define CONFIG_SYS_DDRCDR

2015-11-13 Thread Valentin Longchamp
On the km8321 boards is CONFIG_SYS_DDRCDR not defined, which leads to
the DDRCDR not being configured at startup and still containing the
reset value.

The required settings for our km8321 hardware designs are different than
the reset value and must be set with CONFIG_SYS_DDRCDR, that is used
by mpc83xx's cpu_init_f function at early CPU initialization.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km8321-common.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/km/km8321-common.h 
b/include/configs/km/km8321-common.h
index 058b0ab..6f21c05 100644
--- a/include/configs/km/km8321-common.h
+++ b/include/configs/km/km8321-common.h
@@ -65,6 +65,12 @@
HRCWH_BIG_ENDIAN | \
HRCWH_LALE_NORMAL)
 
+#define CONFIG_SYS_DDRCDR (\
+   DDRCDR_EN | \
+   DDRCDR_PZ_NOMZ | \
+   DDRCDR_NZ_NOMZ | \
+   DDRCDR_M_ODR)
+
 #define CONFIG_SYS_DDR_CS0_BNDS0x007f
 #define CONFIG_SYS_DDR_SDRAM_CFG   (SDRAM_CFG_SDRAM_TYPE_DDR2 | \
 SDRAM_CFG_32_BE | \
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 05/17] km/powerpc: increase space for kernel imange and FDT blob

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

128kByte and 3,986MB may be in the future too little for kernel the fdt
blob respectively the kernel image. So increase the reserved areas here,
we have the space for this.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km-powerpc.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index eb85a74..8121e5c 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -63,9 +63,9 @@
  * is not valid yet, which is the case for when u-boot copies itself to RAM */
 #define CONFIG_PRAM((CONFIG_KM_PNVRAM + CONFIG_KM_PHRAM)>>10)
 
-#define CONFIG_KM_CRAMFS_ADDR  0x80
-#define CONFIG_KM_KERNEL_ADDR  0x40/* 3968Kbytes */
-#define CONFIG_KM_FDT_ADDR 0x7E/* 128Kbytes */
+#define CONFIG_KM_CRAMFS_ADDR  0xC0
+#define CONFIG_KM_KERNEL_ADDR  0x40/* 7680Kbytes */
+#define CONFIG_KM_FDT_ADDR 0xB8/* 512Kbytes */
 
 /* architecture specific default bootargs */
 #define CONFIG_KM_DEF_BOOT_ARGS_CPU""
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/4] km: update the boot script to check for a DTB

2015-11-13 Thread Valentin Longchamp
If a DTB is found with cramfsls, the bootscript continues as expected.
If none is found, the cramfsloadfdt and boot subbootcmds are updated to
not load the DTB from cramfs and not pass it to the kernel. The kernel
thus must have an appended DTB otherwise the boot will fail.

This is required for the km_kirkwood boards that must support .esw where
the DTB sometimes is appended (for backwards compatibility) and sometimes
is passed correctly (as we do now for all newer boards).

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/keymile-common.h | 5 +++--
 include/configs/km/km-powerpc.h | 1 +
 include/configs/km/km_arm.h | 6 ++
 include/configs/km/kmp204x-common.h | 1 +
 4 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/keymile-common.h 
b/include/configs/km/keymile-common.h
index 2fc1ea8..91b29b3 100644
--- a/include/configs/km/keymile-common.h
+++ b/include/configs/km/keymile-common.h
@@ -141,8 +141,9 @@
  * - 'release': for a standalone systemkernel/rootfs from flash
  */
 #define CONFIG_KM_DEF_ENV_BOOTTARGETS  \
-   "subbootcmds=ubiattach ubicopy cramfsloadfdt set_fdthigh "  \
-   "cramfsloadkernel flashargs add_default addpanic boot\0"\
+   "subbootcmds=ubiattach ubicopy checkfdt cramfsloadfdt " \
+   "set_fdthigh cramfsloadkernel flashargs add_default "   \
+   "addpanic boot\0"   \
"develop="  \
"tftp 20 scripts/develop-${arch}.txt && "   \
"env import -t 20 ${filesize} && "  \
diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index eb85a74..20ef036 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -79,6 +79,7 @@
"  ${filesize} && " \
"protect on " __stringify(BOOTFLASH_START) "  +${filesize}\0"\
"set_fdthigh=true\0"\
+   "checkfdt=true\0"   \
""
 
 #endif /* __CONFIG_KEYMILE_POWERPC_H */
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index 15fca1a..8c18e16 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -83,6 +83,12 @@
"u-boot="__stringify(CONFIG_HOSTNAME) "/u-boot.kwb\0"   \
CONFIG_KM_UPDATE_UBOOT  \
"set_fdthigh=setenv fdt_high ${kernelmem}\0"\
+   "checkfdt=" \
+   "if cramfsls fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb; " \
+   "then true; else setenv cramfsloadfdt true; "   \
+   "setenv boot bootm ${load_addr_r}; "\
+   "echo No FDT found, booting with the kernel "   \
+   "appended one; fi\0"\
""
 
 #define CONFIG_SKIP_LOWLEVEL_INIT  /* disable board lowlevel_init */
diff --git a/include/configs/km/kmp204x-common.h 
b/include/configs/km/kmp204x-common.h
index 7536cbd..540c672 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -458,6 +458,7 @@ int get_scl(void);
"sf probe 0;sf erase 0 +${filesize};"   \
"sf write ${load_addr_r} 0 ${filesize};\0"  \
"set_fdthigh=true\0"\
+   "checkfdt=true\0"   \
""
 
 #define CONFIG_HW_ENV_SETTINGS \
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4] km/scripts: search for kernel/DTBs at serverip:/PRODUCTNAME via TFTP in develop mode

2015-11-13 Thread Valentin Longchamp
From: Tobias Müller <tobias.muel...@keymile.com>

Search for the kernel and DTBs in a folder named PRODUCTNAME (found in the IVM)
at the TFTP server instead of the u-boot boardname.

Signed-off-by: Tobias Müller <tobias.muel...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/scripts/develop-common.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/keymile/scripts/develop-common.txt 
b/board/keymile/scripts/develop-common.txt
index 99a0589..265f02f 100644
--- a/board/keymile/scripts/develop-common.txt
+++ b/board/keymile/scripts/develop-common.txt
@@ -1,10 +1,10 @@
 altbootcmd=run ${subbootcmds}
 bootcmd=run ${subbootcmds}
-configure=run set_uimage; km_setboardid && saveenv && reset
+configure=run set_uimage; setenv tftppath ${IVM_Symbol} ; km_setboardid && 
saveenv && reset
 subbootcmds=tftpfdt tftpkernel nfsargs add_default boot
 nfsargs=setenv bootargs root=/dev/nfs rw 
nfsroot=${serverip}:${toolchain}/${arch}
-tftpfdt=if run set_fdthigh || test ${arch} != arm; then if tftpboot 
${fdt_addr_r} ${hostname}/fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb; then; else 
tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb; fi; else true; fi
-tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage}
+tftpfdt=if run set_fdthigh || test ${arch} != arm; then if tftpboot 
${fdt_addr_r} ${tftppath}/fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb; then; else 
tftpboot ${fdt_addr_r} ${tftppath}/${hostname}.dtb; fi; else true; fi
+tftpkernel=tftpboot ${load_addr_r} ${tftppath}/${uimage}
 toolchain=/opt/eldk
 rootfssize=0
 set_uimage=printenv uimage || setenv uimage uImage
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/4] km/scripts: load fdt_bid_kwkey.dtb when working with tftp

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

When loading the dtb file via tftp we should load the one which matches
boardId and hwKey and not a common one for the boardname. We have boards
were different hwKeys are used and then we may load an incorrect dtb
file. If no fdt_bid_kwkey.dtb file is not a fallback to boardname.dtb is used.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Tobias Müller <tobias.muel...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/scripts/develop-common.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/keymile/scripts/develop-common.txt 
b/board/keymile/scripts/develop-common.txt
index a80812a..99a0589 100644
--- a/board/keymile/scripts/develop-common.txt
+++ b/board/keymile/scripts/develop-common.txt
@@ -3,7 +3,7 @@ bootcmd=run ${subbootcmds}
 configure=run set_uimage; km_setboardid && saveenv && reset
 subbootcmds=tftpfdt tftpkernel nfsargs add_default boot
 nfsargs=setenv bootargs root=/dev/nfs rw 
nfsroot=${serverip}:${toolchain}/${arch}
-tftpfdt=if run set_fdthigh || test ${arch} != arm; then tftpboot ${fdt_addr_r} 
${hostname}/${hostname}.dtb; else true; fi
+tftpfdt=if run set_fdthigh || test ${arch} != arm; then if tftpboot 
${fdt_addr_r} ${hostname}/fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb; then; else 
tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb; fi; else true; fi
 tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage}
 toolchain=/opt/eldk
 rootfssize=0
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/4] km/common: stop u-boot only if someone press

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

To prevent u-boot to stop accidently e.g. due to line noise on the
serial line, we now use the option CONFIG_AUTOBOOT_KEYED. We choose the
 key for this.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/keymile-common.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/include/configs/km/keymile-common.h 
b/include/configs/km/keymile-common.h
index f3248bc..2fc1ea8 100644
--- a/include/configs/km/keymile-common.h
+++ b/include/configs/km/keymile-common.h
@@ -56,6 +56,10 @@
 #define CONFIG_LOADS_ECHO
 #define CONFIG_SYS_LOADS_BAUD_CHANGE
 
+#define CONFIG_AUTOBOOT_KEYED
+#define CONFIG_AUTOBOOT_PROMPT "Hit  key to stop autoboot in %2ds\n"
+#define CONFIG_AUTOBOOT_STOP_STR" "
+
 /* Support the IVM EEprom */
 #defineCONFIG_SYS_IVM_EEPROM_ADR   0x50
 #define CONFIG_SYS_IVM_EEPROM_MAX_LEN  0x400
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 04/17] powerpc/82xx/km: add testpin detection for mgcoge3ne

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

On mgcoge3ne we also want to start the test application if the testpin
is asserted. But we don't have a full POST test support yet. So simply
add a function to read the testpin value.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/common/common.c | 5 -
 board/keymile/common/common.h | 2 ++
 board/keymile/km82xx/km82xx.c | 9 +
 3 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c
index b9aff1a..8de129d 100644
--- a/board/keymile/common/common.c
+++ b/board/keymile/common/common.c
@@ -354,8 +354,11 @@ static int do_checktestboot(cmd_tbl_t *cmdtp, int flag, 
int argc,
 
 #if defined(CONFIG_POST)
testpin = post_hotkeys_pressed();
-   s = getenv("test_bank");
 #endif
+#if defined(CONFIG_MGCOGE3NE)
+   testpin = get_testpin();
+#endif
+   s = getenv("test_bank");
/* when test_bank is not set, act as if testpin is not asserted */
testboot = (testpin != 0) && (s);
if (verbose) {
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index dcfefc4..c74f569 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -134,6 +134,8 @@ int wait_for_fpga_config(void);
 int fpga_reset(void);
 int toggle_eeprom_spi_bus(void);
 
+int get_testpin(void);
+
 int set_km_env(void);
 int fdt_set_node_and_value(void *blob,
char *nodename,
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 03cd10c..cc9a7c9 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -473,3 +473,12 @@ int ft_board_setup(void *blob, bd_t *bd)
return 0;
 }
 #endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
+
+#if defined(CONFIG_MGCOGE3NE)
+int get_testpin(void)
+{
+   /* Testpin is Port C pin 29 - enable = low */
+   int testpin = !get_pin(0x0004, 2);
+   return testpin;
+}
+#endif
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/4] Keymile common changes

2015-11-13 Thread Valentin Longchamp
This is the last part of the changes for the Keymile boards. This series
contains all the changes that are common to all boards and architectures
(that's why they are sent as an independant series) and mostly target
our environment scripts.

Holger Brunck (2):
  km/common: stop u-boot only if someone press 
  km/scripts: load fdt_bid_kwkey.dtb when working with tftp

Tobias Müller (1):
  km/scripts: search for kernel/DTBs at serverip:/PRODUCTNAME via TFTP
in develop mode

Valentin Longchamp (1):
  km: update the boot script to check for a DTB

 board/keymile/scripts/develop-common.txt | 6 +++---
 include/configs/km/keymile-common.h  | 9 +++--
 include/configs/km/km-powerpc.h  | 1 +
 include/configs/km/km_arm.h  | 6 ++
 include/configs/km/kmp204x-common.h  | 1 +
 5 files changed, 18 insertions(+), 5 deletions(-)

-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 08/17] km/powerpc82xx: remove unused function

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

commit 0a4f88b98 removed the usage of our setports function, but the
function itself were not removed. So toss it it's dead code.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km82xx/km82xx.c | 16 
 1 file changed, 16 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 70f816b..01a3c20 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -447,22 +447,6 @@ int get_scl(void)
return get_pin(SCL_MASK, 3);
 }
 
-#if defined(CONFIG_HARD_I2C)
-static void setports(int gpio)
-{
-   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
-
-   if (gpio) {
-   clrbits_be32(>ppar, (SDA_MASK | SCL_MASK));
-   clrbits_be32(>podr, (SDA_MASK | SCL_MASK));
-   } else {
-   setbits_be32(>ppar, (SDA_MASK | SCL_MASK));
-   clrbits_be32(>pdir, (SDA_MASK | SCL_MASK));
-   setbits_be32(>podr, (SDA_MASK | SCL_MASK));
-   }
-}
-#endif
-
 void ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 03/17] powerpc/82xx: make set/get_pin for km82xx more flexible

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

The get_pin and set_pin funciton was only used for pins on Port D and
therefore the value was hard coded in the function. Enhance this with a
parameter, that we are able to use this functions for other ports too.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km82xx/km82xx.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c599b40..03cd10c 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -343,7 +343,7 @@ int last_stage_init(void)
 }
 
 #ifdef CONFIG_MGCOGE3NE
-static void set_pin(int state, unsigned long mask);
+static void set_pin(int state, unsigned long mask, int port);
 
 /*
  * For mgcoge3ne boards, the mgcoge3un control is controlled from
@@ -357,11 +357,11 @@ static void handle_mgcoge3un_reset(void)
if (bobcatreset) {
if (strcmp(bobcatreset, "true") == 0) {
puts("Forcing bobcat reset\n");
-   set_pin(0, 0x0004); /* clear PD29 to reset arm */
+   set_pin(0, 0x0004, 3); /* clear PD29 (reset arm) */
udelay(1000);
-   set_pin(1, 0x0004);
+   set_pin(1, 0x0004, 3);
} else
-   set_pin(1, 0x0004); /* set PD29 to not reset arm */
+   set_pin(1, 0x0004, 3); /* don't reset arm */
}
 }
 #endif
@@ -410,9 +410,9 @@ int hush_init_var(void)
 #define SDA_MASK   0x0001
 #define SCL_MASK   0x0002
 
-static void set_pin(int state, unsigned long mask)
+static void set_pin(int state, unsigned long mask, int port)
 {
-   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
+   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
 
if (state)
setbits_be32(>pdat, mask);
@@ -422,9 +422,9 @@ static void set_pin(int state, unsigned long mask)
setbits_be32(>pdir, mask);
 }
 
-static int get_pin(unsigned long mask)
+static int get_pin(unsigned long mask, int port)
 {
-   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
+   ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, port);
 
clrbits_be32(>pdir, mask);
return 0 != (in_be32(>pdat) & mask);
@@ -432,22 +432,22 @@ static int get_pin(unsigned long mask)
 
 void set_sda(int state)
 {
-   set_pin(state, SDA_MASK);
+   set_pin(state, SDA_MASK, 3);
 }
 
 void set_scl(int state)
 {
-   set_pin(state, SCL_MASK);
+   set_pin(state, SCL_MASK, 3);
 }
 
 int get_sda(void)
 {
-   return get_pin(SDA_MASK);
+   return get_pin(SDA_MASK, 3);
 }
 
 int get_scl(void)
 {
-   return get_pin(SCL_MASK);
+   return get_pin(SCL_MASK, 3);
 }
 
 #if defined(CONFIG_HARD_I2C)
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 10/17] powerpc/km8321: set the DDRCDR impedance settings back to half strength

2015-11-13 Thread Valentin Longchamp
The impedance settings have been changed with commit
2ea8ae99595ca11dd228726e854ebc6268208601 (whose goal was to set
the internal voltage level to the DDR2 value - and not DDR1).

There was no other good reason to set them to nominal strength than
"the others do it like that" according to Ludger. The others however
very often use DIMM modules where the nominal strength makes sense.

In our case where the DRAM chips are soldered on board and the routing
for these signals under control, half-strength is sufficient as a few
measurements done in the lasts have shown. Since all the hardware
qualification tests have been performed with half strength, the nominal
strength settings are removed in favor of the default reset half
strength settings.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km8321-common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km8321-common.h 
b/include/configs/km/km8321-common.h
index 6f21c05..b2e68e3 100644
--- a/include/configs/km/km8321-common.h
+++ b/include/configs/km/km8321-common.h
@@ -67,8 +67,8 @@
 
 #define CONFIG_SYS_DDRCDR (\
DDRCDR_EN | \
-   DDRCDR_PZ_NOMZ | \
-   DDRCDR_NZ_NOMZ | \
+   DDRCDR_PZ_MAXZ | \
+   DDRCDR_NZ_MAXZ | \
DDRCDR_M_ODR)
 
 #define CONFIG_SYS_DDR_CS0_BNDS0x007f
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 11/17] powerpc/km8309: define CONFIG_SYS_DDRCDR

2015-11-13 Thread Valentin Longchamp
For consistency with all the other km83xx plaforms, this should also be
defined for km8309. The same settings as for km8321 are taken.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km8309-common.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/km/km8309-common.h 
b/include/configs/km/km8309-common.h
index ec133f9..d7f6cb1 100644
--- a/include/configs/km/km8309-common.h
+++ b/include/configs/km/km8309-common.h
@@ -99,6 +99,12 @@
HRCWH_BIG_ENDIAN | \
HRCWH_LALE_NORMAL)
 
+#define CONFIG_SYS_DDRCDR (\
+   DDRCDR_EN | \
+   DDRCDR_PZ_MAXZ | \
+   DDRCDR_NZ_MAXZ | \
+   DDRCDR_M_ODR)
+
 #define CONFIG_SYS_DDR_CS0_BNDS0x007f
 #define CONFIG_SYS_DDR_SDRAM_CFG   (SDRAM_CFG_SDRAM_TYPE_DDR2 | \
 SDRAM_CFG_32_BE | \
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 07/17] km/powerpc: remove unneeded defines

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

We use CONFIG_OF_LIBFDT and CONFIG_OF_BOARD_SETUP on all our powerpc
targets, so there is no need to check these defines within our C code.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
Conflicts:
board/keymile/km82xx/km82xx.c
board/keymile/km83xx/km83xx.c

---

 board/keymile/km82xx/km82xx.c | 8 ++--
 board/keymile/km83xx/km83xx.c | 4 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index cc9a7c9..70f816b 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -11,10 +11,7 @@
 #include 
 #include 
 
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
 #include 
-#endif
-
 #include 
 #include "../common/common.h"
 
@@ -465,14 +462,13 @@ static void setports(int gpio)
}
 }
 #endif
-#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT)
-int ft_board_setup(void *blob, bd_t *bd)
+
+void ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
return 0;
 }
-#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */
 
 #if defined(CONFIG_MGCOGE3NE)
 int get_testpin(void)
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 4ebcdbd..a7f2bf7 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -369,14 +369,12 @@ int checkboard(void)
return 0;
 }
 
-#if defined(CONFIG_OF_BOARD_SETUP)
-int ft_board_setup(void *blob, bd_t *bd)
+void ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
return 0;
 }
-#endif
 
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 12/17] powerpc/km8360: fix the ODT parameters for CS0

2015-11-13 Thread Valentin Longchamp
The ODT parameters for km8360 set the ODT_WR_ACS bit in u-boot KM-2011.09
that is used in the release bootpackage for kmcoge5ne. During the
transition from the kmeter1 to km8360 and with the migration to
KM-2012.10 (commit 0f2b721c80fa50c8e09548f0ad1b4210d2197bf9), this
was changed to ODT_RD_ONLY_CURRENT, which is uncorrect and causes faulty
RAM accesses at low temperatures.

This is now changed to ODT_WR_ONLY_CURRENT which is the equivalent of
ODT_WR_ACS.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km8360.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/km8360.h b/include/configs/km8360.h
index 04cde46..5034fda 100644
--- a/include/configs/km8360.h
+++ b/include/configs/km8360.h
@@ -100,7 +100,7 @@
 #define CONFIG_SYS_DDR_CS0_CONFIG (\
CSCONFIG_EN | \
CSCONFIG_AP | \
-   CSCONFIG_ODT_RD_ONLY_CURRENT | \
+   CSCONFIG_ODT_WR_ONLY_CURRENT | \
CSCONFIG_BANK_BIT_3 | \
CSCONFIG_ROW_BIT_13 | \
CSCONFIG_COL_BIT_10)
@@ -108,7 +108,7 @@
 #define CONFIG_SYS_DDR_CS0_CONFIG  (CSCONFIG_EN | CSCONFIG_AP | \
 CSCONFIG_ROW_BIT_13 | \
 CSCONFIG_COL_BIT_10 | \
-CSCONFIG_ODT_RD_ONLY_CURRENT)
+CSCONFIG_ODT_WR_ONLY_CURRENT)
 #endif
 
 #define CONFIG_SYS_DDR_CLK_CNTL (\
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 15/17] km8309: change the default QE_FW address

2015-11-13 Thread Valentin Longchamp
It should be after the u-boot reserved sectors and before the env
sectors, since the solution used for kmvect1 (tell the linker to put the
firmware into the u-boot produced binary, at the end of the area) should
be the exception.

The #define is only "conditional" so that we can still support kmvect1.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km8309-common.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km8309-common.h 
b/include/configs/km/km8309-common.h
index d7f6cb1..a69fdf1 100644
--- a/include/configs/km/km8309-common.h
+++ b/include/configs/km/km8309-common.h
@@ -29,8 +29,10 @@
 
 /* QE microcode/firmware address */
 #define CONFIG_SYS_QE_FMAN_FW_IN_NOR
-/* at end of uboot partition, before env */
-#define CONFIG_SYS_QE_FW_ADDR   0xF00B
+/* between the u-boot partition and env */
+#ifndef CONFIG_SYS_QE_FW_ADDR
+#define CONFIG_SYS_QE_FW_ADDR   0xF00C
+#endif
 
 /*
  * System IO Config
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 06/17] km/powerpc: move open firmware defines to km-powerpc.h

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

We use the same settings for open firmware defines on all our powerpc
targets, so move them from the CPU specific headers to the common
powerpc header.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km-powerpc.h| 4 
 include/configs/km/km83xx-common.h | 3 ---
 include/configs/km82xx.h   | 3 ---
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h
index 8121e5c..cf4a91c 100644
--- a/include/configs/km/km-powerpc.h
+++ b/include/configs/km/km-powerpc.h
@@ -17,6 +17,10 @@
 #define CONFIG_CMD_DTT
 #define CONFIG_JFFS2_CMDLINE
 
+/* Pass open firmware flat tree */
+#define CONFIG_OF_LIBFDT
+#define CONFIG_OF_BOARD_SETUP
+
 /* standard km ethernet_present for piggy */
 #define CONFIG_KM_COMMON_ETH_INIT
 
diff --git a/include/configs/km/km83xx-common.h 
b/include/configs/km/km83xx-common.h
index 94e..2325451 100644
--- a/include/configs/km/km83xx-common.h
+++ b/include/configs/km/km83xx-common.h
@@ -153,9 +153,6 @@
 #define CONFIG_SYS_NS16550_COM1(CONFIG_SYS_IMMR+0x4500)
 #define CONFIG_SYS_NS16550_COM2(CONFIG_SYS_IMMR+0x4600)
 
-/* Pass open firmware flat tree */
-#define CONFIG_OF_LIBFDT
-#define CONFIG_OF_BOARD_SETUP
 #define CONFIG_OF_STDOUT_VIA_ALIAS
 
 /*
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 12f9d42..8c06dc1 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -431,10 +431,7 @@ int get_scl(void);
 
 #defineCONFIG_SYS_RESET_ADDRESS 0xFDFC /* "bad" address */
 
-/* pass open firmware flat tree */
 #define CONFIG_FIT 1
-#define CONFIG_OF_LIBFDT   1
-#define CONFIG_OF_BOARD_SETUP  1
 
 #define OF_TBCLK   (bd->bi_busfreq / 4)
 #define OF_STDOUT_PATH "/soc/cpm/serial@11a90"
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 02/17] powerpc/83xx: add support for kmtepr2 board

2015-11-13 Thread Valentin Longchamp
From: Christoph Dietrich <christoph.dietr...@keymile.com>

This board is similar to TUXX1, but it has differend FPGAs.

Signed-off-by: Christoph Dietrich <christoph.dietr...@keymile.com>
Signed-off-by: Andreas Huber <andreas.hu...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km83xx/MAINTAINERS |  1 +
 configs/kmtepr2_defconfig|  4 
 include/configs/tuxx1.h  | 43 +---
 3 files changed, 41 insertions(+), 7 deletions(-)
 create mode 100644 configs/kmtepr2_defconfig

diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS
index 51367b6..58969a2 100644
--- a/board/keymile/km83xx/MAINTAINERS
+++ b/board/keymile/km83xx/MAINTAINERS
@@ -7,6 +7,7 @@ F:  configs/kmcoge5ne_defconfig
 F: configs/kmeter1_defconfig
 F: include/configs/tuxx1.h
 F: configs/kmopti2_defconfig
+F: configs/kmtepr2_defconfig
 F: include/configs/suvd3.h
 F: configs/kmvect1_defconfig
 F: configs/kmvect1_p1a_defconfig
diff --git a/configs/kmtepr2_defconfig b/configs/kmtepr2_defconfig
new file mode 100644
index 000..5cffd53
--- /dev/null
+++ b/configs/kmtepr2_defconfig
@@ -0,0 +1,4 @@
+CONFIG_SYS_EXTRA_OPTIONS="KMTEPR2"
+CONFIG_PPC=y
+CONFIG_MPC83xx=y
+CONFIG_TARGET_TUXX1=y
diff --git a/include/configs/tuxx1.h b/include/configs/tuxx1.h
index 08ead7f..e2ca9e3 100644
--- a/include/configs/tuxx1.h
+++ b/include/configs/tuxx1.h
@@ -36,6 +36,9 @@
 #elif defined(CONFIG_KMOPTI2)
 #define CONFIG_KM_BOARD_NAME   "kmopti2"
 #define CONFIG_HOSTNAMEkmopti2
+#elif defined(CONFIG_KMTEPR2)
+#define CONFIG_KM_BOARD_NAME"kmtepr2"
+#define CONFIG_HOSTNAME kmtepr2
 #else
 #error ("Board not supported")
 #endif
@@ -47,21 +50,45 @@
 
 #define CONFIG_SYS_APP1_BASE   0xA000/* PAXG */
 #defineCONFIG_SYS_APP1_SIZE256 /* Megabytes */
-#if defined(CONFIG_TUXX1) || defined(CONFIG_KMOPTI2)
+#if defined(CONFIG_TUXX1) || defined(CONFIG_KMOPTI2) || defined(CONFIG_KMTEPR2)
 #define CONFIG_SYS_APP2_BASE   0xB000/* PINC3 */
 #defineCONFIG_SYS_APP2_SIZE256 /* Megabytes */
 #endif
 
 /*
  * Init Local Bus Memory Controller:
- *   Device on
- * Bank Bus Machine PortSz  Size  TUDA1  TUXA1  TUGE1  KMSUPX4 KMOPTI2
- *  --- --- --  - ---
- *  2   Local   GPCM8 bit  256MB  PAXG  LPXF   PAXI LPXF   PAXE
- *  3   Local   GPCM8 bit  256MB  PINC3 PINC2  unused  unused  OPI2(16 bit)
+ *   Device on board
+ * Bank Bus Machine PortSz Size   TUDA1  TUXA1  TUGE1   KMSUPX4 KMOPTI2
+ * 
-
+ *  2   Local   GPCM8 bit  256MB  PAXG   LPXF   PAXILPXFPAXE
+ *  3   Local   GPCM8 bit  256MB  PINC3  PINC2  unused  unused  OPI2(16 
bit)
  *
+ *   Device on board (continued)
+ * Bank Bus Machine PortSz Size   KMTEPR2
+ * 
-
+ *  2   Local   GPCM8 bit  256MB  NVRAM
+ *  3   Local   GPCM8 bit  256MB  TEP2 (16 bit)
  */
 
+#if defined(CONFIG_KMTEPRO2)
+/*
+ * Configuration for C2 (NVRAM) on the local bus
+ */
+#define CONFIG_SYS_LBLAWBAR2_PRELIMCONFIG_SYS_APP1_BASE
+#define CONFIG_SYS_LBLAWAR2_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
+#define CONFIG_SYS_BR2_PRELIM  (CONFIG_SYS_APP1_BASE | \
+   BR_PS_8 | \
+   BR_MS_GPCM | \
+   BR_V)
+#define CONFIG_SYS_OR2_PRELIM  (MEG_TO_AM(CONFIG_SYS_APP1_SIZE) | \
+   OR_GPCM_CSNT | \
+   OR_GPCM_ACS_DIV2 | \
+   OR_GPCM_XACS | \
+   OR_GPCM_SCY_2 | \
+   OR_GPCM_TRLX_SET | \
+   OR_GPCM_EHTR_SET | \
+   OR_GPCM_EAD)
+#else
 /*
  * Configuration for C2 on the local bus
  */
@@ -82,6 +109,8 @@
 OR_GPCM_TRLX_SET | \
 OR_GPCM_EHTR_CLEAR | \
 OR_GPCM_EAD)
+#endif
+
 #if defined(CONFIG_TUXX1)
 /*
  * Configuration for C3 on the local bus
@@ -108,7 +137,7 @@
 MxMR_WLFx_2X)
 #endif
 
-#if defined(CONFIG_KMOPTI2)
+#if defined(CONFIG_KMOPTI2) || defined(CONFIG_KMTEPR2)
 /*
  * Configuration for C3 on the local bus
  */
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 16/17] powerpc/83xx: add support for kmtegr1 board

2015-11-13 Thread Valentin Longchamp
This board uses the same CPU (8309) as VECT1. The memory however is
different since it has NAND Flash, the NOR Flash partitioning is
different and of course the FPGAs as well.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
Signed-off-by: Christoph Dietrich <christoph.dietr...@keymile.com>
---

 board/keymile/km83xx/MAINTAINERS |  1 +
 configs/kmtegr1_defconfig|  4 +++
 include/configs/suvd3.h  | 65 +---
 3 files changed, 66 insertions(+), 4 deletions(-)
 create mode 100644 configs/kmtegr1_defconfig

diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS
index 58969a2..f765575 100644
--- a/board/keymile/km83xx/MAINTAINERS
+++ b/board/keymile/km83xx/MAINTAINERS
@@ -9,6 +9,7 @@ F:  include/configs/tuxx1.h
 F: configs/kmopti2_defconfig
 F: configs/kmtepr2_defconfig
 F: include/configs/suvd3.h
+F: configs/kmtegr1_defconfig
 F: configs/kmvect1_defconfig
 F: configs/kmvect1_p1a_defconfig
 F: configs/suvd3_defconfig
diff --git a/configs/kmtegr1_defconfig b/configs/kmtegr1_defconfig
new file mode 100644
index 000..aee9886
--- /dev/null
+++ b/configs/kmtegr1_defconfig
@@ -0,0 +1,4 @@
+CONFIG_SYS_EXTRA_OPTIONS="KMTEGR1"
+CONFIG_PPC=y
+CONFIG_MPC83xx=y
+CONFIG_TARGET_SUVD3=y
diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h
index fddba92..af8730a 100644
--- a/include/configs/suvd3.h
+++ b/include/configs/suvd3.h
@@ -29,13 +29,48 @@
 #define CONFIG_KM_BOARD_NAME   "suvd3"
 /* include common defines/options for all 8321 Keymile boards */
 #include "km/km8321-common.h"
+
 #elif defined(CONFIG_KMVECT1)   /* VECT1 board specific */
 #define CONFIG_HOSTNAMEkmvect1
 #define CONFIG_KM_BOARD_NAME   "kmvect1"
+/* at end of uboot partition, before env */
+#define CONFIG_SYS_QE_FW_ADDR   0xF00B
+/* include common defines/options for all 8309 Keymile boards */
+#include "km/km8309-common.h"
+
+#elif defined(CONFIG_KMTEGR1)   /* TEGR1 board specific */
+#define CONFIG_HOSTNAME   kmtegr1
+#define CONFIG_KM_BOARD_NAME   "kmtegr1"
+#define CONFIG_KM_UBI_PARTITION_NAME_BOOT  "ubi0"
+#define CONFIG_KM_UBI_PARTITION_NAME_APP   "ubi1"
+#define MTDIDS_DEFAULT "nor0=boot,nand0=app"
+#define MTDPARTS_DEFAULT   "mtdparts=" \
+   "boot:" \
+   "768k(u-boot)," \
+   "256k(qe-fw),"  \
+   "128k(env),"\
+   "128k(envred)," \
+   "-(" CONFIG_KM_UBI_PARTITION_NAME_BOOT ");" \
+   "app:"  \
+   "-(" CONFIG_KM_UBI_PARTITION_NAME_APP ");"
+
+#define CONFIG_ENV_ADDR0xF010
+#define CONFIG_ENV_OFFSET  0x10
+
+#define CONFIG_CMD_NAND
+#define CONFIG_NAND_ECC_BCH
+#define CONFIG_BCH
+#define CONFIG_NAND_KMETER1
+#define CONFIG_SYS_MAX_NAND_DEVICE 1
+#define NAND_MAX_CHIPS 1
+
 /* include common defines/options for all 8309 Keymile boards */
 #include "km/km8309-common.h"
+/* must be after the include because KMBEC_FPGA is otherwise undefined */
+#define CONFIG_SYS_NAND_BASE CONFIG_SYS_KMBEC_FPGA_BASE /* PRIO_BASE_ADDRESS */
+
 #else
-#error Supported boards are: SUVD3, KMVECT1
+#error Supported boards are: SUVD3, KMVECT1, KMTEGR1
 #endif
 
 #define CONFIG_SYS_APP1_BASE   0xA000
@@ -56,6 +91,7 @@
  *
  */
 
+#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1)
 /*
  * APP1 on the local bus CS2
  */
@@ -82,14 +118,26 @@
 0xc000 | \
 MxMR_WLFx_2X)
 
+#elif defined(CONFIG_KMTEGR1)
+#define CONFIG_SYS_BR3_PRELIM (CONFIG_SYS_APP2_BASE | \
+BR_PS_16 | \
+BR_MS_GPCM | \
+BR_V)
+
+#define CONFIG_SYS_OR3_PRELIM (MEG_TO_AM(CONFIG_SYS_APP2_SIZE) | \
+OR_GPCM_SCY_5 | \
+OR_GPCM_TRLX_CLEAR | \
+OR_GPCM_EHTR_CLEAR)
+
+#endif /* CONFIG_KMTEGR1 */
+
 #define CONFIG_SYS_LBLAWBAR3_PRELIMCONFIG_SYS_APP2_BASE
 #define CONFIG_SYS_LBLAWAR3_PRELIM (LBLAWAR_EN | LBLAWAR_256MB)
 
 /*
  * MMU Setup
  */
-
-
+#if defined(CONFIG_SUVD3) || defined(CONFIG_KMVECT1)
 /* APP1:  icache cacheable, but dcache-inhibit and guarded */
 #define CONFIG_SYS_IBAT5L  (CONFIG_SYS_APP1_BASE | BATL_PP_RW | \
 BATL_MEMCOHERENCE)
@@ -99,6 +147,1

[U-Boot] [PATCH 13/17] board/keymile/km82xx: setting dip_switch 3 and 4 will run bootloader

2015-11-13 Thread Valentin Longchamp
From: Bagavathiannan Palanisamy <bagavathiannan.palanis...@keymile.com>

Setting dip_switch 3 and 4 also will run bootloader in COGE3 and COGE6
It is required remove local mgmt IP address, when DIP Switch PIN3 is
enabled. DIP Switch 4 also enabled to avoid u-boot update in future
for DIP switch enhancements.

Signed-off-by: Bagavathiannan Palanisamy <bagavathiannan.palanis...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km82xx/km82xx.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 01a3c20..9e285ec 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -329,8 +329,8 @@ int last_stage_init(void)
 
dip_switch = in_8(>mswitch);
dip_switch &= BFTICU_DIPSWITCH_MASK;
-   /* dip switch 'full reset' or 'db erase' */
-   if (dip_switch & 0x1 || dip_switch & 0x2) {
+   /* dip switch 'full reset' or 'db erase' or 'Local mgmt IP' or any */
+   if (dip_switch != 0) {
/* start bootloader */
puts("DIP:   Enabled\n");
setenv("actual_bank", "0");
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 14/17] km83xx: use CONFIG_ENV_ADDR for the newenv env command

2015-11-13 Thread Valentin Longchamp
The hardcoded value are bad, since the address could change between
different boards.

Furthermore, the relevant #defines are set only if #undefined here, so
that they can be changed by some boards if required.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km83xx-common.h | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km83xx-common.h 
b/include/configs/km/km83xx-common.h
index 2325451..27b47d7 100644
--- a/include/configs/km/km83xx-common.h
+++ b/include/configs/km/km83xx-common.h
@@ -182,10 +182,14 @@
 
 #ifndef CONFIG_SYS_RAMBOOT
 #define CONFIG_ENV_IS_IN_FLASH
+#ifndef CONFIG_ENV_ADDR
 #define CONFIG_ENV_ADDR(CONFIG_SYS_MONITOR_BASE + \
CONFIG_SYS_MONITOR_LEN)
+#endif
 #define CONFIG_ENV_SECT_SIZE   0x2 /* 128K(one sector) for env */
+#ifndef CONFIG_ENV_OFFSET
 #define CONFIG_ENV_OFFSET  (CONFIG_SYS_MONITOR_LEN)
+#endif
 
 /* Address and size of Redundant Environment Sector*/
 #define CONFIG_ENV_OFFSET_REDUND   (CONFIG_ENV_OFFSET + \
@@ -320,8 +324,8 @@
CONFIG_KM_DEF_ENV   \
CONFIG_KM_DEF_ARCH  \
"newenv="   \
-   "prot off 0xF00C +0x4 && "  \
-   "era 0xF00C +0x4\0" \
+   "prot off "__stringify(CONFIG_ENV_ADDR)" +0x4 && "  \
+   "era "__stringify(CONFIG_ENV_ADDR)" +0x4\0" \
"unlock=yes\0"  \
""
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 17/17] km/powerpc: fix ft_board_setup prototype for km82xx & km83xx

2015-11-13 Thread Valentin Longchamp
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km82xx/km82xx.c | 2 +-
 board/keymile/km83xx/km83xx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index 9e285ec..c2a7a5f 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -447,7 +447,7 @@ int get_scl(void)
return get_pin(SCL_MASK, 3);
 }
 
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index a7f2bf7..92c8ccf 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -369,7 +369,7 @@ int checkboard(void)
return 0;
 }
 
-void ft_board_setup(void *blob, bd_t *bd)
+int ft_board_setup(void *blob, bd_t *bd)
 {
ft_cpu_setup(blob, bd);
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 00/17] km/powerpc: various bugfixes and support for 3 new boards

2015-11-13 Thread Valentin Longchamp
A few bugfixes have been done for the km_kirkwood bards in the last
months and this series collects them all to be sumbitted to mainline.
Furthermore, support for 3 new Keymile ppc boards are added:
- kmvect1_p1a: based on 8309, first hw revision of kmvect1
- kmtepr2: based on a 8321, this is another variation of tuxx1
- kmtegr1: based on 8309, similarly to kmvect1 but with a lot of
  different peripherals

Bagavathiannan Palanisamy (1):
  board/keymile/km82xx: setting dip_switch 3 and 4 will run bootloader

Christoph Dietrich (1):
  powerpc/83xx: add support for kmtepr2 board

Holger Brunck (7):
  powerpc/83xx/km: add support for kmvect1 p1a hw version
  powerpc/82xx: make set/get_pin for km82xx more flexible
  powerpc/82xx/km: add testpin detection for mgcoge3ne
  km/powerpc: increase space for kernel imange and FDT blob
  km/powerpc: move open firmware defines to km-powerpc.h
  km/powerpc: remove unneeded defines
  km/powerpc82xx: remove unused function

Valentin Longchamp (8):
  powerpc/km8321: define CONFIG_SYS_DDRCDR
  powerpc/km8321: set the DDRCDR impedance settings back to half
strength
  powerpc/km8309: define CONFIG_SYS_DDRCDR
  powerpc/km8360: fix the ODT parameters for CS0
  km83xx: use CONFIG_ENV_ADDR for the newenv env command
  km8309: change the default QE_FW address
  powerpc/83xx: add support for kmtegr1 board
  km/powerpc: fix ft_board_setup prototype for km82xx & km83xx

 board/keymile/common/common.c  |  5 ++-
 board/keymile/common/common.h  |  2 ++
 board/keymile/km82xx/km82xx.c  | 57 ++---
 board/keymile/km83xx/MAINTAINERS   |  3 ++
 board/keymile/km83xx/km83xx.c  | 10 --
 configs/kmtegr1_defconfig  |  4 +++
 configs/kmtepr2_defconfig  |  4 +++
 configs/kmvect1_p1a_defconfig  |  4 +++
 include/configs/km/km-powerpc.h| 10 --
 include/configs/km/km8309-common.h | 12 +--
 include/configs/km/km8321-common.h |  6 
 include/configs/km/km83xx-common.h | 11 ---
 include/configs/km82xx.h   |  3 --
 include/configs/km8360.h   |  4 +--
 include/configs/suvd3.h| 65 +++---
 include/configs/tuxx1.h| 43 +
 16 files changed, 180 insertions(+), 63 deletions(-)
 create mode 100644 configs/kmtegr1_defconfig
 create mode 100644 configs/kmtepr2_defconfig
 create mode 100644 configs/kmvect1_p1a_defconfig

-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 01/17] powerpc/83xx/km: add support for kmvect1 p1a hw version

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

This first boards have the simple switch connected to a PRST line of the
PRIO3. This is not allowed because it releases the PRIO3 watchdog in
u-boot which causes problems with the bootloader application. This is
fixed in the newer HW releases. To be able to deal with these old
versions we add temporary a further target kmvect1_p1a.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km83xx/MAINTAINERS | 1 +
 board/keymile/km83xx/km83xx.c| 8 
 configs/kmvect1_p1a_defconfig| 4 
 3 files changed, 13 insertions(+)
 create mode 100644 configs/kmvect1_p1a_defconfig

diff --git a/board/keymile/km83xx/MAINTAINERS b/board/keymile/km83xx/MAINTAINERS
index cee7e08..51367b6 100644
--- a/board/keymile/km83xx/MAINTAINERS
+++ b/board/keymile/km83xx/MAINTAINERS
@@ -9,6 +9,7 @@ F:  include/configs/tuxx1.h
 F: configs/kmopti2_defconfig
 F: include/configs/suvd3.h
 F: configs/kmvect1_defconfig
+F: configs/kmvect1_p1a_defconfig
 F: configs/suvd3_defconfig
 F: configs/tuge1_defconfig
 F: configs/tuxx1_defconfig
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 89e9e1e..4ebcdbd 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -241,6 +241,13 @@ int last_stage_init(void)
 #if defined(CONFIG_KMVECT1)
struct km_bec_fpga __iomem *base =
(struct km_bec_fpga __iomem *)CONFIG_SYS_KMBEC_FPGA_BASE;
+#if defined(CONFIG_HWVERSION_P1A)
+   /* Release mv88e6352 from reset */
+   u8 prst_reg;
+
+   prst_reg = in_8(>prst) | 0x80;
+   out_8(>prst, prst_reg);
+#else
u8 tmp_reg;
 
/* Release mv88e6122 from reset */
@@ -248,6 +255,7 @@ int last_stage_init(void)
out_8(>res1[0], tmp_reg);/* GP28 as output */
tmp_reg = in_8(>gprt3) | 0x10;   /* GP28 to high */
out_8(>gprt3, tmp_reg);
+#endif
 
/* configure MV88E6122 switch */
char *name = "UEC2";
diff --git a/configs/kmvect1_p1a_defconfig b/configs/kmvect1_p1a_defconfig
new file mode 100644
index 000..cdf50d5
--- /dev/null
+++ b/configs/kmvect1_p1a_defconfig
@@ -0,0 +1,4 @@
+CONFIG_SYS_EXTRA_OPTIONS="KMVECT1,HWVERSION_P1A"
+CONFIG_PPC=y
+CONFIG_MPC83xx=y
+CONFIG_TARGET_SUVD3=y
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/4] km_kirkwood: various bugfixes

2015-11-13 Thread Valentin Longchamp
A few bugfixes have been done for the km_kirkwood bards in the last
months and this series collects them all to be sumbitted to mainline.

Patch 1/4 was already submitted to mainline in [1] and even marked as
accepted but the kirkwood maintainer but it was unfortunately never
pushed to mainline, so it is here sent again.

[1] http://patchwork.ozlabs.org/patch/399411/


Holger Brunck (1):
  arm/mgcoge3un: check dip_switch at startup

Tobias Müller (1):
  arm/km: Fix LED configuration for 88E1118R PHY (PIGGY3)

Valentin Longchamp (2):
  arm/km_kirkwood: remove KM_ENV_BUS and use CONFIG_I2C_ENV_EEPROM_BUS
  arm/km_kirkwood: fix the #ifdef for KM_COGE5UN dip switch

 board/keymile/km_arm/km_arm.c | 66 ---
 include/configs/km/km_arm.h   |  2 +-
 include/configs/km_kirkwood.h |  4 ---
 3 files changed, 63 insertions(+), 9 deletions(-)

-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/4] arm/km_kirkwood: fix the #ifdef for KM_COGE5UN dip switch

2015-11-13 Thread Valentin Longchamp
There was a small typo for KM_COGE5UN that resulted in the dip switch
not to behave as expected.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km_arm/km_arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index b2ddab2..03a1901 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -296,7 +296,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-#if (defined(CONFIG_KMCOGE5UN) | defined(CONFIG_KM_MGCOGE3UN))
+#if (defined(CONFIG_KM_COGE5UN) | defined(CONFIG_KM_MGCOGE3UN))
u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
 
/* if pin 1 do full erase */
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/4] arm/km_kirkwood: remove KM_ENV_BUS and use CONFIG_I2C_ENV_EEPROM_BUS

2015-11-13 Thread Valentin Longchamp
KM_ENV_BUS was used for nothing else than an direct assignment to
CONFIG_I2C_ENV_EEPROM_BUS. To avoid this, directly use
CONFIG_I2C_ENV_EEPROM_BUS instead.

Patchwork: http://patchwork.ozlabs.org/patch/399411/
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 include/configs/km/km_arm.h   | 2 +-
 include/configs/km_kirkwood.h | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index 15fca1a..8fff381 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -243,7 +243,7 @@ int get_scl(void);
 #define CONFIG_SYS_EEPROM_WREN
 #define CONFIG_ENV_OFFSET  0x0 /* no bracets! */
 #define CONFIG_ENV_SIZE(0x2000 - CONFIG_ENV_OFFSET)
-#define CONFIG_I2C_ENV_EEPROM_BUS  KM_ENV_BUS
+#define CONFIG_I2C_ENV_EEPROM_BUS 5 /* I2C2 (Mux-Port 5) */
 #define CONFIG_ENV_OFFSET_REDUND   0x2000 /* no bracets! */
 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
 #endif
diff --git a/include/configs/km_kirkwood.h b/include/configs/km_kirkwood.h
index dc26155..a445aaf 100644
--- a/include/configs/km_kirkwood.h
+++ b/include/configs/km_kirkwood.h
@@ -116,10 +116,6 @@
 /* include common defines/options for all arm based Keymile boards */
 #include "km/km_arm.h"
 
-#ifndef CONFIG_KM_ENV_IS_IN_SPI_NOR
-#define KM_ENV_BUS 5   /* I2C2 (Mux-Port 5)*/
-#endif
-
 #if defined(CONFIG_KM_PIGGY4_88E6352)
 /*
  * Some keymile boards like mgcoge5un & nusa1 have their PIGGY4 connected via
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/4] arm/mgcoge3un: check dip_switch at startup

2015-11-13 Thread Valentin Longchamp
From: Holger Brunck <holger.bru...@keymile.com>

Similar to kmcoge5un we need to check the dip switch at startup
connected to the kirkwood at MPP43. If it's set we need to set the
actual_bank to zero to boot from SW bank zero. Additional to kmcoge5un
we need to check also the pin in misc_init to decide wether we wait for
the ne to start or not. If the dip_switch is set we don't wait and
continue immediately.

Signed-off-by: Holger Brunck <holger.bru...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km_arm/km_arm.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index a11474c..b2ddab2 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -55,6 +55,9 @@ DECLARE_GLOBAL_DATA_PTR;
 #define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3<<4)
 #define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK(0x0<<8)
 
+/* I/O pin to erase flash RGPP09 = MPP43 */
+#define KM_FLASH_ERASE_ENABLE  43
+
 /* Multi-Purpose Pins Functionality configuration */
 static const u32 kwmpp_config[] = {
MPP0_NF_IO2,
@@ -201,8 +204,10 @@ int misc_init_r(void)
 {
 #if defined(CONFIG_KM_MGCOGE3UN)
char *wait_for_ne;
+   u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
wait_for_ne = getenv("waitforne");
-   if (wait_for_ne != NULL) {
+
+   if ((wait_for_ne != NULL) && (dip_switch == 0)) {
if (strcmp(wait_for_ne, "true") == 0) {
int cnt = 0;
int abort = 0;
@@ -291,9 +296,7 @@ int board_init(void)
 
 int board_late_init(void)
 {
-#if defined(CONFIG_KMCOGE5UN)
-/* I/O pin to erase flash RGPP09 = MPP43 */
-#define KM_FLASH_ERASE_ENABLE  43
+#if (defined(CONFIG_KMCOGE5UN) | defined(CONFIG_KM_MGCOGE3UN))
u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
 
/* if pin 1 do full erase */
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/4] arm/km: Fix LED configuration for 88E1118R PHY (PIGGY3)

2015-11-13 Thread Valentin Longchamp
From: Tobias Müller <tobias.muel...@keymile.com>

Configure PHY LED register for Marvell 88E1118R PHY used on PIGGY3 to
match with printed descriptions on PCB

Signed-off-by: Tobias Müller <tobias.muel...@keymile.com>
Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

 board/keymile/km_arm/km_arm.c | 55 +++
 1 file changed, 55 insertions(+)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 2938861..a11474c 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -37,6 +37,24 @@ DECLARE_GLOBAL_DATA_PTR;
 #define REG_IRQ_CIRQ2  0x2d
 #define MASK_RBI_DEFECT_16 0x01
 
+/*
+ * PHY registers definitions
+ */
+#define PHY_MARVELL_OUI0x5043
+#define PHY_MARVELL_88E1118_MODEL  0x0022
+#define PHY_MARVELL_88E1118R_MODEL 0x0024
+
+#define PHY_MARVELL_PAGE_REG   0x0016
+#define PHY_MARVELL_DEFAULT_PAGE   0x
+
+#define PHY_MARVELL_88E1118R_LED_CRTL_PAGE 0x0003
+#define PHY_MARVELL_88E1118R_LED_CTRL_REG  0x0010
+
+#define PHY_MARVELL_88E1118R_LED_CTRL_RESERVED 0x1000
+#define PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB  (0x7<<0)
+#define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3<<4)
+#define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK(0x0<<8)
+
 /* Multi-Purpose Pins Functionality configuration */
 static const u32 kwmpp_config[] = {
MPP0_NF_IO2,
@@ -409,6 +427,9 @@ void reset_phy(void)
 /* Configure and enable MV88E1118 PHY on the piggy*/
 void reset_phy(void)
 {
+   unsigned int oui;
+   unsigned char model, rev;
+
char *name = "egiga0";
 
if (miiphy_set_current_dev(name))
@@ -416,6 +437,40 @@ void reset_phy(void)
 
/* reset the phy */
miiphy_reset(name, CONFIG_PHY_BASE_ADR);
+
+   /* get PHY model */
+   if (miiphy_info(name, CONFIG_PHY_BASE_ADR, , , ))
+   return;
+
+   /* check for Marvell 88E1118R Gigabit PHY (PIGGY3) */
+   if ((oui == PHY_MARVELL_OUI) &&
+   (model == PHY_MARVELL_88E1118R_MODEL)) {
+   /* set page register to 3 */
+   if (miiphy_write(name, CONFIG_PHY_BASE_ADR,
+PHY_MARVELL_PAGE_REG,
+PHY_MARVELL_88E1118R_LED_CTRL_PAGE))
+   printf("Error writing PHY page reg\n");
+
+   /*
+* leds setup as printed on PCB:
+* LED2 (Link): 0x0 (On Link, Off No Link)
+* LED1 (Activity): 0x3 (On Activity, Off No Activity)
+* LED0 (Speed): 0x7 (On 1000 MBits, Off Else)
+*/
+   if (miiphy_write(name, CONFIG_PHY_BASE_ADR,
+PHY_MARVELL_88E1118R_LED_CTRL_REG,
+PHY_MARVELL_88E1118R_LED_CTRL_RESERVED |
+PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB |
+PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT |
+PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK))
+   printf("Error writing PHY LED reg\n");
+
+   /* set page register back to 0 */
+   if (miiphy_write(name, CONFIG_PHY_BASE_ADR,
+PHY_MARVELL_PAGE_REG,
+PHY_MARVELL_DEFAULT_PAGE))
+   printf("Error writing PHY page reg\n");
+   }
 }
 #endif
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/3] env_sf: generalize call to spi_flash_free after accesses

2015-11-13 Thread Valentin Longchamp
Some board require spi_flash_free to be called after all the accesses,
in order, for instance, to restore the pin multiplexing configuration in
the case where the SPI pins are multiplexed.

This was done only in env_relocate_spec and not in saveenv. saveenv is
thus changed in order to have the same behavior as env_relocate_spec.

Since the static env_flash variable will be NULL after every function
call, it is thus removed and its functionality is replaced by a
systematic call to spi_flash_probe at the start of both
env_relocate_spec and saveenv.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v3:
- Rebased on v2015.10

Changes in v2: None

 common/env_sf.c | 28 ++--
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/common/env_sf.c b/common/env_sf.c
index 9409831..19fcbd3 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -52,14 +52,11 @@ int saveenv(void)
u32 saved_size, saved_offset, sector = 1;
int ret;
 
+   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
+   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
-   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
-   CONFIG_ENV_SPI_CS,
-   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
-   if (!env_flash) {
-   set_default_env("!spi_flash_probe() failed");
-   return 1;
-   }
+   set_default_env("!spi_flash_probe() failed");
+   return 1;
}
 
ret = env_export(_new);
@@ -131,6 +128,9 @@ int saveenv(void)
if (saved_buffer)
free(saved_buffer);
 
+   spi_flash_free(env_flash);
+   env_flash = NULL;
+
return ret;
 }
 
@@ -228,14 +228,11 @@ int saveenv(void)
int ret = 1;
env_t   env_new;
 
+   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
+   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
-   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
-   CONFIG_ENV_SPI_CS,
-   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
-   if (!env_flash) {
-   set_default_env("!spi_flash_probe() failed");
-   return 1;
-   }
+   set_default_env("!spi_flash_probe() failed");
+   return 1;
}
 
/* Is the sector larger than the env (i.e. embedded) */
@@ -288,6 +285,9 @@ int saveenv(void)
if (saved_buffer)
free(saved_buffer);
 
+   spi_flash_free(env_flash);
+   env_flash = NULL;
+
return ret;
 }
 
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 3/3] km_arm: call 'sf release' in the newenv and update scripts

2015-11-13 Thread Valentin Longchamp
This is necessary to make sure that all the pins used for SPI access,
especially the CS, are configured back to the NAND Flash interface.
Otherwise, if either newenv or update are called, u-boot cannot access
the NAND Flash anymore.

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v3: None
Changes in v2: None

 include/configs/km/km_arm.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index 15fca1a..7a0d3b1 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -271,13 +271,15 @@ int get_scl(void);
 #defineCONFIG_KM_UPDATE_UBOOT  
\
"update="   \
"sf probe 0;sf erase 0 +${filesize};"   \
-   "sf write ${load_addr_r} 0 ${filesize};\0"
+   "sf write ${load_addr_r} 0 ${filesize};"\
+   "sf release\0"
 
 #if defined CONFIG_KM_ENV_IS_IN_SPI_NOR
 #define CONFIG_KM_NEW_ENV  \
"newenv=sf probe 0;"\
"sf erase " __stringify(CONFIG_ENV_OFFSET) " "  \
-   __stringify(CONFIG_ENV_TOTAL_SIZE)"\0"
+   __stringify(CONFIG_ENV_TOTAL_SIZE)";"   \
+   "sf release\0"
 #else
 #define CONFIG_KM_NEW_ENV  \
"newenv=setenv addr 0x10 && "   \
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 0/3] Serial Flash: call spi_flash_free more coherently

2015-11-13 Thread Valentin Longchamp
Some board require spi_flash_free to be called after all the accesses,
in order, for instance, to restore the pin multiplexing configuration in
the case where the SPI pins are multiplexed.

This patch series tries to enhance this. Patch 1 adds spi_flash_free
calls to env_sf so that the SPI interface is always "cleaned up" after
the env read/writes. Patch 2 adds a 'sf release' command that implicitly
calls spi_flash_free and is thus the pendant of 'sf probe'. Patch 3 uses
the 'sf command' for the km_arm board scripts.

The whole series had already been sent more than 2 years ago [1] but it
was rejected without any feedback. So I send this rebased v2 so that it
finally gets reviewed and merged. This was not successfull either, again
without any given feedback. So this is a 3rd attempt to get some
feedback to get this mailined.

[1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/169723

Changes in v3:
- Rebased on v2015.10
- Rebased on v2015.10

Changes in v2:
- Rebased on v2014.10

Valentin Longchamp (3):
  cmd_sf: add 'release' command
  env_sf: generalize call to spi_flash_free after accesses
  km_arm: call 'sf release' in the newenv and update scripts

 common/cmd_sf.c | 11 +++
 common/env_sf.c | 28 ++--
 include/configs/km/km_arm.h |  6 --
 3 files changed, 29 insertions(+), 16 deletions(-)

-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/3] cmd_sf: add 'release' command

2015-11-13 Thread Valentin Longchamp
The release command is the pendant of the probe command. This command
allows to call spi_flash_free from the command line. This may be
necessary for some boards where sf probe does change the state of the
hardware (like with some pin multiplexing changes for instance).

Signed-off-by: Valentin Longchamp <valentin.longch...@keymile.com>
---

Changes in v3:
- Rebased on v2015.10

Changes in v2:
- Rebased on v2014.10

 common/cmd_sf.c | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index ac7f5df..9c51dca 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -152,6 +152,14 @@ static int do_spi_flash_probe(int argc, char * const 
argv[])
return 0;
 }
 
+static int do_spi_flash_release(int argc, char * const argv[])
+{
+   if (flash)
+   spi_flash_free(flash);
+   flash = NULL;
+
+   return 0;
+}
 /**
  * Write a block of data to SPI flash, first checking if it is different from
  * what is already there.
@@ -540,6 +548,8 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int 
argc,
ret = do_spi_flash_read_write(argc, argv);
else if (strcmp(cmd, "erase") == 0)
ret = do_spi_flash_erase(argc, argv);
+   else if (strcmp(cmd, "release") == 0)
+   ret = do_spi_flash_release(argc, argv);
 #ifdef CONFIG_CMD_SF_TEST
else if (!strcmp(cmd, "test"))
ret = do_spi_flash_test(argc, argv);
@@ -579,5 +589,6 @@ U_BOOT_CMD(
"sf update addr offset|partition len- erase and write `len' bytes 
from memory\n"
" at `addr' to flash at 
`offset'\n"
" or to start of mtd 
`partition'\n"
+   "sf release - release the current flash 
device\n"
SF_TEST_HELP
 );
-- 
1.8.3.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [RFC] powerpc: add 2 common dcache assembly functions

2015-03-27 Thread Valentin Longchamp
This patch defines the 2 flush_dcache_range and invalidate_dcache_range
functions for all the powerpc architecture. Their implementation is
borrowed from the kernel's misc_32.S file and replace the ones from
mpc86xx and ppc4xx since they were equivalent.

This is a fix for the problem introduced by this patch:
http://patchwork.ozlabs.org/patch/448849/

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---
 arch/powerpc/cpu/mpc512x/Makefile |  3 ---
 arch/powerpc/cpu/mpc512x/cache.c  | 17 --
 arch/powerpc/cpu/mpc5xxx/Makefile |  1 -
 arch/powerpc/cpu/mpc5xxx/cache.c  | 15 
 arch/powerpc/cpu/mpc83xx/Makefile |  3 ---
 arch/powerpc/cpu/mpc83xx/cache.c  | 17 --
 arch/powerpc/cpu/mpc85xx/Makefile |  3 ---
 arch/powerpc/cpu/mpc85xx/cache.c  | 17 --
 arch/powerpc/cpu/mpc86xx/cache.S  | 45 
 arch/powerpc/cpu/ppc4xx/cache.S   | 43 ---
 arch/powerpc/lib/ppccache.S   | 48 +++
 11 files changed, 48 insertions(+), 164 deletions(-)
 delete mode 100644 arch/powerpc/cpu/mpc512x/cache.c
 delete mode 100644 arch/powerpc/cpu/mpc5xxx/cache.c
 delete mode 100644 arch/powerpc/cpu/mpc83xx/cache.c
 delete mode 100644 arch/powerpc/cpu/mpc85xx/cache.c

diff --git a/arch/powerpc/cpu/mpc512x/Makefile 
b/arch/powerpc/cpu/mpc512x/Makefile
index a4934ef..98991c6 100644
--- a/arch/powerpc/cpu/mpc512x/Makefile
+++ b/arch/powerpc/cpu/mpc512x/Makefile
@@ -17,6 +17,3 @@ obj-y += speed.o
 obj-$(CONFIG_FSL_DIU_FB) += diu.o
 obj-$(CONFIG_CMD_IDE) += ide.o
 obj-$(CONFIG_PCI) += pci.o
-
-# Stub implementations of cache management functions for USB
-obj-$(CONFIG_USB_EHCI) += cache.o
diff --git a/arch/powerpc/cpu/mpc512x/cache.c b/arch/powerpc/cpu/mpc512x/cache.c
deleted file mode 100644
index 66384f9..000
--- a/arch/powerpc/cpu/mpc512x/cache.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2012 Marek Vasut ma...@denx.de
- *
- * This file contains stub implementation of
- *   invalidate_dcache_range()
- *   flush_dcache_range()
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-void invalidate_dcache_range(unsigned long start, unsigned long stop)
-{
-}
-
-void flush_dcache_range(unsigned long start, unsigned long stop)
-{
-}
diff --git a/arch/powerpc/cpu/mpc5xxx/Makefile 
b/arch/powerpc/cpu/mpc5xxx/Makefile
index d122b29..5c67e1d 100644
--- a/arch/powerpc/cpu/mpc5xxx/Makefile
+++ b/arch/powerpc/cpu/mpc5xxx/Makefile
@@ -7,7 +7,6 @@
 
 extra-y= start.o
 extra-y += traps.o
-obj-y  += cache.o
 obj-y  += io.o
 obj-y  += firmware_sc_task_bestcomm.impl.o
 obj-y += i2c.o
diff --git a/arch/powerpc/cpu/mpc5xxx/cache.c b/arch/powerpc/cpu/mpc5xxx/cache.c
deleted file mode 100644
index 5d674bc..000
--- a/arch/powerpc/cpu/mpc5xxx/cache.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * This file contains stub implementation of
- *   invalidate_dcache_range()
- *   flush_dcache_range()
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-void invalidate_dcache_range(unsigned long start, unsigned long stop)
-{
-}
-
-void flush_dcache_range(unsigned long start, unsigned long stop)
-{
-}
diff --git a/arch/powerpc/cpu/mpc83xx/Makefile 
b/arch/powerpc/cpu/mpc83xx/Makefile
index cf91162..a93cf13 100644
--- a/arch/powerpc/cpu/mpc83xx/Makefile
+++ b/arch/powerpc/cpu/mpc83xx/Makefile
@@ -35,9 +35,6 @@ obj-$(CONFIG_PCI) += pci.o
 obj-$(CONFIG_PCIE) += pcie.o
 obj-$(CONFIG_OF_LIBFDT) += fdt.o
 
-# Stub implementations of cache management functions for USB
-obj-y += cache.o
-
 ifndef CONFIG_SYS_FSL_DDRC_GEN2
 obj-y += spd_sdram.o
 endif
diff --git a/arch/powerpc/cpu/mpc83xx/cache.c b/arch/powerpc/cpu/mpc83xx/cache.c
deleted file mode 100644
index 66384f9..000
--- a/arch/powerpc/cpu/mpc83xx/cache.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2012 Marek Vasut ma...@denx.de
- *
- * This file contains stub implementation of
- *   invalidate_dcache_range()
- *   flush_dcache_range()
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-void invalidate_dcache_range(unsigned long start, unsigned long stop)
-{
-}
-
-void flush_dcache_range(unsigned long start, unsigned long stop)
-{
-}
diff --git a/arch/powerpc/cpu/mpc85xx/Makefile 
b/arch/powerpc/cpu/mpc85xx/Makefile
index b93158b..65c26c0 100644
--- a/arch/powerpc/cpu/mpc85xx/Makefile
+++ b/arch/powerpc/cpu/mpc85xx/Makefile
@@ -114,7 +114,4 @@ endif
 obj-y  += tlb.o
 obj-y  += traps.o
 
-# Stub implementations of cache management functions for USB
-obj-y += cache.o
-
 endif # not minimal
diff --git a/arch/powerpc/cpu/mpc85xx/cache.c b/arch/powerpc/cpu/mpc85xx/cache.c
deleted file mode 100644
index 66384f9..000
--- a/arch/powerpc/cpu/mpc85xx/cache.c
+++ /dev/null
@@ -1,17 +0,0 @@
-/*
- * Copyright (C) 2012 Marek Vasut ma...@denx.de
- *
- * This file contains stub implementation of
- *   invalidate_dcache_range()
- *   flush_dcache_range()
- *
- * SPDX-License-Identifier:GPL-2.0+
- */
-
-void invalidate_dcache_range(unsigned long

[U-Boot] [PATCH v3 6/6] KM/IVM: remove ivm_read_eeprom(void)

2015-02-10 Thread Valentin Longchamp
This is not used anymore since the procedure was split into a simple
read function and a later alaysis.

The ivm_read_eeprom name is now used for the previous
ivm_simple_read_eeprom function.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

Changes in v3: None
Changes in v2: None

 board/keymile/common/common.h   |  3 +--
 board/keymile/common/ivm.c  | 21 +
 board/keymile/km82xx/km82xx.c   |  2 +-
 board/keymile/km83xx/km83xx.c   |  2 +-
 board/keymile/km_arm/km_arm.c   |  2 +-
 board/keymile/kmp204x/kmp204x.c |  2 +-
 6 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 7e16d25..dcfefc4 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -126,8 +126,7 @@ struct bfticu_iomap {
 #endif
 
 int ethernet_present(void);
-int ivm_read_eeprom(void);
-int ivm_simple_read_eeprom(unsigned char *buf, int len);
+int ivm_read_eeprom(unsigned char *buf, int len);
 int ivm_analyze_eeprom(unsigned char *buf, int len);
 
 int trigger_fpga_config(void);
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 9abc09a..42db542 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -315,7 +315,7 @@ static int ivm_populate_env(unsigned char *buf, int len)
return 0;
 }
 
-int ivm_simple_read_eeprom(unsigned char *buf, int len)
+int ivm_read_eeprom(unsigned char *buf, int len)
 {
int ret;
 
@@ -331,22 +331,3 @@ int ivm_simple_read_eeprom(unsigned char *buf, int len)
 
return ivm_populate_env(buf, len);
 }
-
-int ivm_read_eeprom(void)
-{
-   uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
-   int ret;
-
-   i2c_set_bus_num(CONFIG_KM_IVM_BUS);
-   /* add deblocking here */
-   i2c_make_abort();
-
-   ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, i2c_buffer,
-   CONFIG_SYS_IVM_EEPROM_MAX_LEN);
-   if (ret != 0) {
-   printf(Error reading EEprom\n);
-   return -2;
-   }
-
-   return ivm_analyze_eeprom(i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
-}
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c3a1131..c599b40 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -397,7 +397,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index fc68a2f..89e9e1e 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -192,7 +192,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 6eb6712..2938861 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -212,7 +212,7 @@ int misc_init_r(void)
}
 #endif
 
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
 
initialize_unit_leds();
set_km_env();
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 0f544fb..eebb47f 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -197,7 +197,7 @@ int misc_init_r(void)
}
}
 
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 2/6] kirkwood/km_arm: read the IVM eeprom earlier

2015-02-10 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v3: None
Changes in v2: None

 board/keymile/km_arm/km_arm.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 1c7c108..6eb6712 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -102,6 +102,8 @@ static const u32 kwmpp_config[] = {
0
 };
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 #if defined(CONFIG_KM_MGCOGE3UN)
 /*
  * Wait for startup OK from mgcoge3ne
@@ -210,6 +212,8 @@ int misc_init_r(void)
}
 #endif
 
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+
initialize_unit_leds();
set_km_env();
set_bootcount_addr();
@@ -419,7 +423,7 @@ void reset_phy(void)
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 3/6] 85xx/kmp204x: read the IVM eeprom earlier

2015-02-10 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v3: None
Changes in v2: None

 board/keymile/kmp204x/kmp204x.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index a74f75b..0f544fb 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -26,6 +26,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 int checkboard(void)
 {
printf(Board: Keymile %s\n, CONFIG_KM_BOARD_NAME);
@@ -195,13 +197,14 @@ int misc_init_r(void)
}
}
 
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 4/6] 83xx/km83xx: read the IVM eeprom earlier

2015-02-10 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v3: None
Changes in v2: None

 board/keymile/km83xx/km83xx.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 1da0dcb..fc68a2f 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -28,6 +28,8 @@
 
 #include ../common/common.h
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 const qe_iop_conf_t qe_iop_conf_tab[] = {
/* port pin dir open_drain assign */
 #if defined(CONFIG_MPC8360)
@@ -190,6 +192,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
@@ -370,7 +373,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 0/6] keymile: enhance IVM reading

2015-02-10 Thread Valentin Longchamp
All Keymile boards have an EEPROM that is called IVM that contain
information about the board that is progammed at production time.
One piece of information is the MAC addresses assigned to the board.

u-boot requires the MAC address of the ethernet interfaces it uses to be
defined when the interface is intialized. This is most of the time read
from the environment but in the case where only the default environment
is available, this must be read from somewhere else, in our case the
IVM.

This patch series splits the reading and analysis of the IVM content in
2, so that the IVM content and MAC addresses can be read prior to
ethernet initialization. The analysis of the rest of the IVM content
still happens at a later second stage.

Changes in v3:
- Fix typo that prevented patch 1/6 from compiling

Changes in v2:
- Include the first patch, which was forgotten in the first submission

Valentin Longchamp (6):
  KM/IVM: split the IVM reading and parsing in 2 parts
  kirkwood/km_arm: read the IVM eeprom earlier
  85xx/kmp204x: read the IVM eeprom earlier
  83xx/km83xx: read the IVM eeprom earlier
  82xx/km82xx: read the IVM eeprom earlier
  KM/IVM: remove ivm_read_eeprom(void)

 board/keymile/common/common.h   |  3 +-
 board/keymile/common/ivm.c  | 77 +
 board/keymile/km82xx/km82xx.c   | 10 +-
 board/keymile/km83xx/km83xx.c   |  5 ++-
 board/keymile/km_arm/km_arm.c   |  6 +++-
 board/keymile/kmp204x/kmp204x.c |  5 ++-
 include/configs/km82xx.h|  2 ++
 7 files changed, 73 insertions(+), 35 deletions(-)

-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 5/6] 82xx/km82xx: read the IVM eeprom earlier

2015-02-10 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v3: None
Changes in v2: None

 board/keymile/km82xx/km82xx.c | 10 +-
 include/configs/km82xx.h  |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index bf84676..c3a1131 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -18,6 +18,8 @@
 #include i2c.h
 #include ../common/common.h
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 /*
  * I/O Port configuration table
  *
@@ -393,9 +395,15 @@ int board_early_init_r(void)
return 0;
 }
 
+int misc_init_r(void)
+{
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   return 0;
+}
+
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 14fd290..12f9d42 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -34,6 +34,8 @@
 
 #defineCONFIG_SYS_TEXT_BASE0xFE00
 
+#define CONFIG_MISC_INIT_R
+
 /* include common defines/options for all Keymile boards */
 #include km/keymile-common.h
 #include km/km-powerpc.h
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v3 1/6] KM/IVM: split the IVM reading and parsing in 2 parts

2015-02-10 Thread Valentin Longchamp
This allows to first read the IVM content (earlier in the boot sequence)
and define the ethaddr env variable thanks to the ivm_read_eepromi().
Later, the IVM content can be parsed and used to define some hush
variables, when the hush subsystem is available thanks to
ivm_analyze_eeprom().

To avoid the HW read to happen twice, the buffer passed to
ivm_read_eeprom() has to be reused by ivm_analyze_eeprom (and thus
allocated before calling ivm_read_eeprom()).

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

Changes in v3:
- Fix typo that prevented patch 1/6 from compiling

Changes in v2:
- Include the first patch, which was forgotten in the first submission

 board/keymile/common/common.h |  2 +
 board/keymile/common/ivm.c| 86 ++-
 2 files changed, 63 insertions(+), 25 deletions(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index e075f46..7e16d25 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -127,6 +127,8 @@ struct bfticu_iomap {
 
 int ethernet_present(void);
 int ivm_read_eeprom(void);
+int ivm_simple_read_eeprom(unsigned char *buf, int len);
+int ivm_analyze_eeprom(unsigned char *buf, int len);
 
 int trigger_fpga_config(void);
 int wait_for_fpga_config(void);
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index b6b19cc..9abc09a 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -10,6 +10,8 @@
 #include i2c.h
 #include common.h
 
+#define MAC_STR_SZ 20
+
 static int ivm_calc_crc(unsigned char *buf, int len)
 {
const unsigned short crc_tab[16] = {
@@ -185,45 +187,37 @@ static int ivm_check_crc(unsigned char *buf, int block)
return 0;
 }
 
-static int calculate_mac_offset(unsigned char *valbuf, unsigned char *buf,
+/* take care of the possible MAC address offset and the IVM content offset */
+static int process_mac(unsigned char *valbuf, unsigned char *buf,
int offset)
 {
+   unsigned char mac[6];
unsigned long val = (buf[4]  16) + (buf[5]  8) + buf[6];
 
-   if (offset == 0)
-   return 0;
+   /* use an intermediate buffer, to not change IVM content
+* MAC address is at offset 1
+*/
+   memcpy(mac, buf+1, 6);
 
-   val += offset;
-   buf[4] = (val  16)  0xff;
-   buf[5] = (val  8)  0xff;
-   buf[6] = val  0xff;
-   sprintf((char *)valbuf, %pM, buf + 1);
+   if (offset) {
+   val += offset;
+   mac[3] = (val  16)  0xff;
+   mac[4] = (val  8)  0xff;
+   mac[5] = val  0xff;
+   }
+
+   sprintf((char *)valbuf, %pM, mac);
return 0;
 }
 
 static int ivm_analyze_block2(unsigned char *buf, int len)
 {
-   unsigned char   valbuf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN];
+   unsigned char   valbuf[MAC_STR_SZ];
unsigned long   count;
 
/* IVM_MAC Adress begins at offset 1 */
sprintf((char *)valbuf, %pM, buf + 1);
ivm_set_value(IVM_MacAddress, (char *)valbuf);
-   /* if an offset is defined, add it */
-   calculate_mac_offset(buf, valbuf, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
-#ifdef MACH_TYPE_KM_KIRKWOOD
-   setenv((char *)ethaddr, (char *)valbuf);
-#else
-   if (getenv(ethaddr) == NULL)
-   setenv((char *)ethaddr, (char *)valbuf);
-#endif
-#ifdef CONFIG_KMVECT1
-/* KMVECT1 has two ethernet interfaces */
-   if (getenv(eth1addr) == NULL) {
-   calculate_mac_offset(buf, valbuf, 1);
-   setenv((char *)eth1addr, (char *)valbuf);
-   }
-#endif
/* IVM_MacCount */
count = (buf[10]  24) +
   (buf[11]  16) +
@@ -236,7 +230,7 @@ static int ivm_analyze_block2(unsigned char *buf, int len)
return 0;
 }
 
-static int ivm_analyze_eeprom(unsigned char *buf, int len)
+int ivm_analyze_eeprom(unsigned char *buf, int len)
 {
unsigned short  val;
unsigned char   valbuf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN];
@@ -296,6 +290,48 @@ static int ivm_analyze_eeprom(unsigned char *buf, int len)
return 0;
 }
 
+static int ivm_populate_env(unsigned char *buf, int len)
+{
+   unsigned char   *page2;
+   unsigned char   valbuf[MAC_STR_SZ];
+
+   /* do we have the page 2 filled ? if not return */
+   if (ivm_check_crc(buf, 2))
+   return 0;
+   page2 = buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN*2];
+
+   /* if an offset is defined, add it */
+   process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
+   if (getenv(ethaddr) == NULL)
+   setenv((char *)ethaddr, (char *)valbuf);
+#ifdef CONFIG_KMVECT1
+/* KMVECT1 has two ethernet interfaces */
+   if (getenv(eth1addr) == NULL) {
+   process_mac(valbuf, page2, 1);
+   setenv((char *)eth1addr, (char *)valbuf);
+   }
+#endif
+
+   return 0;
+}
+
+int ivm_simple_read_eeprom(unsigned char *buf, int len

[U-Boot] [PATCH v2 1/6] KM/IVM: split the IVM reading and parsing in 2 parts

2015-02-02 Thread Valentin Longchamp
This allows to first read the IVM content (earlier in the boot sequence)
and define the ethaddr env variable thanks to the ivm_read_eepromi().
Later, the IVM content can be parsed and used to define some hush
variables, when the hush subsystem is available thanks to
ivm_analyze_eeprom().

To avoid the HW read to happen twice, the buffer passed to
ivm_read_eeprom() has to be reused by ivm_analyze_eeprom (and thus
allocated before calling ivm_read_eeprom()).

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

Changes in v2:
- Include the first patch, which was forgotten in the first submission

 board/keymile/common/common.h |  2 +
 board/keymile/common/ivm.c| 88 ++-
 2 files changed, 64 insertions(+), 26 deletions(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index e075f46..7e16d25 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -127,6 +127,8 @@ struct bfticu_iomap {
 
 int ethernet_present(void);
 int ivm_read_eeprom(void);
+int ivm_simple_read_eeprom(unsigned char *buf, int len);
+int ivm_analyze_eeprom(unsigned char *buf, int len);
 
 int trigger_fpga_config(void);
 int wait_for_fpga_config(void);
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index b6b19cc..4cb0b9a 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -10,6 +10,8 @@
 #include i2c.h
 #include common.h
 
+#define MAC_STR_SZ 20
+
 static int ivm_calc_crc(unsigned char *buf, int len)
 {
const unsigned short crc_tab[16] = {
@@ -185,45 +187,37 @@ static int ivm_check_crc(unsigned char *buf, int block)
return 0;
 }
 
-static int calculate_mac_offset(unsigned char *valbuf, unsigned char *buf,
+/* take care of the possible MAC address offset and the IVM content offset */
+static int process_mac(unsigned char *valbuf, unsigned char *buf,
int offset)
 {
+   unsigned char mac[6];
unsigned long val = (buf[4]  16) + (buf[5]  8) + buf[6];
 
-   if (offset == 0)
-   return 0;
+   /* use an intermediate buffer, to not change IVM content
+* MAC address is at offset 1
+*/
+   memcpy(mac, buf+1, 6);
 
-   val += offset;
-   buf[4] = (val  16)  0xff;
-   buf[5] = (val  8)  0xff;
-   buf[6] = val  0xff;
-   sprintf((char *)valbuf, %pM, buf + 1);
+   if (offset) {
+   val += offset;
+   mac[3] = (val  16)  0xff;
+   mac[4] = (val  8)  0xff;
+   mac[5] = val  0xff;
+   }
+
+   sprintf((char *)valbuf, %pM, mac);
return 0;
 }
 
 static int ivm_analyze_block2(unsigned char *buf, int len)
 {
-   unsigned char   valbuf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN];
+   unsigned char   valbuf[MAC_STR_SZ];
unsigned long   count;
 
/* IVM_MAC Adress begins at offset 1 */
sprintf((char *)valbuf, %pM, buf + 1);
ivm_set_value(IVM_MacAddress, (char *)valbuf);
-   /* if an offset is defined, add it */
-   calculate_mac_offset(buf, valbuf, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
-#ifdef MACH_TYPE_KM_KIRKWOOD
-   setenv((char *)ethaddr, (char *)valbuf);
-#else
-   if (getenv(ethaddr) == NULL)
-   setenv((char *)ethaddr, (char *)valbuf);
-#endif
-#ifdef CONFIG_KMVECT1
-/* KMVECT1 has two ethernet interfaces */
-   if (getenv(eth1addr) == NULL) {
-   calculate_mac_offset(buf, valbuf, 1);
-   setenv((char *)eth1addr, (char *)valbuf);
-   }
-#endif
/* IVM_MacCount */
count = (buf[10]  24) +
   (buf[11]  16) +
@@ -236,7 +230,7 @@ static int ivm_analyze_block2(unsigned char *buf, int len)
return 0;
 }
 
-static int ivm_analyze_eeprom(unsigned char *buf, int len)
+int ivm_analyze_eeprom(unsigned char *buf, int len)
 {
unsigned short  val;
unsigned char   valbuf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN];
@@ -296,6 +290,48 @@ static int ivm_analyze_eeprom(unsigned char *buf, int len)
return 0;
 }
 
+static int ivm_populate_env(unsigned char *buf, int len)
+{
+   unsigned char   *page2;
+   unsigned char   valbuf[MAC_STR_SZ];
+
+   /* do we have the page 2 filled ? if not return */
+   if (ivm_check_crc(buf, 2))
+   return 0;
+   page2 = buf[CONFIG_SYS_IVM_EEPROM_PAGE_LEN*2];
+
+   /* if an offset is defined, add it */
+   process_mac(valbuf, page2, CONFIG_PIGGY_MAC_ADRESS_OFFSET);
+   if (getenv(ethaddr) == NULL)
+   setenv((char *)ethaddr, (char *)valbuf);
+#ifdef CONFIG_KMVECT1
+/* KMVECT1 has two ethernet interfaces */
+   if (getenv(eth1addr) == NULL) {
+   process_mac(valbuf, page2, 1);
+   setenv((char *)eth1addr, (char *)valbuf);
+   }
+#endif
+
+   return 0;
+}
+
+int ivm_simple_read_eeprom(unsigned char *buf, int len)
+{
+   int ret;
+
+   i2c_set_bus_num(CONFIG_KM_IVM_BUS

[U-Boot] [PATCH v2 2/6] kirkwood/km_arm: read the IVM eeprom earlier

2015-02-02 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v2: None

 board/keymile/km_arm/km_arm.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 1c7c108..6eb6712 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -102,6 +102,8 @@ static const u32 kwmpp_config[] = {
0
 };
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 #if defined(CONFIG_KM_MGCOGE3UN)
 /*
  * Wait for startup OK from mgcoge3ne
@@ -210,6 +212,8 @@ int misc_init_r(void)
}
 #endif
 
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+
initialize_unit_leds();
set_km_env();
set_bootcount_addr();
@@ -419,7 +423,7 @@ void reset_phy(void)
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/6] 85xx/kmp204x: read the IVM eeprom earlier

2015-02-02 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v2: None

 board/keymile/kmp204x/kmp204x.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index a74f75b..0f544fb 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -26,6 +26,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 int checkboard(void)
 {
printf(Board: Keymile %s\n, CONFIG_KM_BOARD_NAME);
@@ -195,13 +197,14 @@ int misc_init_r(void)
}
}
 
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 5/6] 82xx/km82xx: read the IVM eeprom earlier

2015-02-02 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v2: None

 board/keymile/km82xx/km82xx.c | 10 +-
 include/configs/km82xx.h  |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index bf84676..c3a1131 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -18,6 +18,8 @@
 #include i2c.h
 #include ../common/common.h
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 /*
  * I/O Port configuration table
  *
@@ -393,9 +395,15 @@ int board_early_init_r(void)
return 0;
 }
 
+int misc_init_r(void)
+{
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   return 0;
+}
+
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 14fd290..12f9d42 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -34,6 +34,8 @@
 
 #defineCONFIG_SYS_TEXT_BASE0xFE00
 
+#define CONFIG_MISC_INIT_R
+
 /* include common defines/options for all Keymile boards */
 #include km/keymile-common.h
 #include km/km-powerpc.h
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 4/6] 83xx/km83xx: read the IVM eeprom earlier

2015-02-02 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v2: None

 board/keymile/km83xx/km83xx.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 1da0dcb..fc68a2f 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -28,6 +28,8 @@
 
 #include ../common/common.h
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 const qe_iop_conf_t qe_iop_conf_tab[] = {
/* port pin dir open_drain assign */
 #if defined(CONFIG_MPC8360)
@@ -190,6 +192,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
@@ -370,7 +373,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 6/6] KM/IVM: remove ivm_read_eeprom(void)

2015-02-02 Thread Valentin Longchamp
This is not used anymore since the procedure was split into a simple
read function and a later alaysis.

The ivm_read_eeprom name is now used for the previous
ivm_simple_read_eeprom function.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

Changes in v2: None

 board/keymile/common/common.h   |  3 +--
 board/keymile/common/ivm.c  | 21 +
 board/keymile/km82xx/km82xx.c   |  2 +-
 board/keymile/km83xx/km83xx.c   |  2 +-
 board/keymile/km_arm/km_arm.c   |  2 +-
 board/keymile/kmp204x/kmp204x.c |  2 +-
 6 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 7e16d25..dcfefc4 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -126,8 +126,7 @@ struct bfticu_iomap {
 #endif
 
 int ethernet_present(void);
-int ivm_read_eeprom(void);
-int ivm_simple_read_eeprom(unsigned char *buf, int len);
+int ivm_read_eeprom(unsigned char *buf, int len);
 int ivm_analyze_eeprom(unsigned char *buf, int len);
 
 int trigger_fpga_config(void);
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 4cb0b9a..42db542 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -315,7 +315,7 @@ static int ivm_populate_env(unsigned char *buf, int len)
return 0;
 }
 
-int ivm_simple_read_eeprom(unsigned char *buf, int len)
+int ivm_read_eeprom(unsigned char *buf, int len)
 {
int ret;
 
@@ -331,22 +331,3 @@ int ivm_simple_read_eeprom(unsigned char *buf, int len)
 
return ivm_populate_env(buf, len);
 }
-
-int ivm_read_eeprom(void)
-{
-   uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
-   int ret;
-
-   i2c_set_bus_num(CONFIG_KM_IVM_BUS);
-   /* add deblocking here */
-   i2c_make_abort();
-
-   ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, i2c_bufer,
-   CONFIG_SYS_IVM_EEPROM_MAX_LEN);
-   if (ret != 0) {
-   printf(Error reading EEprom\n);
-   return -2;
-   }
-
-   return ivm_analyze_eeprom(i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
-}
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c3a1131..c599b40 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -397,7 +397,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index fc68a2f..89e9e1e 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -192,7 +192,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 6eb6712..2938861 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -212,7 +212,7 @@ int misc_init_r(void)
}
 #endif
 
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
 
initialize_unit_leds();
set_km_env();
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 0f544fb..eebb47f 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -197,7 +197,7 @@ int misc_init_r(void)
}
}
 
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void)

2015-02-02 Thread Valentin Longchamp
Hello Tom and Holger,

On 01/06/2015 09:19 AM, Brunck, Holger wrote:
 On 01/05/2015 07:47 PM, Tom Rini wrote:
 On Tue, Dec 23, 2014 at 02:08:57PM +0100, Valentin Longchamp wrote:

 This is not used anymore since the procedure was split into a simple
 read function and a later alaysis.

 The ivm_read_eeprom name is now used for the previous
 ivm_simple_read_eeprom function.

 Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

 This doesn't apply (but 1-4 does) because there's no
 ivm_simple_read_eeprom today.  Or have I gone crazy?  Thanks!

 
 you are right this is missing. I assume that there is a patch missing in his
 serie. Unfortunately Valentin is not in until the end of january, so I propose
 to skip this patch series for this merge window.
 

Yes the first patch was missing. I have unfortunately not included it in my
first submission just before leaving for holiday. I am sending a V2 that fixes
this right now.

Sorry for the noise

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 0/6] keymile: enhance IVM reading

2015-02-02 Thread Valentin Longchamp
All Keymile boards have an EEPROM that is called IVM that contain
information about the board that is progammed at production time.
One piece of information is the MAC addresses assigned to the board.

u-boot requires the MAC address of the ethernet interfaces it uses to be
defined when the interface is intialized. This is most of the time read
from the environment but in the case where only the default environment
is available, this must be read from somewhere else, in our case the
IVM.

This patch series splits the reading and analysis of the IVM content in
2, so that the IVM content and MAC addresses can be read prior to
ethernet initialization. The analysis of the rest of the IVM content
still happens at a later second stage.

Changes in v2:
- Include the first patch, which was forgotten in the first submission

Valentin Longchamp (6):
  KM/IVM: split the IVM reading and parsing in 2 parts
  kirkwood/km_arm: read the IVM eeprom earlier
  85xx/kmp204x: read the IVM eeprom earlier
  83xx/km83xx: read the IVM eeprom earlier
  82xx/km82xx: read the IVM eeprom earlier
  KM/IVM: remove ivm_read_eeprom(void)

 board/keymile/common/common.h   |  3 +-
 board/keymile/common/ivm.c  | 77 +
 board/keymile/km82xx/km82xx.c   | 10 +-
 board/keymile/km83xx/km83xx.c   |  5 ++-
 board/keymile/km_arm/km_arm.c   |  6 +++-
 board/keymile/kmp204x/kmp204x.c |  5 ++-
 include/configs/km82xx.h|  2 ++
 7 files changed, 73 insertions(+), 35 deletions(-)

-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 0/3] Serial Flash: call spi_flash_free more coherently

2014-12-23 Thread Valentin Longchamp
On 12/18/2014 03:03 PM, Jagan Teki wrote:
 On 3 November 2014 at 19:31, Valentin Longchamp
 valentin.longch...@keymile.com wrote:
 Some board require spi_flash_free to be called after all the accesses,
 in order, for instance, to restore the pin multiplexing configuration in
 the case where the SPI pins are multiplexed.
 
 So, for each probe calls you must need to free the flash even-though
 the flash is-in-use, looks some different behavior.

To be precise, AFTER the flash has been used is a better description. The flash
is not in use anymore.

 
 Can you pleas elaborate little more.

Let me explain you our use case more in details. In our case the pins used for
accessing the SPI NOR flash (contains u-boot and the environment) are
multiplexed with the pins used for accessing the NAND Flash.

In an usual boot sequence, the SPI NOR is accessed first (copying u-boot to the
RAM, reading out the environment) and so the pins are configured in hardware at
boot time for accessing the SPI NOR. After that, they are configured to access
the NAND where the kernel and filesystem are stored to boot Linux thanks to
env_relocate_spec() calling spi_flash_free() on exit in conjunction with [1]

Now in the case where the boot sequence is interrupted and some accesses are
done to the SPI NOR, the pins are changed again temporarily to NOR to do these
accesses. But we have to make sure that the pins are configured back to NAND by
calling spi_flash_free() after these accesses. In our case, there are 2 types of
such accesses:
- environment variables write: this is the first patch of the series. It simply
adds calls to spi_flash_free() at function exit no only in env_relocate_spec()
but also in saveenv() so that the behavior here is coherent for the whole env_sf
file (spi_flash_probe() at function start, spi_flash_free() at function exit).
- updating u-boot: this is solved for us with the last 2 patches of the series.
The first one just adds a sf release command that does the opposite/cleanup to
sf probe and the second patch just calls this command in our scripts where
u-boot is updated/the SPI NOR is written.

[1] http://patchwork.ozlabs.org/patch/162307/

 

 This patch series tries to enhance this. Patch 1 adds spi_flash_free
 calls to env_sf so that the SPI interface is always cleaned up after
 the env read/writes. Patch 2 adds a 'sf release' command that implicitly
 calls spi_flash_free and is thus the pendant of 'sf probe'. Patch 3 uses
 the 'sf command' for the km_arm board scripts.

 The whole series had already been sent more than a year ago [1] but it
 was rejected without any feedback. So I send this rebased v2 so that it
 finally gets reviewed and merged.

 [1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/169723

 Changes in v2:
 - Rebased on v2014.10

 Valentin Longchamp (3):
   env_sf: generalize call to spi_flash_free after accesses
   cmd_sf: add 'release' command
 
 This may not be an optimistic solutions where we couldn't add command
 to have generic behavior which does at-least on probe time - IMHO.

Do you mean optimal ? Anyway I don't understand your sentence/what you mean
here. Could you rephrase it, please ?

But if we have a sf probe command, why can't we have a sf release command ?

 
   km_arm: call 'sf release' in the newenv and update scripts

  common/cmd_sf.c | 13 -
  common/env_sf.c | 34 --
  include/configs/km/km_arm.h |  6 --
  3 files changed, 32 insertions(+), 21 deletions(-)

 --
 1.8.0.1

 
 thanks!
 

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 0/5] keymile: enhance IVM reading

2014-12-23 Thread Valentin Longchamp
All Keymile boards have an EEPROM that is called IVM that contain
information about the board that is progammed at production time.
One piece of information is the MAC addresses assigned to the board.

u-boot requires the MAC address of the ethernet interfaces it uses to be
defined when the interface is intialized. This is most of the time read
from the environment but in the case where only the default environment
is available, this must be read from somewhere else, in our case the
IVM.

This patch series splits the reading and analysis of the IVM content in
2, so that the IVM content and MAC addresses can be read prior to
ethernet initialization. The analysis of the rest of the IVM content
still happens at a later second stage.


Valentin Longchamp (5):
  kirkwood/km_arm: read the IVM eeprom earlier
  85xx/kmp204x: read the IVM eeprom earlier
  83xx/km83xx: read the IVM eeprom earlier
  82xx/km82xx: read the IVM eeprom earlier
  KM/IVM: remove ivm_read_eeprom(void)

 board/keymile/common/common.h   |  3 +--
 board/keymile/common/ivm.c  | 21 +
 board/keymile/km82xx/km82xx.c   | 10 +-
 board/keymile/km83xx/km83xx.c   |  5 -
 board/keymile/km_arm/km_arm.c   |  6 +-
 board/keymile/kmp204x/kmp204x.c |  5 -
 include/configs/km82xx.h|  2 ++
 7 files changed, 26 insertions(+), 26 deletions(-)

-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/5] 85xx/kmp204x: read the IVM eeprom earlier

2014-12-23 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 board/keymile/kmp204x/kmp204x.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index a74f75b..0f544fb 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -26,6 +26,8 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 int checkboard(void)
 {
printf(Board: Keymile %s\n, CONFIG_KM_BOARD_NAME);
@@ -195,13 +197,14 @@ int misc_init_r(void)
}
}
 
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 3/5] 83xx/km83xx: read the IVM eeprom earlier

2014-12-23 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 board/keymile/km83xx/km83xx.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 1da0dcb..fc68a2f 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -28,6 +28,8 @@
 
 #include ../common/common.h
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 const qe_iop_conf_t qe_iop_conf_tab[] = {
/* port pin dir open_drain assign */
 #if defined(CONFIG_MPC8360)
@@ -190,6 +192,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
@@ -370,7 +373,7 @@ int ft_board_setup(void *blob, bd_t *bd)
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/5] kirkwood/km_arm: read the IVM eeprom earlier

2014-12-23 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 board/keymile/km_arm/km_arm.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 1c7c108..6eb6712 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -102,6 +102,8 @@ static const u32 kwmpp_config[] = {
0
 };
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 #if defined(CONFIG_KM_MGCOGE3UN)
 /*
  * Wait for startup OK from mgcoge3ne
@@ -210,6 +212,8 @@ int misc_init_r(void)
}
 #endif
 
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+
initialize_unit_leds();
set_km_env();
set_bootcount_addr();
@@ -419,7 +423,7 @@ void reset_phy(void)
 #if defined(CONFIG_HUSH_INIT_VAR)
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 #endif
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void)

2014-12-23 Thread Valentin Longchamp
This is not used anymore since the procedure was split into a simple
read function and a later alaysis.

The ivm_read_eeprom name is now used for the previous
ivm_simple_read_eeprom function.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

 board/keymile/common/common.h   |  3 +--
 board/keymile/common/ivm.c  | 21 +
 board/keymile/km82xx/km82xx.c   |  2 +-
 board/keymile/km83xx/km83xx.c   |  2 +-
 board/keymile/km_arm/km_arm.c   |  2 +-
 board/keymile/kmp204x/kmp204x.c |  2 +-
 6 files changed, 6 insertions(+), 26 deletions(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 7e16d25..dcfefc4 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -126,8 +126,7 @@ struct bfticu_iomap {
 #endif
 
 int ethernet_present(void);
-int ivm_read_eeprom(void);
-int ivm_simple_read_eeprom(unsigned char *buf, int len);
+int ivm_read_eeprom(unsigned char *buf, int len);
 int ivm_analyze_eeprom(unsigned char *buf, int len);
 
 int trigger_fpga_config(void);
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 932459a..0a3a2bf 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -315,7 +315,7 @@ static int ivm_populate_env(unsigned char *buf, int len)
return 0;
 }
 
-int ivm_simple_read_eeprom(unsigned char *buf, int len)
+int ivm_read_eeprom(unsigned char *buf, int len)
 {
int ret;
 
@@ -331,22 +331,3 @@ int ivm_simple_read_eeprom(unsigned char *buf, int len)
 
return ivm_populate_env(buf, len);
 }
-
-int ivm_read_eeprom(void);
-{
-   uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
-   int ret;
-
-   i2c_set_bus_num(CONFIG_KM_IVM_BUS);
-   /* add deblocking here */
-   i2c_make_abort();
-
-   ret = i2c_read(CONFIG_SYS_IVM_EEPROM_ADR, 0, 1, i2c_bufer,
-   CONFIG_SYS_IVM_EEPROM_MAX_LEN);
-   if (ret != 0) {
-   printf(Error reading EEprom\n);
-   return -2;
-   }
-
-   return ivm_analyze_eeprom(i2c_buffer, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
-}
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c3a1131..c599b40 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -397,7 +397,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index fc68a2f..89e9e1e 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -192,7 +192,7 @@ int board_early_init_r(void)
 
 int misc_init_r(void)
 {
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 6eb6712..2938861 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -212,7 +212,7 @@ int misc_init_r(void)
}
 #endif
 
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
 
initialize_unit_leds();
set_km_env();
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 0f544fb..eebb47f 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -197,7 +197,7 @@ int misc_init_r(void)
}
}
 
-   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   ivm_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 4/5] 82xx/km82xx: read the IVM eeprom earlier

2014-12-23 Thread Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM
content by reading the IVM in misc_init_r.

Later, when HUSH is available the content read earlier is analyzed to
populate some non env variables.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 board/keymile/km82xx/km82xx.c | 10 +-
 include/configs/km82xx.h  |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index bf84676..c3a1131 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -18,6 +18,8 @@
 #include i2c.h
 #include ../common/common.h
 
+static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN];
+
 /*
  * I/O Port configuration table
  *
@@ -393,9 +395,15 @@ int board_early_init_r(void)
return 0;
 }
 
+int misc_init_r(void)
+{
+   ivm_simple_read_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
+   return 0;
+}
+
 int hush_init_var(void)
 {
-   ivm_read_eeprom();
+   ivm_analyze_eeprom(ivm_content, CONFIG_SYS_IVM_EEPROM_MAX_LEN);
return 0;
 }
 
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 14fd290..12f9d42 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -34,6 +34,8 @@
 
 #defineCONFIG_SYS_TEXT_BASE0xFE00
 
+#define CONFIG_MISC_INIT_R
+
 /* include common defines/options for all Keymile boards */
 #include km/keymile-common.h
 #include km/km-powerpc.h
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [ANN] U-Boot v2015.01-rc1 released

2014-11-14 Thread Valentin Longchamp
Hi Tom,

On 11/10/2014 10:29 PM, Tom Rini wrote:
 Hey all,
 
 I've pushed v2015.01-rc1 out to the repository and tarballs should exist
 soon.
 
 The merge window is now closed.  Per both the min-summit and the follow
 up emails, I'm going to try and get into the every 2 week RC tagging
 groove.  And, I'm going to be relying on everyones best judgement about
 what level of changes they're going to put into a pull request to me.
 
 When I do a buildman of most things I see:
   blackfin: +   ip04
arm: +   Ippo_q8h_v5 novena openrd_base maxbcm openrd_ultimate 
 openrd_client tricorder db-mv784mp-gp Linksprite_pcDuino3_fdt tricorder_flash 
 cm_t3517
powerpc: +   kmcoge4 taishan kmlion1 dlvision  
 
 And I'd really like to see those sorted out, one way or another for
 -rc2.
 

For both kmcoge4 and kmlion1, the error is fixed by [1].

Hopefully York will be able to review this, also with the 2 patches for  the
migration of the keymile powerpc board to generic board, for -rc2.

Best Regards

Valentin

[1] http://patchwork.ozlabs.org/patch/403232/

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 2/3] cmd_sf: add 'release' command

2014-11-03 Thread Valentin Longchamp
The release command is the pendant of the probe command. This command
allows to call spi_flash_free from the command line. This may be
necessary for some boards where sf probe does change the state of the
hardware (like with some pin multiplexing changes for instance).

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v2: None

 common/cmd_sf.c | 13 -
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/common/cmd_sf.c b/common/cmd_sf.c
index c60e8d1..453b466 100644
--- a/common/cmd_sf.c
+++ b/common/cmd_sf.c
@@ -121,6 +121,14 @@ static int do_spi_flash_probe(int argc, char * const 
argv[])
return 0;
 }
 
+static int do_spi_flash_release(int argc, char * const argv[])
+{
+   if (flash)
+   spi_flash_free(flash);
+   flash = NULL;
+
+   return 0;
+}
 /**
  * Write a block of data to SPI flash, first checking if it is different from
  * what is already there.
@@ -504,6 +512,8 @@ static int do_spi_flash(cmd_tbl_t *cmdtp, int flag, int 
argc,
ret = do_spi_flash_read_write(argc, argv);
else if (strcmp(cmd, erase) == 0)
ret = do_spi_flash_erase(argc, argv);
+   else if (strcmp(cmd, release) == 0)
+   ret = do_spi_flash_release(argc, argv);
 #ifdef CONFIG_CMD_SF_TEST
else if (!strcmp(cmd, test))
ret = do_spi_flash_test(argc, argv);
@@ -538,6 +548,7 @@ U_BOOT_CMD(
sf erase offset [+]len - erase `len' bytes from `offset'\n
 `+len' round up `len' to block size\n
sf update addr offset len  - erase and write `len' bytes from 
memory\n
-at `addr' to flash at `offset'
+at `addr' to flash at `offset'\n
+   sf release - release the current flash device
SF_TEST_HELP
 );
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 0/3] Serial Flash: call spi_flash_free more coherently

2014-11-03 Thread Valentin Longchamp
Some board require spi_flash_free to be called after all the accesses,
in order, for instance, to restore the pin multiplexing configuration in
the case where the SPI pins are multiplexed.

This patch series tries to enhance this. Patch 1 adds spi_flash_free
calls to env_sf so that the SPI interface is always cleaned up after
the env read/writes. Patch 2 adds a 'sf release' command that implicitly
calls spi_flash_free and is thus the pendant of 'sf probe'. Patch 3 uses
the 'sf command' for the km_arm board scripts.

The whole series had already been sent more than a year ago [1] but it
was rejected without any feedback. So I send this rebased v2 so that it
finally gets reviewed and merged.

[1] http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/169723

Changes in v2:
- Rebased on v2014.10

Valentin Longchamp (3):
  env_sf: generalize call to spi_flash_free after accesses
  cmd_sf: add 'release' command
  km_arm: call 'sf release' in the newenv and update scripts

 common/cmd_sf.c | 13 -
 common/env_sf.c | 34 --
 include/configs/km/km_arm.h |  6 --
 3 files changed, 32 insertions(+), 21 deletions(-)

-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 1/3] env_sf: generalize call to spi_flash_free after accesses

2014-11-03 Thread Valentin Longchamp
Some board require spi_flash_free to be called after all the accesses,
in order, for instance, to restore the pin multiplexing configuration in
the case where the SPI pins are multiplexed.

This was done only in env_relocate_spec and not in saveenv. saveenv is
thus changed in order to have the same behavior as env_relocate_spec.

Since the static env_flash variable will be NULL after every function
call, it is thus removed and its functionality is replaced by a
systematic call to spi_flash_probe at the start of both
env_relocate_spec and saveenv.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

Changes in v2:
- Rebased on v2014.10

 common/env_sf.c | 34 --
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/common/env_sf.c b/common/env_sf.c
index 37ab13a..823f4ad 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -41,24 +41,20 @@ DECLARE_GLOBAL_DATA_PTR;
 
 char *env_name_spec = SPI Flash;
 
-static struct spi_flash *env_flash;
-
 #if defined(CONFIG_ENV_OFFSET_REDUND)
 int saveenv(void)
 {
env_t   env_new;
char*saved_buffer = NULL, flag = OBSOLETE_FLAG;
u32 saved_size, saved_offset, sector = 1;
+   struct spi_flash *env_flash = NULL;
int ret;
 
+   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
+   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
-   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
-   CONFIG_ENV_SPI_CS,
-   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
-   if (!env_flash) {
-   set_default_env(!spi_flash_probe() failed);
-   return 1;
-   }
+   set_default_env(!spi_flash_probe() failed);
+   return 1;
}
 
ret = env_export(env_new);
@@ -130,6 +126,8 @@ int saveenv(void)
if (saved_buffer)
free(saved_buffer);
 
+   spi_flash_free(env_flash);
+
return ret;
 }
 
@@ -140,6 +138,7 @@ void env_relocate_spec(void)
env_t *tmp_env1 = NULL;
env_t *tmp_env2 = NULL;
env_t *ep = NULL;
+   struct spi_flash *env_flash = NULL;
 
tmp_env1 = (env_t *)malloc(CONFIG_ENV_SIZE);
tmp_env2 = (env_t *)malloc(CONFIG_ENV_SIZE);
@@ -211,7 +210,6 @@ void env_relocate_spec(void)
 
 err_read:
spi_flash_free(env_flash);
-   env_flash = NULL;
 out:
free(tmp_env1);
free(tmp_env2);
@@ -223,15 +221,13 @@ int saveenv(void)
char*saved_buffer = NULL;
int ret = 1;
env_t   env_new;
+   struct  spi_flash *env_flash = NULL;
 
+   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS,
+   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
if (!env_flash) {
-   env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS,
-   CONFIG_ENV_SPI_CS,
-   CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE);
-   if (!env_flash) {
-   set_default_env(!spi_flash_probe() failed);
-   return 1;
-   }
+   set_default_env(!spi_flash_probe() failed);
+   return 1;
}
 
/* Is the sector larger than the env (i.e. embedded) */
@@ -284,11 +280,14 @@ int saveenv(void)
if (saved_buffer)
free(saved_buffer);
 
+   spi_flash_free(env_flash);
+
return ret;
 }
 
 void env_relocate_spec(void)
 {
+   struct  spi_flash *env_flash = NULL;
int ret;
char *buf = NULL;
 
@@ -316,7 +315,6 @@ out:
spi_flash_free(env_flash);
if (buf)
free(buf);
-   env_flash = NULL;
 }
 #endif
 
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH v2 3/3] km_arm: call 'sf release' in the newenv and update scripts

2014-11-03 Thread Valentin Longchamp
This is necessary to make sure that all the pins used for SPI access,
especially the CS, are configured back to the NAND Flash interface.
Otherwise, if either newenv or update are called, u-boot cannot access
the NAND Flash anymore.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

Changes in v2: None

 include/configs/km/km_arm.h | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index d31e674..d8f86b4 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -273,13 +273,15 @@ int get_scl(void);
 #defineCONFIG_KM_UPDATE_UBOOT  
\
update=   \
sf probe 0;sf erase 0 +${filesize};   \
-   sf write ${load_addr_r} 0 ${filesize};\0
+   sf write ${load_addr_r} 0 ${filesize};\
+   sf release\0
 
 #if defined CONFIG_KM_ENV_IS_IN_SPI_NOR
 #define CONFIG_KM_NEW_ENV  \
newenv=sf probe 0;\
sf erase  __stringify(CONFIG_ENV_OFFSET)\
-   __stringify(CONFIG_ENV_TOTAL_SIZE)\0
+   __stringify(CONFIG_ENV_TOTAL_SIZE);   \
+   sf release\0
 #else
 #define CONFIG_KM_NEW_ENV  \
newenv=setenv addr 0x10 \
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please increase the image size for km boards

2014-10-26 Thread Valentin Longchamp
On 10/23/2014 05:13 PM, York Sun wrote:
 On 10/23/2014 08:02 AM, Valentin Longchamp wrote:
 Hi York,

 On 10/01/2014 05:41 PM, York Sun wrote:
 On 10/01/2014 08:39 AM, Valentin Longchamp wrote:
 Hi York,

 On 09/30/2014 05:48 PM, York Sun wrote:
 Valentin,

 We are seeing the image size of kmcoge4 and kmlion1 are on the edge. 
 Attempts to
 add new features cause overflow. Would you consider to increase the image 
 size
 for km boards. You may have noticed several patches doing this for 
 selected
 boards (search git log for 768K).


 I am going to have a look at it and see what the impact is for us. 
 Basically I
 have nothing against changing this value, especially for kmcoge4/kmlion1.


 Thanks. I can anticipate some chaos on the flash memory map. The 
 environmental
 variables are stored before u-boot in flash, if FMan ucode if the SoC 
 requires it.


 I have finally had time to look at this point. For kmcoge4, we are lucky to 
 have
 enough space on our boot SPI Flash and I had reserved 1M for u-boot when 
 doing
 the layout to have some reserve. So in my case I am avoiding the possible 
 flash
 memory map chaos.

 If I have understood correctly, for the powerpc boards, the default value was
 changed from 512K to 768K. What do you think makes more sense, stay on line 
 with
 the other powerpc boards with 768K or go directly to 1M since this space is
 avaible ? I prefer to stay on line.
 
 I agree.
 

 Another question: am I right that the two things that need to be adjusted 
 are:
 - CONFIG_SYS_TEXT_BASE
 - CONFIG_SYS_MONITOR_LEN

 or am I missing something ?

 
 You don't have other than NOR flash boot, do you? If yes, you need to take 
 care
 of them, too. You can find some example by looking into git log, search for 
 768K.
 

No we don't. SPI NOR Flash is the only boot flash supported on this design. So I
think the above changes should be enough. I will give them a try and send the
patch when tested.

Valentin

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] mpc85xx/kmp204x: raise u-boot size to 768KB

2014-10-26 Thread Valentin Longchamp
Until now this defined to be 512KB and the total binary size actually
was on the edge of this limit. Most of the powerpc boards have thus
moved to 768KB.

Since on the current kmp204x boards there is 1MB reserved for u-boot on
the SPI boot flash, there is no problem to set the limit to 768KB as
well to be on line with the other powerpc boards and to eventually
configure in some additional features (and binary size) to u-boot.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 include/configs/km/kmp204x-common.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/configs/km/kmp204x-common.h 
b/include/configs/km/kmp204x-common.h
index a0f9d29..c5c9dfc 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -11,7 +11,7 @@
 #define CONFIG_PHYS_64BIT
 #define CONFIG_PPC_P2041
 
-#define CONFIG_SYS_TEXT_BASE   0xfff8
+#define CONFIG_SYS_TEXT_BASE   0xfff4
 
 #define CONFIG_KM_DEF_NETDEV   netdev=eth0\0
 
@@ -235,7 +235,7 @@ unsigned long get_board_sys_clk(unsigned long dummy);
 #define CONFIG_SYS_INIT_SP_OFFSET  CONFIG_SYS_GBL_DATA_OFFSET
 
 #define CONFIG_SYS_MONITOR_BASECONFIG_SYS_TEXT_BASE
-#define CONFIG_SYS_MONITOR_LEN (512 * 1024)
+#define CONFIG_SYS_MONITOR_LEN (768 * 1024)
 #define CONFIG_SYS_MALLOC_LEN  (1024 * 1024)
 
 /* Serial Port - controlled on board with jumper J8
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please increase the image size for km boards

2014-10-23 Thread Valentin Longchamp
Hi York,

On 10/01/2014 05:41 PM, York Sun wrote:
 On 10/01/2014 08:39 AM, Valentin Longchamp wrote:
 Hi York,

 On 09/30/2014 05:48 PM, York Sun wrote:
 Valentin,

 We are seeing the image size of kmcoge4 and kmlion1 are on the edge. 
 Attempts to
 add new features cause overflow. Would you consider to increase the image 
 size
 for km boards. You may have noticed several patches doing this for selected
 boards (search git log for 768K).


 I am going to have a look at it and see what the impact is for us. Basically 
 I
 have nothing against changing this value, especially for kmcoge4/kmlion1.

 
 Thanks. I can anticipate some chaos on the flash memory map. The environmental
 variables are stored before u-boot in flash, if FMan ucode if the SoC 
 requires it.
 

I have finally had time to look at this point. For kmcoge4, we are lucky to have
enough space on our boot SPI Flash and I had reserved 1M for u-boot when doing
the layout to have some reserve. So in my case I am avoiding the possible flash
memory map chaos.

If I have understood correctly, for the powerpc boards, the default value was
changed from 512K to 768K. What do you think makes more sense, stay on line with
the other powerpc boards with 768K or go directly to 1M since this space is
avaible ? I prefer to stay on line.

Another question: am I right that the two things that need to be adjusted are:
- CONFIG_SYS_TEXT_BASE
- CONFIG_SYS_MONITOR_LEN

or am I missing something ?

Thank you very much

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] Revert common, env: Fix support for environment in i2c eeprom

2014-10-14 Thread Valentin Longchamp
Since i2c_init_all always sets the bus back to CONFIG_SYS_SPD_BUS_NUM
for compatibility reasons, it means that any eeprom not located on this
CONFIG_SYS_SPD_BUS_NUM is not accessible with the eeprom commands, even
if you change the bus number with an i2c dev command before.

Furthermore i2c_init_all should disappear and is currently only called
from the early board initialisation sequences, it is not suited for
other usage.

This reverts commit 01a0c64762e902971b34587a8a61b59e9ea51374.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

 common/cmd_eeprom.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
index a02f0cb..29f0f1f 100644
--- a/common/cmd_eeprom.c
+++ b/common/cmd_eeprom.c
@@ -389,13 +389,8 @@ void eeprom_init  (void)
 #if defined(CONFIG_SPI)  !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
spi_init_f ();
 #endif
-#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) || \
-   defined(CONFIG_SYS_I2C)
-#ifdef CONFIG_SYS_I2C
-   i2c_init_all();
-#else
-   i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
-#endif
+#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT)
+   i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 #endif
 }
 
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] km_kirkwood: remove KM_ENV_BUS and use CONFIG_I2C_ENV_EEPROM_BUS

2014-10-14 Thread Valentin Longchamp
KM_ENV_BUS was used for nothing else than an direct assignment to
CONFIG_I2C_ENV_EEPROM_BUS. To avoid this, directly use
CONFIG_I2C_ENV_EEPROM_BUS instead.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

---

 include/configs/km/km_arm.h   | 2 +-
 include/configs/km_kirkwood.h | 4 
 2 files changed, 1 insertion(+), 5 deletions(-)

diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index d31e674..04cddb1 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -244,7 +244,7 @@ int get_scl(void);
 #define CONFIG_SYS_EEPROM_WREN
 #define CONFIG_ENV_OFFSET  0x0 /* no bracets! */
 #define CONFIG_ENV_SIZE(0x2000 - CONFIG_ENV_OFFSET)
-#define CONFIG_I2C_ENV_EEPROM_BUS  KM_ENV_BUS
+#define CONFIG_I2C_ENV_EEPROM_BUS 5 /* I2C2 (Mux-Port 5) */
 #define CONFIG_ENV_OFFSET_REDUND   0x2000 /* no bracets! */
 #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE)
 #endif
diff --git a/include/configs/km_kirkwood.h b/include/configs/km_kirkwood.h
index dc26155..a445aaf 100644
--- a/include/configs/km_kirkwood.h
+++ b/include/configs/km_kirkwood.h
@@ -116,10 +116,6 @@
 /* include common defines/options for all arm based Keymile boards */
 #include km/km_arm.h
 
-#ifndef CONFIG_KM_ENV_IS_IN_SPI_NOR
-#define KM_ENV_BUS 5   /* I2C2 (Mux-Port 5)*/
-#endif
-
 #if defined(CONFIG_KM_PIGGY4_88E6352)
 /*
  * Some keymile boards like mgcoge5un  nusa1 have their PIGGY4 connected via
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] Revert common, env: Fix support for environment in i2c eeprom

2014-10-14 Thread Valentin Longchamp
Hi Matthias,

On 10/14/2014 02:32 PM, Matthias Fuchs wrote:
 Hi Valentin,
 
 my patch fixed environment from i2c eeprom. I am not sure on which board
 I ran into that trouble. Probably PMC440. So reverting my former patch
 will break environment in i2c eeprom again on many boards.

Good that you have answered to patch. I run into that trouble on our Keymile
boards that have the environment in the EEPROM. On our boards, the environment
eeprom works with or without your patch. However, with your patch, I cannot
directly access ANY eeprom which is not on the CONFIG_I2C_ENV_EEPROM_BUS bus.

 
 But perhaps there's a better way to fix that.

I think that the proposal that Holger made to actually define
CONFIG_I2C_ENV_EEPROM_BUS for your boards is what I would try first.

Valentin

 
 Matthias
 
 
 On 10/14/2014 11:16 AM, Valentin Longchamp wrote:
 Since i2c_init_all always sets the bus back to CONFIG_SYS_SPD_BUS_NUM
 for compatibility reasons, it means that any eeprom not located on this
 CONFIG_SYS_SPD_BUS_NUM is not accessible with the eeprom commands, even
 if you change the bus number with an i2c dev command before.

 Furthermore i2c_init_all should disappear and is currently only called
 from the early board initialisation sequences, it is not suited for
 other usage.

 This reverts commit 01a0c64762e902971b34587a8a61b59e9ea51374.

 Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com

 ---

  common/cmd_eeprom.c | 9 ++---
  1 file changed, 2 insertions(+), 7 deletions(-)

 diff --git a/common/cmd_eeprom.c b/common/cmd_eeprom.c
 index a02f0cb..29f0f1f 100644
 --- a/common/cmd_eeprom.c
 +++ b/common/cmd_eeprom.c
 @@ -389,13 +389,8 @@ void eeprom_init  (void)
  #if defined(CONFIG_SPI)  !defined(CONFIG_ENV_EEPROM_IS_ON_I2C)
  spi_init_f ();
  #endif
 -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT) || \
 -defined(CONFIG_SYS_I2C)
 -#ifdef CONFIG_SYS_I2C
 -i2c_init_all();
 -#else
 -i2c_init(CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
 -#endif
 +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SYS_I2C_SOFT)
 +i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE);
  #endif
  }
  

 
 

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 0/3] Serial Flash: call spi_flash_free more coherently

2014-10-10 Thread Valentin Longchamp
Hello Jagannadha,

On 01/21/2014 11:03 AM, Valentin Longchamp wrote:
 On 09/17/2013 08:46 AM, Valentin Longchamp wrote:
 Some board require spi_flash_free to be called after all the accesses,
 in order, for instance, to restore the pin multiplexing configuration in
 the case where the SPI pins are multiplexed.

 This patch series tries to enhance this. Patch 1 adds spi_flash_free
 calls to env_sf so that the SPI interface is always cleaned up after
 the env read/writes. Patch 2 adds a 'sf release' command that implicitly
 calls spi_flash_free and is thus the pendant of 'sf probe'. Patch 3 uses
 the 'sf command' for the km_arm board scripts.


 Valentin Longchamp (3):
   env_sf: generalize call to spi_flash_free after accesses
   cmd_sf: add 'release' command
   km_arm: call 'sf release' in the newenv and update scripts

  common/cmd_sf.c | 13 -
  common/env_sf.c | 34 --
  include/configs/km/km_arm.h |  6 --
  3 files changed, 32 insertions(+), 21 deletions(-)

 
 I have sent this series 4 months ago and while it is according to patchwork
 under review I have not received any feedback yet.
 
 That would be nice if this goes into the next merge window since they have 
 been
 floating around for 4 months now.
 

Here I ping again ! I have sent this series more than a year ago and you had
promised me a off list a review in a few days at the beginning of march 2014
... but I have seen nothing. The only thing that has happened is that the first
patch of the series was rejected by you.

I don't mind that the patch was rejected. But this is a required patch for us
and I want it to be mainlined, because I have to rebase it internally for every
release. Without the feedback about why it was rejected, I cannot however
improve it and resubmit it.

Can you please review this series and give me a feedback about it ?

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] common/board_r: remove warning in initr_mem for 64-bit phys_size_t

2014-10-03 Thread Valentin Longchamp
Since on powerpc phys_size_t can be unsigned long long, this printout
line can result in a not nice compile warning.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 common/board_r.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/board_r.c b/common/board_r.c
index f9647e1..6c94546 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -664,7 +664,7 @@ int initr_mem(void)
/* Also take the logbuffer into account (pram is in kB) */
pram += (LOGBUFF_LEN + LOGBUFF_OVERHEAD) / 1024;
 # endif
-   sprintf(memsz, %ldk, (gd-ram_size / 1024) - pram);
+   sprintf(memsz, %ldk, (long int) ((gd-ram_size / 1024) - pram));
setenv(mem, memsz);
 
return 0;
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] keymile/powerpc: move to the architecture-generic board system

2014-10-03 Thread Valentin Longchamp
This converts all the Keymile powerpc boards to the generic board
initialization.

This includes the 3 Keymile powerpc subsystems: km82xx, km83xx,
and kmp204x.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 include/configs/km/km83xx-common.h  | 3 +++
 include/configs/km/kmp204x-common.h | 3 +++
 include/configs/km82xx.h| 3 +++
 3 files changed, 9 insertions(+)

diff --git a/include/configs/km/km83xx-common.h 
b/include/configs/km/km83xx-common.h
index ae6b6dc..94e 100644
--- a/include/configs/km/km83xx-common.h
+++ b/include/configs/km/km83xx-common.h
@@ -8,6 +8,9 @@
 #ifndef __CONFIG_KM83XX_H
 #define __CONFIG_KM83XX_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 /* include common defines/options for all Keymile boards */
 #include keymile-common.h
 #include km-powerpc.h
diff --git a/include/configs/km/kmp204x-common.h 
b/include/configs/km/kmp204x-common.h
index a0f9d29..b658c68 100644
--- a/include/configs/km/kmp204x-common.h
+++ b/include/configs/km/kmp204x-common.h
@@ -21,6 +21,9 @@
 
 #define CONFIG_NAND_ECC_BCH
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 /* common KM defines */
 #include keymile-common.h
 
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 029c348..69ba66a 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -29,6 +29,9 @@
 #error (Board unsupported)
 #endif
 
+#define CONFIG_SYS_GENERIC_BOARD
+#define CONFIG_DISPLAY_BOARDINFO
+
 #defineCONFIG_SYS_TEXT_BASE0xFE00
 
 /* include common defines/options for all Keymile boards */
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] powerpc/mpc83xx: Zero boot_flags arg for calling board_init_f()

2014-10-03 Thread Valentin Longchamp
The argument boot_flags of board_init_f() is not used at all in the
powerpc specific board.c init sequence. Now with the generic init
sequence, this boot_flags arg is used by board_init_f().

This patch sets the r3 register that is used to pass the boot_flags
argument from the start.S board_init_f() call to 0 prior to the function
call to avoid unknown content to end up in gd-flags.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 arch/powerpc/cpu/mpc83xx/start.S | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/cpu/mpc83xx/start.S b/arch/powerpc/cpu/mpc83xx/start.S
index 36724e5..8abb3f1 100644
--- a/arch/powerpc/cpu/mpc83xx/start.S
+++ b/arch/powerpc/cpu/mpc83xx/start.S
@@ -283,6 +283,7 @@ in_flash:
bl  cpu_init_f
 
/* run 1st part of board init code (in Flash)*/
+   li  r3, 0   /* clear boot_flag for calling board_init_f */
bl  board_init_f
 
/* NOTREACHED - board_init_f() does not return */
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH] km_arm: convert the km_arm boards to the generic board support

2014-10-03 Thread Valentin Longchamp
This implies that all the km_kirkwood boards and their variants now are
using the generic board init sequence.

Signed-off-by: Valentin Longchamp valentin.longch...@keymile.com
---

 include/configs/km/km_arm.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h
index d31e674..f780f8b 100644
--- a/include/configs/km/km_arm.h
+++ b/include/configs/km/km_arm.h
@@ -20,6 +20,8 @@
 #ifndef _CONFIG_KM_ARM_H
 #define _CONFIG_KM_ARM_H
 
+#define CONFIG_SYS_GENERIC_BOARD
+
 /* We got removed from Linux mach-types.h */
 #define MACH_TYPE_KM_KIRKWOOD  2255
 
-- 
1.8.0.1

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] Please increase the image size for km boards

2014-10-01 Thread Valentin Longchamp
Hi York,

On 09/30/2014 05:48 PM, York Sun wrote:
 Valentin,
 
 We are seeing the image size of kmcoge4 and kmlion1 are on the edge. Attempts 
 to
 add new features cause overflow. Would you consider to increase the image size
 for km boards. You may have noticed several patches doing this for selected
 boards (search git log for 768K).
 

I am going to have a look at it and see what the impact is for us. Basically I
have nothing against changing this value, especially for kmcoge4/kmlion1.

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [GENERIC_BOARD] env problems before relocation with ppc8360

2014-09-30 Thread Valentin Longchamp
Hi Simon,

I'm very glad you answered this, I was busy with other stuff these last weeks
but I had planed to pick this issue again this week.

On 09/28/2014 06:27 AM, Simon Glass wrote:
 Hi,
 
 On 26 August 2014 09:17, Valentin Longchamp
 valentin.longch...@keymile.com wrote:

 Hello,

 Here is the outcome of my debug session today:

 On 08/25/2014 05:42 PM, Valentin Longchamp wrote:
 Hello,

 I am currently porting all the Keymile boards to CONFIG_SYS_GENERIC_BOARD.
 On u-boot 2014.10-rc1 I have all of them working quite well (at least 
 booting
 and showing no obvious problem), except for our boards using a MPC8360
 from Freescale (kmcoge5ne and kmeter1, both using km8360.h as config) that 
 do
 not boot at all.

 I have found out that u-boot crashes as soon as a getenv function call 
 happens
 before relocation. When I disable them, u-boot seems to work fine. I am
 currently trying to debug further, but it's not clear yet exactly what 
 causes
 the crash.

 So the problem is that for an unknown reason, the gd-flags are not correct 
 and
 getenv actually calls hsearch_h to look for the desired env variable. This 
 fails
 before relocation (due to the small stack ?).

 If I replace the board_f getenv_ulong calls in board_f.c with my 
 getenv_f_ulong
 function that explicitely calls getenv_f the board boots up nicely.

 Now the question is, why are my gd-flags not correct/corrupted ? Has someone
 already seen something similar ? I unfortunateley cannot access gd easily 
 with
 the BDI, since it is located in the INIT_RAM which is a data cache, for 
 which I
 have no LAW configured (could work on that).
 
 I just saw this. There is condition code at the start of
 board_init_f() in board_f.c that might exclude your board. So your
 global data might not be zeroed.
 

That's not exactly the problem here, since defining
CONFIG_SYS_GENERIC_GLOBAL_DATA did not solve the problem. However it made me
look at the right place and I have noticed that gd-flags are set in the generic
board_inif_f() and were not in the previous powerpc specific board_init_f(). If
I comment out the gd-flags = boot_flags in the board_init_f() function, then
everything works well.

Since board_init_f() is called from the assembly code (in my case
mpc83xx/start.S), I guess the ulong boot_flags argument ends up being a register
(if the arguments are passed in register ... which I am not sure of for
powerpc). Since prior to the bl board_init_f call in the start.S file, there is
a call another C function (cpu_init_f()), I guess the register passed as
argument has an undefined content ... that ends up in gd-flags.

I think that the best way to fix this is to make sure from start.S that
boot_flags (so the register) has a defined (zeroed ?) content ? But how to make
sure which register it is and that this will not change, since the compiler
comes into play here ?

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [GENERIC_BOARD] env problems before relocation with ppc8360

2014-08-26 Thread Valentin Longchamp
Hello,

Here is the outcome of my debug session today:

On 08/25/2014 05:42 PM, Valentin Longchamp wrote:
 Hello,
 
 I am currently porting all the Keymile boards to CONFIG_SYS_GENERIC_BOARD.
 On u-boot 2014.10-rc1 I have all of them working quite well (at least booting
 and showing no obvious problem), except for our boards using a MPC8360
 from Freescale (kmcoge5ne and kmeter1, both using km8360.h as config) that do
 not boot at all.
 
 I have found out that u-boot crashes as soon as a getenv function call happens
 before relocation. When I disable them, u-boot seems to work fine. I am
 currently trying to debug further, but it's not clear yet exactly what causes
 the crash.

So the problem is that for an unknown reason, the gd-flags are not correct and
getenv actually calls hsearch_h to look for the desired env variable. This fails
before relocation (due to the small stack ?).

If I replace the board_f getenv_ulong calls in board_f.c with my getenv_f_ulong
function that explicitely calls getenv_f the board boots up nicely.

Now the question is, why are my gd-flags not correct/corrupted ? Has someone
already seen something similar ? I unfortunateley cannot access gd easily with
the BDI, since it is located in the INIT_RAM which is a data cache, for which I
have no LAW configured (could work on that).

 
 We also have quite a few MPC8321 boards (for instance tuxx1.h or suvd3.h) and
 there the problem is not present, while the environment is also in the NOR
 flash as on km8360 and their core also a e300 (so their initialization is VERY
 similar).

I have checked and there it's clearly getenv_f that gets called by getenv before
relocation. That's why no problem is seen there.

Valentin
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


  1   2   3   4   5   >