ARM: clep7212: Migrate to config-board
Subsystems (7)
PATCH 1/13 ARM: clep7212: Migrate to config-board
--- arch/arm/boards/clep7212/env/config | 20 -------------------- arch/arm/boards/clep7212/env/config-board | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 arch/arm/boards/clep7212/env/config create mode 100644 arch/arm/boards/clep7212/env/config-board
arch/arm/boards/clep7212/env/config deleted +0 -20
@@ -1,20 +0,0 @@ -#!/bin/sh - -global.hostname=clps711x - -# set to false if you do not want to have colors -global.allow_color=true - -# user (used for network filenames) -global.user=anonymous - -# timeout in seconds before the default boot entry is started -global.autoboot_timeout=2 - -# default boot entry (one of /env/boot/*) -if [ -e /dev/nor0 ]; then - global.boot.default=nor -fi - -# default bootargs -global.linux.bootargs.base="earlyprintk console=ttyCL0,57600n8"
arch/arm/boards/clep7212/env/config-board new file +14 -0
@@ -0,0 +1,14 @@ +#!/bin/sh + +global.hostname=clps711x + +# Timeout in seconds before the default boot entry is started +global.autoboot_timeout=2 + +# Default boot entry (one of /env/boot/*) +if [ -e /dev/nor0 ]; then + global.boot.default=nor +fi + +# Board bootargs +global.linux.bootargs.base="earlyprintk console=ttyCL0,57600n8"
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/13 ARM: clps711x: Fix setup bus wait state scaling factor for 13Mhz mode
--- arch/arm/mach-clps711x/lowlevel.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-)
arch/arm/mach-clps711x/lowlevel.c +10 -6
@@ -21,12 +21,12 @@ void __naked __bare_init clps711x_barebox_entry(u32 pllmult) {u32 cpu, bus; -/* Setup base clocking, Enable SDQM pins */ -writel (SYSCON3_CLKCTL0 |SYSCON3_CLKCTL1 ,SYSCON3 ); - asm("nop" ); -/* Check if we running from external 13 MHz clock */ if (!(readl (SYSFLG2 ) &SYSFLG2_CKMODE )) { +/* Setup bus wait state scaling factor to 2 */ +writel (SYSCON3_CLKCTL0 |SYSCON3_CLKCTL1 ,SYSCON3 ); + asm("nop" ); +/* Check valid multiplier, default to 74 MHz */ if ((pllmult <20 ) || (pllmult >50 )) pllmult =40 ;
@@ -42,11 +42,15 @@ void __naked __bare_init clps711x_barebox_entry(u32 pllmult) cpu = pllmult *3686400 ;if (cpu >=36864000 ) - bus = cpu /2 ; + bus = cpu /2 ;else bus =36864000 /2 ; - }else + }else { bus =13000000 ; +/* Setup bus wait state scaling factor to 1 */ +writel (0 ,SYSCON3 ); + asm("nop" ); + }/* CLKEN select, SDRAM width=32 */ writel (SYSCON2_CLKENSL ,SYSCON2 );
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/13 ARM: clps711x: Replace numeric PLL option with boolean for raise CPU frequency
In reply to Alexander Shiyan--- arch/arm/boards/clep7212/lowlevel.c | 8 +++++--- arch/arm/mach-clps711x/Kconfig | 13 ++++++------- 2 files changed, 11 insertions(+), 10 deletions(-)
arch/arm/boards/clep7212/lowlevel.c +5 -3
@@ -14,13 +14,15 @@#include <mach/clps711x.h> -#if (CONFIG_CLPS711X_CPU_PLL_MULT <20 ) || (CONFIG_CLPS711X_CPU_PLL_MULT >50 ) -# error "CPU PLL multiplier out of range" +#ifdef CONFIG_CLPS711X_RAISE_CPUFREQ +# define CLPS711X_CPU_PLL_MULT 50 +#else +# define CLPS711X_CPU_PLL_MULT 40#endif void __naked __bare_init barebox_arm_reset_vector(void) {arm_cpu_lowlevel_init (); -clps711x_barebox_entry (CONFIG_CLPS711X_CPU_PLL_MULT ); +clps711x_barebox_entry (CLPS711X_CPU_PLL_MULT ); }
arch/arm/mach-clps711x/Kconfig +6 -7
@@ -12,14 +12,13 @@ endchoice menu "CLPS711X specific settings" -config CLPS711X_CPU_PLL_MULT - int "CPU PLL multiplier (20-50)" - range 20 50 - default "40" +config CLPS711X_RAISE_CPUFREQ + bool "Raise CPU frequency to 90 MHz" + depends on MACH_CLEP7212 help - Define CPU PLL multiplier. PLL is calculated by formula: - PLL Frequency = (PLL Multiplier / 2) * 3686400 Hz - Default value is 40, for achieve 73 MHz. + Raise CPU frequency to 90 MHz. This operation can be performed + only for devices which allow to operate at 90 MHz. + If option is not selected, CPU frequency will set to default 73 MHz. endmenu
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/13 ARM: clps711x: Add clocksource driver
In reply to Alexander ShiyanThis patch adds clocksource driver for CLPS711X targets and adds support to platform to use this new driver.
--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/clock.c | 51 ++++++++++++++++----------------- drivers/clocksource/Kconfig | 4 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/clps711x.c | 61 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 26 deletions(-) create mode 100644 drivers/clocksource/clps711x.c
arch/arm/Kconfig +1 -0
@@ -39,6 +39,7 @@ config ARCH_BCM2835 config ARCH_CLPS711X bool "Cirrus Logic EP711x/EP721x/EP731x" select CLKDEV_LOOKUP + select CLOCKSOURCE_CLPS711X select CPU_32v4T config ARCH_EP93XX
arch/arm/mach-clps711x/clock.c +25 -26
106 lines not on this page · raw message
drivers/clocksource/Kconfig +4 -0
@@ -10,6 +10,10 @@ config CLOCKSOURCE_BCM2835 bool depends on ARCH_BCM2835 +config CLOCKSOURCE_CLPS711X + bool + depends on ARCH_CLPS711X + config CLOCKSOURCE_NOMADIK bool depends on ARM
drivers/clocksource/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_AMBA_SP804) += amba-sp804.o obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o +obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.o
drivers/clocksource/clps711x.c new file +61 -0
61 lines not on this page · raw message
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 04/13] ARM: clps711x: Add clocksource driver
Quoted 205 lines · Alexander Shiyan
This patch adds clocksource driver for CLPS711X targets and adds support to platform to use this new driver.
Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/clock.c | 51 ++++++++++++++++----------------- drivers/clocksource/Kconfig | 4 ++ drivers/clocksource/Makefile | 1 + drivers/clocksource/clps711x.c | 61 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 92 insertions(+), 26 deletions(-) create mode 100644 drivers/clocksource/clps711x.carch/arm/Kconfig +1
-0@@ -39,6 +39,7 @@ config ARCH_BCM2835 config ARCH_CLPS711X bool "Cirrus Logic EP711x/EP721x/EP731x" select CLKDEV_LOOKUP + select CLOCKSOURCE_CLPS711X select CPU_32v4T config ARCH_EP93XXarch/arm/mach-clps711x/clock.c +25
-26@@ -9,25 +9,18 @@#include <common.h> #include <init.h> -#include <clock.h> +#include <sizes.h> #include <asm/io.h> #include <linux/clkdev.h> #include <mach/clps711x.h> +#define CLPS711X_OSC_FREQ 3686400 +#define CLPS711X_EXT_FREQ 13000000 +static struct clk {unsigned long rate; -} uart_clk, bus_clk; - -static uint64_t clocksource_read (void ) -{ -return ~readw (TC2D ); -} - -static struct clocksource cs = { - .read = clocksource_read, - .mask =CLOCKSOURCE_MASK (16 ), -}; +} uart_clk, bus_clk, timer_clk;unsigned long clk_get_rate (struct clk *clk) {@@ -50,22 +43,19 @@ EXPORT_SYMBOL(clk_disable);static int clocks_init (void ) { -int osc, ext, pll, cpu, timer; +int pll, cpu;u32 tmp; - osc =3686400 ; - ext =13000000 ; - tmp =readl (PLLR ) >>24 ;if (tmp) - pll = (osc * tmp) /2 ; + pll = (CLPS711X_OSC_FREQ * tmp) /2 ;else pll =73728000 ;/* Default value for old CPUs */ tmp =readl (SYSFLG2 );if (tmp &SYSFLG2_CKMODE ) { - cpu = ext; - bus_clk.rate = cpu; + cpu =CLPS711X_EXT_FREQ ; + bus_clk.rate =CLPS711X_EXT_FREQ ; }else { cpu = pll;if (cpu >=36864000 )@@ -74,25 +64,23 @@ static int clocks_init(void) bus_clk.rate =36864000 /2 ; } - uart_clk.rate = bus_clk.rate /10 ; + uart_clk.rate =DIV_ROUND_CLOSEST (bus_clk.rate,10 );if (tmp &SYSFLG2_CKMODE ) { tmp =readw (SYSCON2 );if (tmp &SYSCON2_OSTB ) - timer = ext /26 ; + timer_clk.rate =DIV_ROUND_CLOSEST (CLPS711X_EXT_FREQ ,26 );else - timer =541440 ; + timer_clk.rate =DIV_ROUND_CLOSEST (CLPS711X_EXT_FREQ ,24 ); }else - timer = cpu /144 ; + timer_clk.rate =DIV_ROUND_CLOSEST (cpu,144 ); tmp =readl (SYSCON1 ); tmp &= ~SYSCON1_TC2M ;/* Free running mode */ tmp |=SYSCON1_TC2S ;/* High frequency source */ writel (tmp,SYSCON1 ); -clocks_calc_mult_shift (&cs.mult, &cs.shift, timer,NSEC_PER_SEC ,10 ); - -return init_clock (&cs); +return 0 ; }core_initcall (clocks_init);@@ -100,6 +88,7 @@ static struct clk_lookup clocks_lookups[] = {CLKDEV_CON_ID ("bus" , &bus_clk),CLKDEV_DEV_ID ("clps711x_serial0" , &uart_clk),CLKDEV_DEV_ID ("clps711x_serial1" , &uart_clk), + CLKDEV_DEV_ID("clps711x-cs", &timer_clk), };static int clkdev_init (void )@@ -109,3 +98,13 @@ static int clkdev_init(void)return 0 ; }postcore_initcall (clkdev_init); + +static const char *clps711x_clocksrc_name ="clps711x-cs" ; + +static __init int clps711x_core_init (void ) +{ +add_generic_device (clps711x_clocksrc_name,DEVICE_ID_SINGLE ,NULL , +TC2D ,SZ_2 ,IORESOURCE_MEM ,NULL ); +return 0 ; +} +coredevice_initcall (clps711x_core_init);drivers/clocksource/Kconfig +4
-0@@ -10,6 +10,10 @@ config CLOCKSOURCE_BCM2835 bool depends on ARCH_BCM2835 +config CLOCKSOURCE_CLPS711X + bool + depends on ARCH_CLPS711X + config CLOCKSOURCE_NOMADIK bool depends on ARMdrivers/clocksource/Makefile +1
-0@@ -1,4 +1,5 @@ obj-$(CONFIG_AMBA_SP804) += amba-sp804.o obj-$(CONFIG_ARM_SMP_TWD) += arm_smp_twd.o obj-$(CONFIG_CLOCKSOURCE_BCM2835) += bcm2835.o +obj-$(CONFIG_CLOCKSOURCE_CLPS711X) += clps711x.o obj-$(CONFIG_CLOCKSOURCE_NOMADIK) += nomadik.odrivers/clocksource/clps711x.c new file +34
-0@@ -0,0 +1,61 @@ +/* +* Copyright (C) 2013 Alexander Shiyan <[email protected]> +* +* This program is free software; you can redistribute it and/or +* modify it under the terms of the GNU General Public License as +* published by the Free Software Foundation; either version 2 of +* the License, or (at your option) any later version. +*/ + +#include <common.h> +#include <clock.h> +#include <io.h> +#include <init.h> + +#include <linux/clk.h> +#include <linux/err.h> + +static __iomem void *clps711x_timer_base; + +static uint64_t clps711x_cs_read (void ) +{ +return ~readw (clps711x_timer_base); +} + +static struct clocksource clps711x_cs = { + .read = clps711x_cs_read, + .mask =CLOCKSOURCE_MASK (16 ), +}; + +static int clps711x_cs_probe (struct device_d *dev) +{ +u32 rate; +struct clk *timer_clk; +
drivers/clocksource/clps711x.c line 44
Quoted 10 lines
drivers/clocksource/clps711x.c new file +10
-0+ timer_clk =clk_get (dev,NULL ); +if (IS_ERR (timer_clk)) +return PTR_ERR (timer_clk); + + rate =clk_get_rate (timer_clk); + clps711x_timer_base =dev_request_mem_region (dev,0 ); +if (!clps711x_timer_base) { +clk_put (timer_clk); +return -ENOENT ; + }
this deserve a nice crash
Quoted 25 lines
drivers/clocksource/clps711x.c new file +17
-0+ +clocks_calc_mult_shift (&clps711x_cs.mult, &clps711x_cs.shift, rate, +NSEC_PER_SEC ,10 ); + +return init_clock (&clps711x_cs); +} + +static struct driver_d clps711x_cs_driver = { + .name ="clps711x-cs" , + .probe = clps711x_cs_probe, +}; + +static __init int clps711x_cs_init (void ) +{ +return platform_driver_register (&clps711x_cs_driver); +} +coredevice_initcall (clps711x_cs_init);Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 04/13] ARM: clps711x: Add clocksource driver
Quoted 8 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines
drivers/clocksource/clps711x.c new file +8
-0+static int clps711x_cs_probe (struct device_d *dev) +{ +u32 rate; +struct clk *timer_clk; + + timer_clk =clk_get (dev,NULL ); +if (IS_ERR (timer_clk)) +return PTR_ERR (timer_clk);
Quoted 8 lines
drivers/clocksource/clps711x.c line 44
Quoted 7 lines
drivers/clocksource/clps711x.c new file +7
-0+ + rate =clk_get_rate (timer_clk); + clps711x_timer_base =dev_request_mem_region (dev,0 ); +if (!clps711x_timer_base) { +clk_put (timer_clk); +return -ENOENT ; + }this deserve a nice crash
No, it doesn't. First of all we are very early here, so we might not even see the crash. Then, with devicetree probing we may often end up with the same devices registered from the devicetree and from the platform/soc. While this should find a way to avoid duplicate device registration, it is not nice having barebox crash in this case.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re[2]: [PATCH 04/13] ARM: clps711x: Add clocksource driver
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines
Quoted 8 lines
drivers/clocksource/clps711x.c new file +8
-0+static int clps711x_cs_probe (struct device_d *dev) +{ +u32 rate; +struct clk *timer_clk; + + timer_clk =clk_get (dev,NULL ); +if (IS_ERR (timer_clk)) +return PTR_ERR (timer_clk);Quoted 8 lines
drivers/clocksource/clps711x.c line 44
Quoted 7 lines
drivers/clocksource/clps711x.c new file +7
-0+ + rate =clk_get_rate (timer_clk); + clps711x_timer_base =dev_request_mem_region (dev,0 ); +if (!clps711x_timer_base) { +clk_put (timer_clk); +return -ENOENT ; + }this deserve a nice crash
Quoted 5 lines
No, it doesn't. First of all we are very early here, so we might not even see the crash. Then, with devicetree probing we may often end up with the same devices registered from the devicetree and from the platform/soc. While this should find a way to avoid duplicate device registration, it is not nice having barebox crash in this case.
So what is the solution you propose in this case?
---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 04/13] ARM: clps711x: Add clocksource driver
Quoted 18 lines · Alexander Shiyan
Quoted 18 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 16 lines
Quoted 5 lines
drivers/clocksource/clps711x.c new file +5
-0+static int clps711x_cs_probe (struct device_d *dev) +{ +u32 rate; +struct clk *timer_clk; +drivers/clocksource/clps711x.c line 44
Quoted 10 lines
drivers/clocksource/clps711x.c new file +10
-0+ timer_clk =clk_get (dev,NULL ); +if (IS_ERR (timer_clk)) +return PTR_ERR (timer_clk); + + rate =clk_get_rate (timer_clk); + clps711x_timer_base =dev_request_mem_region (dev,0 ); +if (!clps711x_timer_base) { +clk_put (timer_clk); +return -ENOENT ; + }this deserve a nice crash
Quoted 7 lines
Quoted 5 lines
No, it doesn't. First of all we are very early here, so we might not even see the crash. Then, with devicetree probing we may often end up with the same devices registered from the devicetree and from the platform/soc. While this should find a way to avoid duplicate device registration, it is not nice having barebox crash in this case.
So what is the solution you propose in this case?
For the device duplication I don't have a solution yet. Basically I wanted to say that your patch looks good the way you did it.
Sascha
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re[2]: [PATCH 04/13] ARM: clps711x: Add clocksource driver
Quoted 25 lines · Alexander Shiyan
Quoted 24 lines
Quoted 23 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 8 lines
Quoted 8 lines
drivers/clocksource/clps711x.c new file +8
-0+static int clps711x_cs_probe (struct device_d *dev) +{ +u32 rate; +struct clk *timer_clk; + + timer_clk =clk_get (dev,NULL ); +if (IS_ERR (timer_clk)) +return PTR_ERR (timer_clk);Quoted 8 lines
drivers/clocksource/clps711x.c line 44
Quoted 7 lines
drivers/clocksource/clps711x.c new file +7
-0+ + rate =clk_get_rate (timer_clk); + clps711x_timer_base =dev_request_mem_region (dev,0 ); +if (!clps711x_timer_base) { +clk_put (timer_clk); +return -ENOENT ; + }this deserve a nice crash
No, it doesn't. First of all we are very early here, so we might not even see the crash. Then, with devicetree probing we may often end up with the same devices registered from the devicetree and from the platform/soc. While this should find a way to avoid duplicate device registration, it is not nice having barebox crash in this case.
Quoted 4 lines
Quoted 1 line
So what is the solution you propose in this case?
For the device duplication I don't have a solution yet. Basically I wanted to say that your patch looks good the way you did it.
Later I can move check for clps711x_timer_base at start of probe function. So at least we may avoid to add another clocksource.
---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/13 ARM: clps711x: Using COMMON_CLK
In reply to Alexander ShiyanThis patch adds support for COMMON_CLK API for CLPS711X targets.
--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/clock.c | 109 ++++++++++++++++++++++---------------- arch/arm/mach-clps711x/devices.c | 4 ++ 3 files changed, 68 insertions(+), 46 deletions(-)
arch/arm/Kconfig +1 -0
@@ -40,6 +40,7 @@ config ARCH_CLPS711X bool "Cirrus Logic EP711x/EP721x/EP731x" select CLKDEV_LOOKUP select CLOCKSOURCE_CLPS711X + select COMMON_CLK select CPU_32v4T config ARCH_EP93XX
arch/arm/mach-clps711x/clock.c +63 -46
158 lines not on this page · raw message
arch/arm/mach-clps711x/devices.c +4 -0
@@ -14,6 +14,8 @@#include <asm/io.h> #include <asm/memory.h> +#include <linux/clk.h> +#include <mach/clps711x.h> static int clps711x_mem_init (void )
@@ -98,10 +100,12 @@ void clps711x_add_uart(unsigned int id) {switch (id) {case 0 : +clk_add_alias (NULL ,"clps711x_serial0" ,"uart" ,NULL );add_generic_device_res ("clps711x_serial" ,0 , uart0_resources,ARRAY_SIZE (uart0_resources),NULL );break ;case 1 : +clk_add_alias (NULL ,"clps711x_serial1" ,"uart" ,NULL );add_generic_device_res ("clps711x_serial" ,1 , uart1_resources,ARRAY_SIZE (uart1_resources),NULL );break ;
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 05/13] ARM: clps711x: Using COMMON_CLK
Quoted 123 lines · Alexander Shiyan
This patch adds support for
COMMON_CLKAPI for CLPS711X targets.Signed-off-by Alexander Shiyan <[email protected]>--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/clock.c | 109 ++++++++++++++++++++++---------------- arch/arm/mach-clps711x/devices.c | 4 ++ 3 files changed, 68 insertions(+), 46 deletions(-)arch/arm/Kconfig +1
-0@@ -40,6 +40,7 @@ config ARCH_CLPS711X bool "Cirrus Logic EP711x/EP721x/EP731x" select CLKDEV_LOOKUP select CLOCKSOURCE_CLPS711X + select COMMON_CLK select CPU_32v4T config ARCH_EP93XXarch/arm/mach-clps711x/clock.c +34
-29@@ -11,6 +11,7 @@#include <init.h> #include <sizes.h> #include <asm/io.h> +#include <linux/clk.h> #include <linux/clkdev.h> #include <mach/clps711x.h> @@ -18,32 +19,37 @@#define CLPS711X_OSC_FREQ 3686400#define CLPS711X_EXT_FREQ 13000000 -static struct clk { -unsigned long rate; -} uart_clk, bus_clk, timer_clk; +enum clps711x_clks { + dummy, cpu, bus, uart, timer_hf, timer_lf, tc1, tc2, clk_max +}; -unsigned long clk_get_rate (struct clk *clk) -{ -return clk->rate; -} -EXPORT_SYMBOL (clk_get_rate); +static struct { +const char *name; +struct clk *clk; +} clks[clk_max] = { + {"dummy" , }, + {"cpu" , }, + {"bus" , }, + {"uart" , }, + {"timer_hf" , }, + {"timer_lf" , }, + {"tc1" , }, + {"tc2" , }, +}; -int clk_enable (struct clk *clk) -{ -/* Do nothing */ -return 0 ; -} -EXPORT_SYMBOL (clk_enable); +static const char *tc_sel_clks[] = { +"timer_lf" , +"timer_hf" , +}; -void clk_disable (struct clk *clk) +static __init void clps711x_clk_register (enum clps711x_clks id) { -/* Do nothing */ +clk_register_clkdev (clks[id].clk, clks[id].name,NULL ); } -EXPORT_SYMBOL (clk_disable); -static int clocks_init (void ) +static __init int clps711x_clk_init (void ) { -int pll, cpu; +unsigned int f_cpu, f_bus, f_uart, f_timer_hf, f_timer_lf, pll;u32 tmp; tmp =readl (PLLR ) >>24 ;@@ -54,57 +60,68 @@ static int clocks_init(void) tmp =readl (SYSFLG2 );if (tmp &SYSFLG2_CKMODE ) { - cpu =CLPS711X_EXT_FREQ ; - bus_clk.rate =CLPS711X_EXT_FREQ ; + f_cpu =CLPS711X_EXT_FREQ ; + f_bus =CLPS711X_EXT_FREQ ; }else { - cpu = pll; -if (cpu >=36864000 ) - bus_clk.rate = cpu /2 ; + f_cpu = pll; +if (f_cpu >=36864000 ) + f_bus = f_cpu /2 ;else - bus_clk.rate =36864000 /2 ; + f_bus =36864000 /2 ; } - uart_clk.rate =DIV_ROUND_CLOSEST (bus_clk.rate,10 ); + f_uart = f_bus /10 ;if (tmp &SYSFLG2_CKMODE ) { tmp =readw (SYSCON2 );if (tmp &SYSCON2_OSTB ) - timer_clk.rate =DIV_ROUND_CLOSEST (CLPS711X_EXT_FREQ ,26 ); + f_timer_hf =DIV_ROUND_CLOSEST (CLPS711X_EXT_FREQ ,26 );else - timer_clk.rate =DIV_ROUND_CLOSEST (CLPS711X_EXT_FREQ ,24 ); + f_timer_hf =DIV_ROUND_CLOSEST (CLPS711X_EXT_FREQ ,24 ); }else - timer_clk.rate =DIV_ROUND_CLOSEST (cpu,144 );
arch/arm/mach-clps711x/clock.c static int clocks_init(void) · line 89
Quoted 10 lines
arch/arm/mach-clps711x/clock.c +5
-2+ f_timer_hf =DIV_ROUND_CLOSEST (f_cpu,144 ); + f_timer_lf =DIV_ROUND_CLOSEST (f_timer_hf,256 ); + +/* Turn timers in free running mode */ tmp =readl (SYSCON1 ); - tmp &= ~SYSCON1_TC2M ;/* Free running mode */ - tmp |=SYSCON1_TC2S ;/* High frequency source */ + tmp &= ~(SYSCON1_TC1M |SYSCON1_TC2M );writel (tmp,SYSCON1 );
this is timer configuration not clocks
Best Regards,
J.
Quoted 87 lines
arch/arm/mach-clps711x/clock.c +24
-15-return 0 ; -} -core_initcall (clocks_init); - -static struct clk_lookup clocks_lookups[] = { -CLKDEV_CON_ID ("bus" , &bus_clk), -CLKDEV_DEV_ID ("clps711x_serial0" , &uart_clk), -CLKDEV_DEV_ID ("clps711x_serial1" , &uart_clk), -CLKDEV_DEV_ID ("clps711x-cs" , &timer_clk), -}; - -static int clkdev_init (void ) -{ -clkdev_add_table (clocks_lookups,ARRAY_SIZE (clocks_lookups)); + 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)); + clks[tc2].clk =clk_mux (clks[tc2].name,IOMEM (SYSCON1 ),7 ,1 , + tc_sel_clks,ARRAY_SIZE (tc_sel_clks)); + +clps711x_clk_register (dummy); +clps711x_clk_register (cpu); +clps711x_clk_register (bus); +clps711x_clk_register (uart); +clps711x_clk_register (timer_hf); +clps711x_clk_register (timer_lf); +clps711x_clk_register (tc1); +clps711x_clk_register (tc2);return 0 ; } -postcore_initcall (clkdev_init); +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 ,TC2D ,SZ_2 ,IORESOURCE_MEM ,NULL ); +return 0 ; }coredevice_initcall (clps711x_core_init);arch/arm/mach-clps711x/devices.c +4
-0@@ -14,6 +14,8 @@#include <asm/io.h> #include <asm/memory.h> +#include <linux/clk.h> +#include <mach/clps711x.h> static int clps711x_mem_init (void )@@ -98,10 +100,12 @@ void clps711x_add_uart(unsigned int id) {switch (id) {case 0 : +clk_add_alias (NULL ,"clps711x_serial0" ,"uart" ,NULL );add_generic_device_res ("clps711x_serial" ,0 , uart0_resources,ARRAY_SIZE (uart0_resources),NULL );break ;case 1 : +clk_add_alias (NULL ,"clps711x_serial1" ,"uart" ,NULL );add_generic_device_res ("clps711x_serial" ,1 , uart1_resources,ARRAY_SIZE (uart1_resources),NULL );break ;Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re[2]: [PATCH 05/13] ARM: clps711x: Using COMMON_CLK
Hello.
Quoted 4 lines · Alexander Shiyan
Quoted 3 lines
This patch adds support for
COMMON_CLKAPI for CLPS711X targets.Signed-off-by Alexander Shiyan <[email protected]>
...
Quoted 7 lines
arch/arm/mach-clps711x/clock.c static int clocks_init(void) · line 89
Quoted 6 lines
arch/arm/mach-clps711x/clock.c +2
-2+/* Turn timers in free running mode */ tmp =readl (SYSCON1 ); - tmp &= ~SYSCON1_TC2M ;/* Free running mode */ - tmp |=SYSCON1_TC2S ;/* High frequency source */ + tmp &= ~(SYSCON1_TC1M |SYSCON1_TC2M );writel (tmp,SYSCON1 );this is timer configuration not clocks
We need to read counter value for clocksource, so we need to ensure that we have full range of values (0x0 - 0xffff). It mean that timer/counters should not be in prescaler mode. All correct.
Thanks.
---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 05/13] ARM: clps711x: Using COMMON_CLK
Quoted 15 lines · Alexander Shiyan
Hello.
Quoted 4 lines · Alexander Shiyan
Quoted 3 lines
This patch adds support for
COMMON_CLKAPI for CLPS711X targets.Signed-off-by Alexander Shiyan <[email protected]>...
Quoted 7 lines
arch/arm/mach-clps711x/clock.c static int clocks_init(void) · line 89
Quoted 6 lines
arch/arm/mach-clps711x/clock.c +2
-2+/* Turn timers in free running mode */ tmp =readl (SYSCON1 ); - tmp &= ~SYSCON1_TC2M ;/* Free running mode */ - tmp |=SYSCON1_TC2S ;/* High frequency source */ + tmp &= ~(SYSCON1_TC1M |SYSCON1_TC2M );writel (tmp,SYSCON1 );this is timer configuration not clocks
Quoted 3 lines
We need to read counter value for clocksource, so we need to ensure that we have full range of values (
0x0-0xffff). It mean that timer/counters should not be in prescaler mode. All correct.
as on ARM this timer config no clocks
Quoted 3 lines
Thanks.
---
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/13 Add Generic GPIO driver
In reply to Alexander ShiyanThis patch adds generic memory-mapped GPIO controller support. Code taken from Linux Kernel and adopted for barebox.
--- drivers/gpio/Kconfig | 10 + drivers/gpio/Makefile | 5 +- drivers/gpio/gpio-generic.c | 428 +++++++++++++++++++++++++++++++++++++++ drivers/gpio/gpio.c | 5 + include/gpio.h | 1 + include/linux/basic_mmio_gpio.h | 69 +++++++ 6 files changed, 516 insertions(+), 2 deletions(-) create mode 100644 drivers/gpio/gpio-generic.c create mode 100644 include/linux/basic_mmio_gpio.h
drivers/gpio/Kconfig +10 -0
@@ -6,10 +6,20 @@ if GPIOLIB menu "GPIO" +config GPIO_GENERIC + bool + config GPIO_BCM2835 bool "GPIO support for BCM2835" depends on ARCH_BCM2835 +config GPIO_GENERIC_PLATFORM + bool "Generic memory-mapped GPIO controller support" + select GPIO_GENERIC + help + Say yes here to support basic platform memory-mapped + GPIO controllers + config GPIO_PL061 bool "PrimeCell PL061 GPIO support" depends on ARM_AMBA
drivers/gpio/Makefile +3 -2
@@ -1,4 +1,5 @@ -obj-$(CONFIG_GPIOLIB) += gpio.o +obj-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_GPIO_BCM2835) += gpio-bcm2835.o +obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o -obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o +obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
drivers/gpio/gpio-generic.c new file +428 -0
428 lines not on this page · raw message
drivers/gpio/gpio.c +5 -0
@@ -189,6 +189,11 @@ int gpiochip_add(struct gpio_chip *chip)return 0 ; } +void gpiochip_remove (struct gpio_chip *chip) +{ +list_del (&chip->list); +} +int gpio_get_num (struct device_d *dev,int gpio) {struct gpio_chip *chip;
include/gpio.h +1 -0
@@ -40,6 +40,7 @@ struct gpio_chip { };int gpiochip_add (struct gpio_chip *chip); +void gpiochip_remove (struct gpio_chip *chip);int gpio_get_num (struct device_d *dev,int gpio);
include/linux/basic_mmio_gpio.h new file +69 -0
69 lines not on this page · raw message
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/13 ARM: clps711x: Add GPIO driver
In reply to Alexander ShiyanThis patch adds support for CLPS711X GPIOs. Driver based on generic GPIO driver.
--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/devices.c | 82 ++++++++++++++++++++++++++++ arch/arm/mach-clps711x/include/mach/gpio.h | 3 + drivers/gpio/Kconfig | 7 +++ drivers/gpio/Makefile | 1 + drivers/gpio/gpio-clps711x.c | 70 ++++++++++++++++++++++++ 6 files changed, 164 insertions(+), 0 deletions(-) create mode 100644 arch/arm/mach-clps711x/include/mach/gpio.h create mode 100644 drivers/gpio/gpio-clps711x.c
arch/arm/Kconfig +1 -0
@@ -42,6 +42,7 @@ config ARCH_CLPS711X select CLOCKSOURCE_CLPS711X select COMMON_CLK select CPU_32v4T + select GPIOLIB config ARCH_EP93XX bool "Cirrus Logic EP93xx"
arch/arm/mach-clps711x/devices.c +82 -0
85 lines not on this page · raw message
arch/arm/mach-clps711x/include/mach/gpio.h new file +3 -0
@@ -0,0 +1,3 @@ +#include <asm-generic/gpio.h> + +#define CLPS711X_GPIO (prt,bit) ((prt) * 8 + (bit))
drivers/gpio/Kconfig +7 -0
@@ -13,6 +13,13 @@ config GPIO_BCM2835 bool "GPIO support for BCM2835" depends on ARCH_BCM2835 +config GPIO_CLPS711X + bool "GPIO support for CLPS711X" + depends on ARCH_CLPS711X + select GPIO_GENERIC + help + Say yes here to enable the GPIO driver for the CLPS711X CPUs + config GPIO_GENERIC_PLATFORM bool "Generic memory-mapped GPIO controller support" select GPIO_GENERIC
drivers/gpio/Makefile +1 -0
@@ -1,5 +1,6 @@ obj-$(CONFIG_GPIOLIB) += gpio.o obj-$(CONFIG_GPIO_BCM2835) += gpio-bcm2835.o +obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_GENERIC) += gpio-generic.o obj-$(CONFIG_GPIO_PL061) += gpio-pl061.o obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
drivers/gpio/gpio-clps711x.c new file +70 -0
70 lines not on this page · raw message
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 8/13 Add helpers to define resources
In reply to Alexander ShiyanThis patch adds helpers to define resources, such as DEFINE_RES_NAMED, DEFINE_RES_MEM and DEFINE_RES_MEM_NAMED.
--- include/linux/ioport.h | 15 +++++++++++++++ 1 files changed, 15 insertions(+), 0 deletions(-)
include/linux/ioport.h +15 -0
@@ -111,10 +111,25 @@ struct resource {/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ #define IORESOURCE_PCI_FIXED (1<<4)/* Do not move resource */ +/* Helpers to define resources */ +#define DEFINE_RES_NAMED (_start, _size, _name, _flags) \ + { \ + .start = (_start), \ + .end = (_start) + (_size) - 1, \ + .name = (_name), \ + .flags = (_flags), \ + } + +#define DEFINE_RES_MEM_NAMED (_start, _size, _name) \ + DEFINE_RES_NAMED((_start), (_size), (_name), IORESOURCE_MEM) +#define DEFINE_RES_MEM (_start, _size) \ + DEFINE_RES_MEM_NAMED((_start), (_size), NULL) +static inline resource_size_t resource_size (const struct resource *res) {return res->end - res->start +1 ; } +static inline unsigned long resource_type (const struct resource *res) {return res->flags &IORESOURCE_TYPE_BITS ;
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 9/13 ARM: clps711x: Migrate to using DEFINE_RES_MEM macro
In reply to Alexander Shiyan--- arch/arm/mach-clps711x/devices.c | 108 ++++++------------------------------- 1 files changed, 18 insertions(+), 90 deletions(-)
arch/arm/mach-clps711x/devices.c +18 -90
@@ -51,49 +51,17 @@ void clps711x_setup_memcfg(int bank, u32 val) }static struct resource uart0_resources[] = { - { - .start =UBRLCR1 , - .end =UBRLCR1 , - .flags =IORESOURCE_MEM , - }, - { - .start =SYSCON1 , - .end =SYSCON1 , - .flags =IORESOURCE_MEM , - }, - { - .start =SYSFLG1 , - .end =SYSFLG1 , - .flags =IORESOURCE_MEM , - }, - { - .start =UARTDR1 , - .end =UARTDR1 , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (UBRLCR1 ,SZ_4 ), +DEFINE_RES_MEM (SYSCON1 ,SZ_4 ), +DEFINE_RES_MEM (SYSFLG1 ,SZ_4 ), +DEFINE_RES_MEM (UARTDR1 ,SZ_4 ), };static struct resource uart1_resources[] = { - { - .start =UBRLCR2 , - .end =UBRLCR2 , - .flags =IORESOURCE_MEM , - }, - { - .start =SYSCON2 , - .end =SYSCON2 , - .flags =IORESOURCE_MEM , - }, - { - .start =SYSFLG2 , - .end =SYSFLG2 , - .flags =IORESOURCE_MEM , - }, - { - .start =UARTDR2 , - .end =UARTDR2 , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (UBRLCR2 ,SZ_4 ), +DEFINE_RES_MEM (SYSCON2 ,SZ_4 ), +DEFINE_RES_MEM (SYSFLG2 ,SZ_4 ), +DEFINE_RES_MEM (UARTDR2 ,SZ_4 ), };void clps711x_add_uart (unsigned int id)
@@ -113,68 +81,28 @@ void clps711x_add_uart(unsigned int id) }static struct resource gpio0_resources[] = { - { - .start =PADR , - .end =PADR , - .flags =IORESOURCE_MEM , - }, - { - .start =PADDR , - .end =PADDR , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (PADR ,SZ_1 ), +DEFINE_RES_MEM (PADDR ,SZ_1 ), };static struct resource gpio1_resources[] = { - { - .start =PBDR , - .end =PBDR , - .flags =IORESOURCE_MEM , - }, - { - .start =PBDDR , - .end =PBDDR , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (PBDR ,SZ_1 ), +DEFINE_RES_MEM (PBDDR ,SZ_1 ), };static struct resource gpio2_resources[] = { - { - .start =PCDR , - .end =PCDR , - .flags =IORESOURCE_MEM , - }, - { - .start =PCDDR , - .end =PCDDR , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (PCDR ,SZ_1 ), +DEFINE_RES_MEM (PCDDR ,SZ_1 ), };static struct resource gpio3_resources[] = { - { - .start =PDDR , - .end =PDDR , - .flags =IORESOURCE_MEM , - }, - { - .start =PDDDR , - .end =PDDDR , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (PDDR ,SZ_1 ), +DEFINE_RES_MEM (PDDDR ,SZ_1 ), };static struct resource gpio4_resources[] = { - { - .start =PEDR , - .end =PEDR , - .flags =IORESOURCE_MEM , - }, - { - .start =PEDDR , - .end =PEDDR , - .flags =IORESOURCE_MEM , - }, +DEFINE_RES_MEM (PEDR ,SZ_1 ), +DEFINE_RES_MEM (PEDDR ,SZ_1 ), };static __init int clps711x_gpio_init (void )
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 10/13 ARM: clps711x: Limit chipselect setup up to CS5
In reply to Alexander ShiyanCS6 and CS7 is a internal CPU resources and these chipselects are already pre configured, so avoid to rewrite this settings.
--- arch/arm/mach-clps711x/devices.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-clps711x/devices.c +1 -1
@@ -44,7 +44,7 @@ void clps711x_setup_memcfg(int bank, u32 val) case 0 ... 3:_clps711x_setup_memcfg (bank,MEMCFG1 , val);break ; - case 4 ... 7: + case 4 ... 5:_clps711x_setup_memcfg (bank -4 ,MEMCFG2 , val);break ; }
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 11/13 Add system controller register driver (SYSCON)
In reply to Alexander ShiyanThis patch adds support for system controller register driver (SYSCON). Code taken from Linux Kernel and adapted for using in barebox.
--- drivers/mfd/Kconfig | 5 +++ drivers/mfd/Makefile | 1 + drivers/mfd/syscon.c | 92 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/mfd/syscon.h | 26 ++++++++++++++ 4 files changed, 124 insertions(+), 0 deletions(-) create mode 100644 drivers/mfd/syscon.c create mode 100644 include/mfd/syscon.h
drivers/mfd/Kconfig +5 -0
@@ -24,6 +24,11 @@ config MFD_STMPE depends on I2C bool "STMPE-i2c driver" +config MFD_SYSCON + bool "System Controller Register" + help + Select this option to enable accessing system control registers + config MFD_TWLCORE bool
drivers/mfd/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_MFD_MC34704) += mc34704.o obj-$(CONFIG_MFD_MC34708) += mc34708.o obj-$(CONFIG_MFD_MC9SDZ60) += mc9sdz60.o obj-$(CONFIG_MFD_STMPE) += stmpe-i2c.o +obj-$(CONFIG_MFD_SYSCON) += syscon.o obj-$(CONFIG_MFD_TWLCORE) += twl-core.o obj-$(CONFIG_MFD_TWL4030) += twl4030.o obj-$(CONFIG_MFD_TWL6030) += twl6030.o
drivers/mfd/syscon.c new file +92 -0
92 lines not on this page · raw message
include/mfd/syscon.h new file +26 -0
@@ -0,0 +1,26 @@ +/* System Control Driver +* +* Based on linux driver by: +* Copyright (C) 2012 Freescale Semiconductor, Inc. +* Copyright (C) 2012 Linaro Ltd. +* Author: Dong Aisheng <[email protected]> +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ + +#ifndef __MFD_SYSCON_H__ +#define __MFD_SYSCON_H__ + +#ifdef CONFIG_MFD_SYSCON +void __iomem *syscon_base_lookup_by_pdevname (const char *); +#else +static inline void __iomem *syscon_base_lookup_by_pdevname (const char *) +{ +return NULL ; +} +#endif + +#endif
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 12/13 ARM: clps711x: Export system-wide registers through SYSCON driver
In reply to Alexander Shiyan--- arch/arm/Kconfig | 1 + arch/arm/mach-clps711x/devices.c | 16 ++++++++++++++++ drivers/mfd/syscon.c | 3 +++ 3 files changed, 20 insertions(+), 0 deletions(-)
arch/arm/Kconfig +1 -0
@@ -43,6 +43,7 @@ config ARCH_CLPS711X select COMMON_CLK select CPU_32v4T select GPIOLIB + select MFD_SYSCON config ARCH_EP93XX bool "Cirrus Logic EP93xx"
arch/arm/mach-clps711x/devices.c +16 -0
@@ -121,3 +121,19 @@ static __init int clps711x_gpio_init(void)return 0 ; }coredevice_initcall (clps711x_gpio_init); + +static __init int clps711x_syscon_init (void ) +{ +/* SYSCON1, SYSFLG1 */ +add_generic_device ("clps711x-syscon" ,1 ,NULL ,SYSCON1 ,SZ_128 , +IORESOURCE_MEM ,NULL ); +/* SYSCON2, SYSFLG2 */ +add_generic_device ("clps711x-syscon" ,2 ,NULL ,SYSCON2 ,SZ_128 , +IORESOURCE_MEM ,NULL ); +/* SYSCON3 */ +add_generic_device ("clps711x-syscon" ,3 ,NULL ,SYSCON3 ,SZ_64 , +IORESOURCE_MEM ,NULL ); + +return 0 ; +} +postcore_initcall (clps711x_syscon_init);
drivers/mfd/syscon.c +3 -0
@@ -72,6 +72,9 @@ static int syscon_probe(struct device_d *dev)static struct platform_device_id syscon_ids[] = { {"syscon" , }, +#ifdef CONFIG_ARCH_CLPS711X + {"clps711x-syscon" , }, +#endif { } };
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 13/13 serial: clps711x: Migrate to using SYSCON driver
In reply to Alexander Shiyan--- arch/arm/mach-clps711x/devices.c | 4 ---- drivers/serial/serial_clps711x.c | 31 +++++++++++++++++++------------ 2 files changed, 19 insertions(+), 16 deletions(-)
arch/arm/mach-clps711x/devices.c +0 -4
@@ -52,15 +52,11 @@ void clps711x_setup_memcfg(int bank, u32 val)static struct resource uart0_resources[] = {DEFINE_RES_MEM (UBRLCR1 ,SZ_4 ), -DEFINE_RES_MEM (SYSCON1 ,SZ_4 ), -DEFINE_RES_MEM (SYSFLG1 ,SZ_4 ),DEFINE_RES_MEM (UARTDR1 ,SZ_4 ), };static struct resource uart1_resources[] = {DEFINE_RES_MEM (UBRLCR2 ,SZ_4 ), -DEFINE_RES_MEM (SYSCON2 ,SZ_4 ), -DEFINE_RES_MEM (SYSFLG2 ,SZ_4 ),DEFINE_RES_MEM (UARTDR2 ,SZ_4 ), };
drivers/serial/serial_clps711x.c +19 -12
@@ -15,18 +15,21 @@#include <io.h> #include <linux/clk.h> #include <linux/err.h> +#include <mfd/syscon.h> #include <mach/clps711x.h> struct clps711x_uart {void __iomem *UBRLCR; -void __iomem *SYSCON; -void __iomem *SYSFLG;void __iomem *UARTDR; +void __iomem *syscon;struct clk *uart_clk;struct console_device cdev; }; +#define SYSCON (x) ((x)->syscon + 0x00) +#define SYSFLG (x) ((x)->syscon + 0x40) +static int clps711x_setbaudrate (struct console_device *cdev,int baudrate) {struct clps711x_uart *s = cdev->dev->priv;
@@ -48,7 +51,7 @@ static void clps711x_init_port(struct console_device *cdev)u32 tmp;/* Disable the UART */ -writel (readl (s->SYSCON) & ~SYSCON_UARTEN , s->SYSCON); +writel (readl (SYSCON (s)) & ~SYSCON_UARTEN ,SYSCON (s));/* Setup Line Control Register */ tmp =readl (s->UBRLCR) &UBRLCR_BAUD_MASK ;
@@ -59,7 +62,7 @@ static void clps711x_init_port(struct console_device *cdev)clps711x_setbaudrate (cdev,CONFIG_BAUDRATE );/* Enable the UART */ -writel (readl (s->SYSCON) |SYSCON_UARTEN , s->SYSCON); +writel (readl (SYSCON (s)) |SYSCON_UARTEN ,SYSCON (s)); }static void clps711x_putc (struct console_device *cdev,char c)
@@ -67,7 +70,7 @@ static void clps711x_putc(struct console_device *cdev, char c)struct clps711x_uart *s = cdev->dev->priv;/* Wait until there is space in the FIFO */ -while (readl (s->SYSFLG) &SYSFLG_UTXFF ) +while (readl (SYSFLG (s)) &SYSFLG_UTXFF )barrier ();/* Send the character */
@@ -80,7 +83,7 @@ static int clps711x_getc(struct console_device *cdev)u16 data;/* Wait until there is data in the FIFO */ -while (readl (s->SYSFLG) &SYSFLG_URXFE ) +while (readl (SYSFLG (s)) &SYSFLG_URXFE )barrier (); data =readw (s->UARTDR);
@@ -96,31 +99,35 @@ static int clps711x_tstc(struct console_device *cdev) {struct clps711x_uart *s = cdev->dev->priv; -return !(readl (s->SYSFLG) &SYSFLG_URXFE ); +return !(readl (SYSFLG (s)) &SYSFLG_URXFE ); }static void clps711x_flush (struct console_device *cdev) {struct clps711x_uart *s = cdev->dev->priv; -while (readl (s->SYSFLG) &SYSFLG_UBUSY ) +while (readl (SYSFLG (s)) &SYSFLG_UBUSY )barrier (); }static int clps711x_probe (struct device_d *dev) {struct clps711x_uart *s; +char syscon_dev[18 ]; -BUG_ON (dev->num_resources !=4 ); +BUG_ON (dev->num_resources !=2 ); +BUG_ON ((dev->id !=0 ) && (dev->id !=1 )); s =xzalloc (sizeof (struct clps711x_uart )); s->uart_clk =clk_get (dev,NULL );BUG_ON (IS_ERR (s->uart_clk)); s->UBRLCR =dev_get_mem_region (dev,0 ); - s->SYSCON =dev_get_mem_region (dev,1 ); - s->SYSFLG =dev_get_mem_region (dev,2 ); - s->UARTDR =dev_get_mem_region (dev,3 ); + s->UARTDR =dev_get_mem_region (dev,1 ); + +sprintf (syscon_dev,"clps711x-syscon%i" , dev->id +1 ); + s->syscon =syscon_base_lookup_by_pdevname (syscon_dev); +BUG_ON (IS_ERR (s->syscon)); dev->priv = s; s->cdev.dev = dev;
Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Sascha Hauer
AppliedQuoted 2 lines · Alexander Shiyan
Signed-off-by Alexander Shiyan <[email protected]>
Applied, thanks
Sascha
Quoted 62 lines
--- arch/arm/boards/clep7212/env/config | 20 -------------------- arch/arm/boards/clep7212/env/config-board | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 20 deletions(-) delete mode 100644 arch/arm/boards/clep7212/env/config create mode 100644 arch/arm/boards/clep7212/env/config-boardarch/arm/boards/clep7212/env/config deleted +0
-20@@ -1,20 +0,0 @@ -#!/bin/sh - -global.hostname=clps711x - -# set to false if you do not want to have colors -global.allow_color=true - -# user (used for network filenames) -global.user=anonymous - -# timeout in seconds before the default boot entry is started -global.autoboot_timeout=2 - -# default boot entry (one of /env/boot/*) -if [ -e /dev/nor0 ]; then - global.boot.default=nor -fi - -# default bootargs -global.linux.bootargs.base="earlyprintk console=ttyCL0,57600n8"arch/arm/boards/clep7212/env/config-board new file +14
-0@@ -0,0 +1,14 @@ +#!/bin/sh + +global.hostname=clps711x + +# Timeout in seconds before the default boot entry is started +global.autoboot_timeout=2 + +# Default boot entry (one of /env/boot/*) +if [ -e /dev/nor0 ]; then + global.boot.default=nor +fi + +# Board bootargs +global.linux.bootargs.base="earlyprintk console=ttyCL0,57600n8"Signature · 7 lines
1.7.3.4 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Signature · 9 lines
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 [email protected] http://lists.infradead.org/mailman/listinfo/barebox