diff options
author | Yonghui Zhang <yonghui.zhang@csr.com> | 2015-11-30 01:05:54 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-12-10 10:21:14 -0500 |
commit | 6d985333a1e05ba6b8cdd6f6f4e08992a06e9bc0 (patch) | |
tree | b79d6ae12dbcf46bf9129bc99b1dc58fd777d193 /drivers/pinctrl/sirf | |
parent | 80d71b616d7294ad65c4b4cf43dd734bc82b4fcf (diff) |
pinctrl: altas7: add sd9 function mux support
The sd9 pin mux with sd3 and it is selected by SYS2PCI_SDIO9SEL.
This makes the codes ugly since the register is not in pinctrl
module.
Signed-off-by: Yonghui Zhang <yonghui.zhang@csr.com>
Signed-off-by: Barry Song <Baohua.Song@csr.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/pinctrl/sirf')
-rw-r--r-- | drivers/pinctrl/sirf/pinctrl-atlas7.c | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/drivers/pinctrl/sirf/pinctrl-atlas7.c b/drivers/pinctrl/sirf/pinctrl-atlas7.c index 30db524bea39..47c63c5ba4e0 100644 --- a/drivers/pinctrl/sirf/pinctrl-atlas7.c +++ b/drivers/pinctrl/sirf/pinctrl-atlas7.c | |||
@@ -161,6 +161,9 @@ enum altas7_pad_type { | |||
161 | #define IN_DISABLE_VAL_1_REG_SET 0x0A88 | 161 | #define IN_DISABLE_VAL_1_REG_SET 0x0A88 |
162 | #define IN_DISABLE_VAL_1_REG_CLR 0x0A8C | 162 | #define IN_DISABLE_VAL_1_REG_CLR 0x0A8C |
163 | 163 | ||
164 | /* Offset of the SDIO9SEL*/ | ||
165 | #define SYS2PCI_SDIO9SEL 0x14 | ||
166 | |||
164 | struct dt_params { | 167 | struct dt_params { |
165 | const char *property; | 168 | const char *property; |
166 | int value; | 169 | int value; |
@@ -370,6 +373,7 @@ struct atlas7_pmx { | |||
370 | struct pinctrl_desc pctl_desc; | 373 | struct pinctrl_desc pctl_desc; |
371 | struct atlas7_pinctrl_data *pctl_data; | 374 | struct atlas7_pinctrl_data *pctl_data; |
372 | void __iomem *regs[ATLAS7_PINCTRL_REG_BANKS]; | 375 | void __iomem *regs[ATLAS7_PINCTRL_REG_BANKS]; |
376 | void __iomem *sys2pci_base; | ||
373 | u32 status_ds[NUM_OF_IN_DISABLE_REG]; | 377 | u32 status_ds[NUM_OF_IN_DISABLE_REG]; |
374 | u32 status_dsv[NUM_OF_IN_DISABLE_REG]; | 378 | u32 status_dsv[NUM_OF_IN_DISABLE_REG]; |
375 | struct atlas7_pad_status sleep_data[ATLAS7_PINCTRL_TOTAL_PINS]; | 379 | struct atlas7_pad_status sleep_data[ATLAS7_PINCTRL_TOTAL_PINS]; |
@@ -946,7 +950,7 @@ static const unsigned int sd2_cdb_pins0[] = { 124, }; | |||
946 | static const unsigned int sd2_cdb_pins1[] = { 161, }; | 950 | static const unsigned int sd2_cdb_pins1[] = { 161, }; |
947 | static const unsigned int sd2_wpb_pins0[] = { 123, }; | 951 | static const unsigned int sd2_wpb_pins0[] = { 123, }; |
948 | static const unsigned int sd2_wpb_pins1[] = { 163, }; | 952 | static const unsigned int sd2_wpb_pins1[] = { 163, }; |
949 | static const unsigned int sd3_pins[] = { 85, 86, 87, 88, 89, 90, }; | 953 | static const unsigned int sd3_9_pins[] = { 85, 86, 87, 88, 89, 90, }; |
950 | static const unsigned int sd5_pins[] = { 91, 92, 93, 94, 95, 96, }; | 954 | static const unsigned int sd5_pins[] = { 91, 92, 93, 94, 95, 96, }; |
951 | static const unsigned int sd6_pins0[] = { 79, 78, 74, 75, 76, 77, }; | 955 | static const unsigned int sd6_pins0[] = { 79, 78, 74, 75, 76, 77, }; |
952 | static const unsigned int sd6_pins1[] = { 101, 99, 100, 110, 109, 111, }; | 956 | static const unsigned int sd6_pins1[] = { 101, 99, 100, 110, 109, 111, }; |
@@ -1199,7 +1203,7 @@ struct atlas7_pin_group altas7_pin_groups[] = { | |||
1199 | GROUP("sd2_cdb_grp1", sd2_cdb_pins1), | 1203 | GROUP("sd2_cdb_grp1", sd2_cdb_pins1), |
1200 | GROUP("sd2_wpb_grp0", sd2_wpb_pins0), | 1204 | GROUP("sd2_wpb_grp0", sd2_wpb_pins0), |
1201 | GROUP("sd2_wpb_grp1", sd2_wpb_pins1), | 1205 | GROUP("sd2_wpb_grp1", sd2_wpb_pins1), |
1202 | GROUP("sd3_grp", sd3_pins), | 1206 | GROUP("sd3_9_grp", sd3_9_pins), |
1203 | GROUP("sd5_grp", sd5_pins), | 1207 | GROUP("sd5_grp", sd5_pins), |
1204 | GROUP("sd6_grp0", sd6_pins0), | 1208 | GROUP("sd6_grp0", sd6_pins0), |
1205 | GROUP("sd6_grp1", sd6_pins1), | 1209 | GROUP("sd6_grp1", sd6_pins1), |
@@ -1482,7 +1486,7 @@ static const char * const sd2_cdb_grp0[] = { "sd2_cdb_grp0", }; | |||
1482 | static const char * const sd2_cdb_grp1[] = { "sd2_cdb_grp1", }; | 1486 | static const char * const sd2_cdb_grp1[] = { "sd2_cdb_grp1", }; |
1483 | static const char * const sd2_wpb_grp0[] = { "sd2_wpb_grp0", }; | 1487 | static const char * const sd2_wpb_grp0[] = { "sd2_wpb_grp0", }; |
1484 | static const char * const sd2_wpb_grp1[] = { "sd2_wpb_grp1", }; | 1488 | static const char * const sd2_wpb_grp1[] = { "sd2_wpb_grp1", }; |
1485 | static const char * const sd3_grp[] = { "sd3_grp", }; | 1489 | static const char * const sd3_9_grp[] = { "sd3_9_grp", }; |
1486 | static const char * const sd5_grp[] = { "sd5_grp", }; | 1490 | static const char * const sd5_grp[] = { "sd5_grp", }; |
1487 | static const char * const sd6_grp0[] = { "sd6_grp0", }; | 1491 | static const char * const sd6_grp0[] = { "sd6_grp0", }; |
1488 | static const char * const sd6_grp1[] = { "sd6_grp1", }; | 1492 | static const char * const sd6_grp1[] = { "sd6_grp1", }; |
@@ -3771,7 +3775,7 @@ static struct atlas7_grp_mux sd2_wpb_grp1_mux = { | |||
3771 | .pad_mux_list = sd2_wpb_grp1_pad_mux, | 3775 | .pad_mux_list = sd2_wpb_grp1_pad_mux, |
3772 | }; | 3776 | }; |
3773 | 3777 | ||
3774 | static struct atlas7_pad_mux sd3_grp_pad_mux[] = { | 3778 | static struct atlas7_pad_mux sd3_9_grp_pad_mux[] = { |
3775 | MUX(1, 85, 1, N, N, N, N), | 3779 | MUX(1, 85, 1, N, N, N, N), |
3776 | MUX(1, 86, 1, N, N, N, N), | 3780 | MUX(1, 86, 1, N, N, N, N), |
3777 | MUX(1, 87, 1, N, N, N, N), | 3781 | MUX(1, 87, 1, N, N, N, N), |
@@ -3780,9 +3784,9 @@ static struct atlas7_pad_mux sd3_grp_pad_mux[] = { | |||
3780 | MUX(1, 90, 1, N, N, N, N), | 3784 | MUX(1, 90, 1, N, N, N, N), |
3781 | }; | 3785 | }; |
3782 | 3786 | ||
3783 | static struct atlas7_grp_mux sd3_grp_mux = { | 3787 | static struct atlas7_grp_mux sd3_9_grp_mux = { |
3784 | .pad_mux_count = ARRAY_SIZE(sd3_grp_pad_mux), | 3788 | .pad_mux_count = ARRAY_SIZE(sd3_9_grp_pad_mux), |
3785 | .pad_mux_list = sd3_grp_pad_mux, | 3789 | .pad_mux_list = sd3_9_grp_pad_mux, |
3786 | }; | 3790 | }; |
3787 | 3791 | ||
3788 | static struct atlas7_pad_mux sd5_grp_pad_mux[] = { | 3792 | static struct atlas7_pad_mux sd5_grp_pad_mux[] = { |
@@ -4715,10 +4719,11 @@ static struct atlas7_pmx_func atlas7_pmx_functions[] = { | |||
4715 | FUNCTION("sd2_cdb_m1", sd2_cdb_grp1, &sd2_cdb_grp1_mux), | 4719 | FUNCTION("sd2_cdb_m1", sd2_cdb_grp1, &sd2_cdb_grp1_mux), |
4716 | FUNCTION("sd2_wpb_m0", sd2_wpb_grp0, &sd2_wpb_grp0_mux), | 4720 | FUNCTION("sd2_wpb_m0", sd2_wpb_grp0, &sd2_wpb_grp0_mux), |
4717 | FUNCTION("sd2_wpb_m1", sd2_wpb_grp1, &sd2_wpb_grp1_mux), | 4721 | FUNCTION("sd2_wpb_m1", sd2_wpb_grp1, &sd2_wpb_grp1_mux), |
4718 | FUNCTION("sd3", sd3_grp, &sd3_grp_mux), | 4722 | FUNCTION("sd3", sd3_9_grp, &sd3_9_grp_mux), |
4719 | FUNCTION("sd5", sd5_grp, &sd5_grp_mux), | 4723 | FUNCTION("sd5", sd5_grp, &sd5_grp_mux), |
4720 | FUNCTION("sd6_m0", sd6_grp0, &sd6_grp0_mux), | 4724 | FUNCTION("sd6_m0", sd6_grp0, &sd6_grp0_mux), |
4721 | FUNCTION("sd6_m1", sd6_grp1, &sd6_grp1_mux), | 4725 | FUNCTION("sd6_m1", sd6_grp1, &sd6_grp1_mux), |
4726 | FUNCTION("sd9", sd3_9_grp, &sd3_9_grp_mux), | ||
4722 | FUNCTION("sp0_ext_ldo_on", | 4727 | FUNCTION("sp0_ext_ldo_on", |
4723 | sp0_ext_ldo_on_grp, | 4728 | sp0_ext_ldo_on_grp, |
4724 | &sp0_ext_ldo_on_grp_mux), | 4729 | &sp0_ext_ldo_on_grp_mux), |
@@ -5126,6 +5131,14 @@ static int atlas7_pmx_set_mux(struct pinctrl_dev *pctldev, | |||
5126 | pr_debug("PMX DUMP ### Function:[%s] Group:[%s] #### START >>>\n", | 5131 | pr_debug("PMX DUMP ### Function:[%s] Group:[%s] #### START >>>\n", |
5127 | pmx_func->name, pin_grp->name); | 5132 | pmx_func->name, pin_grp->name); |
5128 | 5133 | ||
5134 | /* the sd3 and sd9 pin select by SYS2PCI_SDIO9SEL register */ | ||
5135 | if (pin_grp->pins == (unsigned int *)&sd3_9_pins) { | ||
5136 | if (!strcmp(pmx_func->name, "sd9")) | ||
5137 | writel(1, pmx->sys2pci_base + SYS2PCI_SDIO9SEL); | ||
5138 | else | ||
5139 | writel(0, pmx->sys2pci_base + SYS2PCI_SDIO9SEL); | ||
5140 | } | ||
5141 | |||
5129 | grp_mux = pmx_func->grpmux; | 5142 | grp_mux = pmx_func->grpmux; |
5130 | 5143 | ||
5131 | for (idx = 0; idx < grp_mux->pad_mux_count; idx++) { | 5144 | for (idx = 0; idx < grp_mux->pad_mux_count; idx++) { |
@@ -5414,12 +5427,27 @@ static int atlas7_pinmux_probe(struct platform_device *pdev) | |||
5414 | struct atlas7_pmx *pmx; | 5427 | struct atlas7_pmx *pmx; |
5415 | struct device_node *np = pdev->dev.of_node; | 5428 | struct device_node *np = pdev->dev.of_node; |
5416 | u32 banks = ATLAS7_PINCTRL_REG_BANKS; | 5429 | u32 banks = ATLAS7_PINCTRL_REG_BANKS; |
5430 | struct device_node *sys2pci_np; | ||
5431 | struct resource res; | ||
5417 | 5432 | ||
5418 | /* Create state holders etc for this driver */ | 5433 | /* Create state holders etc for this driver */ |
5419 | pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); | 5434 | pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL); |
5420 | if (!pmx) | 5435 | if (!pmx) |
5421 | return -ENOMEM; | 5436 | return -ENOMEM; |
5422 | 5437 | ||
5438 | /* The sd3 and sd9 shared all pins, and the function select by | ||
5439 | * SYS2PCI_SDIO9SEL register | ||
5440 | */ | ||
5441 | sys2pci_np = of_find_node_by_name(NULL, "sys2pci"); | ||
5442 | if (!sys2pci_np) | ||
5443 | return -EINVAL; | ||
5444 | ret = of_address_to_resource(sys2pci_np, 0, &res); | ||
5445 | if (ret) | ||
5446 | return ret; | ||
5447 | pmx->sys2pci_base = devm_ioremap_resource(&pdev->dev, &res); | ||
5448 | if (IS_ERR(pmx->sys2pci_base)) | ||
5449 | return -ENOMEM; | ||
5450 | |||
5423 | pmx->dev = &pdev->dev; | 5451 | pmx->dev = &pdev->dev; |
5424 | 5452 | ||
5425 | pmx->pctl_data = &atlas7_ioc_data; | 5453 | pmx->pctl_data = &atlas7_ioc_data; |