diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index 7a8402c..603c14d 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -17,6 +17,7 @@ dtb-$(CONFIG_ARCH_AT91) += usb_a9263.dtb # sam9g20 dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek.dtb dtb-$(CONFIG_ARCH_AT91) += at91sam9g20ek_2mmc.dtb +dtb-$(CONFIG_ARCH_AT91) += at91-foxg20.dtb dtb-$(CONFIG_ARCH_AT91) += kizbox.dtb dtb-$(CONFIG_ARCH_AT91) += tny_a9g20.dtb dtb-$(CONFIG_ARCH_AT91) += usb_a9g20.dtb diff --git a/arch/arm/boot/dts/at91sam9260.dtsi b/arch/arm/boot/dts/at91sam9260.dtsi index 39253b9..9afc6c4 100644 --- a/arch/arm/boot/dts/at91sam9260.dtsi +++ b/arch/arm/boot/dts/at91sam9260.dtsi @@ -158,8 +158,8 @@ usart1 { pinctrl_usart1: usart1-0 { atmel,pins = - <2 6 0x1 0x1 /* PB6 periph A with pullup */ - 2 7 0x1 0x0>; /* PB7 periph A */ + <1 6 0x1 0x1 /* PB6 periph A with pullup */ + 1 7 0x1 0x0>; /* PB7 periph A */ }; pinctrl_usart1_rts: usart1_rts-0 { @@ -194,18 +194,18 @@ usart3 { pinctrl_usart3: usart3-0 { atmel,pins = - <2 10 0x1 0x1 /* PB10 periph A with pullup */ - 2 11 0x1 0x0>; /* PB11 periph A */ + <1 10 0x1 0x1 /* PB10 periph A with pullup */ + 1 11 0x1 0x0>; /* PB11 periph A */ }; pinctrl_usart3_rts: usart3_rts-0 { atmel,pins = - <3 8 0x2 0x0>; /* PB8 periph B */ + <2 8 0x2 0x0>; /* PC8 periph B */ }; pinctrl_usart3_cts: usart3_cts-0 { atmel,pins = - <3 10 0x2 0x0>; /* PB10 periph B */ + <2 10 0x2 0x0>; /* PC10 periph B */ }; }; @@ -220,8 +220,8 @@ uart1 { pinctrl_uart1: uart1-0 { atmel,pins = - <2 12 0x1 0x1 /* PB12 periph A with pullup */ - 2 13 0x1 0x0>; /* PB13 periph A */ + <1 12 0x1 0x1 /* PB12 periph A with pullup */ + 1 13 0x1 0x0>; /* PB13 periph A */ }; }; diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 39cfd2e..0172cc3 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -20,6 +20,8 @@ #include #include #include +#include +#include #include #include @@ -71,6 +73,18 @@ struct sam9_rtc { #define gpbr_writel(rtc, val) \ __raw_writel((val), (rtc)->gpbr) +#ifdef CONFIG_OF +static const struct of_device_id at91sam9_rtc_dt_ids[] = { + { .compatible = "atmel,at91sam9260-rtt-rtc" }, + /* string above preferred, the following may be taken in the + * future for a more general purpose rtt driver */ + { .compatible = "atmel,at91sam9260-rtt" }, + { /* sentinel */ } +}; +MODULE_DEVICE_TABLE(of, at91sam9_rtc_dt_ids); +#endif /* CONFIG_OF */ + + /* * Read current time and date in RTC */ @@ -470,6 +484,7 @@ static struct platform_driver at91_rtc_driver = { .driver = { .name = "rtc-at91sam9", .owner = THIS_MODULE, + .of_match_table = of_match_ptr(at91sam9_rtc_dt_ids), }, }; diff --git a/arch/arm/boot/dts/at91-foxg20.dts b/arch/arm/boot/dts/at91-foxg20.dts new file mode 100644 index 0000000..7b96492 --- /dev/null +++ b/arch/arm/boot/dts/at91-foxg20.dts @@ -0,0 +1,221 @@ +/* + * at91-foxg20.dts - Device Tree file for Acme Systems FoxG20 board + * + * Based on DT files for at91sam9g20ek evaluation board (AT91SAM9G20 SoC) + * + * Compile with dtc in folder: + * 'dtc -O dtb -o at91-foxg20.dtb at91-foxg20.dts' [dpg 20130404] + */ + +/dts-v1/; +/include/ "at91sam9g20.dtsi" + +/ { + + model = "Acme Systems FoxG20"; + compatible = "acme,foxg20", "atmel,at91sam9g20", "atmel,at91sam9"; + + chosen { + /* bootargs = "mem=64M console=ttyS0,115200 noinitrd root=/dev/mmcblk0p2 rw rootwait init=/sbin/init"; */ + bootargs = "mem=64M console=ttyS0,115200 noinitrd root=/dev/mmcblk0p2 rw rootwait"; + }; + + memory { + reg = <0x20000000 0x4000000>; + }; + + clocks { + #address-cells = <1>; + #size-cells = <1>; + ranges; + + main_clock: clock@0 { + compatible = "atmel,osc", "fixed-clock"; + clock-frequency = <18432000>; + }; + }; + + ahb { + apb { + pinctrl@fffff400 { + board { + pinctrl_pck0_as_mck: pck0_as_mck { + atmel,pins = + <2 1 0x2 0x0>; /* PC1 periph B */ + }; + + }; + + mmc0_slot1 { + pinctrl_board_mmc0_slot1: mmc0_slot1-board { + atmel,pins = + <2 9 0x0 0x5>; /* PC9 gpio CD pin pull up and deglitch */ + }; + }; + + i2c0 { + pinctrl_i2c0: i2c0-0 { + atmel,pins = + <0 23 0x1 0x2 /* TWD (SDA) PA23 periph A, open drain */ + 0 24 0x1 0x2>; /* TWCK (SCL) PA24 periph A, open drain */ + }; + }; + }; + + dbgu: serial@fffff200 { + status = "okay"; + }; + + usart0: serial@fffb0000 { + pinctrl-0 = + <&pinctrl_usart0 + &pinctrl_usart0_rts + &pinctrl_usart0_cts + /* &pinctrl_usart0_dtr_dsr */ + /* &pinctrl_usart0_dcd */ + /* &pinctrl_usart0_ri */ + >; + status = "okay"; + }; + + usart1: serial@fffb4000 { + status = "okay"; + }; + + usart2: serial@fffb8000 { + status = "okay"; + }; + + usart3: serial@fffd0000 { + status = "okay"; + }; + + uart0: serial@fffd4000 { + status = "okay"; + }; + + uart1: serial@fffd8000 { + status = "okay"; + }; + + macb0: ethernet@fffc4000 { + phy-mode = "rmii"; + status = "okay"; + }; + + usb1: gadget@fffa4000 { + atmel,vbus-gpio = <&pioC 6 0>; + status = "okay"; + }; + + mmc0: mmc@fffa8000 { + pinctrl-0 = < + /* &pinctrl_board_mmc0_slot1 */ + &pinctrl_mmc0_clk + &pinctrl_mmc0_slot1_cmd_dat0 + &pinctrl_mmc0_slot1_dat1_3>; + status = "okay"; + slot@1 { + reg = <1>; + bus-width = <4>; + /* cd-gpios = <&pioC 9 0>; */ + }; + }; + + ssc0: ssc@fffbc000 { + /* status = "okay"; */ + pinctrl-0 = <&pinctrl_ssc0_tx>; + }; + + spi0: spi@fffc8000 { + /* status = "okay"; */ + cs-gpios = <0>, <&pioC 11 0>, <0>, <0>; + mtd_dataflash@0 { + compatible = "atmel,at45", "atmel,dataflash"; + spi-max-frequency = <50000000>; + reg = <1>; + }; + }; + + i2c0: i2c@fffac000 { + /* i2c-at91 driver (silicon based) */ + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c0>; + /* status = "okay"; */ + }; + + adc0: adc@fffe0000 { + /* see bindings/arm/atmel-adc.txt */ + /* status = "okay"; */ + }; + + watchdog@fffffd40 { + status = "okay"; + }; + + rtc { + compatible = "atmel,at91sam9260-rtt-rtc"; + /* RTTC followed by GPBR (backup registers) */ + reg = <0xfffffd20 0x10>, <0xfffffd50 0x10>; + interrupts = <1 4 7>; + status = "okay"; + }; + + }; + + usb0: ohci@00500000 { + num-ports = <2>; + status = "okay"; + }; + }; + + i2c@0 { + /* i2c-gpio driver (bit banging) */ + /* default from at91sam9260.dtsi is PA23 (SDA) + PA24 */ + /* can override like this: */ + // gpios = <&pioA 28 0 /* sda */ + // &pioA 29 0 /* scl */ + // >; + + /* Despite appearances this line: 'i2c-gpio,sda-open-drain;' */ + /* in at91sam9260.dtsi doesn't set the SDA gpio line in */ + /* multi-driver (open drain) mode. That can be done like this: */ + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c0>; + i2c-gpio,delay-us = <5>; /* ~85 kHz */ + + status = "okay"; + + // 24c512@50 { + // compatible = "24c512"; + // reg = <0x50>; + // }; + + }; + + leds { + compatible = "gpio-leds"; + + /* red LED marked "PC7" near mini USB (device) receptacle */ + user_led { + label = "user_led"; + gpios = <&pioC 7 0>; /* PC7 */ + linux,default-trigger = "heartbeat"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + + btn { + label = "Button"; + gpios = <&pioC 4 1>; + linux,code = <0x103>; + gpio-key,wakeup; + }; + + }; + +};