[PATCH v2 07/10] ARM: at91: remove at91sam9n12_get_ddram_size helper

2019-04-01 Thread Ahmad Fatoum
Substitute the current #ifdefery in at91sam9_ddrsdr.h by open-coding at91sam9n12_get_ddram_size wherever it was called. Suggested-by: Sascha Hauer Signed-off-by: Ahmad Fatoum --- arch/arm/boards/at91sam9n12ek/lowlevel.c | 5 +++-- arch/arm/mach-at91/at91sam9n12_devices.c |

[PATCH v2 06/10] ARM: at91: remove at91sam9g45_get_ddram_size helper

2019-04-01 Thread Ahmad Fatoum
Substitute the current #ifdefery in at91sam9_ddrsdr.h by open-coding at91sam9g45_get_ddram_size wherever it was called. Suggested-by: Sascha Hauer Signed-off-by: Ahmad Fatoum --- arch/arm/boards/at91sam9m10g45ek/lowlevel.c | 5 +++-- arch/arm/boards/at91sam9m10ihd/lowlevel.c | 5 +++--

[PATCH v2 08/10] ARM: at91: remove at91sam9x5_get_ddram_size helper

2019-04-01 Thread Ahmad Fatoum
Substitute the current #ifdefery in at91sam9_ddrsdr.h by open-coding at91sam9x5_get_ddram_size wherever it was called. Suggested-by: Sascha Hauer Signed-off-by: Ahmad Fatoum --- arch/arm/boards/at91sam9x5ek/lowlevel.c | 4 +++- arch/arm/mach-at91/at91sam9x5_devices.c | 2

[PATCH v2 02/10] ARM: at91: debug_ll: make UART base address configurable

2019-04-01 Thread Ahmad Fatoum
This is in line with other platforms such as i.MX, which allow specifying a debug port. As we can't use port indices because the UARTs aren't mapped consecutively, allow specifying a hex base at configuration time. A side effect of this patch is that sama5d4's HAVE_AT91_DBGU2 is now honored as

[PATCH v2 05/10] ARM: at91: remove duplicate get_ddram_size code

2019-04-01 Thread Ahmad Fatoum
Both at91_get_ddram_size and at91sama5_get_ddram_size are the same if is_sdram == false and is_nb == true. is_sdram is always false, because according to the sama5d{2,3,4} datasheets, the lowest possible value for AT91_DDRSDRC_MD is 3 (i.e. none of them supports SDR SDRAM). Therefore have

[PATCH v2 03/10] arm: sama5d4: fix stack setup

2019-04-01 Thread Ahmad Fatoum
From: Sam Ravnborg The code that configure the stack uses sama5d3 constants. Fix this to use the proper sama5d4 constants. Boot tested on sama5d4_xplained. Signed-off-by: Sam Ravnborg --- arch/arm/boards/sama5d4_xplained/lowlevel.c | 2 +- arch/arm/boards/sama5d4ek/lowlevel.c| 2 +-

[PATCH v2 00/10] ARM: at91: misc fixes and cleanup

2019-04-01 Thread Ahmad Fatoum
Changes since v1: - Collected Sam's Test-by and Reviewed-by - Included Sam's fix for the sama5d4 as patch 03 - moved debug_ll base address defaults to common/Kconfig - above also got rid of a typo in the base address constant name - added patches 06-09 which remove board-specific helpers

[PATCH v2 10/10] clk: at91: fix warning about missing const-safety

2019-04-01 Thread Ahmad Fatoum
compiling clk-main.c results in: warning: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] memcpy(clkmain->clk.parent_names, parent_names, parents_array_size); ^ Avoid this by replacing the

[PATCH v2 04/10] ARM: at91: fix at91sama5_get_ddram_size for sama5d4

2019-04-01 Thread Ahmad Fatoum
at91sama5_get_ddram_size() is despite the name specific to the sama5d3 which it was added alongside of. sama5d4 board code continues to use it, but accessing SAMA5D3_BASE_MPDDRC (0xea00) on a sama5d4 should result in a Data Abort (Datasheet Figure 5-1).. Fix this by giving

[PATCH v3 13/15] ARM: at91: microchip-ksz9477-evb: implement first stage

2019-04-01 Thread Ahmad Fatoum
This imports the low level init code from at91bootstrap https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/board/sama5d3_xplained/sama5d3_xplained.c Signed-off-by: Ahmad Fatoum --- .../boards/microchip-ksz9477-evb/lowlevel.c | 208 +- arch/arm/mach-at91/Kconfig

Re: [PATCH v3 13/15] ARM: at91: microchip-ksz9477-evb: implement first stage

2019-04-01 Thread Roland Hieber
On Mon, Apr 01, 2019 at 12:18:21PM +0200, Ahmad Fatoum wrote: > This imports the low level init code from at91bootstrap > https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/board/sama5d3_xplained/sama5d3_xplained.c > > Signed-off-by: Ahmad Fatoum > --- >

[PATCH v3 10/15] images: at91: differentiate between first and second stage images

2019-04-01 Thread Ahmad Fatoum
Incoming microchip-ksz9477-evb first stage will add one more entry point for the first stage. As there is a little reason to use the same piggy data for both images (BOOT.BIN, the first stage, is limited to 64K), have CONFIG_AT91_LOAD_BAREBOX_SRAM decide which stage should be built.

[PATCH v3 03/15] ARM: at91: migrate at91sam9_ddrsdr.h to use at91bootstrap's at91_ddrsdrc.h

2019-04-01 Thread Ahmad Fatoum
Instead of adding missing definitions to the existing at91sam9_ddrsdr.h and adapting the incoming DDRAM initialization code from at91bootstrap, just replace the lightly used existing header with: https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/include/arch/at91_ddrsdrc.h For easier

[PATCH v3 15/15] doc: microchip-ksz9477-evb: add documentation

2019-04-01 Thread Ahmad Fatoum
Signed-off-by: Ahmad Fatoum --- .../boards/at91/microchip-ksz9477-evb.rst | 38 ++- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/Documentation/boards/at91/microchip-ksz9477-evb.rst b/Documentation/boards/at91/microchip-ksz9477-evb.rst index

Re: [PATCH v3 01/15] LICENSES: add BSD-1-Clause license

2019-04-01 Thread Roland Hieber
On Mon, Apr 01, 2019 at 12:18:09PM +0200, Ahmad Fatoum wrote: > Incoming sama5d3 bootstrap code has been ported from the at91bootstrap > project and is licensed under a 1-clause BSD license. To remove > boilerplate legal text there, place the license at a fixed location > and only note

[PATCH v3 08/15] ARM: at91: import low level DDRAMC initialization code from at91bootstrap

2019-04-01 Thread Ahmad Fatoum
This commit imports DDRAMC initialization routines for use in PBL from https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/driver/ddramc.c Signed-off-by: Ahmad Fatoum --- arch/arm/mach-at91/Makefile | 1 + arch/arm/mach-at91/ddramc.c | 507 +++

[PATCH v3 12/15] ARM: dts: microchip-ksz9477-evb: add dummy first stage device tree

2019-04-01 Thread Ahmad Fatoum
The existing device tree is too big for the 64K byte constrained first stage. Because of the size limitation it might be better to only use the device tree for the second stage. This increases user-friendliness by leaving space for PBL_CONSOLE. For now provide a slightly smaller smaller

[PATCH v3 06/15] ARM: at91: import lowlevel clock initialization from at91bootstrap

2019-04-01 Thread Ahmad Fatoum
For use by future at91 first stage bootloaders, this commit imports https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/driver/pmc.c Signed-off-by: Ahmad Fatoum --- arch/arm/mach-at91/Makefile | 1 + arch/arm/mach-at91/at91_pmc_ll.c | 184 ++

[PATCH] clk: at91: fix compilation errors in sama5d2.c

2019-04-01 Thread Ahmad Fatoum
sama5d2 was added along with the update to the upstream device tree bindings, but wasn't wired in anywhere. To prepare for usage in future sama5d2 support, fix compilation errors related to absence of locks and unavailability of audio/i2s clock/pll handling. Signed-off-by: Ahmad Fatoum ---

Re: [PATCH v3 02/15] ARM: at91: import at91bootstrap's at91_ddrsdrc.h

2019-04-01 Thread Roland Hieber
On Mon, Apr 01, 2019 at 12:18:10PM +0200, Ahmad Fatoum wrote: > Instead of adding missing definitions to the existing at91sam9_ddrsdr.h > and adapting the incoming DDRAM initialization code from at91bootstrap, > just replace the lightly used existing header with: >

[PATCH v3 04/15] ARM: at91: replace at91sam9_ddrsdr.h with at91bootstrap's at91_ddrsdrc.h

2019-04-01 Thread Ahmad Fatoum
Instead of adding missing definitions to the existing at91sam9_ddrsdr.h and adapting the incoming DDRAM initialization code from at91bootstrap, just replace the lightly used existing header with: https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/include/arch/at91_ddrsdrc.h For easier

[PATCH v3 07/15] ARM: at91: import early_udelay from at91bootstrap

2019-04-01 Thread Ahmad Fatoum
For use by the incoming at91bootstrap DDRAMC initialization code, this commit provides an early_udelay function usable in PBL imported from https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/driver/at91_pit.c Signed-off-by: Ahmad Fatoum --- arch/arm/mach-at91/Makefile |

[PATCH v3 01/15] LICENSES: add BSD-1-Clause license

2019-04-01 Thread Ahmad Fatoum
Incoming sama5d3 bootstrap code has been ported from the at91bootstrap project and is licensed under a 1-clause BSD license. To remove boilerplate legal text there, place the license at a fixed location and only note SPDX-License-Identifier and Copyright in the source files. Signed-off-by: Ahmad

[PATCH v3 14/15] ARM: at91: microchip-ksz9477: provide board code fallback

2019-04-01 Thread Ahmad Fatoum
The newly added device tree based first stage fails to load the second stage from MMC, which might be in relation to a preceding atmel_mci "command/data timeout" message. Due to this and because it's not clear yet how viable it's to use the device tree for the size-constrained first stage anyway,

[PATCH v3 09/15] ARM: at91: import lowlevel dbgu UART init code from at91bootstrap

2019-04-01 Thread Ahmad Fatoum
From: Ahmad Fatoum For use in PBL, import dbgu init code from: https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/driver/at91_usart.c Signed-off-by: Ahmad Fatoum --- arch/arm/mach-at91/include/mach/at91_dbgu.h | 57 - 1 file changed, 56 insertions(+), 1 deletion(-)

[PATCH v3 11/15] ARM: at91: microchip-ksz9477-evb: use compressed DTB

2019-04-01 Thread Ahmad Fatoum
This saves about 25K, which could be useful to fit the incoming first stage board support into the SRAM's 64K. Signed-off-by: Ahmad Fatoum --- arch/arm/boards/microchip-ksz9477-evb/lowlevel.c | 4 ++-- arch/arm/mach-at91/Kconfig | 1 + 2 files changed, 3 insertions(+), 2

[PATCH v3 00/15] ARM: at91: microchip-kz9477-evb: support first stage boot

2019-04-01 Thread Ahmad Fatoum
This is (the hopefully final and bestest) v3 of a series that pulls in enough of at91bootstrap to make barebox usable as first stage bootloader for the SAMA5 family of AT91 SoCs. Besides incorporating feedback on v2 (mainly multi-image support), I've also reinstated code paths needed by the

[PATCH v3 05/15] ARM: at91: watchdog: implement at91_wdt_disable

2019-04-01 Thread Ahmad Fatoum
Low level init code might want to disable the watchdog in PBL. Provide a helper to do so. Signed-off-by: Ahmad Fatoum --- arch/arm/mach-at91/include/mach/at91_wdt.h | 16 1 file changed, 16 insertions(+) diff --git a/arch/arm/mach-at91/include/mach/at91_wdt.h

[PATCH v3 02/15] ARM: at91: import at91bootstrap's at91_ddrsdrc.h

2019-04-01 Thread Ahmad Fatoum
Instead of adding missing definitions to the existing at91sam9_ddrsdr.h and adapting the incoming DDRAM initialization code from at91bootstrap, just replace the lightly used existing header with: https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/include/arch/at91_ddrsdrc.h For easier

Re: [PATCH v3 13/15] ARM: at91: microchip-ksz9477-evb: implement first stage

2019-04-01 Thread Ahmad Fatoum
On 4/1/19 2:37 PM, Roland Hieber wrote: > On Mon, Apr 01, 2019 at 12:18:21PM +0200, Ahmad Fatoum wrote: >> This imports the low level init code from at91bootstrap >> https://github.com/linux4sam/at91bootstrap/blob/v3.8.12/board/sama5d3_xplained/sama5d3_xplained.c >> >> Signed-off-by: Ahmad Fatoum

Re: [PATCH v3 02/15] ARM: at91: import at91bootstrap's at91_ddrsdrc.h

2019-04-01 Thread Roland Hieber
On Mon, Apr 01, 2019 at 03:36:06PM +0200, Ahmad Fatoum wrote: > Hello Roland, > > On 4/1/19 2:32 PM, Roland Hieber wrote: > > On Mon, Apr 01, 2019 at 12:18:10PM +0200, Ahmad Fatoum wrote: > >> Instead of adding missing definitions to the existing at91sam9_ddrsdr.h > >> and adapting the incoming

[PATCH] clk: imx6: remove quirky clk_set_parent(LDB_diN_sel, pll5_video_div)

2019-04-01 Thread Ahmad Fatoum
barebox has inherited the clk_set_parent(ldb_diN_sel, pll5_video_div) from upstream kernel commit 32f3b8da22 ("ARM i.MX6q: set the LDB serial clock parent to the video PLL"), where it was enabled for all i.MX6Q revisions after 1.0. It was applied whenever CONFIG_DRIVER_VIDEO_IMX_IPUV3 was defined.

Re: [PATCH v2 07/10] ARM: at91: remove at91sam9n12_get_ddram_size helper

2019-04-01 Thread Sam Ravnborg
On Mon, Apr 01, 2019 at 11:31:03AM +0200, Ahmad Fatoum wrote: > Substitute the current #ifdefery in at91sam9_ddrsdr.h by > open-coding at91sam9n12_get_ddram_size wherever it was called. > > Suggested-by: Sascha Hauer > Signed-off-by: Ahmad Fatoum Reviewed-by: Sam Ravnborg

Re: [PATCH v2 06/10] ARM: at91: remove at91sam9g45_get_ddram_size helper

2019-04-01 Thread Sam Ravnborg
On Mon, Apr 01, 2019 at 11:31:02AM +0200, Ahmad Fatoum wrote: > Substitute the current #ifdefery in at91sam9_ddrsdr.h by > open-coding at91sam9g45_get_ddram_size wherever it was called. > > Suggested-by: Sascha Hauer > Signed-off-by: Ahmad Fatoum Reviewed-by: Sam Ravnborg

Re: [PATCH v2 08/10] ARM: at91: remove at91sam9x5_get_ddram_size helper

2019-04-01 Thread Sam Ravnborg
On Mon, Apr 01, 2019 at 11:31:04AM +0200, Ahmad Fatoum wrote: > Substitute the current #ifdefery in at91sam9_ddrsdr.h by > open-coding at91sam9x5_get_ddram_size wherever it was called. > > Suggested-by: Sascha Hauer > Signed-off-by: Ahmad Fatoum Reviewed-by: Sam Ravnborg

Re: [PATCH v2 10/10] clk: at91: fix warning about missing const-safety

2019-04-01 Thread Sam Ravnborg
Hi Ahmad. On Mon, Apr 01, 2019 at 11:31:06AM +0200, Ahmad Fatoum wrote: > compiling clk-main.c results in: > > warning: passing argument 1 of 'memcpy' discards 'const' qualifier from > pointer target type [-Wdiscarded-qualifiers] > memcpy(clkmain->clk.parent_names, parent_names,

[PATCH 2/6] clk: imx6: Mask mmdc_ch1 handshake for periph2_sel and mmdc_ch1_axi_podf

2019-04-01 Thread Ahmad Fatoum
From: Philipp Zabel MMDC CH1 is not used on i.MX6Q, so the handshake needed to change the parent of periph2_sel or the divider of mmdc_ch1_axi_podf will never succeed. Disable the handshake mechanism to allow changing the frequency of mmdc_ch1_axi, allowing to use it as a possible source for the

[PATCH 5/6] clk: imx6: Make the LDB_DI0 and LDB_DI1 clocks read-only

2019-04-01 Thread Ahmad Fatoum
From: Philipp Zabel Due to incorrect placement of the clock gate cell in the ldb_di[x]_clk tree, the glitchy parent mux of ldb_di[x]_clk can cause a glitch to enter the ldb_di_ipu_div divider. If the divider gets locked up, no ldb_di[x]_clk is generated, and the LVDS display will hang when the

Re: [PATCH] clk: imx6: remove quirky clk_set_parent(LDB_diN_sel, pll5_video_div)

2019-04-01 Thread Ahmad Fatoum
On 1/4/19 22:15, Ahmad Fatoum wrote: Argh. This is RFC PATCH 6/6.. Missed the prefix. -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone:

[PATCH 0/6] clk: imx6: work around LDB hang caused by ERR009219

2019-04-01 Thread Ahmad Fatoum
Due to incorrect placement of the clock gate cell in the ldb_di[x]_clk tree, the glitchy parent mux of ldb_di[x]_clk can cause a glitch to enter the ldb_di_ipu_div divider[1]. If the divider gets locked up, no ldb_di[x]_clk is generated, and the LVDS display will hang when the ipu_di_clk is

[PATCH 3/6] clk: imx6: Fix procedure to switch the parent of LDB_DI_CLK

2019-04-01 Thread Ahmad Fatoum
From: Fabio Estevam Due to incorrect placement of the clock gate cell in the ldb_di[x]_clk tree, the glitchy parent mux of ldb_di[x]_clk can cause a glitch to enter the ldb_di_ipu_div divider. If the divider gets locked up, no ldb_di[x]_clk is generated, and the LVDS display will hang when the

[PATCH 4/6] clk: imx6: define an enum for ldb mux inputs

2019-04-01 Thread Ahmad Fatoum
For better readability should this code be reviewed in future, replace the hardcoded input numbers with an enum. This is just a cosmetic change and was verified to not affect clk-imx6.o. Signed-off-by: Ahmad Fatoum --- drivers/clk/imx/clk-imx6.c | 41 +++--- 1

[PATCH 1/6] clk: imx6: provide helper to check if video PLL post dividers work

2019-04-01 Thread Ahmad Fatoum
Audio/Video PLL post dividers don't work on i.MX6q revision 1.0. This helper can be reused in the upcoming workaround patch for erratum ERR009219. The check in the helper has been inverted to make it clearer which platforms are affected. Old call site was adjusted to spell out what is really

Re: [PATCH v2 09/10] ARM: at91: remove at91sama5_get_ddram_size helper

2019-04-01 Thread Sam Ravnborg
On Mon, Apr 01, 2019 at 11:31:05AM +0200, Ahmad Fatoum wrote: > Substitute the current #ifdefery in at91sam9_ddrsdr.h by > open-coding at91sama5_get_ddram_size wherever it was called. > > Suggested-by: Sascha Hauer > Signed-off-by: Ahmad Fatoum Reviewed-by: Sam Ravnborg

[PATCH v2 11/10] clk: at91: fix warning about missing const-safety

2019-04-01 Thread Ahmad Fatoum
compiling clk-generated.c results in: warning: passing argument 1 of 'memcpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers] memcpy(gck->hw.parent_names, parent_names, parents_array_size); ~~~^ Avoid this by replacing the xzalloc+memcpy

Re: [PATCH v2 10/10] clk: at91: fix warning about missing const-safety

2019-04-01 Thread Ahmad Fatoum
Hello Sam, On 1/4/19 22:48, Sam Ravnborg wrote: > Hi Ahmad. > > On Mon, Apr 01, 2019 at 11:31:06AM +0200, Ahmad Fatoum wrote: >> compiling clk-main.c results in: >> >> warning: passing argument 1 of 'memcpy' discards 'const' qualifier from >> pointer target type [-Wdiscarded-qualifiers] >>