From: John Crispin <blogic@openwrt.org>
To: Sergey Ryazanov <ryazanov.s.a@gmail.com>,
Ralf Baechle <ralf@linux-mips.org>
Cc: Linux MIPS <linux-mips@linux-mips.org>
Subject: Re: [PATCH v2 09/13] MIPS: ath25: register various chip devices
Date: Wed, 22 Oct 2014 10:39:55 +0200 [thread overview]
Message-ID: <54476D5B.3070503@openwrt.org> (raw)
In-Reply-To: <1413932631-12866-10-git-send-email-ryazanov.s.a@gmail.com>
On 22/10/2014 01:03, Sergey Ryazanov wrote:
> Register GPIO, watchdog and flash devices.
>
> Signed-off-by: Sergey Ryazanov <ryazanov.s.a@gmail.com> ---
>
> Changes since v1: - rename MIPS machine ar231x -> ath25
>
> arch/mips/ath25/Kconfig | 2 +
> arch/mips/ath25/ar2315.c | 86
> +++++++++++++++++++++++++- arch/mips/ath25/ar5312.c
> | 53 +++++++++++++++-
> arch/mips/include/asm/mach-ath25/ar2315_regs.h | 5 ++
> arch/mips/include/asm/mach-ath25/ar5312_regs.h | 2 + 5 files
> changed, 144 insertions(+), 4 deletions(-)
>
> diff --git a/arch/mips/ath25/Kconfig b/arch/mips/ath25/Kconfig
> index ca3dde4..7bcdbf3 100644 --- a/arch/mips/ath25/Kconfig +++
> b/arch/mips/ath25/Kconfig @@ -1,9 +1,11 @@ config SOC_AR5312 bool
> "Atheros AR5312/AR2312+ SoC support" depends on ATH25 + select
> GPIO_AR5312 default y
>
> config SOC_AR2315 bool "Atheros AR2315+ SoC support" depends on
> ATH25 + select GPIO_AR2315 default y
please do not select these 2 until the driver
> diff --git a/arch/mips/ath25/ar2315.c b/arch/mips/ath25/ar2315.c
> index f239035..ac784d7 100644 --- a/arch/mips/ath25/ar2315.c +++
> b/arch/mips/ath25/ar2315.c @@ -16,7 +16,10 @@
>
> #include <linux/init.h> #include <linux/kernel.h> +#include
> <linux/platform_device.h> #include <linux/reboot.h> +#include
> <linux/delay.h> +#include <linux/gpio.h> #include <asm/bootinfo.h>
> #include <asm/reboot.h> #include <asm/time.h> @@ -136,6 +139,66 @@
> void __init ar2315_arch_init_irq(void)
> irq_set_chained_handler(AR2315_IRQ_MISC, ar2315_misc_irq_handler);
> }
>
> +static struct resource ar2315_spiflash_res[] = { + { + .name =
> "spiflash_read", + .flags = IORESOURCE_MEM, + .start =
> AR2315_SPI_READ, + .end = AR2315_SPI_READ + 0x1000000 - 1, + }, +
> { + .name = "spiflash_mmr", + .flags = IORESOURCE_MEM, + .start
> = AR2315_SPI_MMR, + .end = AR2315_SPI_MMR + 12 - 1, + }, +}; +
> +static struct platform_device ar2315_spiflash = { + .id = -1, +
> .name = "ar2315-spiflash", + .resource = ar2315_spiflash_res, +
> .num_resources = ARRAY_SIZE(ar2315_spiflash_res) +}; + +static
> struct resource ar2315_wdt_res[] = { + { + .flags =
> IORESOURCE_MEM, + .start = AR2315_WD, + .end = AR2315_WD + 8 -
> 1, + }, + { + .flags = IORESOURCE_IRQ, + } +}; + +static struct
> platform_device ar2315_wdt = { + .id = -1, + .name = "ar2315-wdt",
> + .resource = ar2315_wdt_res, + .num_resources =
> ARRAY_SIZE(ar2315_wdt_res) +}; + +static struct resource
> ar2315_gpio_res[] = { + { + .name = "ar2315-gpio", + .flags =
> IORESOURCE_MEM, + .start = AR2315_GPIO, + .end = AR2315_GPIO +
> 0x10 - 1, + }, + { + .name = "ar2315-gpio", + .flags =
> IORESOURCE_IRQ, + }, +}; + +static struct platform_device
> ar2315_gpio = { + .id = -1, + .name = "ar2315-gpio", + .resource =
> ar2315_gpio_res, + .num_resources = ARRAY_SIZE(ar2315_gpio_res)
> +}; +
i think none of these needs to be part of the series. add them with
their corresponding drivers please
> /* * NB: We use mapping size that is larger than the actual flash
> size, * but this shouldn't be a problem here, because the flash
> will simply @@ -146,8 +209,20 @@ ar2315_flash_limit = (u8
> *)KSEG1ADDR(AR2315_SPI_READ + 0x1000000);
>
> void __init ar2315_init_devices(void) { + struct resource *res; +
> /* Find board configuration */
> ath25_find_config(ar2315_flash_limit); + + res =
> &ar2315_gpio_res[1]; + res->start = ar2315_misc_irq_base +
> AR2315_MISC_IRQ_GPIO; + res->end = res->start; +
> platform_device_register(&ar2315_gpio); + res =
> &ar2315_wdt_res[1]; + res->start = ar2315_misc_irq_base +
> AR2315_MISC_IRQ_WATCHDOG; + res->end = res->start; +
> platform_device_register(&ar2315_wdt); +
> platform_device_register(&ar2315_spiflash); }
>
> static void ar2315_restart(char *command) @@ -159,8 +234,15 @@
> static void ar2315_restart(char *command) /* try reset the system
> via reset control */ ath25_write_reg(AR2315_COLD_RESET,
> AR2317_RESET_SYSTEM);
>
> - /* Attempt to jump to the mips reset location - the boot loader -
> * itself might be able to recover the system */ + /* Cold reset
> does not work on the AR2315/6, use the GPIO reset bits + * a
> workaround. Give it some time to attempt a gpio based hardware + *
> reset (atheros reference design workaround) */ +
> gpio_request_one(AR2315_RESET_GPIO, GPIOF_OUT_INIT_LOW, "Reset");
same here ...
> + mdelay(100); + + /* Some boards (e.g. Senao EOC-2610) don't
> implement the reset logic + * workaround. Attempt to jump to the
> mips reset location - + * the boot loader itself might be able to
> recover the system */ mips_reset_vec(); }
>
> diff --git a/arch/mips/ath25/ar5312.c b/arch/mips/ath25/ar5312.c
> index faa0633..99c2745 100644 --- a/arch/mips/ath25/ar5312.c +++
> b/arch/mips/ath25/ar5312.c @@ -16,6 +16,8 @@
>
> #include <linux/init.h> #include <linux/kernel.h> +#include
> <linux/platform_device.h> +#include <linux/mtd/physmap.h> #include
> <linux/reboot.h> #include <asm/bootinfo.h> #include <asm/reboot.h>
> @@ -131,15 +133,59 @@ void __init ar5312_arch_init_irq(void)
> irq_set_chained_handler(AR5312_IRQ_MISC, ar5312_misc_irq_handler);
> }
>
> +static struct physmap_flash_data ar5312_flash_data = { + .width =
> 2, +}; + +static struct resource ar5312_flash_resource = { + .start
> = AR5312_FLASH, + .end = AR5312_FLASH + 0x800000 - 1, + .flags =
> IORESOURCE_MEM, +}; + +static struct platform_device
> ar5312_physmap_flash = { + .name = "physmap-flash", + .id = 0, +
> .dev.platform_data = &ar5312_flash_data, + .resource =
> &ar5312_flash_resource, + .num_resources = 1, +}; + +static struct
> resource ar5312_gpio_res[] = { + { + .name = "ar5312-gpio", +
> .flags = IORESOURCE_MEM, + .start = AR5312_GPIO, + .end =
> AR5312_GPIO + 0x0c - 1, + }, +}; + +static struct platform_device
> ar5312_gpio = { + .name = "ar5312-gpio", + .id = -1, + .resource =
> ar5312_gpio_res, + .num_resources = ARRAY_SIZE(ar5312_gpio_res),
> +}; +
and here .. etc etc
> static void __init ar5312_flash_init(void) { - u32 ctl; + u32 ctl =
> ath25_read_reg(AR5312_FLASHCTL0) & AR5312_FLASHCTL_MW; + + /* fixup
> flash width */ + switch (ctl) { + case AR5312_FLASHCTL_MW16: +
> ar5312_flash_data.width = 2; + break; + case AR5312_FLASHCTL_MW8:
> + default: + ar5312_flash_data.width = 1; + break; + }
>
> /* * Configure flash bank 0. * Assume 8M window size. Flash will be
> aliased if it's smaller */ - ctl = ath25_read_reg(AR5312_FLASHCTL0)
> & AR5312_FLASHCTL_MW; ctl |= AR5312_FLASHCTL_E |
> AR5312_FLASHCTL_AC_8M | AR5312_FLASHCTL_RBLE; ctl |= 0x01 <<
> AR5312_FLASHCTL_IDCY_S; ctl |= 0x07 << AR5312_FLASHCTL_WST1_S; @@
> -182,6 +228,9 @@ void __init ar5312_init_devices(void) /*
> Everything else is probably AR5312 or compatible */ else ath25_soc
> = ATH25_SOC_AR5312; + +
> platform_device_register(&ar5312_physmap_flash); +
> platform_device_register(&ar5312_gpio); }
>
> static void ar5312_restart(char *command) diff --git
> a/arch/mips/include/asm/mach-ath25/ar2315_regs.h
> b/arch/mips/include/asm/mach-ath25/ar2315_regs.h index
> e680abc..d61c8a1 100644 ---
> a/arch/mips/include/asm/mach-ath25/ar2315_regs.h +++
> b/arch/mips/include/asm/mach-ath25/ar2315_regs.h @@ -283,6 +283,11
> @@ #define AR2315_AMBACLK_CLK_DIV_M 0x0000000c #define
> AR2315_AMBACLK_CLK_DIV_S 2
>
> +/* GPIO MMR base address */ +#define AR2315_GPIO (AR2315_DSLBASE
> + 0x0088) + +#define AR2315_RESET_GPIO 5 + /* * PCI Clock Control
> */ diff --git a/arch/mips/include/asm/mach-ath25/ar5312_regs.h
> b/arch/mips/include/asm/mach-ath25/ar5312_regs.h index
> afcd0b2..d715385 100644 ---
> a/arch/mips/include/asm/mach-ath25/ar5312_regs.h +++
> b/arch/mips/include/asm/mach-ath25/ar5312_regs.h @@ -210,4 +210,6
> @@ #define AR5312_MEM_CFG1_AC1_M 0x00007000 /* bank 1: SDRAM addr
> check */ #define AR5312_MEM_CFG1_AC1_S 12
>
> +#define AR5312_GPIO (AR5312_APBBASE + 0x2000) + #endif /*
> __ASM_MACH_ATH25_AR5312_REGS_H */
>
next prev parent reply other threads:[~2014-10-22 8:40 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-21 23:03 [PATCH v2 00/13] MIPS: support for the Atheros AR231X SoCs Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 01/13] MIPS: ath25: add common parts Sergey Ryazanov
2014-10-21 23:36 ` John Crispin
2014-10-22 12:40 ` Sergey Ryazanov
2014-10-22 8:31 ` John Crispin
2014-10-22 13:06 ` Sergey Ryazanov
2014-10-22 13:09 ` John Crispin
2014-10-21 23:03 ` [PATCH v2 02/13] MIPS: ath25: add basic AR5312 SoC support Sergey Ryazanov
2014-10-21 23:48 ` John Crispin
2014-10-22 0:03 ` John Crispin
2014-10-22 14:11 ` Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 03/13] MIPS: ath25: add basic AR2315 " Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 04/13] MIPS: ath25: add interrupts handling routines Sergey Ryazanov
2014-10-22 8:26 ` John Crispin
2014-10-22 14:51 ` Sergey Ryazanov
2014-10-22 8:49 ` John Crispin
2014-10-21 23:03 ` [PATCH v2 05/13] MIPS: ath25: add early printk support Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 06/13] MIPS: ath25: add UART support Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 07/13] MIPS: ath25: add board configuration detection Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 08/13] MIPS: ath25: add SoC type detection Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 09/13] MIPS: ath25: register various chip devices Sergey Ryazanov
2014-10-22 8:39 ` John Crispin [this message]
2014-10-22 15:22 ` Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 10/13] MIPS: ath25: add AR2315 PCI host controller driver Sergey Ryazanov
2014-10-22 8:47 ` John Crispin
2014-10-22 15:25 ` Sergey Ryazanov
2014-10-21 23:03 ` [PATCH v2 11/13] ath5k: revert AHB bus support removing Sergey Ryazanov
2014-10-22 12:18 ` Bob Copeland
2014-10-22 12:37 ` Sergey Ryazanov
2014-10-27 18:04 ` John W. Linville
2014-10-28 7:08 ` Sergey Ryazanov
2014-10-28 13:48 ` John W. Linville
2014-10-21 23:03 ` [PATCH v2 12/13] ath5k: update dependencies Sergey Ryazanov
2014-10-27 18:05 ` John W. Linville
2014-10-21 23:03 ` [PATCH v2 13/13] MIPS: ath25: add Wireless device support Sergey Ryazanov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54476D5B.3070503@openwrt.org \
--to=blogic@openwrt.org \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.org \
--cc=ryazanov.s.a@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox