at91: Replace duplicate device initialisation code with
v2 cover at91: Replace duplicate device initialisation code with
Each AT91 variant (AT91RM9200, AT91SAM9260, etc) currently has its own devices file, which includes the MMIO address, interrupt configuration, GPIO setup, etc for each device. This results in a large amount of duplicated code.
This patch set introduces a framework for adding shared devices for the AT91 platform and replaces the multiple device setup implementations for each device with single implementations in the new framework. This has a net reduction of nearly 5000 lines of code.
Each of the arch/arm/mach-at91/*_devices.c files becomes a collection of structures (with some initialisation callbacks where necessary) with a table of devices which are present on the particular AT91 variant. All structures/functions are marked as __init/__initdata so there is little additional memory overhead. This also means that the #ifdefs around each device can be removed from the *_devices.c files (but remain in the new common devices.c file) without overhead.
This patch series does not introduce any functional changes to how the board files add devices, it only replaces the duplicate device initialisation code with common versions. The patch series attempts to have minimum change by rewriting as little as possible of the actual device initialisation functions.
This is also a step towards allowing more than one AT91 variant to be built into a single kernel by removing duplicate function names across the *_devices.c files.
I have build tested the patch series for all of the AT91 variants and devices, and have boot tested it on the AT91SAM9260 (Snapper 9260 board) and tested basic device functionality.
Changes from v1:
- Moved __initdata to the end of lines
- Fixed at572d940hf EMAC MMIO base
- Fixed some whitespace issues
Ryan Mallon (23):
at91: Add common devices framework
at91: Make Ethernet device common
at91: Make USB OHCI/EHCI devices common
at91: Make UDC device common
at91: Make MMC device common
at91: Make NAND device common
at91: Make TWI device common
at91: Make SPI device common
at91: Make TCB device common
at91: Make RTT device common
at91: Make watchdog device common
at91: Make UART devices common
at91: Make PWM device common
at91: Make SSC device common
at91: Make AC97 device common
at91: Make LCD controller device common
at91: Make touchscreen device common
at91: Make HDMAC device common
at91: Make RTC device common
at91: Make high speed USB gadget device common
at91: Make compact flash device common
at91: Move at91sam9263 CAN device to common devices
at91: Remove mAgic and ISI device code
arch/arm/mach-at91/Makefile | 2 +- arch/arm/mach-at91/at572d940hf.c | 4 + arch/arm/mach-at91/at572d940hf_devices.c | 1022 +++------------- arch/arm/mach-at91/at91cap9.c | 4 + arch/arm/mach-at91/at91cap9_devices.c | 1411 ++++---------------- arch/arm/mach-at91/at91rm9200.c | 4 + arch/arm/mach-at91/at91rm9200_devices.c | 1321 ++++--------------- arch/arm/mach-at91/at91sam9260.c | 4 + arch/arm/mach-at91/at91sam9260_devices.c | 1471 ++++----------------- arch/arm/mach-at91/at91sam9261.c | 4 + arch/arm/mach-at91/at91sam9261_devices.c | 1172 ++++-------------- arch/arm/mach-at91/at91sam9263.c | 4 + arch/arm/mach-at91/at91sam9263_devices.c | 1589 +++++------------------ arch/arm/mach-at91/at91sam9g45.c | 4 + arch/arm/mach-at91/at91sam9g45_devices.c | 1779 +++++--------------------- arch/arm/mach-at91/at91sam9rl.c | 4 + arch/arm/mach-at91/at91sam9rl_devices.c | 1332 ++++---------------- arch/arm/mach-at91/board-1arm.c | 6 +- arch/arm/mach-at91/board-afeb-9260v1.c | 10 +- arch/arm/mach-at91/board-at572d940hf_ek.c | 12 +- arch/arm/mach-at91/board-cam60.c | 2 +- arch/arm/mach-at91/board-cap9adk.c | 4 +- arch/arm/mach-at91/board-carmeva.c | 6 +- arch/arm/mach-at91/board-cpu9krea.c | 16 +- arch/arm/mach-at91/board-cpuat91.c | 12 +- arch/arm/mach-at91/board-csb337.c | 4 +- arch/arm/mach-at91/board-csb637.c | 4 +- arch/arm/mach-at91/board-eb9200.c | 8 +- arch/arm/mach-at91/board-ecbat91.c | 6 +- arch/arm/mach-at91/board-eco920.c | 2 +- arch/arm/mach-at91/board-flexibity.c | 2 +- arch/arm/mach-at91/board-foxg20.c | 16 +- arch/arm/mach-at91/board-gsia18s.c | 14 +- arch/arm/mach-at91/board-kafa.c | 6 +- arch/arm/mach-at91/board-kb9202.c | 10 +- arch/arm/mach-at91/board-neocore926.c | 6 +- arch/arm/mach-at91/board-pcontrol-g20.c | 10 +- arch/arm/mach-at91/board-picotux200.c | 6 +- arch/arm/mach-at91/board-qil-a9260.c | 10 +- arch/arm/mach-at91/board-rm9200dk.c | 6 +- arch/arm/mach-at91/board-rm9200ek.c | 6 +- arch/arm/mach-at91/board-sam9-l9260.c | 8 +- arch/arm/mach-at91/board-sam9260ek.c | 10 +- arch/arm/mach-at91/board-sam9261ek.c | 6 +- arch/arm/mach-at91/board-sam9263ek.c | 6 +- arch/arm/mach-at91/board-sam9g20ek.c | 10 +- arch/arm/mach-at91/board-sam9m10g45ek.c | 2 +- arch/arm/mach-at91/board-sam9rlek.c | 4 +- arch/arm/mach-at91/board-snapper9260.c | 14 +- arch/arm/mach-at91/board-stamp9g20.c | 20 +- arch/arm/mach-at91/board-usb-a9260.c | 4 +- arch/arm/mach-at91/board-usb-a9263.c | 4 +- arch/arm/mach-at91/board-yl-9200.c | 10 +- arch/arm/mach-at91/devices.c | 2002 +++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 237 ++++ arch/arm/mach-at91/include/mach/board.h | 21 +- 56 files changed, 4483 insertions(+), 9190 deletions(-) create mode 100644 arch/arm/mach-at91/devices.c create mode 100644 arch/arm/mach-at91/devices.h
PATCH v2 1/23 at91: Add common devices framework
Each AT91 variant (AT91RM9200, AT91SAM9260, etc) currently has its own devices file, which includes the MMIO address, interrupt configuration, GPIO setup, etc for each device. This results in a large amount of duplicated code.
This patch introduces a framework for adding shared devices for the AT91 platform. The subsequent patches in this series replace the multiple device setup implementations for each device with single implementations in the new framework.
--- arch/arm/mach-at91/Makefile | 2 +- arch/arm/mach-at91/devices.c | 70 ++++++++++++++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 36 +++++++++++++++++++++ 3 files changed, 107 insertions(+), 1 deletions(-) create mode 100644 arch/arm/mach-at91/devices.c create mode 100644 arch/arm/mach-at91/devices.h
arch/arm/mach-at91/Makefile +1 -1
@@ -2,7 +2,7 @@ # Makefile for the linux kernel. # -obj-y := irq.o gpio.o +obj-y := irq.o gpio.o devices.o obj-m := obj-n := obj- :=
arch/arm/mach-at91/devices.c new file +70 -0
70 lines not on this page · raw message
arch/arm/mach-at91/devices.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* arch/arm/mach-at91/devices.h +* +* Copyright (C) 2011 Bluewater Systems +* Copyright (C) 2011 Ryan Mallon <[email protected]> +* +* 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. +* +*/ + +#ifndef _AT91_DEVICES_H +#define _AT91_DEVICES_H + +enum { +AT91_PIN_PERIPH_A , +AT91_PIN_PERIPH_B , +AT91_PIN_GPIO , +}; + +struct at91_pin_config { +int pin; +int mode; +int pullup; +int direction; +int value; +}; + +struct at91_device_table { +}; + +extern void __init at91_init_devices (struct at91_device_table *device_table); + +#endif /* _AT91_DEVICES_H */
Signature · 1 line
1.7.0.4
PATCH v2 2/23 at91: Make Ethernet device common
In reply to Ryan MallonReplace the individual Ethernet device code for each at91 variant with a single implementation in devices.
--- arch/arm/mach-at91/at572d940hf.c | 4 + arch/arm/mach-at91/at572d940hf_devices.c | 83 +++++++---------------- arch/arm/mach-at91/at91cap9.c | 4 + arch/arm/mach-at91/at91cap9_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91rm9200.c | 4 + arch/arm/mach-at91/at91rm9200_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91sam9260.c | 4 + arch/arm/mach-at91/at91sam9260_devices.c | 104 +++++++++++------------------ arch/arm/mach-at91/at91sam9263.c | 4 + arch/arm/mach-at91/at91sam9263_devices.c | 102 ++++++++++------------------ arch/arm/mach-at91/at91sam9g45.c | 4 + arch/arm/mach-at91/at91sam9g45_devices.c | 108 +++++++++++------------------- arch/arm/mach-at91/devices.c | 61 +++++++++++++++++ arch/arm/mach-at91/devices.h | 10 +++ 14 files changed, 309 insertions(+), 389 deletions(-)
arch/arm/mach-at91/at572d940hf.c +4 -0
@@ -34,6 +34,8 @@#include "generic.h" #include "clock.h" +extern void at572d940hf_init_devices (void ); +static struct map_desc at572d940hf_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -307,6 +309,8 @@ void __init at572d940hf_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at572d940hf_io_desc,ARRAY_SIZE (at572d940hf_io_desc)); +at572d940hf_init_devices (); + at91_arch_reset = at572d940hf_reset; at91_extern_irq = (1 <<AT572D940HF_ID_IRQ0 ) | (1 <<AT572D940HF_ID_IRQ1 ) | (1 <<AT572D940HF_ID_IRQ2 );
arch/arm/mach-at91/at572d940hf_devices.c +25 -58
105 lines not on this page · raw message
arch/arm/mach-at91/at91cap9.c +4 -0
@@ -28,6 +28,8 @@#include "generic.h" #include "clock.h" +extern void at91cap9_init_devices (void ); +static struct map_desc at91cap9_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -308,6 +310,8 @@ void __init at91cap9_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at91cap9_io_desc,ARRAY_SIZE (at91cap9_io_desc)); +at91cap9_init_devices (); + at91_arch_reset = at91cap9_reset; pm_power_off = at91cap9_poweroff; at91_extern_irq = (1 <<AT91CAP9_ID_IRQ0 ) | (1 <<AT91CAP9_ID_IRQ1 );
arch/arm/mach-at91/at91cap9_devices.c +37 -66
125 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200.c +4 -0
@@ -22,6 +22,8 @@#include "generic.h" #include "clock.h" +extern void at91rm9200_init_devices (void ); +static struct map_desc at91rm9200_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -275,6 +277,8 @@ void __init at91rm9200_initialize(unsigned long main_clock, unsigned short banks/* Map peripherals */ iotable_init (at91rm9200_io_desc,ARRAY_SIZE (at91rm9200_io_desc)); +at91rm9200_init_devices (); + at91_arch_reset = at91rm9200_reset; at91_extern_irq = (1 <<AT91RM9200_ID_IRQ0 ) | (1 <<AT91RM9200_ID_IRQ1 ) | (1 <<AT91RM9200_ID_IRQ2 ) | (1 <<AT91RM9200_ID_IRQ3 )
arch/arm/mach-at91/at91rm9200_devices.c +37 -66
125 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260.c +4 -0
@@ -25,6 +25,8 @@#include "generic.h" #include "clock.h" +extern void at91sam9260_init_devices (void ); +static struct map_desc at91sam9260_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -315,6 +317,8 @@ void __init at91sam9260_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at91sam9260_io_desc,ARRAY_SIZE (at91sam9260_io_desc)); +at91sam9260_init_devices (); +if (cpu_is_at91sam9xe ())at91sam9xe_initialize ();else if (cpu_is_at91sam9g20 ())
arch/arm/mach-at91/at91sam9260_devices.c +38 -66
126 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263.c +4 -0
@@ -24,6 +24,8 @@#include "generic.h" #include "clock.h" +extern void at91sam9263_init_devices (void ); +static struct map_desc at91sam9263_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -284,6 +286,8 @@ void __init at91sam9263_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at91sam9263_io_desc,ARRAY_SIZE (at91sam9263_io_desc)); +at91sam9263_init_devices (); + at91_arch_reset = at91sam9_alt_reset; pm_power_off = at91sam9263_poweroff; at91_extern_irq = (1 <<AT91SAM9263_ID_IRQ0 ) | (1 <<AT91SAM9263_ID_IRQ1 );
arch/arm/mach-at91/at91sam9263_devices.c +37 -65
124 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45.c +4 -0
@@ -25,6 +25,8 @@#include "generic.h" #include "clock.h" +extern void at91sam9g45_init_devices (void ); +static struct map_desc at91sam9g45_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -311,6 +313,8 @@ void __init at91sam9g45_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at91sam9g45_io_desc,ARRAY_SIZE (at91sam9g45_io_desc)); +at91sam9g45_init_devices (); + at91_arch_reset = at91sam9g45_reset; pm_power_off = at91sam9g45_poweroff; at91_extern_irq = (1 <<AT91SAM9G45_ID_IRQ0 );
arch/arm/mach-at91/at91sam9g45_devices.c +40 -68
128 lines not on this page · raw message
arch/arm/mach-at91/devices.c +61 -0
75 lines not on this page · raw message
arch/arm/mach-at91/devices.h +10 -0
@@ -28,7 +28,17 @@ struct at91_pin_config {int value; }; +struct at91_dev_table_ethernet { +unsigned mmio_base; +int irq; +struct at91_pin_config *rmii_pins; +int nr_rmii_pins; +struct at91_pin_config *mii_pins; +int nr_mii_pins; +}; +struct at91_device_table { +struct at91_dev_table_ethernet *ethernet; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 28 lines · Ryan Mallon
Replace the individual Ethernet device code for each at91 variant with a single implementation in devices.
Signed-off-by Ryan Mallon <[email protected]>---
arch/arm/mach-at91/at572d940hf.c | 4 + arch/arm/mach-at91/at572d940hf_devices.c | 83 +++++++---------------- arch/arm/mach-at91/at91cap9.c | 4 + arch/arm/mach-at91/at91cap9_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91rm9200.c | 4 + arch/arm/mach-at91/at91rm9200_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91sam9260.c | 4 + arch/arm/mach-at91/at91sam9260_devices.c | 104 +++++++++++------------------ arch/arm/mach-at91/at91sam9263.c | 4 + arch/arm/mach-at91/at91sam9263_devices.c | 102 ++++++++++------------------ arch/arm/mach-at91/at91sam9g45.c | 4 + arch/arm/mach-at91/at91sam9g45_devices.c | 108 +++++++++++------------------- arch/arm/mach-at91/devices.c | 61 +++++++++++++++++ arch/arm/mach-at91/devices.h | 10 +++ 14 files changed, 309 insertions(+), 389 deletions(-)arch/arm/mach-at91/at572d940hf.c +0
-0
arch/arm/mach-at91/at572d940hf.c line 37
Quoted 4 lines
arch/arm/mach-at91/at572d940hf.c +1
-0@@ -34,6 +34,8 @@#include "generic.h" #include "clock.h" +extern void at572d940hf_init_devices (void );
You might consider moving this, and all the other similar externs, to the generic.h header. That's where all the other platform init functions are defined.
Regards,
Hartley
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 32 lines · H Hartley Sweeten
Quoted 31 lines · Ryan Mallon
Replace the individual Ethernet device code for each at91 variant with a single implementation in devices.
Signed-off-by Ryan Mallon <[email protected]>---
arch/arm/mach-at91/at572d940hf.c | 4 + arch/arm/mach-at91/at572d940hf_devices.c | 83 +++++++---------------- arch/arm/mach-at91/at91cap9.c | 4 + arch/arm/mach-at91/at91cap9_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91rm9200.c | 4 + arch/arm/mach-at91/at91rm9200_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91sam9260.c | 4 + arch/arm/mach-at91/at91sam9260_devices.c | 104 +++++++++++------------------ arch/arm/mach-at91/at91sam9263.c | 4 + arch/arm/mach-at91/at91sam9263_devices.c | 102 ++++++++++------------------ arch/arm/mach-at91/at91sam9g45.c | 4 + arch/arm/mach-at91/at91sam9g45_devices.c | 108 +++++++++++------------------- arch/arm/mach-at91/devices.c | 61 +++++++++++++++++ arch/arm/mach-at91/devices.h | 10 +++ 14 files changed, 309 insertions(+), 389 deletions(-)arch/arm/mach-at91/at572d940hf.c +0
-0@@ -34,6 +34,8 @@#include "generic.h" #include "clock.h"
Quoted 4 lines
arch/arm/mach-at91/at572d940hf.c line 37
Quoted 1 line
arch/arm/mach-at91/at572d940hf.c +1
-0+extern void at572d940hf_init_devices (void );You might consider moving this, and all the other similar externs, to the
generic.hheader. That's where all the other platform init functions are defined.
I put the externs in the .c files since that is the only place they are actually called from. What is the general consensus on this?
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 33 lines · Ryan Mallon
Quoted 32 lines · H Hartley Sweeten
Quoted 31 lines · Ryan Mallon
Replace the individual Ethernet device code for each at91 variant with a single implementation in devices.
Signed-off-by Ryan Mallon <[email protected]>---
arch/arm/mach-at91/at572d940hf.c | 4 + arch/arm/mach-at91/at572d940hf_devices.c | 83 +++++++---------------- arch/arm/mach-at91/at91cap9.c | 4 + arch/arm/mach-at91/at91cap9_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91rm9200.c | 4 + arch/arm/mach-at91/at91rm9200_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91sam9260.c | 4 + arch/arm/mach-at91/at91sam9260_devices.c | 104 +++++++++++------------------ arch/arm/mach-at91/at91sam9263.c | 4 + arch/arm/mach-at91/at91sam9263_devices.c | 102 ++++++++++------------------ arch/arm/mach-at91/at91sam9g45.c | 4 + arch/arm/mach-at91/at91sam9g45_devices.c | 108 +++++++++++------------------- arch/arm/mach-at91/devices.c | 61 +++++++++++++++++ arch/arm/mach-at91/devices.h | 10 +++ 14 files changed, 309 insertions(+), 389 deletions(-)arch/arm/mach-at91/at572d940hf.c +0
-0@@ -34,6 +34,8 @@#include "generic.h" #include "clock.h"
Quoted 7 lines
Quoted 4 lines
arch/arm/mach-at91/at572d940hf.c line 37
Quoted 1 line
arch/arm/mach-at91/at572d940hf.c +1
-0+extern void at572d940hf_init_devices (void );You might consider moving this, and all the other similar externs, to the
generic.hheader. That's where all the other platform init functions are defined.I put the externs in the .c files since that is the only place they are actually called from. What is the general consensus on this?
no I do not want to 1000 of export function again
with the new soc we do not need it anymore
Best Regards,
J.
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 39 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 38 lines · Ryan Mallon
Quoted 36 lines · H Hartley Sweeten
Quoted 28 lines · Ryan Mallon
Replace the individual Ethernet device code for each at91 variant with a single implementation in devices.
Signed-off-by Ryan Mallon <[email protected]>---
arch/arm/mach-at91/at572d940hf.c | 4 + arch/arm/mach-at91/at572d940hf_devices.c | 83 +++++++---------------- arch/arm/mach-at91/at91cap9.c | 4 + arch/arm/mach-at91/at91cap9_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91rm9200.c | 4 + arch/arm/mach-at91/at91rm9200_devices.c | 103 ++++++++++------------------ arch/arm/mach-at91/at91sam9260.c | 4 + arch/arm/mach-at91/at91sam9260_devices.c | 104 +++++++++++------------------ arch/arm/mach-at91/at91sam9263.c | 4 + arch/arm/mach-at91/at91sam9263_devices.c | 102 ++++++++++------------------ arch/arm/mach-at91/at91sam9g45.c | 4 + arch/arm/mach-at91/at91sam9g45_devices.c | 108 +++++++++++------------------- arch/arm/mach-at91/devices.c | 61 +++++++++++++++++ arch/arm/mach-at91/devices.h | 10 +++ 14 files changed, 309 insertions(+), 389 deletions(-)arch/arm/mach-at91/at572d940hf.c +0
-0arch/arm/mach-at91/at572d940hf.c line 37
Quoted 4 lines
arch/arm/mach-at91/at572d940hf.c +1
-0@@ -34,6 +34,8 @@#include "generic.h" #include "clock.h" +extern void at572d940hf_init_devices (void );You might consider moving this, and all the other similar externs, to the
generic.hheader. That's where all the other platform init functions are defined.
Quoted 5 lines
Quoted 2 lines
I put the externs in the .c files since that is the only place they are actually called from. What is the general consensus on this?
no I do not want to 1000 of export function again
with the new soc we do not need it anymore
Yes. In merging with your patch the init_devices function can become a member of struct at91_soc, which removes this whole problem.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
PATCH v2 2/23 at91: Make Ethernet device common
In reply to Ryan MallonQuoted 5 lines · Ryan Mallon
Replace the individual Ethernet device code for each at91 variant with a single implementation in devices.
Signed-off-by Ryan Mallon <[email protected]>
[snip]
Quoted 34 lines
arch/arm/mach-at91/devices.c +17
-0@@ -14,8 +14,11 @@*/ #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/gpio.h> +#include <mach/board.h> +#include "devices.h" static struct at91_device_table *devices__initdata ;@@ -64,6 +67,64 @@ static inline void __init init_resource_irq(struct resource *res, int irq) } } +/* -------------------------------------------------------------------- +* Ethernet +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) +static u64 eth_dmamask = DMA_BIT_MASK(32); +static struct at91_eth_data eth_data; + +static struct resource eth_resources[] = { + [0] = { + .end = SZ_16K, + .flags = IORESOURCE_MEM, + }, + [1] = {
arch/arm/mach-at91/devices.c static inline void __init init_resource_irq(struct resource *res, int irq) · line 93
Quoted 10 lines
arch/arm/mach-at91/devices.c +10
-0+ .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = ð_dmamask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),
Doesn't this work also?
+static struct platform_device at91_eth_device = {
+ .name = "macb",
+ .id = -1,
+ .dev = {
+ .dma_mask = &at91_eth_device.dev.coherent_dma_mask,
+ .coherent_dma_mask = DMA_BIT_MASK(32),
That will get rid of the static u64 variable used for every dma capable device.
Regards,
Hartley
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 63 lines · H Hartley Sweeten
Quoted 5 lines · Ryan Mallon
Replace the individual Ethernet device code for each at91 variant with a single implementation in devices.
Signed-off-by Ryan Mallon <[email protected]>[snip]
Quoted 34 lines
arch/arm/mach-at91/devices.c +17
-0@@ -14,8 +14,11 @@*/ #include <linux/platform_device.h> +#include <linux/dma-mapping.h> #include <linux/gpio.h> +#include <mach/board.h> +#include "devices.h" static struct at91_device_table *devices__initdata ;@@ -64,6 +67,64 @@ static inline void __init init_resource_irq(struct resource *res, int irq) } } +/* -------------------------------------------------------------------- +* Ethernet +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) +static u64 eth_dmamask = DMA_BIT_MASK(32); +static struct at91_eth_data eth_data; + +static struct resource eth_resources[] = { + [0] = { + .end = SZ_16K, + .flags = IORESOURCE_MEM, + }, + [1] = {arch/arm/mach-at91/devices.c static inline void __init init_resource_irq(struct resource *res, int irq) · line 93
Quoted 10 lines
arch/arm/mach-at91/devices.c +10
-0+ .flags = IORESOURCE_IRQ, + }, +}; + +static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = ð_dmamask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),Doesn't this work also?
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),
Quoted 1 line
That will get rid of the static u64 variable used for every dma capable device.
Possibly. I think it should be done as a separate patch though. I've tried to introduce as little code change as possible with this patch set to avoid introducing additional bugs.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
PATCH v2 2/23 at91: Make Ethernet device common
In reply to H Hartley SweetenQuoted 9 lines · H Hartley Sweeten
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),That will get rid of the static u64 variable used for every dma capable device.
I've never really liked that, because coherent_dma_mask is never changed, but the value pointed to be dma_mask can be by drivers. See dma_set_mask().
So, calling dma_set_mask() on any device which does the above will also (unexpectedly?) change the coherent mask too.
It's a minor point as we don't have many platform drivers using dma_set_mask().
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 14 lines · Russell King
Quoted 9 lines · H Hartley Sweeten
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),That will get rid of the static u64 variable used for every dma capable device.
I've never really liked that, because
coherent_dma_maskis never changed, but the value pointed to bedma_maskcan be by drivers. Seedma_set_mask().
Quoted 5 lines
So, calling
dma_set_mask()on any device which does the above will also (unexpectedly?) change the coherent mask too.It's a minor point as we don't have many platform drivers using
dma_set_mask().
So, if I understand this correctly...
1) dev.coherent_dma_mask is a constant that defines the default dma mask of the device.
2) dev.dma_mask is a pointer to the dma mask that is being used by the device.
3) The static variable pointed to by dev.dma_mask holds the dma mask being used by the device. The value can be modified by the driver.
Why couldn't a new field be added to struct device to replace the static variable? The code that sets up the device could do something like:
dev.used_dma_mask = dev.coherent_dma_mask; dev.dma_mask = &dev.used_dma_mask;
Then all that needs to be set in the init code is:
.dev = {
.coherent_dma_mask = DMA_BIT_MASK(32),
},Drivers can then change the value pointer to be dma_mask as needed.
Regards,
Hartley
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 18 lines · H Hartley Sweeten
Quoted 17 lines · Russell King
Quoted 9 lines · H Hartley Sweeten
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),That will get rid of the static u64 variable used for every dma capable device.
I've never really liked that, because
coherent_dma_maskis never changed, but the value pointed to bedma_maskcan be by drivers. Seedma_set_mask().So, calling
dma_set_mask()on any device which does the above will also (unexpectedly?) change the coherent mask too.
Quoted 7 lines
Quoted 2 lines
It's a minor point as we don't have many platform drivers using
dma_set_mask().So, if I understand this correctly...
1) dev.coherent_dma_mask is a constant that defines the default dma mask of the device.
dev.coherent_dma_mask is used for dma_alloc_coherent() allocations.
Quoted 1 line
2) dev.dma_mask is a pointer to the dma mask that is being used by the device.
dev.dma_mask is a pointer to the DMA mask being used by the dma_map_* API.
Quoted 8 lines
3) The static variable pointed to by dev.dma_mask holds the dma mask being used by the device. The value can be modified by the driver.
Why couldn't a new field be added to struct device to replace the static variable? The code that sets up the device could do something like:
dev.used_dma_mask = dev.coherent_dma_mask; dev.dma_mask = &dev.used_dma_mask;
There was talk a while ago about getting rid of the pointer-ness of dma_mask, but I think there's a bit of historic baggage in there to do with the pre-device model PCI bus support code which gets in the way. Not too sure about that though.
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 22 lines · Russell King
Quoted 22 lines · H Hartley Sweeten
Quoted 19 lines · Russell King
Quoted 9 lines · H Hartley Sweeten
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),That will get rid of the static u64 variable used for every dma capable device.
I've never really liked that, because
coherent_dma_maskis never changed, but the value pointed to bedma_maskcan be by drivers. Seedma_set_mask().So, calling
dma_set_mask()on any device which does the above will also (unexpectedly?) change the coherent mask too.It's a minor point as we don't have many platform drivers using
dma_set_mask().
Quoted 6 lines
Quoted 4 lines
So, if I understand this correctly...
1) dev.coherent_dma_mask is a constant that defines the default dma mask of the device.
dev.coherent_dma_mask is used for
dma_alloc_coherent()allocations.
OK. Thanks for the information.
BTW, the setting of coherent_dma_mask seems to be a bit of a mess. Most of the time the DMA_BIT_MASK macro is used but there are a number of things like:
.coherent_dma_mask = ~0, <- DMA_BIT_MASK(64) or (32)? .coherent_dma_mask = -1, <- again, DMA_BIT_MASK(64) or (32)? .coherent_dma_mask = 0xffffffff, <- DMA_BIT_MASK(32) .coherent_dma_mask = 0xffffffffULL, <- DMA_BIT_MASK(32) .coherent_dma_mask = 0xffffffffUL, <- DMA_BIT_MASK(32) .coherent_dma_mask = ~(u32)0, <- DMA_BIT_MASK(32) dev->coherent_dma_mask = SZ_64M - 1; <- DMA_BIT_MASK(26) dev->coherent_dma_mask = (SZ_64M - 1) | PHYS_OFFSET; <- DMA_BIT_MASK(26)
Quoted 3 lines
Quoted 1 line
2) dev.dma_mask is a pointer to the dma mask that is being used by the device.
dev.dma_mask is a pointer to the DMA mask being used by the dma_map_* API.
OK.
Quoted 6 lines
Quoted 6 lines
3) The static variable pointed to by dev.dma_mask holds the dma mask being used by the device. The value can be modified by the driver.
Why couldn't a new field be added to struct device to replace the static variable? The code that sets up the device could do something like:
Quoted 7 lines
Quoted 2 lines
dev.used_dma_mask = dev.coherent_dma_mask; dev.dma_mask = &dev.used_dma_mask;There was talk a while ago about getting rid of the pointer-ness of
dma_mask, but I think there's a bit of historic baggage in there to do with the pre-device model PCI bus support code which gets in the way. Not too sure about that though.
It looks like the amba bus driver does something like this already.
int amba_device_register(struct amba_device *dev, struct resource *parent)
{
...
dev->dev.dma_mask = &dev->dma_mask;
...
if (!dev->dev.coherent_dma_mask && dev->dma_mask)Regards,
Hartley
PATCH v2 2/23 at91: Make Ethernet device common
In reply to Russell King - ARM LinuxHello,
Quoted 4 lines · Russell King - ARM Linux
There was talk a while ago about getting rid of the pointer-ness of
dma_mask, but I think there's a bit of historic baggage in there to do with the pre-device model PCI bus support code which gets in the way. Not too sure about that though.
Here is some more info:
http://thread.gmane.org/gmane.linux.kernel.pci/9081
The long story short (IIRC): it's ugly but not worth to be cleaned up.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 2/23 at91: Make Ethernet device common
In reply to Russell King - ARM LinuxQuoted 14 lines · Russell King - ARM Linux
Quoted 9 lines · H Hartley Sweeten
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),That will get rid of the static u64 variable used for every dma capable device.
I've never really liked that, because
coherent_dma_maskis never changed, but the value pointed to bedma_maskcan be by drivers. Seedma_set_mask().
Quoted 5 lines
So, calling
dma_set_mask()on any device which does the above will also (unexpectedly?) change the coherent mask too.It's a minor point as we don't have many platform drivers using
dma_set_mask().
I've got a couple of other minor changes, but will aim to push out an updated version of the series today. Russell, are you happy for me to leave the dma_mask stuff as is in the series?
Thanks,
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
PATCH v2 2/23 at91: Make Ethernet device common
Quoted 18 lines · Ryan Mallon
Quoted 17 lines · Russell King - ARM Linux
Quoted 9 lines · H Hartley Sweeten
arch/arm/mach-at91/devices.c +6
-0+static struct platform_device at91_eth_device = { + .name ="macb" , + .id =-1 , + .dev = { + .dma_mask = &at91_eth_device.dev.coherent_dma_mask, + .coherent_dma_mask =DMA_BIT_MASK (32 ),That will get rid of the static u64 variable used for every dma capable device.
I've never really liked that, because
coherent_dma_maskis never changed, but the value pointed to bedma_maskcan be by drivers. Seedma_set_mask().So, calling
dma_set_mask()on any device which does the above will also (unexpectedly?) change the coherent mask too.
Quoted 6 lines
Quoted 2 lines
It's a minor point as we don't have many platform drivers using
dma_set_mask().I've got a couple of other minor changes, but will aim to push out an updated version of the series today. Russell, are you happy for me to leave the
dma_maskstuff as is in the series?
Yes, I think as it is in your series is better than pointing it at coherent_dma_mask, which makes stuff more representative of what other subsystems have traditionally done (kept the two separate.)
PATCH v2 3/23 at91: Make USB OHCI/EHCI devices common
In reply to Ryan MallonReplace the individual USB OHCI and EHCI (AT91SAM9G45 only) device code for each at91 variant with a single implementation in devices.c. Rename at91_add_device_usbh to at91_add_device_usbh_ohci (as it is on AT91SAM9G45) to make the API consistent for all variants.
--- arch/arm/mach-at91/at572d940hf_devices.c | 45 +---------- arch/arm/mach-at91/at91cap9_devices.c | 54 ++------------ arch/arm/mach-at91/at91rm9200_devices.c | 44 +---------- arch/arm/mach-at91/at91sam9260_devices.c | 44 +---------- arch/arm/mach-at91/at91sam9261.c | 4 + arch/arm/mach-at91/at91sam9261_devices.c | 53 +++---------- arch/arm/mach-at91/at91sam9263_devices.c | 52 +------------ arch/arm/mach-at91/at91sam9g45_devices.c | 105 ++------------------------ arch/arm/mach-at91/board-1arm.c | 2 +- arch/arm/mach-at91/board-afeb-9260v1.c | 2 +- arch/arm/mach-at91/board-at572d940hf_ek.c | 2 +- arch/arm/mach-at91/board-cam60.c | 2 +- arch/arm/mach-at91/board-cap9adk.c | 2 +- arch/arm/mach-at91/board-carmeva.c | 2 +- arch/arm/mach-at91/board-cpu9krea.c | 2 +- arch/arm/mach-at91/board-cpuat91.c | 2 +- arch/arm/mach-at91/board-csb337.c | 2 +- arch/arm/mach-at91/board-csb637.c | 2 +- arch/arm/mach-at91/board-eb9200.c | 2 +- arch/arm/mach-at91/board-ecbat91.c | 2 +- arch/arm/mach-at91/board-eco920.c | 2 +- arch/arm/mach-at91/board-flexibity.c | 2 +- arch/arm/mach-at91/board-foxg20.c | 2 +- arch/arm/mach-at91/board-gsia18s.c | 2 +- arch/arm/mach-at91/board-kafa.c | 2 +- arch/arm/mach-at91/board-kb9202.c | 2 +- arch/arm/mach-at91/board-neocore926.c | 2 +- arch/arm/mach-at91/board-pcontrol-g20.c | 2 +- arch/arm/mach-at91/board-picotux200.c | 2 +- arch/arm/mach-at91/board-qil-a9260.c | 2 +- arch/arm/mach-at91/board-rm9200dk.c | 2 +- arch/arm/mach-at91/board-rm9200ek.c | 2 +- arch/arm/mach-at91/board-sam9-l9260.c | 2 +- arch/arm/mach-at91/board-sam9260ek.c | 2 +- arch/arm/mach-at91/board-sam9261ek.c | 2 +- arch/arm/mach-at91/board-sam9263ek.c | 2 +- arch/arm/mach-at91/board-sam9g20ek.c | 2 +- arch/arm/mach-at91/board-snapper9260.c | 2 +- arch/arm/mach-at91/board-stamp9g20.c | 4 +- arch/arm/mach-at91/board-usb-a9260.c | 2 +- arch/arm/mach-at91/board-usb-a9263.c | 2 +- arch/arm/mach-at91/board-yl-9200.c | 2 +- arch/arm/mach-at91/devices.c | 117 +++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 13 +++ arch/arm/mach-at91/include/mach/board.h | 1 - 45 files changed, 212 insertions(+), 390 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +4 -41
@@ -42,49 +42,11 @@* USB Host * -------------------------------------------------------------------- */ -#if defined(CONFIG_USB_OHCI_HCD ) || defined(CONFIG_USB_OHCI_HCD_MODULE ) -static u64 ohci_dmamask =DMA_BIT_MASK (32 ); -static struct at91_usbh_data usbh_data; - -static struct resource usbh_resources[] = { - [0 ] = { - .start =AT572D940HF_UHP_BASE , - .end =AT572D940HF_UHP_BASE +SZ_1M -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_UHP , - .end =AT572D940HF_ID_UHP , - .flags =IORESOURCE_IRQ , - }, +static struct at91_dev_table_usb_ohci device_usbh_ohci__initdata = { + .mmio_base =AT572D940HF_UHP_BASE , + .irq =AT572D940HF_ID_UHP , }; -static struct platform_device at572d940hf_usbh_device = { - .name ="at91_ohci" , - .id =-1 , - .dev = { - .dma_mask = &ohci_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &usbh_data, - }, - .resource = usbh_resources, - .num_resources =ARRAY_SIZE (usbh_resources), -}; - -void __init at91_add_device_usbh (struct at91_usbh_data *data) -{ -if (!data) -return ; - - usbh_data = *data; -platform_device_register (&at572d940hf_usbh_device); - -} -#else -void __init at91_add_device_usbh (struct at91_usbh_data *data) {} -#endif - -/* -------------------------------------------------------------------- * USB Device (Gadget) * -------------------------------------------------------------------- */
@@ -913,6 +875,7 @@ void __init at91_add_device_mAgic(void) {}static struct at91_device_table at572d940hf_device_table__initdata = { .ethernet = &device_eth, + .usbh_ohci = &device_usbh_ohci, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91cap9_devices.c +7 -47
71 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200_devices.c +4 -40
58 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +4 -40
58 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261.c +4 -0
@@ -25,6 +25,8 @@#include "generic.h" #include "clock.h" +extern void at91sam9261_init_devices (void ); +static struct map_desc at91sam9261_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -272,6 +274,8 @@ void __init at91sam9261_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at91sam9261_io_desc,ARRAY_SIZE (at91sam9261_io_desc)); +at91sam9261_init_devices (); +if (cpu_is_at91sam9g10 ())iotable_init (at91sam9g10_sram_desc,ARRAY_SIZE (at91sam9g10_sram_desc));else
arch/arm/mach-at91/at91sam9261_devices.c +12 -41
72 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +4 -48
66 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +8 -97
126 lines not on this page · raw message
arch/arm/mach-at91/board-1arm.c +1 -1
@@ -85,7 +85,7 @@ static void __init onearm_board_init(void)/* Ethernet */ at91_add_device_eth (&onearm_eth_data);/* USB Host */ -at91_add_device_usbh (&onearm_usbh_data); +at91_add_device_usbh_ohci (&onearm_usbh_data);/* USB Device */ at91_add_device_udc (&onearm_udc_data); }
arch/arm/mach-at91/board-afeb-9260v1.c +1 -1
@@ -189,7 +189,7 @@ static void __init afeb9260_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&afeb9260_usbh_data); +at91_add_device_usbh_ohci (&afeb9260_usbh_data);/* USB Device */ at91_add_device_udc (&afeb9260_udc_data);/* SPI */
arch/arm/mach-at91/board-at572d940hf_ek.c +1 -1
@@ -297,7 +297,7 @@ static void __init eb_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&eb_usbh_data); +at91_add_device_usbh_ohci (&eb_usbh_data);/* USB Device */ at91_add_device_udc (&eb_udc_data);/* I2C */
arch/arm/mach-at91/board-cam60.c +1 -1
@@ -191,7 +191,7 @@ static void __init cam60_board_init(void)/* USB Host */ /* enable USB power supply circuit */ at91_set_gpio_output (AT91_PIN_PB18 ,1 ); -at91_add_device_usbh (&cam60_usbh_data); +at91_add_device_usbh_ohci (&cam60_usbh_data);/* NAND */ cam60_add_device_nand (); }
arch/arm/mach-at91/board-cap9adk.c +1 -1
@@ -374,7 +374,7 @@ static void __init cap9adk_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&cap9adk_usbh_data); +at91_add_device_usbh_ohci (&cap9adk_usbh_data);/* USB HS */ at91_add_device_usba (&cap9adk_usba_udc_data);/* SPI */
arch/arm/mach-at91/board-carmeva.c +1 -1
@@ -145,7 +145,7 @@ static void __init carmeva_board_init(void)/* Ethernet */ at91_add_device_eth (&carmeva_eth_data);/* USB Host */ -at91_add_device_usbh (&carmeva_usbh_data); +at91_add_device_usbh_ohci (&carmeva_usbh_data);/* USB Device */ at91_add_device_udc (&carmeva_udc_data);/* I2C */
arch/arm/mach-at91/board-cpu9krea.c +1 -1
@@ -351,7 +351,7 @@ static void __init cpu9krea_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&cpu9krea_usbh_data); +at91_add_device_usbh_ohci (&cpu9krea_usbh_data);/* USB Device */ at91_add_device_udc (&cpu9krea_udc_data);/* NAND */
arch/arm/mach-at91/board-cpuat91.c +1 -1
@@ -162,7 +162,7 @@ static void __init cpuat91_board_init(void)/* Ethernet */ at91_add_device_eth (&cpuat91_eth_data);/* USB Host */ -at91_add_device_usbh (&cpuat91_usbh_data); +at91_add_device_usbh_ohci (&cpuat91_usbh_data);/* USB Device */ at91_add_device_udc (&cpuat91_udc_data);/* MMC */
arch/arm/mach-at91/board-csb337.c +1 -1
@@ -235,7 +235,7 @@ static void __init csb337_board_init(void)/* Ethernet */ at91_add_device_eth (&csb337_eth_data);/* USB Host */ -at91_add_device_usbh (&csb337_usbh_data); +at91_add_device_usbh_ohci (&csb337_usbh_data);/* USB Device */ at91_add_device_udc (&csb337_udc_data);/* I2C */
arch/arm/mach-at91/board-csb637.c +1 -1
@@ -125,7 +125,7 @@ static void __init csb637_board_init(void)/* Ethernet */ at91_add_device_eth (&csb637_eth_data);/* USB Host */ -at91_add_device_usbh (&csb637_usbh_data); +at91_add_device_usbh_ohci (&csb637_usbh_data);/* USB Device */ at91_add_device_udc (&csb637_udc_data);/* I2C */
arch/arm/mach-at91/board-eb9200.c +1 -1
@@ -105,7 +105,7 @@ static void __init eb9200_board_init(void)/* Ethernet */ at91_add_device_eth (&eb9200_eth_data);/* USB Host */ -at91_add_device_usbh (&eb9200_usbh_data); +at91_add_device_usbh_ohci (&eb9200_usbh_data);/* USB Device */ at91_add_device_udc (&eb9200_udc_data);/* I2C */
arch/arm/mach-at91/board-ecbat91.c +1 -1
@@ -154,7 +154,7 @@ static void __init ecb_at91board_init(void)at91_add_device_eth (&ecb_at91eth_data);/* USB Host */ -at91_add_device_usbh (&ecb_at91usbh_data); +at91_add_device_usbh_ohci (&ecb_at91usbh_data);/* I2C */ at91_add_device_i2c (NULL ,0 );
arch/arm/mach-at91/board-eco920.c +1 -1
@@ -114,7 +114,7 @@ static void __init eco920_board_init(void) {at91_add_device_serial ();at91_add_device_eth (&eco920_eth_data); -at91_add_device_usbh (&eco920_usbh_data); +at91_add_device_usbh_ohci (&eco920_usbh_data);at91_add_device_udc (&eco920_udc_data);at91_add_device_mmc (0 , &eco920_mmc_data);
arch/arm/mach-at91/board-flexibity.c +1 -1
@@ -140,7 +140,7 @@ static void __init flexibity_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&flexibity_usbh_data); +at91_add_device_usbh_ohci (&flexibity_usbh_data);/* USB Device */ at91_add_device_udc (&flexibity_udc_data);/* SPI */
arch/arm/mach-at91/board-foxg20.c +1 -1
@@ -244,7 +244,7 @@ static void __init foxg20_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&foxg20_usbh_data); +at91_add_device_usbh_ohci (&foxg20_usbh_data);/* USB Device */ at91_add_device_udc (&foxg20_udc_data);/* SPI */
arch/arm/mach-at91/board-gsia18s.c +1 -1
@@ -561,7 +561,7 @@ static int __init gsia18s_power_off_init(void)static void __init gsia18s_board_init (void ) {stamp9g20_board_init (); -at91_add_device_usbh (&usbh_data); +at91_add_device_usbh_ohci (&usbh_data);at91_add_device_udc (&udc_data);at91_add_device_eth (&macb_data);gsia18s_leds_init ();
arch/arm/mach-at91/board-kafa.c +1 -1
@@ -83,7 +83,7 @@ static void __init kafa_board_init(void)/* Ethernet */ at91_add_device_eth (&kafa_eth_data);/* USB Host */ -at91_add_device_usbh (&kafa_usbh_data); +at91_add_device_usbh_ohci (&kafa_usbh_data);/* USB Device */ at91_add_device_udc (&kafa_udc_data);/* I2C */
arch/arm/mach-at91/board-kb9202.c +1 -1
@@ -121,7 +121,7 @@ static void __init kb9202_board_init(void)/* Ethernet */ at91_add_device_eth (&kb9202_eth_data);/* USB Host */ -at91_add_device_usbh (&kb9202_usbh_data); +at91_add_device_usbh_ohci (&kb9202_usbh_data);/* USB Device */ at91_add_device_udc (&kb9202_udc_data);/* MMC */
arch/arm/mach-at91/board-neocore926.c +1 -1
@@ -351,7 +351,7 @@ static void __init neocore926_board_init(void)at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&neocore926_usbh_data); +at91_add_device_usbh_ohci (&neocore926_usbh_data);/* USB Device */ at91_add_device_udc (&neocore926_udc_data);
arch/arm/mach-at91/board-pcontrol-g20.c +1 -1
@@ -205,7 +205,7 @@ static struct spi_board_info pcontrol_g20_spi_devices[] = {static void __init pcontrol_g20_board_init (void ) {stamp9g20_board_init (); -at91_add_device_usbh (&usbh_data); +at91_add_device_usbh_ohci (&usbh_data);at91_add_device_eth (&macb_data);at91_add_device_i2c (pcontrol_g20_i2c_devices,ARRAY_SIZE (pcontrol_g20_i2c_devices));
arch/arm/mach-at91/board-picotux200.c +1 -1
@@ -111,7 +111,7 @@ static void __init picotux200_board_init(void)/* Ethernet */ at91_add_device_eth (&picotux200_eth_data);/* USB Host */ -at91_add_device_usbh (&picotux200_usbh_data); +at91_add_device_usbh_ohci (&picotux200_usbh_data);/* I2C */ at91_add_device_i2c (NULL ,0 );/* MMC */
arch/arm/mach-at91/board-qil-a9260.c +1 -1
@@ -244,7 +244,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* SPI */
arch/arm/mach-at91/board-rm9200dk.c +1 -1
@@ -197,7 +197,7 @@ static void __init dk_board_init(void)/* Ethernet */ at91_add_device_eth (&dk_eth_data);/* USB Host */ -at91_add_device_usbh (&dk_usbh_data); +at91_add_device_usbh_ohci (&dk_usbh_data);/* USB Device */ at91_add_device_udc (&dk_udc_data);at91_set_multi_drive (dk_udc_data.pullup_pin,1 );/* pullup_pin is connected to reset */
arch/arm/mach-at91/board-rm9200ek.c +1 -1
@@ -167,7 +167,7 @@ static void __init ek_board_init(void)/* Ethernet */ at91_add_device_eth (&ek_eth_data);/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);at91_set_multi_drive (ek_udc_data.pullup_pin,1 );/* pullup_pin is connected to reset */
arch/arm/mach-at91/board-sam9-l9260.c +1 -1
@@ -195,7 +195,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* SPI */
arch/arm/mach-at91/board-sam9260ek.c +1 -1
@@ -332,7 +332,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* SPI */
arch/arm/mach-at91/board-sam9261ek.c +1 -1
@@ -586,7 +586,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* I2C */
arch/arm/mach-at91/board-sam9263ek.c +1 -1
@@ -423,7 +423,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* SPI */
arch/arm/mach-at91/board-sam9g20ek.c +1 -1
@@ -379,7 +379,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* SPI */
arch/arm/mach-at91/board-snapper9260.c +1 -1
@@ -169,7 +169,7 @@ static void __init snapper9260_board_init(void)at91_add_device_i2c (snapper9260_i2c_devices,ARRAY_SIZE (snapper9260_i2c_devices));at91_add_device_serial (); -at91_add_device_usbh (&snapper9260_usbh_data); +at91_add_device_usbh_ohci (&snapper9260_usbh_data);at91_add_device_udc (&snapper9260_udc_data);at91_add_device_eth (&snapper9260_macb_data); at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK |
arch/arm/mach-at91/board-stamp9g20.c +2 -2
@@ -268,7 +268,7 @@ static void __init portuxg20_board_init(void) {stamp9g20_board_init ();/* USB Host */ -at91_add_device_usbh (&usbh_data); +at91_add_device_usbh_ohci (&usbh_data);/* USB Device */ at91_add_device_udc (&portuxg20_udc_data);/* Ethernet */
@@ -285,7 +285,7 @@ static void __init stamp9g20evb_board_init(void) {stamp9g20_board_init ();/* USB Host */ -at91_add_device_usbh (&usbh_data); +at91_add_device_usbh_ohci (&usbh_data);/* USB Device */ at91_add_device_udc (&stamp9g20evb_udc_data);/* Ethernet */
arch/arm/mach-at91/board-usb-a9260.c +1 -1
@@ -208,7 +208,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* NAND */
arch/arm/mach-at91/board-usb-a9263.c +1 -1
@@ -222,7 +222,7 @@ static void __init ek_board_init(void)/* Serial */ at91_add_device_serial ();/* USB Host */ -at91_add_device_usbh (&ek_usbh_data); +at91_add_device_usbh_ohci (&ek_usbh_data);/* USB Device */ at91_add_device_udc (&ek_udc_data);/* SPI */
arch/arm/mach-at91/board-yl-9200.c +1 -1
@@ -567,7 +567,7 @@ static void __init yl9200_board_init(void)/* Ethernet */ at91_add_device_eth (&yl9200_eth_data);/* USB Host */ -at91_add_device_usbh (&yl9200_usbh_data); +at91_add_device_usbh_ohci (&yl9200_usbh_data);/* USB Device */ at91_add_device_udc (&yl9200_udc_data);/* I2C */
arch/arm/mach-at91/devices.c +117 -0
131 lines not on this page · raw message
arch/arm/mach-at91/devices.h +13 -0
@@ -28,6 +28,11 @@ struct at91_pin_config {int value; }; +struct at91_dev_table_basic_device { +unsigned mmio_base; +int irq; +}; +struct at91_dev_table_ethernet {unsigned mmio_base;int irq;
@@ -37,8 +42,16 @@ struct at91_dev_table_ethernet {int nr_mii_pins; }; +struct at91_dev_table_usb_ohci { +unsigned mmio_base; +int irq; +void (*device_init)(void ); +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet; +struct at91_dev_table_usb_ohci *usbh_ohci; +struct at91_dev_table_basic_device *usbh_ehci; };extern void __init at91_init_devices (struct at91_device_table *device_table);
arch/arm/mach-at91/include/mach/board.h +0 -1
@@ -99,7 +99,6 @@ struct at91_usbh_data {u8 ports;/* number of ports on root hub */ u8 vbus_pin[2 ];/* port power-control pin */ }; -extern void __init at91_add_device_usbh (struct at91_usbh_data *data);extern void __init at91_add_device_usbh_ohci (struct at91_usbh_data *data);extern void __init at91_add_device_usbh_ehci (struct at91_usbh_data *data);
Signature · 1 line
1.7.0.4
PATCH v2 4/23 at91: Make UDC device common
In reply to Ryan MallonReplace the individual UDC device code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at572d940hf_devices.c | 48 ++------------------------- arch/arm/mach-at91/at91rm9200_devices.c | 48 ++------------------------- arch/arm/mach-at91/at91sam9260_devices.c | 48 ++------------------------- arch/arm/mach-at91/at91sam9261_devices.c | 47 ++------------------------ arch/arm/mach-at91/at91sam9263_devices.c | 48 ++------------------------- arch/arm/mach-at91/devices.c | 52 ++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 1 + 7 files changed, 73 insertions(+), 219 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +4 -44
@@ -51,52 +51,11 @@ static struct at91_dev_table_usb_ohci device_usbh_ohci __initdata = {* USB Device (Gadget) * -------------------------------------------------------------------- */ -#ifdef CONFIG_USB_GADGET_AT91 -static struct at91_udc_data udc_data; - -static struct resource udc_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_UDP , - .end =AT572D940HF_BASE_UDP +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_UDP , - .end =AT572D940HF_ID_UDP , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at572d940hf_udc_device = { - .name ="at91_udc" , - .id =-1 , - .dev = { - .platform_data = &udc_data, - }, - .resource = udc_resources, - .num_resources =ARRAY_SIZE (udc_resources), +static struct at91_dev_table_basic_device device_udc__initdata = { + .mmio_base =AT572D940HF_BASE_UDP , + .irq =AT572D940HF_ID_UDP , }; -void __init at91_add_device_udc (struct at91_udc_data *data) -{ -if (!data) -return ; - -if (data->vbus_pin) { -at91_set_gpio_input (data->vbus_pin,0 ); -at91_set_deglitch (data->vbus_pin,1 ); - } - -/* Pullup pin is handled internally */ - - udc_data = *data; -platform_device_register (&at572d940hf_udc_device); -} -#else -void __init at91_add_device_udc (struct at91_udc_data *data) {} -#endif - -/* -------------------------------------------------------------------- * Ethernet * -------------------------------------------------------------------- */
@@ -876,6 +835,7 @@ void __init at91_add_device_mAgic(void) {}static struct at91_device_table at572d940hf_device_table__initdata = { .ethernet = &device_eth, .usbh_ohci = &device_usbh_ohci, + .udc = &device_udc, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91rm9200_devices.c +4 -44
62 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +4 -44
62 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +4 -43
61 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +4 -44
62 lines not on this page · raw message
arch/arm/mach-at91/devices.c +52 -0
58 lines not on this page · raw message
arch/arm/mach-at91/devices.h +1 -0
@@ -52,6 +52,7 @@ struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;struct at91_dev_table_basic_device *usbh_ehci; +struct at91_dev_table_basic_device *udc; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 5/23 at91: Make MMC device common
In reply to Ryan MallonReplace the individual MMC code for each at91 variant with a single implementation in devices.c. Both the AT91 MMC and Atmel MCI drivers are converted here to use the common data in both instances.
--- arch/arm/mach-at91/at572d940hf_devices.c | 79 ++-------- arch/arm/mach-at91/at91cap9_devices.c | 134 ++++------------- arch/arm/mach-at91/at91rm9200_devices.c | 96 +++---------- arch/arm/mach-at91/at91sam9260_devices.c | 192 +++--------------------- arch/arm/mach-at91/at91sam9261_devices.c | 76 ++-------- arch/arm/mach-at91/at91sam9263_devices.c | 173 ++++++---------------- arch/arm/mach-at91/at91sam9g45_devices.c | 189 +++++------------------- arch/arm/mach-at91/at91sam9rl.c | 4 + arch/arm/mach-at91/at91sam9rl_devices.c | 85 +++-------- arch/arm/mach-at91/devices.c | 237 ++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 15 ++ 11 files changed, 455 insertions(+), 825 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +15 -64
@@ -84,72 +84,22 @@ static struct at91_dev_table_ethernet device_eth __initdata = {* MMC / SD * -------------------------------------------------------------------- */ -#if defined(CONFIG_MMC_AT91 ) || defined(CONFIG_MMC_AT91_MODULE ) -static u64 mmc_dmamask =DMA_BIT_MASK (32 ); -static struct at91_mmc_data mmc_data; - -static struct resource mmc_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_MCI , - .end =AT572D940HF_BASE_MCI +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_MCI , - .end =AT572D940HF_ID_MCI , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at572d940hf_mmc_device = { - .name ="at91_mci" , - .id =-1 , - .dev = { - .dma_mask = &mmc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &mmc_data, - }, - .resource = mmc_resources, - .num_resources =ARRAY_SIZE (mmc_resources), +static struct at91_dev_table_mmc device_mmc__initdata = { + .mmio_base =AT572D940HF_BASE_MCI , + .irq =AT572D940HF_ID_MCI , + .clock_pin = {AT91_PIN_PC22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .slot[0 ] = { +/* mmc_id 0, slot a */ + .cmd_pin = {AT91_PIN_PC23 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .data_pins = { + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + {AT91_PIN_PC25 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + {AT91_PIN_PC26 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + {AT91_PIN_PC27 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + }, + }, }; -void __init at91_add_device_mmc (short mmc_id,struct at91_mmc_data *data) -{ -if (!data) -return ; - -/* input/irq */ -if (data->det_pin) { -at91_set_gpio_input (data->det_pin,1 ); -at91_set_deglitch (data->det_pin,1 ); - } -if (data->wp_pin) -at91_set_gpio_input (data->wp_pin,1 ); -if (data->vcc_pin) -at91_set_gpio_output (data->vcc_pin,0 ); - -/* CLK */ -at91_set_A_periph (AT91_PIN_PC22 ,0 ); - -/* CMD */ -at91_set_A_periph (AT91_PIN_PC23 ,1 ); - -/* DAT0, maybe DAT1..DAT3 */ -at91_set_A_periph (AT91_PIN_PC24 ,1 ); -if (data->wire4) { -at91_set_A_periph (AT91_PIN_PC25 ,1 ); -at91_set_A_periph (AT91_PIN_PC26 ,1 ); -at91_set_A_periph (AT91_PIN_PC27 ,1 ); - } - - mmc_data = *data; -platform_device_register (&at572d940hf_mmc_device); -} -#else -void __init at91_add_device_mmc (short mmc_id,struct at91_mmc_data *data) {} -#endif - -/* -------------------------------------------------------------------- * NAND / SmartMedia * -------------------------------------------------------------------- */
@@ -836,6 +786,7 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .ethernet = &device_eth, .usbh_ohci = &device_usbh_ohci, .udc = &device_udc, + .mmc[0] = &device_mmc, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91cap9_devices.c +28 -106
152 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200_devices.c +21 -75
112 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +21 -171
208 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +13 -63
91 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +44 -129
193 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +36 -153
207 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl.c +4 -0
@@ -24,6 +24,8 @@#include "generic.h" #include "clock.h" +extern void __init at91sam9rl_init_devices (void ); +static struct map_desc at91sam9rl_io_desc[]__initdata = { { .virtual =AT91_VA_BASE_SYS ,
@@ -259,6 +261,8 @@ void __init at91sam9rl_initialize(unsigned long main_clock)/* Map peripherals */ iotable_init (at91sam9rl_io_desc,ARRAY_SIZE (at91sam9rl_io_desc)); +at91sam9rl_init_devices (); + cidr =at91_sys_read (AT91_DBGU_CIDR );switch (cidr &AT91_CIDR_SRAMSIZ ) {
arch/arm/mach-at91/at91sam9rl_devices.c +21 -64
106 lines not on this page · raw message
arch/arm/mach-at91/devices.c +237 -0
243 lines not on this page · raw message
arch/arm/mach-at91/devices.h +15 -0
@@ -48,11 +48,26 @@ struct at91_dev_table_usb_ohci {void (*device_init)(void ); }; +struct at91_mmc_pins { +struct at91_pin_config cmd_pin; +struct at91_pin_config data_pins[8 ]; +int bus_width; +}; + +struct at91_dev_table_mmc { +unsigned mmio_base; +int irq; +const char *clock_asc; +struct at91_pin_config clock_pin; +struct at91_mmc_pins slot[2 ]; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;struct at91_dev_table_basic_device *usbh_ehci;struct at91_dev_table_basic_device *udc; +struct at91_dev_table_mmc *mmc[2 ]; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 6/23 at91: Make NAND device common
In reply to Ryan MallonReplace the individual NAND code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at572d940hf_devices.c | 65 ++++-------------------- arch/arm/mach-at91/at91cap9_devices.c | 62 ++-------------------- arch/arm/mach-at91/at91rm9200_devices.c | 81 +++++++----------------------- arch/arm/mach-at91/at91sam9260_devices.c | 62 ++-------------------- arch/arm/mach-at91/at91sam9261_devices.c | 63 ++++------------------- arch/arm/mach-at91/at91sam9263_devices.c | 62 ++-------------------- arch/arm/mach-at91/at91sam9g45_devices.c | 62 ++-------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 66 ++---------------------- arch/arm/mach-at91/devices.c | 76 ++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 12 ++++ 10 files changed, 158 insertions(+), 453 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +11 -54
@@ -104,64 +104,20 @@ static struct at91_dev_table_mmc device_mmc __initdata = {* NAND / SmartMedia * -------------------------------------------------------------------- */ -#if defined(CONFIG_MTD_NAND_ATMEL ) || defined(CONFIG_MTD_NAND_ATMEL_MODULE ) -static struct atmel_nand_data nand_data; - -#define NAND_BASE AT91_CHIPSELECT_3 - -static struct resource nand_resources[] = { - { - .start =NAND_BASE , - .end =NAND_BASE +SZ_256M -1 , - .flags =IORESOURCE_MEM , - } +static struct at91_pin_config nand_pins[]__initdata = { + {AT91_PIN_PB28 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* A[22] */ + {AT91_PIN_PA28 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* NANDOE */ + {AT91_PIN_PA29 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* NANDWE */ }; -static struct platform_device at572d940hf_nand_device = { - .name ="atmel_nand" , - .id =-1 , - .dev = { - .platform_data = &nand_data, - }, - .resource = nand_resources, - .num_resources =ARRAY_SIZE (nand_resources), +static struct at91_dev_table_nand device_nand__initdata = { + .chip_select =3 , + .enable_reg =AT91_MATRIX_EBICSA , + .enable =AT91_MATRIX_CS3A_SMC_SMARTMEDIA , + .pins = nand_pins, + .nr_pins =ARRAY_SIZE (nand_pins), }; -void __init at91_add_device_nand (struct atmel_nand_data *data) -{ -unsigned long csa; - -if (!data) -return ; - - csa =at91_sys_read (AT91_MATRIX_EBICSA ); -at91_sys_write (AT91_MATRIX_EBICSA , csa |AT91_MATRIX_CS3A_SMC_SMARTMEDIA ); - -/* enable pin */ -if (data->enable_pin) -at91_set_gpio_output (data->enable_pin,1 ); - -/* ready/busy pin */ -if (data->rdy_pin) -at91_set_gpio_input (data->rdy_pin,1 ); - -/* card detect pin */ -if (data->det_pin) -at91_set_gpio_input (data->det_pin,1 ); - -at91_set_A_periph (AT91_PIN_PB28 ,0 );/* A[22] */ -at91_set_B_periph (AT91_PIN_PA28 ,0 );/* NANDOE */ -at91_set_B_periph (AT91_PIN_PA29 ,0 );/* NANDWE */ - - nand_data = *data; -platform_device_register (&at572d940hf_nand_device); -} - -#else -void __init at91_add_device_nand (struct atmel_nand_data *data) {} -#endif - -/* -------------------------------------------------------------------- * TWI (i2c) * -------------------------------------------------------------------- */
@@ -787,6 +743,7 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .usbh_ohci = &device_usbh_ohci, .udc = &device_udc, .mmc[0] = &device_mmc, + .nand = &device_nand, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91cap9_devices.c +6 -56
76 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200_devices.c +19 -62
95 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +6 -56
76 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +10 -53
79 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +6 -56
76 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +6 -56
76 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +6 -60
80 lines not on this page · raw message
arch/arm/mach-at91/devices.c +76 -0
82 lines not on this page · raw message
arch/arm/mach-at91/devices.h +12 -0
@@ -62,12 +62,24 @@ struct at91_dev_table_mmc {struct at91_mmc_pins slot[2 ]; }; +struct at91_dev_table_nand { +unsigned chip_select; +unsigned enable_reg; +unsigned enable; +unsigned ecc_mmio_base; +unsigned flags_reg; +unsigned flags; +struct at91_pin_config *pins; +int nr_pins; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;struct at91_dev_table_basic_device *usbh_ehci;struct at91_dev_table_basic_device *udc;struct at91_dev_table_mmc *mmc[2 ]; +struct at91_dev_table_nand *nand; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 7/23 at91: Make TWI device common
In reply to Ryan MallonReplace the individual TWI code for each at91 variant with a single implementation in devices.c
The AT91SAM9G45 has an additional argument to at91_add_device_i2c for the bus number. We change the other variants to use this API for consistency.
--- arch/arm/mach-at91/at572d940hf_devices.c | 111 +++-------------------- arch/arm/mach-at91/at91cap9_devices.c | 76 ++--------------- arch/arm/mach-at91/at91rm9200_devices.c | 77 ++--------------- arch/arm/mach-at91/at91sam9260_devices.c | 78 ++--------------- arch/arm/mach-at91/at91sam9261_devices.c | 77 ++--------------- arch/arm/mach-at91/at91sam9263_devices.c | 77 ++--------------- arch/arm/mach-at91/at91sam9g45_devices.c | 136 +++-------------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 77 ++--------------- arch/arm/mach-at91/board-afeb-9260v1.c | 2 +- arch/arm/mach-at91/board-at572d940hf_ek.c | 2 +- arch/arm/mach-at91/board-cap9adk.c | 2 +- arch/arm/mach-at91/board-carmeva.c | 2 +- arch/arm/mach-at91/board-cpu9krea.c | 2 +- arch/arm/mach-at91/board-cpuat91.c | 2 +- arch/arm/mach-at91/board-csb337.c | 2 +- arch/arm/mach-at91/board-csb637.c | 2 +- arch/arm/mach-at91/board-eb9200.c | 2 +- arch/arm/mach-at91/board-ecbat91.c | 2 +- arch/arm/mach-at91/board-foxg20.c | 2 +- arch/arm/mach-at91/board-gsia18s.c | 2 +- arch/arm/mach-at91/board-kafa.c | 2 +- arch/arm/mach-at91/board-kb9202.c | 2 +- arch/arm/mach-at91/board-neocore926.c | 2 +- arch/arm/mach-at91/board-pcontrol-g20.c | 2 +- arch/arm/mach-at91/board-picotux200.c | 2 +- arch/arm/mach-at91/board-qil-a9260.c | 2 +- arch/arm/mach-at91/board-rm9200dk.c | 2 +- arch/arm/mach-at91/board-rm9200ek.c | 2 +- arch/arm/mach-at91/board-sam9-l9260.c | 2 +- arch/arm/mach-at91/board-sam9260ek.c | 2 +- arch/arm/mach-at91/board-sam9261ek.c | 2 +- arch/arm/mach-at91/board-sam9263ek.c | 2 +- arch/arm/mach-at91/board-sam9g20ek.c | 2 +- arch/arm/mach-at91/board-sam9rlek.c | 2 +- arch/arm/mach-at91/board-snapper9260.c | 2 +- arch/arm/mach-at91/board-stamp9g20.c | 4 +- arch/arm/mach-at91/board-usb-a9260.c | 2 +- arch/arm/mach-at91/board-usb-a9263.c | 2 +- arch/arm/mach-at91/board-yl-9200.c | 2 +- arch/arm/mach-at91/devices.c | 122 ++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 9 ++ arch/arm/mach-at91/include/mach/board.h | 4 - 42 files changed, 233 insertions(+), 675 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +14 -97
@@ -122,107 +122,22 @@ static struct at91_dev_table_nand device_nand __initdata = {* TWI (i2c) * -------------------------------------------------------------------- */ -/* -* Prefer the GPIO code since the TWI controller isn't robust -* (gets overruns and underruns under load) and can only issue -* repeated STARTs in one scenario (the driver doesn't yet handle them). -*/ - -#if defined(CONFIG_I2C_GPIO ) || defined(CONFIG_I2C_GPIO_MODULE ) - -static struct i2c_gpio_platform_data pdata = { - .sda_pin =AT91_PIN_PC7 , - .sda_is_open_drain =1 , - .scl_pin =AT91_PIN_PC8 , - .scl_is_open_drain =1 , - .udelay =2 ,/* ~100 kHz */ -}; - -static struct platform_device at572d940hf_twi_device { - .name = "i2c-gpio", - .id = -1, - .dev.platform_data = &pdata, -}; - -void __init at91_add_device_i2c (struct i2c_board_info *devices,int nr_devices) -{ -at91_set_GPIO_periph (AT91_PIN_PC7 ,1 );/* TWD (SDA) */ -at91_set_multi_drive (AT91_PIN_PC7 ,1 ); - -at91_set_GPIO_periph (AT91_PIN_PA8 ,1 );/* TWCK (SCL) */ -at91_set_multi_drive (AT91_PIN_PC8 ,1 ); - -i2c_register_board_info (0 , devices, nr_devices); -platform_device_register (&at572d940hf_twi_device); -} - -#elif defined(CONFIG_I2C_AT91 ) || defined(CONFIG_I2C_AT91_MODULE ) - -static struct resource twi0_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_TWI0 , - .end =AT572D940HF_BASE_TWI0 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_TWI0 , - .end =AT572D940HF_ID_TWI0 , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at572d940hf_twi0_device = { - .name ="at91_i2c" , - .id =0 , - .resource = twi0_resources, - .num_resources =ARRAY_SIZE (twi0_resources), +static struct at91_dev_table_twi device_twi0__initdata = { + .mmio_base =AT572D940HF_BASE_TWI0 , + .irq =AT572D940HF_ID_TWI0 , + .sda_pin = {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .scl_pin = {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .udelay =2 , }; -static struct resource twi1_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_TWI1 , - .end =AT572D940HF_BASE_TWI1 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_TWI1 , - .end =AT572D940HF_ID_TWI1 , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at572d940hf_twi1_device = { - .name ="at91_i2c" , - .id =1 , - .resource = twi1_resources, - .num_resources =ARRAY_SIZE (twi1_resources), +static struct at91_dev_table_twi device_twi1__initdata = { + .mmio_base =AT572D940HF_BASE_TWI1 , + .irq =AT572D940HF_ID_TWI1 , + .sda_pin = {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .scl_pin = {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .udelay =2 , }; -void __init at91_add_device_i2c (struct i2c_board_info *devices,int nr_devices) -{ -/* pins used for TWI0 interface */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* TWD */ -at91_set_multi_drive (AT91_PIN_PC7 ,1 ); - -at91_set_A_periph (AT91_PIN_PC8 ,0 );/* TWCK */ -at91_set_multi_drive (AT91_PIN_PC8 ,1 ); - -/* pins used for TWI1 interface */ -at91_set_A_periph (AT91_PIN_PC20 ,0 );/* TWD */ -at91_set_multi_drive (AT91_PIN_PC20 ,1 ); - -at91_set_A_periph (AT91_PIN_PC21 ,0 );/* TWCK */ -at91_set_multi_drive (AT91_PIN_PC21 ,1 ); - -i2c_register_board_info (0 , devices, nr_devices); -platform_device_register (&at572d940hf_twi0_device); -platform_device_register (&at572d940hf_twi1_device); -} -#else -void __init at91_add_device_i2c (struct i2c_board_info *devices,int nr_devices) {} -#endif - -/* -------------------------------------------------------------------- * SPI * -------------------------------------------------------------------- */
@@ -744,6 +659,8 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .udc = &device_udc, .mmc[0] = &device_mmc, .nand = &device_nand, + .twi[0] = &device_twi0, + .twi[1] = &device_twi1, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91cap9_devices.c +7 -69
90 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200_devices.c +7 -70
91 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +7 -71
92 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +7 -70
91 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +7 -70
91 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +14 -122
152 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +7 -70
91 lines not on this page · raw message
arch/arm/mach-at91/board-afeb-9260v1.c +1 -1
@@ -208,7 +208,7 @@ static void __init afeb9260_board_init(void)/* MMC */ at91_add_device_mmc (0 , &afeb9260_mmc_data);/* I2C */ -at91_add_device_i2c (afeb9260_i2c_devices, +at91_add_device_i2c (0 , afeb9260_i2c_devices,ARRAY_SIZE (afeb9260_i2c_devices));/* Audio */ at91_add_device_ssc (AT91SAM9260_ID_SSC ,ATMEL_SSC_TX );
arch/arm/mach-at91/board-at572d940hf_ek.c +1 -1
@@ -301,7 +301,7 @@ static void __init eb_board_init(void)/* USB Device */ at91_add_device_udc (&eb_udc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* NOR */ eb_add_device_nor ();/* NAND */
arch/arm/mach-at91/board-cap9adk.c +1 -1
@@ -390,7 +390,7 @@ static void __init cap9adk_board_init(void)/* NOR Flash */ cap9adk_add_device_nor ();/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* LCD Controller */ at91_add_device_lcdc (&cap9adk_lcdc_data);/* AC97 */
arch/arm/mach-at91/board-carmeva.c +1 -1
@@ -149,7 +149,7 @@ static void __init carmeva_board_init(void)/* USB Device */ at91_add_device_udc (&carmeva_udc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* SPI */ at91_add_device_spi (carmeva_spi_devices,ARRAY_SIZE (carmeva_spi_devices));/* Compact Flash */
arch/arm/mach-at91/board-cpu9krea.c +1 -1
@@ -361,7 +361,7 @@ static void __init cpu9krea_board_init(void)/* MMC */ at91_add_device_mmc (0 , &cpu9krea_mmc_data);/* I2C */ -at91_add_device_i2c (cpu9krea_i2c_devices, +at91_add_device_i2c (0 , cpu9krea_i2c_devices,ARRAY_SIZE (cpu9krea_i2c_devices));/* LEDs */ at91_gpio_leds (cpu9krea_leds,ARRAY_SIZE (cpu9krea_leds));
arch/arm/mach-at91/board-cpuat91.c +1 -1
@@ -168,7 +168,7 @@ static void __init cpuat91_board_init(void)/* MMC */ at91_add_device_mmc (0 , &cpuat91_mmc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* Platform devices */ platform_add_devices (platform_devices,ARRAY_SIZE (platform_devices)); }
arch/arm/mach-at91/board-csb337.c +1 -1
@@ -239,7 +239,7 @@ static void __init csb337_board_init(void)/* USB Device */ at91_add_device_udc (&csb337_udc_data);/* I2C */ -at91_add_device_i2c (csb337_i2c_devices,ARRAY_SIZE (csb337_i2c_devices)); +at91_add_device_i2c (0 , csb337_i2c_devices,ARRAY_SIZE (csb337_i2c_devices));/* Compact Flash */ at91_set_gpio_input (AT91_PIN_PB22 ,1 );/* IOIS16 */ at91_add_device_cf (&csb337_cf_data);
arch/arm/mach-at91/board-csb637.c +1 -1
@@ -129,7 +129,7 @@ static void __init csb637_board_init(void)/* USB Device */ at91_add_device_udc (&csb637_udc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* SPI */ at91_add_device_spi (NULL ,0 );/* NOR flash */
arch/arm/mach-at91/board-eb9200.c +1 -1
@@ -109,7 +109,7 @@ static void __init eb9200_board_init(void)/* USB Device */ at91_add_device_udc (&eb9200_udc_data);/* I2C */ -at91_add_device_i2c (eb9200_i2c_devices,ARRAY_SIZE (eb9200_i2c_devices)); +at91_add_device_i2c (0 , eb9200_i2c_devices,ARRAY_SIZE (eb9200_i2c_devices));/* Compact Flash */ at91_add_device_cf (&eb9200_cf_data);/* SPI */
arch/arm/mach-at91/board-ecbat91.c +1 -1
@@ -157,7 +157,7 @@ static void __init ecb_at91board_init(void)at91_add_device_usbh_ohci (&ecb_at91usbh_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* MMC */ at91_add_device_mmc (0 , &ecb_at91mmc_data);
arch/arm/mach-at91/board-foxg20.c +1 -1
@@ -254,7 +254,7 @@ static void __init foxg20_board_init(void)/* MMC */ at91_add_device_mmc (0 , &foxg20_mmc_data);/* I2C */ -at91_add_device_i2c (foxg20_i2c_devices,ARRAY_SIZE (foxg20_i2c_devices)); +at91_add_device_i2c (0 , foxg20_i2c_devices,ARRAY_SIZE (foxg20_i2c_devices));/* LEDs */ at91_gpio_leds (foxg20_leds,ARRAY_SIZE (foxg20_leds));/* Push Buttons */
arch/arm/mach-at91/board-gsia18s.c +1 -1
@@ -567,7 +567,7 @@ static void __init gsia18s_board_init(void)gsia18s_leds_init ();gsia18s_pcf_leds_init ();gsia18s_add_device_buttons (); -at91_add_device_i2c (gsia18s_i2c_devices, +at91_add_device_i2c (0 , gsia18s_i2c_devices,ARRAY_SIZE (gsia18s_i2c_devices));at91_add_device_cf (&gsia18s_cf1_data); at91_add_device_spi(gsia18s_spi_devices,
arch/arm/mach-at91/board-kafa.c +1 -1
@@ -87,7 +87,7 @@ static void __init kafa_board_init(void)/* USB Device */ at91_add_device_udc (&kafa_udc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* SPI */ at91_add_device_spi (NULL ,0 ); }
arch/arm/mach-at91/board-kb9202.c +1 -1
@@ -127,7 +127,7 @@ static void __init kb9202_board_init(void)/* MMC */ at91_add_device_mmc (0 , &kb9202_mmc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* SPI */ at91_add_device_spi (NULL ,0 );/* NAND */
arch/arm/mach-at91/board-neocore926.c +1 -1
@@ -373,7 +373,7 @@ static void __init neocore926_board_init(void)neocore926_add_device_nand ();/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* LCD Controller */ at91_add_device_lcdc (&neocore926_lcdc_data);
arch/arm/mach-at91/board-pcontrol-g20.c +1 -1
@@ -207,7 +207,7 @@ static void __init pcontrol_g20_board_init(void)stamp9g20_board_init ();at91_add_device_usbh_ohci (&usbh_data);at91_add_device_eth (&macb_data); -at91_add_device_i2c (pcontrol_g20_i2c_devices, +at91_add_device_i2c (0 , pcontrol_g20_i2c_devices,ARRAY_SIZE (pcontrol_g20_i2c_devices));add_device_pcontrol (); at91_add_device_spi(pcontrol_g20_spi_devices,
arch/arm/mach-at91/board-picotux200.c +1 -1
@@ -113,7 +113,7 @@ static void __init picotux200_board_init(void)/* USB Host */ at91_add_device_usbh_ohci (&picotux200_usbh_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* MMC */ at91_set_gpio_output (AT91_PIN_PB22 ,1 );/* this MMC card slot can optionally use SPI signaling (CS3). */ at91_add_device_mmc (0 , &picotux200_mmc_data);
arch/arm/mach-at91/board-qil-a9260.c +1 -1
@@ -252,7 +252,7 @@ static void __init ek_board_init(void)/* NAND */ ek_add_device_nand ();/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* Ethernet */ at91_add_device_eth (&ek_macb_data);/* MMC */
arch/arm/mach-at91/board-rm9200dk.c +1 -1
@@ -204,7 +204,7 @@ static void __init dk_board_init(void)/* Compact Flash */ at91_add_device_cf (&dk_cf_data);/* I2C */ -at91_add_device_i2c (dk_i2c_devices,ARRAY_SIZE (dk_i2c_devices)); +at91_add_device_i2c (0 , dk_i2c_devices,ARRAY_SIZE (dk_i2c_devices));/* SPI */ at91_add_device_spi (dk_spi_devices,ARRAY_SIZE (dk_spi_devices));#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
arch/arm/mach-at91/board-rm9200ek.c +1 -1
@@ -172,7 +172,7 @@ static void __init ek_board_init(void)at91_add_device_udc (&ek_udc_data);at91_set_multi_drive (ek_udc_data.pullup_pin,1 );/* pullup_pin is connected to reset */ /* I2C */ -at91_add_device_i2c (ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices)); +at91_add_device_i2c (0 , ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices));/* SPI */ at91_add_device_spi (ek_spi_devices,ARRAY_SIZE (ek_spi_devices));#ifdef CONFIG_MTD_AT91_DATAFLASH_CARD
arch/arm/mach-at91/board-sam9-l9260.c +1 -1
@@ -207,7 +207,7 @@ static void __init ek_board_init(void)/* MMC */ at91_add_device_mmc (0 , &ek_mmc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 ); }MACHINE_START (SAM9_L9260 ,"Olimex SAM9-L9260" )
arch/arm/mach-at91/board-sam9260ek.c +1 -1
@@ -344,7 +344,7 @@ static void __init ek_board_init(void)/* MMC */ at91_add_device_mmc (0 , &ek_mmc_data);/* I2C */ -at91_add_device_i2c (ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices)); +at91_add_device_i2c (0 , ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices));/* SSC (to AT73C213) */ at73c213_set_clk (&at73c213_data);at91_add_device_ssc (AT91SAM9260_ID_SSC ,ATMEL_SSC_TX );
arch/arm/mach-at91/board-sam9261ek.c +1 -1
@@ -590,7 +590,7 @@ static void __init ek_board_init(void)/* USB Device */ at91_add_device_udc (&ek_udc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* NAND */ ek_add_device_nand ();/* DM9000 ethernet */
arch/arm/mach-at91/board-sam9263ek.c +1 -1
@@ -438,7 +438,7 @@ static void __init ek_board_init(void)/* NAND */ ek_add_device_nand ();/* I2C */ -at91_add_device_i2c (ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices)); +at91_add_device_i2c (0 , ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices));/* LCD Controller */ at91_add_device_lcdc (&ek_lcdc_data);/* Push Buttons */
arch/arm/mach-at91/board-sam9g20ek.c +1 -1
@@ -393,7 +393,7 @@ static void __init ek_board_init(void)/* MMC */ ek_add_device_mmc ();/* I2C */ -at91_add_device_i2c (ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices)); +at91_add_device_i2c (0 , ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices));/* LEDs */ ek_add_device_gpio_leds ();/* Push Buttons */
arch/arm/mach-at91/board-sam9rlek.c +1 -1
@@ -308,7 +308,7 @@ static void __init ek_board_init(void)/* USB HS */ at91_add_device_usba (&ek_usba_udc_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* NAND */ ek_add_device_nand ();/* SPI */
arch/arm/mach-at91/board-snapper9260.c +1 -1
@@ -166,7 +166,7 @@ static void __init snapper9260_add_device_nand(void)static void __init snapper9260_board_init (void ) { -at91_add_device_i2c (snapper9260_i2c_devices, +at91_add_device_i2c (0 , snapper9260_i2c_devices,ARRAY_SIZE (snapper9260_i2c_devices));at91_add_device_serial ();at91_add_device_usbh_ohci (&snapper9260_usbh_data);
arch/arm/mach-at91/board-stamp9g20.c +2 -2
@@ -274,7 +274,7 @@ static void __init portuxg20_board_init(void)/* Ethernet */ at91_add_device_eth (&macb_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* SPI */ at91_add_device_spi (portuxg20_spi_devices,ARRAY_SIZE (portuxg20_spi_devices));/* LEDs */
@@ -291,7 +291,7 @@ static void __init stamp9g20evb_board_init(void)/* Ethernet */ at91_add_device_eth (&macb_data);/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* LEDs */ at91_gpio_leds (stamp9g20evb_leds,ARRAY_SIZE (stamp9g20evb_leds)); }
arch/arm/mach-at91/board-usb-a9260.c +1 -1
@@ -214,7 +214,7 @@ static void __init ek_board_init(void)/* NAND */ ek_add_device_nand ();/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* Ethernet */ at91_add_device_eth (&ek_macb_data);/* Push Buttons */
arch/arm/mach-at91/board-usb-a9263.c +1 -1
@@ -232,7 +232,7 @@ static void __init ek_board_init(void)/* NAND */ ek_add_device_nand ();/* I2C */ -at91_add_device_i2c (NULL ,0 ); +at91_add_device_i2c (0 ,NULL ,0 );/* Push Buttons */ ek_add_device_buttons ();/* LEDs */
arch/arm/mach-at91/board-yl-9200.c +1 -1
@@ -571,7 +571,7 @@ static void __init yl9200_board_init(void)/* USB Device */ at91_add_device_udc (&yl9200_udc_data);/* I2C */ -at91_add_device_i2c (yl9200_i2c_devices,ARRAY_SIZE (yl9200_i2c_devices)); +at91_add_device_i2c (0 , yl9200_i2c_devices,ARRAY_SIZE (yl9200_i2c_devices));/* MMC */ at91_add_device_mmc (0 , &yl9200_mmc_data);/* NAND */
arch/arm/mach-at91/devices.c +122 -0
134 lines not on this page · raw message
arch/arm/mach-at91/devices.h +9 -0
@@ -73,6 +73,14 @@ struct at91_dev_table_nand {int nr_pins; }; +struct at91_dev_table_twi { +unsigned mmio_base; +int irq; +struct at91_pin_config scl_pin; +struct at91_pin_config sda_pin; +int udelay;/* For i2c-gpio */ +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -80,6 +88,7 @@ struct at91_device_table {struct at91_dev_table_basic_device *udc;struct at91_dev_table_mmc *mmc[2 ];struct at91_dev_table_nand *nand; +struct at91_dev_table_twi *twi[2 ]; };extern void __init at91_init_devices (struct at91_device_table *device_table);
arch/arm/mach-at91/include/mach/board.h +0 -4
@@ -116,11 +116,7 @@ struct atmel_nand_data {extern void __init at91_add_device_nand (struct atmel_nand_data *data);/* I2C*/ -#if defined(CONFIG_ARCH_AT91SAM9G45 )extern void __init at91_add_device_i2c (short i2c_id,struct i2c_board_info *devices,int nr_devices); -#else -extern void __init at91_add_device_i2c (struct i2c_board_info *devices,int nr_devices); -#endif /* SPI */ extern void __init at91_add_device_spi (struct spi_board_info *devices,int nr_devices);
Signature · 1 line
1.7.0.4
PATCH v2 8/23 at91: Make SPI device common
In reply to Ryan MallonReplace the individual SPI code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at572d940hf_devices.c | 122 +++++------------------------- arch/arm/mach-at91/at91cap9_devices.c | 122 +++++------------------------- arch/arm/mach-at91/at91rm9200_devices.c | 69 ++--------------- arch/arm/mach-at91/at91sam9260_devices.c | 122 +++++------------------------- arch/arm/mach-at91/at91sam9261_devices.c | 122 +++++------------------------- arch/arm/mach-at91/at91sam9263_devices.c | 122 +++++------------------------- arch/arm/mach-at91/at91sam9g45_devices.c | 122 +++++------------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 67 ++-------------- arch/arm/mach-at91/devices.c | 103 +++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 11 +++ 10 files changed, 252 insertions(+), 730 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +20 -102
@@ -142,114 +142,30 @@ static struct at91_dev_table_twi device_twi1 __initdata = {* SPI * -------------------------------------------------------------------- */ -#if defined(CONFIG_SPI_ATMEL ) || defined(CONFIG_SPI_ATMEL_MODULE ) -static u64 spi_dmamask =DMA_BIT_MASK (32 ); - -static struct resource spi0_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_SPI0 , - .end =AT572D940HF_BASE_SPI0 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_SPI0 , - .end =AT572D940HF_ID_SPI0 , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at572d940hf_spi0_device = { - .name ="atmel_spi" , - .id =0 , - .dev = { - .dma_mask = &spi_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), +static struct at91_dev_table_spi device_spi0__initdata = { + .mmio_base =AT572D940HF_BASE_SPI0 , + .irq =AT572D940HF_ID_SPI0 , + .clk_asc ="spi0_clk" , + .standard_cs_pins = { +AT91_PIN_PA3 ,AT91_PIN_PA4 ,AT91_PIN_PA5 ,AT91_PIN_PA6 , }, - .resource = spi0_resources, - .num_resources =ARRAY_SIZE (spi0_resources), + .pin_miso = {AT91_PIN_PA0 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .pin_mosi = {AT91_PIN_PA1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .pin_spck = {AT91_PIN_PA2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, }; -static const unsigned spi0_standard_cs[4 ] = {AT91_PIN_PA3 ,AT91_PIN_PA4 ,AT91_PIN_PA5 ,AT91_PIN_PA6 }; - -static struct resource spi1_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_SPI1 , - .end =AT572D940HF_BASE_SPI1 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_SPI1 , - .end =AT572D940HF_ID_SPI1 , - .flags =IORESOURCE_IRQ , +static struct at91_dev_table_spi device_spi1__initdata = { + .mmio_base =AT572D940HF_BASE_SPI1 , + .irq =AT572D940HF_ID_SPI1 , + .clk_asc ="spi1_clk" , + .standard_cs_pins = { +AT91_PIN_PC3 ,AT91_PIN_PC4 ,AT91_PIN_PC5 ,AT91_PIN_PC6 , }, + .pin_miso = {AT91_PIN_PC0 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .pin_mosi = {AT91_PIN_PC1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .pin_spck = {AT91_PIN_PC2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, }; -static struct platform_device at572d940hf_spi1_device = { - .name ="atmel_spi" , - .id =1 , - .dev = { - .dma_mask = &spi_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - }, - .resource = spi1_resources, - .num_resources =ARRAY_SIZE (spi1_resources), -}; - -static const unsigned spi1_standard_cs[4 ] = {AT91_PIN_PC3 ,AT91_PIN_PC4 ,AT91_PIN_PC5 ,AT91_PIN_PC6 }; - -void __init at91_add_device_spi (struct spi_board_info *devices,int nr_devices) -{ -int i; -unsigned long cs_pin; -short enable_spi0 =0 ; -short enable_spi1 =0 ; - -/* Choose SPI chip-selects */ -for (i =0 ; i < nr_devices; i++) { -if (devices[i].controller_data) - cs_pin = (unsigned long ) devices[i].controller_data; -else if (devices[i].bus_num ==0 ) - cs_pin = spi0_standard_cs[devices[i].chip_select]; -else - cs_pin = spi1_standard_cs[devices[i].chip_select]; - -if (devices[i].bus_num ==0 ) - enable_spi0 =1 ; -else - enable_spi1 =1 ; - -/* enable chip-select pin */ -at91_set_gpio_output (cs_pin,1 ); - -/* pass chip-select pin to driver */ - devices[i].controller_data = (void *) cs_pin; - } - -spi_register_board_info (devices, nr_devices); - -/* Configure SPI bus(es) */ -if (enable_spi0) { -at91_set_A_periph (AT91_PIN_PA0 ,0 );/* SPI0_MISO */ -at91_set_A_periph (AT91_PIN_PA1 ,0 );/* SPI0_MOSI */ -at91_set_A_periph (AT91_PIN_PA2 ,0 );/* SPI0_SPCK */ - -at91_clock_associate ("spi0_clk" , &at572d940hf_spi0_device.dev,"spi_clk" ); -platform_device_register (&at572d940hf_spi0_device); - } -if (enable_spi1) { -at91_set_A_periph (AT91_PIN_PC0 ,0 );/* SPI1_MISO */ -at91_set_A_periph (AT91_PIN_PC1 ,0 );/* SPI1_MOSI */ -at91_set_A_periph (AT91_PIN_PC2 ,0 );/* SPI1_SPCK */ - -at91_clock_associate ("spi1_clk" , &at572d940hf_spi1_device.dev,"spi_clk" ); -platform_device_register (&at572d940hf_spi1_device); - } -} -#else -void __init at91_add_device_spi (struct spi_board_info *devices,int nr_devices) {} -#endif - -/* -------------------------------------------------------------------- * Timer/Counter blocks * -------------------------------------------------------------------- */
@@ -661,6 +577,8 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .nand = &device_nand, .twi[0] = &device_twi0, .twi[1] = &device_twi1, + .spi[0] = &device_spi0, + .spi[1] = &device_spi1, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91cap9_devices.c +20 -102
140 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200_devices.c +9 -60
84 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +20 -102
140 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +20 -102
140 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +20 -102
140 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +20 -102
140 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +9 -58
82 lines not on this page · raw message
arch/arm/mach-at91/devices.c +103 -0
109 lines not on this page · raw message
arch/arm/mach-at91/devices.h +11 -0
@@ -81,6 +81,16 @@ struct at91_dev_table_twi {int udelay;/* For i2c-gpio */ }; +struct at91_dev_table_spi { +unsigned mmio_base; +int irq; +const char *clk_asc; +int standard_cs_pins[4 ]; +struct at91_pin_config pin_miso; +struct at91_pin_config pin_mosi; +struct at91_pin_config pin_spck; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -89,6 +99,7 @@ struct at91_device_table {struct at91_dev_table_mmc *mmc[2 ];struct at91_dev_table_nand *nand;struct at91_dev_table_twi *twi[2 ]; +struct at91_dev_table_spi *spi[2 ]; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 9/23 at91: Make TCB device common
In reply to Ryan MallonReplace the individual TCB code for each at91 variant with a single implementation in devices.c
This also fixes a bug on the AT572D940HF, where at91_add_device_tc was never called.
--- arch/arm/mach-at91/at572d940hf_devices.c | 52 +++------------- arch/arm/mach-at91/at91cap9_devices.c | 38 +++--------- arch/arm/mach-at91/at91rm9200_devices.c | 93 ++++++---------------------- arch/arm/mach-at91/at91sam9260_devices.c | 91 ++++++---------------------- arch/arm/mach-at91/at91sam9261_devices.c | 52 +++------------- arch/arm/mach-at91/at91sam9263_devices.c | 38 +++--------- arch/arm/mach-at91/at91sam9g45_devices.c | 64 +++++-------------- arch/arm/mach-at91/at91sam9rl_devices.c | 52 +++------------- arch/arm/mach-at91/devices.c | 99 ++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 13 ++++ 10 files changed, 212 insertions(+), 380 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +10 -42
@@ -170,51 +170,19 @@ static struct at91_dev_table_spi device_spi1 __initdata = {* Timer/Counter blocks * -------------------------------------------------------------------- */ -#ifdef CONFIG_ATMEL_TCLIB - -static struct resource tcb_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_TCB , - .end =AT572D940HF_BASE_TCB +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_TC0 , - .end =AT572D940HF_ID_TC0 , - .flags =IORESOURCE_IRQ , - }, - [2 ] = { - .start =AT572D940HF_ID_TC1 , - .end =AT572D940HF_ID_TC1 , - .flags =IORESOURCE_IRQ , - }, - [3 ] = { - .start =AT572D940HF_ID_TC2 , - .end =AT572D940HF_ID_TC2 , - .flags =IORESOURCE_IRQ , - }, +static struct at91_tcb_res tcb_resources[]__initdata = { +/* this chip has a separate clock and irq for each TC channel */ + {AT572D940HF_ID_TC0 ,"tc0_clk" ,"t0_clk" }, + {AT572D940HF_ID_TC1 ,"tc1_clk" ,"t1_clk" }, + {AT572D940HF_ID_TC2 ,"tc2_clk" ,"t2_clk" }, }; -static struct platform_device at572d940hf_tcb_device = { - .name ="atmel_tcb" , - .id =0 , - .resource = tcb_resources, - .num_resources =ARRAY_SIZE (tcb_resources), +static struct at91_dev_table_tcb device_tcb__initdata = { + .mmio_base =AT572D940HF_BASE_TCB , + .resources = tcb_resources, + .nr_resources =ARRAY_SIZE (tcb_resources), }; -static void __init at91_add_device_tc (void ) -{ -/* this chip has a separate clock and irq for each TC channel */ -at91_clock_associate ("tc0_clk" , &at572d940hf_tcb_device.dev,"t0_clk" ); -at91_clock_associate ("tc1_clk" , &at572d940hf_tcb_device.dev,"t1_clk" ); -at91_clock_associate ("tc2_clk" , &at572d940hf_tcb_device.dev,"t2_clk" ); -platform_device_register (&at572d940hf_tcb_device); -} -#else -static void __init at91_add_device_tc (void ) { } -#endif - -/* -------------------------------------------------------------------- * RTT * -------------------------------------------------------------------- */
@@ -579,6 +547,7 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .twi[1] = &device_twi1, .spi[0] = &device_spi0, .spi[1] = &device_spi1, + .tcb[0] = &device_tcb, };void __init at572d940hf_init_devices (void )
@@ -596,7 +565,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_rtt ();at91_add_device_watchdog (); -at91_add_device_tc ();return 0 ; }
arch/arm/mach-at91/at91cap9_devices.c +8 -30
@@ -279,39 +279,17 @@ static struct at91_dev_table_spi device_spi1 __initdata = {* Timer/Counter block * -------------------------------------------------------------------- */ -#ifdef CONFIG_ATMEL_TCLIB - -static struct resource tcb_resources[] = { - [0 ] = { - .start =AT91CAP9_BASE_TCB0 , - .end =AT91CAP9_BASE_TCB0 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_TCB , - .end =AT91CAP9_ID_TCB , - .flags =IORESOURCE_IRQ , - }, +static struct at91_tcb_res tcb_resources[]__initdata = { +/* this chip has one clock and irq for all three TC channels */ + {AT91CAP9_ID_TCB ,"tcb_clk" ,"t0_clk" }, }; -static struct platform_device at91cap9_tcb_device = { - .name ="atmel_tcb" , - .id =0 , - .resource = tcb_resources, - .num_resources =ARRAY_SIZE (tcb_resources), +static struct at91_dev_table_tcb device_tcb__initdata = { + .mmio_base =AT91CAP9_BASE_TCB0 , + .resources = tcb_resources, + .nr_resources =ARRAY_SIZE (tcb_resources), }; -static void __init at91_add_device_tc (void ) -{ -/* this chip has one clock and irq for all three TC channels */ -at91_clock_associate ("tcb_clk" , &at91cap9_tcb_device.dev,"t0_clk" ); -platform_device_register (&at91cap9_tcb_device); -} -#else -static void __init at91_add_device_tc (void ) { } -#endif - -/* -------------------------------------------------------------------- * RTT * -------------------------------------------------------------------- */
@@ -907,6 +885,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .twi[0] = &device_twi, .spi[0] = &device_spi0, .spi[1] = &device_spi1, + .tcb[0] = &device_tcb, };void __init at91cap9_init_devices (void )
@@ -923,7 +902,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_rtt ();at91_add_device_watchdog (); -at91_add_device_tc ();return 0 ; }
arch/arm/mach-at91/at91rm9200_devices.c +20 -73
119 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +18 -73
117 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +10 -42
74 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +8 -30
@@ -509,39 +509,17 @@ void __init at91_add_device_isi(void) {}* Timer/Counter block * -------------------------------------------------------------------- */ -#ifdef CONFIG_ATMEL_TCLIB - -static struct resource tcb_resources[] = { - [0 ] = { - .start =AT91SAM9263_BASE_TCB0 , - .end =AT91SAM9263_BASE_TCB0 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9263_ID_TCB , - .end =AT91SAM9263_ID_TCB , - .flags =IORESOURCE_IRQ , - }, +static struct at91_tcb_res tcb_resources[]__initdata = { +/* this chip has one clock and irq for all three TC channels */ + {AT91SAM9263_ID_TCB ,"tcb_clk" ,"t0_clk" }, }; -static struct platform_device at91sam9263_tcb_device = { - .name ="atmel_tcb" , - .id =0 , - .resource = tcb_resources, - .num_resources =ARRAY_SIZE (tcb_resources), +static struct at91_dev_table_tcb device_tcb__initdata = { + .mmio_base =AT91SAM9263_BASE_TCB0 , + .resources = tcb_resources, + .nr_resources =ARRAY_SIZE (tcb_resources), }; -static void __init at91_add_device_tc (void ) -{ -/* this chip has one clock and irq for all three TC channels */ -at91_clock_associate ("tcb_clk" , &at91sam9263_tcb_device.dev,"t0_clk" ); -platform_device_register (&at91sam9263_tcb_device); -} -#else -static void __init at91_add_device_tc (void ) { } -#endif - -/* -------------------------------------------------------------------- * RTT * -------------------------------------------------------------------- */
@@ -1027,6 +1005,7 @@ static struct at91_device_table at91sam9263_device_table __initdata = { .twi[0] = &device_twi, .spi[0] = &device_spi0, .spi[1] = &device_spi1, + .tcb[0] = &device_tcb, };void __init at91sam9263_init_devices (void )
@@ -1043,7 +1022,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_rtt ();at91_add_device_watchdog (); -at91_add_device_tc ();return 0 ; }
arch/arm/mach-at91/at91sam9g45_devices.c +16 -48
90 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +10 -42
74 lines not on this page · raw message
arch/arm/mach-at91/devices.c +99 -0
106 lines not on this page · raw message
arch/arm/mach-at91/devices.h +13 -0
@@ -91,6 +91,18 @@ struct at91_dev_table_spi {struct at91_pin_config pin_spck; }; +struct at91_tcb_res { +int irq; +const char *clock_asc; +const char *clock_name; +}; + +struct at91_dev_table_tcb { +unsigned mmio_base; +struct at91_tcb_res *resources; +int nr_resources; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -100,6 +112,7 @@ struct at91_device_table {struct at91_dev_table_nand *nand;struct at91_dev_table_twi *twi[2 ];struct at91_dev_table_spi *spi[2 ]; +struct at91_dev_table_tcb *tcb[2 ]; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 10/23 at91: Make RTT device common
In reply to Ryan MallonReplace the individual RTT code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at572d940hf_devices.c | 23 ++------------ arch/arm/mach-at91/at91cap9_devices.c | 23 ++------------ arch/arm/mach-at91/at91sam9260_devices.c | 23 ++------------ arch/arm/mach-at91/at91sam9261_devices.c | 23 ++------------ arch/arm/mach-at91/at91sam9263_devices.c | 40 +++-------------------- arch/arm/mach-at91/at91sam9g45_devices.c | 23 ++------------ arch/arm/mach-at91/at91sam9rl_devices.c | 23 ++------------ arch/arm/mach-at91/devices.c | 51 ++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 5 +++ 9 files changed, 80 insertions(+), 154 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +3 -20
@@ -187,27 +187,10 @@ static struct at91_dev_table_tcb device_tcb __initdata = {* RTT * -------------------------------------------------------------------- */ -static struct resource rtt_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT , - .end =AT91_BASE_SYS +AT91_RTT +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at572d940hf_rtt_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt_resources, - .num_resources =ARRAY_SIZE (rtt_resources), +static struct at91_dev_table_rtt device_rtt__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at572d940hf_rtt_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -548,6 +531,7 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .spi[0] = &device_spi0, .spi[1] = &device_spi1, .tcb[0] = &device_tcb, + .rtt[0] = &device_rtt, };void __init at572d940hf_init_devices (void )
@@ -563,7 +547,6 @@ void __init at572d940hf_init_devices(void)*/ static int __init at91_add_standard_devices (void ) { -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91cap9_devices.c +3 -20
@@ -294,27 +294,10 @@ static struct at91_dev_table_tcb device_tcb __initdata = {* RTT * -------------------------------------------------------------------- */ -static struct resource rtt_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT , - .end =AT91_BASE_SYS +AT91_RTT +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at91cap9_rtt_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt_resources, - .num_resources =ARRAY_SIZE (rtt_resources), +static struct at91_dev_table_rtt device_rtt__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at91cap9_rtt_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -886,6 +869,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .spi[0] = &device_spi0, .spi[1] = &device_spi1, .tcb[0] = &device_tcb, + .rtt[0] = &device_rtt, };void __init at91cap9_init_devices (void )
@@ -900,7 +884,6 @@ void __init at91cap9_init_devices(void)*/ static int __init at91_add_standard_devices (void ) { -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9260_devices.c +3 -20
@@ -192,27 +192,10 @@ static struct at91_dev_table_tcb device_tcb1 __initdata = {* RTT * -------------------------------------------------------------------- */ -static struct resource rtt_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT , - .end =AT91_BASE_SYS +AT91_RTT +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at91sam9260_rtt_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt_resources, - .num_resources =ARRAY_SIZE (rtt_resources), +static struct at91_dev_table_rtt device_rtt__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at91sam9260_rtt_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -815,6 +798,7 @@ static struct at91_device_table at91sam9260_device_table __initdata = { .spi[1] = &device_spi1, .tcb[0] = &device_tcb0, .tcb[1] = &device_tcb1, + .rtt[0] = &device_rtt, };void __init at91sam9260_init_devices (void )
@@ -829,7 +813,6 @@ void __init at91sam9260_init_devices(void)*/ static int __init at91_add_standard_devices (void ) { -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9261_devices.c +3 -20
@@ -244,27 +244,10 @@ static struct at91_dev_table_tcb device_tcb __initdata = {* RTT * -------------------------------------------------------------------- */ -static struct resource rtt_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT , - .end =AT91_BASE_SYS +AT91_RTT +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at91sam9261_rtt_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt_resources, - .num_resources =ARRAY_SIZE (rtt_resources), +static struct at91_dev_table_rtt device_rtt__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at91sam9261_rtt_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -701,6 +684,7 @@ static struct at91_device_table at91sam9261_device_table __initdata = { .spi[0] = &device_spi0, .spi[1] = &device_spi1, .tcb[0] = &device_tcb, + .rtt[0] = &device_rtt, };void __init at91sam9261_init_devices (void )
@@ -716,7 +700,6 @@ void __init at91sam9261_init_devices(void)*/ static int __init at91_add_standard_devices (void ) { -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9263_devices.c +6 -34
@@ -524,43 +524,14 @@ static struct at91_dev_table_tcb device_tcb __initdata = {* RTT * -------------------------------------------------------------------- */ -static struct resource rtt0_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT0 , - .end =AT91_BASE_SYS +AT91_RTT0 +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at91sam9263_rtt0_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt0_resources, - .num_resources =ARRAY_SIZE (rtt0_resources), -}; - -static struct resource rtt1_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT1 , - .end =AT91_BASE_SYS +AT91_RTT1 +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } +static struct at91_dev_table_rtt device_rtt0__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT0 , }; -static struct platform_device at91sam9263_rtt1_device = { - .name ="at91_rtt" , - .id =1 , - .resource = rtt1_resources, - .num_resources =ARRAY_SIZE (rtt1_resources), +static struct at91_dev_table_rtt device_rtt1__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT1 , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at91sam9263_rtt0_device); -platform_device_register (&at91sam9263_rtt1_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -1006,6 +977,8 @@ static struct at91_device_table at91sam9263_device_table __initdata = { .spi[0] = &device_spi0, .spi[1] = &device_spi1, .tcb[0] = &device_tcb, + .rtt[0] = &device_rtt0, + .rtt[1] = &device_rtt1, };void __init at91sam9263_init_devices (void )
@@ -1020,7 +993,6 @@ void __init at91sam9263_init_devices(void)*/ static int __init at91_add_standard_devices (void ) { -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9g45_devices.c +3 -20
@@ -561,27 +561,10 @@ void __init at91_add_device_tsadcc(struct at91_tsadcc_data *data) {}* RTT * -------------------------------------------------------------------- */ -static struct resource rtt_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT , - .end =AT91_BASE_SYS +AT91_RTT +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at91sam9g45_rtt_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt_resources, - .num_resources =ARRAY_SIZE (rtt_resources), +static struct at91_dev_table_rtt device_rtt__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at91sam9g45_rtt_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -1076,6 +1059,7 @@ static struct at91_device_table at91sam9g45_device_table __initdata = { .spi[1] = &device_spi1, .tcb[0] = &device_tcb0, .tcb[1] = &device_tcb1, + .rtt[0] = &device_rtt, };void __init at91sam9g45_init_devices (void )
@@ -1092,7 +1076,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_hdmac ();at91_add_device_rtc (); -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9rl_devices.c +3 -20
@@ -439,27 +439,10 @@ static void __init at91_add_device_rtc(void) {}* RTT * -------------------------------------------------------------------- */ -static struct resource rtt_resources[] = { - { - .start =AT91_BASE_SYS +AT91_RTT , - .end =AT91_BASE_SYS +AT91_RTT +SZ_16 -1 , - .flags =IORESOURCE_MEM , - } -}; - -static struct platform_device at91sam9rl_rtt_device = { - .name ="at91_rtt" , - .id =0 , - .resource = rtt_resources, - .num_resources =ARRAY_SIZE (rtt_resources), +static struct at91_dev_table_rtt device_rtt__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_RTT , }; -static void __init at91_add_device_rtt (void ) -{ -platform_device_register (&at91sam9rl_rtt_device); -} - -/* -------------------------------------------------------------------- * Watchdog * -------------------------------------------------------------------- */
@@ -955,6 +938,7 @@ static struct at91_device_table at91sam9rl_device_table __initdata = { .twi[0] = &device_twi, .spi[0] = &device_spi, .tcb[0] = &device_tcb, + .rtt[0] = &device_rtt, };void __init at91sam9rl_init_devices (void )
@@ -972,7 +956,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_hdmac ();at91_add_device_rtc (); -at91_add_device_rtt ();at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/devices.c +51 -0
63 lines not on this page · raw message
arch/arm/mach-at91/devices.h +5 -0
@@ -103,6 +103,10 @@ struct at91_dev_table_tcb {int nr_resources; }; +struct at91_dev_table_rtt { +unsigned mmio_base; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -113,6 +117,7 @@ struct at91_device_table {struct at91_dev_table_twi *twi[2 ];struct at91_dev_table_spi *spi[2 ];struct at91_dev_table_tcb *tcb[2 ]; +struct at91_dev_table_rtt *rtt[2 ]; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 11/23 at91: Make watchdog device common
In reply to Ryan MallonThe code for the watchdog device for each of the at91 variants is identical. Remove it from each variant and replace them with a single version in devices.c
--- arch/arm/mach-at91/at572d940hf_devices.c | 34 ------------------------------ arch/arm/mach-at91/at91cap9_devices.c | 33 ----------------------------- arch/arm/mach-at91/at91rm9200_devices.c | 22 ------------------- arch/arm/mach-at91/at91sam9260_devices.c | 33 ----------------------------- arch/arm/mach-at91/at91sam9261_devices.c | 34 ------------------------------ arch/arm/mach-at91/at91sam9263_devices.c | 33 ----------------------------- arch/arm/mach-at91/at91sam9g45_devices.c | 21 ------------------ arch/arm/mach-at91/at91sam9rl_devices.c | 21 ------------------ arch/arm/mach-at91/devices.c | 23 ++++++++++++++++++++ 9 files changed, 23 insertions(+), 231 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +0 -34
@@ -192,26 +192,6 @@ static struct at91_dev_table_rtt device_rtt __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at572d940hf_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at572d940hf_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * UART * -------------------------------------------------------------------- */
@@ -538,17 +518,3 @@ void __init at572d940hf_init_devices(void) {at91_init_devices (&at572d940hf_device_table); } - -/* -------------------------------------------------------------------- */ - -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_watchdog (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91cap9_devices.c +0 -33
@@ -299,26 +299,6 @@ static struct at91_dev_table_rtt device_rtt __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at91cap9_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91cap9_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * PWM * --------------------------------------------------------------------*/
@@ -876,16 +856,3 @@ void __init at91cap9_init_devices(void) {at91_init_devices (&at91cap9_device_table); } - -/* -------------------------------------------------------------------- */ -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_watchdog (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91rm9200_devices.c +0 -22
@@ -295,27 +295,6 @@ static void __init at91_add_device_rtc(void)static void __init at91_add_device_rtc (void ) {}#endif - -/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91RM9200_WATCHDOG ) || defined(CONFIG_AT91RM9200_WATCHDOG_MODULE ) -static struct platform_device at91rm9200_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91rm9200_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - -/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller * -------------------------------------------------------------------- */
@@ -812,7 +791,6 @@ void __init at91rm9200_init_devices(void)static int __init at91_add_standard_devices (void ) {at91_add_device_rtc (); -at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9260_devices.c +0 -33
@@ -197,26 +197,6 @@ static struct at91_dev_table_rtt device_rtt __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at91sam9260_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91sam9260_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller * -------------------------------------------------------------------- */
@@ -805,16 +785,3 @@ void __init at91sam9260_init_devices(void) {at91_init_devices (&at91sam9260_device_table); } - -/* -------------------------------------------------------------------- */ -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_watchdog (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91sam9261_devices.c +0 -34
@@ -249,26 +249,6 @@ static struct at91_dev_table_rtt device_rtt __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at91sam9261_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91sam9261_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller * -------------------------------------------------------------------- */
@@ -691,17 +671,3 @@ void __init at91sam9261_init_devices(void) {at91_init_devices (&at91sam9261_device_table); } - -/* -------------------------------------------------------------------- */ - -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_watchdog (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91sam9263_devices.c +0 -33
@@ -533,26 +533,6 @@ static struct at91_dev_table_rtt device_rtt1 __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at91sam9263_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91sam9263_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * PWM * --------------------------------------------------------------------*/
@@ -985,16 +965,3 @@ void __init at91sam9263_init_devices(void) {at91_init_devices (&at91sam9263_device_table); } - -/* -------------------------------------------------------------------- */ -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_watchdog (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91sam9g45_devices.c +0 -21
@@ -566,26 +566,6 @@ static struct at91_dev_table_rtt device_rtt __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at91sam9g45_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91sam9g45_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * PWM * --------------------------------------------------------------------*/
@@ -1076,7 +1056,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_hdmac ();at91_add_device_rtc (); -at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/at91sam9rl_devices.c +0 -21
@@ -444,26 +444,6 @@ static struct at91_dev_table_rtt device_rtt __initdata = { };/* -------------------------------------------------------------------- -* Watchdog -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) -static struct platform_device at91sam9rl_wdt_device = { - .name ="at91_wdt" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_watchdog (void ) -{ -platform_device_register (&at91sam9rl_wdt_device); -} -#else -static void __init at91_add_device_watchdog (void ) {} -#endif - - -/* -------------------------------------------------------------------- * PWM * --------------------------------------------------------------------*/
@@ -956,7 +936,6 @@ static int __init at91_add_standard_devices(void) {at91_add_device_hdmac ();at91_add_device_rtc (); -at91_add_device_watchdog ();return 0 ; }
arch/arm/mach-at91/devices.c +23 -0
@@ -973,6 +973,28 @@ static void __init at91_add_device_rtt(void) } } +/* -------------------------------------------------------------------- +* Watchdog +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_AT91SAM9X_WATCHDOG ) || \ + defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE ) || \ + defined(CONFIG_AT91RM9200_WATCHDOG ) || \ + defined(CONFIG_AT91RM9200_WATCHDOG_MODULE ) +static struct platform_device at91_wdt_device = { + .name ="at91_wdt" , + .id =-1 , + .num_resources =0 , +}; + +static void __init at91_add_device_watchdog (void ) +{ +platform_device_register (&at91_wdt_device); +} +#else +static void __init at91_add_device_watchdog (void ) {} +#endif +void __init at91_init_devices (struct at91_device_table *device_table) { devices = device_table;
@@ -982,6 +1004,7 @@ static int __init at91_add_standard_devices(void) {at91_add_device_tc ();at91_add_device_rtt (); +at91_add_device_watchdog ();return 0 ; }
Signature · 1 line
1.7.0.4
PATCH v2 12/23 at91: Make UART devices common
In reply to Ryan MallonReplace the individual UART, including debug UART, code for each at91 vairiant with a single implementation in devices.c
--- arch/arm/mach-at91/at572d940hf_devices.c | 267 +++-------------- arch/arm/mach-at91/at91cap9_devices.c | 285 ++++--------------- arch/arm/mach-at91/at91rm9200_devices.c | 358 +++++------------------ arch/arm/mach-at91/at91sam9260_devices.c | 449 ++++++----------------------- arch/arm/mach-at91/at91sam9261_devices.c | 273 ++++-------------- arch/arm/mach-at91/at91sam9263_devices.c | 286 ++++--------------- arch/arm/mach-at91/at91sam9g45_devices.c | 348 +++++------------------ arch/arm/mach-at91/at91sam9rl_devices.c | 360 +++++------------------ arch/arm/mach-at91/board-1arm.c | 4 +- arch/arm/mach-at91/board-afeb-9260v1.c | 4 +- arch/arm/mach-at91/board-at572d940hf_ek.c | 6 +- arch/arm/mach-at91/board-carmeva.c | 2 +- arch/arm/mach-at91/board-cpu9krea.c | 12 +- arch/arm/mach-at91/board-cpuat91.c | 8 +- arch/arm/mach-at91/board-eb9200.c | 4 +- arch/arm/mach-at91/board-ecbat91.c | 2 +- arch/arm/mach-at91/board-foxg20.c | 12 +- arch/arm/mach-at91/board-gsia18s.c | 10 +- arch/arm/mach-at91/board-kafa.c | 2 +- arch/arm/mach-at91/board-kb9202.c | 6 +- arch/arm/mach-at91/board-neocore926.c | 2 +- arch/arm/mach-at91/board-pcontrol-g20.c | 6 +- arch/arm/mach-at91/board-picotux200.c | 2 +- arch/arm/mach-at91/board-qil-a9260.c | 6 +- arch/arm/mach-at91/board-rm9200dk.c | 2 +- arch/arm/mach-at91/board-rm9200ek.c | 2 +- arch/arm/mach-at91/board-sam9-l9260.c | 4 +- arch/arm/mach-at91/board-sam9260ek.c | 4 +- arch/arm/mach-at91/board-sam9263ek.c | 2 +- arch/arm/mach-at91/board-sam9g20ek.c | 4 +- arch/arm/mach-at91/board-sam9m10g45ek.c | 2 +- arch/arm/mach-at91/board-sam9rlek.c | 2 +- arch/arm/mach-at91/board-snapper9260.c | 6 +- arch/arm/mach-at91/board-stamp9g20.c | 12 +- arch/arm/mach-at91/board-yl-9200.c | 6 +- arch/arm/mach-at91/devices.c | 303 +++++++++++++++++++ arch/arm/mach-at91/devices.h | 17 ++ arch/arm/mach-at91/include/mach/board.h | 10 + 38 files changed, 922 insertions(+), 2168 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +47 -220
@@ -195,238 +195,61 @@ static struct at91_dev_table_rtt device_rtt __initdata = {* UART * -------------------------------------------------------------------- */ -#if defined(CONFIG_SERIAL_ATMEL ) -static struct resource dbgu_resources[] = { - [0 ] = { - .start =AT91_VA_BASE_SYS +AT91_DBGU , - .end =AT91_VA_BASE_SYS +AT91_DBGU +SZ_512 -1 , - .flags =IORESOURCE_MEM , +static struct at91_dev_table_uart device_dbgu__initdata = { + .mmio_base =AT91_VA_BASE_SYS +AT91_DBGU , + .irq =AT91_ID_SYS , + .clock_asc ="mck" , + .uart_data = { + .use_dma_tx =0 , + .use_dma_rx =0 , + .regs = (void __iomem *)(AT91_VA_BASE_SYS +AT91_DBGU ), }, - [1 ] = { - .start =AT91_ID_SYS , - .end =AT91_ID_SYS , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct atmel_uart_data dbgu_data = { - .use_dma_tx =0 , - .use_dma_rx =0 ,/* DBGU not capable of receive DMA */ - .regs = (void __iomem *)(AT91_VA_BASE_SYS +AT91_DBGU ), -}; - -static u64 dbgu_dmamask =DMA_BIT_MASK (32 ); - -static struct platform_device at572d940hf_dbgu_device = { - .name ="atmel_usart" , - .id =0 , - .dev = { - .dma_mask = &dbgu_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &dbgu_data, - }, - .resource = dbgu_resources, - .num_resources =ARRAY_SIZE (dbgu_resources), -}; - -static inline void configure_dbgu_pins (void ) -{ -at91_set_A_periph (AT91_PIN_PC31 ,1 );/* DTXD */ -at91_set_A_periph (AT91_PIN_PC30 ,0 );/* DRXD */ -} - -static struct resource uart0_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_US0 , - .end =AT572D940HF_BASE_US0 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_US0 , - .end =AT572D940HF_ID_US0 , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct atmel_uart_data uart0_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , + .tx_pin = {AT91_PIN_PC31 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rx_pin = {AT91_PIN_PC30 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, }; -static u64 uart0_dmamask =DMA_BIT_MASK (32 ); - -static struct platform_device at572d940hf_uart0_device = { - .name ="atmel_usart" , - .id =1 , - .dev = { - .dma_mask = &uart0_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &uart0_data, +static struct at91_dev_table_uart device_uart0__initdata = { + .mmio_base =AT572D940HF_BASE_US0 , + .irq =AT572D940HF_ID_US0 , + .clock_asc ="usart0_clk" , + .uart_data = { + .use_dma_tx =1 , + .use_dma_rx =1 , }, - .resource = uart0_resources, - .num_resources =ARRAY_SIZE (uart0_resources), + .tx_pin = {AT91_PIN_PA8 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rx_pin = {AT91_PIN_PA7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .rts_pin = {AT91_PIN_PA10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .cts_pin = {AT91_PIN_PA9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, }; -static inline void configure_usart0_pins (unsigned pins) -{ -at91_set_A_periph (AT91_PIN_PA8 ,1 );/* TXD0 */ -at91_set_A_periph (AT91_PIN_PA7 ,0 );/* RXD0 */ - -if (pins &ATMEL_UART_RTS ) -at91_set_A_periph (AT91_PIN_PA10 ,0 );/* RTS0 */ -if (pins &ATMEL_UART_CTS ) -at91_set_A_periph (AT91_PIN_PA9 ,0 );/* CTS0 */ -} - -static struct resource uart1_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_US1 , - .end =AT572D940HF_BASE_US1 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_US1 , - .end =AT572D940HF_ID_US1 , - .flags =IORESOURCE_IRQ , +static struct at91_dev_table_uart device_uart1__initdata = { + .mmio_base =AT572D940HF_BASE_US1 , + .irq =AT572D940HF_ID_US1 , + .clock_asc ="usart1_clk" , + .uart_data = { + .use_dma_tx =1 , + .use_dma_rx =1 , }, + .tx_pin = {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rx_pin = {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .rts_pin = {AT91_PIN_PA12 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .cts_pin = {AT91_PIN_PA11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, }; -static struct atmel_uart_data uart1_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , -}; - -static u64 uart1_dmamask =DMA_BIT_MASK (32 ); - -static struct platform_device at572d940hf_uart1_device = { - .name ="atmel_usart" , - .id =2 , - .dev = { - .dma_mask = &uart1_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &uart1_data, +static struct at91_dev_table_uart device_uart2__initdata = { + .mmio_base =AT572D940HF_BASE_US2 , + .irq =AT572D940HF_ID_US2 , + .clock_asc ="usart2_clk" , + .uart_data = { + .use_dma_tx =1 , + .use_dma_rx =1 , }, - .resource = uart1_resources, - .num_resources =ARRAY_SIZE (uart1_resources), + .tx_pin = {AT91_PIN_PC15 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rx_pin = {AT91_PIN_PC14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .rts_pin = {AT91_PIN_PA17 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, + .cts_pin = {AT91_PIN_PA16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 }, }; -static inline void configure_usart1_pins (unsigned pins) -{ -at91_set_A_periph (AT91_PIN_PC10 ,1 );/* TXD1 */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* RXD1 */ - -if (pins &ATMEL_UART_RTS ) -at91_set_A_periph (AT91_PIN_PC12 ,0 );/* RTS1 */ -if (pins &ATMEL_UART_CTS ) -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* CTS1 */ -} - -static struct resource uart2_resources[] = { - [0 ] = { - .start =AT572D940HF_BASE_US2 , - .end =AT572D940HF_BASE_US2 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT572D940HF_ID_US2 , - .end =AT572D940HF_ID_US2 , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct atmel_uart_data uart2_data = { - .use_dma_tx =1 , - .use_dma_rx =1 , -}; - -static u64 uart2_dmamask =DMA_BIT_MASK (32 ); - -static struct platform_device at572d940hf_uart2_device = { - .name ="atmel_usart" , - .id =3 , - .dev = { - .dma_mask = &uart2_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &uart2_data, - }, - .resource = uart2_resources, - .num_resources =ARRAY_SIZE (uart2_resources), -}; - -static inline void configure_usart2_pins (unsigned pins) -{ -at91_set_A_periph (AT91_PIN_PC15 ,1 );/* TXD2 */ -at91_set_A_periph (AT91_PIN_PC14 ,0 );/* RXD2 */ - -if (pins &ATMEL_UART_RTS ) -at91_set_A_periph (AT91_PIN_PC17 ,0 );/* RTS2 */ -if (pins &ATMEL_UART_CTS ) -at91_set_A_periph (AT91_PIN_PC16 ,0 );/* CTS2 */ -} - -static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART ];/* the UARTs to use */ -struct platform_device *atmel_default_console_device;/* the serial console device */ - -void __init at91_register_uart (unsigned id,unsigned portnr,unsigned pins) -{ -struct platform_device *pdev; - -switch (id) { -case 0 :/* DBGU */ - pdev = &at572d940hf_dbgu_device; -configure_dbgu_pins (); -at91_clock_associate ("mck" , &pdev->dev,"usart" ); -break ; -case AT572D940HF_ID_US0 : - pdev = &at572d940hf_uart0_device; -configure_usart0_pins (pins); -at91_clock_associate ("usart0_clk" , &pdev->dev,"usart" ); -break ; -case AT572D940HF_ID_US1 : - pdev = &at572d940hf_uart1_device; -configure_usart1_pins (pins); -at91_clock_associate ("usart1_clk" , &pdev->dev,"usart" ); -break ; -case AT572D940HF_ID_US2 : - pdev = &at572d940hf_uart2_device; -configure_usart2_pins (pins); -at91_clock_associate ("usart2_clk" , &pdev->dev,"usart" ); -break ; -default : -return ; - } - pdev->id = portnr;/* update to mapped ID */ - -if (portnr <ATMEL_MAX_UART ) - at91_uarts[portnr] = pdev; -} - -void __init at91_set_serial_console (unsigned portnr) -{ -if (portnr <ATMEL_MAX_UART ) - atmel_default_console_device = at91_uarts[portnr]; -} - -void __init at91_add_device_serial (void ) -{ -int i; - -for (i =0 ; i <ATMEL_MAX_UART ; i++) { -if (at91_uarts[i]) -platform_device_register (at91_uarts[i]); - } - -if (!atmel_default_console_device) -printk (KERN_INFO "AT91: No default serial console defined.\n" ); -} - -#else -void __init at91_register_uart (unsigned id,unsigned portnr,unsigned pins) {} -void __init at91_set_serial_console (unsigned portnr) {} -void __init at91_add_device_serial (void ) {} -#endif - -/* -------------------------------------------------------------------- * mAgic * -------------------------------------------------------------------- */
@@ -512,6 +335,10 @@ static struct at91_device_table at572d940hf_device_table __initdata = { .spi[1] = &device_spi1, .tcb[0] = &device_tcb, .rtt[0] = &device_rtt, + .dbgu = &device_dbgu, + .uart[0] = &device_uart0, + .uart[1] = &device_uart1, + .uart[2] = &device_uart2, };void __init at572d940hf_init_devices (void )
arch/arm/mach-at91/at91cap9_devices.c +57 -228
299 lines not on this page · raw message
arch/arm/mach-at91/at91rm9200_devices.c +74 -284
379 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +91 -358
475 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +51 -222
293 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +57 -229
300 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +72 -276
362 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +76 -284
374 lines not on this page · raw message
arch/arm/mach-at91/board-1arm.c +2 -2
@@ -48,10 +48,10 @@ static void __init onearm_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */ -at91_register_uart (AT91RM9200_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS ); +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* USART1 on ttyS2 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91RM9200_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS +at91_register_uart (AT91_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );
arch/arm/mach-at91/board-afeb-9260v1.c +2 -2
@@ -57,13 +57,13 @@ static void __init afeb9260_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91SAM9260_ID_US0 ,1 , +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );/* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ -at91_register_uart (AT91SAM9260_ID_US1 ,2 , +at91_register_uart (AT91_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* set serial console to ttyS0 (ie, DBGU) */
arch/arm/mach-at91/board-at572d940hf_ek.c +3 -3
@@ -55,13 +55,13 @@ static void __init eb_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1. (Rx & Tx only) */ -at91_register_uart (AT572D940HF_ID_US0 ,1 ,0 ); +at91_register_uart (AT91_ID_US0 ,1 ,0 );/* USART1 on ttyS2. (Rx & Tx only) */ -at91_register_uart (AT572D940HF_ID_US1 ,2 ,0 ); +at91_register_uart (AT91_ID_US1 ,2 ,0 );/* USART2 on ttyS3. (Tx & Rx only */ -at91_register_uart (AT572D940HF_ID_US2 ,3 ,0 ); +at91_register_uart (AT91_ID_US2 ,3 ,0 );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-carmeva.c +1 -1
@@ -49,7 +49,7 @@ static void __init carmeva_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91RM9200_ID_US1 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS +at91_register_uart (AT91_ID_US1 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );
arch/arm/mach-at91/board-cpu9krea.c +6 -6
@@ -56,26 +56,26 @@ static void __init cpu9krea_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91SAM9260_ID_US0 ,1 ,ATMEL_UART_CTS | +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );/* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ -at91_register_uart (AT91SAM9260_ID_US1 ,2 ,ATMEL_UART_CTS | +at91_register_uart (AT91_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* USART2 on ttyS3. (Rx, Tx, RTS, CTS) */ -at91_register_uart (AT91SAM9260_ID_US2 ,3 ,ATMEL_UART_CTS | +at91_register_uart (AT91_ID_US2 ,3 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* USART3 on ttyS4. (Rx, Tx) */ -at91_register_uart (AT91SAM9260_ID_US3 ,4 ,0 ); +at91_register_uart (AT91_ID_US3 ,4 ,0 );/* USART4 on ttyS5. (Rx, Tx) */ -at91_register_uart (AT91SAM9260_ID_US4 ,5 ,0 ); +at91_register_uart (AT91_ID_US4 ,5 ,0 );/* USART5 on ttyS6. (Rx, Tx) */ -at91_register_uart (AT91SAM9260_ID_US5 ,6 ,0 ); +at91_register_uart (AT91_ID_US5 ,6 ,0 );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-cpuat91.c +4 -4
@@ -59,19 +59,19 @@ static void __init cpuat91_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1. (Rx, Tx, CTS, RTS) */ -at91_register_uart (AT91RM9200_ID_US0 ,1 ,ATMEL_UART_CTS | +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* USART1 on ttyS2. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91RM9200_ID_US1 ,2 ,ATMEL_UART_CTS | +at91_register_uart (AT91_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );/* USART2 on ttyS3 (Rx, Tx) */ -at91_register_uart (AT91RM9200_ID_US2 ,3 ,0 ); +at91_register_uart (AT91_ID_US2 ,3 ,0 );/* USART3 on ttyS4 (Rx, Tx, CTS, RTS) */ -at91_register_uart (AT91RM9200_ID_US3 ,4 ,ATMEL_UART_CTS | +at91_register_uart (AT91_ID_US3 ,4 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* set serial console to ttyS0 (ie, DBGU) */
arch/arm/mach-at91/board-eb9200.c +2 -2
@@ -49,12 +49,12 @@ static void __init eb9200_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART1 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91RM9200_ID_US1 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS +at91_register_uart (AT91_ID_US1 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );/* USART2 on ttyS2. (Rx, Tx) - IRDA */ -at91_register_uart (AT91RM9200_ID_US2 ,2 ,0 ); +at91_register_uart (AT91_ID_US2 ,2 ,0 );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-ecbat91.c +1 -1
@@ -54,7 +54,7 @@ static void __init ecb_at91map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1. (Rx & Tx only) */ -at91_register_uart (AT91RM9200_ID_US0 ,1 ,0 ); +at91_register_uart (AT91_ID_US0 ,1 ,0 );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-foxg20.c +6 -6
@@ -66,7 +66,7 @@ static void __init foxg20_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1. (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI) */ -at91_register_uart (AT91SAM9260_ID_US0 ,1 , +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS | ATMEL_UART_DTR
@@ -75,23 +75,23 @@ static void __init foxg20_map_io(void) | ATMEL_UART_RI);/* USART1 on ttyS2. (Rx, Tx, RTS, CTS) */ -at91_register_uart (AT91SAM9260_ID_US1 ,2 , +at91_register_uart (AT91_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* USART2 on ttyS3. (Rx & Tx only) */ -at91_register_uart (AT91SAM9260_ID_US2 ,3 ,0 ); +at91_register_uart (AT91_ID_US2 ,3 ,0 );/* USART3 on ttyS4. (Rx, Tx, RTS, CTS) */ -at91_register_uart (AT91SAM9260_ID_US3 ,4 , +at91_register_uart (AT91_ID_US3 ,4 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* USART4 on ttyS5. (Rx & Tx only) */ -at91_register_uart (AT91SAM9260_ID_US4 ,5 ,0 ); +at91_register_uart (AT91_ID_US4 ,5 ,0 );/* USART5 on ttyS6. (Rx & Tx only) */ -at91_register_uart (AT91SAM9260_ID_US5 ,6 ,0 ); +at91_register_uart (AT91_ID_US5 ,6 ,0 );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-gsia18s.c +5 -5
@@ -46,7 +46,7 @@ static void __init gsia18s_map_io(void)* USART0 on ttyS1 (Rx, Tx, CTS, RTS, DTR, DSR, DCD, RI). * Used for Internal Analog Modem. */ -at91_register_uart (AT91SAM9260_ID_US0 ,1 , +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS |ATMEL_UART_DTR |ATMEL_UART_DSR |ATMEL_UART_DCD |ATMEL_UART_RI );
@@ -54,25 +54,25 @@ static void __init gsia18s_map_io(void)* USART1 on ttyS2 (Rx, Tx, CTS, RTS). * Used for GPS or WiFi or Data stream. */ -at91_register_uart (AT91SAM9260_ID_US1 ,2 , +at91_register_uart (AT91_ID_US1 ,2 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* * USART2 on ttyS3 (Rx, Tx, CTS, RTS). * Used for External Modem. */ -at91_register_uart (AT91SAM9260_ID_US2 ,3 , +at91_register_uart (AT91_ID_US2 ,3 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* * USART3 on ttyS4 (Rx, Tx, RTS). * Used for RS-485. */ -at91_register_uart (AT91SAM9260_ID_US3 ,4 ,ATMEL_UART_RTS ); +at91_register_uart (AT91_ID_US3 ,4 ,ATMEL_UART_RTS );/* * USART4 on ttyS5 (Rx, Tx). * Used for TRX433 Radio Module. */ -at91_register_uart (AT91SAM9260_ID_US4 ,5 ,0 ); +at91_register_uart (AT91_ID_US4 ,5 ,0 ); }static void __init init_irq (void )
arch/arm/mach-at91/board-kafa.c +1 -1
@@ -51,7 +51,7 @@ static void __init kafa_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1 (Rx, Tx, CTS, RTS) */ -at91_register_uart (AT91RM9200_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS ); +at91_register_uart (AT91_ID_US0 ,1 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-kb9202.c +3 -3
@@ -54,13 +54,13 @@ static void __init kb9202_map_io(void)at91_register_uart (0 ,0 ,0 );/* USART0 on ttyS1 (Rx & Tx only) */ -at91_register_uart (AT91RM9200_ID_US0 ,1 ,0 ); +at91_register_uart (AT91_ID_US0 ,1 ,0 );/* USART1 on ttyS2 (Rx & Tx only) - IRDA (optional) */ -at91_register_uart (AT91RM9200_ID_US1 ,2 ,0 ); +at91_register_uart (AT91_ID_US1 ,2 ,0 );/* USART3 on ttyS3 (Rx, Tx, CTS, RTS) - RS485 (optional) */ -at91_register_uart (AT91RM9200_ID_US3 ,3 ,ATMEL_UART_CTS |ATMEL_UART_RTS ); +at91_register_uart (AT91_ID_US3 ,3 ,ATMEL_UART_CTS |ATMEL_UART_RTS );/* set serial console to ttyS0 (ie, DBGU) */ at91_set_serial_console (0 );
arch/arm/mach-at91/board-neocore926.c +1 -1
@@ -60,7 +60,7 @@ static void __init neocore926_map_io(void)at91_register_uart (0 ,0 ,0 );
Lines of this file are not shown. View the raw message.
arch/arm/mach-at91/board-pcontrol-g20.c +3 -3
Lines of this file are not shown. View the raw message.
arch/arm/mach-at91/board-sam9m10g45ek.c +1 -1
Lines of this file are not shown. View the raw message.
arch/arm/mach-at91/devices.c +303 -0
303 lines not on this page · raw message
arch/arm/mach-at91/include/mach/board.h +10 -0
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.7.0.4
Part of the diff is not shown here. View the raw message.
PATCH v2 13/23 at91: Make PWM device common
In reply to Ryan MallonReplace the individual PWM code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91cap9_devices.c | 56 +++++------------------------- arch/arm/mach-at91/at91sam9263_devices.c | 55 +++++------------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 55 +++++------------------------ arch/arm/mach-at91/at91sam9rl_devices.c | 55 +++++------------------------ arch/arm/mach-at91/devices.c | 55 +++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 7 ++++ 6 files changed, 98 insertions(+), 185 deletions(-)
arch/arm/mach-at91/at91cap9_devices.c +9 -47
@@ -302,56 +302,17 @@ static struct at91_dev_table_rtt device_rtt __initdata = {* PWM * --------------------------------------------------------------------*/ -#if defined(CONFIG_ATMEL_PWM ) -static u32 pwm_mask; - -static struct resource pwm_resources[] = { - [0 ] = { - .start =AT91CAP9_BASE_PWMC , - .end =AT91CAP9_BASE_PWMC +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_PWMC , - .end =AT91CAP9_ID_PWMC , - .flags =IORESOURCE_IRQ , +static struct at91_dev_table_pwm device_pwm__initdata = { + .mmio_base =AT91CAP9_BASE_PWMC , + .irq =AT91CAP9_ID_PWMC , + .pwm_pins = { + {AT91_PIN_PB19 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + {AT91_PIN_PB8 ,AT91_PIN_PERIPH_B ,1 ,0 ,0 }, + {AT91_PIN_PC29 ,AT91_PIN_PERIPH_B ,1 ,0 ,0 }, + {AT91_PIN_PA11 ,AT91_PIN_PERIPH_B ,1 ,0 ,0 }, }, }; -static struct platform_device at91cap9_pwm0_device = { - .name ="atmel_pwm" , - .id =-1 , - .dev = { - .platform_data = &pwm_mask, - }, - .resource = pwm_resources, - .num_resources =ARRAY_SIZE (pwm_resources), -}; - -void __init at91_add_device_pwm (u32 mask) -{ -if (mask & (1 <<AT91_PWM0 )) -at91_set_A_periph (AT91_PIN_PB19 ,1 );/* enable PWM0 */ - -if (mask & (1 <<AT91_PWM1 )) -at91_set_B_periph (AT91_PIN_PB8 ,1 );/* enable PWM1 */ - -if (mask & (1 <<AT91_PWM2 )) -at91_set_B_periph (AT91_PIN_PC29 ,1 );/* enable PWM2 */ - -if (mask & (1 <<AT91_PWM3 )) -at91_set_B_periph (AT91_PIN_PA11 ,1 );/* enable PWM3 */ - - pwm_mask = mask; - -platform_device_register (&at91cap9_pwm0_device); -} -#else -void __init at91_add_device_pwm (u32 mask) {} -#endif - - -/* -------------------------------------------------------------------- * AC97 * -------------------------------------------------------------------- */
@@ -679,6 +640,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .uart[0] = &device_uart0, .uart[1] = &device_uart1, .uart[2] = &device_uart2, + .pwm = &device_pwm, };void __init at91cap9_init_devices (void )
arch/arm/mach-at91/at91sam9263_devices.c +9 -46
70 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +9 -46
70 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +9 -46
70 lines not on this page · raw message
arch/arm/mach-at91/devices.c +55 -0
61 lines not on this page · raw message
arch/arm/mach-at91/devices.h +7 -0
@@ -122,6 +122,12 @@ struct at91_dev_table_uart {struct at91_pin_config dsr_pin; }; +struct at91_dev_table_pwm { +unsigned mmio_base; +int irq; +struct at91_pin_config pwm_pins[4 ]; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -135,6 +141,7 @@ struct at91_device_table {struct at91_dev_table_rtt *rtt[2 ];struct at91_dev_table_uart *dbgu;struct at91_dev_table_uart *uart[6 ]; +struct at91_dev_table_pwm *pwm; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 14/23 at91: Make SSC device common
In reply to Ryan MallonReplace the individual SSC code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91cap9_devices.c | 142 ++++------------------ arch/arm/mach-at91/at91rm9200_devices.c | 199 ++++++------------------------ arch/arm/mach-at91/at91sam9260_devices.c | 85 ++----------- arch/arm/mach-at91/at91sam9261_devices.c | 199 ++++++------------------------ arch/arm/mach-at91/at91sam9263_devices.c | 146 ++++------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 146 ++++------------------ arch/arm/mach-at91/at91sam9rl_devices.c | 142 ++++------------------ arch/arm/mach-at91/board-afeb-9260v1.c | 2 +- arch/arm/mach-at91/board-sam9260ek.c | 2 +- arch/arm/mach-at91/board-sam9261ek.c | 2 +- arch/arm/mach-at91/board-sam9g20ek.c | 2 +- arch/arm/mach-at91/board-snapper9260.c | 4 +- arch/arm/mach-at91/devices.c | 167 +++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 14 ++ 14 files changed, 371 insertions(+), 881 deletions(-)
arch/arm/mach-at91/at91cap9_devices.c +24 -118
@@ -444,128 +444,32 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}* SSC -- Synchronous Serial Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_ATMEL_SSC ) || defined(CONFIG_ATMEL_SSC_MODULE ) -static u64 ssc0_dmamask =DMA_BIT_MASK (32 ); - -static struct resource ssc0_resources[] = { - [0 ] = { - .start =AT91CAP9_BASE_SSC0 , - .end =AT91CAP9_BASE_SSC0 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_SSC0 , - .end =AT91CAP9_ID_SSC0 , - .flags =IORESOURCE_IRQ , - }, +static struct at91_dev_table_ssc device_ssc0__initdata = { + .mmio_base =AT91CAP9_BASE_SSC0 , + .irq =AT91CAP9_ID_SSC0 , + .clock_asc ="ssc0_clk" , + .clock_name ="ssc" , + .tf_pin = {AT91_PIN_PB0 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .tk_pin = {AT91_PIN_PB1 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .td_pin = {AT91_PIN_PB2 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rd_pin = {AT91_PIN_PB3 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rk_pin = {AT91_PIN_PB4 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rf_pin = {AT91_PIN_PB5 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, }; -static struct platform_device at91cap9_ssc0_device = { - .name ="ssc" , - .id =0 , - .dev = { - .dma_mask = &ssc0_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - }, - .resource = ssc0_resources, - .num_resources =ARRAY_SIZE (ssc0_resources), +static struct at91_dev_table_ssc device_ssc1__initdata = { + .mmio_base =AT91CAP9_BASE_SSC1 , + .irq =AT91CAP9_ID_SSC1 , + .clock_asc ="ssc0_clk" , + .clock_name ="ssc" , + .tf_pin = {AT91_PIN_PB6 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .tk_pin = {AT91_PIN_PB7 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .td_pin = {AT91_PIN_PB8 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rd_pin = {AT91_PIN_PB9 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rk_pin = {AT91_PIN_PB10 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, + .rf_pin = {AT91_PIN_PB11 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 }, }; -static inline void configure_ssc0_pins (unsigned pins) -{ -if (pins &ATMEL_SSC_TF ) -at91_set_A_periph (AT91_PIN_PB0 ,1 ); -if (pins &ATMEL_SSC_TK ) -at91_set_A_periph (AT91_PIN_PB1 ,1 ); -if (pins &ATMEL_SSC_TD ) -at91_set_A_periph (AT91_PIN_PB2 ,1 ); -if (pins &ATMEL_SSC_RD ) -at91_set_A_periph (AT91_PIN_PB3 ,1 ); -if (pins &ATMEL_SSC_RK ) -at91_set_A_periph (AT91_PIN_PB4 ,1 ); -if (pins &ATMEL_SSC_RF ) -at91_set_A_periph (AT91_PIN_PB5 ,1 ); -} - -static u64 ssc1_dmamask =DMA_BIT_MASK (32 ); - -static struct resource ssc1_resources[] = { - [0 ] = { - .start =AT91CAP9_BASE_SSC1 , - .end =AT91CAP9_BASE_SSC1 +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_SSC1 , - .end =AT91CAP9_ID_SSC1 , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at91cap9_ssc1_device = { - .name ="ssc" , - .id =1 , - .dev = { - .dma_mask = &ssc1_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - }, - .resource = ssc1_resources, - .num_resources =ARRAY_SIZE (ssc1_resources), -}; - -static inline void configure_ssc1_pins (unsigned pins) -{ -if (pins &ATMEL_SSC_TF ) -at91_set_A_periph (AT91_PIN_PB6 ,1 ); -if (pins &ATMEL_SSC_TK ) -at91_set_A_periph (AT91_PIN_PB7 ,1 ); -if (pins &ATMEL_SSC_TD ) -at91_set_A_periph (AT91_PIN_PB8 ,1 ); -if (pins &ATMEL_SSC_RD ) -at91_set_A_periph (AT91_PIN_PB9 ,1 ); -if (pins &ATMEL_SSC_RK ) -at91_set_A_periph (AT91_PIN_PB10 ,1 ); -if (pins &ATMEL_SSC_RF ) -at91_set_A_periph (AT91_PIN_PB11 ,1 ); -} - -/* -* SSC controllers are accessed through library code, instead of any -* kind of all-singing/all-dancing driver. For example one could be -* used by a particular I2S audio codec's driver, while another one -* on the same system might be used by a custom data capture driver. -*/ -void __init at91_add_device_ssc (unsigned id,unsigned pins) -{ -struct platform_device *pdev; - -/* -* NOTE: caller is responsible for passing information matching -* "pins" to whatever will be using each particular controller. -*/ -switch (id) { -case AT91CAP9_ID_SSC0 : - pdev = &at91cap9_ssc0_device; -configure_ssc0_pins (pins); -at91_clock_associate ("ssc0_clk" , &pdev->dev,"ssc" ); -break ; -case AT91CAP9_ID_SSC1 : - pdev = &at91cap9_ssc1_device; -configure_ssc1_pins (pins); -at91_clock_associate ("ssc1_clk" , &pdev->dev,"ssc" ); -break ; -default : -return ; - } - -platform_device_register (pdev); -} - -#else -void __init at91_add_device_ssc (unsigned id,unsigned pins) {} -#endif - -/* -------------------------------------------------------------------- * UART * -------------------------------------------------------------------- */
@@ -641,6 +545,8 @@ static struct at91_device_table at91cap9_device_table __initdata = { .uart[1] = &device_uart1, .uart[2] = &device_uart2, .pwm = &device_pwm, + .ssc[0] = &device_ssc0, + .ssc[1] = &device_ssc1, };void __init at91cap9_init_devices (void )
arch/arm/mach-at91/at91rm9200_devices.c +36 -163
217 lines not on this page · raw message
arch/arm/mach-at91/at91sam9260_devices.c +12 -73
99 lines not on this page · raw message
arch/arm/mach-at91/at91sam9261_devices.c +36 -163
217 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +26 -120
160 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +26 -120
160 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +24 -118
158 lines not on this page · raw message
arch/arm/mach-at91/board-afeb-9260v1.c +1 -1
@@ -211,7 +211,7 @@ static void __init afeb9260_board_init(void)at91_add_device_i2c (0 , afeb9260_i2c_devices,ARRAY_SIZE (afeb9260_i2c_devices));/* Audio */ -at91_add_device_ssc (AT91SAM9260_ID_SSC ,ATMEL_SSC_TX ); +at91_add_device_ssc (0 ,ATMEL_SSC_TX );/* IDE */ at91_add_device_cf (&afeb9260_cf_data); }
arch/arm/mach-at91/board-sam9260ek.c +1 -1
@@ -347,7 +347,7 @@ static void __init ek_board_init(void)at91_add_device_i2c (0 , ek_i2c_devices,ARRAY_SIZE (ek_i2c_devices));/* SSC (to AT73C213) */ at73c213_set_clk (&at73c213_data); -at91_add_device_ssc (AT91SAM9260_ID_SSC ,ATMEL_SSC_TX ); +at91_add_device_ssc (0 ,ATMEL_SSC_TX );/* LEDs */ at91_gpio_leds (ek_leds,ARRAY_SIZE (ek_leds));/* Push Buttons */
arch/arm/mach-at91/board-sam9261ek.c +1 -1
@@ -604,7 +604,7 @@ static void __init ek_board_init(void)ek_add_device_ts ();/* SSC (to AT73C213) */ at73c213_set_clk (&at73c213_data); -at91_add_device_ssc (AT91SAM9261_ID_SSC1 ,ATMEL_SSC_TX ); +at91_add_device_ssc (1 ,ATMEL_SSC_TX );#else /* MMC */ at91_add_device_mmc (0 , &ek_mmc_data);
arch/arm/mach-at91/board-sam9g20ek.c +1 -1
@@ -401,7 +401,7 @@ static void __init ek_board_init(void)/* PCK0 provides MCLK to the WM8731 */ at91_set_B_periph (AT91_PIN_PC1 ,0 );/* SSC (for WM8731) */ -at91_add_device_ssc (AT91SAM9260_ID_SSC ,ATMEL_SSC_TX ); +at91_add_device_ssc (0 ,ATMEL_SSC_TX ); }MACHINE_START (AT91SAM9G20EK ,"Atmel AT91SAM9G20-EK" )
arch/arm/mach-at91/board-snapper9260.c +2 -2
@@ -172,8 +172,8 @@ static void __init snapper9260_board_init(void)at91_add_device_usbh_ohci (&snapper9260_usbh_data);at91_add_device_udc (&snapper9260_udc_data);at91_add_device_eth (&snapper9260_macb_data); -at91_add_device_ssc (AT91SAM9260_ID_SSC , (ATMEL_SSC_TF |ATMEL_SSC_TK | -ATMEL_SSC_TD |ATMEL_SSC_RD )); +at91_add_device_ssc (0 , (ATMEL_SSC_TF |ATMEL_SSC_TK | +ATMEL_SSC_TD |ATMEL_SSC_RD ));snapper9260_add_device_nand (); }
arch/arm/mach-at91/devices.c +167 -0
173 lines not on this page · raw message
arch/arm/mach-at91/devices.h +14 -0
@@ -128,6 +128,19 @@ struct at91_dev_table_pwm {struct at91_pin_config pwm_pins[4 ]; }; +struct at91_dev_table_ssc { +unsigned mmio_base; +int irq; +const char *clock_asc; +const char *clock_name; +struct at91_pin_config tf_pin; +struct at91_pin_config tk_pin; +struct at91_pin_config td_pin; +struct at91_pin_config rf_pin; +struct at91_pin_config rd_pin; +struct at91_pin_config rk_pin; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -142,6 +155,7 @@ struct at91_device_table {struct at91_dev_table_uart *dbgu;struct at91_dev_table_uart *uart[6 ];struct at91_dev_table_pwm *pwm; +struct at91_dev_table_ssc *ssc[4 ]; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 15/23 at91: Make AC97 device common
In reply to Ryan MallonReplace the individual AC97 code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91cap9_devices.c | 57 +++++------------------------- arch/arm/mach-at91/at91sam9263_devices.c | 56 +++++------------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 57 +++++------------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 57 +++++------------------------- arch/arm/mach-at91/devices.c | 54 ++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 7 ++++ 6 files changed, 97 insertions(+), 191 deletions(-)
arch/arm/mach-at91/at91cap9_devices.c +9 -48
@@ -317,57 +317,17 @@ static struct at91_dev_table_pwm device_pwm __initdata = {* AC97 * -------------------------------------------------------------------- */ -#if defined(CONFIG_SND_ATMEL_AC97C ) || defined(CONFIG_SND_ATMEL_AC97C_MODULE ) -static u64 ac97_dmamask =DMA_BIT_MASK (32 ); -static struct ac97c_platform_data ac97_data; - -static struct resource ac97_resources[] = { - [0 ] = { - .start =AT91CAP9_BASE_AC97C , - .end =AT91CAP9_BASE_AC97C +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_AC97C , - .end =AT91CAP9_ID_AC97C , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at91cap9_ac97_device = { - .name ="atmel_ac97c" , - .id =1 , - .dev = { - .dma_mask = &ac97_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &ac97_data, +static struct at91_dev_table_ac97 device_ac97__initdata = { + .mmio_base =AT91CAP9_BASE_AC97C , + .irq =AT91CAP9_ID_AC97C , + .pins = { + {AT91_PIN_PA6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* AC97FS */ + {AT91_PIN_PA7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* AC97CK */ + {AT91_PIN_PA8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* AC97TX */ + {AT91_PIN_PA9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* AC97RX */ }, - .resource = ac97_resources, - .num_resources =ARRAY_SIZE (ac97_resources), }; -void __init at91_add_device_ac97 (struct ac97c_platform_data *data) -{ -if (!data) -return ; - -at91_set_A_periph (AT91_PIN_PA6 ,0 );/* AC97FS */ -at91_set_A_periph (AT91_PIN_PA7 ,0 );/* AC97CK */ -at91_set_A_periph (AT91_PIN_PA8 ,0 );/* AC97TX */ -at91_set_A_periph (AT91_PIN_PA9 ,0 );/* AC97RX */ - -/* reset */ -if (data->reset_pin) -at91_set_gpio_output (data->reset_pin,0 ); - - ac97_data = *data; -platform_device_register (&at91cap9_ac97_device); -} -#else -void __init at91_add_device_ac97 (struct ac97c_platform_data *data) {} -#endif - -/* -------------------------------------------------------------------- * LCD Controller * -------------------------------------------------------------------- */
@@ -547,6 +507,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .pwm = &device_pwm, .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, + .ac97 = &device_ac97, };void __init at91cap9_init_devices (void )
arch/arm/mach-at91/at91sam9263_devices.c +9 -47
71 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +9 -48
72 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +9 -48
72 lines not on this page · raw message
arch/arm/mach-at91/devices.c +54 -0
60 lines not on this page · raw message
arch/arm/mach-at91/devices.h +7 -0
@@ -141,6 +141,12 @@ struct at91_dev_table_ssc {struct at91_pin_config rk_pin; }; +struct at91_dev_table_ac97 { +unsigned mmio_base; +int irq; +struct at91_pin_config pins[4 ];/* FS, CK, TX, RX */ +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -156,6 +162,7 @@ struct at91_device_table {struct at91_dev_table_uart *uart[6 ];struct at91_dev_table_pwm *pwm;struct at91_dev_table_ssc *ssc[4 ]; +struct at91_dev_table_ac97 *ac97; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 16/23 at91: Make LCD controller device common
In reply to Ryan MallonReplace the individual LCD controller device code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91cap9_devices.c | 96 ++++++++-------------- arch/arm/mach-at91/at91sam9261_devices.c | 133 ++++++++++-------------------- arch/arm/mach-at91/at91sam9263_devices.c | 94 +++++++-------------- arch/arm/mach-at91/at91sam9g45_devices.c | 111 +++++++++---------------- arch/arm/mach-at91/at91sam9rl_devices.c | 89 ++++++-------------- arch/arm/mach-at91/devices.c | 75 +++++++++++++++++ arch/arm/mach-at91/devices.h | 11 +++ 7 files changed, 261 insertions(+), 348 deletions(-)
arch/arm/mach-at91/at91cap9_devices.c +34 -62
@@ -332,73 +332,44 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91CAP9_LCDC_BASE , - .end =AT91CAP9_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_LCDC , - .end =AT91CAP9_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) +static void __init at91cap9_lcdc_init (void ) { -if (!data) -return ; -if (cpu_is_at91cap9_revB ())irq_set_irq_type (AT91CAP9_ID_LCDC ,IRQ_TYPE_LEVEL_HIGH ); - -at91_set_A_periph (AT91_PIN_PC1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDDEN */ -at91_set_B_periph (AT91_PIN_PB9 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PC8 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PC10 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PC14 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PC17 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PC22 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PC23 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PC24 ,0 );/* LCDD20 */ -at91_set_A_periph (AT91_PIN_PC25 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PC26 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PC27 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); } -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PB9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC25 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91CAP9_LCDC_BASE , + .irq =AT91CAP9_ID_LCDC , + .device_init = at91cap9_lcdc_init, + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), +};/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller
@@ -508,6 +479,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91cap9_init_devices (void )
arch/arm/mach-at91/at91sam9261_devices.c +43 -90
150 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +31 -63
108 lines not on this page · raw message
arch/arm/mach-at91/at91sam9g45_devices.c +39 -72
125 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +28 -61
105 lines not on this page · raw message
arch/arm/mach-at91/devices.c +75 -0
81 lines not on this page · raw message
arch/arm/mach-at91/devices.h +11 -0
@@ -147,6 +147,16 @@ struct at91_dev_table_ac97 {struct at91_pin_config pins[4 ];/* FS, CK, TX, RX */ }; +struct at91_dev_table_lcdc { +unsigned mmio_base; +int irq; +unsigned sram_base;/* Only on AT91SAM9261 */ +unsigned sram_size; +void (*device_init)(void ); +struct at91_pin_config *pins; +int nr_pins; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -163,6 +173,7 @@ struct at91_device_table {struct at91_dev_table_pwm *pwm;struct at91_dev_table_ssc *ssc[4 ];struct at91_dev_table_ac97 *ac97; +struct at91_dev_table_lcdc *lcdc; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 16/23 at91: Make LCD controller device common
Hello Ryan,
Quoted 677 lines · Ryan Mallon
Replace the individual LCD controller device code for each at91 variant with a single implementation in
devices.cSigned-off-by Ryan Mallon <[email protected]>--- arch/arm/mach-at91/at91cap9_devices.c | 96 ++++++++-------------- arch/arm/mach-at91/at91sam9261_devices.c | 133 ++++++++++-------------------- arch/arm/mach-at91/at91sam9263_devices.c | 94 +++++++-------------- arch/arm/mach-at91/at91sam9g45_devices.c | 111 +++++++++---------------- arch/arm/mach-at91/at91sam9rl_devices.c | 89 ++++++-------------- arch/arm/mach-at91/devices.c | 75 +++++++++++++++++ arch/arm/mach-at91/devices.h | 11 +++ 7 files changed, 261 insertions(+), 348 deletions(-)arch/arm/mach-at91/at91cap9_devices.c +34
-62@@ -332,73 +332,44 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91CAP9_LCDC_BASE , - .end =AT91CAP9_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_LCDC , - .end =AT91CAP9_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) +static void __init at91cap9_lcdc_init (void ) { -if (!data) -return ; -if (cpu_is_at91cap9_revB ())irq_set_irq_type (AT91CAP9_ID_LCDC ,IRQ_TYPE_LEVEL_HIGH ); - -at91_set_A_periph (AT91_PIN_PC1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDDEN */ -at91_set_B_periph (AT91_PIN_PB9 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PC8 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PC10 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PC14 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PC17 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PC22 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PC23 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PC24 ,0 );/* LCDD20 */ -at91_set_A_periph (AT91_PIN_PC25 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PC26 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PC27 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); } -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PB9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC25 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91CAP9_LCDC_BASE , + .irq =AT91CAP9_ID_LCDC , + .device_init = at91cap9_lcdc_init, + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), +};/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller @@ -508,6 +479,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91cap9_init_devices (void )arch/arm/mach-at91/at91sam9261_devices.c +43
-90@@ -127,101 +127,53 @@ static struct at91_dev_table_spi device_spi1 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9261_LCDC_BASE , - .end =AT91SAM9261_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9261_ID_LCDC , - .end =AT91SAM9261_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, -#if defined(CONFIG_FB_INTSRAM) - [2] = { - .start =AT91SAM9261_SRAM_BASE , - .end =AT91SAM9261_SRAM_BASE +AT91SAM9261_SRAM_SIZE -1 , - .flags =IORESOURCE_MEM , - }, -#endif -}; - -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) { -return ; - } - +static struct at91_pin_config lcdc_pins[] __initdata = { #if defined(CONFIG_FB_ATMEL_STN) -at91_set_A_periph (AT91_PIN_PB0 ,0 );/* LCDVSYNC */ -at91_set_A_periph (AT91_PIN_PB1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PB2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PB3 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PB4 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PB5 ,0 );/* LCDD0 */ -at91_set_A_periph (AT91_PIN_PB6 ,0 );/* LCDD1 */ -at91_set_A_periph (AT91_PIN_PB7 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PB8 ,0 );/* LCDD3 */ + {AT91_PIN_PB0, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDVSYNC */ + {AT91_PIN_PB1, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDHSYNC */ + {AT91_PIN_PB2, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDOTCK */ + {AT91_PIN_PB3, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDEN */ + {AT91_PIN_PB4, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDCC */ + {AT91_PIN_PB5, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD0 */ + {AT91_PIN_PB6, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD1 */ + {AT91_PIN_PB7, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD2 */ + {AT91_PIN_PB8, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD3 */ #else -at91_set_A_periph (AT91_PIN_PB1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PB2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PB3 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PB4 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PB7 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PB8 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PB9 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PB10 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PB11 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PB12 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PB15 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PB16 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PB17 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PB18 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PB19 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PB20 ,0 );/* LCDD15 */ -at91_set_B_periph (AT91_PIN_PB23 ,0 );/* LCDD18 */ -at91_set_B_periph (AT91_PIN_PB24 ,0 );/* LCDD19 */ -at91_set_B_periph (AT91_PIN_PB25 ,0 );/* LCDD20 */ -at91_set_B_periph (AT91_PIN_PB26 ,0 );/* LCDD21 */ -at91_set_B_periph (AT91_PIN_PB27 ,0 );/* LCDD22 */ -at91_set_B_periph (AT91_PIN_PB28 ,0 );/* LCDD23 */ + {AT91_PIN_PB1, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDHSYNC */ + {AT91_PIN_PB2, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDOTCK */ + {AT91_PIN_PB3, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDEN */ + {AT91_PIN_PB4, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDCC */ + {AT91_PIN_PB7, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD2 */ + {AT91_PIN_PB8, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD3 */ + {AT91_PIN_PB9, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD4 */ + {AT91_PIN_PB10, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD5 */ + {AT91_PIN_PB11, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD6 */ + {AT91_PIN_PB12, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD7 */ + {AT91_PIN_PB15, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD10 */ + {AT91_PIN_PB16, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD11 */ + {AT91_PIN_PB17, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD12 */ + {AT91_PIN_PB18, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD13 */ + {AT91_PIN_PB19, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD14 */ + {AT91_PIN_PB20, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD15 */ + {AT91_PIN_PB23, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD18 */ + {AT91_PIN_PB24, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD19 */ + {AT91_PIN_PB25, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD20 */ + {AT91_PIN_PB26, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD21 */ + {AT91_PIN_PB27, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD22 */ + {AT91_PIN_PB28, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD23 */ #endif +}; -if (ARRAY_SIZE (lcdc_resources) >2 ) { -void __iomem *fb; -struct resource *fb_res = &lcdc_resources[2 ]; -size_t fb_len = fb_res->end - fb_res->start +1 ; - - fb =ioremap (fb_res->start, fb_len); -if (fb) { -memset (fb,0 , fb_len); -iounmap (fb); - } - } - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} +static struct at91_dev_table_lcdc device_lcdc __initdata = { + .mmio_base = AT91SAM9261_LCDC_BASE, + .irq = AT91SAM9261_ID_LCDC, +#if defined(CONFIG_FB_INTSRAM) + .sram_base = AT91SAM9261_SRAM_BASE, + .sram_size = AT91SAM9261_SRAM_SIZE, #endif - + .pins = lcdc_pins, + .nr_pins = ARRAY_SIZE(lcdc_pins), +}; /* -------------------------------------------------------------------- * Timer/Counter block@@ -367,6 +319,7 @@ static struct at91_device_table at91sam9261_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ssc[2] = &device_ssc2, + .lcdc = &device_lcdc, };void __init at91sam9261_init_devices (void )arch/arm/mach-at91/at91sam9263_devices.c +31
-63@@ -351,71 +351,38 @@ void __init at91_add_device_can(struct at91_can_data *data) {}* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9263_LCDC_BASE , - .end =AT91SAM9263_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9263_ID_LCDC , - .end =AT91SAM9263_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PB9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC12 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91SAM9263_LCDC_BASE , + .irq =AT91SAM9263_ID_LCDC , + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), }; -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) -return ; - -at91_set_A_periph (AT91_PIN_PC1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDDEN */ -at91_set_B_periph (AT91_PIN_PB9 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PC8 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PC10 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PC14 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_B_periph (AT91_PIN_PC12 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PC22 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PC23 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PC24 ,0 );/* LCDD20 */ -at91_set_B_periph (AT91_PIN_PC17 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PC26 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PC27 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif - -/* -------------------------------------------------------------------- * Image Sensor Interface * -------------------------------------------------------------------- */ @@ -618,6 +585,7 @@ static struct at91_device_table at91sam9263_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91sam9263_init_devices (void )arch/arm/mach-at91/at91sam9g45_devices.c +39
-72@@ -346,80 +346,46 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9G45_LCDC_BASE , - .end =AT91SAM9G45_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9G45_ID_LCDC , - .end =AT91SAM9G45_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PE0 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDPWR */ + {AT91_PIN_PE2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PE3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDVSYNC */ + {AT91_PIN_PE4 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PE5 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PE6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PE7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD0 */ + {AT91_PIN_PE8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD1 */ + {AT91_PIN_PE9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PE10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PE11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PE12 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PE13 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PE14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PE15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD8 */ + {AT91_PIN_PE16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD9 */ + {AT91_PIN_PE17 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PE18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PE19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PE20 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PE21 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PE22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PE23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD16 */ + {AT91_PIN_PE24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD17 */ + {AT91_PIN_PE25 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PE26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PE27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PE28 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PE29 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PE30 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91SAM9G45_LCDC_BASE , + .irq =AT91SAM9G45_ID_LCDC , + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), }; -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) -return ; - -at91_set_A_periph (AT91_PIN_PE0 ,0 );/* LCDDPWR */ - -at91_set_A_periph (AT91_PIN_PE2 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PE3 ,0 );/* LCDVSYNC */ -at91_set_A_periph (AT91_PIN_PE4 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PE5 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PE6 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PE7 ,0 );/* LCDD0 */ -at91_set_A_periph (AT91_PIN_PE8 ,0 );/* LCDD1 */ -at91_set_A_periph (AT91_PIN_PE9 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PE10 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PE11 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PE12 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PE13 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PE14 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PE15 ,0 );/* LCDD8 */ -at91_set_A_periph (AT91_PIN_PE16 ,0 );/* LCDD9 */ -at91_set_A_periph (AT91_PIN_PE17 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PE18 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PE19 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PE20 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PE21 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PE22 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PE23 ,0 );/* LCDD16 */ -at91_set_A_periph (AT91_PIN_PE24 ,0 );/* LCDD17 */ -at91_set_A_periph (AT91_PIN_PE25 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PE26 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PE27 ,0 );/* LCDD20 */ -at91_set_A_periph (AT91_PIN_PE28 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PE29 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PE30 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif - -/* -------------------------------------------------------------------- * Timer/Counter block * -------------------------------------------------------------------- */ @@ -666,6 +632,7 @@ static struct at91_device_table at91sam9g45_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91sam9g45_init_devices (void )arch/arm/mach-at91/at91sam9rl_devices.c +28
-61@@ -242,71 +242,37 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9RL_LCDC_BASE , - .end =AT91SAM9RL_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9RL_ID_LCDC , - .end =AT91SAM9RL_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDPWR */ + {AT91_PIN_PC5 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC12 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC13 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC20 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC21 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC25 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD23 */ }; -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91SAM9RL_LCDC_BASE , + .irq =AT91SAM9RL_ID_LCDC , + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), }; -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) { -return ; - } - -at91_set_B_periph (AT91_PIN_PC1 ,0 );/* LCDPWR */ -at91_set_A_periph (AT91_PIN_PC5 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDCC */ -at91_set_B_periph (AT91_PIN_PC9 ,0 );/* LCDD3 */ -at91_set_B_periph (AT91_PIN_PC10 ,0 );/* LCDD4 */ -at91_set_B_periph (AT91_PIN_PC11 ,0 );/* LCDD5 */ -at91_set_B_periph (AT91_PIN_PC12 ,0 );/* LCDD6 */ -at91_set_B_periph (AT91_PIN_PC13 ,0 );/* LCDD7 */ -at91_set_B_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_B_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_B_periph (AT91_PIN_PC17 ,0 );/* LCDD13 */ -at91_set_B_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_B_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_B_periph (AT91_PIN_PC20 ,0 );/* LCDD18 */ -at91_set_B_periph (AT91_PIN_PC21 ,0 );/* LCDD19 */ -at91_set_B_periph (AT91_PIN_PC22 ,0 );/* LCDD20 */ -at91_set_B_periph (AT91_PIN_PC23 ,0 );/* LCDD21 */ -at91_set_B_periph (AT91_PIN_PC24 ,0 );/* LCDD22 */ -at91_set_B_periph (AT91_PIN_PC25 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif - -/* -------------------------------------------------------------------- * Timer/Counter block * -------------------------------------------------------------------- */ @@ -541,6 +507,7 @@ static struct at91_device_table at91sam9rl_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91sam9rl_init_devices (void )arch/arm/mach-at91/devices.c +24
-0@@ -1579,6 +1579,81 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)void __init at91_add_device_ac97 (struct ac97c_platform_data *data) {}#endif +/* -------------------------------------------------------------------- +* LCD Controller +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) +static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); +static struct atmel_lcdfb_info lcdc_data; + +static struct resource lcdc_resources[] = { + [0 ] = { + .end =SZ_4K , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .flags =IORESOURCE_IRQ , + }, +#if defined(CONFIG_FB_INTSRAM) + [2] = { + .flags =IORESOURCE_MEM , + }, +#endif +}; + +static struct platform_device at91_lcdc_device = {
arch/arm/mach-at91/devices.c void __init at91_add_device_ac97(struct ac97c_platform_data *data) · line 1615
Quoted 10 lines
arch/arm/mach-at91/devices.c +10
-0+ .name = "atmel_lcdfb", + .id = 0, + .dev = { + .dma_mask = &lcdc_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &lcdc_data, + }, + .resource = lcdc_resources, + .num_resources = ARRAY_SIZE(lcdc_resources), +};
One difference to my approach (which you can like or not) is that mxc uses dynamic allocation of the platform_devices. A struct platform_device has a size of 320 bytes. So instead of using at91_lcdc_device you could add to at91_add_device_lcdc:
struct platform_device *pdev = platform_device_register_resndata( NULL, "atmel_lcdfb", 0, &lcdc_resources, ARRAY_SIZE(lcdc_resources), *data, sizeof(*data));
with the added benefit that lcdc_resources and *data can be __initdata (or __initconst) to save a few more bytes.
The obvious downside is that dynamic allocation probably takes more time than using static data and so increases the boottime. I didn't measure it, but I think the difference is small enough to see over it.
Best regards
Uwe
Signature · 2 lines
Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |
PATCH v2 16/23 at91: Make LCD controller device common
Quoted 7 lines · Uwe Kleine-K?nig
Hello Ryan,
Quoted 4 lines · Ryan Mallon
Replace the individual LCD controller device code for each at91 variant with a single implementation in
devices.cSigned-off-by Ryan Mallon <[email protected]>
<snip>
Quoted 20 lines
arch/arm/mach-at91/devices.c void __init at91_add_device_ac97(struct ac97c_platform_data *data) · line 1615
Quoted 11 lines
arch/arm/mach-at91/devices.c +11
-0+static struct platform_device at91_lcdc_device = { + .name ="atmel_lcdfb" , + .id =0 , + .dev = { + .dma_mask = &lcdc_dmamask, + .coherent_dma_mask =DMA_BIT_MASK (32 ), + .platform_data = &lcdc_data, + }, + .resource = lcdc_resources, + .num_resources =ARRAY_SIZE (lcdc_resources), +};One difference to my approach (which you can like or not) is that mxc uses dynamic allocation of the
platform_devices. A structplatform_devicehas a size of 320 bytes. So instead of usingat91_lcdc_deviceyou could add toat91_add_device_lcdc:struct platform_device *pdev = platform_device_register_resndata( NULL, "atmel_lcdfb", 0, &lcdc_resources, ARRAY_SIZE(lcdc_resources), *data, sizeof(*data));
Quoted 6 lines
with the added benefit that
lcdc_resourcesand *data can be__initdata(or__initconst) to save a few more bytes.The obvious downside is that dynamic allocation probably takes more time than using static data and so increases the boottime. I didn't measure it, but I think the difference is small enough to see over it.
Having the resources and *data also be __initdata would be good. One reason I have taken the approach I have, rather than what you suggest, is that my patches introduce minimal change. To create the common devices.c I have cut and pasted one of the implementations and only made necessary changes to make it generic to all of the variants rather than do a complete rewrite. I think that this approach makes the patch series easier to review and more likely to be correct (less new bugs introduced).
~Ryan
PATCH v2 16/23 at91: Make LCD controller device common
In reply to Uwe Kleine-KönigQuoted 699 lines · Uwe Kleine-K?nig
Hello Ryan,
Quoted 677 lines · Ryan Mallon
Replace the individual LCD controller device code for each at91 variant with a single implementation in
devices.cSigned-off-by Ryan Mallon <[email protected]>--- arch/arm/mach-at91/at91cap9_devices.c | 96 ++++++++-------------- arch/arm/mach-at91/at91sam9261_devices.c | 133 ++++++++++-------------------- arch/arm/mach-at91/at91sam9263_devices.c | 94 +++++++-------------- arch/arm/mach-at91/at91sam9g45_devices.c | 111 +++++++++---------------- arch/arm/mach-at91/at91sam9rl_devices.c | 89 ++++++-------------- arch/arm/mach-at91/devices.c | 75 +++++++++++++++++ arch/arm/mach-at91/devices.h | 11 +++ 7 files changed, 261 insertions(+), 348 deletions(-)arch/arm/mach-at91/at91cap9_devices.c +34
-62@@ -332,73 +332,44 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91CAP9_LCDC_BASE , - .end =AT91CAP9_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_ID_LCDC , - .end =AT91CAP9_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) +static void __init at91cap9_lcdc_init (void ) { -if (!data) -return ; -if (cpu_is_at91cap9_revB ())irq_set_irq_type (AT91CAP9_ID_LCDC ,IRQ_TYPE_LEVEL_HIGH ); - -at91_set_A_periph (AT91_PIN_PC1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDDEN */ -at91_set_B_periph (AT91_PIN_PB9 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PC8 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PC10 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PC14 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PC17 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PC22 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PC23 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PC24 ,0 );/* LCDD20 */ -at91_set_A_periph (AT91_PIN_PC25 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PC26 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PC27 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); } -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PB9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC25 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91CAP9_LCDC_BASE , + .irq =AT91CAP9_ID_LCDC , + .device_init = at91cap9_lcdc_init, + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), +};/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller @@ -508,6 +479,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91cap9_init_devices (void )arch/arm/mach-at91/at91sam9261_devices.c +43
-90@@ -127,101 +127,53 @@ static struct at91_dev_table_spi device_spi1 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9261_LCDC_BASE , - .end =AT91SAM9261_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9261_ID_LCDC , - .end =AT91SAM9261_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, -#if defined(CONFIG_FB_INTSRAM) - [2] = { - .start =AT91SAM9261_SRAM_BASE , - .end =AT91SAM9261_SRAM_BASE +AT91SAM9261_SRAM_SIZE -1 , - .flags =IORESOURCE_MEM , - }, -#endif -}; - -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) { -return ; - } - +static struct at91_pin_config lcdc_pins[] __initdata = { #if defined(CONFIG_FB_ATMEL_STN) -at91_set_A_periph (AT91_PIN_PB0 ,0 );/* LCDVSYNC */ -at91_set_A_periph (AT91_PIN_PB1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PB2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PB3 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PB4 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PB5 ,0 );/* LCDD0 */ -at91_set_A_periph (AT91_PIN_PB6 ,0 );/* LCDD1 */ -at91_set_A_periph (AT91_PIN_PB7 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PB8 ,0 );/* LCDD3 */ + {AT91_PIN_PB0, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDVSYNC */ + {AT91_PIN_PB1, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDHSYNC */ + {AT91_PIN_PB2, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDOTCK */ + {AT91_PIN_PB3, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDEN */ + {AT91_PIN_PB4, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDCC */ + {AT91_PIN_PB5, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD0 */ + {AT91_PIN_PB6, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD1 */ + {AT91_PIN_PB7, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD2 */ + {AT91_PIN_PB8, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD3 */ #else -at91_set_A_periph (AT91_PIN_PB1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PB2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PB3 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PB4 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PB7 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PB8 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PB9 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PB10 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PB11 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PB12 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PB15 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PB16 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PB17 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PB18 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PB19 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PB20 ,0 );/* LCDD15 */ -at91_set_B_periph (AT91_PIN_PB23 ,0 );/* LCDD18 */ -at91_set_B_periph (AT91_PIN_PB24 ,0 );/* LCDD19 */ -at91_set_B_periph (AT91_PIN_PB25 ,0 );/* LCDD20 */ -at91_set_B_periph (AT91_PIN_PB26 ,0 );/* LCDD21 */ -at91_set_B_periph (AT91_PIN_PB27 ,0 );/* LCDD22 */ -at91_set_B_periph (AT91_PIN_PB28 ,0 );/* LCDD23 */ + {AT91_PIN_PB1, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDHSYNC */ + {AT91_PIN_PB2, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDOTCK */ + {AT91_PIN_PB3, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDDEN */ + {AT91_PIN_PB4, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDCC */ + {AT91_PIN_PB7, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD2 */ + {AT91_PIN_PB8, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD3 */ + {AT91_PIN_PB9, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD4 */ + {AT91_PIN_PB10, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD5 */ + {AT91_PIN_PB11, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD6 */ + {AT91_PIN_PB12, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD7 */ + {AT91_PIN_PB15, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD10 */ + {AT91_PIN_PB16, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD11 */ + {AT91_PIN_PB17, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD12 */ + {AT91_PIN_PB18, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD13 */ + {AT91_PIN_PB19, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD14 */ + {AT91_PIN_PB20, AT91_PIN_PERIPH_A, 0, 0, 0}, /* LCDD15 */ + {AT91_PIN_PB23, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD18 */ + {AT91_PIN_PB24, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD19 */ + {AT91_PIN_PB25, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD20 */ + {AT91_PIN_PB26, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD21 */ + {AT91_PIN_PB27, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD22 */ + {AT91_PIN_PB28, AT91_PIN_PERIPH_B, 0, 0, 0}, /* LCDD23 */ #endif +}; -if (ARRAY_SIZE (lcdc_resources) >2 ) { -void __iomem *fb; -struct resource *fb_res = &lcdc_resources[2 ]; -size_t fb_len = fb_res->end - fb_res->start +1 ; - - fb =ioremap (fb_res->start, fb_len); -if (fb) { -memset (fb,0 , fb_len); -iounmap (fb); - } - } - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} +static struct at91_dev_table_lcdc device_lcdc __initdata = { + .mmio_base = AT91SAM9261_LCDC_BASE, + .irq = AT91SAM9261_ID_LCDC, +#if defined(CONFIG_FB_INTSRAM) + .sram_base = AT91SAM9261_SRAM_BASE, + .sram_size = AT91SAM9261_SRAM_SIZE, #endif - + .pins = lcdc_pins, + .nr_pins = ARRAY_SIZE(lcdc_pins), +}; /* -------------------------------------------------------------------- * Timer/Counter block@@ -367,6 +319,7 @@ static struct at91_device_table at91sam9261_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ssc[2] = &device_ssc2, + .lcdc = &device_lcdc, };void __init at91sam9261_init_devices (void )arch/arm/mach-at91/at91sam9263_devices.c +31
-63@@ -351,71 +351,38 @@ void __init at91_add_device_can(struct at91_can_data *data) {}* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9263_LCDC_BASE , - .end =AT91SAM9263_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9263_ID_LCDC , - .end =AT91SAM9263_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PB9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC12 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91SAM9263_LCDC_BASE , + .irq =AT91SAM9263_ID_LCDC , + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), }; -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) -return ; - -at91_set_A_periph (AT91_PIN_PC1 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC2 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDDEN */ -at91_set_B_periph (AT91_PIN_PB9 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PC8 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PC10 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PC14 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_B_periph (AT91_PIN_PC12 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PC22 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PC23 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PC24 ,0 );/* LCDD20 */ -at91_set_B_periph (AT91_PIN_PC17 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PC26 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PC27 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif - -/* -------------------------------------------------------------------- * Image Sensor Interface * -------------------------------------------------------------------- */ @@ -618,6 +585,7 @@ static struct at91_device_table at91sam9263_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91sam9263_init_devices (void )arch/arm/mach-at91/at91sam9g45_devices.c +39
-72@@ -346,80 +346,46 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9G45_LCDC_BASE , - .end =AT91SAM9G45_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9G45_ID_LCDC , - .end =AT91SAM9G45_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PE0 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDPWR */ + {AT91_PIN_PE2 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PE3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDVSYNC */ + {AT91_PIN_PE4 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PE5 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PE6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PE7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD0 */ + {AT91_PIN_PE8 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD1 */ + {AT91_PIN_PE9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD2 */ + {AT91_PIN_PE10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PE11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PE12 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PE13 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PE14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PE15 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD8 */ + {AT91_PIN_PE16 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD9 */ + {AT91_PIN_PE17 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD10 */ + {AT91_PIN_PE18 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PE19 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PE20 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PE21 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PE22 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PE23 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD16 */ + {AT91_PIN_PE24 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD17 */ + {AT91_PIN_PE25 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PE26 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PE27 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PE28 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PE29 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PE30 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDD23 */ +}; + +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91SAM9G45_LCDC_BASE , + .irq =AT91SAM9G45_ID_LCDC , + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), }; -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), -}; - -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) -return ; - -at91_set_A_periph (AT91_PIN_PE0 ,0 );/* LCDDPWR */ - -at91_set_A_periph (AT91_PIN_PE2 ,0 );/* LCDCC */ -at91_set_A_periph (AT91_PIN_PE3 ,0 );/* LCDVSYNC */ -at91_set_A_periph (AT91_PIN_PE4 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PE5 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PE6 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PE7 ,0 );/* LCDD0 */ -at91_set_A_periph (AT91_PIN_PE8 ,0 );/* LCDD1 */ -at91_set_A_periph (AT91_PIN_PE9 ,0 );/* LCDD2 */ -at91_set_A_periph (AT91_PIN_PE10 ,0 );/* LCDD3 */ -at91_set_A_periph (AT91_PIN_PE11 ,0 );/* LCDD4 */ -at91_set_A_periph (AT91_PIN_PE12 ,0 );/* LCDD5 */ -at91_set_A_periph (AT91_PIN_PE13 ,0 );/* LCDD6 */ -at91_set_A_periph (AT91_PIN_PE14 ,0 );/* LCDD7 */ -at91_set_A_periph (AT91_PIN_PE15 ,0 );/* LCDD8 */ -at91_set_A_periph (AT91_PIN_PE16 ,0 );/* LCDD9 */ -at91_set_A_periph (AT91_PIN_PE17 ,0 );/* LCDD10 */ -at91_set_A_periph (AT91_PIN_PE18 ,0 );/* LCDD11 */ -at91_set_A_periph (AT91_PIN_PE19 ,0 );/* LCDD12 */ -at91_set_A_periph (AT91_PIN_PE20 ,0 );/* LCDD13 */ -at91_set_A_periph (AT91_PIN_PE21 ,0 );/* LCDD14 */ -at91_set_A_periph (AT91_PIN_PE22 ,0 );/* LCDD15 */ -at91_set_A_periph (AT91_PIN_PE23 ,0 );/* LCDD16 */ -at91_set_A_periph (AT91_PIN_PE24 ,0 );/* LCDD17 */ -at91_set_A_periph (AT91_PIN_PE25 ,0 );/* LCDD18 */ -at91_set_A_periph (AT91_PIN_PE26 ,0 );/* LCDD19 */ -at91_set_A_periph (AT91_PIN_PE27 ,0 );/* LCDD20 */ -at91_set_A_periph (AT91_PIN_PE28 ,0 );/* LCDD21 */ -at91_set_A_periph (AT91_PIN_PE29 ,0 );/* LCDD22 */ -at91_set_A_periph (AT91_PIN_PE30 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif - -/* -------------------------------------------------------------------- * Timer/Counter block * -------------------------------------------------------------------- */ @@ -666,6 +632,7 @@ static struct at91_device_table at91sam9g45_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91sam9g45_init_devices (void )arch/arm/mach-at91/at91sam9rl_devices.c +28
-61@@ -242,71 +242,37 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* LCD Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) -static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); -static struct atmel_lcdfb_info lcdc_data; - -static struct resource lcdc_resources[] = { - [0 ] = { - .start =AT91SAM9RL_LCDC_BASE , - .end =AT91SAM9RL_LCDC_BASE +SZ_4K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9RL_ID_LCDC , - .end =AT91SAM9RL_ID_LCDC , - .flags =IORESOURCE_IRQ , - }, +static struct at91_pin_config lcdc_pins[]__initdata = { + {AT91_PIN_PC1 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDPWR */ + {AT91_PIN_PC5 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDHSYNC */ + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDOTCK */ + {AT91_PIN_PC7 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDDEN */ + {AT91_PIN_PC3 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* LCDCC */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD3 */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD4 */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD5 */ + {AT91_PIN_PC12 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD6 */ + {AT91_PIN_PC13 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD7 */ + {AT91_PIN_PC15 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD11 */ + {AT91_PIN_PC16 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD12 */ + {AT91_PIN_PC17 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD13 */ + {AT91_PIN_PC18 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD14 */ + {AT91_PIN_PC19 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD15 */ + {AT91_PIN_PC20 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD18 */ + {AT91_PIN_PC21 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD19 */ + {AT91_PIN_PC22 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD20 */ + {AT91_PIN_PC23 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD21 */ + {AT91_PIN_PC24 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD22 */ + {AT91_PIN_PC25 ,AT91_PIN_PERIPH_B ,0 ,0 ,0 },/* LCDD23 */ }; -static struct platform_device at91_lcdc_device = { - .name ="atmel_lcdfb" , - .id =0 , - .dev = { - .dma_mask = &lcdc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &lcdc_data, - }, - .resource = lcdc_resources, - .num_resources =ARRAY_SIZE (lcdc_resources), +static struct at91_dev_table_lcdc device_lcdc__initdata = { + .mmio_base =AT91SAM9RL_LCDC_BASE , + .irq =AT91SAM9RL_ID_LCDC , + .pins = lcdc_pins, + .nr_pins =ARRAY_SIZE (lcdc_pins), }; -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) -{ -if (!data) { -return ; - } - -at91_set_B_periph (AT91_PIN_PC1 ,0 );/* LCDPWR */ -at91_set_A_periph (AT91_PIN_PC5 ,0 );/* LCDHSYNC */ -at91_set_A_periph (AT91_PIN_PC6 ,0 );/* LCDDOTCK */ -at91_set_A_periph (AT91_PIN_PC7 ,0 );/* LCDDEN */ -at91_set_A_periph (AT91_PIN_PC3 ,0 );/* LCDCC */ -at91_set_B_periph (AT91_PIN_PC9 ,0 );/* LCDD3 */ -at91_set_B_periph (AT91_PIN_PC10 ,0 );/* LCDD4 */ -at91_set_B_periph (AT91_PIN_PC11 ,0 );/* LCDD5 */ -at91_set_B_periph (AT91_PIN_PC12 ,0 );/* LCDD6 */ -at91_set_B_periph (AT91_PIN_PC13 ,0 );/* LCDD7 */ -at91_set_B_periph (AT91_PIN_PC15 ,0 );/* LCDD11 */ -at91_set_B_periph (AT91_PIN_PC16 ,0 );/* LCDD12 */ -at91_set_B_periph (AT91_PIN_PC17 ,0 );/* LCDD13 */ -at91_set_B_periph (AT91_PIN_PC18 ,0 );/* LCDD14 */ -at91_set_B_periph (AT91_PIN_PC19 ,0 );/* LCDD15 */ -at91_set_B_periph (AT91_PIN_PC20 ,0 );/* LCDD18 */ -at91_set_B_periph (AT91_PIN_PC21 ,0 );/* LCDD19 */ -at91_set_B_periph (AT91_PIN_PC22 ,0 );/* LCDD20 */ -at91_set_B_periph (AT91_PIN_PC23 ,0 );/* LCDD21 */ -at91_set_B_periph (AT91_PIN_PC24 ,0 );/* LCDD22 */ -at91_set_B_periph (AT91_PIN_PC25 ,0 );/* LCDD23 */ - - lcdc_data = *data; -platform_device_register (&at91_lcdc_device); -} -#else -void __init at91_add_device_lcdc (struct atmel_lcdfb_info *data) {} -#endif - -/* -------------------------------------------------------------------- * Timer/Counter block * -------------------------------------------------------------------- */ @@ -541,6 +507,7 @@ static struct at91_device_table at91sam9rl_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ac97 = &device_ac97, + .lcdc = &device_lcdc, };void __init at91sam9rl_init_devices (void )arch/arm/mach-at91/devices.c +24
-0@@ -1579,6 +1579,81 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data)void __init at91_add_device_ac97 (struct ac97c_platform_data *data) {}#endif +/* -------------------------------------------------------------------- +* LCD Controller +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_FB_ATMEL ) || defined(CONFIG_FB_ATMEL_MODULE ) +static u64 lcdc_dmamask =DMA_BIT_MASK (32 ); +static struct atmel_lcdfb_info lcdc_data; + +static struct resource lcdc_resources[] = { + [0 ] = { + .end =SZ_4K , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .flags =IORESOURCE_IRQ , + }, +#if defined(CONFIG_FB_INTSRAM) + [2] = { + .flags =IORESOURCE_MEM , + }, +#endif +}; + +static struct platform_device at91_lcdc_device = {arch/arm/mach-at91/devices.c void __init at91_add_device_ac97(struct ac97c_platform_data *data) · line 1615
Quoted 10 lines
arch/arm/mach-at91/devices.c +10
-0+ .name = "atmel_lcdfb", + .id = 0, + .dev = { + .dma_mask = &lcdc_dmamask, + .coherent_dma_mask = DMA_BIT_MASK(32), + .platform_data = &lcdc_data, + }, + .resource = lcdc_resources, + .num_resources = ARRAY_SIZE(lcdc_resources), +};One difference to my approach (which you can like or not) is that mxc uses dynamic allocation of the
platform_devices. A structplatform_devicehas a size of 320 bytes. So instead of usingat91_lcdc_deviceyou could add toat91_add_device_lcdc:struct platform_device *pdev = platform_device_register_resndata( NULL, "atmel_lcdfb", 0, &lcdc_resources, ARRAY_SIZE(lcdc_resources), *data, sizeof(*data));
Quoted 6 lines
with the added benefit that
lcdc_resourcesand *data can be__initdata(or__initconst) to save a few more bytes.The obvious downside is that dynamic allocation probably takes more time than using static data and so increases the boottime. I didn't measure it, but I think the difference is small enough to see over it.
I prefer static
Best Regards,
J.
PATCH v2 17/23 at91: Make touchscreen device common
In reply to Ryan MallonReplace the individual touchscreen code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91sam9g45_devices.c | 53 +++++------------------------ arch/arm/mach-at91/at91sam9rl_devices.c | 53 +++++------------------------ arch/arm/mach-at91/devices.c | 49 +++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 7 ++++ 4 files changed, 74 insertions(+), 88 deletions(-)
arch/arm/mach-at91/at91sam9g45_devices.c +9 -44
@@ -436,53 +436,17 @@ static void __init at91_add_device_rtc(void) {}* Touchscreen * -------------------------------------------------------------------- */ -#if defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC ) || defined(CONFIG_TOUCHSCREEN_ATMEL_TSADCC_MODULE ) -static u64 tsadcc_dmamask =DMA_BIT_MASK (32 ); -static struct at91_tsadcc_data tsadcc_data; - -static struct resource tsadcc_resources[] = { - [0 ] = { - .start =AT91SAM9G45_BASE_TSC , - .end =AT91SAM9G45_BASE_TSC +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9G45_ID_TSC , - .end =AT91SAM9G45_ID_TSC , - .flags =IORESOURCE_IRQ , - } -}; - -static struct platform_device at91sam9g45_tsadcc_device = { - .name ="atmel_tsadcc" , - .id =-1 , - .dev = { - .dma_mask = &tsadcc_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &tsadcc_data, +static struct at91_dev_table_tsadcc device_tsadcc__initdata = { + .mmio_base =AT91SAM9G45_BASE_TSC , + .irq =AT91SAM9G45_ID_TSC , + .pins = { + {AT91_PIN_PD20 ,AT91_PIN_GPIO ,0 ,GPIOF_DIR_IN ,0 },/* AD0_XR */ + {AT91_PIN_PD21 ,AT91_PIN_GPIO ,0 ,GPIOF_DIR_IN ,0 },/* AD0_XL */ + {AT91_PIN_PD22 ,AT91_PIN_GPIO ,0 ,GPIOF_DIR_IN ,0 },/* AD0_YT */ + {AT91_PIN_PD23 ,AT91_PIN_GPIO ,0 ,GPIOF_DIR_IN ,0 },/* AD0_TB */ }, - .resource = tsadcc_resources, - .num_resources =ARRAY_SIZE (tsadcc_resources), }; -void __init at91_add_device_tsadcc (struct at91_tsadcc_data *data) -{ -if (!data) -return ; - -at91_set_gpio_input (AT91_PIN_PD20 ,0 );/* AD0_XR */ -at91_set_gpio_input (AT91_PIN_PD21 ,0 );/* AD1_XL */ -at91_set_gpio_input (AT91_PIN_PD22 ,0 );/* AD2_YT */ -at91_set_gpio_input (AT91_PIN_PD23 ,0 );/* AD3_TB */ - - tsadcc_data = *data; -platform_device_register (&at91sam9g45_tsadcc_device); -} -#else -void __init at91_add_device_tsadcc (struct at91_tsadcc_data *data) {} -#endif - -/* -------------------------------------------------------------------- * RTT * -------------------------------------------------------------------- */
@@ -633,6 +597,7 @@ static struct at91_device_table at91sam9g45_device_table __initdata = { .ssc[1] = &device_ssc1, .ac97 = &device_ac97, .lcdc = &device_lcdc, + .tsadcc = &device_tsadcc, };void __init at91sam9g45_init_devices (void )
arch/arm/mach-at91/at91sam9rl_devices.c +9 -44
68 lines not on this page · raw message
arch/arm/mach-at91/devices.c +49 -0
55 lines not on this page · raw message
arch/arm/mach-at91/devices.h +7 -0
@@ -157,6 +157,12 @@ struct at91_dev_table_lcdc {int nr_pins; }; +struct at91_dev_table_tsadcc { +unsigned mmio_base; +int irq; +struct at91_pin_config pins[4 ];/* XR, XL, YT, TB */ +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -174,6 +180,7 @@ struct at91_device_table {struct at91_dev_table_ssc *ssc[4 ];struct at91_dev_table_ac97 *ac97;struct at91_dev_table_lcdc *lcdc; +struct at91_dev_table_tsadcc *tsadcc; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 18/23 at91: Make HDMAC device common
In reply to Ryan MallonReplace the individual HDMAC code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91sam9g45_devices.c | 46 +++-------------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 43 ++------------------------- arch/arm/mach-at91/devices.c | 46 ++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 8 +++++ 4 files changed, 63 insertions(+), 80 deletions(-)
arch/arm/mach-at91/at91sam9g45_devices.c +5 -41
@@ -36,49 +36,13 @@* HDMAC - AHB DMA Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_AT_HDMAC ) || defined(CONFIG_AT_HDMAC_MODULE ) -static u64 hdmac_dmamask =DMA_BIT_MASK (32 ); - -static struct at_dma_platform_data atdma_pdata = { +static struct at91_dev_table_hdmac device_hdmac__initdata = { + .mmio_base =AT91_BASE_SYS +AT91_DMA , + .irq =AT91SAM9G45_ID_DMA , .nr_channels =8 , + .have_slave =1 , }; -static struct resource hdmac_resources[] = { - [0 ] = { - .start =AT91_BASE_SYS +AT91_DMA , - .end =AT91_BASE_SYS +AT91_DMA +SZ_512 -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9G45_ID_DMA , - .end =AT91SAM9G45_ID_DMA , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device at_hdmac_device = { - .name ="at_hdmac" , - .id =-1 , - .dev = { - .dma_mask = &hdmac_dmamask, - .coherent_dma_mask =DMA_BIT_MASK (32 ), - .platform_data = &atdma_pdata, - }, - .resource = hdmac_resources, - .num_resources =ARRAY_SIZE (hdmac_resources), -}; - -void __init at91_add_device_hdmac (void ) -{ -dma_cap_set (DMA_MEMCPY , atdma_pdata.cap_mask); -dma_cap_set (DMA_SLAVE , atdma_pdata.cap_mask); -platform_device_register (&at_hdmac_device); -} -#else -void __init at91_add_device_hdmac (void ) {} -#endif - -/* -------------------------------------------------------------------- * USB Host (OHCI) * -------------------------------------------------------------------- */
@@ -598,6 +562,7 @@ static struct at91_device_table at91sam9g45_device_table __initdata = { .ac97 = &device_ac97, .lcdc = &device_lcdc, .tsadcc = &device_tsadcc, + .hdmac = &device_hdmac, };void __init at91sam9g45_init_devices (void )
@@ -612,7 +577,6 @@ void __init at91sam9g45_init_devices(void)*/ static int __init at91_add_standard_devices (void ) { -at91_add_device_hdmac ();at91_add_device_rtc ();return 0 ; }
arch/arm/mach-at91/at91sam9rl_devices.c +4 -39
64 lines not on this page · raw message
arch/arm/mach-at91/devices.c +46 -0
57 lines not on this page · raw message
arch/arm/mach-at91/devices.h +8 -0
@@ -163,6 +163,13 @@ struct at91_dev_table_tsadcc {struct at91_pin_config pins[4 ];/* XR, XL, YT, TB */ }; +struct at91_dev_table_hdmac { +unsigned mmio_base; +int irq; +int nr_channels; +int have_slave; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -181,6 +188,7 @@ struct at91_device_table {struct at91_dev_table_ac97 *ac97;struct at91_dev_table_lcdc *lcdc;struct at91_dev_table_tsadcc *tsadcc; +struct at91_dev_table_hdmac *hdmac; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 19/23 at91: Make RTC device common
In reply to Ryan MallonThe RTC device code for the AT91RM9200, AT91SAM9G45 and AT91SAM9RL are all exactly the same. Remove the individual implementations and replace them with a single version in devices.c
--- arch/arm/mach-at91/at91rm9200_devices.c | 33 ----------------------------- arch/arm/mach-at91/at91sam9g45_devices.c | 33 ----------------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 34 ------------------------------ arch/arm/mach-at91/devices.c | 20 +++++++++++++++++ 4 files changed, 20 insertions(+), 100 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +0 -33
@@ -277,25 +277,6 @@ static struct at91_dev_table_tcb device_tcb1 __initdata = { };/* -------------------------------------------------------------------- -* RTC -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_RTC_DRV_AT91RM9200 ) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE ) -static struct platform_device at91rm9200_rtc_device = { - .name ="at91_rtc" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_rtc (void ) -{ -platform_device_register (&at91rm9200_rtc_device); -} -#else -static void __init at91_add_device_rtc (void ) {} -#endif - -/* -------------------------------------------------------------------- * SSC -- Synchronous Serial Controller * -------------------------------------------------------------------- */
@@ -444,17 +425,3 @@ void __init at91rm9200_init_devices(void) {at91_init_devices (&at91rm9200_device_table); } - -/* -------------------------------------------------------------------- */ - -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_rtc (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91sam9g45_devices.c +0 -33
@@ -377,26 +377,6 @@ static struct at91_dev_table_tcb device_tcb1 __initdata = { };/* -------------------------------------------------------------------- -* RTC -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_RTC_DRV_AT91RM9200 ) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE ) -static struct platform_device at91sam9g45_rtc_device = { - .name ="at91_rtc" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_rtc (void ) -{ -platform_device_register (&at91sam9g45_rtc_device); -} -#else -static void __init at91_add_device_rtc (void ) {} -#endif - - -/* -------------------------------------------------------------------- * Touchscreen * -------------------------------------------------------------------- */
@@ -569,16 +549,3 @@ void __init at91sam9g45_init_devices(void) {at91_init_devices (&at91sam9g45_device_table); } - -/* -------------------------------------------------------------------- */ -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_rtc (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/at91sam9rl_devices.c +0 -34
@@ -271,26 +271,6 @@ static struct at91_dev_table_tsadcc device_tsadcc __initdata = { };/* -------------------------------------------------------------------- -* RTC -* -------------------------------------------------------------------- */ - -#if defined(CONFIG_RTC_DRV_AT91RM9200 ) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE ) -static struct platform_device at91sam9rl_rtc_device = { - .name ="at91_rtc" , - .id =-1 , - .num_resources =0 , -}; - -static void __init at91_add_device_rtc (void ) -{ -platform_device_register (&at91sam9rl_rtc_device); -} -#else -static void __init at91_add_device_rtc (void ) {} -#endif - - -/* -------------------------------------------------------------------- * RTT * -------------------------------------------------------------------- */
@@ -445,17 +425,3 @@ void __init at91sam9rl_init_devices(void) {at91_init_devices (&at91sam9rl_device_table); } - -/* -------------------------------------------------------------------- */ - -/* -* These devices are always present and don't need any board-specific -* setup. -*/ -static int __init at91_add_standard_devices (void ) -{ -at91_add_device_rtc (); -return 0 ; -} - -arch_initcall (at91_add_standard_devices);
arch/arm/mach-at91/devices.c +20 -0
@@ -1748,12 +1748,32 @@ void __init at91_add_device_hdmac(void)void __init at91_add_device_hdmac (void ) {}#endif +/* -------------------------------------------------------------------- +* RTC +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_RTC_DRV_AT91RM9200 ) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE ) +static struct platform_device at91_rtc_device = { + .name ="at91_rtc" , + .id =-1 , + .num_resources =0 , +}; + +static void __init at91_add_device_rtc (void ) +{ +platform_device_register (&at91_rtc_device); +} +#else +static void __init at91_add_device_rtc (void ) {} +#endif +static int __init at91_add_standard_devices (void ) {at91_add_device_tc ();at91_add_device_rtt ();at91_add_device_watchdog ();at91_add_device_hdmac (); +at91_add_device_rtc ();return 0 ; }
Signature · 1 line
1.7.0.4
PATCH v2 20/23 at91: Make high speed USB gadget device common
In reply to Ryan MallonReplace the individual high-speed UDC code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91cap9_devices.c | 114 ++++++------------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 94 ++++--------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 100 ++++---------------------- arch/arm/mach-at91/devices.c | 79 +++++++++++++++++++++ arch/arm/mach-at91/devices.h | 20 +++++ 5 files changed, 150 insertions(+), 257 deletions(-)
arch/arm/mach-at91/at91cap9_devices.c +23 -91
@@ -51,105 +51,36 @@ static struct at91_dev_table_usb_ohci device_usbh_ohci __initdata = {* USB HS Device (Gadget) * -------------------------------------------------------------------- */ -#if defined(CONFIG_USB_GADGET_ATMEL_USBA ) || defined(CONFIG_USB_GADGET_ATMEL_USBA_MODULE ) - -static struct resource usba_udc_resources[] = { - [0 ] = { - .start =AT91CAP9_UDPHS_FIFO , - .end =AT91CAP9_UDPHS_FIFO +SZ_512K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91CAP9_BASE_UDPHS , - .end =AT91CAP9_BASE_UDPHS +SZ_1K -1 , - .flags =IORESOURCE_MEM , - }, - [2 ] = { - .start =AT91CAP9_ID_UDPHS , - .end =AT91CAP9_ID_UDPHS , - .flags =IORESOURCE_IRQ , - }, -}; - -#define EP (nam, idx, maxpkt, maxbk, dma, isoc) \ - [idx] = { \ - .name = nam, \ - .index = idx, \ - .fifo_size = maxpkt, \ - .nr_banks = maxbk, \ - .can_dma = dma, \ - .can_isoc = isoc, \ - } - -static struct usba_ep_data usba_udc_ep[] = { -EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), -EP ("ep1" ,1 ,1024 ,3 ,1 ,1 ), -EP ("ep2" ,2 ,1024 ,3 ,1 ,1 ), -EP ("ep3" ,3 ,1024 ,2 ,1 ,1 ), -EP ("ep4" ,4 ,1024 ,2 ,1 ,1 ), -EP ("ep5" ,5 ,1024 ,2 ,1 ,0 ), -EP ("ep6" ,6 ,1024 ,2 ,1 ,0 ), -EP ("ep7" ,7 ,1024 ,2 ,0 ,0 ), -}; - -#undef EP - -/* -* pdata doesn't have room for any endpoints, so we need to -* append room for the ones we need right after it. -*/ -static struct { -struct usba_platform_data pdata; -struct usba_ep_data ep[8 ]; -} usba_udc_data; - -static struct platform_device at91_usba_udc_device = { - .name ="atmel_usba_udc" , - .id =-1 , - .dev = { - .platform_data = &usba_udc_data.pdata, - }, - .resource = usba_udc_resources, - .num_resources =ARRAY_SIZE (usba_udc_resources), -}; - -void __init at91_add_device_usba (struct usba_platform_data *data) +static void at91cap9_usba_init (void ) {if (cpu_is_at91cap9_revB ()) {irq_set_irq_type (AT91CAP9_ID_UDPHS ,IRQ_TYPE_LEVEL_HIGH );at91_sys_write (AT91_MATRIX_UDPHS ,AT91_MATRIX_SELECT_UDPHS | -AT91_MATRIX_UDPHS_BYPASS_LOCK ); - } -else +AT91_MATRIX_UDPHS_BYPASS_LOCK ); + }else {at91_sys_write (AT91_MATRIX_UDPHS ,AT91_MATRIX_SELECT_UDPHS ); - -/* -* Invalid pins are 0 on AT91, but the usba driver is shared -* with AVR32, which use negative values instead. Once/if -* gpio_is_valid() is ported to AT91, revisit this code. -*/ - usba_udc_data.pdata.vbus_pin = -EINVAL ; - usba_udc_data.pdata.num_ep =ARRAY_SIZE (usba_udc_ep); -memcpy (usba_udc_data.ep, usba_udc_ep,sizeof (usba_udc_ep));; - -if (data && data->vbus_pin >0 ) { -at91_set_gpio_input (data->vbus_pin,0 ); -at91_set_deglitch (data->vbus_pin,1 ); - usba_udc_data.pdata.vbus_pin = data->vbus_pin; } - -/* Pullup pin is handled internally by USB device peripheral */ - -/* Clocks */ -at91_clock_associate ("utmi_clk" , &at91_usba_udc_device.dev,"hclk" ); -at91_clock_associate ("udphs_clk" , &at91_usba_udc_device.dev,"pclk" ); - -platform_device_register (&at91_usba_udc_device); } -#else -void __init at91_add_device_usba (struct usba_platform_data *data) {} -#endif +static struct usba_ep_data usba_udc_ep[] = { +AT91_UDC_HS_EP ("ep0" ,0 ,64 ,1 ,0 ,0 ), +AT91_UDC_HS_EP ("ep1" ,1 ,1024 ,3 ,1 ,1 ), +AT91_UDC_HS_EP ("ep2" ,2 ,1024 ,3 ,1 ,1 ), +AT91_UDC_HS_EP ("ep3" ,3 ,1024 ,2 ,1 ,1 ), +AT91_UDC_HS_EP ("ep4" ,4 ,1024 ,2 ,1 ,1 ), +AT91_UDC_HS_EP ("ep5" ,5 ,1024 ,2 ,1 ,0 ), +AT91_UDC_HS_EP ("ep6" ,6 ,1024 ,2 ,1 ,0 ), +AT91_UDC_HS_EP ("ep7" ,7 ,1024 ,2 ,0 ,0 ), +}; + +static struct at91_dev_table_udc_hs device_udc_hs__initdata = { + .fifo_base =AT91CAP9_UDPHS_FIFO , + .mmio_base =AT91CAP9_BASE_UDPHS , + .irq =AT91CAP9_ID_UDPHS , + .device_init = at91cap9_usba_init, + .endpoints = usba_udc_ep, + .nr_endpoints =ARRAY_SIZE (usba_udc_ep), +};/* -------------------------------------------------------------------- * Ethernet
@@ -480,6 +411,7 @@ static struct at91_device_table at91cap9_device_table __initdata = { .ssc[1] = &device_ssc1, .ac97 = &device_ac97, .lcdc = &device_lcdc, + .udc_hs = &device_udc_hs, };void __init at91cap9_init_devices (void )
arch/arm/mach-at91/at91sam9g45_devices.c +14 -80
111 lines not on this page · raw message
arch/arm/mach-at91/at91sam9rl_devices.c +14 -86
117 lines not on this page · raw message
arch/arm/mach-at91/devices.c +79 -0
85 lines not on this page · raw message
arch/arm/mach-at91/devices.h +20 -0
@@ -170,6 +170,25 @@ struct at91_dev_table_hdmac {int have_slave; }; +#define AT91_UDC_HS_EP (nam, idx, maxpkt, maxbk, dma, isoc) \ + [idx] = { \ + .name = nam, \ + .index = idx, \ + .fifo_size = maxpkt, \ + .nr_banks = maxbk, \ + .can_dma = dma, \ + .can_isoc = isoc, \ + } + +struct at91_dev_table_udc_hs { +unsigned fifo_base; +unsigned mmio_base; +int irq; +void (*device_init)(void ); +struct usba_ep_data *endpoints; +int nr_endpoints; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -189,6 +208,7 @@ struct at91_device_table {struct at91_dev_table_lcdc *lcdc;struct at91_dev_table_tsadcc *tsadcc;struct at91_dev_table_hdmac *hdmac; +struct at91_dev_table_udc_hs *udc_hs; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 20/23 at91: Make high speed USB gadget device common
Quoted 4 lines · Ryan Mallon
Replace the individual high-speed UDC code for each at91 variant with a single implementation in
devices.c
Quoted 8 lines
Signed-off-by Ryan Mallon <[email protected]>--- arch/arm/mach-at91/at91cap9_devices.c | 114 ++++++------------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 94 ++++--------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 100 ++++---------------------- arch/arm/mach-at91/devices.c | 79 +++++++++++++++++++++ arch/arm/mach-at91/devices.h | 20 +++++ 5 files changed, 150 insertions(+), 257 deletions(-)
Thanks for sending part 12/23 of the series.
I tried applying all of the patches to linux-next and got this on part 20/23:
patching file arch/arm/mach-at91/at91cap9_devices.c
Hunk #1 FAILED at 51.
1 out of 2 hunks FAILED -- saving rejects to file arch/arm/mach-at91/at91cap9_devices.c.rej patching file arch/arm/mach-at91/at91sam9g45_devices.c
Hunk #1 FAILED at 66.
1 out of 2 hunks FAILED -- saving rejects to file arch/arm/mach-at91/at91sam9g45_devices.c.rej patching file arch/arm/mach-at91/at91sam9rl_devices.c
Hunk #1 FAILED at 40.
1 out of 2 hunks FAILED -- saving rejects to file arch/arm/mach-at91/at91sam9rl_devices.c.rej patching file arch/arm/mach-at91/devices.c
patching file arch/arm/mach-at91/devices.h
What kernel should this apply to?
Thanks,
Hartley
PATCH v2 20/23 at91: Make high speed USB gadget device common
Quoted 31 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
Replace the individual high-speed UDC code for each at91 variant with a single implementation in
devices.cQuoted 8 lines
Signed-off-by Ryan Mallon <[email protected]>--- arch/arm/mach-at91/at91cap9_devices.c | 114 ++++++------------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 94 ++++--------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 100 ++++---------------------- arch/arm/mach-at91/devices.c | 79 +++++++++++++++++++++ arch/arm/mach-at91/devices.h | 20 +++++ 5 files changed, 150 insertions(+), 257 deletions(-)Thanks for sending part 12/23 of the series.
I tried applying all of the patches to linux-next and got this on part 20/23:
patching file
arch/arm/mach-at91/at91cap9_devices.c
Hunk #1 FAILED at 51.
1 out of 2 hunks FAILED -- saving rejects to filearch/arm/mach-at91/at91cap9_devices.c.rejpatching filearch/arm/mach-at91/at91sam9g45_devices.c
Hunk #1 FAILED at 66.
1 out of 2 hunks FAILED -- saving rejects to filearch/arm/mach-at91/at91sam9g45_devices.c.rejpatching filearch/arm/mach-at91/at91sam9rl_devices.c
Hunk #1 FAILED at 40.
1 out of 2 hunks FAILED -- saving rejects to filearch/arm/mach-at91/at91sam9rl_devices.c.rejpatching filearch/arm/mach-at91/devices.c
patching filearch/arm/mach-at91/devices.h
Quoted 1 line
What kernel should this apply to?
It should apply on top of 2.6.39-rc1. I can rebase it on top of -next if needed.
~Ryan
PATCH v2 20/23 at91: Make high speed USB gadget device common
Quoted 32 lines · Ryan Mallon
Quoted 31 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
Replace the individual high-speed UDC code for each at91 variant with a single implementation in
devices.cQuoted 8 lines
Signed-off-by Ryan Mallon <[email protected]>--- arch/arm/mach-at91/at91cap9_devices.c | 114 ++++++------------------------ arch/arm/mach-at91/at91sam9g45_devices.c | 94 ++++--------------------- arch/arm/mach-at91/at91sam9rl_devices.c | 100 ++++---------------------- arch/arm/mach-at91/devices.c | 79 +++++++++++++++++++++ arch/arm/mach-at91/devices.h | 20 +++++ 5 files changed, 150 insertions(+), 257 deletions(-)Thanks for sending part 12/23 of the series.
I tried applying all of the patches to linux-next and got this on part 20/23:
patching file
arch/arm/mach-at91/at91cap9_devices.c
Hunk #1 FAILED at 51.
1 out of 2 hunks FAILED -- saving rejects to filearch/arm/mach-at91/at91cap9_devices.c.rejpatching filearch/arm/mach-at91/at91sam9g45_devices.c
Hunk #1 FAILED at 66.
1 out of 2 hunks FAILED -- saving rejects to filearch/arm/mach-at91/at91sam9g45_devices.c.rejpatching filearch/arm/mach-at91/at91sam9rl_devices.c
Hunk #1 FAILED at 40.
1 out of 2 hunks FAILED -- saving rejects to filearch/arm/mach-at91/at91sam9rl_devices.c.rejpatching filearch/arm/mach-at91/devices.c
patching filearch/arm/mach-at91/devices.h
Quoted 4 lines
Quoted 1 line
What kernel should this apply to?
It should apply on top of 2.6.39-rc1. I can rebase it on top of -next if needed.
Found the cause of the problem in linux-next:
commit 6eab04a87677a37cf15b52e2b4b4fd57917102ad
Author: Justin P. Mattock <[email protected]> Date: Fri Apr 8 19:49:08 2011 -0700
treewide: remove extra semicolons
I just tweeked your existing patch to get it to apply cleanly.
I'll try to do a full review now that I have all the pieces.
Thanks,
Hartley
PATCH v2 21/23 at91: Make compact flash device common
In reply to Ryan MallonReplace the individual compact flash device code for each at91 variant with a single implementation in devices.c
--- arch/arm/mach-at91/at91rm9200_devices.c | 74 ++++++-------------- arch/arm/mach-at91/at91sam9260_devices.c | 114 +++++++----------------------- arch/arm/mach-at91/at91sam9263_devices.c | 102 +++++++-------------------- arch/arm/mach-at91/devices.c | 105 +++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 14 ++++ 5 files changed, 193 insertions(+), 216 deletions(-)
arch/arm/mach-at91/at91rm9200_devices.c +22 -52
@@ -84,38 +84,12 @@ static struct at91_dev_table_ethernet device_eth __initdata = {* Compact Flash / PCMCIA * -------------------------------------------------------------------- */ -#if defined(CONFIG_AT91_CF ) || defined(CONFIG_AT91_CF_MODULE ) -static struct at91_cf_data cf_data; - -#define CF_BASE AT91_CHIPSELECT_4 - -static struct resource cf_resources[] = { - [0 ] = { - .start =CF_BASE , -/* ties up CS4, CS5 and CS6 */ - .end =CF_BASE + (0x30000000 -1 ), - .flags =IORESOURCE_MEM |IORESOURCE_MEM_8AND16BIT , - }, -}; - -static struct platform_device at91rm9200_cf_device = { - .name ="at91_cf" , - .id =-1 , - .dev = { - .platform_data = &cf_data, - }, - .resource = cf_resources, - .num_resources =ARRAY_SIZE (cf_resources), -}; - -void __init at91_add_device_cf (struct at91_cf_data *data) +static int __init at91rm9200_cf_init (struct at91_cf_data *data,int *slot) {unsigned int csa; -if (!data) -return ; - data->chipselect =4 ;/* can only use EBI ChipSelect 4 */ + *slot =0 ;/* only one CF slot */ /* CF takes over CS4, CS5, CS6 */ csa =at91_sys_read (AT91_EBI_CSA );
@@ -136,35 +110,30 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | AT91_SMC_RWHOLD_(4) /* hold time */ ); -/* input/irq */ -if (data->irq_pin) { -at91_set_gpio_input (data->irq_pin,1 ); -at91_set_deglitch (data->irq_pin,1 ); - } -at91_set_gpio_input (data->det_pin,1 ); -at91_set_deglitch (data->det_pin,1 ); - -/* outputs, initially off */ -if (data->vcc_pin) -at91_set_gpio_output (data->vcc_pin,0 ); -at91_set_gpio_output (data->rst_pin,0 ); +return 0 ; +} +static struct at91_pin_config cf_pins[]__initdata = {/* force poweron defaults for these pins ... */ -at91_set_A_periph (AT91_PIN_PC9 ,0 );/* A25/CFRNW */ -at91_set_A_periph (AT91_PIN_PC10 ,0 );/* NCS4/CFCS */ -at91_set_A_periph (AT91_PIN_PC11 ,0 );/* NCS5/CFCE1 */ -at91_set_A_periph (AT91_PIN_PC12 ,0 );/* NCS6/CFCE2 */ + {AT91_PIN_PC9 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* A25/CFRNW */ + {AT91_PIN_PC10 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* NCS4/CFCS */ + {AT91_PIN_PC11 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* NCS5/CFCE1 */ + {AT91_PIN_PC12 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* NCS6/CFCE2 */ /* nWAIT is _not_ a default setting */ -at91_set_A_periph (AT91_PIN_PC6 ,1 );/* nWAIT */ - - cf_data = *data; - platform_device_register(&at91rm9200_cf_device); -} -#else -void __init at91_add_device_cf (struct at91_cf_data *data) {} -#endif + {AT91_PIN_PC6 ,AT91_PIN_PERIPH_A ,1 ,0 ,0 },/* nWAIT */ +}; +static struct at91_dev_table_cf device_cf__initdata = { + .slot[0 ] = { +/* ties up CS4, CS5 and CS6 */ + .mmio_base =AT91_CHIPSELECT_4 , + .mmio_size =0x30000000 , + }, + .device_init = at91rm9200_cf_init, + .pins = cf_pins, + .nr_pins =ARRAY_SIZE (cf_pins), +};/* -------------------------------------------------------------------- * MMC / SD
@@ -419,6 +388,7 @@ static struct at91_device_table at91rm9200_device_table __initdata = { .ssc[0] = &device_ssc0, .ssc[1] = &device_ssc1, .ssc[2] = &device_ssc2, + .cf = &device_cf, };void __init at91rm9200_init_devices (void )
arch/arm/mach-at91/at91sam9260_devices.c +26 -88
149 lines not on this page · raw message
arch/arm/mach-at91/at91sam9263_devices.c +26 -76
134 lines not on this page · raw message
arch/arm/mach-at91/devices.c +105 -0
111 lines not on this page · raw message
arch/arm/mach-at91/devices.h +14 -0
@@ -189,6 +189,19 @@ struct at91_dev_table_udc_hs {int nr_endpoints; }; +struct at91_cf_slot { +unsigned mmio_base; +unsigned mmio_size; +}; + +struct at91_dev_table_cf { +struct at91_cf_slot slot[2 ]; +int (*device_init)(struct at91_cf_data *data, +int *slot); +struct at91_pin_config *pins; +int nr_pins; +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -209,6 +222,7 @@ struct at91_device_table {struct at91_dev_table_tsadcc *tsadcc;struct at91_dev_table_hdmac *hdmac;struct at91_dev_table_udc_hs *udc_hs; +struct at91_dev_table_cf *cf; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 22/23 at91: Move at91sam9263 CAN device to common devices
In reply to Ryan MallonThe CAN device is only used on the AT91SAM9263. Move it to the common devices.c file to be consistent with other devices.
--- arch/arm/mach-at91/at91sam9263_devices.c | 37 +++++----------------------- arch/arm/mach-at91/devices.c | 38 ++++++++++++++++++++++++++++++ arch/arm/mach-at91/devices.h | 7 +++++ 3 files changed, 52 insertions(+), 30 deletions(-)
arch/arm/mach-at91/at91sam9263_devices.c +7 -30
@@ -263,39 +263,15 @@ static struct at91_dev_table_ac97 device_ac97 __initdata = {* CAN Controller * -------------------------------------------------------------------- */ -#if defined(CONFIG_CAN_AT91 ) || defined(CONFIG_CAN_AT91_MODULE ) -static struct resource can_resources[] = { - [0 ] = { - .start =AT91SAM9263_BASE_CAN , - .end =AT91SAM9263_BASE_CAN +SZ_16K -1 , - .flags =IORESOURCE_MEM , - }, - [1 ] = { - .start =AT91SAM9263_ID_CAN , - .end =AT91SAM9263_ID_CAN , - .flags =IORESOURCE_IRQ , +static struct at91_dev_table_can device_can__initdata = { + .mmio_base =AT91SAM9263_BASE_CAN , + .irq =AT91SAM9263_ID_CAN , + .pins = { + {AT91_PIN_PA13 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* CANTX */ + {AT91_PIN_PA14 ,AT91_PIN_PERIPH_A ,0 ,0 ,0 },/* CANRX */ }, }; -static struct platform_device at91sam9263_can_device = { - .name ="at91_can" , - .id =-1 , - .resource = can_resources, - .num_resources =ARRAY_SIZE (can_resources), -}; - -void __init at91_add_device_can (struct at91_can_data *data) -{ -at91_set_A_periph (AT91_PIN_PA13 ,0 );/* CANTX */ -at91_set_A_periph (AT91_PIN_PA14 ,0 );/* CANRX */ - at91sam9263_can_device.dev.platform_data = data; - -platform_device_register (&at91sam9263_can_device); -} -#else -void __init at91_add_device_can (struct at91_can_data *data) {} -#endif -/* -------------------------------------------------------------------- * LCD Controller * -------------------------------------------------------------------- */
@@ -536,6 +512,7 @@ static struct at91_device_table at91sam9263_device_table __initdata = { .ac97 = &device_ac97, .lcdc = &device_lcdc, .cf = &device_cf, + .can = &device_can, };void __init at91sam9263_init_devices (void )
arch/arm/mach-at91/devices.c +38 -0
@@ -1951,6 +1951,44 @@ void __init at91_add_device_cf(struct at91_cf_data *data)void __init at91_add_device_cf (struct at91_cf_data *data) {}#endif +/* -------------------------------------------------------------------- +* CAN Controller +* -------------------------------------------------------------------- */ + +#if defined(CONFIG_CAN_AT91 ) || defined(CONFIG_CAN_AT91_MODULE ) +static struct resource can_resources[] = { + [0 ] = { + .end =SZ_16K , + .flags =IORESOURCE_MEM , + }, + [1 ] = { + .flags =IORESOURCE_IRQ , + }, +}; + +static struct platform_device at91_can_device = { + .name ="at91_can" , + .id =-1 , + .resource = can_resources, + .num_resources =ARRAY_SIZE (can_resources), +}; + +void __init at91_add_device_can (struct at91_can_data *data) +{ +struct at91_dev_table_can *info = devices->can; + +BUG_ON (!info); +init_resource_mem (&can_resources[0 ], info->mmio_base); +init_resource_irq (&can_resources[1 ], info->irq); + +at91_config_pins (info->pins,ARRAY_SIZE (info->pins)); + at91_can_device.dev.platform_data = data; +platform_device_register (&at91sam9263_can_device); +} +#else +void __init at91_add_device_can (struct at91_can_data *data) {} +#endif +static int __init at91_add_standard_devices (void ) {at91_add_device_tc ();
arch/arm/mach-at91/devices.h +7 -0
@@ -202,6 +202,12 @@ struct at91_dev_table_cf {int nr_pins; }; +struct at91_dev_table_can { +unsigned mmio_base; +int irq; +struct at91_pin_config pins[2 ];/* TX, RX */ +}; +struct at91_device_table {struct at91_dev_table_ethernet *ethernet;struct at91_dev_table_usb_ohci *usbh_ohci;
@@ -223,6 +229,7 @@ struct at91_device_table {struct at91_dev_table_hdmac *hdmac;struct at91_dev_table_udc_hs *udc_hs;struct at91_dev_table_cf *cf; +struct at91_dev_table_can *can; };extern void __init at91_init_devices (struct at91_device_table *device_table);
Signature · 1 line
1.7.0.4
PATCH v2 23/23 at91: Remove mAgic and ISI device code
In reply to Ryan MallonThe AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in arch/arm/mach-at91 is unused and can be removed.
--- arch/arm/mach-at91/at572d940hf_devices.c | 73 ----------------------------- arch/arm/mach-at91/at91sam9263_devices.c | 50 -------------------- arch/arm/mach-at91/board-at572d940hf_ek.c | 2 - arch/arm/mach-at91/include/mach/board.h | 6 -- 4 files changed, 0 insertions(+), 131 deletions(-)
arch/arm/mach-at91/at572d940hf_devices.c +0 -73
@@ -250,79 +250,6 @@ static struct at91_dev_table_uart device_uart2 __initdata = { .cts_pin = {AT91_PIN_PA16, AT91_PIN_PERIPH_A, 0, 0, 0}, }; -/* -------------------------------------------------------------------- -* mAgic -* -------------------------------------------------------------------- */ - -#ifdef CONFIG_MAGICV -static struct resource mAgic_resources[] = { - { - .start =AT91_MAGIC_PM_BASE , - .end =AT91_MAGIC_PM_BASE +AT91_MAGIC_PM_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =AT91_MAGIC_DM_I_BASE , - .end =AT91_MAGIC_DM_I_BASE +AT91_MAGIC_DM_I_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =AT91_MAGIC_DM_F_BASE , - .end =AT91_MAGIC_DM_F_BASE +AT91_MAGIC_DM_F_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =AT91_MAGIC_DM_DB_BASE , - .end =AT91_MAGIC_DM_DB_BASE +AT91_MAGIC_DM_DB_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =AT91_MAGIC_REGS_BASE , - .end =AT91_MAGIC_REGS_BASE +AT91_MAGIC_REGS_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =AT91_MAGIC_EXTPAGE_BASE , - .end =AT91_MAGIC_EXTPAGE_BASE +AT91_MAGIC_EXTPAGE_SIZE -1 , - .flags =IORESOURCE_MEM , - }, - { - .start =AT572D940HF_ID_MSIRQ0 , - .end =AT572D940HF_ID_MSIRQ0 , - .flags =IORESOURCE_IRQ , - }, - { - .start =AT572D940HF_ID_MHALT , - .end =AT572D940HF_ID_MHALT , - .flags =IORESOURCE_IRQ , - }, - { - .start =AT572D940HF_ID_MEXC , - .end =AT572D940HF_ID_MEXC , - .flags =IORESOURCE_IRQ , - }, - { - .start =AT572D940HF_ID_MEDMA , - .end =AT572D940HF_ID_MEDMA , - .flags =IORESOURCE_IRQ , - }, -}; - -static struct platform_device mAgic_device = { - .name ="mAgic" , - .id =-1 , - .num_resources =ARRAY_SIZE (mAgic_resources), - .resource = mAgic_resources, -}; - -void __init at91_add_device_mAgic (void ) -{ -platform_device_register (&mAgic_device); -} -#else -void __init at91_add_device_mAgic (void ) {} -#endif -static struct at91_device_table at572d940hf_device_table__initdata = { .ethernet = &device_eth, .usbh_ohci = &device_usbh_ohci,
arch/arm/mach-at91/at91sam9263_devices.c +0 -50
56 lines not on this page · raw message
arch/arm/mach-at91/board-at572d940hf_ek.c +0 -2
@@ -312,8 +312,6 @@ static void __init eb_board_init(void)at91_add_device_mmc (0 , &eb_mmc_data);/* Ethernet */ at91_add_device_eth (&eb_eth_data); -/* mAgic */ -at91_add_device_mAgic (); }MACHINE_START (AT572D940HFEB ,"Atmel AT91D940HF-EB" )
arch/arm/mach-at91/include/mach/board.h +0 -6
@@ -186,9 +186,6 @@ extern void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data);/* AC97 */ extern void __init at91_add_device_ac97 (struct ac97c_platform_data *data); -/* ISI */ -extern void __init at91_add_device_isi (void ); -/* Touchscreen Controller */ struct at91_tsadcc_data {unsigned int adc_clock;
@@ -208,9 +205,6 @@ extern void __init at91_init_leds(u8 cpu_led, u8 timer_led);extern void __init at91_gpio_leds (struct gpio_led *leds,int nr);extern void __init at91_pwm_leds (struct gpio_led *leds,int nr); -/* AT572D940HF DSP */ -extern void __init at91_add_device_mAgic (void ); -/* FIXME: this needs a better location, but gets stuff building again */ extern int at91_suspend_entering_slow_clock (void );
Signature · 1 line
1.7.0.4
PATCH v2 23/23 at91: Remove mAgic and ISI device code
Quoted 4 lines · Ryan Mallon
The AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in
arch/arm/mach-at91is unused and can be removed.
Is anyone planning on adding these drivers?
I wonder if it makes sense to add the infrastructure to devices.[ch] and convert the users even it the drivers are not in mainline yet?
Regards,
Hartley
PATCH v2 23/23 at91: Remove mAgic and ISI device code
Quoted 10 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
The AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in
arch/arm/mach-at91is unused and can be removed.Is anyone planning on adding these drivers?
I wonder if it makes sense to add the infrastructure to devices.[ch] and convert the users even it the drivers are not in mainline yet?
I removed them because there is currently a push to reduce the size of the ARM tree. The ISI code has been there since 2008 and the mAgic device code since 2009 without drivers. The ISI device at least is supported on more than one variant, but only had code present for the AT91SAM9263.
I think it is better to remove them now, and then if/when drivers get added the support code can be added to the common framework.
~Ryan
PATCH v2 23/23 at91: Remove mAgic and ISI device code
Quoted 12 lines · Ryan Mallon
Quoted 10 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
The AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in
arch/arm/mach-at91is unused and can be removed.Is anyone planning on adding these drivers?
I wonder if it makes sense to add the infrastructure to devices.[ch] and convert the users even it the drivers are not in mainline yet?
Quoted 8 lines
I removed them because there is currently a push to reduce the size of the ARM tree. The ISI code has been there since 2008 and the mAgic device code since 2009 without drivers. The ISI device at least is supported on more than one variant, but only had code present for the AT91SAM9263.
I think it is better to remove them now, and then if/when drivers get added the support code can be added to the common framework.
NACK I do not want to remove code just to reduce line code for soc
factorize ok
remove soc resources no
for the ISI I plan to add it but I work on something else by now
and some patch have already been send to the v4l ML
Best Regards,
J.
PATCH v2 23/23 at91: Remove mAgic and ISI device code
Quoted 21 lines · Jean-Christophe PLAGNIOL-VILLARD
Quoted 12 lines · Ryan Mallon
Quoted 10 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
The AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in
arch/arm/mach-at91is unused and can be removed.Is anyone planning on adding these drivers?
I wonder if it makes sense to add the infrastructure to devices.[ch] and convert the users even it the drivers are not in mainline yet?
Quoted 8 lines
I removed them because there is currently a push to reduce the size of the ARM tree. The ISI code has been there since 2008 and the mAgic device code since 2009 without drivers. The ISI device at least is supported on more than one variant, but only had code present for the AT91SAM9263.
I think it is better to remove them now, and then if/when drivers get added the support code can be added to the common framework.
Quoted 8 lines
NACK I do not want to remove code just to reduce line code for soc
factorize ok
remove soc resources nofor the ISI I plan to add it but I work on something else by now
and some patch have already been send to the v4l ML
I'm fine with keeping them if there is driver support, but they do need to be moved into the common framework. However I don't think it is worth keeping dead code just be a driver _might_ appear. The mAgic code has been sitting in the the kernel for over two years with no users. Especially with the current push to reduce the size of the ARM tree, it needs to go.
~Ryan
Signature · 7 lines
Bluewater Systems Ltd - ARM Technology Solution Centre Ryan Mallon 5 Amuri Park, 404 Barbadoes St ryan at bluewatersys.com PO Box 13 889, Christchurch 8013 http://www.bluewatersys.com New Zealand Phone: +64 3 3779127 Freecall: Australia 1800 148 751 Fax: +64 3 3779135 USA 1800 261 2934
PATCH v2 23/23 at91: Remove mAgic and ISI device code
In reply to Ryan MallonQuoted 9 lines · Ryan Mallon
Quoted 8 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
The AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in
arch/arm/mach-at91is unused and can be removed.Is anyone planning on adding these drivers?
Quoted 8 lines
Quoted 2 lines
I wonder if it makes sense to add the infrastructure to devices.[ch] and convert the users even it the drivers are not in mainline yet?
I removed them because there is currently a push to reduce the size of the ARM tree. The ISI code has been there since 2008 and the mAgic device code since 2009 without drivers. The ISI device at least is supported on more than one variant, but only had code present for the AT91SAM9263.
If they've not been merged for two to three years, they probably aren't going to ever be merged. Removing them seems to be the right thing to do as they're not doing *anything* useful by remaining there.
They should be kept as part of the patch series adding the drivers.
PATCH v2 23/23 at91: Remove mAgic and ISI device code
Quoted 19 lines · Russell King - ARM Linux
Quoted 9 lines · Ryan Mallon
Quoted 8 lines · H Hartley Sweeten
Quoted 4 lines · Ryan Mallon
The AT572D940HF mAgic device and the AT91SAM9263 ISI device do not have drivers yet and therefore the platform code in
arch/arm/mach-at91is unused and can be removed.Is anyone planning on adding these drivers?
Quoted 8 lines
Quoted 2 lines
I wonder if it makes sense to add the infrastructure to devices.[ch] and convert the users even it the drivers are not in mainline yet?
I removed them because there is currently a push to reduce the size of the ARM tree. The ISI code has been there since 2008 and the mAgic device code since 2009 without drivers. The ISI device at least is supported on more than one variant, but only had code present for the AT91SAM9263.
Quoted 5 lines
If they've not been merged for two to three years, they probably aren't going to ever be merged. Removing them seems to be the right thing to do as they're not doing *anything* useful by remaining there.
They should be kept as part of the patch series adding the drivers.
The driver for isi was send the last year IIRC but no time to rebase it again
I need to clean the architecture first so keep it make sense
Best Regards,
J.
v2 cover at91: Replace duplicate device initialisation code with
In reply to Ryan MallonQuoted 38 lines · Ryan Mallon
Each AT91 variant (AT91RM9200, AT91SAM9260, etc) currently has its own devices file, which includes the MMIO address, interrupt configuration, GPIO setup, etc for each device. This results in a large amount of duplicated code.
This patch set introduces a framework for adding shared devices for the AT91 platform and replaces the multiple device setup implementations for each device with single implementations in the new framework. This has a net reduction of nearly 5000 lines of code.
Each of the
arch/arm/mach-at91/*_devices.cfiles becomes a collection of structures (with some initialisation callbacks where necessary) with a table of devices which are present on the particular AT91 variant. All structures/functions are marked as __init/__initdata so there is little additional memory overhead. This also means that the #ifdefs around each device can be removed from the *_devices.c files (but remain in the new commondevices.cfile) without overhead.This patch series does not introduce any functional changes to how the board files add devices, it only replaces the duplicate device initialisation code with common versions. The patch series attempts to have minimum change by rewriting as little as possible of the actual device initialisation functions.
This is also a step towards allowing more than one AT91 variant to be built into a single kernel by removing duplicate function names across the *_devices.c files.
I have build tested the patch series for all of the AT91 variants and devices, and have boot tested it on the AT91SAM9260 (Snapper 9260 board) and tested basic device functionality.
Changes from v1:
- Moved__initdatato the end of lines
- Fixed at572d940hf EMAC MMIO base
- Fixed some whitespace issues
Quoted 13 lines
Ryan Mallon (23):
at91: Add common devices framework
at91: Make Ethernet device common
at91: Make USB OHCI/EHCI devices common
at91: Make UDC device common
at91: Make MMC device common
at91: Make NAND device common
at91: Make TWI device common
at91: Make SPI device common
at91: Make TCB device common
at91: Make RTT device common
at91: Make watchdog device common
at91: Make UART devices common
Ryan,
This one must be still getting held. Any chance you could send my a copy directly? I believe there was another party also interested in getting it.
Thanks,
Hartley