Re: [PATCH 7/8] i.MX: serial: Distil common clock ungating code
On Mon, May 04, 2015 at 11:04:25AM -0700, Andrey Smirnov wrote: > > Please add a imx6_ namespace to this function. The calling code always > > knows that it is running on imx6, so you can use IMX6_CCM_BASE_ADDR > > directly rather than using soc##_. The function above is imx6 specific > > anyway since only this SoC has the gate registers on 0x68..0x80. > > What about i.MX51? As far as I can tell it is the same as i.MX6 in > this aspect. This function wouldn't have any consumers on i.MX51 > architecture, of course, but shouldn't this function have a SoC > variant agnostic name, just for the sake of genericity? On i.MX1/21/25/27/31/35 the function would look different, so when trying to create a generic function we would need to decide which SoC we are on. cpu_is_imxxy() doesn't work at that place because it needs initialisation. #ifdefs do not work because we may have multiple SoC supports compiled in. Even if we could decide which SoC we are on, we still need a cascade of if() or #ifdef. Since the caller already knows the SoC type it's easiest to create SoC specific functions. If i.MX51 (and i.MX53 probably aswell) is the same as i.MX6 the i.MX6 function could simply call the i.MX5 function. Sascha -- 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- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 7/8] i.MX: serial: Distil common clock ungating code
> Please add a imx6_ namespace to this function. The calling code always > knows that it is running on imx6, so you can use IMX6_CCM_BASE_ADDR > directly rather than using soc##_. The function above is imx6 specific > anyway since only this SoC has the gate registers on 0x68..0x80. What about i.MX51? As far as I can tell it is the same as i.MX6 in this aspect. This function wouldn't have any consumers on i.MX51 architecture, of course, but shouldn't this function have a SoC variant agnostic name, just for the sake of genericity? > > Sascha > > -- > 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- | ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 7/8] i.MX: serial: Distil common clock ungating code
On Sat, May 02, 2015 at 07:26:19PM -0700, Andrey Smirnov wrote: > Move all of the common clock ungating code in early UART > initialization into a dedicated subroutine that can be shared by all > of the users. > > Signed-off-by: Andrey Smirnov > --- > arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c | 9 + > arch/arm/boards/karo-tx6x/lowlevel.c| 10 +- > arch/arm/boards/phytec-phycard-imx6/lowlevel.c | 10 +- > arch/arm/boards/phytec-phyflex-imx6/lowlevel.c | 10 +- > arch/arm/boards/variscite-mx6/lowlevel.c| 10 +- > arch/arm/mach-imx/include/mach/debug_ll.h | 17 + > 6 files changed, 22 insertions(+), 44 deletions(-) > > diff --git a/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c > b/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c > index a8d16cb..fd154df 100644 > --- a/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c > +++ b/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c > @@ -21,16 +21,9 @@ > > static inline void setup_uart(void) > { > - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; > void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; > > - writel(0x, ccmbase + 0x68); > - writel(0x, ccmbase + 0x6c); > - writel(0x, ccmbase + 0x70); > - writel(0x, ccmbase + 0x74); > - writel(0x, ccmbase + 0x78); > - writel(0x, ccmbase + 0x7c); > - writel(0x, ccmbase + 0x80); > + ungate_all_peripherals(); > > writel(0x0, iomuxbase + 0x24); > writel(0x1b0b1, iomuxbase + 0x036C); > diff --git a/arch/arm/boards/karo-tx6x/lowlevel.c > b/arch/arm/boards/karo-tx6x/lowlevel.c > index 3f9fb23..d7087f5 100644 > --- a/arch/arm/boards/karo-tx6x/lowlevel.c > +++ b/arch/arm/boards/karo-tx6x/lowlevel.c > @@ -22,7 +22,6 @@ > > static inline void setup_uart(void) > { > - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; > void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; > > writel(0x1, iomuxbase + 0x0314); > @@ -30,14 +29,7 @@ static inline void setup_uart(void) > writel(0x1, iomuxbase + 0x0330); > writel(0x1, iomuxbase + 0x032c); > > - writel(0x, ccmbase + 0x68); > - writel(0x, ccmbase + 0x6c); > - writel(0x, ccmbase + 0x70); > - writel(0x, ccmbase + 0x74); > - writel(0x, ccmbase + 0x78); > - writel(0x, ccmbase + 0x7c); > - writel(0x, ccmbase + 0x80); > - > + ungate_all_peripherals(); > setup_uart_ll(); > > putc_ll('>'); > diff --git a/arch/arm/boards/phytec-phycard-imx6/lowlevel.c > b/arch/arm/boards/phytec-phycard-imx6/lowlevel.c > index 1d48818..c8306ec 100644 > --- a/arch/arm/boards/phytec-phycard-imx6/lowlevel.c > +++ b/arch/arm/boards/phytec-phycard-imx6/lowlevel.c > @@ -26,19 +26,11 @@ > > static inline void setup_uart(void) > { > - void __iomem *ccmbase = IOMEM(MX6_CCM_BASE_ADDR); > void __iomem *iomuxbase = IOMEM(MX6_IOMUXC_BASE_ADDR); > > writel(0x4, iomuxbase + 0x01f8); > > - writel(0x, ccmbase + 0x68); > - writel(0x, ccmbase + 0x6c); > - writel(0x, ccmbase + 0x70); > - writel(0x, ccmbase + 0x74); > - writel(0x, ccmbase + 0x78); > - writel(0x, ccmbase + 0x7c); > - writel(0x, ccmbase + 0x80); > - > + ungate_all_peripherals(); > setup_uart_ll(); > > putc_ll('>'); > diff --git a/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c > b/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c > index 367d4dc..46f788c 100644 > --- a/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c > +++ b/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c > @@ -27,19 +27,11 @@ > > static inline void setup_uart(void) > { > - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; > void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; > > writel(0x4, iomuxbase + 0x01f8); > > - writel(0x, ccmbase + 0x68); > - writel(0x, ccmbase + 0x6c); > - writel(0x, ccmbase + 0x70); > - writel(0x, ccmbase + 0x74); > - writel(0x, ccmbase + 0x78); > - writel(0x, ccmbase + 0x7c); > - writel(0x, ccmbase + 0x80); > - > + ungate_all_peripherals(); > setup_uart_ll(); > > putc_ll('>'); > diff --git a/arch/arm/boards/variscite-mx6/lowlevel.c > b/arch/arm/boards/variscite-mx6/lowlevel.c > index b0ab424..01878e6 100644 > --- a/arch/arm/boards/variscite-mx6/lowlevel.c > +++ b/arch/arm/boards/variscite-mx6/lowlevel.c > @@ -28,20 +28,12 @@ > > static inline void setup_uart(void) > { > - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; > void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; > > writel(0x03, iomuxbase + 0x0280); > writel(0x03, iomuxbase + 0x0284); > > - writel(0x, ccmbase + 0x68); > - writel(0x, ccmbas
[PATCH 7/8] i.MX: serial: Distil common clock ungating code
Move all of the common clock ungating code in early UART initialization into a dedicated subroutine that can be shared by all of the users. Signed-off-by: Andrey Smirnov --- arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c | 9 + arch/arm/boards/karo-tx6x/lowlevel.c| 10 +- arch/arm/boards/phytec-phycard-imx6/lowlevel.c | 10 +- arch/arm/boards/phytec-phyflex-imx6/lowlevel.c | 10 +- arch/arm/boards/variscite-mx6/lowlevel.c| 10 +- arch/arm/mach-imx/include/mach/debug_ll.h | 17 + 6 files changed, 22 insertions(+), 44 deletions(-) diff --git a/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c b/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c index a8d16cb..fd154df 100644 --- a/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c +++ b/arch/arm/boards/freescale-mx6sx-sabresdb/lowlevel.c @@ -21,16 +21,9 @@ static inline void setup_uart(void) { - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; - writel(0x, ccmbase + 0x68); - writel(0x, ccmbase + 0x6c); - writel(0x, ccmbase + 0x70); - writel(0x, ccmbase + 0x74); - writel(0x, ccmbase + 0x78); - writel(0x, ccmbase + 0x7c); - writel(0x, ccmbase + 0x80); + ungate_all_peripherals(); writel(0x0, iomuxbase + 0x24); writel(0x1b0b1, iomuxbase + 0x036C); diff --git a/arch/arm/boards/karo-tx6x/lowlevel.c b/arch/arm/boards/karo-tx6x/lowlevel.c index 3f9fb23..d7087f5 100644 --- a/arch/arm/boards/karo-tx6x/lowlevel.c +++ b/arch/arm/boards/karo-tx6x/lowlevel.c @@ -22,7 +22,6 @@ static inline void setup_uart(void) { - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; writel(0x1, iomuxbase + 0x0314); @@ -30,14 +29,7 @@ static inline void setup_uart(void) writel(0x1, iomuxbase + 0x0330); writel(0x1, iomuxbase + 0x032c); - writel(0x, ccmbase + 0x68); - writel(0x, ccmbase + 0x6c); - writel(0x, ccmbase + 0x70); - writel(0x, ccmbase + 0x74); - writel(0x, ccmbase + 0x78); - writel(0x, ccmbase + 0x7c); - writel(0x, ccmbase + 0x80); - + ungate_all_peripherals(); setup_uart_ll(); putc_ll('>'); diff --git a/arch/arm/boards/phytec-phycard-imx6/lowlevel.c b/arch/arm/boards/phytec-phycard-imx6/lowlevel.c index 1d48818..c8306ec 100644 --- a/arch/arm/boards/phytec-phycard-imx6/lowlevel.c +++ b/arch/arm/boards/phytec-phycard-imx6/lowlevel.c @@ -26,19 +26,11 @@ static inline void setup_uart(void) { - void __iomem *ccmbase = IOMEM(MX6_CCM_BASE_ADDR); void __iomem *iomuxbase = IOMEM(MX6_IOMUXC_BASE_ADDR); writel(0x4, iomuxbase + 0x01f8); - writel(0x, ccmbase + 0x68); - writel(0x, ccmbase + 0x6c); - writel(0x, ccmbase + 0x70); - writel(0x, ccmbase + 0x74); - writel(0x, ccmbase + 0x78); - writel(0x, ccmbase + 0x7c); - writel(0x, ccmbase + 0x80); - + ungate_all_peripherals(); setup_uart_ll(); putc_ll('>'); diff --git a/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c b/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c index 367d4dc..46f788c 100644 --- a/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c +++ b/arch/arm/boards/phytec-phyflex-imx6/lowlevel.c @@ -27,19 +27,11 @@ static inline void setup_uart(void) { - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; writel(0x4, iomuxbase + 0x01f8); - writel(0x, ccmbase + 0x68); - writel(0x, ccmbase + 0x6c); - writel(0x, ccmbase + 0x70); - writel(0x, ccmbase + 0x74); - writel(0x, ccmbase + 0x78); - writel(0x, ccmbase + 0x7c); - writel(0x, ccmbase + 0x80); - + ungate_all_peripherals(); setup_uart_ll(); putc_ll('>'); diff --git a/arch/arm/boards/variscite-mx6/lowlevel.c b/arch/arm/boards/variscite-mx6/lowlevel.c index b0ab424..01878e6 100644 --- a/arch/arm/boards/variscite-mx6/lowlevel.c +++ b/arch/arm/boards/variscite-mx6/lowlevel.c @@ -28,20 +28,12 @@ static inline void setup_uart(void) { - void __iomem *ccmbase = (void *)MX6_CCM_BASE_ADDR; void __iomem *iomuxbase = (void *)MX6_IOMUXC_BASE_ADDR; writel(0x03, iomuxbase + 0x0280); writel(0x03, iomuxbase + 0x0284); - writel(0x, ccmbase + 0x68); - writel(0x, ccmbase + 0x6c); - writel(0x, ccmbase + 0x70); - writel(0x, ccmbase + 0x74); - writel(0x, ccmbase + 0x78); - writel(0x, ccmbase + 0x7c); - writel(0x, cc