ARM: uniphier: consolidate NAND pin-mux settings

The NAND subsystem has not supported the Driver Model yet, but the
NAND pin-mux data are already in the pinctrl drivers.  Use them by
calling pinctrl_generic_set_state() directly.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
This commit is contained in:
Masahiro Yamada 2016-09-17 03:33:04 +09:00
parent 6a93478b93
commit 5ac9dfbe9d
13 changed files with 51 additions and 274 deletions

View File

@ -23,6 +23,7 @@ obj-y += boards.o
obj-y += soc_info.o
obj-y += boot-mode/
obj-y += dram/
obj-y += pinctrl-glue.o
obj-$(CONFIG_MICRO_SUPPORT_CARD) += micro-support-card.o
obj-$(CONFIG_DEBUG_UART_UNIPHIER) += debug-uart/

View File

@ -47,6 +47,14 @@ static void uniphier_setup_xirq(void)
writel(tmp, 0x55000090);
}
static void uniphier_nand_pin_init(bool cs2)
{
#ifdef CONFIG_NAND_DENALI
if (uniphier_pin_init(cs2 ? "nand2cs_grp" : "nand_grp"))
pr_err("failed to init NAND pins\n");
#endif
}
int board_init(void)
{
led_puts("U0");
@ -54,55 +62,56 @@ int board_init(void)
switch (uniphier_get_soc_type()) {
#if defined(CONFIG_ARCH_UNIPHIER_SLD3)
case SOC_UNIPHIER_SLD3:
uniphier_sld3_pin_init();
uniphier_nand_pin_init(true);
led_puts("U1");
uniphier_ld4_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD4)
case SOC_UNIPHIER_LD4:
uniphier_ld4_pin_init();
uniphier_nand_pin_init(true);
led_puts("U1");
uniphier_ld4_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO4)
case SOC_UNIPHIER_PRO4:
uniphier_pro4_pin_init();
uniphier_nand_pin_init(false);
led_puts("U1");
uniphier_pro4_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_SLD8)
case SOC_UNIPHIER_SLD8:
uniphier_sld8_pin_init();
uniphier_nand_pin_init(true);
led_puts("U1");
uniphier_ld4_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PRO5)
case SOC_UNIPHIER_PRO5:
uniphier_pro5_pin_init();
uniphier_nand_pin_init(true);
led_puts("U1");
uniphier_pro5_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_PXS2)
case SOC_UNIPHIER_PXS2:
uniphier_pxs2_pin_init();
uniphier_nand_pin_init(true);
led_puts("U1");
uniphier_pxs2_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD6B)
case SOC_UNIPHIER_LD6B:
uniphier_ld6b_pin_init();
uniphier_nand_pin_init(true);
led_puts("U1");
uniphier_pxs2_clk_init();
break;
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD11)
case SOC_UNIPHIER_LD11:
uniphier_nand_pin_init(false);
uniphier_ld20_pin_init();
led_puts("U1");
uniphier_ld11_clk_init();
@ -110,6 +119,7 @@ int board_init(void)
#endif
#if defined(CONFIG_ARCH_UNIPHIER_LD20)
case SOC_UNIPHIER_LD20:
uniphier_nand_pin_init(false);
uniphier_ld20_pin_init();
led_puts("U1");
uniphier_ld20_clk_init();

View File

@ -103,13 +103,6 @@ int uniphier_pxs2_umc_init(const struct uniphier_board_data *bd);
int uniphier_ld20_umc_init(const struct uniphier_board_data *bd);
int uniphier_ld11_umc_init(const struct uniphier_board_data *bd);
void uniphier_sld3_pin_init(void);
void uniphier_ld4_pin_init(void);
void uniphier_pro4_pin_init(void);
void uniphier_sld8_pin_init(void);
void uniphier_pro5_pin_init(void);
void uniphier_pxs2_pin_init(void);
void uniphier_ld6b_pin_init(void);
void uniphier_ld20_pin_init(void);
void uniphier_ld4_clk_init(void);
@ -119,6 +112,7 @@ void uniphier_pxs2_clk_init(void);
void uniphier_ld11_clk_init(void);
void uniphier_ld20_clk_init(void);
int uniphier_pin_init(const char *pinconfig_name);
void uniphier_smp_kick_all_cpus(void);
void cci500_init(int nr_slaves);

View File

@ -0,0 +1,32 @@
/*
* Copyright (C) 2016 Socionext Inc.
* Author: Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/err.h>
#include <dm/device.h>
#include <dm/pinctrl.h>
#include <dm/uclass.h>
#include "init.h"
int uniphier_pin_init(const char *pinconfig_name)
{
struct udevice *pctldev, *config, *next;
int ret;
ret = uclass_first_device(UCLASS_PINCTRL, &pctldev);
if (ret)
return ret;
device_foreach_child_safe(config, next, pctldev) {
if (strcmp(config->name, pinconfig_name))
continue;
return pinctrl_generic_set_state(pctldev, config);
}
return -ENODEV;
}

View File

@ -2,12 +2,5 @@
# SPDX-License-Identifier: GPL-2.0+
#
obj-$(CONFIG_ARCH_UNIPHIER_SLD3) += pinctrl-sld3.o
obj-$(CONFIG_ARCH_UNIPHIER_LD4) += pinctrl-ld4.o
obj-$(CONFIG_ARCH_UNIPHIER_PRO4) += pinctrl-pro4.o
obj-$(CONFIG_ARCH_UNIPHIER_SLD8) += pinctrl-sld8.o
obj-$(CONFIG_ARCH_UNIPHIER_PRO5) += pinctrl-pro5.o
obj-$(CONFIG_ARCH_UNIPHIER_PXS2) += pinctrl-pxs2.o
obj-$(CONFIG_ARCH_UNIPHIER_LD6B) += pinctrl-ld6b.o
obj-$(CONFIG_ARCH_UNIPHIER_LD11) += pinctrl-ld20.o
obj-$(CONFIG_ARCH_UNIPHIER_LD20) += pinctrl-ld20.o

View File

@ -13,25 +13,6 @@ void uniphier_ld20_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(3, 0, 8, 4); /* XNFWP -> XNFWP */
sg_set_pinsel(4, 0, 8, 4); /* XNFCE0 -> XNFCE0 */
sg_set_pinsel(5, 0, 8, 4); /* NFRYBY0 -> NFRYBY0 */
sg_set_pinsel(6, 0, 8, 4); /* XNFRE -> XNFRE */
sg_set_pinsel(7, 0, 8, 4); /* XNFWE -> XNFWE */
sg_set_pinsel(8, 0, 8, 4); /* NFALE -> NFALE */
sg_set_pinsel(9, 0, 8, 4); /* NFCLE -> NFCLE */
sg_set_pinsel(10, 0, 8, 4); /* NFD0 -> NFD0 */
sg_set_pinsel(11, 0, 8, 4); /* NFD1 -> NFD1 */
sg_set_pinsel(12, 0, 8, 4); /* NFD2 -> NFD2 */
sg_set_pinsel(13, 0, 8, 4); /* NFD3 -> NFD3 */
sg_set_pinsel(14, 0, 8, 4); /* NFD4 -> NFD4 */
sg_set_pinsel(15, 0, 8, 4); /* NFD5 -> NFD5 */
sg_set_pinsel(16, 0, 8, 4); /* NFD6 -> NFD6 */
sg_set_pinsel(17, 0, 8, 4); /* NFD7 -> NFD7 */
sg_set_iectrl_range(3, 17);
#endif
sg_set_pinsel(149, 14, 8, 4); /* XIRQ0 -> XIRQ0 */
sg_set_iectrl(149);
sg_set_pinsel(153, 14, 8, 4); /* XIRQ4 -> XIRQ4 */

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/io.h>
#include "../init.h"
#include "../sg-regs.h"
void uniphier_ld4_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(158, 0, 8, 4); /* XNFRE -> XNFRE_GB */
sg_set_pinsel(159, 0, 8, 4); /* XNFWE -> XNFWE_GB */
sg_set_pinsel(160, 0, 8, 4); /* XFALE -> NFALE_GB */
sg_set_pinsel(161, 0, 8, 4); /* XFCLE -> NFCLE_GB */
sg_set_pinsel(162, 0, 8, 4); /* XNFWP -> XFNWP_GB */
sg_set_pinsel(163, 0, 8, 4); /* XNFCE0 -> XNFCE0_GB */
sg_set_pinsel(164, 0, 8, 4); /* NANDRYBY0 -> NANDRYBY0_GB */
sg_set_pinsel(22, 0, 8, 4); /* MMCCLK -> XFNCE1_GB */
sg_set_pinsel(23, 0, 8, 4); /* MMCCMD -> NANDRYBY1_GB */
sg_set_pinsel(24, 0, 8, 4); /* MMCDAT0 -> NFD0_GB */
sg_set_pinsel(25, 0, 8, 4); /* MMCDAT1 -> NFD1_GB */
sg_set_pinsel(26, 0, 8, 4); /* MMCDAT2 -> NFD2_GB */
sg_set_pinsel(27, 0, 8, 4); /* MMCDAT3 -> NFD3_GB */
sg_set_pinsel(28, 0, 8, 4); /* MMCDAT4 -> NFD4_GB */
sg_set_pinsel(29, 0, 8, 4); /* MMCDAT5 -> NFD5_GB */
sg_set_pinsel(30, 0, 8, 4); /* MMCDAT6 -> NFD6_GB */
sg_set_pinsel(31, 0, 8, 4); /* MMCDAT7 -> NFD7_GB */
#endif
}

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/io.h>
#include "../init.h"
#include "../sg-regs.h"
void uniphier_ld6b_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(30, 0, 8, 4); /* XNFRE -> XNFRE */
sg_set_pinsel(31, 0, 8, 4); /* XNFWE -> XNFWE */
sg_set_pinsel(32, 0, 8, 4); /* NFALE -> NFALE */
sg_set_pinsel(33, 0, 8, 4); /* NFCLE -> NFCLE */
sg_set_pinsel(34, 0, 8, 4); /* XNFWP -> XNFWP */
sg_set_pinsel(35, 0, 8, 4); /* XNFCE0 -> XNFCE0 */
sg_set_pinsel(36, 0, 8, 4); /* NRYBY0 -> NRYBY0 */
sg_set_pinsel(37, 0, 8, 4); /* XNFCE1 -> NRYBY1 */
sg_set_pinsel(38, 0, 8, 4); /* NRYBY1 -> XNFCE1 */
sg_set_pinsel(39, 0, 8, 4); /* NFD0 -> NFD0 */
sg_set_pinsel(40, 0, 8, 4); /* NFD1 -> NFD1 */
sg_set_pinsel(41, 0, 8, 4); /* NFD2 -> NFD2 */
sg_set_pinsel(42, 0, 8, 4); /* NFD3 -> NFD3 */
sg_set_pinsel(43, 0, 8, 4); /* NFD4 -> NFD4 */
sg_set_pinsel(44, 0, 8, 4); /* NFD5 -> NFD5 */
sg_set_pinsel(45, 0, 8, 4); /* NFD6 -> NFD6 */
sg_set_pinsel(46, 0, 8, 4); /* NFD7 -> NFD7 */
#endif
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/io.h>
#include "../init.h"
#include "../sg-regs.h"
void uniphier_pro4_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(40, 0, 4, 8); /* NFD0 -> NFD0 */
sg_set_pinsel(41, 0, 4, 8); /* NFD1 -> NFD1 */
sg_set_pinsel(42, 0, 4, 8); /* NFD2 -> NFD2 */
sg_set_pinsel(43, 0, 4, 8); /* NFD3 -> NFD3 */
sg_set_pinsel(44, 0, 4, 8); /* NFD4 -> NFD4 */
sg_set_pinsel(45, 0, 4, 8); /* NFD5 -> NFD5 */
sg_set_pinsel(46, 0, 4, 8); /* NFD6 -> NFD6 */
sg_set_pinsel(47, 0, 4, 8); /* NFD7 -> NFD7 */
sg_set_pinsel(48, 0, 4, 8); /* NFALE -> NFALE */
sg_set_pinsel(49, 0, 4, 8); /* NFCLE -> NFCLE */
sg_set_pinsel(50, 0, 4, 8); /* XNFRE -> XNFRE */
sg_set_pinsel(51, 0, 4, 8); /* XNFWE -> XNFWE */
sg_set_pinsel(52, 0, 4, 8); /* XNFWP -> XNFWP */
sg_set_pinsel(53, 0, 4, 8); /* XNFCE0 -> XNFCE0 */
sg_set_pinsel(54, 0, 4, 8); /* NRYBY0 -> NRYBY0 */
/* sg_set_pinsel(131, 1, 4, 8); */ /* RXD2 -> NRYBY1 */
/* sg_set_pinsel(132, 1, 4, 8); */ /* TXD2 -> XNFCE1 */
#endif
writel(1, SG_LOADPINCTRL);
}

View File

@ -1,37 +0,0 @@
/*
* Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/io.h>
#include "../init.h"
#include "../sg-regs.h"
void uniphier_pro5_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(19, 0, 4, 8); /* XNFRE -> XNFRE */
sg_set_pinsel(20, 0, 4, 8); /* XNFWE -> XNFWE */
sg_set_pinsel(21, 0, 4, 8); /* NFALE -> NFALE */
sg_set_pinsel(22, 0, 4, 8); /* NFCLE -> NFCLE */
sg_set_pinsel(23, 0, 4, 8); /* XNFWP -> XNFWP */
sg_set_pinsel(24, 0, 4, 8); /* XNFCE0 -> XNFCE0 */
sg_set_pinsel(25, 0, 4, 8); /* NRYBY0 -> NRYBY0 */
sg_set_pinsel(26, 0, 4, 8); /* XNFCE1 -> XNFCE1 */
sg_set_pinsel(27, 0, 4, 8); /* NRYBY1 -> NRYBY1 */
sg_set_pinsel(28, 0, 4, 8); /* NFD0 -> NFD0 */
sg_set_pinsel(29, 0, 4, 8); /* NFD1 -> NFD1 */
sg_set_pinsel(30, 0, 4, 8); /* NFD2 -> NFD2 */
sg_set_pinsel(31, 0, 4, 8); /* NFD3 -> NFD3 */
sg_set_pinsel(32, 0, 4, 8); /* NFD4 -> NFD4 */
sg_set_pinsel(33, 0, 4, 8); /* NFD5 -> NFD5 */
sg_set_pinsel(34, 0, 4, 8); /* NFD6 -> NFD6 */
sg_set_pinsel(35, 0, 4, 8); /* NFD7 -> NFD7 */
#endif
writel(1, SG_LOADPINCTRL);
}

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/io.h>
#include "../init.h"
#include "../sg-regs.h"
void uniphier_pxs2_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(30, 8, 8, 4); /* XNFRE -> XNFRE */
sg_set_pinsel(31, 8, 8, 4); /* XNFWE -> XNFWE */
sg_set_pinsel(32, 8, 8, 4); /* NFALE -> NFALE */
sg_set_pinsel(33, 8, 8, 4); /* NFCLE -> NFCLE */
sg_set_pinsel(34, 8, 8, 4); /* XNFWP -> XNFWP */
sg_set_pinsel(35, 8, 8, 4); /* XNFCE0 -> XNFCE0 */
sg_set_pinsel(36, 8, 8, 4); /* NRYBY0 -> NRYBY0 */
sg_set_pinsel(37, 8, 8, 4); /* XNFCE1 -> NRYBY1 */
sg_set_pinsel(38, 8, 8, 4); /* NRYBY1 -> XNFCE1 */
sg_set_pinsel(39, 8, 8, 4); /* NFD0 -> NFD0 */
sg_set_pinsel(40, 8, 8, 4); /* NFD1 -> NFD1 */
sg_set_pinsel(41, 8, 8, 4); /* NFD2 -> NFD2 */
sg_set_pinsel(42, 8, 8, 4); /* NFD3 -> NFD3 */
sg_set_pinsel(43, 8, 8, 4); /* NFD4 -> NFD4 */
sg_set_pinsel(44, 8, 8, 4); /* NFD5 -> NFD5 */
sg_set_pinsel(45, 8, 8, 4); /* NFD6 -> NFD6 */
sg_set_pinsel(46, 8, 8, 4); /* NFD7 -> NFD7 */
#endif
}

View File

@ -1,20 +0,0 @@
/*
* Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include "../init.h"
#include "../sg-regs.h"
void uniphier_sld3_pin_init(void)
{
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(38, 1, 4, 4); /* NFALE_GB, NFCLE_GB */
sg_set_pinsel(39, 1, 4, 4); /* XNFRYBY0_GB */
sg_set_pinsel(40, 1, 4, 4); /* XNFCE0_GB, XNFRE_GB, XNFWE_GB, XNFWP_GB */
sg_set_pinsel(41, 1, 4, 4); /* XNFRYBY1_GB, XNFCE1_GB */
sg_set_pinsel(58, 1, 4, 4); /* NFD[0-3]_GB */
sg_set_pinsel(59, 1, 4, 4); /* NFD[4-7]_GB */
#endif
}

View File

@ -1,35 +0,0 @@
/*
* Copyright (C) 2011-2015 Masahiro Yamada <yamada.masahiro@socionext.com>
*
* SPDX-License-Identifier: GPL-2.0+
*/
#include <linux/io.h>
#include "../init.h"
#include "../sg-regs.h"
void uniphier_sld8_pin_init(void)
{
/* Comment format: PAD Name -> Function Name */
#ifdef CONFIG_NAND_DENALI
sg_set_pinsel(15, 0, 8, 4); /* XNFRE_GB -> XNFRE_GB */
sg_set_pinsel(16, 0, 8, 4); /* XNFWE_GB -> XNFWE_GB */
sg_set_pinsel(17, 0, 8, 4); /* XFALE_GB -> NFALE_GB */
sg_set_pinsel(18, 0, 8, 4); /* XFCLE_GB -> NFCLE_GB */
sg_set_pinsel(19, 0, 8, 4); /* XNFWP_GB -> XFNWP_GB */
sg_set_pinsel(20, 0, 8, 4); /* XNFCE0_GB -> XNFCE0_GB */
sg_set_pinsel(21, 0, 8, 4); /* NANDRYBY0_GB -> NANDRYBY0_GB */
sg_set_pinsel(22, 0, 8, 4); /* XFNCE1_GB -> XFNCE1_GB */
sg_set_pinsel(23, 0, 8, 4); /* NANDRYBY1_GB -> NANDRYBY1_GB */
sg_set_pinsel(24, 0, 8, 4); /* NFD0_GB -> NFD0_GB */
sg_set_pinsel(25, 0, 8, 4); /* NFD1_GB -> NFD1_GB */
sg_set_pinsel(26, 0, 8, 4); /* NFD2_GB -> NFD2_GB */
sg_set_pinsel(27, 0, 8, 4); /* NFD3_GB -> NFD3_GB */
sg_set_pinsel(28, 0, 8, 4); /* NFD4_GB -> NFD4_GB */
sg_set_pinsel(29, 0, 8, 4); /* NFD5_GB -> NFD5_GB */
sg_set_pinsel(30, 0, 8, 4); /* NFD6_GB -> NFD6_GB */
sg_set_pinsel(31, 0, 8, 4); /* NFD7_GB -> NFD7_GB */
#endif
}