Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32…
Browse files Browse the repository at this point in the history
…-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6: (31 commits)
  avr32: Fix typo of IFSR in a comment in the PIO header file
  avr32: Power Management support ("standby" and "mem" modes)
  avr32: Add system device for the internal interrupt controller (intc)
  avr32: Add simple SRAM allocator
  avr32: Enable SDRAMC clock at startup
  rtc-at32ap700x: Enable wakeup
  macb: Basic suspend/resume support
  atmel_serial: Drain console TX shifter before suspending
  atmel_serial: Fix build on avr32 with CONFIG_PM enabled
  avr32: Use a quicklist for PTE allocation as well
  avr32: Use a quicklist for PGD allocation
  avr32: Cover the kernel page tables in the user PGDs
  avr32: Store virtual addresses in the PGD
  avr32: Remove useless zeroing of swapper_pg_dir at startup
  avr32: Clean up and optimize the TLB operations
  avr32: Rename at32ap.c -> pdc.c
  avr32: Move setup_platform() into chip-specific file
  avr32: Kill special exception handler sections
  avr32: Kill unneeded #include <asm/pgalloc.h> from asm/mmu_context.h
  avr32: Clean up time.c #includes
  ...
  • Loading branch information
torvalds committed Jul 14, 2008
2 parents 847106f + 72f6bef commit 6c118e4
Show file tree
Hide file tree
Showing 36 changed files with 1,093 additions and 280 deletions.
9 changes: 9 additions & 0 deletions arch/avr32/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ config PLATFORM_AT32AP
select MMU
select PERFORMANCE_COUNTERS
select HAVE_GPIO_LIB
select GENERIC_ALLOCATOR

#
# CPU types
Expand Down Expand Up @@ -147,6 +148,9 @@ config PHYS_OFFSET

source "kernel/Kconfig.preempt"

config QUICKLIST
def_bool y

config HAVE_ARCH_BOOTMEM_NODE
def_bool n

Expand Down Expand Up @@ -201,6 +205,11 @@ endmenu

menu "Power management options"

source "kernel/power/Kconfig"

config ARCH_SUSPEND_POSSIBLE
def_bool y

menu "CPU Frequency scaling"

source "drivers/cpufreq/Kconfig"
Expand Down
29 changes: 29 additions & 0 deletions arch/avr32/boards/atngw100/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
*/
#include <linux/clk.h>
#include <linux/etherdevice.h>
#include <linux/irq.h>
#include <linux/i2c.h>
#include <linux/i2c-gpio.h>
#include <linux/init.h>
#include <linux/linkage.h>
Expand All @@ -25,6 +27,13 @@
#include <asm/arch/init.h>
#include <asm/arch/portmux.h>

/* Oscillator frequencies. These are board-specific */
unsigned long at32_board_osc_rates[3] = {
[0] = 32768, /* 32.768 kHz on RTC osc */
[1] = 20000000, /* 20 MHz on osc0 */
[2] = 12000000, /* 12 MHz on osc1 */
};

/* Initialized by bootloader-specific startup code. */
struct tag *bootloader_tags __initdata;

Expand Down Expand Up @@ -140,6 +149,10 @@ static struct platform_device i2c_gpio_device = {
},
};

static struct i2c_board_info __initdata i2c_info[] = {
/* NOTE: original ATtiny24 firmware is at address 0x0b */
};

static int __init atngw100_init(void)
{
unsigned i;
Expand All @@ -165,12 +178,28 @@ static int __init atngw100_init(void)
}
platform_device_register(&ngw_gpio_leds);

/* all these i2c/smbus pins should have external pullups for
* open-drain sharing among all I2C devices. SDA and SCL do;
* PB28/EXTINT3 doesn't; it should be SMBALERT# (for PMBus),
* but it's not available off-board.
*/
at32_select_periph(GPIO_PIN_PB(28), 0, AT32_GPIOF_PULLUP);
at32_select_gpio(i2c_gpio_data.sda_pin,
AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
at32_select_gpio(i2c_gpio_data.scl_pin,
AT32_GPIOF_MULTIDRV | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH);
platform_device_register(&i2c_gpio_device);
i2c_register_board_info(0, i2c_info, ARRAY_SIZE(i2c_info));

return 0;
}
postcore_initcall(atngw100_init);

static int __init atngw100_arch_init(void)
{
/* set_irq_type() after the arch_initcall for EIC has run, and
* before the I2C subsystem could try using this IRQ.
*/
return set_irq_type(AT32_EXTINT(3), IRQ_TYPE_EDGE_FALLING);
}
arch_initcall(atngw100_arch_init);
8 changes: 7 additions & 1 deletion arch/avr32/boards/atstk1000/atstk1002.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@

#include "atstk1000.h"

/* Oscillator frequencies. These are board specific */
unsigned long at32_board_osc_rates[3] = {
[0] = 32768, /* 32.768 kHz on RTC osc */
[1] = 20000000, /* 20 MHz on osc0 */
[2] = 12000000, /* 12 MHz on osc1 */
};

struct eth_addr {
u8 addr[6];
Expand Down Expand Up @@ -232,7 +238,7 @@ static int __init atstk1002_init(void)
set_hw_addr(at32_add_device_eth(1, &eth_data[1]));
#else
at32_add_device_lcdc(0, &atstk1000_lcdc_data,
fbmem_start, fbmem_size);
fbmem_start, fbmem_size, 0);
#endif
at32_add_device_usba(0, NULL);
#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
Expand Down
7 changes: 7 additions & 0 deletions arch/avr32/boards/atstk1000/atstk1003.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@

#include "atstk1000.h"

/* Oscillator frequencies. These are board specific */
unsigned long at32_board_osc_rates[3] = {
[0] = 32768, /* 32.768 kHz on RTC osc */
[1] = 20000000, /* 20 MHz on osc0 */
[2] = 12000000, /* 12 MHz on osc1 */
};

#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
static struct at73c213_board_info at73c213_data = {
.ssc_id = 0,
Expand Down
9 changes: 8 additions & 1 deletion arch/avr32/boards/atstk1000/atstk1004.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@

#include "atstk1000.h"

/* Oscillator frequencies. These are board specific */
unsigned long at32_board_osc_rates[3] = {
[0] = 32768, /* 32.768 kHz on RTC osc */
[1] = 20000000, /* 20 MHz on osc0 */
[2] = 12000000, /* 12 MHz on osc1 */
};

#ifdef CONFIG_BOARD_ATSTK1000_EXTDAC
static struct at73c213_board_info at73c213_data = {
.ssc_id = 0,
Expand Down Expand Up @@ -133,7 +140,7 @@ static int __init atstk1004_init(void)
at32_add_device_mci(0);
#endif
at32_add_device_lcdc(0, &atstk1000_lcdc_data,
fbmem_start, fbmem_size);
fbmem_start, fbmem_size, 0);
at32_add_device_usba(0, NULL);
#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM
at32_add_device_ssc(0, ATMEL_SSC_TX);
Expand Down
88 changes: 53 additions & 35 deletions arch/avr32/kernel/entry-avr32b.S
Original file line number Diff line number Diff line change
Expand Up @@ -74,50 +74,41 @@ exception_vectors:
.align 2
bral do_dtlb_modified

/*
* r0 : PGD/PT/PTE
* r1 : Offending address
* r2 : Scratch register
* r3 : Cause (5, 12 or 13)
*/
#define tlbmiss_save pushm r0-r3
#define tlbmiss_restore popm r0-r3

.section .tlbx.ex.text,"ax",@progbits
.org 0x50
.global itlb_miss
itlb_miss:
tlbmiss_save
rjmp tlb_miss_common

.section .tlbr.ex.text,"ax",@progbits
.org 0x60
dtlb_miss_read:
tlbmiss_save
rjmp tlb_miss_common

.section .tlbw.ex.text,"ax",@progbits
.org 0x70
dtlb_miss_write:
tlbmiss_save

.global tlb_miss_common
.align 2
tlb_miss_common:
mfsr r0, SYSREG_TLBEAR
mfsr r1, SYSREG_PTBR

/* Is it the vmalloc space? */
bld r0, 31
brcs handle_vmalloc_miss

/* First level lookup */
/*
* First level lookup: The PGD contains virtual pointers to
* the second-level page tables, but they may be NULL if not
* present.
*/
pgtbl_lookup:
lsr r2, r0, PGDIR_SHIFT
ld.w r3, r1[r2 << 2]
bfextu r1, r0, PAGE_SHIFT, PGDIR_SHIFT - PAGE_SHIFT
bld r3, _PAGE_BIT_PRESENT
brcc page_table_not_present

/* Translate to virtual address in P1. */
andl r3, 0xf000
sbr r3, 31
cp.w r3, 0
breq page_table_not_present

/* Second level lookup */
ld.w r2, r3[r1 << 2]
Expand Down Expand Up @@ -148,16 +139,55 @@ pgtbl_lookup:
tlbmiss_restore
rete

handle_vmalloc_miss:
/* Simply do the lookup in init's page table */
/* The slow path of the TLB miss handler */
.align 2
page_table_not_present:
/* Do we need to synchronize with swapper_pg_dir? */
bld r0, 31
brcs sync_with_swapper_pg_dir

page_not_present:
tlbmiss_restore
sub sp, 4
stmts --sp, r0-lr
rcall save_full_context_ex
mfsr r12, SYSREG_ECR
mov r11, sp
rcall do_page_fault
rjmp ret_from_exception

.align 2
sync_with_swapper_pg_dir:
/*
* If swapper_pg_dir contains a non-NULL second-level page
* table pointer, copy it into the current PGD. If not, we
* must handle it as a full-blown page fault.
*
* Jumping back to pgtbl_lookup causes an unnecessary lookup,
* but it is guaranteed to be a cache hit, it won't happen
* very often, and we absolutely do not want to sacrifice any
* performance in the fast path in order to improve this.
*/
mov r1, lo(swapper_pg_dir)
orh r1, hi(swapper_pg_dir)
ld.w r3, r1[r2 << 2]
cp.w r3, 0
breq page_not_present
mfsr r1, SYSREG_PTBR
st.w r1[r2 << 2], r3
rjmp pgtbl_lookup

/*
* We currently have two bytes left at this point until we
* crash into the system call handler...
*
* Don't worry, the assembler will let us know.
*/


/* --- System Call --- */

.section .scall.text,"ax",@progbits
.org 0x100
system_call:
#ifdef CONFIG_PREEMPT
mask_interrupts
Expand Down Expand Up @@ -266,18 +296,6 @@ syscall_exit_work:
brcc syscall_exit_cont
rjmp enter_monitor_mode

/* The slow path of the TLB miss handler */
page_table_not_present:
page_not_present:
tlbmiss_restore
sub sp, 4
stmts --sp, r0-lr
rcall save_full_context_ex
mfsr r12, SYSREG_ECR
mov r11, sp
rcall do_page_fault
rjmp ret_from_exception

/* This function expects to find offending PC in SYSREG_RAR_EX */
.type save_full_context_ex, @function
.align 2
Expand Down
3 changes: 3 additions & 0 deletions arch/avr32/kernel/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
goto badframe;

if (do_sigaltstack(&frame->uc.uc_stack, NULL, regs->sp) == -EFAULT)
goto badframe;

pr_debug("Context restored: pc = %08lx, lr = %08lx, sp = %08lx\n",
regs->pc, regs->lr, regs->sp);

Expand Down
14 changes: 3 additions & 11 deletions arch/avr32/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@
*/
#include <linux/clk.h>
#include <linux/clockchips.h>
#include <linux/time.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/kernel_stat.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/profile.h>
#include <linux/sysdev.h>
#include <linux/err.h>
#include <linux/kernel.h>
#include <linux/time.h>

#include <asm/div64.h>
#include <asm/sysreg.h>
#include <asm/io.h>
#include <asm/sections.h>

#include <asm/arch/pm.h>

Expand Down
12 changes: 4 additions & 8 deletions arch/avr32/kernel/vmlinux.lds.S
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,6 @@ SECTIONS
_evba = .;
_text = .;
*(.ex.text)
. = 0x50;
*(.tlbx.ex.text)
. = 0x60;
*(.tlbr.ex.text)
. = 0x70;
*(.tlbw.ex.text)
. = 0x100;
*(.scall.text)
*(.irq.text)
KPROBES_TEXT
TEXT_TEXT
Expand Down Expand Up @@ -107,6 +99,10 @@ SECTIONS
*/
*(.data.init_task)

/* Then, the page-aligned data */
. = ALIGN(PAGE_SIZE);
*(.data.page_aligned)

/* Then, the cacheline aligned data */
. = ALIGN(L1_CACHE_BYTES);
*(.data.cacheline_aligned)
Expand Down
2 changes: 1 addition & 1 deletion arch/avr32/lib/io-readsb.S
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ __raw_readsb:
2: sub r10, -4
reteq r12

3: ld.uh r8, r12[0]
3: ld.ub r8, r12[0]
sub r10, 1
st.b r11++, r8
brne 3b
Expand Down
7 changes: 6 additions & 1 deletion arch/avr32/mach-at32ap/Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
obj-y += at32ap.o clock.o intc.o extint.o pio.o hsmc.o
obj-y += pdc.o clock.o intc.o extint.o pio.o hsmc.o
obj-$(CONFIG_CPU_AT32AP700X) += at32ap700x.o pm-at32ap700x.o
obj-$(CONFIG_CPU_FREQ_AT32AP) += cpufreq.o
obj-$(CONFIG_PM) += pm.o

ifeq ($(CONFIG_PM_DEBUG),y)
CFLAGS_pm.o += -DDEBUG
endif
Loading

0 comments on commit 6c118e4

Please sign in to comment.