Skip to content

Commit 7a82323

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/hskinnemoen/avr32-2.6: avr32: some mmc/sd cleanups include/video/atmel_lcdc.h must #include <linux/workqueue.h> avr32: allow system timer to share interrupt to make OProfile work drivers/misc/atmel-ssc.c: Removed duplicated include avr32: Add platform data for AC97C platform device avr32: clean up mci platform code fix avr32 build errors
2 parents b0d8aa0 + 3c26e17 commit 7a82323

8 files changed

Lines changed: 81 additions & 32 deletions

File tree

‎arch/avr32/boards/atstk1000/atstk1002.c‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
#include <asm/io.h>
2323
#include <asm/setup.h>
24+
#include <asm/atmel-mci.h>
25+
2426
#include <asm/arch/at32ap700x.h>
2527
#include <asm/arch/board.h>
2628
#include <asm/arch/init.h>
@@ -260,6 +262,21 @@ void __init setup_board(void)
260262
at32_setup_serial_console(0);
261263
}
262264

265+
#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
266+
267+
/* MMC card detect requires MACB0 *NOT* be used */
268+
#ifdef CONFIG_BOARD_ATSTK1002_SW6_CUSTOM
269+
static struct mci_platform_data __initdata mci0_data = {
270+
.detect_pin = GPIO_PIN_PC(14), /* gpio30/sdcd */
271+
.wp_pin = GPIO_PIN_PC(15), /* gpio31/sdwp */
272+
};
273+
#define MCI_PDATA &mci0_data
274+
#else
275+
#define MCI_PDATA NULL
276+
#endif /* SW6 for sd{cd,wp} routing */
277+
278+
#endif /* SW2 for MMC signal routing */
279+
263280
static int __init atstk1002_init(void)
264281
{
265282
/*
@@ -309,7 +326,7 @@ static int __init atstk1002_init(void)
309326
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
310327
#endif
311328
#ifndef CONFIG_BOARD_ATSTK1002_SW2_CUSTOM
312-
at32_add_device_mci(0, NULL);
329+
at32_add_device_mci(0, MCI_PDATA);
313330
#endif
314331
#ifdef CONFIG_BOARD_ATSTK1002_SW5_CUSTOM
315332
set_hw_addr(at32_add_device_eth(1, &eth_data[1]));

‎arch/avr32/boards/atstk1000/atstk1003.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ static int __init atstk1003_init(void)
154154
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
155155
#endif
156156
#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
157-
at32_add_device_mci(0);
157+
at32_add_device_mci(0, NULL);
158158
#endif
159159
at32_add_device_usba(0, NULL);
160160
#ifndef CONFIG_BOARD_ATSTK100X_SW3_CUSTOM

‎arch/avr32/boards/atstk1000/atstk1004.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ static int __init atstk1004_init(void)
137137
at32_add_device_spi(1, spi1_board_info, ARRAY_SIZE(spi1_board_info));
138138
#endif
139139
#ifndef CONFIG_BOARD_ATSTK100X_SW2_CUSTOM
140-
at32_add_device_mci(0);
140+
at32_add_device_mci(0, NULL);
141141
#endif
142142
at32_add_device_lcdc(0, &atstk1000_lcdc_data,
143143
fbmem_start, fbmem_size, 0);

‎arch/avr32/kernel/time.c‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
4343
{
4444
struct clock_event_device *evdev = dev_id;
4545

46+
if (unlikely(!(intc_get_pending(0) & 1)))
47+
return IRQ_NONE;
48+
4649
/*
4750
* Disable the interrupt until the clockevent subsystem
4851
* reprograms it.
@@ -55,7 +58,8 @@ static irqreturn_t timer_interrupt(int irq, void *dev_id)
5558

5659
static struct irqaction timer_irqaction = {
5760
.handler = timer_interrupt,
58-
.flags = IRQF_TIMER | IRQF_DISABLED,
61+
/* Oprofile uses the same irq as the timer, so allow it to be shared */
62+
.flags = IRQF_TIMER | IRQF_DISABLED | IRQF_SHARED,
5963
.name = "avr32_comparator",
6064
};
6165

‎arch/avr32/mach-at32ap/at32ap700x.c‎

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/init.h>
1313
#include <linux/platform_device.h>
1414
#include <linux/dma-mapping.h>
15+
#include <linux/gpio.h>
1516
#include <linux/spi/spi.h>
1617
#include <linux/usb/atmel_usba_udc.h>
1718

@@ -1285,7 +1286,6 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
12851286
{
12861287
struct mci_platform_data _data;
12871288
struct platform_device *pdev;
1288-
struct dw_dma_slave *dws;
12891289

12901290
if (id != 0)
12911291
return NULL;
@@ -1300,7 +1300,9 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
13001300

13011301
if (!data) {
13021302
data = &_data;
1303-
memset(data, 0, sizeof(struct mci_platform_data));
1303+
memset(data, -1, sizeof(struct mci_platform_data));
1304+
data->detect_pin = GPIO_PIN_NONE;
1305+
data->wp_pin = GPIO_PIN_NONE;
13041306
}
13051307

13061308
if (platform_device_add_data(pdev, data,
@@ -1314,12 +1316,10 @@ at32_add_device_mci(unsigned int id, struct mci_platform_data *data)
13141316
select_peripheral(PA(14), PERIPH_A, 0); /* DATA2 */
13151317
select_peripheral(PA(15), PERIPH_A, 0); /* DATA3 */
13161318

1317-
if (data) {
1318-
if (data->detect_pin != GPIO_PIN_NONE)
1319-
at32_select_gpio(data->detect_pin, 0);
1320-
if (data->wp_pin != GPIO_PIN_NONE)
1321-
at32_select_gpio(data->wp_pin, 0);
1322-
}
1319+
if (gpio_is_valid(data->detect_pin))
1320+
at32_select_gpio(data->detect_pin, 0);
1321+
if (gpio_is_valid(data->wp_pin))
1322+
at32_select_gpio(data->wp_pin, 0);
13231323

13241324
atmel_mci0_pclk.dev = &pdev->dev;
13251325

@@ -1853,11 +1853,11 @@ at32_add_device_cf(unsigned int id, unsigned int extint,
18531853
if (at32_init_ide_or_cf(pdev, data->cs, extint))
18541854
goto fail;
18551855

1856-
if (data->detect_pin != GPIO_PIN_NONE)
1856+
if (gpio_is_valid(data->detect_pin))
18571857
at32_select_gpio(data->detect_pin, AT32_GPIOF_DEGLITCH);
1858-
if (data->reset_pin != GPIO_PIN_NONE)
1858+
if (gpio_is_valid(data->reset_pin))
18591859
at32_select_gpio(data->reset_pin, 0);
1860-
if (data->vcc_pin != GPIO_PIN_NONE)
1860+
if (gpio_is_valid(data->vcc_pin))
18611861
at32_select_gpio(data->vcc_pin, 0);
18621862
/* READY is used as extint, so we can't select it as gpio */
18631863

@@ -1937,9 +1937,11 @@ static struct clk atmel_ac97c0_pclk = {
19371937
.index = 10,
19381938
};
19391939

1940-
struct platform_device *__init at32_add_device_ac97c(unsigned int id)
1940+
struct platform_device *__init
1941+
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data)
19411942
{
19421943
struct platform_device *pdev;
1944+
struct ac97c_platform_data _data;
19431945

19441946
if (id != 0)
19451947
return NULL;
@@ -1950,19 +1952,37 @@ struct platform_device *__init at32_add_device_ac97c(unsigned int id)
19501952

19511953
if (platform_device_add_resources(pdev, atmel_ac97c0_resource,
19521954
ARRAY_SIZE(atmel_ac97c0_resource)))
1953-
goto err_add_resources;
1955+
goto fail;
1956+
1957+
if (!data) {
1958+
data = &_data;
1959+
memset(data, 0, sizeof(struct ac97c_platform_data));
1960+
data->reset_pin = GPIO_PIN_NONE;
1961+
}
19541962

1955-
select_peripheral(PB(20), PERIPH_B, 0); /* SYNC */
1956-
select_peripheral(PB(21), PERIPH_B, 0); /* SDO */
1957-
select_peripheral(PB(22), PERIPH_B, 0); /* SDI */
1958-
select_peripheral(PB(23), PERIPH_B, 0); /* SCLK */
1963+
data->dma_rx_periph_id = 3;
1964+
data->dma_tx_periph_id = 4;
1965+
data->dma_controller_id = 0;
1966+
1967+
if (platform_device_add_data(pdev, data,
1968+
sizeof(struct ac97c_platform_data)))
1969+
goto fail;
1970+
1971+
select_peripheral(PB(20), PERIPH_B, 0); /* SDO */
1972+
select_peripheral(PB(21), PERIPH_B, 0); /* SYNC */
1973+
select_peripheral(PB(22), PERIPH_B, 0); /* SCLK */
1974+
select_peripheral(PB(23), PERIPH_B, 0); /* SDI */
1975+
1976+
/* TODO: gpio_is_valid(data->reset_pin) with kernel 2.6.26. */
1977+
if (data->reset_pin != GPIO_PIN_NONE)
1978+
at32_select_gpio(data->reset_pin, 0);
19591979

19601980
atmel_ac97c0_pclk.dev = &pdev->dev;
19611981

19621982
platform_device_add(pdev);
19631983
return pdev;
19641984

1965-
err_add_resources:
1985+
fail:
19661986
platform_device_put(pdev);
19671987
return NULL;
19681988
}

‎drivers/misc/atmel-ssc.c‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <linux/clk.h>
1414
#include <linux/err.h>
1515
#include <linux/io.h>
16-
#include <linux/list.h>
1716
#include <linux/spinlock.h>
1817
#include <linux/atmel-ssc.h>
1918

‎drivers/mmc/host/atmel-mci.c‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <linux/clk.h>
1212
#include <linux/debugfs.h>
1313
#include <linux/device.h>
14+
#include <linux/err.h>
15+
#include <linux/gpio.h>
1416
#include <linux/init.h>
1517
#include <linux/interrupt.h>
1618
#include <linux/ioport.h>
@@ -27,7 +29,6 @@
2729
#include <asm/unaligned.h>
2830

2931
#include <asm/arch/board.h>
30-
#include <asm/arch/gpio.h>
3132

3233
#include "atmel-mci-regs.h"
3334

@@ -573,7 +574,7 @@ static int atmci_get_ro(struct mmc_host *mmc)
573574
int read_only = 0;
574575
struct atmel_mci *host = mmc_priv(mmc);
575576

576-
if (host->wp_pin >= 0) {
577+
if (gpio_is_valid(host->wp_pin)) {
577578
read_only = gpio_get_value(host->wp_pin);
578579
dev_dbg(&mmc->class_dev, "card is %s\n",
579580
read_only ? "read-only" : "read-write");
@@ -635,7 +636,7 @@ static void atmci_detect_change(unsigned long data)
635636
* been freed.
636637
*/
637638
smp_rmb();
638-
if (host->detect_pin < 0)
639+
if (!gpio_is_valid(host->detect_pin))
639640
return;
640641

641642
enable_irq(gpio_to_irq(host->detect_pin));
@@ -1050,15 +1051,15 @@ static int __init atmci_probe(struct platform_device *pdev)
10501051

10511052
/* Assume card is present if we don't have a detect pin */
10521053
host->present = 1;
1053-
if (host->detect_pin >= 0) {
1054+
if (gpio_is_valid(host->detect_pin)) {
10541055
if (gpio_request(host->detect_pin, "mmc_detect")) {
10551056
dev_dbg(&mmc->class_dev, "no detect pin available\n");
10561057
host->detect_pin = -1;
10571058
} else {
10581059
host->present = !gpio_get_value(host->detect_pin);
10591060
}
10601061
}
1061-
if (host->wp_pin >= 0) {
1062+
if (gpio_is_valid(host->wp_pin)) {
10621063
if (gpio_request(host->wp_pin, "mmc_wp")) {
10631064
dev_dbg(&mmc->class_dev, "no WP pin available\n");
10641065
host->wp_pin = -1;
@@ -1069,7 +1070,7 @@ static int __init atmci_probe(struct platform_device *pdev)
10691070

10701071
mmc_add_host(mmc);
10711072

1072-
if (host->detect_pin >= 0) {
1073+
if (gpio_is_valid(host->detect_pin)) {
10731074
setup_timer(&host->detect_timer, atmci_detect_change,
10741075
(unsigned long)host);
10751076

@@ -1112,7 +1113,7 @@ static int __exit atmci_remove(struct platform_device *pdev)
11121113
if (host) {
11131114
/* Debugfs stuff is cleaned up by mmc core */
11141115

1115-
if (host->detect_pin >= 0) {
1116+
if (gpio_is_valid(host->detect_pin)) {
11161117
int pin = host->detect_pin;
11171118

11181119
/* Make sure the timer doesn't enable the interrupt */
@@ -1132,7 +1133,7 @@ static int __exit atmci_remove(struct platform_device *pdev)
11321133
mci_readl(host, SR);
11331134
clk_disable(host->mck);
11341135

1135-
if (host->wp_pin >= 0)
1136+
if (gpio_is_valid(host->wp_pin))
11361137
gpio_free(host->wp_pin);
11371138

11381139
free_irq(platform_get_irq(pdev, 0), host->mmc);

‎include/asm-avr32/arch-at32ap/board.h‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,15 @@ struct mci_platform_data;
8282
struct platform_device *
8383
at32_add_device_mci(unsigned int id, struct mci_platform_data *data);
8484

85-
struct platform_device *at32_add_device_ac97c(unsigned int id);
85+
struct ac97c_platform_data {
86+
unsigned short dma_rx_periph_id;
87+
unsigned short dma_tx_periph_id;
88+
unsigned short dma_controller_id;
89+
int reset_pin;
90+
};
91+
struct platform_device *
92+
at32_add_device_ac97c(unsigned int id, struct ac97c_platform_data *data);
93+
8694
struct platform_device *at32_add_device_abdac(unsigned int id);
8795
struct platform_device *at32_add_device_psif(unsigned int id);
8896

0 commit comments

Comments
 (0)