* [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 @ 2016-07-16 4:26 Alexander Shiyan 2016-07-16 4:26 ` [PATCH 2/3] ARM: clps711x: Sync CLK susbsystem with kernel Alexander Shiyan ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: Alexander Shiyan @ 2016-07-16 4:26 UTC (permalink / raw) To: barebox CS3 is used for a variety of external bus devices. Increase the wait state for this chip select for the possibility of more widespread use. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> --- arch/arm/boards/clep7212/clep7212.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm/boards/clep7212/clep7212.c b/arch/arm/boards/clep7212/clep7212.c index de125ea..dfdd0d3 100644 --- a/arch/arm/boards/clep7212/clep7212.c +++ b/arch/arm/boards/clep7212/clep7212.c @@ -30,7 +30,7 @@ static int clps711x_devices_init(void) clps711x_setup_memcfg(1, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_8); clps711x_setup_memcfg(2, MEMCFG_WAITSTATE_8_3 | MEMCFG_BUS_WIDTH_16 | MEMCFG_CLKENB); - clps711x_setup_memcfg(3, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_32); + clps711x_setup_memcfg(3, MEMCFG_WAITSTATE_7_1 | MEMCFG_BUS_WIDTH_32); cfi_io = map_io_sections(CS0_BASE, (void *)0x90000000, SZ_32M); add_cfi_flash_device(DEVICE_ID_DYNAMIC, (unsigned long)cfi_io, SZ_32M, -- 2.4.9 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/3] ARM: clps711x: Sync CLK susbsystem with kernel 2016-07-16 4:26 [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Alexander Shiyan @ 2016-07-16 4:26 ` Alexander Shiyan 2016-07-16 4:26 ` [PATCH 3/3] ARM: clps711x: clep7212: Register board env during runtime Alexander Shiyan 2016-07-18 6:15 ` [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Sascha Hauer 2 siblings, 0 replies; 4+ messages in thread From: Alexander Shiyan @ 2016-07-16 4:26 UTC (permalink / raw) To: barebox Refactoring of CLPS711X CLK driver code to be compatible with the current kernel. This change a bit makes easy of initializing devices using CLKs. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> --- arch/arm/mach-clps711x/clock.c | 70 ++++++++++++++-------------------------- arch/arm/mach-clps711x/devices.c | 4 --- 2 files changed, 24 insertions(+), 50 deletions(-) diff --git a/arch/arm/mach-clps711x/clock.c b/arch/arm/mach-clps711x/clock.c index 6f447f7..4d6403b 100644 --- a/arch/arm/mach-clps711x/clock.c +++ b/arch/arm/mach-clps711x/clock.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Alexander Shiyan <shc_work@mail.ru> + * Copyright (C) 2012-2016 Alexander Shiyan <shc_work@mail.ru> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -9,42 +9,27 @@ #include <common.h> #include <init.h> -#include <linux/sizes.h> #include <asm/io.h> #include <linux/clk.h> #include <linux/clkdev.h> +#include <linux/sizes.h> +#include <dt-bindings/clock/clps711x-clock.h> #include <mach/clps711x.h> #define CLPS711X_OSC_FREQ 3686400 #define CLPS711X_EXT_FREQ 13000000 -enum clps711x_clks { - dummy, cpu, bus, uart, timer_hf, timer_lf, tc1, tc2, clk_max -}; +static struct clk *clks[CLPS711X_CLK_MAX]; -static struct { - const char *name; - struct clk *clk; -} clks[clk_max] = { - { "dummy", }, - { "cpu", }, - { "bus", }, - { "uart", }, - { "timer_hf", }, - { "timer_lf", }, - { "tc1", }, - { "tc2", }, -}; - -static const char *tc_sel_clks[] = { - "timer_lf", - "timer_hf", +static struct clk_div_table tdiv_tbl[] = { + { .val = 0, .div = 256, }, + { .val = 1, .div = 1, }, }; static __init int clps711x_clk_init(void) { - unsigned int f_cpu, f_bus, f_uart, f_timer_hf, f_timer_lf, pll; + unsigned int f_cpu, f_bus, f_uart, f_timer_ref, pll; u32 tmp; tmp = readl(PLLR) >> 24; @@ -70,45 +55,38 @@ static __init int clps711x_clk_init(void) if (tmp & SYSFLG2_CKMODE) { tmp = readw(SYSCON2); if (tmp & SYSCON2_OSTB) - f_timer_hf = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 26); + f_timer_ref = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 26); else - f_timer_hf = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 24); + f_timer_ref = DIV_ROUND_CLOSEST(CLPS711X_EXT_FREQ, 24); } else - f_timer_hf = DIV_ROUND_CLOSEST(f_cpu, 144); - - f_timer_lf = DIV_ROUND_CLOSEST(f_timer_hf, 256); + f_timer_ref = DIV_ROUND_CLOSEST(f_cpu, 144); /* Turn timers in free running mode */ tmp = readl(SYSCON1); tmp &= ~(SYSCON1_TC1M | SYSCON1_TC2M); writel(tmp, SYSCON1); - clks[dummy].clk = clk_fixed(clks[dummy].name, 0); - clks[cpu].clk = clk_fixed(clks[cpu].name, f_cpu); - clks[bus].clk = clk_fixed(clks[bus].name, f_bus); - clks[uart].clk = clk_fixed(clks[uart].name, f_uart); - clks[timer_hf].clk = clk_fixed(clks[timer_hf].name, f_timer_hf); - clks[timer_lf].clk = clk_fixed(clks[timer_lf].name, f_timer_lf); - clks[tc1].clk = clk_mux(clks[tc1].name, IOMEM(SYSCON1), 5, 1, - tc_sel_clks, ARRAY_SIZE(tc_sel_clks), 0); - clks[tc2].clk = clk_mux(clks[tc2].name, IOMEM(SYSCON1), 7, 1, - tc_sel_clks, ARRAY_SIZE(tc_sel_clks), 0); + clks[CLPS711X_CLK_DUMMY] = clk_fixed("dummy", 0); + clks[CLPS711X_CLK_CPU] = clk_fixed("cpu", f_cpu); + clks[CLPS711X_CLK_BUS] = clk_fixed("bus", f_bus); + clks[CLPS711X_CLK_UART] = clk_fixed("uart", f_uart); + clks[CLPS711X_CLK_TIMERREF] = clk_fixed("timer_ref", f_timer_ref); + clks[CLPS711X_CLK_TIMER1] = clk_divider_table("timer1", "timer_ref", + IOMEM(SYSCON1), 5, 1, tdiv_tbl, ARRAY_SIZE(tdiv_tbl)); + clks[CLPS711X_CLK_TIMER2] = clk_divider_table("timer2", "timer_ref", + IOMEM(SYSCON1), 7, 1, tdiv_tbl, ARRAY_SIZE(tdiv_tbl)); - for (tmp = 0; tmp < clk_max; tmp++) - clk_register_clkdev(clks[tmp].clk, clks[tmp].name, NULL); + clkdev_add_physbase(clks[CLPS711X_CLK_UART], UARTDR1, NULL); + clkdev_add_physbase(clks[CLPS711X_CLK_UART], UARTDR2, NULL); + clkdev_add_physbase(clks[CLPS711X_CLK_TIMER2], TC2D, NULL); return 0; } postcore_initcall(clps711x_clk_init); -static const char *clps711x_clocksrc_name = "clps711x-cs"; - static __init int clps711x_core_init(void) { - /* Using TC2 in low frequency mode as clocksource */ - clk_set_parent(clks[tc2].clk, clks[timer_lf].clk); - clk_add_alias(NULL, clps711x_clocksrc_name, "tc2", NULL); - add_generic_device(clps711x_clocksrc_name, DEVICE_ID_SINGLE, NULL, + add_generic_device("clps711x-cs", DEVICE_ID_SINGLE, NULL, TC2D, SZ_2, IORESOURCE_MEM, NULL); return 0; diff --git a/arch/arm/mach-clps711x/devices.c b/arch/arm/mach-clps711x/devices.c index b6647de..6957431 100644 --- a/arch/arm/mach-clps711x/devices.c +++ b/arch/arm/mach-clps711x/devices.c @@ -14,8 +14,6 @@ #include <asm/io.h> #include <asm/memory.h> -#include <linux/clk.h> - #include <mach/clps711x.h> static int clps711x_mem_init(void) @@ -62,12 +60,10 @@ void clps711x_add_uart(unsigned int id) { switch (id) { case 0: - clk_add_alias(NULL, "clps711x-uart0", "uart", NULL); add_generic_device_res("clps711x-uart", 0, uart0_resources, ARRAY_SIZE(uart0_resources), NULL); break; case 1: - clk_add_alias(NULL, "clps711x-uart1", "uart", NULL); add_generic_device_res("clps711x-uart", 1, uart1_resources, ARRAY_SIZE(uart1_resources), NULL); break; -- 2.4.9 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 3/3] ARM: clps711x: clep7212: Register board env during runtime 2016-07-16 4:26 [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Alexander Shiyan 2016-07-16 4:26 ` [PATCH 2/3] ARM: clps711x: Sync CLK susbsystem with kernel Alexander Shiyan @ 2016-07-16 4:26 ` Alexander Shiyan 2016-07-18 6:15 ` [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Sascha Hauer 2 siblings, 0 replies; 4+ messages in thread From: Alexander Shiyan @ 2016-07-16 4:26 UTC (permalink / raw) To: barebox Register the board specific environment during runtime using defaultenv_append_directory(). Also this patch updates default config. Signed-off-by: Alexander Shiyan <shc_work@mail.ru> --- arch/arm/boards/clep7212/Makefile | 1 + arch/arm/boards/clep7212/clep7212.c | 3 +++ .../clep7212/{env => defaultenv-clep7212}/boot/nor | 2 +- .../{env => defaultenv-clep7212}/init/mtdparts-nor | 0 .../nv/autoboot_timeout | 0 .../clep7212/defaultenv-clep7212/nv/boot.default | 1 + .../defaultenv-clep7212/nv/linux.bootargs.console | 1 + .../defaultenv-clep7212/nv/linux.bootargs.debug | 1 + arch/arm/boards/clep7212/env/init/bootsource | 9 ------- .../boards/clep7212/env/nv/linux.bootargs.console | 1 - arch/arm/configs/clps711x_defconfig | 29 +++++++++++----------- arch/arm/mach-clps711x/Kconfig | 1 + 12 files changed, 23 insertions(+), 26 deletions(-) rename arch/arm/boards/clep7212/{env => defaultenv-clep7212}/boot/nor (63%) rename arch/arm/boards/clep7212/{env => defaultenv-clep7212}/init/mtdparts-nor (100%) rename arch/arm/boards/clep7212/{env => defaultenv-clep7212}/nv/autoboot_timeout (100%) create mode 100644 arch/arm/boards/clep7212/defaultenv-clep7212/nv/boot.default create mode 100644 arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.console create mode 100644 arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.debug delete mode 100644 arch/arm/boards/clep7212/env/init/bootsource delete mode 100644 arch/arm/boards/clep7212/env/nv/linux.bootargs.console diff --git a/arch/arm/boards/clep7212/Makefile b/arch/arm/boards/clep7212/Makefile index 4b0304f..a5001df 100644 --- a/arch/arm/boards/clep7212/Makefile +++ b/arch/arm/boards/clep7212/Makefile @@ -1,2 +1,3 @@ obj-y += clep7212.o lwl-y += lowlevel.o +bbenv-y += defaultenv-clep7212 diff --git a/arch/arm/boards/clep7212/clep7212.c b/arch/arm/boards/clep7212/clep7212.c index dfdd0d3..584ecdc 100644 --- a/arch/arm/boards/clep7212/clep7212.c +++ b/arch/arm/boards/clep7212/clep7212.c @@ -9,6 +9,7 @@ #include <common.h> #include <driver.h> +#include <envfs.h> #include <init.h> #include <partition.h> #include <io.h> @@ -44,6 +45,8 @@ static int clps711x_devices_init(void) armlinux_set_architecture(MACH_TYPE_CLEP7212); armlinux_set_serial(((u64)serial_h << 32) | serial_l); + defaultenv_append_directory(defaultenv_clep7212); + return 0; } device_initcall(clps711x_devices_init); diff --git a/arch/arm/boards/clep7212/env/boot/nor b/arch/arm/boards/clep7212/defaultenv-clep7212/boot/nor similarity index 63% rename from arch/arm/boards/clep7212/env/boot/nor rename to arch/arm/boards/clep7212/defaultenv-clep7212/boot/nor index d53f07e..f584307 100644 --- a/arch/arm/boards/clep7212/env/boot/nor +++ b/arch/arm/boards/clep7212/defaultenv-clep7212/boot/nor @@ -1,4 +1,4 @@ #!/bin/sh -global.bootm.image="/dev/kernel" +global.bootm.image="/dev/nor0.kernel" global.linux.bootargs.dyn.root="root=/dev/mtdblock3 ro" diff --git a/arch/arm/boards/clep7212/env/init/mtdparts-nor b/arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor similarity index 100% rename from arch/arm/boards/clep7212/env/init/mtdparts-nor rename to arch/arm/boards/clep7212/defaultenv-clep7212/init/mtdparts-nor diff --git a/arch/arm/boards/clep7212/env/nv/autoboot_timeout b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/autoboot_timeout similarity index 100% rename from arch/arm/boards/clep7212/env/nv/autoboot_timeout rename to arch/arm/boards/clep7212/defaultenv-clep7212/nv/autoboot_timeout diff --git a/arch/arm/boards/clep7212/defaultenv-clep7212/nv/boot.default b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/boot.default new file mode 100644 index 0000000..aa244dc --- /dev/null +++ b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/boot.default @@ -0,0 +1 @@ +nor diff --git a/arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.console b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.console new file mode 100644 index 0000000..0b9dc01 --- /dev/null +++ b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.console @@ -0,0 +1 @@ +console=ttyCL0,57600n8 diff --git a/arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.debug b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.debug new file mode 100644 index 0000000..7106a19 --- /dev/null +++ b/arch/arm/boards/clep7212/defaultenv-clep7212/nv/linux.bootargs.debug @@ -0,0 +1 @@ +earlyprintk diff --git a/arch/arm/boards/clep7212/env/init/bootsource b/arch/arm/boards/clep7212/env/init/bootsource deleted file mode 100644 index 2f09c0c..0000000 --- a/arch/arm/boards/clep7212/env/init/bootsource +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -if [ -n "$nv.boot.default" ]; then - exit -fi - -if [ -e /dev/nor0 ]; then - global.boot.default=nor -fi diff --git a/arch/arm/boards/clep7212/env/nv/linux.bootargs.console b/arch/arm/boards/clep7212/env/nv/linux.bootargs.console deleted file mode 100644 index 77ea2ec..0000000 --- a/arch/arm/boards/clep7212/env/nv/linux.bootargs.console +++ /dev/null @@ -1 +0,0 @@ -earlyprintk console=ttyCL0,57600n8 diff --git a/arch/arm/configs/clps711x_defconfig b/arch/arm/configs/clps711x_defconfig index 9312a25..d9eab56 100644 --- a/arch/arm/configs/clps711x_defconfig +++ b/arch/arm/configs/clps711x_defconfig @@ -1,5 +1,4 @@ CONFIG_ARCH_CLPS711X=y -CONFIG_CLPS711X_CPU_PLL_MULT=50 CONFIG_AEABI=y CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y # CONFIG_MEMINFO is not set @@ -9,31 +8,31 @@ CONFIG_EXPERIMENTAL=y CONFIG_BAUDRATE=57600 CONFIG_CMDLINE_EDITING=y CONFIG_AUTO_COMPLETE=y -CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y -CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/clep7212/env" -CONFIG_CMD_EDIT=y -CONFIG_CMD_SAVEENV=y -CONFIG_CMD_EXPORT=y -CONFIG_CMD_PRINTENV=y -CONFIG_CMD_ECHO_E=y -CONFIG_CMD_IOMEM=y -CONFIG_CMD_CRC=y -CONFIG_CMD_CRC_CMP=y -CONFIG_CMD_FLASH=y CONFIG_BOOTM_SHOW_TYPE=y CONFIG_BOOTM_INITRD=y -CONFIG_CMD_BOOTZ=y +CONFIG_DEFAULT_COMPRESSION_LZO=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y +CONFIG_CMD_IOMEM=y # CONFIG_CMD_BOOTU is not set +CONFIG_CMD_BOOTZ=y CONFIG_CMD_RESET=y -CONFIG_CMD_TIMEOUT=y CONFIG_CMD_PARTITION=y +CONFIG_CMD_EXPORT=y +CONFIG_CMD_PRINTENV=y CONFIG_CMD_MAGICVAR=y CONFIG_CMD_MAGICVAR_HELP=y +CONFIG_CMD_SAVEENV=y +CONFIG_CMD_ECHO_E=y +CONFIG_CMD_EDIT=y +CONFIG_CMD_TIMEOUT=y +CONFIG_CMD_CRC=y +CONFIG_CMD_CRC_CMP=y +CONFIG_CMD_FLASH=y # CONFIG_SPI is not set +CONFIG_MTD=y CONFIG_DRIVER_CFI=y # CONFIG_DRIVER_CFI_BANK_WIDTH_1 is not set # CONFIG_DRIVER_CFI_BANK_WIDTH_4 is not set -CONFIG_MTD=y CONFIG_DISK=y CONFIG_DISK_WRITE=y CONFIG_DISK_INTF_PLATFORM_IDE=y diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig index 0853ce2..92dd51a 100644 --- a/arch/arm/mach-clps711x/Kconfig +++ b/arch/arm/mach-clps711x/Kconfig @@ -5,6 +5,7 @@ choice config MACH_CLEP7212 bool "Cirrus Logic CLEP7212" + select HAVE_DEFAULT_ENVIRONMENT_NEW help Boards based on the Cirrus Logic 7212/7312 CPU. -- 2.4.9 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 2016-07-16 4:26 [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Alexander Shiyan 2016-07-16 4:26 ` [PATCH 2/3] ARM: clps711x: Sync CLK susbsystem with kernel Alexander Shiyan 2016-07-16 4:26 ` [PATCH 3/3] ARM: clps711x: clep7212: Register board env during runtime Alexander Shiyan @ 2016-07-18 6:15 ` Sascha Hauer 2 siblings, 0 replies; 4+ messages in thread From: Sascha Hauer @ 2016-07-18 6:15 UTC (permalink / raw) To: Alexander Shiyan; +Cc: barebox On Sat, Jul 16, 2016 at 07:26:19AM +0300, Alexander Shiyan wrote: > CS3 is used for a variety of external bus devices. > Increase the wait state for this chip select for the possibility > of more widespread use. > > Signed-off-by: Alexander Shiyan <shc_work@mail.ru> > --- > arch/arm/boards/clep7212/clep7212.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) Applied, thanks Sascha > > diff --git a/arch/arm/boards/clep7212/clep7212.c b/arch/arm/boards/clep7212/clep7212.c > index de125ea..dfdd0d3 100644 > --- a/arch/arm/boards/clep7212/clep7212.c > +++ b/arch/arm/boards/clep7212/clep7212.c > @@ -30,7 +30,7 @@ static int clps711x_devices_init(void) > clps711x_setup_memcfg(1, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_8); > clps711x_setup_memcfg(2, MEMCFG_WAITSTATE_8_3 | MEMCFG_BUS_WIDTH_16 | > MEMCFG_CLKENB); > - clps711x_setup_memcfg(3, MEMCFG_WAITSTATE_6_1 | MEMCFG_BUS_WIDTH_32); > + clps711x_setup_memcfg(3, MEMCFG_WAITSTATE_7_1 | MEMCFG_BUS_WIDTH_32); > > cfi_io = map_io_sections(CS0_BASE, (void *)0x90000000, SZ_32M); > add_cfi_flash_device(DEVICE_ID_DYNAMIC, (unsigned long)cfi_io, SZ_32M, > -- > 2.4.9 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-07-18 6:16 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-07-16 4:26 [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Alexander Shiyan 2016-07-16 4:26 ` [PATCH 2/3] ARM: clps711x: Sync CLK susbsystem with kernel Alexander Shiyan 2016-07-16 4:26 ` [PATCH 3/3] ARM: clps711x: clep7212: Register board env during runtime Alexander Shiyan 2016-07-18 6:15 ` [PATCH 1/3] ARM: clps711x: clep7212: Increase the wait state for chip select 3 Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox