i.MX28 architecture inclusion into barebox
Subsystems (7)
PATCH 1/1 i.MX28 architecture inclusion into barebox
This patch stack adds the new Freescale i.MX28 CPU as a basic implementation to barebox. This new CPU shares most components with the existing i.MX23 (former STM378x), but also some components with the existing IMX. So, this patch stack has to touch i.MX23 related files and also some IMX related ones. As a user of this implementation the stack comes with support for the KARO TX28 CPU card and its evaluation starterkit-5.
The following changes since commit 4f21f1ec978c5cb43a25d1b52a49ff5fe84d4206:
arm: update mach-types (2010-12-10 10:06:18 +0100)
are available in the git repository at:
http://git.pengutronix.de/git/jbe/for_barebox_next/ next_iMX28v4
Juergen Beisert (14):
Make DIV_ROUND_UP macro globally available
Add macro for correct rounding in integer devisions
STM378x: Use Hz as the clock unit like in all other arch
STM378x: Do not configure any pin usage in the driver
STM378x: Parameterize the max. possible GPIO number
STM378x: Separate i.MX23 clock handling
IMX: Ignore i.MX23/i.MX28 related code in shared devices
STM378x: Add i.MX28 architecture
STM378x: Adapt the serial driver to support i.MX23 and i.MX28
STM378x: Adapt the MCI driver to support i.MX23 and i.MX28 Fixup the FEC driver files
MX28: add FEC support
STM378x: Add TX28 CPU module
STM378x: Add the TX28 Starterkit-5 baseboard
Documentation/boards.dox | 1 +
arch/arm/Makefile | 1 +
arch/arm/boards/karo-tx28/Makefile | 2 +
arch/arm/boards/karo-tx28/config.h | 16 +
arch/arm/boards/karo-tx28/env/config | 47 ++
arch/arm/boards/karo-tx28/tx28-stk5.c | 229 +++++++++
arch/arm/boards/karo-tx28/tx28.c | 156 ++++++
arch/arm/configs/tx28stk5_defconfig | 38 ++
arch/arm/mach-imx/include/mach/generic.h | 2 +
arch/arm/mach-stm/Kconfig | 36 ++
arch/arm/mach-stm/Makefile | 5 +-
arch/arm/mach-stm/clocksource-imx28.c | 73 +++
arch/arm/mach-stm/{imx23.c => imx.c} | 0
arch/arm/mach-stm/include/mach/clock-imx23.h | 26 +
arch/arm/mach-stm/include/mach/clock-imx28.h | 29 ++
arch/arm/mach-stm/include/mach/clock.h | 22 +-
arch/arm/mach-stm/include/mach/generic.h | 6 +
arch/arm/mach-stm/include/mach/gpio.h | 3 +
arch/arm/mach-stm/include/mach/imx-regs.h | 9 +
arch/arm/mach-stm/include/mach/imx28-regs.h | 47 ++
arch/arm/mach-stm/include/mach/iomux-imx28.h | 552 ++++++++++++++++++++++
arch/arm/mach-stm/{iomux-imx23.c => iomux-imx.c} | 29 +-
arch/arm/mach-stm/{reset-imx23.c => reset-imx.c} | 0
arch/arm/mach-stm/speed-imx23.c | 52 +-
arch/arm/mach-stm/speed-imx28.c | 392 +++++++++++++++
drivers/mci/Kconfig | 4 +-
drivers/mci/stm378x.c | 141 +++++-
drivers/net/fec_imx.c | 95 +++-
drivers/net/fec_imx.h | 21 +-
drivers/serial/Kconfig | 2 +-
drivers/serial/stm-serial.c | 9 +-
drivers/spi/imx_spi.c | 3 -
include/common.h | 9 +
33 files changed, 1955 insertions(+), 102 deletions(-)
create mode 100644 arch/arm/boards/karo-tx28/Makefile
create mode 100644 arch/arm/boards/karo-tx28/config.h
create mode 100644 arch/arm/boards/karo-tx28/env/config
create mode 100644 arch/arm/boards/karo-tx28/tx28-stk5.c
create mode 100644 arch/arm/boards/karo-tx28/tx28.c
create mode 100644 arch/arm/configs/tx28stk5_defconfig
create mode 100644 arch/arm/mach-stm/clocksource-imx28.c
rename arch/arm/mach-stm/{imx23.c => imx.c} (100%)
create mode 100644 arch/arm/mach-stm/include/mach/clock-imx23.h
create mode 100644 arch/arm/mach-stm/include/mach/clock-imx28.h
create mode 100644 arch/arm/mach-stm/include/mach/imx28-regs.h
create mode 100644 arch/arm/mach-stm/include/mach/iomux-imx28.h
rename arch/arm/mach-stm/{iomux-imx23.c => iomux-imx.c} (82%)
rename arch/arm/mach-stm/{reset-imx23.c => reset-imx.c} (100%)
create mode 100644 arch/arm/mach-stm/speed-imx28.c_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
PATCH 1/14 Make DIV_ROUND_UP macro globally available
--- arch/arm/mach-stm/speed-imx23.c | 3 +-- drivers/spi/imx_spi.c | 3 --- include/common.h | 2 ++ 3 files changed, 3 insertions(+), 5 deletions(-)
arch/arm/mach-stm/speed-imx23.c +1 -2
@@ -244,8 +244,7 @@ unsigned imx_set_sspclk(unsigned index, unsigned nc, int high)printf ("Cannot setup SSP unit clock to %u Hz, base clock is only %u Hz\n" , nc, ssp_div); ssp_div =1U ; }else { - ssp_div += nc -1U ; - ssp_div /= nc; + ssp_div =DIV_ROUND_UP (ssp_div, nc);if (ssp_div >CLKCTRL_SSP_DIV_MASK ) ssp_div =CLKCTRL_SSP_DIV_MASK ; }
drivers/spi/imx_spi.c +0 -3
@@ -224,9 +224,6 @@ static unsigned int cspi_2_3_xchg_single(struct imx_spi *imx, unsigned int data)return readl (base +CSPI_2_3_RXDATA ); } -/* FIXME: include/linux/kernel.h */ -#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) -static unsigned int cspi_2_3_clkdiv (unsigned int fin,unsigned int fspi) {/*
include/common.h +2 -0
@@ -222,4 +222,6 @@ extern const char version_string[];#define IOMEM (addr) ((void __force __iomem *)(addr)) +#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) +#endif /* __COMMON_H_ */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 2/14 Add macro for correct rounding in integer devisions
In reply to Juergen BeisertJust stolen from Linux.
--- drivers/mci/stm378x.c | 2 +- include/common.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletions(-)
drivers/mci/stm378x.c +1 -1
@@ -484,7 +484,7 @@ static unsigned setup_clock_speed(struct device_d *hw_dev, unsigned nc) ssp =imx_get_sspclk (0 ) *1000 ;for (div =2 ; div <255 ; div +=2 ) { - rate = (((ssp + (nc >>1 ) ) / nc) + (div >>1 )) / div; + rate =DIV_ROUND_CLOSEST (DIV_ROUND_CLOSEST (ssp, nc), div);if (rate <=0x100 )break ; }
include/common.h +7 -0
@@ -224,4 +224,11 @@ extern const char version_string[];#define DIV_ROUND_UP (n,d) (((n) + (d) - 1) / (d)) +#define DIV_ROUND_CLOSEST (x, divisor)( \ +{ \ + typeof(divisor) __divisor = divisor; \ + (((x) + ((__divisor) / 2)) / (__divisor)); \ +} \ +) +#endif /* __COMMON_H_ */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 3/14 STM378x: Use Hz as the clock unit like in all other arch
In reply to Juergen Beiserti.MX23 currently uses kHz as the unit for its clock handling and calculation to avoid overflows when calculation with the internal 480 MHz PLL and its fractional divider. This patch changes all routines to accept Hz and deliver Hz as the clock unit.
--- arch/arm/mach-stm/speed-imx23.c | 49 +++++++++++++++++++-------------------- drivers/mci/stm378x.c | 10 ++++---- drivers/serial/stm-serial.c | 2 +- 3 files changed, 30 insertions(+), 31 deletions(-)
arch/arm/mach-stm/speed-imx23.c +24 -25
@@ -29,8 +29,6 @@#include <mach/generic.h> #include <mach/clock.h> -/* Note: all clock frequencies are returned in kHz */ -#define HW_CLKCTRL_PLLCTRL0 0x000#define HW_CLKCTRL_PLLCTRL1 0x010#define HW_CLKCTRL_CPU 0x20
@@ -84,13 +82,13 @@unsigned imx_get_mpllclk (void ) {/* the main PLL runs at 480 MHz */ -return 480U *1000U ; +return 480000000 ; }unsigned imx_get_xtalclk (void ) {/* the external reference runs at 24 MHz */ -return 24U *1000U ; +return 24000000 ; }/* used for the SDRAM controller */
@@ -105,14 +103,15 @@ unsigned imx_get_emiclk(void)if (readl (IMX_CCM_BASE +HW_CLKCTRL_CLKSEQ ) &CLKCTRL_CLKSEQ_BYPASS_EMI )return imx_get_xtalclk () /GET_EMI_XTAL_DIV (readl (IMX_CCM_BASE +HW_CLKCTRL_EMI )); - rate =imx_get_mpllclk (); + rate =imx_get_mpllclk () /1000 ; reg =readl (IMX_CCM_BASE +HW_CLKCTRL_FRAC );if (!(reg &CLKCTRL_FRAC_CLKGATEEMI )) { rate *=18U ; rate /=GET_EMIFRAC (reg); } -return rate /GET_EMI_PLL_DIV (readl (IMX_CCM_BASE +HW_CLKCTRL_EMI )); +return (rate /GET_EMI_PLL_DIV (readl (IMX_CCM_BASE +HW_CLKCTRL_EMI ))) + *1000 ; }/*
@@ -121,7 +120,7 @@ unsigned imx_get_emiclk(void)unsigned imx_get_ioclk (void ) {uint32_t reg; -unsigned rate =imx_get_mpllclk (); +unsigned rate =imx_get_mpllclk () /1000 ; reg =readl (IMX_CCM_BASE +HW_CLKCTRL_FRAC );if (reg &CLKCTRL_FRAC_CLKGATEIO )
@@ -129,12 +128,12 @@ unsigned imx_get_ioclk(void) rate *=18U ; rate /=GET_IOFRAC (reg); -return rate; +return rate *1000 ; }/** * Setup a new frequency to the IOCLK domain. -* @param nc New frequency in [kHz] +* @param nc New frequency in [Hz] * * The FRAC divider for the IOCLK must be between 18 (* 18/18) and 35 (* 18/35) */
@@ -143,10 +142,9 @@ unsigned imx_set_ioclk(unsigned nc)uint32_t reg;unsigned div; - div =imx_get_mpllclk (); - div *=18U ; - div += nc >>1 ; - div /= nc; + nc /=1000 ; + div = (imx_get_mpllclk () /1000 ) *18 ; + div =DIV_ROUND_CLOSEST (div, nc);if (div >0x3f ) div =0x3f ;/* mask the current settings */
@@ -171,24 +169,25 @@ unsigned imx_get_armclk(void)if (reg &CLKCTRL_FRAC_CLKGATECPU )return 0U ;/* should not possible, shouldn't it? */ - rate =imx_get_mpllclk (); + rate =imx_get_mpllclk () /1000 ; rate *=18U ; rate /=GET_CPUFRAC (reg); -return rate /GET_CPU_PLL_DIV (readl (IMX_CCM_BASE +HW_CLKCTRL_CPU )); +return (rate /GET_CPU_PLL_DIV (readl (IMX_CCM_BASE +HW_CLKCTRL_CPU ))) + *1000 ; }/* this is the AHB and APBH bus clock */ unsigned imx_get_hclk (void ) { -unsigned rate =imx_get_armclk (); +unsigned rate =imx_get_armclk () /1000 ;if (readl (IMX_CCM_BASE +HW_CLKCTRL_HBUS ) &0x20 ) { rate *=readl (IMX_CCM_BASE +HW_CLKCTRL_HBUS ) &0x1f ; rate >>=5U ;/* / 32 */ }else rate /=readl (IMX_CCM_BASE +HW_CLKCTRL_HBUS ) &0x1f ; -return rate; +return rate *1000 ; }/*
@@ -219,7 +218,7 @@ unsigned imx_get_sspclk(unsigned index)/** * @param index Unit index (ignored on i.MX23) -* @param nc New frequency in [kHz] +* @param nc New frequency in [Hz] * @param high != 0 if ioclk should be the source * @return The new possible frequency in [kHz] */
@@ -269,11 +268,11 @@ unsigned imx_set_sspclk(unsigned index, unsigned nc, int high)void imx_dump_clocks (void ) { -printf ("mpll: %10u kHz\n" ,imx_get_mpllclk ()); -printf ("arm: %10u kHz\n" ,imx_get_armclk ()); -printf ("ioclk: %10u kHz\n" ,imx_get_ioclk ()); -printf ("emiclk: %10u kHz\n" ,imx_get_emiclk ()); -printf ("hclk: %10u kHz\n" ,imx_get_hclk ()); -printf ("xclk: %10u kHz\n" ,imx_get_xclk ()); -printf ("ssp: %10u kHz\n" ,imx_get_sspclk (0 )); +printf ("mpll: %10u kHz\n" ,imx_get_mpllclk () /1000 ); +printf ("arm: %10u kHz\n" ,imx_get_armclk () /1000 ); +printf ("ioclk: %10u kHz\n" ,imx_get_ioclk () /1000 ); +printf ("emiclk: %10u kHz\n" ,imx_get_emiclk () /1000 ); +printf ("hclk: %10u kHz\n" ,imx_get_hclk () /1000 ); +printf ("xclk: %10u kHz\n" ,imx_get_xclk () /1000 ); +printf ("ssp: %10u kHz\n" ,imx_get_sspclk (0 ) /1000 ); }
drivers/mci/stm378x.c +5 -5
@@ -481,7 +481,7 @@ static unsigned setup_clock_speed(struct device_d *hw_dev, unsigned nc)return 0 ; } - ssp =imx_get_sspclk (0 ) *1000 ; + ssp =imx_get_sspclk (0 );for (div =2 ; div <255 ; div +=2 ) { rate =DIV_ROUND_CLOSEST (DIV_ROUND_CLOSEST (ssp, nc), div);
@@ -658,20 +658,20 @@ static int stm_mci_probe(struct device_d *hw_dev) host->host_caps = pd->caps;if (pd->f_min ==0 ) { - host->f_min =imx_get_sspclk (0 ) /254U /256U *1000U ; + host->f_min =imx_get_sspclk (0 ) /254U /256U ;pr_debug ("Min. frequency is %u Hz\n" , host->f_min); }else { host->f_min = pd->f_min;pr_debug ("Min. frequency is %u Hz, could be %u Hz\n" , - host->f_min,imx_get_sspclk (0 ) /254U /256U *1000U ); + host->f_min,imx_get_sspclk (0 ) /254U /256U ); }if (pd->f_max ==0 ) { - host->f_max =imx_get_sspclk (0 ) /2U /1U *1000U ; + host->f_max =imx_get_sspclk (0 ) /2U /1U ;pr_debug ("Max. frequency is %u Hz\n" , host->f_max); }else { host->f_max = pd->f_max;pr_debug ("Max. frequency is %u Hz, could be %u Hz\n" , - host->f_max,imx_get_sspclk (0 ) /2U /1U *1000U ); + host->f_max,imx_get_sspclk (0 ) /2U /1U ); }#ifdef CONFIG_MCI_INFO
drivers/serial/stm-serial.c +1 -1
@@ -108,7 +108,7 @@ static int stm_serial_setbaudrate(struct console_device *cdev, int new_baudrate)writel (0 , dev->map_base +UARTDBGCR );/* Calculate and set baudrate */ - quot = (imx_get_xclk () *4000 ) / new_baudrate; + quot = (imx_get_xclk () *4 ) / new_baudrate;writel (quot &0x3f , dev->map_base +UARTDBGFBRD );writel (quot >>6 , dev->map_base +UARTDBGIBRD );
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 4/14 STM378x: Do not configure any pin usage in the driver
In reply to Juergen BeisertOnly the platform should configure pins to be used by the driver. The driver must work independently from the settings.
--- drivers/serial/stm-serial.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-)
drivers/serial/stm-serial.c +0 -7
@@ -134,13 +134,6 @@ static int stm_clocksource_clock_change(struct notifier_block *nb, unsigned longstatic int stm_serial_init_port (struct console_device *cdev) {struct device_d *dev = cdev->dev; -/* -* If the board specific file registers this console we should force -* the usage of the debug UART pins, to be able to let the user see -* the output, even if the board file forgets to configure these pins. -*/ -imx_gpio_mode (PWM1_DUART_TX ); -imx_gpio_mode (PWM0_DUART_RX );/* Disable UART */ writel (0 , dev->map_base +UARTDBGCR );
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 5/14 STM378x: Parameterize the max. possible GPIO number
In reply to Juergen BeisertThis is for easier integration of the i.MX28 architecture (to share the code later on).
--- 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 uint32_t calc_mux_reg (uint32_t no) {/* each register controls 16 pads */
@@ -77,7 +79,7 @@ void imx_gpio_mode(unsigned 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 6/14 STM378x: 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 | 26 ++++++++++++++++++++++++++ arch/arm/mach-stm/include/mach/clock.h | 19 ++++++------------- 2 files changed, 32 insertions(+), 13 deletions(-) create mode 100644 arch/arm/mach-stm/include/mach/clock-imx23.h
arch/arm/mach-stm/include/mach/clock-imx23.h new file +26 -0
@@ -0,0 +1,26 @@ +/* +* 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. +*/ + +#ifndef MACH_CLOCK_IMX23_H +# define MACH_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 ); + +#endif /* MACH_CLOCK_IMX23_H */
arch/arm/mach-stm/include/mach/clock.h +6 -13
@@ -17,18 +17,11 @@* MA 02111-1307 USA */ -#ifndef ASM_ARCH_CLOCK_IMX23_H -#define ASM_ARCH_CLOCK_IMX23_H +#ifndef __MACH_CLOCK_H +# define __MACH_CLOCK_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 ); - -#endif /* ASM_ARCH_CLOCK_IMX23_H */ +#if definedCONFIG_ARCH_IMX23 +# include <mach/clock-imx23.h> +#endif +#endif /* __MACH_CLOCK_H */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 7/14 IMX: Ignore i.MX23/i.MX28 related code in shared devices
In reply to Juergen BeisertAt least the FEC and the CAN controller drivers can also be used by the i.MX28. When still used by IMX, the i.MX28 (and maybe i.MX23) related code must be ignored.
--- arch/arm/mach-imx/include/mach/generic.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
arch/arm/mach-imx/include/mach/generic.h +2 -0
@@ -51,3 +51,5 @@ u64 imx_uid(void);#define cpu_is_mx51 () (0)#endif +#define cpu_is_mx23 () (0) +#define cpu_is_mx28 () (0)
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 8/14 STM378x: Add i.MX28 architecture
In reply to Juergen BeisertThe i.MX28 shares a lot of functionality with its predecessor, the i.MX23 (formerly known as stm378x). This patch adds some files to support both CPUs.
--- arch/arm/mach-stm/Kconfig | 4 + arch/arm/mach-stm/Makefile | 5 +- arch/arm/mach-stm/clocksource-imx28.c | 73 ++++ arch/arm/mach-stm/imx.c | 35 ++ arch/arm/mach-stm/imx23.c | 35 -- arch/arm/mach-stm/include/mach/clock-imx28.h | 29 ++ arch/arm/mach-stm/include/mach/clock.h | 3 + arch/arm/mach-stm/include/mach/generic.h | 6 + arch/arm/mach-stm/include/mach/gpio.h | 3 + arch/arm/mach-stm/include/mach/imx-regs.h | 9 + arch/arm/mach-stm/include/mach/imx28-regs.h | 47 +++ arch/arm/mach-stm/include/mach/iomux-imx28.h | 552 ++++++++++++++++++++++++++ arch/arm/mach-stm/iomux-imx.c | 136 +++++++ arch/arm/mach-stm/iomux-imx23.c | 119 ------ arch/arm/mach-stm/reset-imx.c | 61 +++ arch/arm/mach-stm/reset-imx23.c | 61 --- arch/arm/mach-stm/speed-imx28.c | 392 ++++++++++++++++++ 17 files changed, 1353 insertions(+), 217 deletions(-) create mode 100644 arch/arm/mach-stm/clocksource-imx28.c create mode 100644 arch/arm/mach-stm/imx.c delete mode 100644 arch/arm/mach-stm/imx23.c create mode 100644 arch/arm/mach-stm/include/mach/clock-imx28.h create mode 100644 arch/arm/mach-stm/include/mach/imx28-regs.h create mode 100644 arch/arm/mach-stm/include/mach/iomux-imx28.h create mode 100644 arch/arm/mach-stm/iomux-imx.c delete mode 100644 arch/arm/mach-stm/iomux-imx23.c create mode 100644 arch/arm/mach-stm/reset-imx.c delete mode 100644 arch/arm/mach-stm/reset-imx23.c create mode 100644 arch/arm/mach-stm/speed-imx28.c
arch/arm/mach-stm/Kconfig +4 -0
@@ -18,6 +18,10 @@ config ARCH_IMX23 bool "i.MX23" select CPU_ARM926T +config ARCH_IMX28 + bool "i.MX28" + select CPU_ARM926T + endchoice if ARCH_IMX23
arch/arm/mach-stm/Makefile +3 -2
@@ -1,2 +1,3 @@ -obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o imx23.o iomux-imx23.o clocksource-imx23.o reset-imx23.o - +obj-y += imx.o iomux-imx.o reset-imx.o +obj-$(CONFIG_ARCH_IMX23) += speed-imx23.o clocksource-imx23.o +obj-$(CONFIG_ARCH_IMX28) += speed-imx28.o clocksource-imx28.o
arch/arm/mach-stm/clocksource-imx28.c new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-stm/imx.c new file +35 -0
@@ -0,0 +1,35 @@ +/* +* (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 +*/ + +#include <common.h> +#include <command.h> + +extern void imx_dump_clocks (void ); + +static int do_clocks (struct command *cmdtp,int argc,char *argv[]) +{ +imx_dump_clocks (); + +return 0 ; +} + +BAREBOX_CMD_START (dump_clocks) + .cmd = do_clocks, + .usage ="show clock frequencies" , +BAREBOX_CMD_END
arch/arm/mach-stm/imx23.c deleted +0 -35
@@ -1,35 +0,0 @@ -/* -* (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 -*/ - -#include <common.h> -#include <command.h> - -extern void imx_dump_clocks (void ); - -static int do_clocks (struct command *cmdtp,int argc,char *argv[]) -{ -imx_dump_clocks (); - -return 0 ; -} - -BAREBOX_CMD_START (dump_clocks) - .cmd = do_clocks, - .usage ="show clock frequencies" , -BAREBOX_CMD_END
arch/arm/mach-stm/include/mach/clock-imx28.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* 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. +*/ + +#ifndef MACH_CLOCK_IMX28_H +#define MACH_CLOCK_IMX28_H + +unsigned imx_get_mpllclk (void ); +unsigned imx_get_emiclk (void ); +unsigned imx_get_ioclk (unsigned ); +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 ); +unsigned imx_get_fecclk (void ); +void imx_enable_enetclk (void ); + +#endif /* MACH_CLOCK_IMX28_H */ +
arch/arm/mach-stm/include/mach/clock.h +3 -0
@@ -23,5 +23,8 @@#if definedCONFIG_ARCH_IMX23 # include <mach/clock-imx23.h> #endif +#if definedCONFIG_ARCH_IMX28 +# include <mach/clock-imx28.h> +#endif #endif /* __MACH_CLOCK_H */
arch/arm/mach-stm/include/mach/generic.h +6 -0
@@ -22,3 +22,9 @@#else # define cpu_is_mx23 () (0)#endif + +#ifdef CONFIG_ARCH_IMX28 +# define cpu_is_mx28 () (1) +#else +# define cpu_is_mx28 () (0) +#endif
arch/arm/mach-stm/include/mach/gpio.h +3 -0
@@ -23,6 +23,9 @@#if definedCONFIG_ARCH_IMX23 # include <mach/iomux-imx23.h> #endif +#if definedCONFIG_ARCH_IMX28 +# include <mach/iomux-imx28.h> +#endif void imx_gpio_mode (unsigned );
arch/arm/mach-stm/include/mach/imx-regs.h +9 -0
@@ -20,8 +20,17 @@#ifndef _IMX_REGS_H# define _IMX_REGS_H +/* Note: Some registers do not support this bit change feature! */ +#define BIT_SET 0x04 +#define BIT_CLR 0x08 +#define BIT_TGL 0x0C +#if definedCONFIG_ARCH_IMX23 # include <mach/imx23-regs.h> #endif +#if definedCONFIG_ARCH_IMX28 +# include <mach/imx28-regs.h> +#endif +#endif /* _IMX_REGS_H */
arch/arm/mach-stm/include/mach/imx28-regs.h new file +47 -0
47 lines not on this page · raw message
arch/arm/mach-stm/include/mach/iomux-imx28.h new file +552 -0
552 lines not on this page · raw message
arch/arm/mach-stm/iomux-imx.c new file +136 -0
136 lines not on this page · raw message
arch/arm/mach-stm/iomux-imx23.c deleted +0 -119
119 lines not on this page · raw message
arch/arm/mach-stm/reset-imx.c new file +61 -0
61 lines not on this page · raw message
arch/arm/mach-stm/reset-imx23.c deleted +0 -61
61 lines not on this page · raw message
arch/arm/mach-stm/speed-imx28.c new file +392 -0
392 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 9/14 STM378x: Adapt the serial driver to support i.MX23 and i.MX28
In reply to Juergen Beisert--- drivers/serial/Kconfig | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/serial/Kconfig +1 -1
@@ -21,7 +21,7 @@ config DRIVER_SERIAL_IMX config DRIVER_SERIAL_STM378X depends on ARCH_STM default y - bool "i.MX23 serial driver" + bool "i.MX23/i.MX28 serial driver" config DRIVER_SERIAL_NETX depends on ARCH_NETX
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 10/14 STM378x: Adapt the MCI driver to support i.MX23 and i.MX28
In reply to Juergen Beisert--- drivers/mci/Kconfig | 4 +- drivers/mci/stm378x.c | 139 +++++++++++++++++++++++++++++++++++++++++++------ 2 files changed, 124 insertions(+), 19 deletions(-)
drivers/mci/Kconfig +2 -2
@@ -28,11 +28,11 @@ config MCI_INFO comment "--- MCI host drivers ---" config MCI_STM378X - bool "i.MX23" + bool "i.MX23/i.MX28" depends on ARCH_STM help Enable this entry to add support to read and write SD cards on a - i.MX23 based system. + i.MX23/i.MX28 based system. config MCI_S3C bool "S3C"
drivers/mci/stm378x.c +122 -17
216 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 11/14 Fixup the FEC driver files
In reply to Juergen BeisertSome register bits are not defined in the IMX CPUs using this FEC (at least I did not find anything about them in the related datasheets) and they will get (partially) a new meaning in the i.MX28 CPU. So, removing them from the source seems the best way to avoid any accidental usage on i.MX28.
--- drivers/net/fec_imx.c | 3 +-- drivers/net/fec_imx.h | 4 ---- 2 files changed, 1 insertions(+), 6 deletions(-)
drivers/net/fec_imx.c +1 -2
@@ -476,8 +476,7 @@ static int fec_recv(struct eth_device *dev) ievent =readl (fec->regs +FEC_IEVENT );writel (ievent, fec->regs +FEC_IEVENT ); -if (ievent & (FEC_IEVENT_BABT |FEC_IEVENT_XFIFO_ERROR | -FEC_IEVENT_RFIFO_ERROR )) { +if (ievent &FEC_IEVENT_BABT ) {/* BABT, Rx/Tx FIFO errors */ fec_halt (dev);fec_init (dev);
drivers/net/fec_imx.h +0 -4
@@ -73,8 +73,6 @@#define FEC_IEVENT_LATE_COL 0x00200000#define FEC_IEVENT_COL_RETRY_LIM 0x00100000#define FEC_IEVENT_XFIFO_UN 0x00080000 -#define FEC_IEVENT_XFIFO_ERROR 0x00040000 -#define FEC_IEVENT_RFIFO_ERROR 0x00020000#define FEC_IMASK_HBERR 0x80000000#define FEC_IMASK_BABR 0x40000000
@@ -84,8 +82,6 @@#define FEC_IMASK_LATE_COL 0x00200000#define FEC_IMASK_COL_RETRY_LIM 0x00100000#define FEC_IMASK_XFIFO_UN 0x00080000 -#define FEC_IMASK_XFIFO_ERROR 0x00040000 -#define FEC_IMASK_RFIFO_ERROR 0x00020000#define FEC_RCNTRL_MAX_FL_SHIFT 16#define FEC_RCNTRL_LOOP 0x01
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 12/14 MX28: add FEC support
In reply to Juergen BeisertThe i.MX28 comes with an extended ethernet controller (ENET/FEC) which is backwards compatible to the FEC known from other i.MX CPUs. Add a few adaptions to the existing driver to make it work with the MX28 FEC.
--- arch/arm/mach-stm/Kconfig | 1 + drivers/net/fec_imx.c | 92 +++++++++++++++++++++++++++++++++++++------- drivers/net/fec_imx.h | 17 +++++++- 3 files changed, 93 insertions(+), 17 deletions(-)
arch/arm/mach-stm/Kconfig +1 -0
@@ -21,6 +21,7 @@ config ARCH_IMX23 config ARCH_IMX28 bool "i.MX28" select CPU_ARM926T + select ARCH_HAS_FEC_IMX endchoice
drivers/net/fec_imx.c +77 -15
150 lines not on this page · raw message
drivers/net/fec_imx.h +16 -3
@@ -63,8 +63,19 @@#define FEC_MIIGSK_ENR_READY (1 << 2)#define FEC_MIIGSK_ENR_EN (1 << 1) - -#define FEC_IEVENT_HBERR 0x80000000 +#define FEC_R_CNTRL_GRS (1 << 31) +#define FEC_R_CNTRL_NO_LGTH_CHECK (1 << 30) +#ifdef CONFIG_ARCH_IMX28 +# define FEC_R_CNTRL_MAX_FL (x) (((x) & 0x3fff) << 16) +#else +# define FEC_R_CNTRL_MAX_FL (x) (((x) & 0x7ff) << 16) +#endif +#define FEC_R_CNTRL_RMII_10T (1 << 9)/* i.MX28 specific */ +#define FEC_R_CNTRL_RMII_MODE (1 << 8)/* i.MX28 specific */ +#define FEC_R_CNTRL_FCE (1 << 5) +#define FEC_R_CNTRL_MII_MODE (1 << 2) + +#define FEC_IEVENT_HBERR 0x80000000/* Note: Not on i.MX28 */ #define FEC_IEVENT_BABR 0x40000000#define FEC_IEVENT_BABT 0x20000000#define FEC_IEVENT_GRA 0x10000000
@@ -74,7 +85,7 @@#define FEC_IEVENT_COL_RETRY_LIM 0x00100000#define FEC_IEVENT_XFIFO_UN 0x00080000 -#define FEC_IMASK_HBERR 0x80000000 +#define FEC_IMASK_HBERR 0x80000000/* Note: Not on i.MX28 */ #define FEC_IMASK_BABR 0x40000000#define FEC_IMASK_BABT 0x20000000#define FEC_IMASK_GRA 0x10000000
@@ -120,6 +131,8 @@* @brief Receive & Transmit Buffer Descriptor definitions * * Note: The first BD must be aligned (see DB_ALIGNMENT) +* +* BTW: Don't trust the i.MX27 and i.MX28 data sheet */ struct buffer_descriptor {uint16_t data_length;/**< payload's length in bytes */
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 13/14 STM378x: Add TX28 CPU module
In reply to Juergen Beisert--- Documentation/boards.dox | 1 + arch/arm/Makefile | 1 + arch/arm/boards/karo-tx28/Makefile | 1 + arch/arm/boards/karo-tx28/config.h | 16 +++++ arch/arm/boards/karo-tx28/tx28.c | 119 ++++++++++++++++++++++++++++++++++++ arch/arm/mach-stm/Kconfig | 16 +++++ 6 files changed, 154 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boards/karo-tx28/Makefile create mode 100644 arch/arm/boards/karo-tx28/config.h create mode 100644 arch/arm/boards/karo-tx28/tx28.c
Documentation/boards.dox +1 -0
@@ -14,6 +14,7 @@ ARM type: @li @subpage pcm043 @li @subpage imx21ads @li @subpage imx27ads +@li @subpage tx28 @li @subpage the3stack @li @subpage mx23_evk @li @subpage board_babage
arch/arm/Makefile +1 -0
@@ -88,6 +88,7 @@ board-$(CONFIG_MACH_SCB9328) := scb9328 board-$(CONFIG_MACH_NESO) := guf-neso board-$(CONFIG_MACH_MX23EVK) := freescale-mx23-evk board-$(CONFIG_MACH_CHUMBY) := chumby_falconwing +board-$(CONFIG_MACH_TX28) := karo-tx28 board-$(CONFIG_MACH_FREESCALE_MX51_PDK) := freescale-mx51-pdk board-$(CONFIG_MACH_GUF_CUPID) := guf-cupid board-$(CONFIG_MACH_MINI2440) := mini2440
arch/arm/boards/karo-tx28/Makefile new file +1 -0
@@ -0,0 +1 @@ +obj-y += tx28.o
arch/arm/boards/karo-tx28/config.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* 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. +*/ + +#ifndef _CONFIG_H_ +# define _CONFIG_H_ + +#endif /* _CONFIG_H_ */
arch/arm/boards/karo-tx28/tx28.c new file +119 -0
119 lines not on this page · raw message
arch/arm/mach-stm/Kconfig +16 -0
@@ -4,10 +4,12 @@ config ARCH_TEXT_BASE hex default 0x41000000 if MACH_MX23EVK default 0x42000000 if MACH_CHUMBY + default 0x47000000 if MACH_TX28 config BOARDINFO default "Freescale i.MX23-EVK" if MACH_MX23EVK default "Chumby Falconwing" if MACH_CHUMBY + default "Karo TX28" if MACH_TX28 comment "SigmaTel/Freescale i.MX System-on-Chip"
@@ -46,6 +48,20 @@ endchoice endif +if ARCH_IMX28 + +choice + prompt "i.MX28 Board Type" + +config MACH_TX28 + bool "KARO tx28" + help + Say Y here if you are using the KARO TX28 CPU module. + +endchoice + +endif + menu "Board specific settings " endmenu
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox
PATCH 14/14 STM378x: Add the TX28 Starterkit-5 baseboard
In reply to Juergen BeisertThis file is to be used in conjunction with the TX28 CPU module.
--- arch/arm/boards/karo-tx28/Makefile | 1 + arch/arm/boards/karo-tx28/env/config | 47 +++++++ arch/arm/boards/karo-tx28/tx28-stk5.c | 229 +++++++++++++++++++++++++++++++++ arch/arm/boards/karo-tx28/tx28.c | 37 ++++++ arch/arm/configs/tx28stk5_defconfig | 38 ++++++ arch/arm/mach-stm/Kconfig | 15 ++ 6 files changed, 367 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boards/karo-tx28/env/config create mode 100644 arch/arm/boards/karo-tx28/tx28-stk5.c create mode 100644 arch/arm/configs/tx28stk5_defconfig
arch/arm/boards/karo-tx28/Makefile +1 -0
@@ -1 +1,2 @@ obj-y += tx28.o +obj-$(CONFIG_MACH_TX28STK5) += tx28-stk5.o
arch/arm/boards/karo-tx28/env/config new file +47 -0
47 lines not on this page · raw message
arch/arm/boards/karo-tx28/tx28-stk5.c new file +229 -0
229 lines not on this page · raw message
arch/arm/boards/karo-tx28/tx28.c +37 -0
@@ -106,6 +106,8 @@ device_initcall(tx28_devices_init);/** @page tx28 KARO's TX28 CPU module +@section tx28_cpu_card The CPU module +http://www.karo-electronics.de/ This CPU card is based on a Freescale i.MX28 CPU. The card is shipped with:
@@ -116,4 +118,39 @@ This CPU card is based on a Freescale i.MX28 CPU. The card is shipped with:- DS1339 RTC - LAN8710 Phy +@section tx28_basboards Supported baseboards + +Supported baseboards are: +- KARO's Starterkit 5 + +@section tx28_stk5_howto How to get barebox for 'KARO's Starterkit 5' + +Using the default configuration: + +@verbatim +make ARCH=arm tx28stk5_defconfig +@endverbatim + +Build the binary image: + +@verbatim +make ARCH=arm CROSS_COMPILE=armv5compiler +@endverbatim + +@note replace the armv5compiler with your ARM v5 cross compiler. + +@note To use the result, you also need the following resources from Freescale: +- the 'bootlets' archive +- the 'elftosb2' encryption tool +- in the case you want to start @b barebox from an attached SD card the +'sdimage' tool from Freescale's 'uuc' archive. + +@section tx28_mlayout Memory layout when barebox is running: + +- 0x40000000 start of SDRAM +- 0x40000100 start of kernel's boot parameters +- below malloc area: stack area +- below barebox: malloc area +- 0x47000000 start of @b barebox +*/
arch/arm/configs/tx28stk5_defconfig new file +38 -0
@@ -0,0 +1,38 @@ +CONFIG_ARCH_STM=y +CONFIG_ARCH_IMX28=y +CONFIG_AEABI=y +CONFIG_ARM_OPTIMZED_STRING_FUNCTIONS=y +CONFIG_BROKEN=y +CONFIG_LONGHELP=y +CONFIG_CMDLINE_EDITING=y +CONFIG_AUTO_COMPLETE=y +CONFIG_PARTITION=y +CONFIG_DEFAULT_ENVIRONMENT_GENERIC=y +CONFIG_DEFAULT_ENVIRONMENT_PATH="arch/arm/boards/karo-tx28/env" +CONFIG_DEBUG_INFO=y +CONFIG_CMD_EDIT=y +CONFIG_CMD_SLEEP=y +CONFIG_CMD_SAVEENV=y +CONFIG_CMD_LOADENV=y +CONFIG_CMD_EXPORT=y +CONFIG_CMD_PRINTENV=y +CONFIG_CMD_READLINE=y +CONFIG_CMD_ECHO_E=y +CONFIG_CMD_MTEST=y +CONFIG_CMD_MTEST_ALTERNATIVE=y +CONFIG_CMD_BOOTM_ZLIB=y +CONFIG_CMD_BOOTM_BZLIB=y +CONFIG_CMD_BOOTM_SHOW_TYPE=y +CONFIG_CMD_RESET=y +CONFIG_CMD_GO=y +CONFIG_CMD_TIMEOUT=y +CONFIG_CMD_PARTITION=y +CONFIG_NET=y +CONFIG_NET_DHCP=y +CONFIG_NET_TFTP=y +CONFIG_NET_RESOLV=y +CONFIG_DRIVER_NET_FEC_IMX=y +# CONFIG_SPI is not set +CONFIG_MCI=y +CONFIG_MCI_STARTUP=y +CONFIG_MCI_STM378X=y
arch/arm/mach-stm/Kconfig +15 -0
@@ -64,6 +64,21 @@ endif menu "Board specific settings " +if MACH_TX28 + +choice + prompt "TX28 Base Board Type" + +config MACH_TX28STK5 + bool "TX28-stk5" + help + Select this entry if you are running the TX28 CPU module on the + KARO TX28 Starterkit5. + +endchoice + +endif + endmenu endif
Signature · 7 lines
1.7.2.3 _______________________________________________ barebox mailing list [email protected] http://lists.infradead.org/mailman/listinfo/barebox