[PATCH 3/4] ARM: remove ARCH_HAS_LOWLEVEL_INIT
From: Sascha Hauer s.ha...@pengutronix.de This is unused now and not needed. We have a board_init_lowlevel. If a board needs some architecture setup it can always call it from its board_init_lowlevel. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/cpu/start-reset.c |4 arch/arm/include/asm/barebox-arm.h |1 - common/Kconfig |3 --- 3 files changed, 8 deletions(-) diff --git a/arch/arm/cpu/start-reset.c b/arch/arm/cpu/start-reset.c index e0df676..46193ef 100644 --- a/arch/arm/cpu/start-reset.c +++ b/arch/arm/cpu/start-reset.c @@ -40,10 +40,6 @@ void __naked __bare_init reset(void) r |= 0xd3; __asm__ __volatile__(msr cpsr, %0 : : r(r)); -#ifdef CONFIG_ARCH_HAS_LOWLEVEL_INIT - arch_init_lowlevel(); -#endif - /* disable MMU stuff and caches */ r = get_cr(); r = ~(CR_M | CR_C | CR_B | CR_S | CR_R | CR_V); diff --git a/arch/arm/include/asm/barebox-arm.h b/arch/arm/include/asm/barebox-arm.h index b880dd4..2689a04 100644 --- a/arch/arm/include/asm/barebox-arm.h +++ b/arch/arm/include/asm/barebox-arm.h @@ -41,6 +41,5 @@ extern char __ll_return[]; void board_init_lowlevel(void); void board_init_lowlevel_return(void); -void arch_init_lowlevel(void); #endif /* _BAREBOX_ARM_H_ */ diff --git a/common/Kconfig b/common/Kconfig index b97392c..bcc3581 100644 --- a/common/Kconfig +++ b/common/Kconfig @@ -292,9 +292,6 @@ config MACH_DO_LOWLEVEL_INIT on many platforms. Disabling this option allows configurations to use barebox as a second stage boot loader. -config ARCH_HAS_LOWLEVEL_INIT - bool - config PROMPT string prompt barebox command prompt -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 4/4] ARM: give boards control of the reset entry point
On some SoCs (for example AM35xx), the ROM bootloader passes useful information in r0 when jumping to barebox. To avoid overwriting this in the generic reset code, we introduce common_reset as a C function and as an assembler macro. This is then called form the reset entry point (either in common or in board code). This patch is based on code by Sascha Hauer s.ha...@pengutronix.de. Signed-off-by: Jan Luebbe j...@pengutronix.de --- arch/arm/boards/a9m2410/lowlevel_init.S| 17 +++-- arch/arm/boards/a9m2440/lowlevel_init.S| 15 ++--- arch/arm/boards/at91sam9260ek/lowlevel_init.S |9 ++- arch/arm/boards/eukrea_cpuimx25/lowlevel.c |5 +- arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S| 11 ++-- arch/arm/boards/eukrea_cpuimx35/lowlevel.c |5 +- .../boards/freescale-mx25-3-stack/lowlevel_init.S | 11 ++-- .../boards/freescale-mx35-3-stack/lowlevel_init.S | 12 ++-- .../boards/friendlyarm-mini2440/lowlevel_init.S| 18 +++--- arch/arm/boards/friendlyarm-tiny210/lowlevel.c |5 +- arch/arm/boards/guf-cupid/lowlevel.c |7 +- arch/arm/boards/guf-neso/lowlevel.c|6 +- arch/arm/boards/imx21ads/lowlevel_init.S | 12 ++-- arch/arm/boards/imx27ads/lowlevel_init.S | 11 ++-- arch/arm/boards/karo-tx25/lowlevel.c |5 +- arch/arm/boards/netx/platform.S|9 ++- arch/arm/boards/panda/lowlevel.c |7 +- arch/arm/boards/pcm027/lowlevel_init.S | 10 ++- arch/arm/boards/pcm037/lowlevel_init.S | 12 ++-- arch/arm/boards/pcm038/lowlevel.c |5 +- arch/arm/boards/pcm043/lowlevel.c |5 +- arch/arm/boards/pcm049/lowlevel.c |5 +- arch/arm/boards/phycard-a-xl2/lowlevel.c |5 +- arch/arm/boards/phycard-i.MX27/lowlevel_init.S | 12 ++-- arch/arm/boards/scb9328/lowlevel_init.S| 11 ++-- arch/arm/cpu/Makefile |4 +- arch/arm/cpu/start-pbl.c | 12 arch/arm/cpu/start-reset.c | 63 -- arch/arm/cpu/start.c | 12 arch/arm/include/asm/barebox-arm-head.h| 68 arch/arm/include/asm/system.h |4 ++ arch/arm/mach-at91/at91rm9200_lowlevel_init.c |5 +- arch/arm/mach-at91/at91sam926x_lowlevel_init.c |5 +- arch/arm/mach-ep93xx/lowlevel_init.S | 15 ++--- arch/arm/mach-omap/Kconfig |5 +- arch/arm/mach-omap/omap3_core.S|9 ++- 36 files changed, 257 insertions(+), 175 deletions(-) delete mode 100644 arch/arm/cpu/start-reset.c diff --git a/arch/arm/boards/a9m2410/lowlevel_init.S b/arch/arm/boards/a9m2410/lowlevel_init.S index 0463b26..502ecdd 100644 --- a/arch/arm/boards/a9m2410/lowlevel_init.S +++ b/arch/arm/boards/a9m2410/lowlevel_init.S @@ -4,13 +4,14 @@ #include config.h #include mach/s3c-iomap.h +#include asm/barebox-arm-head.h - .section .text_bare_init.board_init_lowlevel,ax + .section .text_bare_init.reset,ax -.globl board_init_lowlevel -board_init_lowlevel: +.globl reset +reset: - mov r10, lr /* save the link register */ + common_reset r0 bl s3c24x0_disable_wd @@ -20,7 +21,7 @@ board_init_lowlevel: cmp pc, #S3C_SDRAM_END bhs 1f - mov pc, r10 + b board_init_lowlevel_return /* we are running from NOR or NAND/SRAM memory. Do further initialisation */ 1: @@ -29,9 +30,7 @@ board_init_lowlevel: bl s3c24x0_sdram_init #ifdef CONFIG_S3C_NAND_BOOT - mov lr, r10 /* restore the link register */ /* up to here we are running from the internal SRAM area */ - b s3c24x0_nand_boot /* does return directly to our caller into SDRAM */ -#else - mov pc, r10 + bl s3c24x0_nand_boot #endif + b board_init_lowlevel_return diff --git a/arch/arm/boards/a9m2440/lowlevel_init.S b/arch/arm/boards/a9m2440/lowlevel_init.S index 305014c..da29efd 100644 --- a/arch/arm/boards/a9m2440/lowlevel_init.S +++ b/arch/arm/boards/a9m2440/lowlevel_init.S @@ -5,8 +5,9 @@ #include config.h #include mach/s3c-iomap.h #include mach/s3c24xx-gpio.h +#include asm/barebox-arm-head.h - .section .text_bare_init.board_init_lowlevel,ax + .section .text_bare_init.reset,ax /* * To be able to setup the SDRAM interface correctly, we need some @@ -211,10 +212,10 @@ SDRAMDATA: /* */ -.globl board_init_lowlevel -board_init_lowlevel: +.globl reset +reset: - mov r10, lr /* save the link register */ + common_reset r0 bl s3c24x0_disable_wd @@ -233,9 +234,7 @@ board_init_lowlevel: bl sdram_init #ifdef
[PATCH 2/2] ARM OMAP: switch to gpiolib support
Signed-off-by: Teresa Gámez t.ga...@phytec.de --- arch/arm/Kconfig |1 + arch/arm/mach-omap/gpio.c | 171 --- arch/arm/mach-omap/omap3_generic.c | 19 arch/arm/mach-omap/omap4_generic.c | 19 4 files changed, 117 insertions(+), 93 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a54ad03..7b7b058 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -58,6 +58,7 @@ config ARCH_NOMADIK config ARCH_OMAP bool TI OMAP select HAS_DEBUG_LL + select GPIOLIB config ARCH_PXA bool Intel/Marvell PXA based diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c index 142cf52..d217550 100644 --- a/arch/arm/mach-omap/gpio.c +++ b/arch/arm/mach-omap/gpio.c @@ -36,11 +36,10 @@ * published by the Free Software Foundation. */ #include common.h -#include mach/gpio.h #include io.h #include errno.h - -#ifdef CONFIG_ARCH_OMAP3 +#include gpio.h +#include init.h #define OMAP_GPIO_OE 0x0034 #define OMAP_GPIO_DATAIN 0x0038 @@ -48,129 +47,115 @@ #define OMAP_GPIO_CLEARDATAOUT 0x0090 #define OMAP_GPIO_SETDATAOUT 0x0094 -static void __iomem *gpio_bank[] = { - (void *)0x4831, - (void *)0x4905, - (void *)0x49052000, - (void *)0x49054000, - (void *)0x49056000, - (void *)0x49058000, -}; -#endif - -#ifdef CONFIG_ARCH_OMAP4 - -#define OMAP_GPIO_OE 0x0134 -#define OMAP_GPIO_DATAIN 0x0138 -#define OMAP_GPIO_DATAOUT 0x013c -#define OMAP_GPIO_CLEARDATAOUT 0x0190 -#define OMAP_GPIO_SETDATAOUT 0x0194 - -static void __iomem *gpio_bank[] = { - (void *)0x4a31, - (void *)0x48055000, - (void *)0x48057000, - (void *)0x48059000, - (void *)0x4805b000, - (void *)0x4805d000, +struct omap_gpio_chip { + void __iomem *base; + struct gpio_chip chip; }; -#endif - -static inline void __iomem *get_gpio_base(int gpio) -{ - return gpio_bank[gpio 5]; -} -static inline int get_gpio_index(int gpio) +static inline int omap_get_gpio_index(int gpio) { return gpio 0x1f; } -static inline int gpio_valid(int gpio) +static void omap_gpio_set_value(struct gpio_chip *chip, + unsigned gpio, int value) { - if (gpio 0) - return -1; - if (gpio / 32 ARRAY_SIZE(gpio_bank)) - return 0; - return -1; -} - -static int check_gpio(int gpio) -{ - if (gpio_valid(gpio) 0) { - printf(ERROR : check_gpio: invalid GPIO %d\n, gpio); - return -1; - } - return 0; -} - -void gpio_set_value(unsigned gpio, int value) -{ - void __iomem *reg; + struct omap_gpio_chip *omapgpio = + container_of(chip, struct omap_gpio_chip, chip); + void __iomem *base = omapgpio-base; u32 l = 0; - if (check_gpio(gpio) 0) - return; - - reg = get_gpio_base(gpio); - if (value) - reg += OMAP_GPIO_SETDATAOUT; + base += OMAP_GPIO_SETDATAOUT; else - reg += OMAP_GPIO_CLEARDATAOUT; - l = 1 get_gpio_index(gpio); + base += OMAP_GPIO_CLEARDATAOUT; + + l = 1 omap_get_gpio_index(gpio); - __raw_writel(l, reg); + writel(l, base); } -int gpio_direction_input(unsigned gpio) +static int omap_gpio_direction_input(struct gpio_chip *chip, + unsigned gpio) { - void __iomem *reg; + struct omap_gpio_chip *omapgpio = + container_of(chip, struct omap_gpio_chip, chip); + void __iomem *base = omapgpio-base; u32 val; - if (check_gpio(gpio) 0) - return -EINVAL; - - reg = get_gpio_base(gpio); - - reg += OMAP_GPIO_OE; + base += OMAP_GPIO_OE; - val = __raw_readl(reg); - val |= 1 get_gpio_index(gpio); - __raw_writel(val, reg); + val = readl(base); + val |= 1 omap_get_gpio_index(gpio); + writel(val, base); return 0; } -int gpio_direction_output(unsigned gpio, int value) +static int omap_gpio_direction_output(struct gpio_chip *chip, + unsigned gpio, int value) { - void __iomem *reg; + struct omap_gpio_chip *omapgpio = + container_of(chip, struct omap_gpio_chip, chip); + void __iomem *base = omapgpio-base; u32 val; - if (check_gpio(gpio) 0) - return -EINVAL; - reg = get_gpio_base(gpio); + omap_gpio_set_value(chip, gpio, value); - gpio_set_value(gpio, value); + base += OMAP_GPIO_OE; - reg += OMAP_GPIO_OE; - - val = __raw_readl(reg); - val = ~(1 get_gpio_index(gpio)); - __raw_writel(val, reg); + val = readl(base); + val = ~(1 omap_get_gpio_index(gpio)); + writel(val, base);
Re: [PATCH 1/2] drivers gpio: Check for negativ gpio values
Am 24.09.2012 11:16, schrieb Jan Lübbe: On Mon, 2012-09-24 at 10:59 +0200, Teresa Gámez wrote: static int gpio_is_valid(unsigned gpio) { - if (gpio ARCH_NR_GPIOS) + if (gpio ARCH_NR_GPIOS gpio = 0) For an 'unsigned gpio', gpio = 0 is always true. Thats true... Ignore this one then. Sorry, forgot to cc mailing list. Teresa Regards, Jan Lübbe ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 0/1 v7] net: introduce phylib
HI, v7: - drop the duplicate platform_data for fec driver as we need to update both with the same data (piss me off) v6: - probe phy at mdiobus_register - reimplement the mdiobuss support v5: - drop edev in mii_device v4: - move phy_dev attachement to eth_device instead of mii_device this will allow multiple phy_device per mii bus - move phy cdev to phy_device - add interface type support (so phy driver can configure themselves if MII/RMII/RGMII etc... - manage link status at framework level - mx6 update to fixup the phy at device opening v3: - fix comment - add phy_driver probe and remove - renambe phydev.h to phy.h and phylib.c to phy.c as in linux please pull The following changes since commit 0b3c3e77945243c262f9ff1275479e6d8ea1d5c3: net: catch error on eth_send (2012-09-16 20:39:07 +0800) are available in the git repository at: git://git.jcrosoft.org/barebox.git tags/net_phylib for you to fetch changes up to aa3e78ab068ca81416d6150fc545b6c5e271dad2: net: introduce phylib (2012-09-24 05:35:20 +0800) net: check error and introduce phylib Adapt phylib from linux This will allow to have - phy drivers - to only connect the phy at then opening of the device - if the phy is not ready or down fail on open Same behaviour as in linux and will allow to share code and simplify porting. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com Jean-Christophe PLAGNIOL-VILLARD (1): net: introduce phylib arch/arm/boards/freescale-mx6-arm2/board.c | 43 ++--- arch/arm/boards/freescale-mx6-sabrelite/board.c | 40 ++-- arch/arm/configs/phycard_a_l1_defconfig |2 +- arch/arm/configs/tx51stk5_defconfig |2 +- arch/ppc/boards/pcm030/pcm030.c |4 +- arch/ppc/mach-mpc5xxx/include/mach/fec.h| 14 -- drivers/net/Kconfig | 30 +-- drivers/net/Makefile|2 +- drivers/net/altera_tse.c| 48 +++-- drivers/net/altera_tse.h|3 +- drivers/net/at91_ether.c| 49 ++--- drivers/net/designware.c| 62 --- drivers/net/dm9k.c | 50 +++-- drivers/net/ep93xx.c| 35 ++-- drivers/net/ep93xx.h|2 +- drivers/net/fec_imx.c | 89 + drivers/net/fec_imx.h |6 +- drivers/net/fec_mpc5200.c | 58 +++--- drivers/net/fec_mpc5200.h |4 +- drivers/net/gianfar.c | 61 +++--- drivers/net/gianfar.h |2 +- drivers/net/ks8851_mll.c| 36 ++-- drivers/net/macb.c | 79 drivers/net/miidev.c| 316 --- drivers/net/netx_eth.c | 26 +-- drivers/net/phy/Kconfig | 17 ++ drivers/net/phy/Makefile|2 + drivers/net/phy/generic.c | 36 drivers/net/phy/mdio_bus.c | 250 + drivers/net/phy/phy.c | 568 drivers/net/smc9.c | 47 ++--- drivers/net/smc911x.c | 37 ++-- drivers/net/usb/Kconfig |4 +- drivers/net/usb/asix.c | 29 ++- drivers/net/usb/smsc95xx.c | 41 ++-- drivers/net/usb/usbnet.c| 11 +- include/fec.h |3 + include/linux/ethtool.h | 114 include/linux/mii.h | 421 ++--- include/linux/phy.h | 266 ++ include/miidev.h| 51 + include/net.h |4 + include/usb/usbnet.h|5 +- net/eth.c |8 +- 44 files changed, 2038 insertions(+), 939 deletions(-) delete mode 100644 arch/ppc/mach-mpc5xxx/include/mach/fec.h delete mode 100644 drivers/net/miidev.c create mode 100644 drivers/net/phy/Kconfig create mode 100644 drivers/net/phy/Makefile create mode 100644 drivers/net/phy/generic.c create mode 100644 drivers/net/phy/mdio_bus.c create mode 100644 drivers/net/phy/phy.c create
Re: [PATCH 1/2] drivers gpio: Check for negativ gpio values
On 11:16 Mon 24 Sep , Jan Lübbe wrote: On Mon, 2012-09-24 at 10:59 +0200, Teresa Gámez wrote: static int gpio_is_valid(unsigned gpio) { - if (gpio ARCH_NR_GPIOS) + if (gpio ARCH_NR_GPIOS gpio = 0) For an 'unsigned gpio', gpio = 0 is always true. unsigned is wrong type gpio need to int Best Regards, J. ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 09/14] ARM i.MX: Add header file for WEIM cs setup
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |1 + arch/arm/boards/imx27ads/imx27ads.c |1 + arch/arm/boards/pcm038/pcm038.c |1 + arch/arm/boards/pcm038/pcm970.c |1 + arch/arm/mach-imx/imx27.c |9 + arch/arm/mach-imx/include/mach/imx27-regs.h | 10 -- arch/arm/mach-imx/include/mach/weim.h |7 +++ 7 files changed, 20 insertions(+), 10 deletions(-) create mode 100644 arch/arm/mach-imx/include/mach/weim.h diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c index 0ffe43f..cff4f77 100644 --- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -37,6 +37,7 @@ #include io.h #include mach/imx-nand.h #include mach/imx-pll.h +#include mach/weim.h #include mach/imxfb.h #include ns16550.h #include asm/mmu.h diff --git a/arch/arm/boards/imx27ads/imx27ads.c b/arch/arm/boards/imx27ads/imx27ads.c index f9416e1..22c6e40 100644 --- a/arch/arm/boards/imx27ads/imx27ads.c +++ b/arch/arm/boards/imx27ads/imx27ads.c @@ -23,6 +23,7 @@ #include io.h #include fec.h #include mach/gpio.h +#include mach/weim.h #include partition.h #include fs.h #include fcntl.h diff --git a/arch/arm/boards/pcm038/pcm038.c b/arch/arm/boards/pcm038/pcm038.c index a51825b..58b1ec9 100644 --- a/arch/arm/boards/pcm038/pcm038.c +++ b/arch/arm/boards/pcm038/pcm038.c @@ -31,6 +31,7 @@ #include io.h #include mach/imx-nand.h #include mach/imx-pll.h +#include mach/weim.h #include mach/imxfb.h #include i2c/i2c.h #include mach/spi.h diff --git a/arch/arm/boards/pcm038/pcm970.c b/arch/arm/boards/pcm038/pcm970.c index d392ea4..b8fc65b 100644 --- a/arch/arm/boards/pcm038/pcm970.c +++ b/arch/arm/boards/pcm038/pcm970.c @@ -18,6 +18,7 @@ #include platform_ide.h #include mach/imx-regs.h #include mach/iomux-mx27.h +#include mach/weim.h #include mach/gpio.h #include mach/devices-imx27.h #include usb/ulpi.h diff --git a/arch/arm/mach-imx/imx27.c b/arch/arm/mach-imx/imx27.c index 76bb910..0c92385 100644 --- a/arch/arm/mach-imx/imx27.c +++ b/arch/arm/mach-imx/imx27.c @@ -13,6 +13,7 @@ #include common.h #include mach/imx-regs.h +#include mach/weim.h #include sizes.h #include init.h #include io.h @@ -22,6 +23,14 @@ int imx_silicon_revision(void) return CID 28; } +void imx27_setup_weimcs(size_t cs, unsigned upper, unsigned lower, + unsigned additional) +{ + writel(upper, MX27_WEIM_BASE_ADDR + (cs * 0x10) + 0x0); + writel(lower, MX27_WEIM_BASE_ADDR + (cs * 0x10) + 0x4); + writel(additional, MX27_WEIM_BASE_ADDR + (cs * 0x10) + 0x8); +} + /* * Initialize MAX on i.MX27. necessary to give the DMA engine * higher priority to the memory than the CPU. Needed for proper diff --git a/arch/arm/mach-imx/include/mach/imx27-regs.h b/arch/arm/mach-imx/include/mach/imx27-regs.h index 6e47b28..5db1a3c 100644 --- a/arch/arm/mach-imx/include/mach/imx27-regs.h +++ b/arch/arm/mach-imx/include/mach/imx27-regs.h @@ -278,14 +278,4 @@ #define ESDCFG_TWTR(1 20) #define ESDCFG_TXP(x) (((x) 0x3) 21) -#ifndef __ASSEMBLY__ -#include io.h -static inline void imx27_setup_weimcs(size_t cs, unsigned upper, unsigned lower, unsigned additional) -{ - writel(upper, MX27_WEIM_BASE_ADDR + (cs * 0x10) + 0x0); - writel(lower, MX27_WEIM_BASE_ADDR + (cs * 0x10) + 0x4); - writel(additional, MX27_WEIM_BASE_ADDR + (cs * 0x10) + 0x4); -} -#endif /* __ASSEMBLY__ */ - #endif /* _IMX27_REGS_H */ diff --git a/arch/arm/mach-imx/include/mach/weim.h b/arch/arm/mach-imx/include/mach/weim.h new file mode 100644 index 000..bc9b51e --- /dev/null +++ b/arch/arm/mach-imx/include/mach/weim.h @@ -0,0 +1,7 @@ +#ifndef __MACH_WEIM_H +#define __MACH_WEIM_H + +void imx27_setup_weimcs(size_t cs, unsigned upper, unsigned lower, + unsigned additional); + +#endif /* __MACH_WEIM_H */ -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH] i.MX register cleanups
The following replaces the register base defines from IMX_ to SoC specific variants. The new names/base address defines are from the Kernel. Sascha Sascha Hauer (14): ARM i.MX31: give register base addresses a proper MX31_ prefix ARM i.MX35: give register base addresses a proper MX35_ prefix ARM i.MX21: give register base addresses a proper MX21_ prefix ARM i.MX1: give register base addresses a proper MX1_ prefix ARM i.MX27: give register base addresses a proper MX27_ prefix ARM i.MX25: give register base addresses a proper MX25_ prefix ARM i.MX/MXS: Allow to include imx*-regs.h directly ARM i.MX51: Use defines rather than hardcoded addresses ARM i.MX: Add header file for WEIM cs setup ARM i.MX1: Add function to setup chipselect ARM i.MX21: Add function to setup chipselect ARM i.MX31: Add function to setup chipselect ARM i.MX35: Add function to setup chipselect ARM i.MX25: Add function to setup chipselect arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 32 +-- arch/arm/boards/eukrea_cpuimx25/lowlevel.c | 32 +-- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |5 +- arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S|4 +- arch/arm/boards/eukrea_cpuimx35/eukrea_cpuimx35.c | 100 - arch/arm/boards/eukrea_cpuimx35/lowlevel.c | 24 +- arch/arm/boards/freescale-mx25-3-stack/3stack.c| 20 +- .../boards/freescale-mx25-3-stack/lowlevel_init.S | 26 +-- arch/arm/boards/freescale-mx35-3-stack/3stack.c| 88 .../boards/freescale-mx35-3-stack/lowlevel_init.S |6 +- arch/arm/boards/guf-cupid/board.c | 80 +++ arch/arm/boards/guf-cupid/lowlevel.c | 28 +-- arch/arm/boards/guf-neso/board.c | 12 +- arch/arm/boards/guf-neso/lowlevel.c|4 +- arch/arm/boards/imx21ads/imx21ads.c| 33 ++- arch/arm/boards/imx21ads/lowlevel_init.S |4 +- arch/arm/boards/imx27ads/imx27ads.c|5 +- arch/arm/boards/karo-tx25/board.c |6 +- arch/arm/boards/karo-tx25/lowlevel.c | 14 +- arch/arm/boards/pcm037/lowlevel_init.S | 42 ++-- arch/arm/boards/pcm037/pcm037.c| 66 +++--- arch/arm/boards/pcm038/lowlevel.c |4 +- arch/arm/boards/pcm038/pcm038.c|1 + arch/arm/boards/pcm038/pcm970.c| 17 +- arch/arm/boards/pcm043/lowlevel.c | 26 +-- arch/arm/boards/pcm043/pcm043.c| 83 --- arch/arm/boards/phycard-i.MX27/lowlevel_init.S |4 +- arch/arm/boards/phycard-i.MX27/pca100.c| 20 +- arch/arm/boards/scb9328/scb9328.c | 19 +- arch/arm/mach-imx/external-nand-boot.c |2 +- arch/arm/mach-imx/imx1.c | 19 +- arch/arm/mach-imx/imx21.c | 24 +- arch/arm/mach-imx/imx25.c | 29 ++- arch/arm/mach-imx/imx27.c | 27 ++- arch/arm/mach-imx/imx31.c | 20 +- arch/arm/mach-imx/imx35.c | 23 +- arch/arm/mach-imx/imx51.c | 10 +- arch/arm/mach-imx/include/mach/devices-imx1.h |4 +- arch/arm/mach-imx/include/mach/devices-imx21.h |8 +- arch/arm/mach-imx/include/mach/devices-imx25.h | 55 - arch/arm/mach-imx/include/mach/devices-imx27.h | 28 +-- arch/arm/mach-imx/include/mach/devices-imx31.h | 34 ++- arch/arm/mach-imx/include/mach/devices-imx35.h | 34 ++- arch/arm/mach-imx/include/mach/imx1-regs.h | 131 +-- arch/arm/mach-imx/include/mach/imx21-regs.h| 173 +-- arch/arm/mach-imx/include/mach/imx25-regs.h| 132 ++- arch/arm/mach-imx/include/mach/imx27-regs.h| 229 arch/arm/mach-imx/include/mach/imx31-regs.h| 217 ++- arch/arm/mach-imx/include/mach/imx35-regs.h| 170 ++- arch/arm/mach-imx/include/mach/weim.h | 20 ++ arch/arm/mach-imx/speed-imx25.c| 22 +- arch/arm/mach-imx/speed-imx31.c|8 +- arch/arm/mach-imx/speed-imx35.c| 30 +-- arch/arm/mach-mxs/include/mach/imx23-regs.h|7 - arch/arm/mach-mxs/include/mach/imx28-regs.h|7 - 55 files changed, 1282 insertions(+), 986 deletions(-) create mode 100644 arch/arm/mach-imx/include/mach/weim.h ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 14/14] ARM i.MX25: Add function to setup chipselect
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/imx25.c |9 + arch/arm/mach-imx/include/mach/imx25-regs.h |6 +- arch/arm/mach-imx/include/mach/weim.h |3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c index 3f44649..32c0412 100644 --- a/arch/arm/mach-imx/imx25.c +++ b/arch/arm/mach-imx/imx25.c @@ -16,8 +16,17 @@ #include mach/imx-regs.h #include mach/iim.h #include io.h +#include mach/weim.h #include sizes.h +void imx25_setup_weimcs(size_t cs, unsigned upper, unsigned lower, + unsigned additional) +{ + writel(upper, MX25_WEIM_BASE_ADDR + (cs * 0x10) + 0x0); + writel(lower, MX25_WEIM_BASE_ADDR + (cs * 0x10) + 0x4); + writel(additional, MX25_WEIM_BASE_ADDR + (cs * 0x10) + 0x8); +} + /* IIM fuse definitions */ #define IIM_BANK0_BASE (MX25_IIM_BASE_ADDR + 0x800) #define IIM_BANK1_BASE (MX25_IIM_BASE_ADDR + 0xc00) diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h index 8e7ff85..0bf6e11 100644 --- a/arch/arm/mach-imx/include/mach/imx25-regs.h +++ b/arch/arm/mach-imx/include/mach/imx25-regs.h @@ -137,11 +137,7 @@ #define MX25_CSD1_BASE_ADDR 0x9000 #define MX25_ESDCTL_BASE_ADDR 0xb8001000 - -#define WEIM_BASE 0xb8002000 -#define CSCR_U(x) (WEIM_BASE + (x) * 0x10) -#define CSCR_L(x) (WEIM_BASE + 4 + (x) * 0x10) -#define CSCR_A(x) (WEIM_BASE + 8 + (x) * 0x10) +#define MX25_WEIM_BASE_ADDR0xb8002000 /* * Watchdog Registers diff --git a/arch/arm/mach-imx/include/mach/weim.h b/arch/arm/mach-imx/include/mach/weim.h index 576f87c..8d572dc 100644 --- a/arch/arm/mach-imx/include/mach/weim.h +++ b/arch/arm/mach-imx/include/mach/weim.h @@ -10,6 +10,9 @@ void imx31_setup_weimcs(size_t cs, unsigned upper, unsigned lower, void imx35_setup_weimcs(size_t cs, unsigned upper, unsigned lower, unsigned additional); +void imx25_setup_weimcs(size_t cs, unsigned upper, unsigned lower, + unsigned additional); + void imx1_setup_eimcs(size_t cs, unsigned upper, unsigned lower); void imx21_setup_eimcs(size_t cs, unsigned upper, unsigned lower); -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 03/14] ARM i.MX21: give register base addresses a proper MX21_ prefix
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/boards/imx21ads/imx21ads.c|6 +- arch/arm/boards/imx21ads/lowlevel_init.S |4 +- arch/arm/mach-imx/imx21.c | 16 +-- arch/arm/mach-imx/include/mach/devices-imx21.h |8 +- arch/arm/mach-imx/include/mach/imx21-regs.h| 179 +++- 5 files changed, 132 insertions(+), 81 deletions(-) diff --git a/arch/arm/boards/imx21ads/imx21ads.c b/arch/arm/boards/imx21ads/imx21ads.c index 1aecf18..42b0162 100644 --- a/arch/arm/boards/imx21ads/imx21ads.c +++ b/arch/arm/boards/imx21ads/imx21ads.c @@ -163,9 +163,11 @@ static int mx21ads_devices_init(void) for (i = 0; i ARRAY_SIZE(mode); i++) imx_gpio_mode(mode[i]); - add_cfi_flash_device(DEVICE_ID_DYNAMIC, 0xC800, 32 * 1024 * 1024, 0); + add_cfi_flash_device(DEVICE_ID_DYNAMIC, MX21_CS0_BASE_ADDR, + 32 * 1024 * 1024, 0); imx21_add_nand(nand_info); - add_generic_device(cs8900, DEVICE_ID_DYNAMIC, NULL, IMX_CS1_BASE, 0x1000, + add_generic_device(cs8900, DEVICE_ID_DYNAMIC, NULL, + MX21_CS1_BASE_ADDR, 0x1000, IORESOURCE_MEM, NULL); imx21_add_fb(imx_fb_data); diff --git a/arch/arm/boards/imx21ads/lowlevel_init.S b/arch/arm/boards/imx21ads/lowlevel_init.S index 961029b..03b62df 100644 --- a/arch/arm/boards/imx21ads/lowlevel_init.S +++ b/arch/arm/boards/imx21ads/lowlevel_init.S @@ -120,8 +120,8 @@ board_init_lowlevel: #ifdef CONFIG_NAND_IMX_BOOT ldr sp, =STACK_BASE + STACK_SIZE - 12 /* Setup a temporary stack in SDRAM */ - ldr r0, =IMX_NFC_BASE /* start of NFC SRAM*/ - ldr r2, =IMX_NFC_BASE + 0x800 /* end of NFC SRAM */ + ldr r0, =MX21_NFC_BASE_ADDR /* start of NFC SRAM*/ + ldr r2, =MX21_NFC_BASE_ADDR + 0x800 /* end of NFC SRAM */ /* skip NAND boot if not running from NFC space */ cmp pc, r0 diff --git a/arch/arm/mach-imx/imx21.c b/arch/arm/mach-imx/imx21.c index df3eaf2..8d909ce 100644 --- a/arch/arm/mach-imx/imx21.c +++ b/arch/arm/mach-imx/imx21.c @@ -25,14 +25,14 @@ int imx_silicon_revision(void) static int imx21_init(void) { - add_generic_device(imx1-gpt, 0, NULL, 0x10003000, 0x100, IORESOURCE_MEM, NULL); - add_generic_device(imx1-gpio, 0, NULL, 0x10015000, 0x100, IORESOURCE_MEM, NULL); - add_generic_device(imx1-gpio, 1, NULL, 0x10015100, 0x100, IORESOURCE_MEM, NULL); - add_generic_device(imx1-gpio, 2, NULL, 0x10015200, 0x100, IORESOURCE_MEM, NULL); - add_generic_device(imx1-gpio, 3, NULL, 0x10015300, 0x100, IORESOURCE_MEM, NULL); - add_generic_device(imx1-gpio, 4, NULL, 0x10015400, 0x100, IORESOURCE_MEM, NULL); - add_generic_device(imx1-gpio, 5, NULL, 0x10015500, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx1-gpt, 0, NULL, MX21_GPT1_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx-gpio, 0, NULL, MX21_GPIO1_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx-gpio, 1, NULL, MX21_GPIO2_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx-gpio, 2, NULL, MX21_GPIO3_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx-gpio, 3, NULL, MX21_GPIO4_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx-gpio, 4, NULL, MX21_GPIO5_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); + add_generic_device(imx-gpio, 5, NULL, MX21_GPIO6_BASE_ADDR, 0x100, IORESOURCE_MEM, NULL); return 0; } -coredevice_initcall(imx21_init); +postcore_initcall(imx21_init); diff --git a/arch/arm/mach-imx/include/mach/devices-imx21.h b/arch/arm/mach-imx/include/mach/devices-imx21.h index 1e1fbbd..31c5f8c 100644 --- a/arch/arm/mach-imx/include/mach/devices-imx21.h +++ b/arch/arm/mach-imx/include/mach/devices-imx21.h @@ -3,22 +3,22 @@ static inline struct device_d *imx21_add_uart0(void) { - return imx_add_uart((void *)IMX_UART1_BASE, 0); + return imx_add_uart((void *)MX21_UART1_BASE_ADDR, 0); } static inline struct device_d *imx21_add_uart1(void) { - return imx_add_uart((void *)IMX_UART2_BASE, 1); + return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 1); } static inline struct device_d *imx21_add_uart2(void) { - return imx_add_uart((void *)IMX_UART3_BASE, 2); + return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 2); } static inline struct device_d *imx21_add_uart3(void) { - return imx_add_uart((void *)IMX_UART4_BASE, 3); + return imx_add_uart((void *)MX21_UART2_BASE_ADDR, 3); } static inline struct device_d *imx21_add_nand(struct imx_nand_platform_data *pdata) diff --git a/arch/arm/mach-imx/include/mach/imx21-regs.h b/arch/arm/mach-imx/include/mach/imx21-regs.h index 98e73ef..e58af72 100644 --- a/arch/arm/mach-imx/include/mach/imx21-regs.h +++
[PATCH 05/14] ARM i.MX27: give register base addresses a proper MX27_ prefix
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c |4 +- arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S |4 +- arch/arm/boards/guf-neso/board.c | 12 +- arch/arm/boards/guf-neso/lowlevel.c |4 +- arch/arm/boards/imx27ads/imx27ads.c |4 +- arch/arm/boards/pcm038/lowlevel.c |4 +- arch/arm/boards/pcm038/pcm970.c | 16 +- arch/arm/boards/phycard-i.MX27/lowlevel_init.S|4 +- arch/arm/boards/phycard-i.MX27/pca100.c | 20 +- arch/arm/mach-imx/external-nand-boot.c|2 +- arch/arm/mach-imx/imx27.c | 18 +- arch/arm/mach-imx/include/mach/devices-imx27.h| 28 +-- arch/arm/mach-imx/include/mach/imx27-regs.h | 225 + 13 files changed, 199 insertions(+), 146 deletions(-) diff --git a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c index 068cc11..0ffe43f 100644 --- a/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c +++ b/arch/arm/boards/eukrea_cpuimx27/eukrea_cpuimx27.c @@ -223,13 +223,13 @@ device_initcall(eukrea_cpuimx27_devices_init); static int eukrea_cpuimx27_console_init(void) { #ifdef CONFIG_DRIVER_SERIAL_IMX - imx_add_uart((void *)IMX_UART1_BASE, DEVICE_ID_DYNAMIC); + imx27_add_uart0(); #endif /* configure 8 bit UART on cs3 */ FMCR = ~0x2; imx27_setup_weimcs(3, 0xD603, 0x0D1D0D01, 0x00D2); #ifdef CONFIG_DRIVER_SERIAL_NS16550 - add_ns16550_device(DEVICE_ID_DYNAMIC, IMX_CS3_BASE + QUART_OFFSET, 0xf, + add_ns16550_device(DEVICE_ID_DYNAMIC, MX27_CS3_BASE_ADDR + QUART_OFFSET, 0xf, IORESOURCE_MEM_16BIT, quad_uart_serial_plat); #endif return 0; diff --git a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S index 0dae3ec..4db5765 100644 --- a/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S +++ b/arch/arm/boards/eukrea_cpuimx27/lowlevel_init.S @@ -110,8 +110,8 @@ board_init_lowlevel: #ifdef CONFIG_NAND_IMX_BOOT ldr sp, =STACK_BASE + STACK_SIZE - 12 /* Setup a temporary stack in SDRAM */ - ldr r0, =IMX_NFC_BASE /* start of NFC SRAM */ - ldr r2, =IMX_NFC_BASE + 0x1000 /* end of NFC SRAM */ + ldr r0, =MX27_NFC_BASE_ADDR /* start of NFC SRAM */ + ldr r2, =MX27_NFC_BASE_ADDR + 0x1000/* end of NFC SRAM */ /* skip NAND boot if not running from NFC space */ cmp pc, r0 diff --git a/arch/arm/boards/guf-neso/board.c b/arch/arm/boards/guf-neso/board.c index 7f25a11..7adee92 100644 --- a/arch/arm/boards/guf-neso/board.c +++ b/arch/arm/boards/guf-neso/board.c @@ -115,21 +115,21 @@ static void neso_usbh_init(void) { uint32_t temp; - temp = readl(IMX_OTG_BASE + 0x600); + temp = readl(MX27_USB_OTG_BASE_ADDR + 0x600); temp = ~((3 21) | 1); temp |= (1 5) | (1 16) | (1 19) | (1 20) | (111); - writel(temp, IMX_OTG_BASE + 0x600); + writel(temp, MX27_USB_OTG_BASE_ADDR + 0x600); - temp = readl(IMX_OTG_BASE + 0x584); + temp = readl(MX27_USB_OTG_BASE_ADDR + 0x584); temp = ~(3 30); temp |= 2 30; - writel(temp, IMX_OTG_BASE + 0x584); + writel(temp, MX27_USB_OTG_BASE_ADDR + 0x584); mdelay(10); gpio_set_value(USBH2_PHY_CS_GPIO, 0); mdelay(10); - ulpi_setup((void *)(IMX_OTG_BASE + 0x570), 1); + ulpi_setup((void *)(MX27_USB_OTG_BASE_ADDR + 0x570), 1); } #endif @@ -276,7 +276,7 @@ static int neso_devices_init(void) #ifdef CONFIG_USB neso_usbh_init(); - add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_OTG_BASE + 0x400, NULL); + add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, MX27_USB_OTG_BASE_ADDR + 0x400, NULL); #endif imx27_add_fec(fec_info); diff --git a/arch/arm/boards/guf-neso/lowlevel.c b/arch/arm/boards/guf-neso/lowlevel.c index e6059fe..3a78054 100644 --- a/arch/arm/boards/guf-neso/lowlevel.c +++ b/arch/arm/boards/guf-neso/lowlevel.c @@ -97,10 +97,10 @@ void __bare_init __naked board_init_lowlevel(void) #ifdef CONFIG_NAND_IMX_BOOT /* skip NAND boot if not running from NFC space */ r = get_pc(); - if (r IMX_NFC_BASE || r IMX_NFC_BASE + 0x800) + if (r MX27_NFC_BASE_ADDR || r MX27_NFC_BASE_ADDR + 0x800) board_init_lowlevel_return(); - src = (unsigned int *)IMX_NFC_BASE; + src = (unsigned int *)MX27_NFC_BASE_ADDR; trg = (unsigned int *)_text; /* Move ourselves out of NFC SRAM */ diff --git a/arch/arm/boards/imx27ads/imx27ads.c b/arch/arm/boards/imx27ads/imx27ads.c index 0a9074d..f9416e1 100644 --- a/arch/arm/boards/imx27ads/imx27ads.c +++
[PATCH 06/14] ARM i.MX25: give register base addresses a proper MX25_ prefix
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c | 32 ++--- arch/arm/boards/eukrea_cpuimx25/lowlevel.c | 32 ++--- arch/arm/boards/freescale-mx25-3-stack/3stack.c| 20 ++-- .../boards/freescale-mx25-3-stack/lowlevel_init.S | 26 ++--- arch/arm/boards/karo-tx25/board.c |6 +- arch/arm/boards/karo-tx25/lowlevel.c | 14 +-- arch/arm/mach-imx/imx25.c | 20 +++- arch/arm/mach-imx/include/mach/devices-imx25.h | 55 +++-- arch/arm/mach-imx/include/mach/imx25-regs.h| 123 +--- arch/arm/mach-imx/speed-imx25.c| 22 ++-- 10 files changed, 217 insertions(+), 133 deletions(-) diff --git a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c index 4dc5501..bf3cbc3 100644 --- a/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c +++ b/arch/arm/boards/eukrea_cpuimx25/eukrea_cpuimx25.c @@ -93,21 +93,21 @@ static void imx25_usb_init(void) unsigned int tmp; /* Host 1 */ - tmp = readl(IMX_OTG_BASE + 0x600); + tmp = readl(MX25_USB_OTG_BASE_ADDR + 0x600); tmp = ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_TLL_BIT | MX35_H1_USBTE_BIT | MX35_H1_IPPUE_DOWN_BIT | MX35_H1_IPPUE_UP_BIT); tmp |= (MXC_EHCI_INTERFACE_SINGLE_UNI) MX35_H1_SIC_SHIFT; tmp |= MX35_H1_USBTE_BIT; tmp |= MX35_H1_IPPUE_DOWN_BIT; - writel(tmp, IMX_OTG_BASE + 0x600); + writel(tmp, MX25_USB_OTG_BASE_ADDR + 0x600); - tmp = readl(IMX_OTG_BASE + 0x584); + tmp = readl(MX25_USB_OTG_BASE_ADDR + 0x584); tmp |= 3 30; - writel(tmp, IMX_OTG_BASE + 0x584); + writel(tmp, MX25_USB_OTG_BASE_ADDR + 0x584); /* Set to Host mode */ - tmp = readl(IMX_OTG_BASE + 0x5a8); - writel(tmp | 0x3, IMX_OTG_BASE + 0x5a8); + tmp = readl(MX25_USB_OTG_BASE_ADDR + 0x5a8); + writel(tmp | 0x3, MX25_USB_OTG_BASE_ADDR + 0x5a8); } #endif @@ -119,7 +119,7 @@ static struct fsl_usb2_platform_data usb_pdata = { static int eukrea_cpuimx25_mem_init(void) { - arm_add_mem_device(ram0, IMX_SDRAM_CS0, 64 * 1024 * 1024); + arm_add_mem_device(ram0, MX25_CSD0_BASE_ADDR, 64 * 1024 * 1024); return 0; } @@ -219,12 +219,12 @@ static int eukrea_cpuimx25_devices_init(void) #ifdef CONFIG_USB imx25_usb_init(); - add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, IMX_OTG_BASE + 0x400, NULL); + add_generic_usb_ehci_device(DEVICE_ID_DYNAMIC, MX25_USB_OTG_BASE_ADDR + 0x400, NULL); #endif #ifdef CONFIG_USB_GADGET /* Workaround ENGcm09152 */ - writel(readl(IMX_OTG_BASE + 0x608) | (1 23), IMX_OTG_BASE + 0x608); - add_generic_device(fsl-udc, DEVICE_ID_DYNAMIC, NULL, IMX_OTG_BASE, 0x200, + writel(readl(MX25_USB_OTG_BASE_ADDR + 0x608) | (1 23), MX25_USB_OTG_BASE_ADDR + 0x608); + add_generic_device(fsl-udc, DEVICE_ID_DYNAMIC, NULL, MX25_USB_OTG_BASE_ADDR, 0x200, IORESOURCE_MEM, usb_pdata); #endif @@ -253,13 +253,13 @@ void __bare_init nand_boot(void) static int eukrea_cpuimx25_core_init(void) { /* enable UART1, FEC, SDHC, USB I2C clock */ - writel(readl(IMX_CCM_BASE + CCM_CGCR0) | (1 6) | (1 23) + writel(readl(MX25_CCM_BASE_ADDR + CCM_CGCR0) | (1 6) | (1 23) | (1 15) | (1 21) | (1 3) | (1 28), - IMX_CCM_BASE + CCM_CGCR0); - writel(readl(IMX_CCM_BASE + CCM_CGCR1) | (1 23) | (1 15) - | (1 13), IMX_CCM_BASE + CCM_CGCR1); - writel(readl(IMX_CCM_BASE + CCM_CGCR2) | (1 14), - IMX_CCM_BASE + CCM_CGCR2); + MX25_CCM_BASE_ADDR + CCM_CGCR0); + writel(readl(MX25_CCM_BASE_ADDR + CCM_CGCR1) | (1 23) | (1 15) + | (1 13), MX25_CCM_BASE_ADDR + CCM_CGCR1); + writel(readl(MX25_CCM_BASE_ADDR + CCM_CGCR2) | (1 14), + MX25_CCM_BASE_ADDR + CCM_CGCR2); return 0; } diff --git a/arch/arm/boards/eukrea_cpuimx25/lowlevel.c b/arch/arm/boards/eukrea_cpuimx25/lowlevel.c index 9c1b4f8..feddacc 100644 --- a/arch/arm/boards/eukrea_cpuimx25/lowlevel.c +++ b/arch/arm/boards/eukrea_cpuimx25/lowlevel.c @@ -54,20 +54,20 @@ void __bare_init __naked board_init_lowlevel(void) register uint32_t loops = 0x2; /* restart the MPLL and wait until it's stable */ - writel(readl(IMX_CCM_BASE + CCM_CCTL) | (1 27), - IMX_CCM_BASE + CCM_CCTL); - while (readl(IMX_CCM_BASE + CCM_CCTL) (1 27)) {}; + writel(readl(MX25_CCM_BASE_ADDR + CCM_CCTL) | (1 27), + MX25_CCM_BASE_ADDR + CCM_CCTL); + while (readl(MX25_CCM_BASE_ADDR + CCM_CCTL) (1 27)) {}; /* Configure dividers and ARM clock source * ARM @ 400 MHz * AHB @ 133 MHz
[PATCH 04/23] commands: Add clk commands
This adds some basic commands to manupulate clocks on the command line. Right now we have: - clk_set_parent - clk_set_rate - clk_enable - clk_disable - clk_dump The commands work based on the clock name, otherwise they behave like the Linux Kernel C functions. clk_dump will dump the clocktree to the console. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- commands/Kconfig |8 commands/Makefile |1 + commands/clk.c| 133 + 3 files changed, 142 insertions(+) create mode 100644 commands/clk.c diff --git a/commands/Kconfig b/commands/Kconfig index 930a9b1..7969937 100644 --- a/commands/Kconfig +++ b/commands/Kconfig @@ -605,6 +605,14 @@ config CMD_USB help The usb command allows to rescan for USB devices. +config CMD_CLK + tristate + depends on COMMON_CLK + prompt clock manipulation commands + help + Say yes here to get clk_set_rate, clk_set_parent and clk_dump + commands to manipulate clocks on your system. + menuconfig CMD_WD bool depends on WATCHDOG diff --git a/commands/Makefile b/commands/Makefile index 24bf46a..7a36f60 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -74,3 +74,4 @@ obj-$(CONFIG_CMD_BASENAME)+= basename.o obj-$(CONFIG_CMD_DIRNAME) += dirname.o obj-$(CONFIG_CMD_READLINK) += readlink.o obj-$(CONFIG_CMD_LN) += ln.o +obj-$(CONFIG_CMD_CLK) += clk.o diff --git a/commands/clk.c b/commands/clk.c new file mode 100644 index 000..5cde3ca --- /dev/null +++ b/commands/clk.c @@ -0,0 +1,133 @@ +#include common.h +#include command.h +#include getopt.h +#include linux/clk.h +#include linux/err.h + +static int do_clk_enable(int argc, char *argv[]) +{ + struct clk *clk; + + if (argc != 2) + return COMMAND_ERROR_USAGE; + + clk = clk_lookup(argv[1]); + + return clk_enable(clk); +} + +BAREBOX_CMD_HELP_START(clk_enable) +BAREBOX_CMD_HELP_USAGE(clk_enable clk\n) +BAREBOX_CMD_HELP_SHORT(enable clk\n) +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(clk_enable) + .cmd= do_clk_enable, + .usage = enable a clock, + BAREBOX_CMD_HELP(cmd_clk_enable_help) +BAREBOX_CMD_END + +static int do_clk_disable(int argc, char *argv[]) +{ + struct clk *clk; + + if (argc != 2) + return COMMAND_ERROR_USAGE; + + clk = clk_lookup(argv[1]); + + clk_disable(clk); + + return 0; +} + +BAREBOX_CMD_HELP_START(clk_disable) +BAREBOX_CMD_HELP_USAGE(clk_disable clk\n) +BAREBOX_CMD_HELP_SHORT(disable clk\n) +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(clk_disable) + .cmd= do_clk_disable, + .usage = disable a clock, + BAREBOX_CMD_HELP(cmd_clk_disable_help) +BAREBOX_CMD_END + +static int do_clk_set_rate(int argc, char *argv[]) +{ + struct clk *clk; + unsigned long rate; + + if (argc != 3) + return COMMAND_ERROR_USAGE; + + clk = clk_lookup(argv[1]); + rate = simple_strtoul(argv[2], NULL, 0); + + return clk_set_rate(clk, rate); +} + +BAREBOX_CMD_HELP_START(clk_set_rate) +BAREBOX_CMD_HELP_USAGE(clk_set_rate clk rate_hz\n) +BAREBOX_CMD_HELP_SHORT(Set clock clk to rate\n) +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(clk_set_rate) + .cmd= do_clk_set_rate, + .usage = set a clocks rate, + BAREBOX_CMD_HELP(cmd_clk_set_rate_help) +BAREBOX_CMD_END + +static int do_clk_dump(int argc, char *argv[]) +{ + int opt, verbose = 0; + + while ((opt = getopt(argc, argv, v)) 0) { + switch(opt) { + case 'v': + verbose = 1; + break; + default: + return -EINVAL; + + } + } + + clk_dump(verbose); + + return 0; +} + +BAREBOX_CMD_HELP_START(clk_dump) +BAREBOX_CMD_HELP_USAGE(clk_dump [-v]\n) +BAREBOX_CMD_HELP_OPT (-v, verbose\n) +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(clk_dump) + .cmd= do_clk_dump, + .usage = show information about registered clocks, + BAREBOX_CMD_HELP(cmd_clk_dump_help) +BAREBOX_CMD_END + +static int do_clk_set_parent(int argc, char *argv[]) +{ + struct clk *clk, *parent; + + if (argc != 3) + return COMMAND_ERROR_USAGE; + + clk = clk_lookup(argv[1]); + parent = clk_lookup(argv[2]); + + return clk_set_parent(clk, parent); +} + +BAREBOX_CMD_HELP_START(clk_set_parent) +BAREBOX_CMD_HELP_USAGE(clk_set_parent clk parent\n) +BAREBOX_CMD_HELP_SHORT(Set parent of clk to parent\n) +BAREBOX_CMD_HELP_END + +BAREBOX_CMD_START(clk_set_parent) + .cmd= do_clk_set_parent, + .usage = set a parent of a clock, + BAREBOX_CMD_HELP(cmd_clk_set_parent_help) +BAREBOX_CMD_END -- 1.7.10.4 ___ barebox mailing list
[PATCH 21/23] video i.MX: Switch to clock support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/video/imx.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/video/imx.c b/drivers/video/imx.c index 452e558..810d8e3 100644 --- a/drivers/video/imx.c +++ b/drivers/video/imx.c @@ -22,6 +22,8 @@ #include malloc.h #include errno.h #include init.h +#include linux/clk.h +#include linux/err.h #include mach/imx-regs.h #include asm-generic/div64.h #include mach/clock.h @@ -138,6 +140,7 @@ struct imxfb_rgb { struct imxfb_info { void __iomem*regs; + struct clk *clk; u_int pcr; u_int pwmr; @@ -341,7 +344,7 @@ static int imxfb_activate_var(struct fb_info *info) writel(readl(fbi-regs + LCDC_CPOS) ~(CPOS_CC0 | CPOS_CC1), fbi-regs + LCDC_CPOS); - lcd_clk = imx_get_lcdclk(); + lcd_clk = clk_get_rate(fbi-clk); tmp = mode-pixclock * (unsigned long long)lcd_clk; @@ -564,6 +567,10 @@ static int imxfb_probe(struct device_d *dev) fbi = xzalloc(sizeof(*fbi)); info = fbi-info; + fbi-clk = clk_get(dev, NULL); + if (IS_ERR(fbi-clk)) + return PTR_ERR(fbi-clk); + fbi-mode = pdata-mode; fbi-regs = dev_request_mem_region(dev, 0); fbi-pcr = pdata-mode-pcr; -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 10/23] ARM i.MX31: Switch to common clk
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Makefile|2 +- arch/arm/mach-imx/clk-imx31.c | 133 + arch/arm/mach-imx/imx31.c |3 +- 3 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/clk-imx31.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 994159d..db203e8 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -4,7 +4,7 @@ obj-$(CONFIG_ARCH_IMX1) += speed-imx1.o imx1.o iomux-v1.o clk-imx1.o obj-$(CONFIG_ARCH_IMX25) += speed-imx25.o imx25.o iomux-v3.o clk-imx25.o obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o imx21.o iomux-v1.o obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o clk-imx27.o -obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o +obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o clk-imx31.o obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o clk-imx5.o obj-$(CONFIG_ARCH_IMX53) += speed-imx53.o imx53.o iomux-v3.o imx5.o clk-imx5.o diff --git a/arch/arm/mach-imx/clk-imx31.c b/arch/arm/mach-imx/clk-imx31.c new file mode 100644 index 000..6c181a1 --- /dev/null +++ b/arch/arm/mach-imx/clk-imx31.c @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2012 Sascha Hauer ker...@pengutronix.de + * + * 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. + */ + +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include mach/imx31-regs.h + +#include clk.h + +/* Register addresses */ +#define CCM_CCMR 0x00 +#define CCM_PDR0 0x04 +#define CCM_PDR1 0x08 +//#define CCM_RCSR 0x0C +#define CCM_MPCTL 0x10 +#define CCM_UPCTL 0x14 +#define CCM_SRPCTL 0x18 +#define CCM_COSR 0x1C +#define CCM_CGR0 0x20 +#define CCM_CGR1 0x24 +#define CCM_CGR2 0x28 +#define CCM_WIMR 0x2C +#define CCM_LDC0x30 +#define CCM_DCVR0 0x34 +#define CCM_DCVR1 0x38 +#define CCM_DCVR2 0x3C +#define CCM_DCVR3 0x40 +#define CCM_LTR0 0x44 +#define CCM_LTR1 0x48 +#define CCM_LTR2 0x4C +#define CCM_LTR3 0x50 +#define CCM_LTBR0 0x54 +#define CCM_LTBR1 0x58 +#define CCM_PMCR0 0x5C +#define CCM_PMCR1 0x60 +#define CCM_PDR2 0x64 + +enum mx31_clks { + ckih, ckil, mpll, spll, upll, mcu_main, hsp, ahb, nfc, ipg, per_div, + per, csi, fir, csi_div, usb_div_pre, usb_div_post, fir_div_pre, + fir_div_post, sdhc1_gate, sdhc2_gate, gpt_gate, epit1_gate, epit2_gate, + iim_gate, ata_gate, sdma_gate, cspi3_gate, rng_gate, uart1_gate, + uart2_gate, ssi1_gate, i2c1_gate, i2c2_gate, i2c3_gate, hantro_gate, + mstick1_gate, mstick2_gate, csi_gate, rtc_gate, wdog_gate, pwm_gate, + sim_gate, ect_gate, usb_gate, kpp_gate, ipu_gate, uart3_gate, + uart4_gate, uart5_gate, owire_gate, ssi2_gate, cspi1_gate, cspi2_gate, + gacc_gate, emi_gate, rtic_gate, firi_gate, clk_max +}; + +static struct clk *clks[clk_max]; + +static const char *mcu_main_sel[] = { + spll, + mpll, +}; + +static const char *per_sel[] = { + per_div, + ipg, +}; + +static int imx31_ccm_probe(struct device_d *dev) +{ + void __iomem *base; + + base = dev_request_mem_region(dev, 0); + + writel(0x, base + CCM_CGR0); + writel(0x, base + CCM_CGR1); + writel(0x, base + CCM_CGR2); + + clks[ckih] = clk_fixed(ckih, 2600); + clks[ckil] = clk_fixed(ckil, 32768); + clks[mpll] = imx_clk_pllv1(mpll, ckih, base + CCM_MPCTL); + clks[spll] = imx_clk_pllv1(spll, ckih, base + CCM_SRPCTL); + clks[upll] = imx_clk_pllv1(upll, ckih, base + CCM_UPCTL); + clks[mcu_main] = imx_clk_mux(mcu_main, base + CCM_PMCR0, 31, 1, + mcu_main_sel, ARRAY_SIZE(mcu_main_sel)); + clks[hsp] = imx_clk_divider(hsp, mcu_main, base + CCM_PDR0, 11, 3); + clks[ahb] = imx_clk_divider(ahb, mcu_main, base + CCM_PDR0, 3, 3); + clks[nfc] = imx_clk_divider(nfc,
[PATCH 06/23] ARM i.MX27: implement clk support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/Kconfig |2 + arch/arm/mach-imx/Makefile|2 +- arch/arm/mach-imx/clk-imx27.c | 154 + arch/arm/mach-imx/imx27.c |4 +- 4 files changed, 160 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/clk-imx27.c diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a54ad03..1cb56c5 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -40,6 +40,8 @@ config ARCH_IMX bool Freescale iMX-based select GENERIC_GPIO select GPIOLIB + select COMMON_CLK + select CLKDEV_LOOKUP config ARCH_MXS bool Freescale i.MX23/28 (mxs) based diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index f6d487f..74e08ad 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -3,7 +3,7 @@ obj-$(CONFIG_RESET_SOURCE) += reset_source.o obj-$(CONFIG_ARCH_IMX1) += speed-imx1.o imx1.o iomux-v1.o obj-$(CONFIG_ARCH_IMX25) += speed-imx25.o imx25.o iomux-v3.o obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o imx21.o iomux-v1.o -obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o +obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o clk-imx27.o obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o diff --git a/arch/arm/mach-imx/clk-imx27.c b/arch/arm/mach-imx/clk-imx27.c new file mode 100644 index 000..74a3495 --- /dev/null +++ b/arch/arm/mach-imx/clk-imx27.c @@ -0,0 +1,154 @@ +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include mach/imx27-regs.h +#include mach/generic.h + +#include clk.h + +/* Register offsets */ +#define CCM_CSCR 0x0 +#define CCM_MPCTL0 0x4 +#define CCM_MPCTL1 0x8 +#define CCM_SPCTL0 0xc +#define CCM_SPCTL1 0x10 +#define CCM_OSC26MCTL 0x14 +#define CCM_PCDR0 0x18 +#define CCM_PCDR1 0x1c +#define CCM_PCCR0 0x20 +#define CCM_PCCR1 0x24 +#define CCM_CCSR 0x28 +#define CCM_PMCTL 0x2c +#define CCM_PMCOUNT0x30 +#define CCM_WKGDCTL0x34 + +enum mx27_clks { + dummy, ckih, ckil, mpll, spll, mpll_main2, ahb, ipg, nfc_div, per1_div, + per2_div, per3_div, per4_div, usb_div, cpu_sel, clko_sel, cpu_div, clko_div, + clko_en, clk_max +}; + +static struct clk *clks[clk_max]; + +static const char *cpu_sel_clks[] = { + mpll_main2, + mpll, +}; + +static const char *clko_sel_clks[] = { + ckil, + NULL, + ckih, + ckih, + ckih, + mpll, + spll, + cpu_div, + ahb, + ipg, + per1_div, + per2_div, + per3_div, + per4_div, + NULL, + NULL, + nfc_div, + NULL, + NULL, + NULL, + ckil, + usb_div, + NULL, +}; + +static int imx27_ccm_probe(struct device_d *dev) +{ + void __iomem *base; + + base = dev_request_mem_region(dev, 0); + + writel(PCCR0_SDHC3_EN | PCCR0_SDHC2_EN | PCCR0_SDHC1_EN | + PCCR0_PWM_EN | PCCR0_KPP_EN | PCCR0_IIM_EN | PCCR0_I2C2_EN | + PCCR0_I2C1_EN | PCCR0_GPT6_EN | PCCR0_GPT5_EN | PCCR0_GPT4_EN | + PCCR0_GPT3_EN | PCCR0_GPT2_EN | PCCR0_GPT1_EN | PCCR0_GPIO_EN | + PCCR0_FEC_EN | PCCR0_CSPI3_EN | PCCR0_CSPI2_EN | PCCR0_CSPI1_EN, + base + CCM_PCCR0); + + writel(PCCR1_NFC_BAUDEN | PCCR1_PERCLK4_EN | PCCR1_PERCLK3_EN | + PCCR1_PERCLK2_EN | PCCR1_PERCLK1_EN | PCCR1_HCLK_USB | + PCCR1_HCLK_FEC | PCCR1_HCLK_EMI | PCCR1_WDT_EN | PCCR1_USB_EN | + PCCR1_UART6_EN | PCCR1_UART5_EN | PCCR1_UART4_EN | + PCCR1_UART3_EN | PCCR1_UART2_EN | PCCR1_UART1_EN, + base + CCM_PCCR1); + + clks[dummy] = clk_fixed(dummy, 0); + clks[ckih] = clk_fixed(ckih, 2600); + clks[ckil] = clk_fixed(ckil, 32768); + clks[mpll] = imx_clk_pllv1(mpll, ckih, base + CCM_MPCTL0); + clks[spll] = imx_clk_pllv1(spll, ckih, base + CCM_SPCTL0); + clks[mpll_main2] = imx_clk_fixed_factor(mpll_main2, mpll, 2, 3); + + if (imx_silicon_revision() = IMX27_CHIP_REVISION_2_0) { + clks[ahb] = imx_clk_divider(ahb, mpll_main2, base + CCM_CSCR, 8, 2); + clks[ipg] = imx_clk_fixed_factor(ipg, ahb, 1, 2); + } else { + clks[ahb] = imx_clk_divider(ahb, mpll_main2, base + CCM_CSCR, 9, 4); + clks[ipg] = imx_clk_divider(ipg, ahb, base + CCM_CSCR, 8, 1); + } + + clks[nfc_div] = imx_clk_divider(nfc_div, ahb, base + CCM_PCDR0, 6, 4); +
[PATCH 07/23] ARM i.MX25: Switch to common clk support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Makefile|2 +- arch/arm/mach-imx/clk-imx25.c | 154 + arch/arm/mach-imx/imx25.c |3 +- 3 files changed, 157 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/clk-imx25.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 74e08ad..4cb7011 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -1,7 +1,7 @@ obj-y += clocksource.o gpio.o obj-$(CONFIG_RESET_SOURCE) += reset_source.o obj-$(CONFIG_ARCH_IMX1) += speed-imx1.o imx1.o iomux-v1.o -obj-$(CONFIG_ARCH_IMX25) += speed-imx25.o imx25.o iomux-v3.o +obj-$(CONFIG_ARCH_IMX25) += speed-imx25.o imx25.o iomux-v3.o clk-imx25.o obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o imx21.o iomux-v1.o obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o clk-imx27.o obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o diff --git a/arch/arm/mach-imx/clk-imx25.c b/arch/arm/mach-imx/clk-imx25.c new file mode 100644 index 000..61033d6 --- /dev/null +++ b/arch/arm/mach-imx/clk-imx25.c @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2009 by Sascha Hauer, 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., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301, USA. + */ + +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include mach/imx25-regs.h + +#include clk.h + +#define CCM_MPCTL 0x00 +#define CCM_UPCTL 0x04 +#define CCM_CCTL 0x08 +#define CCM_CGCR0 0x0C +#define CCM_CGCR1 0x10 +#define CCM_CGCR2 0x14 +#define CCM_PCDR0 0x18 +#define CCM_PCDR1 0x1C +#define CCM_PCDR2 0x20 +#define CCM_PCDR3 0x24 +#define CCM_RCSR 0x28 +#define CCM_CRDR 0x2C +#define CCM_DCVR0 0x30 +#define CCM_DCVR1 0x34 +#define CCM_DCVR2 0x38 +#define CCM_DCVR3 0x3c +#define CCM_LTR0 0x40 +#define CCM_LTR1 0x44 +#define CCM_LTR2 0x48 +#define CCM_LTR3 0x4c +#define CCM_MCR0x64 + +enum mx25_clks { + dummy, osc, mpll, upll, mpll_cpu_3_4, cpu_sel, cpu, ahb, usb_div, ipg, + per0_sel, per1_sel, per2_sel, per3_sel, per4_sel, per5_sel, per6_sel, + per7_sel, per8_sel, per9_sel, per10_sel, per11_sel, per12_sel, + per13_sel, per14_sel, per15_sel, per0, per1, per2, per3, per4, per5, + per6, per7, per8, per9, per10, per11, per12, per13, per14, per15, + clk_max +}; + +static struct clk *clks[clk_max]; + +static const char *cpu_sel_clks[] = { + mpll, + mpll_cpu_3_4, +}; + +static const char *per_sel_clks[] = { + ahb, + upll, +}; + +static int imx25_ccm_probe(struct device_d *dev) +{ + void __iomem *base; + + base = dev_request_mem_region(dev, 0); + + writel(0x10e88578, base + CCM_CGCR0); + writel(0x0478e1e0, base + CCM_CGCR0); + writel(0x0007c400, base + CCM_CGCR0); + + clks[dummy] = clk_fixed(dummy, 0); + clks[osc] = clk_fixed(osc, 2400); + clks[mpll] = imx_clk_pllv1(mpll, osc, base + CCM_MPCTL); + clks[upll] = imx_clk_pllv1(upll, osc, base + CCM_UPCTL); + clks[mpll_cpu_3_4] = imx_clk_fixed_factor(mpll_cpu_3_4, mpll, 3, 4); + clks[cpu_sel] = imx_clk_mux(cpu_sel, base + CCM_CCTL, 14, 1, cpu_sel_clks, ARRAY_SIZE(cpu_sel_clks)); + clks[cpu] = imx_clk_divider(cpu, cpu_sel, base + CCM_CCTL, 30, 2); + clks[ahb] = imx_clk_divider(ahb, cpu, base + CCM_CCTL, 28, 2); + clks[usb_div] = imx_clk_divider(usb_div, upll, base + CCM_CCTL, 16, 6); + clks[ipg] = imx_clk_fixed_factor(ipg, ahb, 1, 2); + clks[per0_sel] = imx_clk_mux(per0_sel, base + CCM_MCR, 0, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); + clks[per1_sel] = imx_clk_mux(per1_sel, base + CCM_MCR, 1, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); + clks[per2_sel] = imx_clk_mux(per2_sel, base + CCM_MCR, 2, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); + clks[per3_sel] = imx_clk_mux(per3_sel, base + CCM_MCR, 3, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); + clks[per4_sel] = imx_clk_mux(per4_sel, base + CCM_MCR, 4, 1, per_sel_clks, ARRAY_SIZE(per_sel_clks)); + clks[per5_sel] = imx_clk_mux(per5_sel, base + CCM_MCR, 5, 1, per_sel_clks,
[PATCH 16/23] spi i.MX: Switch to clk support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/spi/imx_spi.c | 12 ++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/spi/imx_spi.c b/drivers/spi/imx_spi.c index c3dc6cc..14d2b28 100644 --- a/drivers/spi/imx_spi.c +++ b/drivers/spi/imx_spi.c @@ -25,6 +25,8 @@ #include mach/spi.h #include mach/generic.h #include mach/clock.h +#include linux/clk.h +#include linux/err.h #define CSPI_0_0_RXDATA0x00 #define CSPI_0_0_TXDATA0x04 @@ -128,6 +130,7 @@ struct imx_spi { struct spi_master master; int *cs_array; void __iomem*regs; + struct clk *clk; unsigned int(*xchg_single)(struct imx_spi *imx, u32 data); void(*chipselect)(struct spi_device *spi, int active); @@ -276,7 +279,7 @@ static void cspi_0_7_chipselect(struct spi_device *spi, int is_active) return; } - reg |= spi_imx_clkdiv_2(imx_get_cspiclk(), spi-max_speed_hz) + reg |= spi_imx_clkdiv_2(clk_get_rate(imx-clk), spi-max_speed_hz) CSPI_0_7_CTRL_DR_SHIFT; reg |= (spi-bits_per_word - 1) CSPI_0_7_CTRL_BL_SHIFT; @@ -381,7 +384,7 @@ static void cspi_2_3_chipselect(struct spi_device *spi, int is_active) ctrl |= CSPI_2_3_CTRL_MODE(cs); /* set clock speed */ - ctrl |= cspi_2_3_clkdiv(imx_get_cspiclk(), spi-max_speed_hz); + ctrl |= cspi_2_3_clkdiv(clk_get_rate(imx-clk), spi-max_speed_hz); /* set chip select to use */ ctrl |= CSPI_2_3_CTRL_CS(cs); @@ -532,6 +535,7 @@ static int imx_spi_probe(struct device_d *dev) master-setup = imx_spi_setup; master-transfer = imx_spi_transfer; + if (pdata) { master-num_chipselect = pdata-num_chipselect; imx-cs_array = pdata-chipselect; @@ -540,6 +544,10 @@ static int imx_spi_probe(struct device_d *dev) imx_spi_dt_probe(imx); } + imx-clk = clk_get(dev, NULL); + if (IS_ERR(imx-clk)) + return PTR_ERR(imx-clk); + #ifdef CONFIG_DRIVER_SPI_IMX_0_0 if (cpu_is_mx27()) version = SPI_IMX_VER_0_0; -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 22/23] video i.MX IPU: Switch to clock support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/video/imx-ipu-fb.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/video/imx-ipu-fb.c b/drivers/video/imx-ipu-fb.c index 80236b3..6343f12 100644 --- a/drivers/video/imx-ipu-fb.c +++ b/drivers/video/imx-ipu-fb.c @@ -27,10 +27,12 @@ #include errno.h #include asm-generic/div64.h #include mach/imx-ipu-fb.h -#include mach/clock.h +#include linux/clk.h +#include linux/err.h struct ipu_fb_info { void __iomem*regs; + struct clk *clk; void(*enable)(int enable); @@ -480,7 +482,7 @@ static int sdc_init_panel(struct fb_info *info, enum pixel_fmt pixel_fmt) * i.MX31 it (HSP_CLK) is = 178MHz. Currently 128.267MHz */ pixel_clk = PICOS2KHZ(mode-pixclock) * 1000UL; - div = imx_get_lcdclk() * 16 / pixel_clk; + div = clk_get_rate(fbi-clk) * 16 / pixel_clk; if (div 0x40) { /* Divider less than 4 */ dev_dbg(info-dev, @@ -986,6 +988,10 @@ static int imxfb_probe(struct device_d *dev) fbi = xzalloc(sizeof(*fbi)); info = fbi-info; + fbi-clk = clk_get(dev, NULL); + if (IS_ERR(fbi-clk)) + return PTR_ERR(fbi-clk); + fbi-regs = dev_request_mem_region(dev, 0); fbi-dev = dev; fbi-enable = pdata-enable; -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 19/23] mci i.MX: Switch to clock support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/mci/imx.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/mci/imx.c b/drivers/mci/imx.c index 0e4fa66..035a3aa 100644 --- a/drivers/mci/imx.c +++ b/drivers/mci/imx.c @@ -25,6 +25,8 @@ #include clock.h #include init.h #include driver.h +#include linux/clk.h +#include linux/err.h #include mach/clock.h #include io.h @@ -103,6 +105,7 @@ struct mxcmci_regs { struct mxcmci_host { struct mci_host mci; struct mxcmci_regs *base; + struct clk *clk; int irq; int detect_irq; int dma; @@ -415,7 +418,7 @@ static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) { unsigned int divider; int prescaler = 0; - unsigned long clk_in = imx_get_mmcclk(); + unsigned long clk_in = clk_get_rate(host-clk); while (prescaler = 0x800) { for (divider = 1; divider = 0xF; divider++) { @@ -490,9 +493,14 @@ static int mxcmci_init(struct mci_host *mci, struct device_d *dev) static int mxcmci_probe(struct device_d *dev) { struct mxcmci_host *host; + unsigned long rate; host = xzalloc(sizeof(*host)); + host-clk = clk_get(dev, NULL); + if (IS_ERR(host-clk)) + return PTR_ERR(host-clk); + host-mci.send_cmd = mxcmci_request; host-mci.set_ios = mxcmci_set_ios; host-mci.init = mxcmci_init; @@ -503,8 +511,9 @@ static int mxcmci_probe(struct device_d *dev) host-mci.voltages = MMC_VDD_32_33 | MMC_VDD_33_34; - host-mci.f_min = imx_get_mmcclk() 7; - host-mci.f_max = imx_get_mmcclk() 1; + rate = clk_get_rate(host-clk); + host-mci.f_min = rate 7; + host-mci.f_max = rate 1; mci_register(host-mci); -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 08/23] ARM i.MX5: Switch to common clk support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Makefile |4 +- arch/arm/mach-imx/clk-imx5.c | 298 ++ arch/arm/mach-imx/imx51.c|3 +- arch/arm/mach-imx/imx53.c|3 +- 4 files changed, 304 insertions(+), 4 deletions(-) create mode 100644 arch/arm/mach-imx/clk-imx5.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 4cb7011..282913d 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -6,8 +6,8 @@ obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o imx21.o iomux-v1.o obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o clk-imx27.o obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o -obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o -obj-$(CONFIG_ARCH_IMX53) += speed-imx53.o imx53.o iomux-v3.o imx5.o +obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o clk-imx5.o +obj-$(CONFIG_ARCH_IMX53) += speed-imx53.o imx53.o iomux-v3.o imx5.o clk-imx5.o obj-$(CONFIG_ARCH_IMX6) += speed-imx6.o imx6.o iomux-v3.o usb-imx6.o obj-$(CONFIG_IMX_CLKO) += clko.o obj-$(CONFIG_IMX_IIM) += iim.o diff --git a/arch/arm/mach-imx/clk-imx5.c b/arch/arm/mach-imx/clk-imx5.c new file mode 100644 index 000..476ea29 --- /dev/null +++ b/arch/arm/mach-imx/clk-imx5.c @@ -0,0 +1,298 @@ +/* + * Copyright (C) 2011 Sascha Hauer, Pengutronix s.ha...@pengutronix.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include mach/imx-regs.h + +#include clk.h + +/* Register addresses of CCM*/ +#define CCM_CCR0x00 +#define CCM_CCDR 0x04 +#define CCM_CSR0x08 +#define CCM_CCSR 0x0C +#define CCM_CACRR 0x10 +#define CCM_CBCDR 0x14 +#define CCM_CBCMR 0x18 +#define CCM_CSCMR1 0x1C +#define CCM_CSCMR2 0x20 +#define CCM_CSCDR1 0x24 +#define CCM_CS1CDR 0x28 +#define CCM_CS2CDR 0x2C +#define CCM_CDCDR 0x30 +#define CCM_CHSCDR 0x34 +#define CCM_CSCDR2 0x38 +#define CCM_CSCDR3 0x3C +#define CCM_CSCDR4 0x40 +#define CCM_CWDR 0x44 +#define CCM_CDHIPR 0x48 +#define CCM_CDCR 0x4C +#define CCM_CTOR 0x50 +#define CCM_CLPCR 0x54 +#define CCM_CISR 0x58 +#define CCM_CIMR 0x5C +#define CCM_CCOSR 0x60 +#define CCM_CGPR 0x64 +#define CCM_CCGR0 0x68 +#define CCM_CCGR1 0x6C +#define CCM_CCGR2 0x70 +#define CCM_CCGR3 0x74 +#define CCM_CCGR4 0x78 +#define CCM_CCGR5 0x7C +#define CCM_CCGR6 0x80 +#define CCM_CCGR7 0x84 + +#define CCM_CMEOR 0x84 + +enum imx5_clks { + dummy, ckil, osc, ckih1, ckih2, ahb, ipg, axi_a, axi_b, uart_pred, + uart_root, esdhc_a_pred, esdhc_b_pred, esdhc_c_s, esdhc_d_s, + emi_sel, emi_slow_podf, nfc_podf, ecspi_pred, ecspi_podf, usboh3_pred, + usboh3_podf, usb_phy_pred, usb_phy_podf, cpu_podf, di_pred, lp_apm, + periph_apm, main_bus, ahb_max, aips_tz1, aips_tz2, tmax1, tmax2, + tmax3, spba, uart_sel, esdhc_a_sel, esdhc_b_sel, esdhc_a_podf, + esdhc_b_podf, ecspi_sel, usboh3_sel, usb_phy_sel, + gpc_dvfs, pll1_sw, pll2_sw, + pll3_sw, pll4_sw, per_lp_apm, per_pred1, per_pred2, per_podf, per_root, + clk_max +}; + +static struct clk *clks[clk_max]; + +/* This is used multiple times */ +static const char *standard_pll_sel[] = { + pll1_sw, + pll2_sw, + pll3_sw, + lp_apm, +}; + +static const char *lp_apm_sel[] = { + osc, +}; + +static const char *periph_apm_sel[] = { + pll1_sw, + pll3_sw, + lp_apm, +}; + +static const char *main_bus_sel[] = { + pll2_sw, + periph_apm, +}; + +static const char *per_lp_apm_sel[] = { + main_bus, + lp_apm, +}; + +static const char *per_root_sel[] = { + per_podf, + ipg, +}; + +static const char *esdhc_c_sel[] = { + esdhc_a_podf, + esdhc_b_podf, +}; + +static const char *esdhc_d_sel[] = { + esdhc_a_podf, + esdhc_b_podf, +}; + +static const char *emi_slow_sel[] = { + main_bus, + ahb, +}; + +static const char *usb_phy_sel_str[] = { + osc, + usb_phy_podf, +}; + +static void __init mx5_clocks_common_init(void __iomem *base, unsigned long rate_ckil, + unsigned long rate_osc, unsigned long rate_ckih1, + unsigned long rate_ckih2) +{ + writel(0x, base + CCM_CCGR0); + writel(0x, base + CCM_CCGR1); + writel(0x, base + CCM_CCGR2); + writel(0x, base + CCM_CCGR3); + writel(0x, base + CCM_CCGR4); + writel(0x, base + CCM_CCGR5); +
[PATCH 17/23] ARM i.MX: Switch clocksource to clk_get
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/clocksource.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-imx/clocksource.c b/arch/arm/mach-imx/clocksource.c index 2c6f6a0..df018e6 100644 --- a/arch/arm/mach-imx/clocksource.c +++ b/arch/arm/mach-imx/clocksource.c @@ -29,6 +29,8 @@ #include init.h #include clock.h #include errno.h +#include linux/clk.h +#include linux/err.h #include notifier.h #include mach/imx-regs.h #include mach/clock.h @@ -46,6 +48,8 @@ #define IMX31_TCTL_CLKSOURCE_IPG (1 6)/* Clock source bit position */ #define TCTL_TEN (1 0)/* Timer enable */ +static struct clk *clk_gpt; + struct imx_gpt_regs { unsigned int tcn; uint32_t tctl_val; @@ -77,7 +81,7 @@ static struct clocksource cs = { static int imx_clocksource_clock_change(struct notifier_block *nb, unsigned long event, void *data) { - cs.mult = clocksource_hz2mult(imx_get_gptclk(), cs.shift); + cs.mult = clocksource_hz2mult(clk_get_rate(clk_gpt), cs.shift); return 0; } @@ -89,6 +93,7 @@ static int imx_gpt_probe(struct device_d *dev) { int i; int ret; + unsigned long rate; /* one timer is enough */ if (timer_base) @@ -118,10 +123,18 @@ static int imx_gpt_probe(struct device_d *dev) for (i = 0; i 100; i++) writel(0, timer_base + GPT_TCTL); /* We have no udelay by now */ + clk_gpt = clk_get(dev, NULL); + if (IS_ERR(clk_gpt)) { + rate = 2000; + dev_err(dev, failed to get clock\n); + } else { + rate = clk_get_rate(clk_gpt); + } + writel(0, timer_base + GPT_TPRER); writel(regs-tctl_val, timer_base + GPT_TCTL); - cs.mult = clocksource_hz2mult(imx_get_gptclk(), cs.shift); + cs.mult = clocksource_hz2mult(rate, cs.shift); init_clock(cs); -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 03/23] clk: initial common clk support
This adds barebox common clk support loosely based on the Kernel common clk support. differences are: - barebox does not need prepare/unprepare - no parent rate propagation for set_rate - struct clk is not really encapsulated from the drivers Along with the clk support we have support for some basic clk building blocks: - clk-fixed - clk-fixed-factor - clk-mux - clk-divider clk-fixed and clk-fixed-factor are completely generic, clk-mux and clk-divider are currently the way i.MX muxes/dividers are implemented. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/clk/Kconfig|3 + drivers/clk/Makefile |2 +- drivers/clk/clk-divider.c | 98 ++ drivers/clk/clk-fixed-factor.c | 63 +++ drivers/clk/clk-fixed.c| 55 ++ drivers/clk/clk-mux.c | 77 ++ drivers/clk/clk.c | 224 include/linux/clk.h| 42 8 files changed, 563 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/clk-divider.c create mode 100644 drivers/clk/clk-fixed-factor.c create mode 100644 drivers/clk/clk-fixed.c create mode 100644 drivers/clk/clk-mux.c create mode 100644 drivers/clk/clk.c diff --git a/drivers/clk/Kconfig b/drivers/clk/Kconfig index 4168c88..66c1c46 100644 --- a/drivers/clk/Kconfig +++ b/drivers/clk/Kconfig @@ -2,3 +2,6 @@ config CLKDEV_LOOKUP bool select HAVE_CLK + +config COMMON_CLK + bool diff --git a/drivers/clk/Makefile b/drivers/clk/Makefile index 07613fa..39a75a4 100644 --- a/drivers/clk/Makefile +++ b/drivers/clk/Makefile @@ -1,2 +1,2 @@ - +obj-$(CONFIG_COMMON_CLK) += clk.o clk-fixed.o clk-divider.o clk-fixed-factor.o clk-mux.o obj-$(CONFIG_CLKDEV_LOOKUP)+= clkdev.o diff --git a/drivers/clk/clk-divider.c b/drivers/clk/clk-divider.c new file mode 100644 index 000..58a7ea5 --- /dev/null +++ b/drivers/clk/clk-divider.c @@ -0,0 +1,98 @@ +/* + * clk-divider.c - generic barebox clock support. Based on Linux clk support + * + * Copyright (c) 2012 Sascha Hauer s.ha...@pengutronix.de, 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. + * + */ +#include common.h +#include io.h +#include malloc.h +#include linux/clk.h +#include linux/err.h + +struct clk_divider { + struct clk clk; + u8 shift; + u8 width; + void __iomem *reg; + const char *parent; +}; + +static int clk_divider_set_rate(struct clk *clk, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_divider *div = container_of(clk, struct clk_divider, clk); + unsigned int val, divval; + + if (rate parent_rate) + rate = parent_rate; + if (!rate) + rate = 1; + + divval = DIV_ROUND_UP(parent_rate, rate); + + if (divval (1 div-width)) + divval = 1 (div-width); + + divval--; + + val = readl(div-reg); + val = ~(((1 div-width) - 1) div-shift); + val |= divval div-shift; + writel(val, div-reg); + + return 0; +} + +static unsigned long clk_divider_recalc_rate(struct clk *clk, + unsigned long parent_rate) +{ + struct clk_divider *div = container_of(clk, struct clk_divider, clk); + unsigned int val; + + val = readl(div-reg) div-shift; + val = (1 div-width) - 1; + + val++; + + return parent_rate / val; +} + +struct clk_ops clk_divider_ops = { + .set_rate = clk_divider_set_rate, + .recalc_rate = clk_divider_recalc_rate, +}; + +struct clk *clk_divider(const char *name, const char *parent, + void __iomem *reg, u8 shift, u8 width) +{ + struct clk_divider *div = xzalloc(sizeof(*div)); + int ret; + + div-shift = shift; + div-reg = reg; + div-width = width; + div-parent = parent; + div-clk.ops = clk_divider_ops; + div-clk.name = name; + div-clk.parent_names = div-parent; + div-clk.num_parents = 1; + + ret = clk_register(div-clk); + if (ret) { + free(div); + return ERR_PTR(ret); + } + + return div-clk; +} diff --git a/drivers/clk/clk-fixed-factor.c b/drivers/clk/clk-fixed-factor.c new file mode 100644 index 000..52e7c16 --- /dev/null +++ b/drivers/clk/clk-fixed-factor.c @@ -0,0 +1,63 @@ +/* + * clk-fixed-factor.c - generic barebox clock support. Based on Linux clk support + * + * Copyright (c) 2012 Sascha Hauer
[PATCH 15/23] serial i.MX: Switch to clk support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/serial/serial_imx.c | 17 - 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/serial/serial_imx.c b/drivers/serial/serial_imx.c index 012ab02..e0e5b01 100644 --- a/drivers/serial/serial_imx.c +++ b/drivers/serial/serial_imx.c @@ -22,6 +22,8 @@ #include malloc.h #include notifier.h #include io.h +#include linux/err.h +#include linux/clk.h #define URXD0 0x0 /* Receiver Register */ #define URTX0 0x40/* Transmitter Register */ @@ -170,16 +172,17 @@ struct imx_serial_priv { int baudrate; struct notifier_block notify; void __iomem *regs; + struct clk *clk; }; -static int imx_serial_reffreq(void __iomem *regs) +static int imx_serial_reffreq(struct imx_serial_priv *priv) { ulong rfdiv; - rfdiv = (readl(regs + UFCR) 7) 7; + rfdiv = (readl(priv-regs + UFCR) 7) 7; rfdiv = rfdiv 6 ? 6 - rfdiv : 7; - return imx_get_uartclk() / rfdiv; + return clk_get_rate(priv-clk) / rfdiv; } /* @@ -209,7 +212,7 @@ static int imx_serial_init_port(struct console_device *cdev) writel(0xa81, regs + UFCR); #ifdef ONEMS - writel(imx_serial_reffreq(regs) / 1000, regs + ONEMS); + writel(imx_serial_reffreq(priv) / 1000, regs + ONEMS); #endif /* Enable FIFOs */ @@ -291,7 +294,7 @@ static int imx_serial_setbaudrate(struct console_device *cdev, int baudrate) /* Set the numerator value minus one of the BRM ratio */ writel((baudrate / 100) - 1, regs + UBIR); /* Set the denominator value minus one of the BRM ratio*/ - writel((imx_serial_reffreq(regs) / 1600) - 1, regs + UBMR); + writel((imx_serial_reffreq(priv) / 1600) - 1, regs + UBMR); writel(ucr1, regs + UCR1); @@ -321,6 +324,10 @@ static int imx_serial_probe(struct device_d *dev) cdev = priv-cdev; dev-priv = priv; + priv-clk = clk_get(dev, NULL); + if (IS_ERR(priv-clk)) + return PTR_ERR(priv-clk); + priv-regs = dev_request_mem_region(dev, 0); cdev-dev = dev; cdev-f_caps = CONSOLE_STDIN | CONSOLE_STDOUT | CONSOLE_STDERR; -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 13/23] ARM i.MX35: Switch to common clk
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Makefile|2 +- arch/arm/mach-imx/clk-imx35.c | 186 + arch/arm/mach-imx/imx35.c |3 +- 3 files changed, 189 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/clk-imx35.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index a06ddf5..f7a5ba4 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -5,7 +5,7 @@ obj-$(CONFIG_ARCH_IMX25) += speed-imx25.o imx25.o iomux-v3.o clk-imx25.o obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o imx21.o iomux-v1.o clk-imx21.o obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o clk-imx27.o obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o clk-imx31.o -obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o +obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o clk-imx35.o obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o clk-imx5.o obj-$(CONFIG_ARCH_IMX53) += speed-imx53.o imx53.o iomux-v3.o imx5.o clk-imx5.o obj-$(CONFIG_ARCH_IMX6) += speed-imx6.o imx6.o iomux-v3.o usb-imx6.o clk-imx6.o diff --git a/arch/arm/mach-imx/clk-imx35.c b/arch/arm/mach-imx/clk-imx35.c new file mode 100644 index 000..d9f88c2 --- /dev/null +++ b/arch/arm/mach-imx/clk-imx35.c @@ -0,0 +1,186 @@ +/* + * Copyright (C) 2012 Sascha Hauer, Pengutronix s.ha...@pengutronix.de + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation. + * + */ +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include mach/imx35-regs.h + +#include clk.h + +#define CCM_CCMR 0x00 +#define CCM_PDR0 0x04 +#define CCM_PDR1 0x08 +#define CCM_PDR2 0x0C +#define CCM_PDR3 0x10 +#define CCM_PDR4 0x14 +#define CCM_RCSR 0x18 +#define CCM_MPCTL 0x1C +#define CCM_PPCTL 0x20 +#define CCM_ACMR 0x24 +#define CCM_COSR 0x28 +#define CCM_CGR0 0x2C +#define CCM_CGR1 0x30 +#define CCM_CGR2 0x34 +#define CCM_CGR3 0x38 + +struct arm_ahb_div { + unsigned char arm, ahb, sel; +}; + +static struct arm_ahb_div clk_consumer[] = { + { .arm = 1, .ahb = 4, .sel = 0}, + { .arm = 1, .ahb = 3, .sel = 1}, + { .arm = 2, .ahb = 2, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, + { .arm = 4, .ahb = 1, .sel = 0}, + { .arm = 1, .ahb = 5, .sel = 0}, + { .arm = 1, .ahb = 8, .sel = 0}, + { .arm = 1, .ahb = 6, .sel = 1}, + { .arm = 2, .ahb = 4, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, + { .arm = 4, .ahb = 2, .sel = 0}, + { .arm = 0, .ahb = 0, .sel = 0}, +}; + +static char hsp_div_532[] = { 4, 8, 3, 0 }; +static char hsp_div_400[] = { 3, 6, 3, 0 }; + +enum mx35_clks { + ckih, mpll, ppll, mpll_075, arm, hsp, hsp_div, hsp_sel, ahb, ipg, + arm_per_div, ahb_per_div, ipg_per, uart_sel, uart_div, esdhc_sel, + esdhc1_div, esdhc2_div, esdhc3_div, spdif_sel, spdif_div_pre, + spdif_div_post, ssi_sel, ssi1_div_pre, ssi1_div_post, ssi2_div_pre, + ssi2_div_post, usb_sel, usb_div, nfc_div, asrc_gate, pata_gate, + audmux_gate, can1_gate, can2_gate, cspi1_gate, cspi2_gate, ect_gate, + edio_gate, emi_gate, epit1_gate, epit2_gate, esai_gate, esdhc1_gate, + esdhc2_gate, esdhc3_gate, fec_gate, gpio1_gate, gpio2_gate, gpio3_gate, + gpt_gate, i2c1_gate, i2c2_gate, i2c3_gate, iomuxc_gate, ipu_gate, + kpp_gate, mlb_gate, mshc_gate, owire_gate, pwm_gate, rngc_gate, + rtc_gate, rtic_gate, scc_gate, sdma_gate, spba_gate, spdif_gate, + ssi1_gate, ssi2_gate, uart1_gate, uart2_gate, uart3_gate, usbotg_gate, + wdog_gate, max_gate, admux_gate, csi_gate, iim_gate, gpu2d_gate, + clk_max +}; + +static struct clk *clks[clk_max]; + +static const char *std_sel[] = { + ppll, + arm, +}; + +static const char *ipg_per_sel[] = { + ahb_per_div, + arm_per_div, +}; + +static int imx35_ccm_probe(struct device_d *dev) +{ + u32 pdr0, consumer_sel, hsp_sel; + struct arm_ahb_div *aad; + unsigned char *hsp_div; + void __iomem *base; + + base = dev_request_mem_region(dev, 0); + + writel(0x, base + CCM_CGR0); + writel(0x, base + CCM_CGR1); + writel(0x, base + CCM_CGR2); + writel(0x, base + CCM_CGR3); + + pdr0 = __raw_readl(base + CCM_PDR0); + consumer_sel = (pdr0 16) 0xf; + aad = clk_consumer[consumer_sel]; + if (!aad-arm) { + pr_err(i.MX35 clk: illegal consumer mux selection 0x%x\n, consumer_sel); +
[PATCH 05/23] ARM i.MX: initial clk support
This adds the basic i.MX common clk support and some pll and pfd drivers. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Makefile |1 + arch/arm/mach-imx/clk-pfd.c | 148 arch/arm/mach-imx/clk-pllv1.c | 94 arch/arm/mach-imx/clk-pllv2.c | 164 + arch/arm/mach-imx/clk-pllv3.c | 386 +++ arch/arm/mach-imx/clk.h | 66 ++ arch/arm/mach-imx/include/mach/clkdev.h |7 + 7 files changed, 866 insertions(+) create mode 100644 arch/arm/mach-imx/clk-pfd.c create mode 100644 arch/arm/mach-imx/clk-pllv1.c create mode 100644 arch/arm/mach-imx/clk-pllv2.c create mode 100644 arch/arm/mach-imx/clk-pllv3.c create mode 100644 arch/arm/mach-imx/clk.h create mode 100644 arch/arm/mach-imx/include/mach/clkdev.h diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index 2b595bc..f6d487f 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -14,6 +14,7 @@ obj-$(CONFIG_IMX_IIM) += iim.o obj-$(CONFIG_NAND_IMX) += nand.o obj-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o pbl-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o +obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-pfd.o obj-y += speed.o obj-y += devices.o obj-y += boot.o diff --git a/arch/arm/mach-imx/clk-pfd.c b/arch/arm/mach-imx/clk-pfd.c new file mode 100644 index 000..8f6d5ad --- /dev/null +++ b/arch/arm/mach-imx/clk-pfd.c @@ -0,0 +1,148 @@ +/* + * Copyright 2012 Freescale Semiconductor, Inc. + * Copyright 2012 Linaro Ltd. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include malloc.h +#include asm-generic/div64.h + +#include clk.h + +/** + * struct clk_pfd - IMX PFD clock + * @clk_hw:clock source + * @reg: PFD register address + * @idx: the index of PFD encoded in the register + * + * PFD clock found on i.MX6 series. Each register for PFD has 4 clk_pfd + * data encoded, and member idx is used to specify the one. And each + * register has SET, CLR and TOG registers at offset 0x4 0x8 and 0xc. + */ +struct clk_pfd { + struct clk clk; + void __iomem*reg; + u8 idx; + const char *parent; +}; + +#define to_clk_pfd(_clk) container_of(_clk, struct clk_pfd, clk) + +#define SET0x4 +#define CLR0x8 +#define OTG0xc + +static int clk_pfd_enable(struct clk *clk) +{ + struct clk_pfd *pfd = to_clk_pfd(clk); + writel(1 ((pfd-idx + 1) * 8 - 1), pfd-reg + CLR); + + return 0; +} + +static void clk_pfd_disable(struct clk *clk) +{ + struct clk_pfd *pfd = to_clk_pfd(clk); + + writel(1 ((pfd-idx + 1) * 8 - 1), pfd-reg + SET); +} + +static unsigned long clk_pfd_recalc_rate(struct clk *clk, +unsigned long parent_rate) +{ + struct clk_pfd *pfd = to_clk_pfd(clk); + u64 tmp = parent_rate; + u8 frac = (readl(pfd-reg) (pfd-idx * 8)) 0x3f; + + tmp *= 18; + do_div(tmp, frac); + + return tmp; +} + +static long clk_pfd_round_rate(struct clk *clk, unsigned long rate, + unsigned long *prate) +{ + u64 tmp = *prate; + u8 frac; + + tmp = tmp * 18 + rate / 2; + do_div(tmp, rate); + frac = tmp; + if (frac 12) + frac = 12; + else if (frac 35) + frac = 35; + tmp = *prate; + tmp *= 18; + do_div(tmp, frac); + + return tmp; +} + +static int clk_pfd_set_rate(struct clk *clk, unsigned long rate, + unsigned long parent_rate) +{ + struct clk_pfd *pfd = to_clk_pfd(clk); + u64 tmp = parent_rate; + u8 frac; + + tmp = tmp * 18 + rate / 2; + do_div(tmp, rate); + frac = tmp; + if (frac 12) + frac = 12; + else if (frac 35) + frac = 35; + + writel(0x3f (pfd-idx * 8), pfd-reg + CLR); + writel(frac (pfd-idx * 8), pfd-reg + SET); + + return 0; +} + +static const struct clk_ops clk_pfd_ops = { + .enable = clk_pfd_enable, + .disable= clk_pfd_disable, + .recalc_rate= clk_pfd_recalc_rate, + .round_rate = clk_pfd_round_rate, + .set_rate = clk_pfd_set_rate, +}; + +struct clk *imx_clk_pfd(const char *name, const char *parent, + void __iomem *reg, u8 idx) +{ + struct clk_pfd *pfd; + int ret; + + pfd = xzalloc(sizeof(*pfd)); + + pfd-reg = reg; +
[PATCH 14/23] net fec: Switch to clk support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/net/fec_imx.c | 27 --- drivers/net/fec_imx.h |1 + 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/net/fec_imx.c b/drivers/net/fec_imx.c index 6acf6bd..4606558 100644 --- a/drivers/net/fec_imx.c +++ b/drivers/net/fec_imx.c @@ -24,6 +24,8 @@ #include clock.h #include xfuncs.h #include linux/phy.h +#include linux/clk.h +#include linux/err.h #include asm/mmu.h @@ -43,6 +45,19 @@ struct fec_frame { uint8_t head[16]; /* MAC header(6 + 6 + 2) + 2(aligned) */ }; +#ifdef CONFIG_COMMON_CLK +static inline unsigned long fec_clk_get_rate(struct fec_priv *fec) +{ + return clk_get_rate(fec-clk); +} +#else +static inline unsigned long fec_clk_get_rate(struct fec_priv *fec) +{ + return imx_get_fecclk(); +} +#endif + + /* * MII-interface related functions */ @@ -54,7 +69,7 @@ static int fec_miibus_read(struct mii_bus *bus, int phyAddr, int regAddr) uint32_t phy; /* convenient holder for the PHY */ uint64_t start; - writel(((imx_get_fecclk() 20) / 5) 1, + writel(((fec_clk_get_rate(fec) 20) / 5) 1, fec-regs + FEC_MII_SPEED); /* * reading from any PHY's register is done by properly @@ -97,7 +112,7 @@ static int fec_miibus_write(struct mii_bus *bus, int phyAddr, uint32_t phy; /* convenient holder for the PHY */ uint64_t start; - writel(((imx_get_fecclk() 20) / 5) 1, + writel(((fec_clk_get_rate(fec) 20) / 5) 1, fec-regs + FEC_MII_SPEED); reg = regAddr FEC_MII_DATA_RA_SHIFT; @@ -290,7 +305,7 @@ static int fec_init(struct eth_device *dev) * Set MII_SPEED = (1/(mii_speed * 2)) * System Clock * and do not drop the Preamble. */ - writel(((imx_get_fecclk() 20) / 5) 1, + writel(((fec_clk_get_rate(fec) 20) / 5) 1, fec-regs + FEC_MII_SPEED); } @@ -628,6 +643,12 @@ static int fec_probe(struct device_d *dev) edev-set_ethaddr = fec_set_hwaddr; edev-parent = dev; +#ifdef CONFIG_COMMON_CLK + fec-clk = clk_get(dev, NULL); + if (IS_ERR(fec-clk)) + return PTR_ERR(fec-clk); +#endif + fec-regs = dev_request_mem_region(dev, 0); /* Reset chip. */ diff --git a/drivers/net/fec_imx.h b/drivers/net/fec_imx.h index d10385a..d147dca 100644 --- a/drivers/net/fec_imx.h +++ b/drivers/net/fec_imx.h @@ -138,6 +138,7 @@ struct fec_priv { u32 phy_flags; struct mii_bus miibus; void (*phy_init)(struct phy_device *dev); + struct clk *clk; }; /** -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 11/23] ARM i.MX6: Switch to common clk
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Makefile |2 +- arch/arm/mach-imx/clk-imx6.c | 306 ++ arch/arm/mach-imx/imx6.c |3 +- 3 files changed, 309 insertions(+), 2 deletions(-) create mode 100644 arch/arm/mach-imx/clk-imx6.c diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index db203e8..9d00c56 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -8,7 +8,7 @@ obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o clk-imx31.o obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o clk-imx5.o obj-$(CONFIG_ARCH_IMX53) += speed-imx53.o imx53.o iomux-v3.o imx5.o clk-imx5.o -obj-$(CONFIG_ARCH_IMX6) += speed-imx6.o imx6.o iomux-v3.o usb-imx6.o +obj-$(CONFIG_ARCH_IMX6) += speed-imx6.o imx6.o iomux-v3.o usb-imx6.o clk-imx6.o obj-$(CONFIG_IMX_CLKO) += clko.o obj-$(CONFIG_IMX_IIM) += iim.o obj-$(CONFIG_NAND_IMX) += nand.o diff --git a/arch/arm/mach-imx/clk-imx6.c b/arch/arm/mach-imx/clk-imx6.c new file mode 100644 index 000..bac35ed --- /dev/null +++ b/arch/arm/mach-imx/clk-imx6.c @@ -0,0 +1,306 @@ +/* + * Copyright 2011 Freescale Semiconductor, Inc. + * Copyright 2011 Linaro Ltd. + * + * The code contained herein is licensed under the GNU General Public + * License. You may obtain a copy of the GNU General Public License + * Version 2 or later at the following locations: + * + * http://www.opensource.org/licenses/gpl-license.html + * http://www.gnu.org/copyleft/gpl.html + */ + +#include common.h +#include init.h +#include driver.h +#include linux/clk.h +#include io.h +#include linux/clkdev.h +#include linux/err.h +#include mach/imx6-regs.h + +#include clk.h + +#define CCGR0 0x68 +#define CCGR1 0x6c +#define CCGR2 0x70 +#define CCGR3 0x74 +#define CCGR4 0x78 +#define CCGR5 0x7c +#define CCGR6 0x80 +#define CCGR7 0x84 + +#define CLPCR 0x54 +#define BP_CLPCR_LPM 0 +#define BM_CLPCR_LPM (0x3 0) +#define BM_CLPCR_BYPASS_PMIC_READY (0x1 2) +#define BM_CLPCR_ARM_CLK_DIS_ON_LPM(0x1 5) +#define BM_CLPCR_SBYOS (0x1 6) +#define BM_CLPCR_DIS_REF_OSC (0x1 7) +#define BM_CLPCR_VSTBY (0x1 8) +#define BP_CLPCR_STBY_COUNT9 +#define BM_CLPCR_STBY_COUNT(0x3 9) +#define BM_CLPCR_COSC_PWRDOWN (0x1 11) +#define BM_CLPCR_WB_PER_AT_LPM (0x1 16) +#define BM_CLPCR_WB_CORE_AT_LPM(0x1 17) +#define BM_CLPCR_BYP_MMDC_CH0_LPM_HS (0x1 19) +#define BM_CLPCR_BYP_MMDC_CH1_LPM_HS (0x1 21) +#define BM_CLPCR_MASK_CORE0_WFI(0x1 22) +#define BM_CLPCR_MASK_CORE1_WFI(0x1 23) +#define BM_CLPCR_MASK_CORE2_WFI(0x1 24) +#define BM_CLPCR_MASK_CORE3_WFI(0x1 25) +#define BM_CLPCR_MASK_SCU_IDLE (0x1 26) +#define BM_CLPCR_MASK_L2CC_IDLE(0x1 27) + +enum mx6q_clks { + dummy, ckil, ckih, osc, pll2_pfd0_352m, pll2_pfd1_594m, pll2_pfd2_396m, + pll3_pfd0_720m, pll3_pfd1_540m, pll3_pfd2_508m, pll3_pfd3_454m, + pll2_198m, pll3_120m, pll3_80m, pll3_60m, twd, step, pll1_sw, + periph_pre, periph2_pre, periph_clk2_sel, periph2_clk2_sel, axi_sel, + esai_sel, asrc_sel, spdif_sel, gpu2d_axi, gpu3d_axi, gpu2d_core_sel, + gpu3d_core_sel, gpu3d_shader_sel, ipu1_sel, ipu2_sel, ldb_di0_sel, + ldb_di1_sel, ipu1_di0_pre_sel, ipu1_di1_pre_sel, ipu2_di0_pre_sel, + ipu2_di1_pre_sel, ipu1_di0_sel, ipu1_di1_sel, ipu2_di0_sel, + ipu2_di1_sel, hsi_tx_sel, pcie_axi_sel, ssi1_sel, ssi2_sel, ssi3_sel, + usdhc1_sel, usdhc2_sel, usdhc3_sel, usdhc4_sel, enfc_sel, emi_sel, + emi_slow_sel, vdo_axi_sel, vpu_axi_sel, cko1_sel, periph, periph2, + periph_clk2, periph2_clk2, ipg, ipg_per, esai_pred, esai_podf, + asrc_pred, asrc_podf, spdif_pred, spdif_podf, can_root, ecspi_root, + gpu2d_core_podf, gpu3d_core_podf, gpu3d_shader, ipu1_podf, ipu2_podf, + ldb_di0_podf, ldb_di1_podf, ipu1_di0_pre, ipu1_di1_pre, ipu2_di0_pre, + ipu2_di1_pre, hsi_tx_podf, ssi1_pred, ssi1_podf, ssi2_pred, ssi2_podf, + ssi3_pred, ssi3_podf, uart_serial_podf, usdhc1_podf, usdhc2_podf, + usdhc3_podf, usdhc4_podf, enfc_pred, enfc_podf, emi_podf, + emi_slow_podf, vpu_axi_podf, cko1_podf, axi, mmdc_ch0_axi_podf, + mmdc_ch1_axi_podf, arm, ahb, apbh_dma, asrc, can1_ipg, can1_serial, + can2_ipg, can2_serial, ecspi1, ecspi2, ecspi3, ecspi4, ecspi5, enet, + esai, gpt_ipg, gpt_ipg_per, gpu2d_core, gpu3d_core, hdmi_iahb, + hdmi_isfr, i2c1, i2c2, i2c3, iim, enfc, ipu1, ipu1_di0, ipu1_di1, ipu2, + ipu2_di0,
[PATCH 23/23] ARM i.MX: Remove old clock support
The old clock support is now unused. Remove it. The former i.MX clko command is superseeded by generic clock manipulation commands. Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- arch/arm/mach-imx/Kconfig |8 - arch/arm/mach-imx/Makefile | 20 +- arch/arm/mach-imx/clko.c | 60 - arch/arm/mach-imx/clocksource.c|1 - arch/arm/mach-imx/include/mach/clock.h | 42 +--- arch/arm/mach-imx/speed-imx1.c | 91 --- arch/arm/mach-imx/speed-imx21.c| 193 --- arch/arm/mach-imx/speed-imx25.c| 155 arch/arm/mach-imx/speed-imx27.c| 227 -- arch/arm/mach-imx/speed-imx31.c| 79 --- arch/arm/mach-imx/speed-imx35.c| 255 arch/arm/mach-imx/speed-imx51.c| 311 arch/arm/mach-imx/speed-imx53.c| 236 --- arch/arm/mach-imx/speed-imx6.c | 404 arch/arm/mach-imx/speed.c | 82 --- drivers/mci/imx-esdhc.c|1 - drivers/serial/serial_imx.c|1 - drivers/spi/imx_spi.c |1 - drivers/video/imx.c|1 - 19 files changed, 10 insertions(+), 2158 deletions(-) delete mode 100644 arch/arm/mach-imx/clko.c delete mode 100644 arch/arm/mach-imx/speed-imx1.c delete mode 100644 arch/arm/mach-imx/speed-imx21.c delete mode 100644 arch/arm/mach-imx/speed-imx25.c delete mode 100644 arch/arm/mach-imx/speed-imx27.c delete mode 100644 arch/arm/mach-imx/speed-imx31.c delete mode 100644 arch/arm/mach-imx/speed-imx35.c delete mode 100644 arch/arm/mach-imx/speed-imx51.c delete mode 100644 arch/arm/mach-imx/speed-imx53.c delete mode 100644 arch/arm/mach-imx/speed-imx6.c delete mode 100644 arch/arm/mach-imx/speed.c diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig index 7ab812a..d27d4f3 100644 --- a/arch/arm/mach-imx/Kconfig +++ b/arch/arm/mach-imx/Kconfig @@ -552,14 +552,6 @@ endmenu menu i.MX specific settings -config IMX_CLKO - bool clko command - depends on ARCH_IMX21 || ARCH_IMX27 || ARCH_IMX35 || ARCH_IMX25 || ARCH_IMX51 - help - The i.MX SoCs have a Pin which can output different reference frequencies. - Say y here if you want to have the clko command which lets you select the - frequency to output on this pin. - config IMX_IIM tristate IIM fusebox device depends on !ARCH_IMX21 !ARCH_IMX21 diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile index f7a5ba4..e43f92e 100644 --- a/arch/arm/mach-imx/Makefile +++ b/arch/arm/mach-imx/Makefile @@ -1,20 +1,18 @@ obj-y += clocksource.o gpio.o obj-$(CONFIG_RESET_SOURCE) += reset_source.o -obj-$(CONFIG_ARCH_IMX1) += speed-imx1.o imx1.o iomux-v1.o clk-imx1.o -obj-$(CONFIG_ARCH_IMX25) += speed-imx25.o imx25.o iomux-v3.o clk-imx25.o -obj-$(CONFIG_ARCH_IMX21) += speed-imx21.o imx21.o iomux-v1.o clk-imx21.o -obj-$(CONFIG_ARCH_IMX27) += speed-imx27.o imx27.o iomux-v1.o clk-imx27.o -obj-$(CONFIG_ARCH_IMX31) += speed-imx31.o imx31.o iomux-v2.o clk-imx31.o -obj-$(CONFIG_ARCH_IMX35) += speed-imx35.o imx35.o iomux-v3.o clk-imx35.o -obj-$(CONFIG_ARCH_IMX51) += speed-imx51.o imx51.o iomux-v3.o imx5.o clk-imx5.o -obj-$(CONFIG_ARCH_IMX53) += speed-imx53.o imx53.o iomux-v3.o imx5.o clk-imx5.o -obj-$(CONFIG_ARCH_IMX6) += speed-imx6.o imx6.o iomux-v3.o usb-imx6.o clk-imx6.o -obj-$(CONFIG_IMX_CLKO) += clko.o +obj-$(CONFIG_ARCH_IMX1) += imx1.o iomux-v1.o clk-imx1.o +obj-$(CONFIG_ARCH_IMX25) += imx25.o iomux-v3.o clk-imx25.o +obj-$(CONFIG_ARCH_IMX21) += imx21.o iomux-v1.o clk-imx21.o +obj-$(CONFIG_ARCH_IMX27) += imx27.o iomux-v1.o clk-imx27.o +obj-$(CONFIG_ARCH_IMX31) += imx31.o iomux-v2.o clk-imx31.o +obj-$(CONFIG_ARCH_IMX35) += imx35.o iomux-v3.o clk-imx35.o +obj-$(CONFIG_ARCH_IMX51) += imx51.o iomux-v3.o imx5.o clk-imx5.o +obj-$(CONFIG_ARCH_IMX53) += imx53.o iomux-v3.o imx5.o clk-imx5.o +obj-$(CONFIG_ARCH_IMX6) += imx6.o iomux-v3.o usb-imx6.o clk-imx6.o obj-$(CONFIG_IMX_IIM) += iim.o obj-$(CONFIG_NAND_IMX) += nand.o obj-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o pbl-$(CONFIG_ARCH_IMX_EXTERNAL_BOOT_NAND) += external-nand-boot.o obj-$(CONFIG_COMMON_CLK) += clk-pllv1.o clk-pllv2.o clk-pllv3.o clk-pfd.o -obj-y += speed.o obj-y += devices.o obj-y += boot.o diff --git a/arch/arm/mach-imx/clko.c b/arch/arm/mach-imx/clko.c deleted file mode 100644 index aeafaa9..000 --- a/arch/arm/mach-imx/clko.c +++ /dev/null @@ -1,60 +0,0 @@ -#include common.h -#include command.h -#include getopt.h -#include mach/imx-regs.h -#include mach/clock.h - -static int do_clko(int argc, char *argv[]) -{ - int opt, div = 0, src = -2, num = 1, ret; - - while((opt = getopt(argc, argv, n:d:s:)) 0) { - switch(opt) { - case 'n': - num = simple_strtoul(optarg, NULL,
[PATCH 18/23] mci i.MX ESDHC: Switch to clock support
Signed-off-by: Sascha Hauer s.ha...@pengutronix.de --- drivers/mci/imx-esdhc.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/mci/imx-esdhc.c b/drivers/mci/imx-esdhc.c index 498578d..94ed807 100644 --- a/drivers/mci/imx-esdhc.c +++ b/drivers/mci/imx-esdhc.c @@ -28,6 +28,8 @@ #include mci.h #include clock.h #include io.h +#include linux/clk.h +#include linux/err.h #include asm/mmu.h #include mach/clock.h #include mach/generic.h @@ -70,6 +72,7 @@ struct fsl_esdhc_host { u32 no_snoop; unsigned long cur_clock; struct device_d *dev; + struct clk *clk; }; #define to_fsl_esdhc(mci) container_of(mci, struct fsl_esdhc_host, mci) @@ -354,7 +357,7 @@ static void set_sysctl(struct mci_host *mci, u32 clock) int div, pre_div; struct fsl_esdhc_host *host = to_fsl_esdhc(mci); struct fsl_esdhc __iomem *regs = host-regs; - int sdhc_clk = imx_get_mmcclk(); + int sdhc_clk = clk_get_rate(host-clk); u32 clk; if (clock mci-f_min) @@ -516,11 +519,16 @@ static int fsl_esdhc_probe(struct device_d *dev) struct mci_host *mci; u32 caps; int ret; + unsigned long rate; struct esdhc_platform_data *pdata = dev-platform_data; host = xzalloc(sizeof(*host)); mci = host-mci; + host-clk = clk_get(dev, NULL); + if (IS_ERR(host-clk)) + return PTR_ERR(host-clk); + host-dev = dev; host-regs = dev_request_mem_region(dev, 0); @@ -553,10 +561,11 @@ static int fsl_esdhc_probe(struct device_d *dev) host-mci.init = esdhc_init; host-mci.hw_dev = dev; - host-mci.f_min = imx_get_mmcclk() 12; + rate = clk_get_rate(host-clk); + host-mci.f_min = rate 12; if (host-mci.f_min 20) host-mci.f_min = 20; - host-mci.f_max = imx_get_mmcclk(); + host-mci.f_max = rate; mci_register(host-mci); -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 08/23] ARM i.MX5: Switch to common clk support
On Mon, Sep 24, 2012 at 01:04:37PM +0200, Sascha Hauer wrote: +{ + clks[pll1_sw] = imx_clk_pllv2(pll1_sw, osc, (void *)MX51_PLL1_BASE_ADDR); + clks[pll2_sw] = imx_clk_pllv2(pll2_sw, osc, (void *)MX51_PLL2_BASE_ADDR); + clks[pll3_sw] = imx_clk_pllv2(pll3_sw, osc, (void *)MX51_PLL2_BASE_ADDR); typo: Should be MX51_PLL3_BASE_ADDR. Will fix. 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 14/14] ARM i.MX25: Add function to setup chipselect
Hi Great series in general, nice cleanup! arch/arm/mach-imx/imx25.c |9 + arch/arm/mach-imx/include/mach/imx25-regs.h |6 +- arch/arm/mach-imx/include/mach/weim.h |3 +++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/arch/arm/mach-imx/imx25.c b/arch/arm/mach-imx/imx25.c index 3f44649..32c0412 100644 --- a/arch/arm/mach-imx/imx25.c +++ b/arch/arm/mach-imx/imx25.c @@ -16,8 +16,17 @@ #include mach/imx-regs.h #include mach/iim.h #include io.h +#include mach/weim.h #include sizes.h +void imx25_setup_weimcs(size_t cs, unsigned upper, unsigned lower, + unsigned additional) +{ + writel(upper, MX25_WEIM_BASE_ADDR + (cs * 0x10) + 0x0); + writel(lower, MX25_WEIM_BASE_ADDR + (cs * 0x10) + 0x4); + writel(additional, MX25_WEIM_BASE_ADDR + (cs * 0x10) + 0x8); +} + /* IIM fuse definitions */ #define IIM_BANK0_BASE (MX25_IIM_BASE_ADDR + 0x800) #define IIM_BANK1_BASE (MX25_IIM_BASE_ADDR + 0xc00) diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h index 8e7ff85..0bf6e11 100644 --- a/arch/arm/mach-imx/include/mach/imx25-regs.h +++ b/arch/arm/mach-imx/include/mach/imx25-regs.h @@ -137,11 +137,7 @@ #define MX25_CSD1_BASE_ADDR 0x9000 #define MX25_ESDCTL_BASE_ADDR 0xb8001000 - -#define WEIM_BASE 0xb8002000 -#define CSCR_U(x) (WEIM_BASE + (x) * 0x10) -#define CSCR_L(x) (WEIM_BASE + 4 + (x) * 0x10) -#define CSCR_A(x) (WEIM_BASE + 8 + (x) * 0x10) +#define MX25_WEIM_BASE_ADDR0xb8002000 /* * Watchdog Registers diff --git a/arch/arm/mach-imx/include/mach/weim.h b/arch/arm/mach-imx/include/mach/weim.h index 576f87c..8d572dc 100644 --- a/arch/arm/mach-imx/include/mach/weim.h +++ b/arch/arm/mach-imx/include/mach/weim.h @@ -10,6 +10,9 @@ void imx31_setup_weimcs(size_t cs, unsigned upper, unsigned lower, void imx35_setup_weimcs(size_t cs, unsigned upper, unsigned lower, unsigned additional); +void imx25_setup_weimcs(size_t cs, unsigned upper, unsigned lower, + unsigned additional); + void imx1_setup_eimcs(size_t cs, unsigned upper, unsigned lower); void imx21_setup_eimcs(size_t cs, unsigned upper, unsigned lower); This allows me to drop my ugly version of the WEIMCS setup from June based on imx27. Now, if only I got barebox to recognize the NOR on my platform :). diff --git a/arch/arm/mach-imx/include/mach/imx25-regs.h b/arch/arm/mach-imx/include/mach/imx25-regs.h index 73307c4..8225832 100644 --- a/arch/arm/mach-imx/include/mach/imx25-regs.h +++ b/arch/arm/mach-imx/include/mach/imx25-regs.h @@ -72,6 +72,7 @@ #define CCM_LTR1 0x44 #define CCM_LTR2 0x48 #define CCM_LTR3 0x4c +#define CCM_MCR0x64 #define PDR0_AUTO_MUX_DIV(x) (((x) 0x7) 9) #define PDR0_CCM_PER_AHB(x)(((x) 0x7) 12) @@ -107,6 +108,22 @@ #define CSCR_L(x) (WEIM_BASE + 4 + (x) * 0x10) #define CSCR_A(x) (WEIM_BASE + 8 + (x) * 0x10) +/* Chip Select Registers */ +#define IMX_WEIM_BASE WEIM_BASE +#define CSxU(x) __REG(IMX_WEIM_BASE + (cs * 0x10) + 0x00) /* Chip Select x Upper Register*/ +#define CSxL(x) __REG(IMX_WEIM_BASE + (cs * 0x10) + 0x04) /* Chip Select x Lower Register*/ +#define CSxA(x) __REG(IMX_WEIM_BASE + (cs * 0x10) + 0x08) /* Chip Select x Addition Register */ +#define EIM __REG(IMX_WEIM_BASE + 0x60) /* WEIM Configuration Register */ + +#ifndef __ASSEMBLY__ +static inline void imx25_setup_weimcs(size_t cs, unsigned upper, unsigned lower, unsigned addional) +{ +CSxU(cs) = upper; +CSxL(cs) = lower; +CSxA(cs) = addional; +} +#endif /* __ASSEMBLY__ */ + /* * Definitions for the clocksource driver * Cheers Roberto ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH] Makefile: add target to produce a SPL compatible uImage
Hello Jan, Am 20.09.2012 21:13, schrieb Jan Luebbe: This is mostly useful during the initial port of barebox to a new board which is supported by u-boot. It also allows starting barebox from a SRAM-based u-boot SPL. A different load address can be set like this: make barebox.uimage UIMAGE_BASE=0x8000 Also add barebox.ubl to CLEAN_FILES. Signed-off-by: Jan Luebbe j...@pengutronix.de --- I've carried this patch for some time and adjusted it to support PBL (compressed image), but have not had an opportunity to verify it again. Teresa, if you have some time to try it out, that would be very much appreciated. :) I have tested it with my am335x patches. And it worked so far. But I have not done anything with the pbl image, yet. Could you explain me what it's actually for? And how I can test it? Regards Teresa .gitignore |1 + Makefile | 19 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 4154c73..7e98a25 100644 --- a/.gitignore +++ b/.gitignore @@ -35,6 +35,7 @@ barebox.srec barebox.netx barebox.s5p barebox.ubl +barebox.uimage barebox.map System.map Module.symvers diff --git a/Makefile b/Makefile index 0f1a319..5cb4730 100644 --- a/Makefile +++ b/Makefile @@ -686,6 +686,22 @@ ifndef CONFIG_PBL_IMAGE $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) endif +# By default the uImage load address is 2MB below CONFIG_TEXT_BASE, +# leaving space for the compressed PBL image at 1MB below CONFIG_TEXT_BASE. +UIMAGE_BASE ?= $(shell printf 0x%08x $$(($(CONFIG_TEXT_BASE) - 0x20))) + +# For development provide a target which makes barebox loadable by an +# unmodified u-boot +quiet_cmd_barebox_mkimage = MKIMAGE $@ + cmd_barebox_mkimage = $(srctree)/scripts/mkimage -A $(ARCH) -T firmware -C none \ + -O barebox -a $(UIMAGE_BASE) -e $(UIMAGE_BASE) \ + -n barebox $(KERNELRELEASE) -d $ $@ + +# barebox.uimage is build from the raw barebox binary, without any other +# headers. +barebox.uimage: $(KBUILD_BINARY) FORCE + $(call if_changed,barebox_mkimage) + ifdef CONFIG_X86 barebox.S: barebox ifdef CONFIG_X86_HDBOOT @@ -1015,7 +1031,8 @@ CLEAN_FILES +=barebox System.map include/generated/barebox_default_env.h \ .tmp_version .tmp_barebox* barebox.bin barebox.map barebox.S \ .tmp_kallsyms* barebox_default_env* barebox.ldr \ scripts/bareboxenv-target barebox-flash-image \ - Doxyfile.version barebox.srec barebox.s5p + Doxyfile.version barebox.srec barebox.s5p barebox.ubl \ + barebox.uimage # Directories files removed with 'make mrproper' MRPROPER_DIRS += include/config include2 usr/include ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH] Makefile: add target to produce a SPL compatible uImage
On Mon, 2012-09-24 at 14:37 +0200, Teresa Gamez wrote: I have tested it with my am335x patches. And it worked so far. But I have not done anything with the pbl image, yet. Could you explain me what it's actually for? And how I can test it? Thanks! PBL stands for Pre-Bootloader Image, which is used to have a compressed barebox binary. You can enable it in General Settings - memory layout - Pre-Bootloader image. Regards, Jan -- 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
[RFC PATCH 0/5] switch globalvar to it's own bus
HI, The folowing patch serie switch the globalvar to it's onw bus and set of device. This will allow to reduce the time spend to search the right parameter especially when we have quite a lot's of globalvar. In this patch serie not all of the globalvar are converted but some fo them The one missingis the linux one The following changes since commit 6392955f283389fa4fecb0e2d5d1837bcb83f480: Merge branch 'for-next/testing-menu' into next (2012-09-20 23:11:42 +0200) are available in the git repository at: git://git.jcrosoft.org/barebox.git delivery/globalvar for you to fetch changes up to b17dcadf3ca3e8ffaa2cfcff69f7a2efef563e31: bootm: switch globalvar to it's own device (2012-09-24 11:13:02 +0800) Jean-Christophe PLAGNIOL-VILLARD (5): globalvar: add it's own bus globalvar: allow to register multiple device net: switch to global device dhcp: switch globalvar to it's own device bootm: switch globalvar to it's own device arch/arm/boards/at91rm9200ek/env/config |2 +- arch/arm/boards/at91sam9260ek/env/config|4 ++-- arch/arm/boards/at91sam9261ek/env/config|4 ++-- arch/arm/boards/at91sam9263ek/env/config|2 +- arch/arm/boards/at91sam9m10g45ek/env/config |2 +- arch/arm/boards/at91sam9x5ek/env/config |2 +- arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 |4 ++-- arch/arm/boards/freescale-mx53-loco/env/config |2 +- arch/arm/boards/pcm038/env/boot/nand-ubi|4 ++-- arch/arm/boards/qil-a9260/env/config|2 +- arch/arm/boards/tny-a926x/env/config|6 +++--- arch/arm/boards/usb-a926x/env/config|6 +++--- commands/bootm.c| 24 +++- common/globalvar.c | 86 ++ defaultenv-2/base/boot/initrd |6 +++--- defaultenv-2/base/boot/net |4 ++-- defaultenv-2/base/data/boot-template|6 +++--- defaultenv-2/base/network/eth0 |2 +- defaultenv/bin/boot | 12 ++-- defaultenv/config |2 +- include/globalvar.h | 26 ++ net/dhcp.c | 58 +- net/net.c | 15 +++ 23 files changed, 171 insertions(+), 110 deletions(-) Best Regards, J. ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/5] globalvar: add it's own bus
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- common/globalvar.c | 13 + 1 file changed, 13 insertions(+) diff --git a/common/globalvar.c b/common/globalvar.c index a8aaa72..6bf2332 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -66,8 +66,21 @@ int globalvar_add_simple(const char *name) return globalvar_add(name, NULL, NULL, 0); } +static int global_match(struct device_d *dev, struct driver_d *drv) +{ + return 1; +} + +static struct bus_type global_bus = { + .name = global, + .match = global_match, + .probe = dummy_probe, +}; + static int globalvar_init(void) { + bus_register(global_bus); + global_device.bus = global_bus; register_device(global_device); return 0; -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 3/5] net: switch to global device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- net/net.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/net/net.c b/net/net.c index 3ac098f..6455b18 100644 --- a/net/net.c +++ b/net/net.c @@ -35,6 +35,7 @@ #include init.h #include linux/ctype.h #include linux/err.h +#include globalvar.h static IPaddr_tnet_netmask;/* Our subnet mask (0=unknown) */ static IPaddr_tnet_gateway;/* Our gateways IP address */ @@ -664,21 +665,19 @@ out: return ret; } -static struct device_d net_device = { - .name = net, - .id = DEVICE_ID_SINGLE, -}; - static int net_init(void) { + struct device_d *dev; int i; for (i = 0; i PKTBUFSRX; i++) NetRxPackets[i] = net_alloc_packet(); - register_device(net_device); - dev_add_param(net_device, nameserver, NULL, NULL, 0); - dev_add_param(net_device, domainname, NULL, NULL, 0); + dev = global_add_device(net); + if (dev) { + global_add_simple(dev, nameserver); + global_add_simple(dev, domainname); + } return 0; } -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 5/5] bootm: switch globalvar to it's own device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- .../boards/crystalfontz-cfa10036/env/boot/mmc-ext3 |4 ++-- arch/arm/boards/pcm038/env/boot/nand-ubi |4 ++-- commands/bootm.c | 24 defaultenv-2/base/boot/initrd |6 ++--- defaultenv-2/base/boot/net |4 ++-- defaultenv-2/base/data/boot-template |6 ++--- 6 files changed, 27 insertions(+), 21 deletions(-) diff --git a/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 b/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 index 7d7eb50..163c2fe 100644 --- a/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 +++ b/arch/arm/boards/crystalfontz-cfa10036/env/boot/mmc-ext3 @@ -5,6 +5,6 @@ if [ $1 = menu ]; then exit fi -global.bootm.image=/mnt/disk0.1/zImage-cfa10036 -global.bootm.oftree=/mnt/disk0.1/oftree-cfa10036 +bootm.image=/mnt/disk0.1/zImage-cfa10036 +bootm.oftree=/mnt/disk0.1/oftree-cfa10036 bootargs-root-ext -r 3 -m mmcblk0p3 diff --git a/arch/arm/boards/pcm038/env/boot/nand-ubi b/arch/arm/boards/pcm038/env/boot/nand-ubi index a3f748e..81a4397 100644 --- a/arch/arm/boards/pcm038/env/boot/nand-ubi +++ b/arch/arm/boards/pcm038/env/boot/nand-ubi @@ -5,6 +5,6 @@ if [ $1 = menu ]; then exit fi -global.bootm.image=/dev/nand0.kernel.bb -#global.bootm.oftree=/env/oftree +bootm.image=/dev/nand0.kernel.bb +#bootm.oftree=/env/oftree bootargs-root-ubi -r root -m nand0.root diff --git a/commands/bootm.c b/commands/bootm.c index 8e51695..c0180d4 100644 --- a/commands/bootm.c +++ b/commands/bootm.c @@ -48,6 +48,12 @@ #include asm-generic/memory_layout.h static LIST_HEAD(handler_list); +static device_d *bootm_dev; + +static const char* bootm_get_global(const char * var) +{ + return dev_get_param(bootm_dev, var); +} int register_image_handler(struct image_handler *handler) { @@ -267,10 +273,10 @@ static int do_bootm(int argc, char *argv[]) data.verify = 0; data.verbose = 0; - oftree = getenv(global.bootm.oftree); - os_file = getenv(global.bootm.image); + oftree = bootm_get_global(oftree); + os_file = bootm_get_global(image); if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) - initrd_file = getenv(global.bootm.initrd); + initrd_file = bootm_get_global(initrd); while ((opt = getopt(argc, argv, BOOTM_OPTS)) 0) { switch(opt) { @@ -440,11 +446,11 @@ err_out: static int bootm_init(void) { - - globalvar_add_simple(bootm.image); - globalvar_add_simple(bootm.oftree); + bootm_dev = global_add_device(bootm); + global_add_simple(bootm_dev, image); + global_add_simple(bootm_dev, oftree); if (IS_ENABLED(CONFIG_CMD_BOOTM_INITRD)) - globalvar_add_simple(bootm.initrd); + global_add_simple(bootm_dev, initrd); return 0; } @@ -475,8 +481,8 @@ BAREBOX_CMD_START(bootm) BAREBOX_CMD_END BAREBOX_MAGICVAR(bootargs, Linux Kernel parameters); -BAREBOX_MAGICVAR_NAMED(global_bootm_image, global.bootm.image, bootm default boot image); -BAREBOX_MAGICVAR_NAMED(global_bootm_initrd, global.bootm.initrd, bootm default initrd); +BAREBOX_MAGICVAR_NAMED(bootm_image, bootm.image, bootm default boot image); +BAREBOX_MAGICVAR_NAMED(bootm_initrd, bootm.initrd, bootm default initrd); static struct binfmt_hook binfmt_uimage_hook = { .type = filetype_uimage, diff --git a/defaultenv-2/base/boot/initrd b/defaultenv-2/base/boot/initrd index 7c44d07..6bfc11c 100644 --- a/defaultenv-2/base/boot/initrd +++ b/defaultenv-2/base/boot/initrd @@ -6,10 +6,10 @@ if [ $1 = menu ]; then fi path=/mnt/tftp -global.bootm.image=${path}/${global.user}-linux-${global.hostname} -global.bootm.initrd=${path}/initramfs +bootm.image=${path}/${global.user}-linux-${global.hostname} +bootm.initrd=${path}/initramfs bootargs-root-initrd -#global.bootm.oftree=path to oftree +#bootm.oftree=path to oftree global.linux.bootargs.dyn.root=root=/dev/ram0 diff --git a/defaultenv-2/base/boot/net b/defaultenv-2/base/boot/net index 922bef1..5cc9823 100644 --- a/defaultenv-2/base/boot/net +++ b/defaultenv-2/base/boot/net @@ -7,8 +7,8 @@ fi path=/mnt/tftp -global.bootm.image=${path}/${global.user}-linux-${global.hostname} -#global.bootm.oftree=${path}/${global.user}-oftree-${global.hostname} +bootm.image=${path}/${global.user}-linux-${global.hostname} +#bootm.oftree=${path}/${global.user}-oftree-${global.hostname} nfsroot=/home/${global.user}/nfsroot/${global.hostname} bootargs-ip bootargs-root-nfs -n $nfsroot diff --git a/defaultenv-2/base/data/boot-template b/defaultenv-2/base/data/boot-template index 1cacf18..d57c852 100644 --- a/defaultenv-2/base/data/boot-template +++ b/defaultenv-2/base/data/boot-template @@ -5,9 +5,9 @@ if [ $1 = menu ]; then exit fi -global.bootm.image=path to image -#global.bootm.oftree=path
[PATCH 2/5] globalvar: allow to register multiple device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- common/globalvar.c | 77 +++ include/globalvar.h | 26 + 2 files changed, 85 insertions(+), 18 deletions(-) diff --git a/common/globalvar.c b/common/globalvar.c index 6bf2332..19e4a17 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -3,33 +3,30 @@ #include globalvar.h #include init.h -static struct device_d global_device = { - .name = global, - .id = DEVICE_ID_SINGLE, -}; +static struct device_d *global_device; int globalvar_add(const char *name, int (*set)(struct device_d *dev, struct param_d *p, const char *val), const char *(*get)(struct device_d *, struct param_d *p), unsigned long flags) { - return dev_add_param(global_device, name, set, get, flags); + return dev_add_param(global_device, name, set, get, flags); } /* - * globalvar_get_match + * global_get_match * - * get a concatenated string of all globalvars beginning with 'match'. - * This adds whitespaces between the different globalvars + * get a concatenated string of all global vars beginning with 'match'. + * This adds whitespaces between the different global vars */ -char *globalvar_get_match(const char *match, const char *seperator) +char *global_get_match(struct device_d *dev, const char *match, const char *seperator) { char *val = NULL; struct param_d *param; - list_for_each_entry(param, global_device.parameters, list) { + list_for_each_entry(param, dev-parameters, list) { if (!strncmp(match, param-name, strlen(match))) { - const char *p = dev_get_param(global_device, param-name); + const char *p = dev_get_param(dev, param-name); if (val) { char *new = asprintf(%s%s%s, val, seperator, p); free(val); @@ -46,16 +43,42 @@ char *globalvar_get_match(const char *match, const char *seperator) return val; } -void globalvar_set_match(const char *match, const char *val) +/* + * globalvar_get_match + * + * get a concatenated string of all globalvars beginning with 'match'. + * This adds whitespaces between the different globalvars + */ +char *globalvar_get_match(const char *match, const char *seperator) +{ + return global_get_match(global_device, match, seperator); +} + +void global_set_match(struct device_d *dev, const char *match, const char *val) { struct param_d *param; - list_for_each_entry(param, global_device.parameters, list) { + list_for_each_entry(param, dev-parameters, list) { if (!strncmp(match, param-name, strlen(match))) - dev_set_param(global_device, param-name, val); + dev_set_param(dev, param-name, val); } } +void globalvar_set_match(const char *match, const char *val) +{ + global_set_match(global_device, match, val); +} + +/* + * global_add_simple + * + * add a new global named 'name' + */ +int global_add_simple(struct device_d *dev, const char *name) +{ + return dev_add_param(dev, name, NULL, NULL, 0); +} + /* * globalvar_add_simple * @@ -63,7 +86,7 @@ void globalvar_set_match(const char *match, const char *val) */ int globalvar_add_simple(const char *name) { - return globalvar_add(name, NULL, NULL, 0); + return global_add_simple(global_device, name); } static int global_match(struct device_d *dev, struct driver_d *drv) @@ -77,12 +100,30 @@ static struct bus_type global_bus = { .probe = dummy_probe, }; +struct device_d *global_add_device(const char *name) +{ + struct device_d *dev; + + dev = xzalloc(sizeof(*dev)); + strcpy(dev-name, name); + dev-id = DEVICE_ID_SINGLE; + dev-bus = global_bus; + + register_device(dev); + + return dev; +} + static int globalvar_init(void) { - bus_register(global_bus); - global_device.bus = global_bus; - register_device(global_device); + global_device = global_add_device(global); return 0; } postconsole_initcall(globalvar_init); + +static int global_bus_init(void) +{ + return bus_register(global_bus); +} +pure_initcall(global_bus_init); diff --git a/include/globalvar.h b/include/globalvar.h index ddf885f..c1d73c4 100644 --- a/include/globalvar.h +++ b/include/globalvar.h @@ -2,6 +2,7 @@ #define __GLOBALVAR_H #ifdef CONFIG_GLOBALVAR +struct device_d *global_add_device(const char *name); int globalvar_add_simple(const char *name); int globalvar_add(const char *name, @@ -10,6 +11,13 @@ int globalvar_add(const char *name, unsigned long flags); char *globalvar_get_match(const char *match, const char *seperator); void globalvar_set_match(const char *match, const char *val); + +struct device_d *global_add_device(const char
[PATCH 4/5] dhcp: switch globalvar to it's own device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- arch/arm/boards/at91rm9200ek/env/config|2 +- arch/arm/boards/at91sam9260ek/env/config |4 +- arch/arm/boards/at91sam9261ek/env/config |4 +- arch/arm/boards/at91sam9263ek/env/config |2 +- arch/arm/boards/at91sam9m10g45ek/env/config|2 +- arch/arm/boards/at91sam9x5ek/env/config|2 +- arch/arm/boards/freescale-mx53-loco/env/config |2 +- arch/arm/boards/qil-a9260/env/config |2 +- arch/arm/boards/tny-a926x/env/config |6 +-- arch/arm/boards/usb-a926x/env/config |6 +-- defaultenv-2/base/network/eth0 |2 +- defaultenv/bin/boot| 12 ++--- defaultenv/config |2 +- net/dhcp.c | 58 +++- 14 files changed, 41 insertions(+), 65 deletions(-) diff --git a/arch/arm/boards/at91rm9200ek/env/config b/arch/arm/boards/at91rm9200ek/env/config index a3830cb..8ef28f5 100644 --- a/arch/arm/boards/at91rm9200ek/env/config +++ b/arch/arm/boards/at91rm9200ek/env/config @@ -3,7 +3,7 @@ # use 'dhcp' to do dhcp in barebox and in kernel # use 'none' if you want to skip kernel ip autoconfiguration ip=dhcp-barebox -global.dhcp.vendor_id=barebox-at91rm9200ek +dhcp.vendor_id=barebox-at91rm9200ek # or set your networking parameters here #eth0.ipaddr=a.b.c.d diff --git a/arch/arm/boards/at91sam9260ek/env/config b/arch/arm/boards/at91sam9260ek/env/config index 8e88186..53720ae 100644 --- a/arch/arm/boards/at91sam9260ek/env/config +++ b/arch/arm/boards/at91sam9260ek/env/config @@ -6,9 +6,9 @@ ip=dhcp-barebox if [ x$armlinux_architecture = x1099 ] then - global.dhcp.vendor_id=barebox-at91sam9260ek + dhcp.vendor_id=barebox-at91sam9260ek else - global.dhcp.vendor_id=barebox-at91sam9g20ek + dhcp.vendor_id=barebox-at91sam9g20ek fi # or set your networking parameters here diff --git a/arch/arm/boards/at91sam9261ek/env/config b/arch/arm/boards/at91sam9261ek/env/config index 7d85577..bc7626e 100644 --- a/arch/arm/boards/at91sam9261ek/env/config +++ b/arch/arm/boards/at91sam9261ek/env/config @@ -6,9 +6,9 @@ ip=dhcp-barebox if [ x$armlinux_architecture = x848 ] then - global.dhcp.vendor_id=barebox-at91sam9261ek + dhcp.vendor_id=barebox-at91sam9261ek else - global.dhcp.vendor_id=barebox-at91sam9g10ek + dhcp.vendor_id=barebox-at91sam9g10ek fi # or set your networking parameters here diff --git a/arch/arm/boards/at91sam9263ek/env/config b/arch/arm/boards/at91sam9263ek/env/config index 5125020..60e38e5 100644 --- a/arch/arm/boards/at91sam9263ek/env/config +++ b/arch/arm/boards/at91sam9263ek/env/config @@ -3,7 +3,7 @@ # use 'dhcp' to do dhcp in barebox and in kernel # use 'none' if you want to skip kernel ip autoconfiguration ip=dhcp-barebox -global.dhcp.vendor_id=barebox-at91sam9263ek +dhcp.vendor_id=barebox-at91sam9263ek # or set your networking parameters here #eth0.ipaddr=a.b.c.d diff --git a/arch/arm/boards/at91sam9m10g45ek/env/config b/arch/arm/boards/at91sam9m10g45ek/env/config index 54ed2cb..a112a1a 100644 --- a/arch/arm/boards/at91sam9m10g45ek/env/config +++ b/arch/arm/boards/at91sam9m10g45ek/env/config @@ -3,7 +3,7 @@ # use 'dhcp' to do dhcp in barebox and in kernel # use 'none' if you want to skip kernel ip autoconfiguration ip=dhcp-barebox -global.dhcp.vendor_id=barebox-at91sam9m10g45ek +dhcp.vendor_id=barebox-at91sam9m10g45ek # or set your networking parameters here #eth0.ipaddr=a.b.c.d diff --git a/arch/arm/boards/at91sam9x5ek/env/config b/arch/arm/boards/at91sam9x5ek/env/config index 6a985ce..3e024ed 100644 --- a/arch/arm/boards/at91sam9x5ek/env/config +++ b/arch/arm/boards/at91sam9x5ek/env/config @@ -3,7 +3,7 @@ # use 'dhcp' to do dhcp in barebox and in kernel # use 'none' if you want to skip kernel ip autoconfiguration ip=dhcp-barebox -global.dhcp.vendor_id=barebox-at91sam9x5ek +dhcp.vendor_id=barebox-at91sam9x5ek # or set your networking parameters here #eth0.ipaddr=a.b.c.d diff --git a/arch/arm/boards/freescale-mx53-loco/env/config b/arch/arm/boards/freescale-mx53-loco/env/config index 2ab1268..43979a3 100644 --- a/arch/arm/boards/freescale-mx53-loco/env/config +++ b/arch/arm/boards/freescale-mx53-loco/env/config @@ -7,7 +7,7 @@ user= # use 'dhcp' to do dhcp in barebox and in kernel # use 'none' if you want to skip kernel ip autoconfiguration ip=dhcp -global.dhcp.vendor_id=barebox-mx53-loco +dhcp.vendor_id=barebox-mx53-loco # or set your networking parameters here #eth0.ipaddr=a.b.c.d diff --git a/arch/arm/boards/qil-a9260/env/config b/arch/arm/boards/qil-a9260/env/config index 9971106..e0e2a9f 100644 --- a/arch/arm/boards/qil-a9260/env/config +++ b/arch/arm/boards/qil-a9260/env/config @@ -3,7 +3,7 @@ # use 'dhcp' to do dhcp in barebox and in kernel # use 'none' if you want to skip kernel ip
Re: [PATCH 0/1 v7] net: introduce phylib
On Mon, Sep 24, 2012 at 11:31:22AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: HI, v7: - drop the duplicate platform_data for fec driver as we need to update both with the same data (piss me off) Already fixed this up. Is there anything else why I should use this version instead of the one currently in -next? 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 2/2] ARM OMAP: switch to gpiolib support
Hi Teresa, On Mon, Sep 24, 2012 at 10:59:36AM +0200, Teresa Gámez wrote: Signed-off-by: Teresa Gámez t.ga...@phytec.de Nice cleanup. Applied, thanks Sascha --- arch/arm/Kconfig |1 + arch/arm/mach-omap/gpio.c | 171 --- arch/arm/mach-omap/omap3_generic.c | 19 arch/arm/mach-omap/omap4_generic.c | 19 4 files changed, 117 insertions(+), 93 deletions(-) diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig index a54ad03..7b7b058 100644 --- a/arch/arm/Kconfig +++ b/arch/arm/Kconfig @@ -58,6 +58,7 @@ config ARCH_NOMADIK config ARCH_OMAP bool TI OMAP select HAS_DEBUG_LL + select GPIOLIB config ARCH_PXA bool Intel/Marvell PXA based diff --git a/arch/arm/mach-omap/gpio.c b/arch/arm/mach-omap/gpio.c index 142cf52..d217550 100644 --- a/arch/arm/mach-omap/gpio.c +++ b/arch/arm/mach-omap/gpio.c @@ -36,11 +36,10 @@ * published by the Free Software Foundation. */ #include common.h -#include mach/gpio.h #include io.h #include errno.h - -#ifdef CONFIG_ARCH_OMAP3 +#include gpio.h +#include init.h #define OMAP_GPIO_OE 0x0034 #define OMAP_GPIO_DATAIN 0x0038 @@ -48,129 +47,115 @@ #define OMAP_GPIO_CLEARDATAOUT 0x0090 #define OMAP_GPIO_SETDATAOUT 0x0094 -static void __iomem *gpio_bank[] = { - (void *)0x4831, - (void *)0x4905, - (void *)0x49052000, - (void *)0x49054000, - (void *)0x49056000, - (void *)0x49058000, -}; -#endif - -#ifdef CONFIG_ARCH_OMAP4 - -#define OMAP_GPIO_OE 0x0134 -#define OMAP_GPIO_DATAIN 0x0138 -#define OMAP_GPIO_DATAOUT0x013c -#define OMAP_GPIO_CLEARDATAOUT 0x0190 -#define OMAP_GPIO_SETDATAOUT 0x0194 - -static void __iomem *gpio_bank[] = { - (void *)0x4a31, - (void *)0x48055000, - (void *)0x48057000, - (void *)0x48059000, - (void *)0x4805b000, - (void *)0x4805d000, +struct omap_gpio_chip { + void __iomem *base; + struct gpio_chip chip; }; -#endif - -static inline void __iomem *get_gpio_base(int gpio) -{ - return gpio_bank[gpio 5]; -} -static inline int get_gpio_index(int gpio) +static inline int omap_get_gpio_index(int gpio) { return gpio 0x1f; } -static inline int gpio_valid(int gpio) +static void omap_gpio_set_value(struct gpio_chip *chip, + unsigned gpio, int value) { - if (gpio 0) - return -1; - if (gpio / 32 ARRAY_SIZE(gpio_bank)) - return 0; - return -1; -} - -static int check_gpio(int gpio) -{ - if (gpio_valid(gpio) 0) { - printf(ERROR : check_gpio: invalid GPIO %d\n, gpio); - return -1; - } - return 0; -} - -void gpio_set_value(unsigned gpio, int value) -{ - void __iomem *reg; + struct omap_gpio_chip *omapgpio = + container_of(chip, struct omap_gpio_chip, chip); + void __iomem *base = omapgpio-base; u32 l = 0; - if (check_gpio(gpio) 0) - return; - - reg = get_gpio_base(gpio); - if (value) - reg += OMAP_GPIO_SETDATAOUT; + base += OMAP_GPIO_SETDATAOUT; else - reg += OMAP_GPIO_CLEARDATAOUT; - l = 1 get_gpio_index(gpio); + base += OMAP_GPIO_CLEARDATAOUT; + + l = 1 omap_get_gpio_index(gpio); - __raw_writel(l, reg); + writel(l, base); } -int gpio_direction_input(unsigned gpio) +static int omap_gpio_direction_input(struct gpio_chip *chip, + unsigned gpio) { - void __iomem *reg; + struct omap_gpio_chip *omapgpio = + container_of(chip, struct omap_gpio_chip, chip); + void __iomem *base = omapgpio-base; u32 val; - if (check_gpio(gpio) 0) - return -EINVAL; - - reg = get_gpio_base(gpio); - - reg += OMAP_GPIO_OE; + base += OMAP_GPIO_OE; - val = __raw_readl(reg); - val |= 1 get_gpio_index(gpio); - __raw_writel(val, reg); + val = readl(base); + val |= 1 omap_get_gpio_index(gpio); + writel(val, base); return 0; } -int gpio_direction_output(unsigned gpio, int value) +static int omap_gpio_direction_output(struct gpio_chip *chip, + unsigned gpio, int value) { - void __iomem *reg; + struct omap_gpio_chip *omapgpio = + container_of(chip, struct omap_gpio_chip, chip); + void __iomem *base = omapgpio-base; u32 val; - if (check_gpio(gpio) 0) - return -EINVAL; - reg = get_gpio_base(gpio); + omap_gpio_set_value(chip, gpio, value); - gpio_set_value(gpio, value); + base += OMAP_GPIO_OE; - reg += OMAP_GPIO_OE; - - val = __raw_readl(reg); - val = ~(1 get_gpio_index(gpio)); -
[for next PATCH 1/1] macb: fix typos in the phy_interface
the RMII is set a RGMII and the flags are only check if MII Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- drivers/net/macb.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 15548cf..64970ba 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c @@ -439,13 +439,13 @@ static int macb_probe(struct device_d *dev) macb-miibus.priv = macb; macb-miibus.parent = dev; - if (pdata-flags AT91SAM_ETHER_RMII) { - macb-interface = PHY_INTERFACE_MODE_RGMII; - } else { + if (pdata-flags AT91SAM_ETHER_RMII) + macb-interface = PHY_INTERFACE_MODE_RMII; + else macb-interface = PHY_INTERFACE_MODE_MII; - macb-phy_flags = pdata-flags AT91SAM_ETHER_FORCE_LINK ? + + macb-phy_flags = pdata-flags AT91SAM_ETHER_FORCE_LINK ? PHYLIB_FORCE_LINK : 0; - } macb-rx_buffer = dma_alloc_coherent(CFG_MACB_RX_BUFFER_SIZE); macb-rx_ring = dma_alloc_coherent(CFG_MACB_RX_RING_SIZE * sizeof(struct macb_dma_desc)); -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [PATCH 0/1 v7] net: introduce phylib
On 21:20 Mon 24 Sep , Sascha Hauer wrote: On Mon, Sep 24, 2012 at 11:31:22AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: HI, v7: - drop the duplicate platform_data for fec driver as we need to update both with the same data (piss me off) Already fixed this up. Is there anything else why I should use this version instead of the one currently in -next? there is a fix for at91_ether IIRC I just send a fix for macb if you can squash them will be nice Best Regards, J. ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[For next PATCH 1/1] defaultenv: fix typo in dhco bootp oftree
it's global.dhcp.oftree Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- defaultenv/bin/boot |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/defaultenv/bin/boot b/defaultenv/bin/boot index 4e2056e..c17ccdb 100644 --- a/defaultenv/bin/boot +++ b/defaultenv/bin/boot @@ -51,7 +51,7 @@ if [ x$ip = xdhcp -o x$ip = xdhcp-barebox ]; then kernelimage=${global.dhcp.bootfile} fi if [ x$global.dhcp.oftree_file} != x ]; then - oftreeimage=${global.dhcp_oftree_file} + oftreeimage=${global.dhcp.oftree_file} fi fi fi -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[RFC][PATCH] archosg9: add support for tablet
Hello, this is my first contribution, so I'm basically requesting for comments. The attached patch adds support for Archos G9 tablet wich uses an OMAP4460 cpu. The tablet by default only boots from internal flash, so to test barebox on it a hardware tweak is required: change the sys_boot configuration. Once done the tablet can be booted with the following command: sudo scripts/usbboot first_stage rootfs The patch contains 1.- specific changes for OMAP4460 2.- support for usb-booting 3.- support for console on usb 4.- support for file transfer through usb 5.- some minor bug fixes 6.- adds support for archosg9 board A question I have is what does omap_vector_init do? It breaks usb-booting. In any case the patch should be tested with other boards to check it does not breaks something. The patch applies against 1af6fdcd03dbc311d785625bd6e2329f7ce1adb7. Thanks, vicencb archosg9.diff.gz Description: GNU Zip compressed data ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
Re: [RFC][PATCH] archosg9: add support for tablet
On 01:37 Tue 25 Sep , vj wrote: Hello, A this is my first contribution, so I'm basically requesting for comments. The attached patch adds support for Archos G9 tablet wich uses an OMAP4460 cpu. The tablet by default only boots from internal flash, so to test barebox on it a hardware tweak is required: change the sys_boot configuration. Once done the tablet can be booted with the following command: A sudo scripts/usbboot first_stage rootfs The patch contains A 1.- specific changes for OMAP4460 A 2.- support for usb-booting A 3.- support for console on usb A 4.- support for file transfer through usb A 5.- some minor bug fixes A 6.- adds support for archosg9 board A question I have is what does omap_vector_init do? It breaks usb-booting. In any case the patch should be tested with other boards to check it does not breaks something. The patch applies against 1af6fdcd03dbc311d785625bd6e2329f7ce1adb7. can you resend your patch splitted in multiple patch (6 1 patchper topic) via git email as example so we can review it Best Regaards, J. ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox
[PATCH 1/1] defaultenv-2: move settings in a submenu
To be more clear so on the mainmenu we will just have - the boot option - settings - shell - reset Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD plagn...@jcrosoft.com --- defaultenv-2/menu/menu/mainmenu |5 + defaultenv-2/menu/menu/settings | 21 + 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 defaultenv-2/menu/menu/settings diff --git a/defaultenv-2/menu/menu/mainmenu b/defaultenv-2/menu/menu/mainmenu index 5bd7027..f10f67a 100644 --- a/defaultenv-2/menu/menu/mainmenu +++ b/defaultenv-2/menu/menu/mainmenu @@ -14,10 +14,7 @@ while true; do boot-entries-collect - menu -e -a -R -m boot -c $global.editcmd /env/network/eth0 -d Network settings - menu -e -a -m boot -c boot-entries-edit -d Edit boot entries - menu -e -a -m boot -c init-entries-edit -d Edit init entries - menu -e -a -R -m boot -c saveenv || echo \failed to save environment\ sleep 2 -d Save settings + menu -e -a -m boot -c settings -d Settings menu -e -a -m boot -c 'PATH=$savepath; echo enter exit to return to menu; sh' -d ${DARK_YELLOW}Shell${NC} menu -e -a -m boot -c reset -d ${RED}Reset${NC} diff --git a/defaultenv-2/menu/menu/settings b/defaultenv-2/menu/menu/settings new file mode 100644 index 000..3f84b03 --- /dev/null +++ b/defaultenv-2/menu/menu/settings @@ -0,0 +1,21 @@ +#!/bin/sh + +export menu_exit=false + +while true; do + menu -a -m settings -d ${CYAN}Settings${NC} + + menu -e -a -R -m settings -c $global.editcmd /env/network/eth0 -d Network settings + + menu -e -a -m settings -c boot-entries-edit -d Edit boot entries + menu -e -a -m settings -c init-entries-edit -d Edit init entries + menu -e -a -R -m settings -c saveenv || echo \failed to save environment\ sleep 2 -d Save settings + menu -e -a -m settings -c menu_exit=true -d back + + menu -s -m settings + menu -r -m settings + + if [ $menu_exit = true ]; then + exit + fi +done -- 1.7.10.4 ___ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox