ARM: LPC32xx: Misc arch updates and fixes
Subsystems (3)
This patch series fixes several small issues with the LPC32xx Linux support:
LPC definition fixes
Remove un-needed code from IRQ ack handler
Fix GPIO 3 IN bit mask
Change AMBA pre and post clock init for AMBA registration Add a workaround for LCD register access prior to clock enable Remove un-needed local MMC clock enable code
Fix up I2S device ID name for clock registration
The LPC32xx will thrown an ARM exception if an attempt is made to access a peripheral register set without the clocks enabled. Patch 5 (workaround for LCD register access) is needed to work around an issue with the LCD driver. During the AMBA PL11x driver init, an access is made to the peripheral registers while the clock is disabled. This workaround prevents an exception during init.
The series can be pulled from:
git://git.lpclinux.com/linux-2.6-lpc wells/lpc32xx-arch_up1
PATCH 1/7 ARM: LPC32xx: Fix naming convention issues with some defines
From: Kevin Wells <[email protected]>
Some platform defines were prefixed with LCP instead of LPC. This has been corrected.
--- arch/arm/mach-lpc32xx/include/mach/platform.h | 48 ++++++++++++------------ arch/arm/mach-lpc32xx/timer.c | 46 ++++++++++++------------ 2 files changed, 47 insertions(+), 47 deletions(-)
arch/arm/mach-lpc32xx/include/mach/platform.h +24 -24
@@ -591,42 +591,42 @@/* * Timer/counter register offsets */ -#define LCP32XX_TIMER_IR (x) io_p2v((x) + 0x00) -#define LCP32XX_TIMER_TCR (x) io_p2v((x) + 0x04) -#define LCP32XX_TIMER_TC (x) io_p2v((x) + 0x08) -#define LCP32XX_TIMER_PR (x) io_p2v((x) + 0x0C) -#define LCP32XX_TIMER_PC (x) io_p2v((x) + 0x10) -#define LCP32XX_TIMER_MCR (x) io_p2v((x) + 0x14) -#define LCP32XX_TIMER_MR0 (x) io_p2v((x) + 0x18) -#define LCP32XX_TIMER_MR1 (x) io_p2v((x) + 0x1C) -#define LCP32XX_TIMER_MR2 (x) io_p2v((x) + 0x20) -#define LCP32XX_TIMER_MR3 (x) io_p2v((x) + 0x24) -#define LCP32XX_TIMER_CCR (x) io_p2v((x) + 0x28) -#define LCP32XX_TIMER_CR0 (x) io_p2v((x) + 0x2C) -#define LCP32XX_TIMER_CR1 (x) io_p2v((x) + 0x30) -#define LCP32XX_TIMER_CR2 (x) io_p2v((x) + 0x34) -#define LCP32XX_TIMER_CR3 (x) io_p2v((x) + 0x38) -#define LCP32XX_TIMER_EMR (x) io_p2v((x) + 0x3C) -#define LCP32XX_TIMER_CTCR (x) io_p2v((x) + 0x70) +#define LPC32XX_TIMER_IR (x) io_p2v((x) + 0x00) +#define LPC32XX_TIMER_TCR (x) io_p2v((x) + 0x04) +#define LPC32XX_TIMER_TC (x) io_p2v((x) + 0x08) +#define LPC32XX_TIMER_PR (x) io_p2v((x) + 0x0C) +#define LPC32XX_TIMER_PC (x) io_p2v((x) + 0x10) +#define LPC32XX_TIMER_MCR (x) io_p2v((x) + 0x14) +#define LPC32XX_TIMER_MR0 (x) io_p2v((x) + 0x18) +#define LPC32XX_TIMER_MR1 (x) io_p2v((x) + 0x1C) +#define LPC32XX_TIMER_MR2 (x) io_p2v((x) + 0x20) +#define LPC32XX_TIMER_MR3 (x) io_p2v((x) + 0x24) +#define LPC32XX_TIMER_CCR (x) io_p2v((x) + 0x28) +#define LPC32XX_TIMER_CR0 (x) io_p2v((x) + 0x2C) +#define LPC32XX_TIMER_CR1 (x) io_p2v((x) + 0x30) +#define LPC32XX_TIMER_CR2 (x) io_p2v((x) + 0x34) +#define LPC32XX_TIMER_CR3 (x) io_p2v((x) + 0x38) +#define LPC32XX_TIMER_EMR (x) io_p2v((x) + 0x3C) +#define LPC32XX_TIMER_CTCR (x) io_p2v((x) + 0x70)/* * ir register definitions */ -#define LCP32XX_TIMER_CNTR_MTCH_BIT (n) (1 << ((n) & 0x3)) -#define LCP32XX_TIMER_CNTR_CAPT_BIT (n) (1 << (4 + ((n) & 0x3))) +#define LPC32XX_TIMER_CNTR_MTCH_BIT (n) (1 << ((n) & 0x3)) +#define LPC32XX_TIMER_CNTR_CAPT_BIT (n) (1 << (4 + ((n) & 0x3)))/* * tcr register definitions */ -#define LCP32XX_TIMER_CNTR_TCR_EN 0x1 -#define LCP32XX_TIMER_CNTR_TCR_RESET 0x2 +#define LPC32XX_TIMER_CNTR_TCR_EN 0x1 +#define LPC32XX_TIMER_CNTR_TCR_RESET 0x2/* * mcr register definitions */ -#define LCP32XX_TIMER_CNTR_MCR_MTCH (n) (0x1 << ((n) * 3)) -#define LCP32XX_TIMER_CNTR_MCR_RESET (n) (0x1 << (((n) * 3) + 1)) -#define LCP32XX_TIMER_CNTR_MCR_STOP (n) (0x1 << (((n) * 3) + 2)) +#define LPC32XX_TIMER_CNTR_MCR_MTCH (n) (0x1 << ((n) * 3)) +#define LPC32XX_TIMER_CNTR_MCR_RESET (n) (0x1 << (((n) * 3) + 1)) +#define LPC32XX_TIMER_CNTR_MCR_STOP (n) (0x1 << (((n) * 3) + 2))/* * Standard UART register offsets
arch/arm/mach-lpc32xx/timer.c +23 -23
82 lines not on this page · raw message
Signature · 1 line
1.7.1.1
PATCH 2/7 ARM: LPC32xx: Remove un-needed wakeup code from IRQ ack handler
In reply to wellsk40 at gmail.comFrom: Kevin Wells <[email protected]>
Code was intended for clearing platform wakeup events and just added extra overhead in the ack handler.
--- arch/arm/mach-lpc32xx/irq.c | 5 ----- 1 files changed, 0 insertions(+), 5 deletions(-)
arch/arm/mach-lpc32xx/irq.c +0 -5
@@ -218,11 +218,6 @@ static void lpc32xx_ack_irq(unsigned int irq)get_controller (irq, &ctrl, &mask);__raw_writel (mask,LPC32XX_INTC_RAW_STAT (ctrl)); - -/* Also need to clear pending wake event */ -if (lpc32xx_events[irq].mask !=0 ) -__raw_writel (lpc32xx_events[irq].mask, - lpc32xx_events[irq].event_group->rawstat_reg); } static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level,
Signature · 1 line
1.7.1.1
PATCH 3/7 ARM: LPC32xx: Fix gpiolib bit mask macro
In reply to wellsk40 at gmail.comFrom: Kevin Wells <[email protected]>
The GPIO bank 3 input mask macro was missing a critical mask that would cause it to return invalid pin states.
--- arch/arm/mach-lpc32xx/gpiolib.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
arch/arm/mach-lpc32xx/gpiolib.c +1 -1
@@ -59,7 +59,7 @@#define GPO3_PIN_TO_BIT (x) (1 << (x))#define GPIO012_PIN_IN_SEL (x, y) (((x) >> (y)) & 1)#define GPIO3_PIN_IN_SHIFT (x) ((x) == 5 ? 24 : 10 + (x)) -#define GPIO3_PIN_IN_SEL (x, y) ((x) >> GPIO3_PIN_IN_SHIFT(y)) +#define GPIO3_PIN_IN_SEL (x, y) (((x) >> GPIO3_PIN_IN_SHIFT(y)) & 1)#define GPIO3_PIN5_IN_SEL (x) (((x) >> 24) & 1)#define GPI3_PIN_IN_SEL (x, y) (((x) >> (y)) & 1)
Signature · 1 line
1.7.1.1
PATCH 4/7 ARM: LPC32xx: Change clocking for AMBA device registration
In reply to wellsk40 at gmail.comFrom: Kevin Wells <[email protected]>
The LCP32xx will throw an exception if a peripheral block is accessed when not being clocked. For AMBA registration where the AMBA peripheral ID is read from the register block, temporarily enable the clocks during registration and disable them once complete. The original logic left the clocks on.
--- arch/arm/mach-lpc32xx/clock.c | 25 +++++++++++++++++++++++++ arch/arm/mach-lpc32xx/clock.h | 3 +++ arch/arm/mach-lpc32xx/phy3250.c | 21 ++++----------------- 3 files changed, 32 insertions(+), 17 deletions(-)
arch/arm/mach-lpc32xx/clock.c +25 -0
@@ -1042,6 +1042,31 @@ struct clk *clk_get_parent(struct clk *clk) }EXPORT_SYMBOL (clk_get_parent); +/* +* These are the clocks for cells registered as primecell drivers +* on the AMBA bus. These must be on during AMBA device registration +* since the bus probe will attempt to read magic configuration +* registers for these devices. If they are deactivated these probes +* will fail. +*/ +void lpc32xx_clock_primecells (void ) +{ +clk_enable (&clk_mmc); +clk_enable (&clk_lcd); +clk_enable (&clk_ssp0); +clk_enable (&clk_ssp1); +} +EXPORT_SYMBOL (lpc32xx_clock_primecells); + +void lpc32xx_unclock_primecells (void ) +{ +clk_disable (&clk_mmc); +clk_disable (&clk_lcd); +clk_disable (&clk_ssp0); +clk_disable (&clk_ssp1); +} +EXPORT_SYMBOL (lpc32xx_unclock_primecells); +#define _REGISTER_CLOCK (d, n, c) \ { \ .dev_id = (d), \
arch/arm/mach-lpc32xx/clock.h +3 -0
@@ -35,4 +35,7 @@ struct clk { u32 enable_mask; }; +void lpc32xx_clock_primecells (void ); +void lpc32xx_unclock_primecells (void ); +#endif
arch/arm/mach-lpc32xx/phy3250.c +4 -17
@@ -38,6 +38,7 @@#include <mach/hardware.h> #include <mach/platform.h> #include "common.h" +#include "clock.h" /* * Mapped GPIOLIB GPIOs
@@ -340,28 +341,14 @@ static void __init phy3250_board_init(void)lpc32xx_serial_init (); -/* -* AMBA peripheral clocks need to be enabled prior to AMBA device -* detection or a data fault will occur, so enable the clocks -* here. However, we don't want to enable them if the peripheral -* isn't included in the image -*/ -#ifdef CONFIG_FB_ARMCLCD - tmp =__raw_readl (LPC32XX_CLKPWR_LCDCLK_CTRL ); -__raw_writel ((tmp |LPC32XX_CLKPWR_LCDCTRL_CLK_EN ), -LPC32XX_CLKPWR_LCDCLK_CTRL ); -#endif -#ifdef CONFIG_SPI_PL022 - tmp =__raw_readl (LPC32XX_CLKPWR_SSP_CLK_CTRL ); -__raw_writel ((tmp |LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN ), -LPC32XX_CLKPWR_SSP_CLK_CTRL ); -#endif -platform_add_devices (phy3250_devs,ARRAY_SIZE (phy3250_devs)); + +lpc32xx_clock_primecells ();for (i =0 ; i <ARRAY_SIZE (amba_devs); i++) {struct amba_device *d = amba_devs[i];amba_device_register (d, &iomem_resource); } +lpc32xx_unclock_primecells ();/* Test clock needed for UDA1380 initial init */ __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC |
Signature · 1 line
1.7.1.1
PATCH 5/7 ARM: LPC32xx: Add workaround the AMBA LCD clocking
In reply to wellsk40 at gmail.comFrom: Kevin Wells <[email protected]>
The AMBA LCD driver attempts to access peripheral registers prior to enabling the clock for the peripheral. This workaround will get around that issue by making sure the LCD clock is enabled for the first peripheral register accesses.
--- arch/arm/mach-lpc32xx/phy3250.c | 13 +++++++++++++ 1 files changed, 13 insertions(+), 0 deletions(-)
arch/arm/mach-lpc32xx/phy3250.c +13 -0
@@ -350,6 +350,19 @@ static void __init phy3250_board_init(void) }lpc32xx_unclock_primecells (); +#ifdef CONFIG_FB_ARMCLCD +/* +* The AMBA PL11x driver attempts to disable the LCD and then +* access some peripheral registers while the clock is disabled. +* This workaround won't fix the unbalanced clock enable and +* disable, but will prevent the ARM core from throwing an +* exception when that happens. +*/ + tmp =__raw_readl (LPC32XX_CLKPWR_LCDCLK_CTRL ); +__raw_writel ((tmp |LPC32XX_CLKPWR_LCDCTRL_CLK_EN ), +LPC32XX_CLKPWR_LCDCLK_CTRL ); +#endif +/* Test clock needed for UDA1380 initial init */ __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC | LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
Signature · 1 line
1.7.1.1
PATCH 6/7 ARM: LPC32xx: Remove MMC peripheral clock enable/disable code
In reply to wellsk40 at gmail.comFrom: Kevin Wells <[email protected]>
The MMC clock rate set and get functions had extra code to force the high level peripheral clock to enable prior to register accesses. This isn't needed.
--- arch/arm/mach-lpc32xx/clock.c | 14 ++------------ 1 files changed, 2 insertions(+), 12 deletions(-)
arch/arm/mach-lpc32xx/clock.c +2 -12
@@ -738,14 +738,9 @@ static int mmc_onoff_enable(struct clk *clk, int enable)static unsigned long mmc_get_rate (struct clk *clk) { -u32 div, rate, oldclk; +u32 div, rate; -/* The MMC clock must be on when accessing an MMC register */ - oldclk =__raw_readl (LPC32XX_CLKPWR_MS_CTRL ); -__raw_writel (oldclk |LPC32XX_CLKPWR_MSCARD_SDCARD_EN , -LPC32XX_CLKPWR_MS_CTRL ); div =__raw_readl (LPC32XX_CLKPWR_MS_CTRL ); -__raw_writel (oldclk,LPC32XX_CLKPWR_MS_CTRL );/* Get the parent clock rate */ rate = clk->parent->get_rate (clk->parent);
@@ -778,7 +773,7 @@ static unsigned long mmc_round_rate(struct clk *clk, unsigned long rate)static int mmc_set_rate (struct clk *clk,unsigned long rate) { -u32 oldclk, tmp; +u32 tmp;unsigned long prate, div, crate =mmc_round_rate (clk, rate); prate = clk->parent->get_rate (clk->parent);
@@ -786,16 +781,11 @@ static int mmc_set_rate(struct clk *clk, unsigned long rate) div = prate / crate;/* The MMC clock must be on when accessing an MMC register */ - oldclk =__raw_readl (LPC32XX_CLKPWR_MS_CTRL ); -__raw_writel (oldclk |LPC32XX_CLKPWR_MSCARD_SDCARD_EN , -LPC32XX_CLKPWR_MS_CTRL ); tmp =__raw_readl (LPC32XX_CLKPWR_MS_CTRL ) & ~LPC32XX_CLKPWR_MSCARD_SDCARD_DIV (0xf ); tmp |=LPC32XX_CLKPWR_MSCARD_SDCARD_DIV (div);__raw_writel (tmp,LPC32XX_CLKPWR_MS_CTRL ); -__raw_writel (oldclk,LPC32XX_CLKPWR_MS_CTRL ); -return 0 ; }
Signature · 1 line
1.7.1.1
PATCH 7/7 ARM: LPC32xx: Replace 'tbd's from audio clock names with NULL
In reply to wellsk40 at gmail.comFrom: Kevin Wells <[email protected]>
--- arch/arm/mach-lpc32xx/clock.c | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-lpc32xx/clock.c +2 -2
@@ -1091,8 +1091,8 @@ static struct clk_lookup lookups[] = { _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1) _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan) _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand) - _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0) - _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1) + _REGISTER_CLOCK(NULL, "i2s0_ck", clk_i2s0) + _REGISTER_CLOCK(NULL, "i2s1_ck", clk_i2s1) _REGISTER_CLOCK("lpc32xx-ts", NULL, clk_tsc) _REGISTER_CLOCK("dev:mmc0", "MCLK", clk_mmc)_REGISTER_CLOCK ("lpc-net.0" ,NULL , clk_net)
Signature · 1 line
1.7.1.1