Rewrite the resource management code (i.e. I/O memory, clock gating, gpio) so it doesn't depend on any global state. This is necessary because this code is heavily used before relocation to RAM, so we can't write to any global variables. As an added bonus, this makes u-boot's memory footprint a bit smaller, although some functionality has been left out; all clocks are enabled all the time, and there's no checking for gpio line conflicts. Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>master
parent
03d1e13657
commit
df548d3c3e
@ -1,448 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#include <common.h> |
||||
|
||||
#include <asm/arch/memory-map.h> |
||||
#include <asm/arch/platform.h> |
||||
|
||||
#include "../sm.h" |
||||
|
||||
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) |
||||
|
||||
const struct clock_domain chip_clock[] = { |
||||
[CLOCK_CPU] = { |
||||
.reg = SM_PM_CPU_MASK, |
||||
.id = CLOCK_CPU, |
||||
.bridge = NO_DEVICE, |
||||
}, |
||||
[CLOCK_HSB] = { |
||||
.reg = SM_PM_HSB_MASK, |
||||
.id = CLOCK_HSB, |
||||
.bridge = NO_DEVICE, |
||||
}, |
||||
[CLOCK_PBA] = { |
||||
.reg = SM_PM_PBA_MASK, |
||||
.id = CLOCK_PBA, |
||||
.bridge = DEVICE_PBA_BRIDGE, |
||||
}, |
||||
[CLOCK_PBB] = { |
||||
.reg = SM_PM_PBB_MASK, |
||||
.id = CLOCK_PBB, |
||||
.bridge = DEVICE_PBB_BRIDGE, |
||||
}, |
||||
}; |
||||
|
||||
static const struct resource hebi_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 0 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 13 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 14 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 27, DEVICE_PIOE, GPIO_FUNC_A, 0 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource pba_bridge_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 1 }, |
||||
} |
||||
}, { |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
/* HSB-HSB Bridge */ |
||||
.clock = { CLOCK_HSB, 4 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource pbb_bridge_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 2 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource hramc_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 3 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource pioa_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 10 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource piob_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 11 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource pioc_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 12 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource piod_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 13 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource pioe_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 14 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource sm_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 0 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource intc_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 1 }, |
||||
}, |
||||
}, |
||||
}; |
||||
static const struct resource hmatrix_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 2 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#if defined(CFG_HPDC) |
||||
static const struct resource hpdc_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 16 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_MACB0) |
||||
static const struct resource macb0_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 8 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 6 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 19, DEVICE_PIOC, GPIO_FUNC_A, 0 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_MACB1) |
||||
static const struct resource macb1_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 9 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 7 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 12, DEVICE_PIOC, GPIO_FUNC_B, 19 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 14, DEVICE_PIOD, GPIO_FUNC_B, 2 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_LCDC) |
||||
static const struct resource lcdc_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 7 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_USART0) |
||||
static const struct resource usart0_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 3 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 2, DEVICE_PIOA, GPIO_FUNC_B, 8 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_USART1) |
||||
static const struct resource usart1_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 4 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 2, DEVICE_PIOA, GPIO_FUNC_A, 17 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_USART2) |
||||
static const struct resource usart2_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 5 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 2, DEVICE_PIOB, GPIO_FUNC_B, 26 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_USART3) |
||||
static const struct resource usart3_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBA, 6 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 2, DEVICE_PIOB, GPIO_FUNC_B, 17 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_MMCI) |
||||
static const struct resource mmci_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_PBB, 9 }, |
||||
}, |
||||
}, { |
||||
.type = RESOURCE_GPIO, |
||||
.u = { |
||||
.gpio = { 6, DEVICE_PIOA, GPIO_FUNC_A, 10 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
#if defined(CFG_DMAC) |
||||
static const struct resource dmac_resource[] = { |
||||
{ |
||||
.type = RESOURCE_CLOCK, |
||||
.u = { |
||||
.clock = { CLOCK_HSB, 10 }, |
||||
}, |
||||
}, |
||||
}; |
||||
#endif |
||||
|
||||
const struct device chip_device[] = { |
||||
[DEVICE_HEBI] = { |
||||
.regs = (void *)HSMC_BASE, |
||||
.nr_resources = ARRAY_SIZE(hebi_resource), |
||||
.resource = hebi_resource, |
||||
}, |
||||
[DEVICE_PBA_BRIDGE] = { |
||||
.nr_resources = ARRAY_SIZE(pba_bridge_resource), |
||||
.resource = pba_bridge_resource, |
||||
}, |
||||
[DEVICE_PBB_BRIDGE] = { |
||||
.nr_resources = ARRAY_SIZE(pbb_bridge_resource), |
||||
.resource = pbb_bridge_resource, |
||||
}, |
||||
[DEVICE_HRAMC] = { |
||||
.nr_resources = ARRAY_SIZE(hramc_resource), |
||||
.resource = hramc_resource, |
||||
}, |
||||
[DEVICE_PIOA] = { |
||||
.regs = (void *)PIOA_BASE, |
||||
.nr_resources = ARRAY_SIZE(pioa_resource), |
||||
.resource = pioa_resource, |
||||
}, |
||||
[DEVICE_PIOB] = { |
||||
.regs = (void *)PIOB_BASE, |
||||
.nr_resources = ARRAY_SIZE(piob_resource), |
||||
.resource = piob_resource, |
||||
}, |
||||
[DEVICE_PIOC] = { |
||||
.regs = (void *)PIOC_BASE, |
||||
.nr_resources = ARRAY_SIZE(pioc_resource), |
||||
.resource = pioc_resource, |
||||
}, |
||||
[DEVICE_PIOD] = { |
||||
.regs = (void *)PIOD_BASE, |
||||
.nr_resources = ARRAY_SIZE(piod_resource), |
||||
.resource = piod_resource, |
||||
}, |
||||
[DEVICE_PIOE] = { |
||||
.regs = (void *)PIOE_BASE, |
||||
.nr_resources = ARRAY_SIZE(pioe_resource), |
||||
.resource = pioe_resource, |
||||
}, |
||||
[DEVICE_SM] = { |
||||
.regs = (void *)SM_BASE, |
||||
.nr_resources = ARRAY_SIZE(sm_resource), |
||||
.resource = sm_resource, |
||||
}, |
||||
[DEVICE_INTC] = { |
||||
.regs = (void *)INTC_BASE, |
||||
.nr_resources = ARRAY_SIZE(intc_resource), |
||||
.resource = intc_resource, |
||||
}, |
||||
[DEVICE_HMATRIX] = { |
||||
.regs = (void *)HMATRIX_BASE, |
||||
.nr_resources = ARRAY_SIZE(hmatrix_resource), |
||||
.resource = hmatrix_resource, |
||||
}, |
||||
#if defined(CFG_HPDC) |
||||
[DEVICE_HPDC] = { |
||||
.nr_resources = ARRAY_SIZE(hpdc_resource), |
||||
.resource = hpdc_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_MACB0) |
||||
[DEVICE_MACB0] = { |
||||
.regs = (void *)MACB0_BASE, |
||||
.nr_resources = ARRAY_SIZE(macb0_resource), |
||||
.resource = macb0_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_MACB1) |
||||
[DEVICE_MACB1] = { |
||||
.regs = (void *)MACB1_BASE, |
||||
.nr_resources = ARRAY_SIZE(macb1_resource), |
||||
.resource = macb1_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_LCDC) |
||||
[DEVICE_LCDC] = { |
||||
.nr_resources = ARRAY_SIZE(lcdc_resource), |
||||
.resource = lcdc_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_USART0) |
||||
[DEVICE_USART0] = { |
||||
.regs = (void *)USART0_BASE, |
||||
.nr_resources = ARRAY_SIZE(usart0_resource), |
||||
.resource = usart0_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_USART1) |
||||
[DEVICE_USART1] = { |
||||
.regs = (void *)USART1_BASE, |
||||
.nr_resources = ARRAY_SIZE(usart1_resource), |
||||
.resource = usart1_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_USART2) |
||||
[DEVICE_USART2] = { |
||||
.regs = (void *)USART2_BASE, |
||||
.nr_resources = ARRAY_SIZE(usart2_resource), |
||||
.resource = usart2_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_USART3) |
||||
[DEVICE_USART3] = { |
||||
.regs = (void *)USART3_BASE, |
||||
.nr_resources = ARRAY_SIZE(usart3_resource), |
||||
.resource = usart3_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_MMCI) |
||||
[DEVICE_MMCI] = { |
||||
.regs = (void *)MMCI_BASE, |
||||
.nr_resources = ARRAY_SIZE(mmci_resource), |
||||
.resource = mmci_resource, |
||||
}, |
||||
#endif |
||||
#if defined(CFG_DMAC) |
||||
[DEVICE_DMAC] = { |
||||
.regs = (void *)DMAC_BASE, |
||||
.nr_resources = ARRAY_SIZE(dmac_resource), |
||||
.resource = dmac_resource, |
||||
}, |
||||
#endif |
||||
}; |
@ -0,0 +1,77 @@ |
||||
/*
|
||||
* Copyright (C) 2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#include <common.h> |
||||
|
||||
#include <asm/arch/gpio.h> |
||||
|
||||
/*
|
||||
* Lots of small functions here. We depend on --gc-sections getting |
||||
* rid of the ones we don't need. |
||||
*/ |
||||
void gpio_enable_ebi(void) |
||||
{ |
||||
#ifdef CFG_HSDRAMC |
||||
#ifndef CFG_SDRAM_16BIT |
||||
gpio_select_periph_A(GPIO_PIN_PE0, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE1, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE2, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE3, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE4, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE5, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE6, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE7, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE8, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE9, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE10, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE11, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE12, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE13, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE14, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PE15, 0); |
||||
#endif |
||||
gpio_select_periph_A(GPIO_PIN_PE26, 0); |
||||
#endif |
||||
} |
||||
|
||||
void gpio_enable_usart0(void) |
||||
{ |
||||
gpio_select_periph_B(GPIO_PIN_PA8, 0); |
||||
gpio_select_periph_B(GPIO_PIN_PA9, 0); |
||||
} |
||||
|
||||
void gpio_enable_usart1(void) |
||||
{ |
||||
gpio_select_periph_A(GPIO_PIN_PA17, 0); |
||||
gpio_select_periph_A(GPIO_PIN_PA18, 0); |
||||
} |
||||
|
||||
void gpio_enable_usart2(void) |
||||
{ |
||||
gpio_select_periph_B(GPIO_PIN_PB26, 0); |
||||
gpio_select_periph_B(GPIO_PIN_PB27, 0); |
||||
} |
||||
|
||||
void gpio_enable_usart3(void) |
||||
{ |
||||
gpio_select_periph_B(GPIO_PIN_PB18, 0); |
||||
gpio_select_periph_B(GPIO_PIN_PB19, 0); |
||||
} |
@ -1,38 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#include <common.h> |
||||
|
||||
#include <asm/io.h> |
||||
|
||||
#include <asm/arch/hmatrix2.h> |
||||
#include <asm/arch/memory-map.h> |
||||
#include <asm/arch/platform.h> |
||||
|
||||
void cpu_enable_sdram(void) |
||||
{ |
||||
const struct device *hmatrix; |
||||
|
||||
hmatrix = get_device(DEVICE_HMATRIX); |
||||
|
||||
/* Set the SDRAM_ENABLE bit in the HEBI SFR */ |
||||
hmatrix2_writel(hmatrix, SFR4, 1 << 1); |
||||
} |
@ -1,126 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#include <common.h> |
||||
|
||||
#include <asm/arch/platform.h> |
||||
|
||||
#include "sm.h" |
||||
|
||||
struct device_state { |
||||
int refcount; |
||||
}; |
||||
|
||||
static struct device_state device_state[NR_DEVICES]; |
||||
|
||||
static int claim_resource(const struct resource *res) |
||||
{ |
||||
int ret = 0; |
||||
|
||||
switch (res->type) { |
||||
case RESOURCE_GPIO: |
||||
ret = gpio_set_func(res->u.gpio.gpio_dev, |
||||
res->u.gpio.start, |
||||
res->u.gpio.nr_pins, |
||||
res->u.gpio.func); |
||||
break; |
||||
case RESOURCE_CLOCK: |
||||
ret = pm_enable_clock(res->u.clock.id, res->u.clock.index); |
||||
break; |
||||
} |
||||
|
||||
return ret; |
||||
} |
||||
|
||||
static void free_resource(const struct resource *res) |
||||
{ |
||||
switch (res->type) { |
||||
case RESOURCE_GPIO: |
||||
gpio_free(res->u.gpio.gpio_dev, res->u.gpio.start, |
||||
res->u.gpio.nr_pins); |
||||
break; |
||||
case RESOURCE_CLOCK: |
||||
pm_disable_clock(res->u.clock.id, res->u.clock.index); |
||||
break; |
||||
} |
||||
} |
||||
|
||||
static int init_dev(const struct device *dev) |
||||
{ |
||||
unsigned int i; |
||||
int ret = 0; |
||||
|
||||
for (i = 0; i < dev->nr_resources; i++) { |
||||
ret = claim_resource(&dev->resource[i]); |
||||
if (ret) |
||||
goto cleanup; |
||||
} |
||||
|
||||
return 0; |
||||
|
||||
cleanup: |
||||
while (i--) |
||||
free_resource(&dev->resource[i]); |
||||
|
||||
return ret; |
||||
} |
||||
|
||||
const struct device *get_device(enum device_id devid) |
||||
{ |
||||
struct device_state *devstate; |
||||
const struct device *dev; |
||||
unsigned long flags; |
||||
int initialized = 0; |
||||
int ret = 0; |
||||
|
||||
devstate = &device_state[devid]; |
||||
dev = &chip_device[devid]; |
||||
|
||||
flags = disable_interrupts(); |
||||
if (devstate->refcount++) |
||||
initialized = 1; |
||||
if (flags) |
||||
enable_interrupts(); |
||||
|
||||
if (!initialized) |
||||
ret = init_dev(dev); |
||||
|
||||
return ret ? NULL : dev; |
||||
} |
||||
|
||||
void put_device(const struct device *dev) |
||||
{ |
||||
struct device_state *devstate; |
||||
unsigned long devid, flags; |
||||
|
||||
devid = (unsigned long)(dev - chip_device) / sizeof(struct device); |
||||
devstate = &device_state[devid]; |
||||
|
||||
flags = disable_interrupts(); |
||||
devstate--; |
||||
if (!devstate) { |
||||
unsigned int i; |
||||
for (i = 0; i < dev->nr_resources; i++) |
||||
free_resource(&dev->resource[i]); |
||||
} |
||||
if (flags) |
||||
enable_interrupts(); |
||||
} |
@ -0,0 +1,58 @@ |
||||
/*
|
||||
* Copyright (C) 2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#ifndef __ASM_AVR32_ARCH_CLK_H__ |
||||
#define __ASM_AVR32_ARCH_CLK_H__ |
||||
|
||||
#ifdef CONFIG_PLL |
||||
#define MAIN_CLK_RATE ((CFG_OSC0_HZ / CFG_PLL0_DIV) * CFG_PLL0_MUL) |
||||
#else |
||||
#define MAIN_CLK_RATE (CFG_OSC0_HZ) |
||||
#endif |
||||
|
||||
static inline unsigned long get_cpu_clk_rate(void) |
||||
{ |
||||
return MAIN_CLK_RATE >> CFG_CLKDIV_CPU; |
||||
} |
||||
static inline unsigned long get_hsb_clk_rate(void) |
||||
{ |
||||
return MAIN_CLK_RATE >> CFG_CLKDIV_HSB; |
||||
} |
||||
static inline unsigned long get_pba_clk_rate(void) |
||||
{ |
||||
return MAIN_CLK_RATE >> CFG_CLKDIV_PBA; |
||||
} |
||||
static inline unsigned long get_pbb_clk_rate(void) |
||||
{ |
||||
return MAIN_CLK_RATE >> CFG_CLKDIV_PBB; |
||||
} |
||||
|
||||
/* Accessors for specific devices. More will be added as needed. */ |
||||
static inline unsigned long get_sdram_clk_rate(void) |
||||
{ |
||||
return get_hsb_clk_rate(); |
||||
} |
||||
static inline unsigned long get_usart_clk_rate(unsigned int dev_id) |
||||
{ |
||||
return get_pba_clk_rate(); |
||||
} |
||||
|
||||
#endif /* __ASM_AVR32_ARCH_CLK_H__ */ |
@ -0,0 +1,210 @@ |
||||
/*
|
||||
* Copyright (C) 2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#ifndef __ASM_AVR32_ARCH_GPIO_H__ |
||||
#define __ASM_AVR32_ARCH_GPIO_H__ |
||||
|
||||
#include <asm/arch/memory-map.h> |
||||
|
||||
#define NR_GPIO_CONTROLLERS 5 |
||||
|
||||
/*
|
||||
* Pin numbers identifying specific GPIO pins on the chip. |
||||
*/ |
||||
#define GPIO_PIOA_BASE (0) |
||||
#define GPIO_PIN_PA0 (GPIO_PIOA_BASE + 0) |
||||
#define GPIO_PIN_PA1 (GPIO_PIOA_BASE + 1) |
||||
#define GPIO_PIN_PA2 (GPIO_PIOA_BASE + 2) |
||||
#define GPIO_PIN_PA3 (GPIO_PIOA_BASE + 3) |
||||
#define GPIO_PIN_PA4 (GPIO_PIOA_BASE + 4) |
||||
#define GPIO_PIN_PA5 (GPIO_PIOA_BASE + 5) |
||||
#define GPIO_PIN_PA6 (GPIO_PIOA_BASE + 6) |
||||
#define GPIO_PIN_PA7 (GPIO_PIOA_BASE + 7) |
||||
#define GPIO_PIN_PA8 (GPIO_PIOA_BASE + 8) |
||||
#define GPIO_PIN_PA9 (GPIO_PIOA_BASE + 9) |
||||
#define GPIO_PIN_PA10 (GPIO_PIOA_BASE + 10) |
||||
#define GPIO_PIN_PA11 (GPIO_PIOA_BASE + 11) |
||||
#define GPIO_PIN_PA12 (GPIO_PIOA_BASE + 12) |
||||
#define GPIO_PIN_PA13 (GPIO_PIOA_BASE + 13) |
||||
#define GPIO_PIN_PA14 (GPIO_PIOA_BASE + 14) |
||||
#define GPIO_PIN_PA15 (GPIO_PIOA_BASE + 15) |
||||
#define GPIO_PIN_PA16 (GPIO_PIOA_BASE + 16) |
||||
#define GPIO_PIN_PA17 (GPIO_PIOA_BASE + 17) |
||||
#define GPIO_PIN_PA18 (GPIO_PIOA_BASE + 18) |
||||
#define GPIO_PIN_PA19 (GPIO_PIOA_BASE + 19) |
||||
#define GPIO_PIN_PA20 (GPIO_PIOA_BASE + 20) |
||||
#define GPIO_PIN_PA21 (GPIO_PIOA_BASE + 21) |
||||
#define GPIO_PIN_PA22 (GPIO_PIOA_BASE + 22) |
||||
#define GPIO_PIN_PA23 (GPIO_PIOA_BASE + 23) |
||||
#define GPIO_PIN_PA24 (GPIO_PIOA_BASE + 24) |
||||
#define GPIO_PIN_PA25 (GPIO_PIOA_BASE + 25) |
||||
#define GPIO_PIN_PA26 (GPIO_PIOA_BASE + 26) |
||||
#define GPIO_PIN_PA27 (GPIO_PIOA_BASE + 27) |
||||
#define GPIO_PIN_PA28 (GPIO_PIOA_BASE + 28) |
||||
#define GPIO_PIN_PA29 (GPIO_PIOA_BASE + 29) |
||||
#define GPIO_PIN_PA30 (GPIO_PIOA_BASE + 30) |
||||
#define GPIO_PIN_PA31 (GPIO_PIOA_BASE + 31) |
||||
|
||||
#define GPIO_PIOB_BASE (GPIO_PIOA_BASE + 32) |
||||
#define GPIO_PIN_PB0 (GPIO_PIOB_BASE + 0) |
||||
#define GPIO_PIN_PB1 (GPIO_PIOB_BASE + 1) |
||||
#define GPIO_PIN_PB2 (GPIO_PIOB_BASE + 2) |
||||
#define GPIO_PIN_PB3 (GPIO_PIOB_BASE + 3) |
||||
#define GPIO_PIN_PB4 (GPIO_PIOB_BASE + 4) |
||||
#define GPIO_PIN_PB5 (GPIO_PIOB_BASE + 5) |
||||
#define GPIO_PIN_PB6 (GPIO_PIOB_BASE + 6) |
||||
#define GPIO_PIN_PB7 (GPIO_PIOB_BASE + 7) |
||||
#define GPIO_PIN_PB8 (GPIO_PIOB_BASE + 8) |
||||
#define GPIO_PIN_PB9 (GPIO_PIOB_BASE + 9) |
||||
#define GPIO_PIN_PB10 (GPIO_PIOB_BASE + 10) |
||||
#define GPIO_PIN_PB11 (GPIO_PIOB_BASE + 11) |
||||
#define GPIO_PIN_PB12 (GPIO_PIOB_BASE + 12) |
||||
#define GPIO_PIN_PB13 (GPIO_PIOB_BASE + 13) |
||||
#define GPIO_PIN_PB14 (GPIO_PIOB_BASE + 14) |
||||
#define GPIO_PIN_PB15 (GPIO_PIOB_BASE + 15) |
||||
#define GPIO_PIN_PB16 (GPIO_PIOB_BASE + 16) |
||||
#define GPIO_PIN_PB17 (GPIO_PIOB_BASE + 17) |
||||
#define GPIO_PIN_PB18 (GPIO_PIOB_BASE + 18) |
||||
#define GPIO_PIN_PB19 (GPIO_PIOB_BASE + 19) |
||||
#define GPIO_PIN_PB20 (GPIO_PIOB_BASE + 20) |
||||
#define GPIO_PIN_PB21 (GPIO_PIOB_BASE + 21) |
||||
#define GPIO_PIN_PB22 (GPIO_PIOB_BASE + 22) |
||||
#define GPIO_PIN_PB23 (GPIO_PIOB_BASE + 23) |
||||
#define GPIO_PIN_PB24 (GPIO_PIOB_BASE + 24) |
||||
#define GPIO_PIN_PB25 (GPIO_PIOB_BASE + 25) |
||||
#define GPIO_PIN_PB26 (GPIO_PIOB_BASE + 26) |
||||
#define GPIO_PIN_PB27 (GPIO_PIOB_BASE + 27) |
||||
#define GPIO_PIN_PB28 (GPIO_PIOB_BASE + 28) |
||||
#define GPIO_PIN_PB29 (GPIO_PIOB_BASE + 29) |
||||
#define GPIO_PIN_PB30 (GPIO_PIOB_BASE + 30) |
||||
|
||||
#define GPIO_PIOC_BASE (GPIO_PIOB_BASE + 32) |
||||
#define GPIO_PIN_PC0 (GPIO_PIOC_BASE + 0) |
||||
#define GPIO_PIN_PC1 (GPIO_PIOC_BASE + 1) |
||||
#define GPIO_PIN_PC2 (GPIO_PIOC_BASE + 2) |
||||
#define GPIO_PIN_PC3 (GPIO_PIOC_BASE + 3) |
||||
#define GPIO_PIN_PC4 (GPIO_PIOC_BASE + 4) |
||||
#define GPIO_PIN_PC5 (GPIO_PIOC_BASE + 5) |
||||
#define GPIO_PIN_PC6 (GPIO_PIOC_BASE + 6) |
||||
#define GPIO_PIN_PC7 (GPIO_PIOC_BASE + 7) |
||||
#define GPIO_PIN_PC8 (GPIO_PIOC_BASE + 8) |
||||
#define GPIO_PIN_PC9 (GPIO_PIOC_BASE + 9) |
||||
#define GPIO_PIN_PC10 (GPIO_PIOC_BASE + 10) |
||||
#define GPIO_PIN_PC11 (GPIO_PIOC_BASE + 11) |
||||
#define GPIO_PIN_PC12 (GPIO_PIOC_BASE + 12) |
||||
#define GPIO_PIN_PC13 (GPIO_PIOC_BASE + 13) |
||||
#define GPIO_PIN_PC14 (GPIO_PIOC_BASE + 14) |
||||
#define GPIO_PIN_PC15 (GPIO_PIOC_BASE + 15) |
||||
#define GPIO_PIN_PC16 (GPIO_PIOC_BASE + 16) |
||||
#define GPIO_PIN_PC17 (GPIO_PIOC_BASE + 17) |
||||
#define GPIO_PIN_PC18 (GPIO_PIOC_BASE + 18) |
||||
#define GPIO_PIN_PC19 (GPIO_PIOC_BASE + 19) |
||||
#define GPIO_PIN_PC20 (GPIO_PIOC_BASE + 20) |
||||
#define GPIO_PIN_PC21 (GPIO_PIOC_BASE + 21) |
||||
#define GPIO_PIN_PC22 (GPIO_PIOC_BASE + 22) |
||||
#define GPIO_PIN_PC23 (GPIO_PIOC_BASE + 23) |
||||
#define GPIO_PIN_PC24 (GPIO_PIOC_BASE + 24) |
||||
#define GPIO_PIN_PC25 (GPIO_PIOC_BASE + 25) |
||||
#define GPIO_PIN_PC26 (GPIO_PIOC_BASE + 26) |
||||
#define GPIO_PIN_PC27 (GPIO_PIOC_BASE + 27) |
||||
#define GPIO_PIN_PC28 (GPIO_PIOC_BASE + 28) |
||||
#define GPIO_PIN_PC29 (GPIO_PIOC_BASE + 29) |
||||
#define GPIO_PIN_PC30 (GPIO_PIOC_BASE + 30) |
||||
#define GPIO_PIN_PC31 (GPIO_PIOC_BASE + 31) |
||||
|
||||
#define GPIO_PIOD_BASE (GPIO_PIOC_BASE + 32) |
||||
#define GPIO_PIN_PD0 (GPIO_PIOD_BASE + 0) |
||||
#define GPIO_PIN_PD1 (GPIO_PIOD_BASE + 1) |
||||
#define GPIO_PIN_PD2 (GPIO_PIOD_BASE + 2) |
||||
#define GPIO_PIN_PD3 (GPIO_PIOD_BASE + 3) |
||||
#define GPIO_PIN_PD4 (GPIO_PIOD_BASE + 4) |
||||
#define GPIO_PIN_PD5 (GPIO_PIOD_BASE + 5) |
||||
#define GPIO_PIN_PD6 (GPIO_PIOD_BASE + 6) |
||||
#define GPIO_PIN_PD7 (GPIO_PIOD_BASE + 7) |
||||
#define GPIO_PIN_PD8 (GPIO_PIOD_BASE + 8) |
||||
#define GPIO_PIN_PD9 (GPIO_PIOD_BASE + 9) |
||||
#define GPIO_PIN_PD10 (GPIO_PIOD_BASE + 10) |
||||
#define GPIO_PIN_PD11 (GPIO_PIOD_BASE + 11) |
||||
#define GPIO_PIN_PD12 (GPIO_PIOD_BASE + 12) |
||||
#define GPIO_PIN_PD13 (GPIO_PIOD_BASE + 13) |
||||
#define GPIO_PIN_PD14 (GPIO_PIOD_BASE + 14) |
||||
#define GPIO_PIN_PD15 (GPIO_PIOD_BASE + 15) |
||||
#define GPIO_PIN_PD16 (GPIO_PIOD_BASE + 16) |
||||
#define GPIO_PIN_PD17 (GPIO_PIOD_BASE + 17) |
||||
|
||||
#define GPIO_PIOE_BASE (GPIO_PIOD_BASE + 32) |
||||
#define GPIO_PIN_PE0 (GPIO_PIOE_BASE + 0) |
||||
#define GPIO_PIN_PE1 (GPIO_PIOE_BASE + 1) |
||||
#define GPIO_PIN_PE2 (GPIO_PIOE_BASE + 2) |
||||
#define GPIO_PIN_PE3 (GPIO_PIOE_BASE + 3) |
||||
#define GPIO_PIN_PE4 (GPIO_PIOE_BASE + 4) |
||||
#define GPIO_PIN_PE5 (GPIO_PIOE_BASE + 5) |
||||
#define GPIO_PIN_PE6 (GPIO_PIOE_BASE + 6) |
||||
#define GPIO_PIN_PE7 (GPIO_PIOE_BASE + 7) |
||||
#define GPIO_PIN_PE8 (GPIO_PIOE_BASE + 8) |
||||
#define GPIO_PIN_PE9 (GPIO_PIOE_BASE + 9) |
||||
#define GPIO_PIN_PE10 (GPIO_PIOE_BASE + 10) |
||||
#define GPIO_PIN_PE11 (GPIO_PIOE_BASE + 11) |
||||
#define GPIO_PIN_PE12 (GPIO_PIOE_BASE + 12) |
||||
#define GPIO_PIN_PE13 (GPIO_PIOE_BASE + 13) |
||||
#define GPIO_PIN_PE14 (GPIO_PIOE_BASE + 14) |
||||
#define GPIO_PIN_PE15 (GPIO_PIOE_BASE + 15) |
||||
#define GPIO_PIN_PE16 (GPIO_PIOE_BASE + 16) |
||||
#define GPIO_PIN_PE17 (GPIO_PIOE_BASE + 17) |
||||
#define GPIO_PIN_PE18 (GPIO_PIOE_BASE + 18) |
||||
#define GPIO_PIN_PE19 (GPIO_PIOE_BASE + 19) |
||||
#define GPIO_PIN_PE20 (GPIO_PIOE_BASE + 20) |
||||
#define GPIO_PIN_PE21 (GPIO_PIOE_BASE + 21) |
||||
#define GPIO_PIN_PE22 (GPIO_PIOE_BASE + 22) |
||||
#define GPIO_PIN_PE23 (GPIO_PIOE_BASE + 23) |
||||
#define GPIO_PIN_PE24 (GPIO_PIOE_BASE + 24) |
||||
#define GPIO_PIN_PE25 (GPIO_PIOE_BASE + 25) |
||||
#define GPIO_PIN_PE26 (GPIO_PIOE_BASE + 26) |
||||
|
||||
static inline void *gpio_pin_to_addr(unsigned int pin) |
||||
{ |
||||
switch (pin >> 5) { |
||||
case 0: |
||||
return (void *)PIOA_BASE; |
||||
case 1: |
||||
return (void *)PIOB_BASE; |
||||
case 2: |
||||
return (void *)PIOC_BASE; |
||||
case 3: |
||||
return (void *)PIOD_BASE; |
||||
case 4: |
||||
return (void *)PIOE_BASE; |
||||
default: |
||||
return NULL; |
||||
} |
||||
} |
||||
|
||||
void gpio_select_periph_A(unsigned int pin, int use_pullup); |
||||
void gpio_select_periph_B(unsigned int pin, int use_pullup); |
||||
|
||||
void gpio_enable_ebi(void); |
||||
void gpio_enable_usart0(void); |
||||
void gpio_enable_usart1(void); |
||||
void gpio_enable_usart2(void); |
||||
void gpio_enable_usart3(void); |
||||
|
||||
#endif /* __ASM_AVR32_ARCH_GPIO_H__ */ |
||||
|
@ -1,146 +0,0 @@ |
||||
/*
|
||||
* Copyright (C) 2005-2006 Atmel Corporation |
||||
* |
||||
* See file CREDITS for list of people who contributed to this |
||||
* project. |
||||
* |
||||
* This program is free software; you can redistribute it and/or |
||||
* modify it under the terms of the GNU General Public License as |
||||
* published by the Free Software Foundation; either version 2 of |
||||
* the License, or (at your option) any later version. |
||||
* |
||||
* This program is distributed in the hope that it will be useful, |
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||||
* GNU General Public License for more details. |
||||
* |
||||
* You should have received a copy of the GNU General Public License |
||||
* along with this program; if not, write to the Free Software |
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
||||
* MA 02111-1307 USA |
||||
*/ |
||||
#ifndef _ASM_AVR32_ARCH_PM_H |
||||
#define _ASM_AVR32_ARCH_PM_H |
||||
|
||||
#include <config.h> |
||||
|
||||
enum clock_domain_id { |
||||
CLOCK_CPU, |
||||
CLOCK_HSB, |
||||
CLOCK_PBA, |
||||
CLOCK_PBB, |
||||
NR_CLOCK_DOMAINS, |
||||
}; |
||||
|
||||
enum resource_type { |
||||
RESOURCE_GPIO, |
||||
RESOURCE_CLOCK, |
||||
}; |
||||
|
||||
enum gpio_func { |
||||
GPIO_FUNC_GPIO, |
||||
GPIO_FUNC_A, |
||||
GPIO_FUNC_B, |
||||
}; |
||||
|
||||
enum device_id { |
||||
DEVICE_HEBI, |
||||
DEVICE_PBA_BRIDGE, |
||||
DEVICE_PBB_BRIDGE, |
||||
DEVICE_HRAMC, |
||||
/* GPIO controllers must be kept together */ |
||||
DEVICE_PIOA, |
||||
DEVICE_PIOB, |
||||
DEVICE_PIOC, |
||||
DEVICE_PIOD, |
||||
DEVICE_PIOE, |
||||
DEVICE_SM, |
||||
DEVICE_INTC, |
||||
DEVICE_HMATRIX, |
||||
#if defined(CFG_HPDC) |
||||
DEVICE_HPDC, |
||||
#endif |
||||
#if defined(CFG_MACB0) |
||||
DEVICE_MACB0, |
||||
#endif |
||||
#if defined(CFG_MACB1) |
||||
DEVICE_MACB1, |
||||
#endif |
||||
#if defined(CFG_LCDC) |
||||
DEVICE_LCDC, |
||||
#endif |
||||
#if defined(CFG_USART0) |
||||
DEVICE_USART0, |
||||
#endif |
||||
#if defined(CFG_USART1) |
||||
DEVICE_USART1, |
||||
#endif |
||||
#if defined(CFG_USART2) |
||||
DEVICE_USART2, |
||||
#endif |
||||
#if defined(CFG_USART3) |
||||
DEVICE_USART3, |
||||
#endif |
||||
#if defined(CFG_MMCI) |
||||
DEVICE_MMCI, |
||||
#endif |
||||
#if defined(CFG_DMAC) |
||||
DEVICE_DMAC, |
||||
#endif |
||||
NR_DEVICES, |
||||
NO_DEVICE = -1, |
||||
}; |
||||
|
||||
struct resource { |
||||
enum resource_type type; |
||||
union { |
||||
struct { |
||||
unsigned long base; |
||||
} iomem; |
||||
struct { |
||||
unsigned char nr_pins; |
||||
enum device_id gpio_dev; |
||||
enum gpio_func func; |
||||
unsigned short start; |
||||
} gpio; |
||||
struct { |
||||
enum clock_domain_id id; |
||||
unsigned char index; |
||||
} clock; |
||||
} u; |
||||
}; |
||||
|
||||
struct device { |
||||
void *regs; |
||||
unsigned int nr_resources; |
||||
const struct resource *resource; |
||||
}; |
||||
|
||||
struct clock_domain { |
||||
unsigned short reg; |
||||
enum clock_domain_id id; |
||||
enum device_id bridge; |
||||
}; |
||||
|
||||
extern const struct device chip_device[NR_DEVICES]; |
||||
extern const struct clock_domain chip_clock[NR_CLOCK_DOMAINS]; |
||||
|
||||
/**
|
||||
* Set up PIO, clock management and I/O memory for a device. |
||||
*/ |
||||
const struct device *get_device(enum device_id devid); |
||||
void put_device(const struct device *dev); |
||||
|
||||
int gpio_set_func(enum device_id gpio_devid, unsigned int start, |
||||
unsigned int nr_pins, enum gpio_func func); |
||||
void gpio_free(enum device_id gpio_devid, unsigned int start, |
||||
unsigned int nr_pins); |
||||
|
||||
void pm_init(void); |
||||
int pm_enable_clock(enum clock_domain_id id, unsigned int index); |
||||
void pm_disable_clock(enum clock_domain_id id, unsigned int index); |
||||
unsigned long pm_get_clock_freq(enum clock_domain_id domain); |
||||
|
||||
void cpu_enable_sdram(void); |
||||
|
||||
#endif /* _ASM_AVR32_ARCH_PM_H */ |
Loading…
Reference in new issue