diff options
author | Håvard Skinnemoen <haavard.skinnemoen@atmel.com> | 2008-06-06 12:04:56 -0400 |
---|---|---|
committer | David Woodhouse <dwmw2@infradead.org> | 2008-06-07 03:45:36 -0400 |
commit | 62090a08aba579e6c69319fac4d4a1f806f26400 (patch) | |
tree | 88af9ba2b768d06d8778018fff9639f95a663627 /arch/avr32 | |
parent | e1677ce4e41a7c1bbc35a0dee27d5c7e7d223a4b (diff) |
[MTD] [NAND] avr32: atmel_nand platform code for AT32AP700x
This function initializes and adds a platform_device for a NAND flash
interface on SMC chip select 3.
Signed-off-by: Håvard Skinnemoen <haavard.skinnemoen@atmel.com>
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'arch/avr32')
-rw-r--r-- | arch/avr32/mach-at32ap/at32ap700x.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arch/avr32/mach-at32ap/at32ap700x.c b/arch/avr32/mach-at32ap/at32ap700x.c index 0f24b4f85c17..b65d3e0667a8 100644 --- a/arch/avr32/mach-at32ap/at32ap700x.c +++ b/arch/avr32/mach-at32ap/at32ap700x.c | |||
@@ -1730,6 +1730,58 @@ fail: | |||
1730 | #endif | 1730 | #endif |
1731 | 1731 | ||
1732 | /* -------------------------------------------------------------------- | 1732 | /* -------------------------------------------------------------------- |
1733 | * NAND Flash / SmartMedia | ||
1734 | * -------------------------------------------------------------------- */ | ||
1735 | static struct resource smc_cs3_resource[] __initdata = { | ||
1736 | { | ||
1737 | .start = 0x0c000000, | ||
1738 | .end = 0x0fffffff, | ||
1739 | .flags = IORESOURCE_MEM, | ||
1740 | }, { | ||
1741 | .start = 0xfff03c00, | ||
1742 | .end = 0xfff03fff, | ||
1743 | .flags = IORESOURCE_MEM, | ||
1744 | }, | ||
1745 | }; | ||
1746 | |||
1747 | struct platform_device *__init | ||
1748 | at32_add_device_nand(unsigned int id, struct atmel_nand_data *data) | ||
1749 | { | ||
1750 | struct platform_device *pdev; | ||
1751 | |||
1752 | if (id != 0 || !data) | ||
1753 | return NULL; | ||
1754 | |||
1755 | pdev = platform_device_alloc("atmel_nand", id); | ||
1756 | if (!pdev) | ||
1757 | goto fail; | ||
1758 | |||
1759 | if (platform_device_add_resources(pdev, smc_cs3_resource, | ||
1760 | ARRAY_SIZE(smc_cs3_resource))) | ||
1761 | goto fail; | ||
1762 | |||
1763 | if (platform_device_add_data(pdev, data, | ||
1764 | sizeof(struct atmel_nand_data))) | ||
1765 | goto fail; | ||
1766 | |||
1767 | set_ebi_sfr_bits(HMATRIX_BIT(CS3A)); | ||
1768 | if (data->enable_pin) | ||
1769 | at32_select_gpio(data->enable_pin, | ||
1770 | AT32_GPIOF_OUTPUT | AT32_GPIOF_HIGH); | ||
1771 | if (data->rdy_pin) | ||
1772 | at32_select_gpio(data->rdy_pin, 0); | ||
1773 | if (data->det_pin) | ||
1774 | at32_select_gpio(data->det_pin, 0); | ||
1775 | |||
1776 | platform_device_add(pdev); | ||
1777 | return pdev; | ||
1778 | |||
1779 | fail: | ||
1780 | platform_device_put(pdev); | ||
1781 | return NULL; | ||
1782 | } | ||
1783 | |||
1784 | /* -------------------------------------------------------------------- | ||
1733 | * AC97C | 1785 | * AC97C |
1734 | * -------------------------------------------------------------------- */ | 1786 | * -------------------------------------------------------------------- */ |
1735 | static struct resource atmel_ac97c0_resource[] __initdata = { | 1787 | static struct resource atmel_ac97c0_resource[] __initdata = { |