i.MX23/STM: Continue improving this architecture
Subsystems (4)
PATCH 1/1 i.MX23/STM: Continue improving this architecture
Some things to improve the i.MX23 architecture and also some things to prepare it for i.MX28 inclusion.
_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/6 Remove variable size restrictions in i.MX23's gpio managing routines
There is no really need for restricted variable types for the parameters. Replace them by standard C types with the same behaviour. Only imx_gpio_mode() need it, to ensure GPIO's bit settings.
--- arch/arm/mach-stm/iomux-imx23.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-)
arch/arm/mach-stm/iomux-imx23.c +14 -7
@@ -31,42 +31,49 @@#define HW_PINCTRL_DIN0 0x600#define HW_PINCTRL_DOE0 0x700 -static uint32_t calc_mux_reg (uint32_t no) +static unsigned calc_mux_reg (unsigned no) {/* each register controls 16 pads */ return ((no >>4 ) <<4 ) +HW_PINCTRL_MUXSEL0 ; } -static uint32_t calc_strength_reg (uint32_t no) +static unsigned calc_strength_reg (unsigned no) {/* each register controls 8 pads */ return ((no >>3 ) <<4 ) +HW_PINCTRL_DRIVE0 ; } -static uint32_t calc_pullup_reg (uint32_t no) +static unsigned calc_pullup_reg (unsigned no) {/* each register controls 32 pads */ return ((no >>5 ) <<4 ) +HW_PINCTRL_PULL0 ; } -static uint32_t calc_output_enable_reg (uint32_t no) +static unsigned calc_output_enable_reg (unsigned no) {/* each register controls 32 pads */ return ((no >>5 ) <<4 ) +HW_PINCTRL_DOE0 ; } -static uint32_t calc_output_reg (uint32_t no) +static unsigned calc_output_reg (unsigned no) {/* each register controls 32 pads */ return ((no >>5 ) <<4 ) +HW_PINCTRL_DOUT0 ; } +static unsigned calc_input_reg (unsigned no) +{ +/* each register controls 32 pads */ +return ((no >>5 ) <<4 ) +HW_PINCTRL_DIN0 ; +} +/** * @param[in] m One of the defines from iomux-mx23.h to configure *one* pin */ -void imx_gpio_mode (unsigned m) +void imx_gpio_mode (uint32_t m) { -uint32_t reg_offset, gpio_pin, reg; +uint32_t reg; +unsigned gpio_pin, reg_offset; gpio_pin =GET_GPIO_NO (m);
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/6 Simplify test for the max. possible GPIO number.
In reply to Juergen BeisertThis is only for easier integration of the i.MX28 architecture.
--- arch/arm/mach-stm/iomux-imx23.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
arch/arm/mach-stm/iomux-imx23.c +3 -1
@@ -31,6 +31,8 @@#define HW_PINCTRL_DIN0 0x600#define HW_PINCTRL_DOE0 0x700 +#define MAX_GPIO_NO 95 +static unsigned calc_mux_reg (unsigned no) {/* each register controls 16 pads */
@@ -84,7 +86,7 @@ void imx_gpio_mode(uint32_t m)writel (reg,IMX_IOMUXC_BASE + reg_offset);/* some pins are disabled when configured for GPIO */ -if ((gpio_pin >95 ) && (GET_FUNC (m) ==IS_GPIO )) { +if ((gpio_pin >MAX_GPIO_NO ) && (GET_FUNC (m) ==IS_GPIO )) {printf ("Cannot configure pad %d to GPIO\n" , gpio_pin);return ; }
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/6 i.MX23: Add support for the gpio commands
In reply to Juergen Beisert--- arch/arm/mach-stm/iomux-imx23.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 files changed, 38 insertions(+), 0 deletions(-)
arch/arm/mach-stm/iomux-imx23.c +38 -0
@@ -20,6 +20,7 @@#include <common.h> #include <init.h> #include <gpio.h> +#include <errno.h> #include <asm/io.h> #include <mach/imx-regs.h>
@@ -124,3 +125,40 @@ void imx_gpio_mode(uint32_t m) } } } + +void gpio_set_value (unsigned gpio,int val) +{ +unsigned reg_offset; + + reg_offset =calc_output_reg (gpio); +pr_debug ("%u: Accessing %X+%X with value %X\n" , gpio,IMX_IOMUXC_BASE , + reg_offset,0x1 << (gpio %32 )); +writel (0x1 << (gpio %32 ), +IMX_IOMUXC_BASE + reg_offset + (val !=0 ?4 :8 )); +} + +int gpio_direction_input (unsigned gpio) +{ +pr_err ("Not yet supported\n" ); +return -EINVAL ; +} + +int gpio_direction_output (unsigned gpio,int val) +{ +pr_err ("Not yet supported\n" ); +return -EINVAL ; +} + +int gpio_get_value (unsigned gpio) +{ +uint32_t reg; +unsigned reg_offset; + + reg_offset =calc_input_reg (gpio); + reg =readl (IMX_IOMUXC_BASE + reg_offset); +pr_debug ("%u: Accessing %X+%X with value %X->%X\n" , gpio,IMX_IOMUXC_BASE , + reg_offset,0x1 << (gpio %32 ), reg & (0x1 << (gpio %32 ))); +if (reg & (0x1 << (gpio %32 ))) +return 1 ; +return 0 ; +}
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/6 i.MX23: Add pixel clock calculation routine for framebuffer support
In reply to Juergen Beisert--- arch/arm/mach-stm/include/mach/clock.h | 2 + arch/arm/mach-stm/speed-imx23.c | 100 +++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 1 deletions(-)
arch/arm/mach-stm/include/mach/clock.h +2 -0
@@ -29,6 +29,8 @@ unsigned imx_get_xclk(void);unsigned imx_get_sspclk (unsigned );unsigned imx_set_sspclk (unsigned ,unsigned ,int );unsigned imx_set_ioclk (unsigned ); +unsigned imx_set_lcdifclk (unsigned ); +unsigned imx_get_lcdifclk (void );#endif /* ASM_ARCH_CLOCK_IMX23_H */
arch/arm/mach-stm/speed-imx23.c +99 -1
128 lines not on this page · raw message
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/6 i.MX23: Add framebuffer device support
In reply to Juergen Beisert--- arch/arm/mach-stm/include/mach/imx23-regs.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/mach-stm/include/mach/imx23-regs.h +1 -0
@@ -36,6 +36,7 @@#define IMX_CCM_BASE 0x80040000#define IMX_I2C1_BASE 0x80058000#define IMX_SSP1_BASE 0x80010000 +#define IMX_FB_BASE 0x80030000#define IMX_SSP2_BASE 0x80034000#endif /* __ASM_ARCH_MX23_REGS_H */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 6/6 Separate i.MX23 clock handling
In reply to Juergen BeisertSeparate i.MX23 clock handling to simplify the addition of the upcoming i.MX28.
--- arch/arm/mach-stm/include/mach/clock-imx23.h | 36 ++++++++++++++++++++++++++ arch/arm/mach-stm/include/mach/clock.h | 23 ++++------------ 2 files changed, 42 insertions(+), 17 deletions(-) create mode 100644 arch/arm/mach-stm/include/mach/clock-imx23.h
arch/arm/mach-stm/include/mach/clock-imx23.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* (C) Copyright 2010 Juergen Beisert - Pengutronix +* +* 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. +* +* This program is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU General Public License for more details. +* +* You should have received a copy of the GNU General Public License +* along with this program; if not, write to the Free Software +* Foundation, Inc., 59 Temple Place, Suite 330, Boston, +* MA 02111-1307 USA +*/ + +#ifndef ASM_ARCH_CLOCK_IMX23_H +#define ASM_ARCH_CLOCK_IMX23_H + +unsigned imx_get_mpllclk (void ); +unsigned imx_get_emiclk (void ); +unsigned imx_get_ioclk (void ); +unsigned imx_get_armclk (void ); +unsigned imx_get_hclk (void ); +unsigned imx_get_xclk (void ); +unsigned imx_get_sspclk (unsigned ); +unsigned imx_set_sspclk (unsigned ,unsigned ,int ); +unsigned imx_set_ioclk (unsigned ); +unsigned imx_set_lcdifclk (unsigned ); +unsigned imx_get_lcdifclk (void ); + +#endif /* ASM_ARCH_CLOCK_IMX23_H */ +
arch/arm/mach-stm/include/mach/clock.h +6 -17
@@ -1,6 +1,4 @@/* -* (C) Copyright 2010 Juergen Beisert - Pengutronix -* * 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
@@ -17,20 +15,11 @@* MA 02111-1307 USA */ -#ifndef ASM_ARCH_CLOCK_IMX23_H -#define ASM_ARCH_CLOCK_IMX23_H - -unsigned imx_get_mpllclk (void ); -unsigned imx_get_emiclk (void ); -unsigned imx_get_ioclk (void ); -unsigned imx_get_armclk (void ); -unsigned imx_get_hclk (void ); -unsigned imx_get_xclk (void ); -unsigned imx_get_sspclk (unsigned ); -unsigned imx_set_sspclk (unsigned ,unsigned ,int ); -unsigned imx_set_ioclk (unsigned ); -unsigned imx_set_lcdifclk (unsigned ); -unsigned imx_get_lcdifclk (void ); +#ifndef __ASM_MACH_CLOCK_H +#define __ASM_MACH_CLOCK_H -#endif /* ASM_ARCH_CLOCK_IMX23_H */ +#if definedCONFIG_ARCH_IMX23 +# include <mach/clock-imx23.h> +#endif +#endif /* __ASM_MACH_CLOCK_H */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
Quoted 2 lines · Juergen Beisert
Some things to improve the i.MX23 architecture and also some things to prepare it for i.MX28 inclusion.
Ups, forgotten:
The following changes since commit 53dbaf3fc7b8371ed1e24ef96715e41d60b8ebc3:
Merge branch 'master' into next (2010-11-19 09:35:15 +0100)
are available in the git repository at:
http://git.pengutronix.de/git/jbe/for_barebox_next improve_imx23
Juergen Beisert (6):
Remove variable size restrictions in i.MX23's gpio managing routines Simplify test for the max. possible GPIO number.
i.MX23: Add support for the gpio commands
i.MX23: Add pixel clock calculation routine for framebuffer support i.MX23: Add framebuffer device support
Separate i.MX23 clock handling
arch/arm/mach-stm/include/mach/clock-imx23.h | 36 +++++++++ arch/arm/mach-stm/include/mach/clock.h | 21 ++---- arch/arm/mach-stm/include/mach/imx23-regs.h | 1 + arch/arm/mach-stm/iomux-imx23.c | 63 ++++++++++++++-- arch/arm/mach-stm/speed-imx23.c | 100 +++++++++++++++++++++++++- 5 files changed, 197 insertions(+), 24 deletions(-) create mode 100644 arch/arm/mach-stm/include/mach/clock-imx23.h
jbe
Signature · 9 lines
Pengutronix e.K. | Juergen Beisert | Linux Solutions for Science and Industry | Phone: +49-8766-939 228 | Vertretung Sued/Muenchen, Germany | Fax: +49-5121-206917-5555 | Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de/ | _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox