aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/atm
diff options
context:
space:
mode:
authorfrançois romieu <romieu@fr.zoreil.com>2011-09-29 20:37:43 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-03 14:09:10 -0400
commit26c5c44d63824f7c397d27b10c2c43a3bab4a2f0 (patch)
tree30035842663845637d481a7008f137442a3ad411 /drivers/atm
parent7880b72e94fd3cf3283de6752175191583bce9f0 (diff)
atm/iphase : removal of PCI space dereferences.
Mostly PHY access and a few (ugly) debug statements for DMA control. Signed-off-by: Francois Romieu <romieu@fr.zoreil.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/atm')
-rw-r--r--drivers/atm/iphase.c265
-rw-r--r--drivers/atm/iphase.h395
2 files changed, 337 insertions, 323 deletions
diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c
index cb90f7a3e074..3d0c2b0fed9c 100644
--- a/drivers/atm/iphase.c
+++ b/drivers/atm/iphase.c
@@ -818,127 +818,152 @@ static void ia_hw_type(IADEV *iadev) {
818 818
819} 819}
820 820
821static void IaFrontEndIntr(IADEV *iadev) { 821static u32 ia_phy_read32(struct iadev_priv *ia, unsigned int reg)
822 volatile IA_SUNI *suni; 822{
823 volatile ia_mb25_t *mb25; 823 return readl(ia->phy + (reg >> 2));
824 volatile suni_pm7345_t *suni_pm7345; 824}
825 825
826 if(iadev->phy_type & FE_25MBIT_PHY) { 826static void ia_phy_write32(struct iadev_priv *ia, unsigned int reg, u32 val)
827 mb25 = (ia_mb25_t*)iadev->phy; 827{
828 iadev->carrier_detect = Boolean(mb25->mb25_intr_status & MB25_IS_GSB); 828 writel(val, ia->phy + (reg >> 2));
829 } else if (iadev->phy_type & FE_DS3_PHY) { 829}
830 suni_pm7345 = (suni_pm7345_t *)iadev->phy; 830
831 /* clear FRMR interrupts */ 831static void ia_frontend_intr(struct iadev_priv *iadev)
832 (void) suni_pm7345->suni_ds3_frm_intr_stat; 832{
833 iadev->carrier_detect = 833 u32 status;
834 Boolean(!(suni_pm7345->suni_ds3_frm_stat & SUNI_DS3_LOSV)); 834
835 } else if (iadev->phy_type & FE_E3_PHY ) { 835 if (iadev->phy_type & FE_25MBIT_PHY) {
836 suni_pm7345 = (suni_pm7345_t *)iadev->phy; 836 status = ia_phy_read32(iadev, MB25_INTR_STATUS);
837 (void) suni_pm7345->suni_e3_frm_maint_intr_ind; 837 iadev->carrier_detect = (status & MB25_IS_GSB) ? 1 : 0;
838 iadev->carrier_detect = 838 } else if (iadev->phy_type & FE_DS3_PHY) {
839 Boolean(!(suni_pm7345->suni_e3_frm_fram_intr_ind_stat&SUNI_E3_LOS)); 839 ia_phy_read32(iadev, SUNI_DS3_FRM_INTR_STAT);
840 } 840 status = ia_phy_read32(iadev, SUNI_DS3_FRM_STAT);
841 else { 841 iadev->carrier_detect = (status & SUNI_DS3_LOSV) ? 0 : 1;
842 suni = (IA_SUNI *)iadev->phy; 842 } else if (iadev->phy_type & FE_E3_PHY) {
843 (void) suni->suni_rsop_status; 843 ia_phy_read32(iadev, SUNI_E3_FRM_MAINT_INTR_IND);
844 iadev->carrier_detect = Boolean(!(suni->suni_rsop_status & SUNI_LOSV)); 844 status = ia_phy_read32(iadev, SUNI_E3_FRM_FRAM_INTR_IND_STAT);
845 } 845 iadev->carrier_detect = (status & SUNI_E3_LOS) ? 0 : 1;
846 if (iadev->carrier_detect) 846 } else {
847 printk("IA: SUNI carrier detected\n"); 847 status = ia_phy_read32(iadev, SUNI_RSOP_STATUS);
848 else 848 iadev->carrier_detect = (status & SUNI_LOSV) ? 0 : 1;
849 printk("IA: SUNI carrier lost signal\n"); 849 }
850 return; 850
851 printk(KERN_INFO "IA: SUNI carrier %s\n",
852 iadev->carrier_detect ? "detected" : "lost signal");
851} 853}
852 854
853static void ia_mb25_init (IADEV *iadev) 855static void ia_mb25_init(struct iadev_priv *iadev)
854{ 856{
855 volatile ia_mb25_t *mb25 = (ia_mb25_t*)iadev->phy;
856#if 0 857#if 0
857 mb25->mb25_master_ctrl = MB25_MC_DRIC | MB25_MC_DREC | MB25_MC_ENABLED; 858 mb25->mb25_master_ctrl = MB25_MC_DRIC | MB25_MC_DREC | MB25_MC_ENABLED;
858#endif 859#endif
859 mb25->mb25_master_ctrl = MB25_MC_DRIC | MB25_MC_DREC; 860 ia_phy_write32(iadev, MB25_MASTER_CTRL, MB25_MC_DRIC | MB25_MC_DREC);
860 mb25->mb25_diag_control = 0; 861 ia_phy_write32(iadev, MB25_DIAG_CONTROL, 0);
861 /* 862
862 * Initialize carrier detect state 863 iadev->carrier_detect =
863 */ 864 (ia_phy_read32(iadev, MB25_INTR_STATUS) & MB25_IS_GSB) ? 1 : 0;
864 iadev->carrier_detect = Boolean(mb25->mb25_intr_status & MB25_IS_GSB); 865}
865 return;
866}
867 866
868static void ia_suni_pm7345_init (IADEV *iadev) 867struct ia_reg {
868 u16 reg;
869 u16 val;
870};
871
872static void ia_phy_write(struct iadev_priv *iadev,
873 const struct ia_reg *regs, int len)
869{ 874{
870 volatile suni_pm7345_t *suni_pm7345 = (suni_pm7345_t *)iadev->phy; 875 while (len--) {
871 if (iadev->phy_type & FE_DS3_PHY) 876 ia_phy_write32(iadev, regs->reg, regs->val);
872 { 877 regs++;
873 iadev->carrier_detect = 878 }
874 Boolean(!(suni_pm7345->suni_ds3_frm_stat & SUNI_DS3_LOSV)); 879}
875 suni_pm7345->suni_ds3_frm_intr_enbl = 0x17; 880
876 suni_pm7345->suni_ds3_frm_cfg = 1; 881static void ia_suni_pm7345_init_ds3(struct iadev_priv *iadev)
877 suni_pm7345->suni_ds3_tran_cfg = 1; 882{
878 suni_pm7345->suni_config = 0; 883 static const struct ia_reg suni_ds3_init [] = {
879 suni_pm7345->suni_splr_cfg = 0; 884 { SUNI_DS3_FRM_INTR_ENBL, 0x17 },
880 suni_pm7345->suni_splt_cfg = 0; 885 { SUNI_DS3_FRM_CFG, 0x01 },
881 } 886 { SUNI_DS3_TRAN_CFG, 0x01 },
882 else 887 { SUNI_CONFIG, 0 },
883 { 888 { SUNI_SPLR_CFG, 0 },
884 iadev->carrier_detect = 889 { SUNI_SPLT_CFG, 0 }
885 Boolean(!(suni_pm7345->suni_e3_frm_fram_intr_ind_stat & SUNI_E3_LOS)); 890 };
886 suni_pm7345->suni_e3_frm_fram_options = 0x4; 891 u32 status;
887 suni_pm7345->suni_e3_frm_maint_options = 0x20; 892
888 suni_pm7345->suni_e3_frm_fram_intr_enbl = 0x1d; 893 status = ia_phy_read32(iadev, SUNI_DS3_FRM_STAT);
889 suni_pm7345->suni_e3_frm_maint_intr_enbl = 0x30; 894 iadev->carrier_detect = (status & SUNI_DS3_LOSV) ? 0 : 1;
890 suni_pm7345->suni_e3_tran_stat_diag_options = 0x0; 895
891 suni_pm7345->suni_e3_tran_fram_options = 0x1; 896 ia_phy_write(iadev, suni_ds3_init, ARRAY_SIZE(suni_ds3_init));
892 suni_pm7345->suni_config = SUNI_PM7345_E3ENBL; 897}
893 suni_pm7345->suni_splr_cfg = 0x41; 898
894 suni_pm7345->suni_splt_cfg = 0x41; 899static void ia_suni_pm7345_init_e3(struct iadev_priv *iadev)
895 } 900{
896 /* 901 static const struct ia_reg suni_e3_init [] = {
897 * Enable RSOP loss of signal interrupt. 902 { SUNI_E3_FRM_FRAM_OPTIONS, 0x04 },
898 */ 903 { SUNI_E3_FRM_MAINT_OPTIONS, 0x20 },
899 suni_pm7345->suni_intr_enbl = 0x28; 904 { SUNI_E3_FRM_FRAM_INTR_ENBL, 0x1d },
900 905 { SUNI_E3_FRM_MAINT_INTR_ENBL, 0x30 },
901 /* 906 { SUNI_E3_TRAN_STAT_DIAG_OPTIONS, 0 },
902 * Clear error counters 907 { SUNI_E3_TRAN_FRAM_OPTIONS, 0x01 },
903 */ 908 { SUNI_CONFIG, SUNI_PM7345_E3ENBL },
904 suni_pm7345->suni_id_reset = 0; 909 { SUNI_SPLR_CFG, 0x41 },
905 910 { SUNI_SPLT_CFG, 0x41 }
906 /* 911 };
907 * Clear "PMCTST" in master test register. 912 u32 status;
908 */ 913
909 suni_pm7345->suni_master_test = 0; 914 status = ia_phy_read32(iadev, SUNI_E3_FRM_FRAM_INTR_IND_STAT);
910 915 iadev->carrier_detect = (status & SUNI_E3_LOS) ? 0 : 1;
911 suni_pm7345->suni_rxcp_ctrl = 0x2c; 916 ia_phy_write(iadev, suni_e3_init, ARRAY_SIZE(suni_e3_init));
912 suni_pm7345->suni_rxcp_fctrl = 0x81; 917}
913 918
914 suni_pm7345->suni_rxcp_idle_pat_h1 = 919static void ia_suni_pm7345_init(struct iadev_priv *iadev)
915 suni_pm7345->suni_rxcp_idle_pat_h2 = 920{
916 suni_pm7345->suni_rxcp_idle_pat_h3 = 0; 921 static const struct ia_reg suni_init [] = {
917 suni_pm7345->suni_rxcp_idle_pat_h4 = 1; 922 /* Enable RSOP loss of signal interrupt. */
918 923 { SUNI_INTR_ENBL, 0x28 },
919 suni_pm7345->suni_rxcp_idle_mask_h1 = 0xff; 924 /* Clear error counters. */
920 suni_pm7345->suni_rxcp_idle_mask_h2 = 0xff; 925 { SUNI_ID_RESET, 0 },
921 suni_pm7345->suni_rxcp_idle_mask_h3 = 0xff; 926 /* Clear "PMCTST" in master test register. */
922 suni_pm7345->suni_rxcp_idle_mask_h4 = 0xfe; 927 { SUNI_MASTER_TEST, 0 },
923 928
924 suni_pm7345->suni_rxcp_cell_pat_h1 = 929 { SUNI_RXCP_CTRL, 0x2c },
925 suni_pm7345->suni_rxcp_cell_pat_h2 = 930 { SUNI_RXCP_FCTRL, 0x81 },
926 suni_pm7345->suni_rxcp_cell_pat_h3 = 0; 931
927 suni_pm7345->suni_rxcp_cell_pat_h4 = 1; 932 { SUNI_RXCP_IDLE_PAT_H1, 0 },
928 933 { SUNI_RXCP_IDLE_PAT_H2, 0 },
929 suni_pm7345->suni_rxcp_cell_mask_h1 = 934 { SUNI_RXCP_IDLE_PAT_H3, 0 },
930 suni_pm7345->suni_rxcp_cell_mask_h2 = 935 { SUNI_RXCP_IDLE_PAT_H4, 0x01 },
931 suni_pm7345->suni_rxcp_cell_mask_h3 = 936
932 suni_pm7345->suni_rxcp_cell_mask_h4 = 0xff; 937 { SUNI_RXCP_IDLE_MASK_H1, 0xff },
933 938 { SUNI_RXCP_IDLE_MASK_H2, 0xff },
934 suni_pm7345->suni_txcp_ctrl = 0xa4; 939 { SUNI_RXCP_IDLE_MASK_H3, 0xff },
935 suni_pm7345->suni_txcp_intr_en_sts = 0x10; 940 { SUNI_RXCP_IDLE_MASK_H4, 0xfe },
936 suni_pm7345->suni_txcp_idle_pat_h5 = 0x55; 941
937 942 { SUNI_RXCP_CELL_PAT_H1, 0 },
938 suni_pm7345->suni_config &= ~(SUNI_PM7345_LLB | 943 { SUNI_RXCP_CELL_PAT_H2, 0 },
939 SUNI_PM7345_CLB | 944 { SUNI_RXCP_CELL_PAT_H3, 0 },
940 SUNI_PM7345_DLB | 945 { SUNI_RXCP_CELL_PAT_H4, 0x01 },
941 SUNI_PM7345_PLB); 946
947 { SUNI_RXCP_CELL_MASK_H1, 0xff },
948 { SUNI_RXCP_CELL_MASK_H2, 0xff },
949 { SUNI_RXCP_CELL_MASK_H3, 0xff },
950 { SUNI_RXCP_CELL_MASK_H4, 0xff },
951
952 { SUNI_TXCP_CTRL, 0xa4 },
953 { SUNI_TXCP_INTR_EN_STS, 0x10 },
954 { SUNI_TXCP_IDLE_PAT_H5, 0x55 }
955 };
956
957 if (iadev->phy_type & FE_DS3_PHY)
958 ia_suni_pm7345_init_ds3(iadev);
959 else
960 ia_suni_pm7345_init_e3(iadev);
961
962 ia_phy_write(iadev, suni_init, ARRAY_SIZE(suni_init));
963
964 ia_phy_write32(iadev, SUNI_CONFIG, ia_phy_read32(iadev, SUNI_CONFIG) &
965 ~(SUNI_PM7345_LLB | SUNI_PM7345_CLB |
966 SUNI_PM7345_DLB | SUNI_PM7345_PLB));
942#ifdef __SNMP__ 967#ifdef __SNMP__
943 suni_pm7345->suni_rxcp_intr_en_sts |= SUNI_OOCDE; 968 suni_pm7345->suni_rxcp_intr_en_sts |= SUNI_OOCDE;
944#endif /* __SNMP__ */ 969#endif /* __SNMP__ */
@@ -1425,10 +1450,10 @@ static int rx_init(struct atm_dev *dev)
1425 iadev->dma + IPHASE5575_RX_LIST_ADDR); 1450 iadev->dma + IPHASE5575_RX_LIST_ADDR);
1426 IF_INIT(printk("Tx Dle list addr: 0x%p value: 0x%0x\n", 1451 IF_INIT(printk("Tx Dle list addr: 0x%p value: 0x%0x\n",
1427 iadev->dma+IPHASE5575_TX_LIST_ADDR, 1452 iadev->dma+IPHASE5575_TX_LIST_ADDR,
1428 *(u32*)(iadev->dma+IPHASE5575_TX_LIST_ADDR)); 1453 readl(iadev->dma + IPHASE5575_TX_LIST_ADDR));
1429 printk("Rx Dle list addr: 0x%p value: 0x%0x\n", 1454 printk("Rx Dle list addr: 0x%p value: 0x%0x\n",
1430 iadev->dma+IPHASE5575_RX_LIST_ADDR, 1455 iadev->dma+IPHASE5575_RX_LIST_ADDR,
1431 *(u32*)(iadev->dma+IPHASE5575_RX_LIST_ADDR));) 1456 readl(iadev->dma + IPHASE5575_RX_LIST_ADDR));)
1432 1457
1433 writew(0xffff, iadev->reass_reg+REASS_MASK_REG); 1458 writew(0xffff, iadev->reass_reg+REASS_MASK_REG);
1434 writew(0, iadev->reass_reg+MODE_REG); 1459 writew(0, iadev->reass_reg+MODE_REG);
@@ -2208,7 +2233,7 @@ static irqreturn_t ia_int(int irq, void *dev_id)
2208 if (status & STAT_DLERINT) 2233 if (status & STAT_DLERINT)
2209 { 2234 {
2210 /* Clear this bit by writing a 1 to it. */ 2235 /* Clear this bit by writing a 1 to it. */
2211 *(u_int *)(iadev->reg+IPHASE5575_BUS_STATUS_REG) = STAT_DLERINT; 2236 writel(STAT_DLERINT, iadev->reg + IPHASE5575_BUS_STATUS_REG);
2212 rx_dle_intr(dev); 2237 rx_dle_intr(dev);
2213 } 2238 }
2214 if (status & STAT_SEGINT) 2239 if (status & STAT_SEGINT)
@@ -2219,13 +2244,13 @@ static irqreturn_t ia_int(int irq, void *dev_id)
2219 } 2244 }
2220 if (status & STAT_DLETINT) 2245 if (status & STAT_DLETINT)
2221 { 2246 {
2222 *(u_int *)(iadev->reg+IPHASE5575_BUS_STATUS_REG) = STAT_DLETINT; 2247 writel(STAT_DLETINT, iadev->reg + IPHASE5575_BUS_STATUS_REG);
2223 tx_dle_intr(dev); 2248 tx_dle_intr(dev);
2224 } 2249 }
2225 if (status & (STAT_FEINT | STAT_ERRINT | STAT_MARKINT)) 2250 if (status & (STAT_FEINT | STAT_ERRINT | STAT_MARKINT))
2226 { 2251 {
2227 if (status & STAT_FEINT) 2252 if (status & STAT_FEINT)
2228 IaFrontEndIntr(iadev); 2253 ia_frontend_intr(iadev);
2229 } 2254 }
2230 } 2255 }
2231 return IRQ_RETVAL(handled); 2256 return IRQ_RETVAL(handled);
@@ -2556,7 +2581,7 @@ static int __devinit ia_start(struct atm_dev *dev)
2556 goto err_free_rx; 2581 goto err_free_rx;
2557 } 2582 }
2558 /* Get iadev->carrier_detect status */ 2583 /* Get iadev->carrier_detect status */
2559 IaFrontEndIntr(iadev); 2584 ia_frontend_intr(iadev);
2560 } 2585 }
2561 return 0; 2586 return 0;
2562 2587
@@ -2827,7 +2852,7 @@ static int ia_ioctl(struct atm_dev *dev, unsigned int cmd, void __user *arg)
2827 2852
2828 case 0xb: 2853 case 0xb:
2829 if (!capable(CAP_NET_ADMIN)) return -EPERM; 2854 if (!capable(CAP_NET_ADMIN)) return -EPERM;
2830 IaFrontEndIntr(iadev); 2855 ia_frontend_intr(iadev);
2831 break; 2856 break;
2832 case 0xa: 2857 case 0xa:
2833 if (!capable(CAP_NET_ADMIN)) return -EPERM; 2858 if (!capable(CAP_NET_ADMIN)) return -EPERM;
diff --git a/drivers/atm/iphase.h b/drivers/atm/iphase.h
index 077735e0e04b..6a0955e6d4fc 100644
--- a/drivers/atm/iphase.h
+++ b/drivers/atm/iphase.h
@@ -889,79 +889,71 @@ typedef struct ia_rtn_q {
889} IARTN_Q; 889} IARTN_Q;
890 890
891#define SUNI_LOSV 0x04 891#define SUNI_LOSV 0x04
892typedef struct { 892enum ia_suni {
893 u32 suni_master_reset; /* SUNI Master Reset and Identity */ 893 SUNI_MASTER_RESET = 0x000, /* SUNI Master Reset and Identity */
894 u32 suni_master_config; /* SUNI Master Configuration */ 894 SUNI_MASTER_CONFIG = 0x004, /* SUNI Master Configuration */
895 u32 suni_master_intr_stat; /* SUNI Master Interrupt Status */ 895 SUNI_MASTER_INTR_STAT = 0x008, /* SUNI Master Interrupt Status */
896 u32 suni_reserved1; /* Reserved */ 896 SUNI_RESERVED1 = 0x00c, /* Reserved */
897 u32 suni_master_clk_monitor;/* SUNI Master Clock Monitor */ 897 SUNI_MASTER_CLK_MONITOR = 0x010, /* SUNI Master Clock Monitor */
898 u32 suni_master_control; /* SUNI Master Clock Monitor */ 898 SUNI_MASTER_CONTROL = 0x014, /* SUNI Master Clock Monitor */
899 u32 suni_reserved2[10]; /* Reserved */ 899 /* Reserved (10) */
900 900 SUNI_RSOP_CONTROL = 0x040, /* RSOP Control/Interrupt Enable */
901 u32 suni_rsop_control; /* RSOP Control/Interrupt Enable */ 901 SUNI_RSOP_STATUS = 0x044, /* RSOP Status/Interrupt States */
902 u32 suni_rsop_status; /* RSOP Status/Interrupt States */ 902 SUNI_RSOP_SECTION_BIP8L = 0x048, /* RSOP Section BIP-8 LSB */
903 u32 suni_rsop_section_bip8l;/* RSOP Section BIP-8 LSB */ 903 SUNI_RSOP_SECTION_BIP8M = 0x04c, /* RSOP Section BIP-8 MSB */
904 u32 suni_rsop_section_bip8m;/* RSOP Section BIP-8 MSB */ 904
905 905 SUNI_TSOP_CONTROL = 0x050, /* TSOP Control */
906 u32 suni_tsop_control; /* TSOP Control */ 906 SUNI_TSOP_DIAG = 0x054, /* TSOP Disgnostics */
907 u32 suni_tsop_diag; /* TSOP Disgnostics */ 907 /* Reserved (2) */
908 u32 suni_tsop_reserved[2]; /* TSOP Reserved */ 908 SUNI_RLOP_CS = 0x060, /* RLOP Control/Status */
909 909 SUNI_RLOP_INTR = 0x064, /* RLOP Interrupt Enable/Status */
910 u32 suni_rlop_cs; /* RLOP Control/Status */ 910 SUNI_RLOP_LINE_BIP24L = 0x068, /* RLOP Line BIP-24 LSB */
911 u32 suni_rlop_intr; /* RLOP Interrupt Enable/Status */ 911 SUNI_RLOP_LINE_BIP24 = 0x06c, /* RLOP Line BIP-24 */
912 u32 suni_rlop_line_bip24l; /* RLOP Line BIP-24 LSB */ 912 SUNI_RLOP_LINE_BIP24M = 0x070, /* RLOP Line BIP-24 MSB */
913 u32 suni_rlop_line_bip24; /* RLOP Line BIP-24 */ 913 SUNI_RLOP_LINE_FEBEL = 0x074, /* RLOP Line FEBE LSB */
914 u32 suni_rlop_line_bip24m; /* RLOP Line BIP-24 MSB */ 914 SUNI_RLOP_LINE_FEBE = 0x078, /* RLOP Line FEBE */
915 u32 suni_rlop_line_febel; /* RLOP Line FEBE LSB */ 915 SUNI_RLOP_LINE_FEBEM = 0x07c, /* RLOP Line FEBE MSB */
916 u32 suni_rlop_line_febe; /* RLOP Line FEBE */ 916
917 u32 suni_rlop_line_febem; /* RLOP Line FEBE MSB */ 917 SUNI_TLOP_CONTROL = 0x080, /* TLOP Control */
918 918 SUNI_TLOP_DISG = 0x084, /* TLOP Disgnostics */
919 u32 suni_tlop_control; /* TLOP Control */ 919 /* Reserved (14) */
920 u32 suni_tlop_disg; /* TLOP Disgnostics */ 920 SUNI_RPOP_CS = 0x0c0, /* RPOP Status/Control */
921 u32 suni_tlop_reserved[14]; /* TLOP Reserved */ 921 SUNI_RPOP_INTR = 0x0c4, /* RPOP Interrupt/Status */
922 922 SUNI_RPOP_RESERVED = 0x0c8, /* RPOP Reserved */
923 u32 suni_rpop_cs; /* RPOP Status/Control */ 923 SUNI_RPOP_INTR_ENA = 0x0cc, /* RPOP Interrupt Enable */
924 u32 suni_rpop_intr; /* RPOP Interrupt/Status */ 924 /* Reserved (3) */
925 u32 suni_rpop_reserved; /* RPOP Reserved */ 925 SUNI_RPOP_PATH_SIG = 0x0dc, /* RPOP Path Signal Label */
926 u32 suni_rpop_intr_ena; /* RPOP Interrupt Enable */ 926 SUNI_RPOP_BIP8L = 0x0e0, /* RPOP Path BIP-8 LSB */
927 u32 suni_rpop_reserved1[3]; /* RPOP Reserved */ 927 SUNI_RPOP_BIP8M = 0x0e4, /* RPOP Path BIP-8 MSB */
928 u32 suni_rpop_path_sig; /* RPOP Path Signal Label */ 928 SUNI_RPOP_FEBEL = 0x0e8, /* RPOP Path FEBE LSB */
929 u32 suni_rpop_bip8l; /* RPOP Path BIP-8 LSB */ 929 SUNI_RPOP_FEBEM = 0x0ec, /* RPOP Path FEBE MSB */
930 u32 suni_rpop_bip8m; /* RPOP Path BIP-8 MSB */ 930 /* Reserved (4) */
931 u32 suni_rpop_febel; /* RPOP Path FEBE LSB */ 931 SUNI_TPOP_CNTRL_DAIG = 0x100, /* TPOP Control/Disgnostics */
932 u32 suni_rpop_febem; /* RPOP Path FEBE MSB */ 932 SUNI_TPOP_POINTER_CTRL = 0x104, /* TPOP Pointer Control */
933 u32 suni_rpop_reserved2[4]; /* RPOP Reserved */ 933 SUNI_TPOP_SOURCER_CTRL = 0x108, /* TPOP Source Control */
934 934 /* Reserved (2) */
935 u32 suni_tpop_cntrl_daig; /* TPOP Control/Disgnostics */ 935 SUNI_TPOP_ARB_PRTL = 0x114, /* TPOP Arbitrary Pointer LSB */
936 u32 suni_tpop_pointer_ctrl; /* TPOP Pointer Control */ 936 SUNI_TPOP_ARB_PRTM = 0x118, /* TPOP Arbitrary Pointer MSB */
937 u32 suni_tpop_sourcer_ctrl; /* TPOP Source Control */ 937 SUNI_TPOP_RESERVED2 = 0x11c, /* TPOP Reserved */
938 u32 suni_tpop_reserved1[2]; /* TPOP Reserved */ 938 SUNI_TPOP_PATH_SIG = 0x120, /* TPOP Path Signal Lable */
939 u32 suni_tpop_arb_prtl; /* TPOP Arbitrary Pointer LSB */ 939 SUNI_TPOP_PATH_STATUS = 0x124, /* TPOP Path Status */
940 u32 suni_tpop_arb_prtm; /* TPOP Arbitrary Pointer MSB */ 940 /* Reserved (6) */
941 u32 suni_tpop_reserved2; /* TPOP Reserved */ 941 SUNI_RACP_CS = 0x140, /* RACP Control/Status */
942 u32 suni_tpop_path_sig; /* TPOP Path Signal Lable */ 942 SUNI_RACP_INTR = 0x144, /* RACP Interrupt Enable/Status */
943 u32 suni_tpop_path_status; /* TPOP Path Status */ 943 SUNI_RACP_HDR_PATTERN = 0x148, /* RACP Match Header Pattern */
944 u32 suni_tpop_reserved3[6]; /* TPOP Reserved */ 944 SUNI_RACP_HDR_MASK = 0x14c, /* RACP Match Header Mask */
945 945 SUNI_RACP_CORR_HCS = 0x150, /* RACP Correctable HCS Error Count */
946 u32 suni_racp_cs; /* RACP Control/Status */ 946 SUNI_RACP_UNCORR_HCS = 0x154, /* RACP Uncorrectable HCS Err Count */
947 u32 suni_racp_intr; /* RACP Interrupt Enable/Status */ 947 /* Reserved (10) */
948 u32 suni_racp_hdr_pattern; /* RACP Match Header Pattern */ 948 SUNI_TACP_CONTROL = 0x180, /* TACP Control */
949 u32 suni_racp_hdr_mask; /* RACP Match Header Mask */ 949 SUNI_TACP_IDLE_HDR_PAT = 0x184, /* TACP Idle Cell Header Pattern */
950 u32 suni_racp_corr_hcs; /* RACP Correctable HCS Error Count */ 950 SUNI_TACP_IDLE_PAY_PAY = 0x188, /* TACP Idle Cell Payld Octet Patrn */
951 u32 suni_racp_uncorr_hcs; /* RACP Uncorrectable HCS Error Count */ 951 /* Reserved (5) */
952 u32 suni_racp_reserved[10]; /* RACP Reserved */ 952 /* Reserved (24) */
953 953 /* FIXME: unused but name conflicts.
954 u32 suni_tacp_control; /* TACP Control */ 954 * SUNI_MASTER_TEST = 0x200, SUNI Master Test */
955 u32 suni_tacp_idle_hdr_pat; /* TACP Idle Cell Header Pattern */ 955 SUNI_RESERVED_TEST = 0x204 /* SUNI Reserved for Test */
956 u32 suni_tacp_idle_pay_pay; /* TACP Idle Cell Payld Octet Pattern */ 956};
957 u32 suni_tacp_reserved[5]; /* TACP Reserved */
958
959 u32 suni_reserved3[24]; /* Reserved */
960
961 u32 suni_master_test; /* SUNI Master Test */
962 u32 suni_reserved_test; /* SUNI Reserved for Test */
963} IA_SUNI;
964
965 957
966typedef struct _SUNI_STATS_ 958typedef struct _SUNI_STATS_
967{ 959{
@@ -993,13 +985,11 @@ typedef struct _SUNI_STATS_
993 u32 racp_uchcs_count; // uncorrectable HCS error count 985 u32 racp_uchcs_count; // uncorrectable HCS error count
994} IA_SUNI_STATS; 986} IA_SUNI_STATS;
995 987
996typedef struct iadev_t { 988typedef struct iadev_priv {
997 /*-----base pointers into (i)chipSAR+ address space */ 989 /*-----base pointers into (i)chipSAR+ address space */
998 u32 __iomem *phy; /* base pointer into phy(SUNI) */ 990 u32 __iomem *phy; /* Base pointer into phy (SUNI). */
999 u32 __iomem *dma; /* base pointer into DMA control 991 u32 __iomem *dma; /* Base pointer into DMA control registers. */
1000 registers */ 992 u32 __iomem *reg; /* Base pointer to SAR registers. */
1001 u32 __iomem *reg; /* base pointer to SAR registers
1002 - Bus Interface Control Regs */
1003 u32 __iomem *seg_reg; /* base pointer to segmentation engine 993 u32 __iomem *seg_reg; /* base pointer to segmentation engine
1004 internal registers */ 994 internal registers */
1005 u32 __iomem *reass_reg; /* base pointer to reassemble engine 995 u32 __iomem *reass_reg; /* base pointer to reassemble engine
@@ -1071,14 +1061,14 @@ typedef struct iadev_t {
1071#define INPH_IA_VCC(v) ((struct ia_vcc *) (v)->dev_data) 1061#define INPH_IA_VCC(v) ((struct ia_vcc *) (v)->dev_data)
1072 1062
1073/******************* IDT77105 25MB/s PHY DEFINE *****************************/ 1063/******************* IDT77105 25MB/s PHY DEFINE *****************************/
1074typedef struct { 1064enum ia_mb25 {
1075 u_int mb25_master_ctrl; /* Master control */ 1065 MB25_MASTER_CTRL = 0x00, /* Master control */
1076 u_int mb25_intr_status; /* Interrupt status */ 1066 MB25_INTR_STATUS = 0x04, /* Interrupt status */
1077 u_int mb25_diag_control; /* Diagnostic control */ 1067 MB25_DIAG_CONTROL = 0x08, /* Diagnostic control */
1078 u_int mb25_led_hec; /* LED driver and HEC status/control */ 1068 MB25_LED_HEC = 0x0c, /* LED driver and HEC status/control */
1079 u_int mb25_low_byte_counter; /* Low byte counter */ 1069 MB25_LOW_BYTE_COUNTER = 0x10,
1080 u_int mb25_high_byte_counter; /* High byte counter */ 1070 MB25_HIGH_BYTE_COUNTER = 0x14
1081} ia_mb25_t; 1071};
1082 1072
1083/* 1073/*
1084 * Master Control 1074 * Master Control
@@ -1127,122 +1117,121 @@ typedef struct {
1127#define FE_E3_PHY 0x0090 /* E3 */ 1117#define FE_E3_PHY 0x0090 /* E3 */
1128 1118
1129/*********************** SUNI_PM7345 PHY DEFINE HERE *********************/ 1119/*********************** SUNI_PM7345 PHY DEFINE HERE *********************/
1130typedef struct _suni_pm7345_t 1120enum suni_pm7345 {
1131{ 1121 SUNI_CONFIG = 0x000, /* SUNI Configuration */
1132 u_int suni_config; /* SUNI Configuration */ 1122 SUNI_INTR_ENBL = 0x004, /* SUNI Interrupt Enable */
1133 u_int suni_intr_enbl; /* SUNI Interrupt Enable */ 1123 SUNI_INTR_STAT = 0x008, /* SUNI Interrupt Status */
1134 u_int suni_intr_stat; /* SUNI Interrupt Status */ 1124 SUNI_CONTROL = 0x00c, /* SUNI Control */
1135 u_int suni_control; /* SUNI Control */ 1125 SUNI_ID_RESET = 0x010, /* SUNI Reset and Identity */
1136 u_int suni_id_reset; /* SUNI Reset and Identity */ 1126 SUNI_DATA_LINK_CTRL = 0x014,
1137 u_int suni_data_link_ctrl; 1127 SUNI_RBOC_CONF_INTR_ENBL = 0x018,
1138 u_int suni_rboc_conf_intr_enbl; 1128 SUNI_RBOC_STAT = 0x01c,
1139 u_int suni_rboc_stat; 1129 SUNI_DS3_FRM_CFG = 0x020,
1140 u_int suni_ds3_frm_cfg; 1130 SUNI_DS3_FRM_INTR_ENBL = 0x024,
1141 u_int suni_ds3_frm_intr_enbl; 1131 SUNI_DS3_FRM_INTR_STAT = 0x028,
1142 u_int suni_ds3_frm_intr_stat; 1132 SUNI_DS3_FRM_STAT = 0x02c,
1143 u_int suni_ds3_frm_stat; 1133 SUNI_RFDL_CFG = 0x030,
1144 u_int suni_rfdl_cfg; 1134 SUNI_RFDL_ENBL_STAT = 0x034,
1145 u_int suni_rfdl_enbl_stat; 1135 SUNI_RFDL_STAT = 0x038,
1146 u_int suni_rfdl_stat; 1136 SUNI_RFDL_DATA = 0x03c,
1147 u_int suni_rfdl_data; 1137 SUNI_PMON_CHNG = 0x040,
1148 u_int suni_pmon_chng; 1138 SUNI_PMON_INTR_ENBL_STAT = 0x044,
1149 u_int suni_pmon_intr_enbl_stat; 1139 /* SUNI_RESERVED1 (0x13 - 0x11) */
1150 u_int suni_reserved1[0x13-0x11]; 1140 SUNI_PMON_LCV_EVT_CNT_LSB = 0x050,
1151 u_int suni_pmon_lcv_evt_cnt_lsb; 1141 SUNI_PMON_LCV_EVT_CNT_MSB = 0x054,
1152 u_int suni_pmon_lcv_evt_cnt_msb; 1142 SUNI_PMON_FBE_EVT_CNT_LSB = 0x058,
1153 u_int suni_pmon_fbe_evt_cnt_lsb; 1143 SUNI_PMON_FBE_EVT_CNT_MSB = 0x05c,
1154 u_int suni_pmon_fbe_evt_cnt_msb; 1144 SUNI_PMON_SEZ_DET_CNT_LSB = 0x060,
1155 u_int suni_pmon_sez_det_cnt_lsb; 1145 SUNI_PMON_SEZ_DET_CNT_MSB = 0x064,
1156 u_int suni_pmon_sez_det_cnt_msb; 1146 SUNI_PMON_PE_EVT_CNT_LSB = 0x068,
1157 u_int suni_pmon_pe_evt_cnt_lsb; 1147 SUNI_PMON_PE_EVT_CNT_MSB = 0x06c,
1158 u_int suni_pmon_pe_evt_cnt_msb; 1148 SUNI_PMON_PPE_EVT_CNT_LSB = 0x070,
1159 u_int suni_pmon_ppe_evt_cnt_lsb; 1149 SUNI_PMON_PPE_EVT_CNT_MSB = 0x074,
1160 u_int suni_pmon_ppe_evt_cnt_msb; 1150 SUNI_PMON_FEBE_EVT_CNT_LSB = 0x078,
1161 u_int suni_pmon_febe_evt_cnt_lsb; 1151 SUNI_PMON_FEBE_EVT_CNT_MSB = 0x07c,
1162 u_int suni_pmon_febe_evt_cnt_msb; 1152 SUNI_DS3_TRAN_CFG = 0x080,
1163 u_int suni_ds3_tran_cfg; 1153 SUNI_DS3_TRAN_DIAG = 0x084,
1164 u_int suni_ds3_tran_diag; 1154 /* SUNI_RESERVED2 (0x23 - 0x21) */
1165 u_int suni_reserved2[0x23-0x21]; 1155 SUNI_XFDL_CFG = 0x090,
1166 u_int suni_xfdl_cfg; 1156 SUNI_XFDL_INTR_ST = 0x094,
1167 u_int suni_xfdl_intr_st; 1157 SUNI_XFDL_XMIT_DATA = 0x098,
1168 u_int suni_xfdl_xmit_data; 1158 SUNI_XBOC_CODE = 0x09c,
1169 u_int suni_xboc_code; 1159 SUNI_SPLR_CFG = 0x0a0,
1170 u_int suni_splr_cfg; 1160 SUNI_SPLR_INTR_EN = 0x0a4,
1171 u_int suni_splr_intr_en; 1161 SUNI_SPLR_INTR_ST = 0x0a8,
1172 u_int suni_splr_intr_st; 1162 SUNI_SPLR_STATUS = 0x0ac,
1173 u_int suni_splr_status; 1163 SUNI_SPLT_CFG = 0x0b0,
1174 u_int suni_splt_cfg; 1164 SUNI_SPLT_CNTL = 0x0b4,
1175 u_int suni_splt_cntl; 1165 SUNI_SPLT_DIAG_G1 = 0x0b8,
1176 u_int suni_splt_diag_g1; 1166 SUNI_SPLT_F1 = 0x0bc,
1177 u_int suni_splt_f1; 1167 SUNI_CPPM_LOC_METERS = 0x0c0,
1178 u_int suni_cppm_loc_meters; 1168 SUNI_CPPM_CHG_OF_CPPM_PERF_METR = 0x0c4,
1179 u_int suni_cppm_chng_of_cppm_perf_meter; 1169 SUNI_CPPM_B1_ERR_CNT_LSB = 0x0c8,
1180 u_int suni_cppm_b1_err_cnt_lsb; 1170 SUNI_CPPM_B1_ERR_CNT_MSB = 0x0cc,
1181 u_int suni_cppm_b1_err_cnt_msb; 1171 SUNI_CPPM_FRAMING_ERR_CNT_LSB = 0x0d0,
1182 u_int suni_cppm_framing_err_cnt_lsb; 1172 SUNI_CPPM_FRAMING_ERR_CNT_MSB = 0x0d4,
1183 u_int suni_cppm_framing_err_cnt_msb; 1173 SUNI_CPPM_FEBE_CNT_LSB = 0x0d8,
1184 u_int suni_cppm_febe_cnt_lsb; 1174 SUNI_CPPM_FEBE_CNT_MSB = 0x0dc,
1185 u_int suni_cppm_febe_cnt_msb; 1175 SUNI_CPPM_HCS_ERR_CNT_LSB = 0x0e0,
1186 u_int suni_cppm_hcs_err_cnt_lsb; 1176 SUNI_CPPM_HCS_ERR_CNT_MSB = 0x0e4,
1187 u_int suni_cppm_hcs_err_cnt_msb; 1177 SUNI_CPPM_IDLE_UN_CELL_CNT_LSB = 0x0e8,
1188 u_int suni_cppm_idle_un_cell_cnt_lsb; 1178 SUNI_CPPM_IDLE_UN_CELL_CNT_MSB = 0x0ec,
1189 u_int suni_cppm_idle_un_cell_cnt_msb; 1179 SUNI_CPPM_RCV_CELL_CNT_LSB = 0x0f0,
1190 u_int suni_cppm_rcv_cell_cnt_lsb; 1180 SUNI_CPPM_RCV_CELL_CNT_MSB = 0x0f4,
1191 u_int suni_cppm_rcv_cell_cnt_msb; 1181 SUNI_CPPM_XMIT_CELL_CNT_LSB = 0x0f8,
1192 u_int suni_cppm_xmit_cell_cnt_lsb; 1182 SUNI_CPPM_XMIT_CELL_CNT_MSB = 0x0fc,
1193 u_int suni_cppm_xmit_cell_cnt_msb; 1183 SUNI_RXCP_CTRL = 0x100,
1194 u_int suni_rxcp_ctrl; 1184 SUNI_RXCP_FCTRL = 0x104,
1195 u_int suni_rxcp_fctrl; 1185 SUNI_RXCP_INTR_EN_STS = 0x108,
1196 u_int suni_rxcp_intr_en_sts; 1186 SUNI_RXCP_IDLE_PAT_H1 = 0x10c,
1197 u_int suni_rxcp_idle_pat_h1; 1187 SUNI_RXCP_IDLE_PAT_H2 = 0x110,
1198 u_int suni_rxcp_idle_pat_h2; 1188 SUNI_RXCP_IDLE_PAT_H3 = 0x114,
1199 u_int suni_rxcp_idle_pat_h3; 1189 SUNI_RXCP_IDLE_PAT_H4 = 0x118,
1200 u_int suni_rxcp_idle_pat_h4; 1190 SUNI_RXCP_IDLE_MASK_H1 = 0x11c,
1201 u_int suni_rxcp_idle_mask_h1; 1191 SUNI_RXCP_IDLE_MASK_H2 = 0x120,
1202 u_int suni_rxcp_idle_mask_h2; 1192 SUNI_RXCP_IDLE_MASK_H3 = 0x124,
1203 u_int suni_rxcp_idle_mask_h3; 1193 SUNI_RXCP_IDLE_MASK_H4 = 0x128,
1204 u_int suni_rxcp_idle_mask_h4; 1194 SUNI_RXCP_CELL_PAT_H1 = 0x12c,
1205 u_int suni_rxcp_cell_pat_h1; 1195 SUNI_RXCP_CELL_PAT_H2 = 0x130,
1206 u_int suni_rxcp_cell_pat_h2; 1196 SUNI_RXCP_CELL_PAT_H3 = 0x134,
1207 u_int suni_rxcp_cell_pat_h3; 1197 SUNI_RXCP_CELL_PAT_H4 = 0x138,
1208 u_int suni_rxcp_cell_pat_h4; 1198 SUNI_RXCP_CELL_MASK_H1 = 0x13c,
1209 u_int suni_rxcp_cell_mask_h1; 1199 SUNI_RXCP_CELL_MASK_H2 = 0x140,
1210 u_int suni_rxcp_cell_mask_h2; 1200 SUNI_RXCP_CELL_MASK_H3 = 0x144,
1211 u_int suni_rxcp_cell_mask_h3; 1201 SUNI_RXCP_CELL_MASK_H4 = 0x148,
1212 u_int suni_rxcp_cell_mask_h4; 1202 SUNI_RXCP_HCS_CS = 0x14c,
1213 u_int suni_rxcp_hcs_cs; 1203 SUNI_RXCP_LCD_CNT_THRESHOLD = 0x150,
1214 u_int suni_rxcp_lcd_cnt_threshold; 1204 /* SUNI_RESERVED3 (0x57 - 0x54) */
1215 u_int suni_reserved3[0x57-0x54]; 1205 SUNI_TXCP_CTRL = 0x160,
1216 u_int suni_txcp_ctrl; 1206 SUNI_TXCP_INTR_EN_STS = 0x164,
1217 u_int suni_txcp_intr_en_sts; 1207 SUNI_TXCP_IDLE_PAT_H1 = 0x168,
1218 u_int suni_txcp_idle_pat_h1; 1208 SUNI_TXCP_IDLE_PAT_H2 = 0x16c,
1219 u_int suni_txcp_idle_pat_h2; 1209 SUNI_TXCP_IDLE_PAT_H3 = 0x170,
1220 u_int suni_txcp_idle_pat_h3; 1210 SUNI_TXCP_IDLE_PAT_H4 = 0x174,
1221 u_int suni_txcp_idle_pat_h4; 1211 SUNI_TXCP_IDLE_PAT_H5 = 0x178,
1222 u_int suni_txcp_idle_pat_h5; 1212 SUNI_TXCP_IDLE_PAYLOAD = 0x17c,
1223 u_int suni_txcp_idle_payload; 1213 SUNI_E3_FRM_FRAM_OPTIONS = 0x180,
1224 u_int suni_e3_frm_fram_options; 1214 SUNI_E3_FRM_MAINT_OPTIONS = 0x184,
1225 u_int suni_e3_frm_maint_options; 1215 SUNI_E3_FRM_FRAM_INTR_ENBL = 0x188,
1226 u_int suni_e3_frm_fram_intr_enbl; 1216 SUNI_E3_FRM_FRAM_INTR_IND_STAT = 0x18c,
1227 u_int suni_e3_frm_fram_intr_ind_stat; 1217 SUNI_E3_FRM_MAINT_INTR_ENBL = 0x190,
1228 u_int suni_e3_frm_maint_intr_enbl; 1218 SUNI_E3_FRM_MAINT_INTR_IND = 0x194,
1229 u_int suni_e3_frm_maint_intr_ind; 1219 SUNI_E3_FRM_MAINT_STAT = 0x198,
1230 u_int suni_e3_frm_maint_stat; 1220 SUNI_RESERVED4 = 0x19c,
1231 u_int suni_reserved4; 1221 SUNI_E3_TRAN_FRAM_OPTIONS = 0x1a0,
1232 u_int suni_e3_tran_fram_options; 1222 SUNI_E3_TRAN_STAT_DIAG_OPTIONS = 0x1a4,
1233 u_int suni_e3_tran_stat_diag_options; 1223 SUNI_E3_TRAN_BIP_8_ERR_MASK = 0x1a8,
1234 u_int suni_e3_tran_bip_8_err_mask; 1224 SUNI_E3_TRAN_MAINT_ADAPT_OPTS = 0x1ac,
1235 u_int suni_e3_tran_maint_adapt_options; 1225 SUNI_TTB_CTRL = 0x1b0,
1236 u_int suni_ttb_ctrl; 1226 SUNI_TTB_TRAIL_TRACE_ID_STAT = 0x1b4,
1237 u_int suni_ttb_trail_trace_id_stat; 1227 SUNI_TTB_IND_ADDR = 0x1b8,
1238 u_int suni_ttb_ind_addr; 1228 SUNI_TTB_IND_DATA = 0x1bc,
1239 u_int suni_ttb_ind_data; 1229 SUNI_TTB_EXP_PAYLOAD_TYPE = 0x1c0,
1240 u_int suni_ttb_exp_payload_type; 1230 SUNI_TTB_PAYLOAD_TYPE_CTRL_STAT = 0x1c4,
1241 u_int suni_ttb_payload_type_ctrl_stat; 1231 /* SUNI_PAD5 (0x7f - 0x71) */
1242 u_int suni_pad5[0x7f-0x71]; 1232 SUNI_MASTER_TEST = 0x200,
1243 u_int suni_master_test; 1233 /* SUNI_PAD6 (0xff - 0x80) */
1244 u_int suni_pad6[0xff-0x80]; 1234};
1245}suni_pm7345_t;
1246 1235
1247#define SUNI_PM7345_T suni_pm7345_t 1236#define SUNI_PM7345_T suni_pm7345_t
1248#define SUNI_PM7345 0x20 /* Suni chip type */ 1237#define SUNI_PM7345 0x20 /* Suni chip type */